Skip to content

Commit 376c25f

Browse files
robclarksuperna9999
authored andcommitted
drm/amdgpu: Switch to fdinfo helper
v2: Rebase on drm-misc-next Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Christian König <[email protected]> Acked-by: Dave Airlie <[email protected]> Signed-off-by: Neil Armstrong <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 51d86ee commit 376c25f

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2747,7 +2747,7 @@ static const struct file_operations amdgpu_driver_kms_fops = {
27472747
.compat_ioctl = amdgpu_kms_compat_ioctl,
27482748
#endif
27492749
#ifdef CONFIG_PROC_FS
2750-
.show_fdinfo = amdgpu_show_fdinfo
2750+
.show_fdinfo = drm_show_fdinfo,
27512751
#endif
27522752
};
27532753

@@ -2802,6 +2802,7 @@ static const struct drm_driver amdgpu_kms_driver = {
28022802
.dumb_map_offset = amdgpu_mode_dumb_mmap,
28032803
.fops = &amdgpu_driver_kms_fops,
28042804
.release = &amdgpu_driver_release_kms,
2805+
.show_fdinfo = amdgpu_show_fdinfo,
28052806

28062807
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
28072808
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,

drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@ static const char *amdgpu_ip_name[AMDGPU_HW_IP_NUM] = {
5353
[AMDGPU_HW_IP_VCN_JPEG] = "jpeg",
5454
};
5555

56-
void amdgpu_show_fdinfo(struct seq_file *m, struct file *f)
56+
void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file)
5757
{
58-
struct drm_file *file = f->private_data;
5958
struct amdgpu_device *adev = drm_to_adev(file->minor->dev);
6059
struct amdgpu_fpriv *fpriv = file->driver_priv;
6160
struct amdgpu_vm *vm = &fpriv->vm;
@@ -87,31 +86,30 @@ void amdgpu_show_fdinfo(struct seq_file *m, struct file *f)
8786
* ******************************************************************
8887
*/
8988

90-
seq_printf(m, "pasid:\t%u\n", fpriv->vm.pasid);
91-
seq_printf(m, "drm-driver:\t%s\n", file->minor->dev->driver->name);
92-
seq_printf(m, "drm-pdev:\t%04x:%02x:%02x.%d\n", domain, bus, dev, fn);
93-
seq_printf(m, "drm-client-id:\t%Lu\n", vm->immediate.fence_context);
94-
seq_printf(m, "drm-memory-vram:\t%llu KiB\n", stats.vram/1024UL);
95-
seq_printf(m, "drm-memory-gtt: \t%llu KiB\n", stats.gtt/1024UL);
96-
seq_printf(m, "drm-memory-cpu: \t%llu KiB\n", stats.cpu/1024UL);
97-
seq_printf(m, "amd-memory-visible-vram:\t%llu KiB\n",
89+
drm_printf(p, "pasid:\t%u\n", fpriv->vm.pasid);
90+
drm_printf(p, "drm-driver:\t%s\n", file->minor->dev->driver->name);
91+
drm_printf(p, "drm-pdev:\t%04x:%02x:%02x.%d\n", domain, bus, dev, fn);
92+
drm_printf(p, "drm-client-id:\t%Lu\n", vm->immediate.fence_context);
93+
drm_printf(p, "drm-memory-vram:\t%llu KiB\n", stats.vram/1024UL);
94+
drm_printf(p, "drm-memory-gtt: \t%llu KiB\n", stats.gtt/1024UL);
95+
drm_printf(p, "drm-memory-cpu: \t%llu KiB\n", stats.cpu/1024UL);
96+
drm_printf(p, "amd-memory-visible-vram:\t%llu KiB\n",
9897
stats.visible_vram/1024UL);
99-
seq_printf(m, "amd-evicted-vram:\t%llu KiB\n",
98+
drm_printf(p, "amd-evicted-vram:\t%llu KiB\n",
10099
stats.evicted_vram/1024UL);
101-
seq_printf(m, "amd-evicted-visible-vram:\t%llu KiB\n",
100+
drm_printf(p, "amd-evicted-visible-vram:\t%llu KiB\n",
102101
stats.evicted_visible_vram/1024UL);
103-
seq_printf(m, "amd-requested-vram:\t%llu KiB\n",
102+
drm_printf(p, "amd-requested-vram:\t%llu KiB\n",
104103
stats.requested_vram/1024UL);
105-
seq_printf(m, "amd-requested-visible-vram:\t%llu KiB\n",
104+
drm_printf(p, "amd-requested-visible-vram:\t%llu KiB\n",
106105
stats.requested_visible_vram/1024UL);
107-
seq_printf(m, "amd-requested-gtt:\t%llu KiB\n",
106+
drm_printf(p, "amd-requested-gtt:\t%llu KiB\n",
108107
stats.requested_gtt/1024UL);
109-
110108
for (hw_ip = 0; hw_ip < AMDGPU_HW_IP_NUM; ++hw_ip) {
111109
if (!usage[hw_ip])
112110
continue;
113111

114-
seq_printf(m, "drm-engine-%s:\t%Ld ns\n", amdgpu_ip_name[hw_ip],
112+
drm_printf(p, "drm-engine-%s:\t%Ld ns\n", amdgpu_ip_name[hw_ip],
115113
ktime_to_ns(usage[hw_ip]));
116114
}
117115
}

drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@
3737
#include "amdgpu_ids.h"
3838

3939
uint32_t amdgpu_get_ip_count(struct amdgpu_device *adev, int id);
40-
void amdgpu_show_fdinfo(struct seq_file *m, struct file *f);
40+
void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file);
4141

4242
#endif

0 commit comments

Comments
 (0)