Re: [PATCH 2/2] drm/amdgpu: print the BO flags in the gem debugfs entry

2018-05-11 Thread Alex Deucher
On Fri, May 11, 2018 at 11:40 AM, Christian König
 wrote:
> Quite usfull to know.

"useful"

With that fixed:
Reviewed-by: Alex Deucher 

>
> Signed-off-by: Christian König 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 15 +++
>  1 file changed, 15 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> index c3f8c5573a97..b09030167c44 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> @@ -774,6 +774,12 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
>  }
>
>  #if defined(CONFIG_DEBUG_FS)
> +
> +#define amdgpu_debugfs_gem_bo_print_flag(m, bo, flag)  \
> +   if (bo->flags & (AMDGPU_GEM_CREATE_ ## flag)) { \
> +   seq_printf((m), " " #flag); \
> +   }
> +
>  static int amdgpu_debugfs_gem_bo_info(int id, void *ptr, void *data)
>  {
> struct drm_gem_object *gobj = ptr;
> @@ -815,6 +821,15 @@ static int amdgpu_debugfs_gem_bo_info(int id, void *ptr, 
> void *data)
> else if (dma_buf)
> seq_printf(m, " exported as %p", dma_buf);
>
> +   amdgpu_debugfs_gem_bo_print_flag(m, bo, CPU_ACCESS_REQUIRED);
> +   amdgpu_debugfs_gem_bo_print_flag(m, bo, NO_CPU_ACCESS);
> +   amdgpu_debugfs_gem_bo_print_flag(m, bo, CPU_GTT_USWC);
> +   amdgpu_debugfs_gem_bo_print_flag(m, bo, VRAM_CLEARED);
> +   amdgpu_debugfs_gem_bo_print_flag(m, bo, SHADOW);
> +   amdgpu_debugfs_gem_bo_print_flag(m, bo, VRAM_CONTIGUOUS);
> +   amdgpu_debugfs_gem_bo_print_flag(m, bo, VM_ALWAYS_VALID);
> +   amdgpu_debugfs_gem_bo_print_flag(m, bo, EXPLICIT_SYNC);
> +
> seq_printf(m, "\n");
>
> return 0;
> --
> 2.14.1
>
> ___
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 2/2] drm/amdgpu: print the BO flags in the gem debugfs entry

2018-05-11 Thread Christian König
Quite usfull to know.

Signed-off-by: Christian König 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index c3f8c5573a97..b09030167c44 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -774,6 +774,12 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
 }
 
 #if defined(CONFIG_DEBUG_FS)
+
+#define amdgpu_debugfs_gem_bo_print_flag(m, bo, flag)  \
+   if (bo->flags & (AMDGPU_GEM_CREATE_ ## flag)) { \
+   seq_printf((m), " " #flag); \
+   }
+
 static int amdgpu_debugfs_gem_bo_info(int id, void *ptr, void *data)
 {
struct drm_gem_object *gobj = ptr;
@@ -815,6 +821,15 @@ static int amdgpu_debugfs_gem_bo_info(int id, void *ptr, 
void *data)
else if (dma_buf)
seq_printf(m, " exported as %p", dma_buf);
 
+   amdgpu_debugfs_gem_bo_print_flag(m, bo, CPU_ACCESS_REQUIRED);
+   amdgpu_debugfs_gem_bo_print_flag(m, bo, NO_CPU_ACCESS);
+   amdgpu_debugfs_gem_bo_print_flag(m, bo, CPU_GTT_USWC);
+   amdgpu_debugfs_gem_bo_print_flag(m, bo, VRAM_CLEARED);
+   amdgpu_debugfs_gem_bo_print_flag(m, bo, SHADOW);
+   amdgpu_debugfs_gem_bo_print_flag(m, bo, VRAM_CONTIGUOUS);
+   amdgpu_debugfs_gem_bo_print_flag(m, bo, VM_ALWAYS_VALID);
+   amdgpu_debugfs_gem_bo_print_flag(m, bo, EXPLICIT_SYNC);
+
seq_printf(m, "\n");
 
return 0;
-- 
2.14.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx