forked from mirrors/linux
		
	drm/amdgpu: Switch to fdinfo helper
v2: Rebase on drm-misc-next Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Christian König <christian.koenig@amd.com> Acked-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://patchwork.freedesktop.org/patch/msgid/20230524155956.382440-5-robdclark@gmail.com
This commit is contained in:
		
							parent
							
								
									51d86ee5e0
								
							
						
					
					
						commit
						376c25f8ca
					
				
					 3 changed files with 18 additions and 19 deletions
				
			
		| 
						 | 
					@ -2747,7 +2747,7 @@ static const struct file_operations amdgpu_driver_kms_fops = {
 | 
				
			||||||
	.compat_ioctl = amdgpu_kms_compat_ioctl,
 | 
						.compat_ioctl = amdgpu_kms_compat_ioctl,
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef CONFIG_PROC_FS
 | 
					#ifdef CONFIG_PROC_FS
 | 
				
			||||||
	.show_fdinfo = amdgpu_show_fdinfo
 | 
						.show_fdinfo = drm_show_fdinfo,
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2802,6 +2802,7 @@ static const struct drm_driver amdgpu_kms_driver = {
 | 
				
			||||||
	.dumb_map_offset = amdgpu_mode_dumb_mmap,
 | 
						.dumb_map_offset = amdgpu_mode_dumb_mmap,
 | 
				
			||||||
	.fops = &amdgpu_driver_kms_fops,
 | 
						.fops = &amdgpu_driver_kms_fops,
 | 
				
			||||||
	.release = &amdgpu_driver_release_kms,
 | 
						.release = &amdgpu_driver_release_kms,
 | 
				
			||||||
 | 
						.show_fdinfo = amdgpu_show_fdinfo,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
 | 
						.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
 | 
				
			||||||
	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
 | 
						.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -53,9 +53,8 @@ static const char *amdgpu_ip_name[AMDGPU_HW_IP_NUM] = {
 | 
				
			||||||
	[AMDGPU_HW_IP_VCN_JPEG]	=	"jpeg",
 | 
						[AMDGPU_HW_IP_VCN_JPEG]	=	"jpeg",
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void amdgpu_show_fdinfo(struct seq_file *m, struct file *f)
 | 
					void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct drm_file *file = f->private_data;
 | 
					 | 
				
			||||||
	struct amdgpu_device *adev = drm_to_adev(file->minor->dev);
 | 
						struct amdgpu_device *adev = drm_to_adev(file->minor->dev);
 | 
				
			||||||
	struct amdgpu_fpriv *fpriv = file->driver_priv;
 | 
						struct amdgpu_fpriv *fpriv = file->driver_priv;
 | 
				
			||||||
	struct amdgpu_vm *vm = &fpriv->vm;
 | 
						struct amdgpu_vm *vm = &fpriv->vm;
 | 
				
			||||||
| 
						 | 
					@ -87,31 +86,30 @@ void amdgpu_show_fdinfo(struct seq_file *m, struct file *f)
 | 
				
			||||||
	 * ******************************************************************
 | 
						 * ******************************************************************
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	seq_printf(m, "pasid:\t%u\n", fpriv->vm.pasid);
 | 
						drm_printf(p, "pasid:\t%u\n", fpriv->vm.pasid);
 | 
				
			||||||
	seq_printf(m, "drm-driver:\t%s\n", file->minor->dev->driver->name);
 | 
						drm_printf(p, "drm-driver:\t%s\n", file->minor->dev->driver->name);
 | 
				
			||||||
	seq_printf(m, "drm-pdev:\t%04x:%02x:%02x.%d\n", domain, bus, dev, fn);
 | 
						drm_printf(p, "drm-pdev:\t%04x:%02x:%02x.%d\n", domain, bus, dev, fn);
 | 
				
			||||||
	seq_printf(m, "drm-client-id:\t%Lu\n", vm->immediate.fence_context);
 | 
						drm_printf(p, "drm-client-id:\t%Lu\n", vm->immediate.fence_context);
 | 
				
			||||||
	seq_printf(m, "drm-memory-vram:\t%llu KiB\n", stats.vram/1024UL);
 | 
						drm_printf(p, "drm-memory-vram:\t%llu KiB\n", stats.vram/1024UL);
 | 
				
			||||||
	seq_printf(m, "drm-memory-gtt: \t%llu KiB\n", stats.gtt/1024UL);
 | 
						drm_printf(p, "drm-memory-gtt: \t%llu KiB\n", stats.gtt/1024UL);
 | 
				
			||||||
	seq_printf(m, "drm-memory-cpu: \t%llu KiB\n", stats.cpu/1024UL);
 | 
						drm_printf(p, "drm-memory-cpu: \t%llu KiB\n", stats.cpu/1024UL);
 | 
				
			||||||
	seq_printf(m, "amd-memory-visible-vram:\t%llu KiB\n",
 | 
						drm_printf(p, "amd-memory-visible-vram:\t%llu KiB\n",
 | 
				
			||||||
		   stats.visible_vram/1024UL);
 | 
							   stats.visible_vram/1024UL);
 | 
				
			||||||
	seq_printf(m, "amd-evicted-vram:\t%llu KiB\n",
 | 
						drm_printf(p, "amd-evicted-vram:\t%llu KiB\n",
 | 
				
			||||||
		   stats.evicted_vram/1024UL);
 | 
							   stats.evicted_vram/1024UL);
 | 
				
			||||||
	seq_printf(m, "amd-evicted-visible-vram:\t%llu KiB\n",
 | 
						drm_printf(p, "amd-evicted-visible-vram:\t%llu KiB\n",
 | 
				
			||||||
		   stats.evicted_visible_vram/1024UL);
 | 
							   stats.evicted_visible_vram/1024UL);
 | 
				
			||||||
	seq_printf(m, "amd-requested-vram:\t%llu KiB\n",
 | 
						drm_printf(p, "amd-requested-vram:\t%llu KiB\n",
 | 
				
			||||||
		   stats.requested_vram/1024UL);
 | 
							   stats.requested_vram/1024UL);
 | 
				
			||||||
	seq_printf(m, "amd-requested-visible-vram:\t%llu KiB\n",
 | 
						drm_printf(p, "amd-requested-visible-vram:\t%llu KiB\n",
 | 
				
			||||||
		   stats.requested_visible_vram/1024UL);
 | 
							   stats.requested_visible_vram/1024UL);
 | 
				
			||||||
	seq_printf(m, "amd-requested-gtt:\t%llu KiB\n",
 | 
						drm_printf(p, "amd-requested-gtt:\t%llu KiB\n",
 | 
				
			||||||
		   stats.requested_gtt/1024UL);
 | 
							   stats.requested_gtt/1024UL);
 | 
				
			||||||
 | 
					 | 
				
			||||||
	for (hw_ip = 0; hw_ip < AMDGPU_HW_IP_NUM; ++hw_ip) {
 | 
						for (hw_ip = 0; hw_ip < AMDGPU_HW_IP_NUM; ++hw_ip) {
 | 
				
			||||||
		if (!usage[hw_ip])
 | 
							if (!usage[hw_ip])
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		seq_printf(m, "drm-engine-%s:\t%Ld ns\n", amdgpu_ip_name[hw_ip],
 | 
							drm_printf(p, "drm-engine-%s:\t%Ld ns\n", amdgpu_ip_name[hw_ip],
 | 
				
			||||||
			   ktime_to_ns(usage[hw_ip]));
 | 
								   ktime_to_ns(usage[hw_ip]));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,6 +37,6 @@
 | 
				
			||||||
#include "amdgpu_ids.h"
 | 
					#include "amdgpu_ids.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint32_t amdgpu_get_ip_count(struct amdgpu_device *adev, int id);
 | 
					uint32_t amdgpu_get_ip_count(struct amdgpu_device *adev, int id);
 | 
				
			||||||
void amdgpu_show_fdinfo(struct seq_file *m, struct file *f);
 | 
					void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue