diff mbox series

[34/49] drm/ttm: make manager debug function optional

Message ID 20200731040520.3701599-35-airlied@gmail.com (mailing list archive)
State New, archived
Headers show
Series ttm mem manager refactoring. | expand

Commit Message

Dave Airlie July 31, 2020, 4:05 a.m. UTC
From: Dave Airlie <airlied@redhat.com>

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniel Vetter July 31, 2020, 9:46 a.m. UTC | #1
On Fri, Jul 31, 2020 at 02:05:05PM +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied@redhat.com>
> 
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> ---
>  drivers/gpu/drm/ttm/ttm_bo.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index 92de8a6d7647..1e8fda1c9b3a 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -88,7 +88,7 @@ static void ttm_mem_type_debug(struct ttm_bo_device *bdev, struct drm_printer *p
>  	drm_printf(p, "    size: %llu\n", man->size);
>  	drm_printf(p, "    available_caching: 0x%08X\n", man->available_caching);
>  	drm_printf(p, "    default_caching: 0x%08X\n", man->default_caching);
> -	if (mem_type != TTM_PL_SYSTEM)
> +	if (mem_type != TTM_PL_SYSTEM && man->func->debug)
>  		(*man->func->debug)(man, p);
>  }

Bit a bikeshed, but what about exporting this function (maybe with the man
as argument, not the bdev, mem_type pair) and using it in the first 2
patches? Avoids surprises with optional func->debug.
-Daniel

>  
> -- 
> 2.26.2
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Christian König July 31, 2020, 1:03 p.m. UTC | #2
Am 31.07.20 um 11:46 schrieb daniel@ffwll.ch:
> On Fri, Jul 31, 2020 at 02:05:05PM +1000, Dave Airlie wrote:
>> From: Dave Airlie <airlied@redhat.com>
>>
>> Signed-off-by: Dave Airlie <airlied@redhat.com>
>> ---
>>   drivers/gpu/drm/ttm/ttm_bo.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
>> index 92de8a6d7647..1e8fda1c9b3a 100644
>> --- a/drivers/gpu/drm/ttm/ttm_bo.c
>> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
>> @@ -88,7 +88,7 @@ static void ttm_mem_type_debug(struct ttm_bo_device *bdev, struct drm_printer *p
>>   	drm_printf(p, "    size: %llu\n", man->size);
>>   	drm_printf(p, "    available_caching: 0x%08X\n", man->available_caching);
>>   	drm_printf(p, "    default_caching: 0x%08X\n", man->default_caching);
>> -	if (mem_type != TTM_PL_SYSTEM)
>> +	if (mem_type != TTM_PL_SYSTEM && man->func->debug)
>>   		(*man->func->debug)(man, p);
>>   }
> Bit a bikeshed, but what about exporting this function (maybe with the man
> as argument, not the bdev, mem_type pair) and using it in the first 2
> patches? Avoids surprises with optional func->debug.

+1 for that. That's no bikeshed at all but just clean design.

And we should rename all those backend related functions and move them 
into a separate [ch] file.

E.g. let's just have a backend resource object TTM works with.

Christian.

> -Daniel
>
>>   
>> -- 
>> 2.26.2
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fdri-devel&amp;data=02%7C01%7Cchristian.koenig%40amd.com%7C8540e6d1e99547722b2c08d83536929d%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637317855794189396&amp;sdata=GpkfEetygk53dJ1qWiF%2FucNVRc9%2FxWLzKc2BGuG9bLg%3D&amp;reserved=0
Christian König July 31, 2020, 1:24 p.m. UTC | #3
Am 31.07.20 um 06:05 schrieb Dave Airlie:
> From: Dave Airlie <airlied@redhat.com>
>
> Signed-off-by: Dave Airlie <airlied@redhat.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/ttm/ttm_bo.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index 92de8a6d7647..1e8fda1c9b3a 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -88,7 +88,7 @@ static void ttm_mem_type_debug(struct ttm_bo_device *bdev, struct drm_printer *p
>   	drm_printf(p, "    size: %llu\n", man->size);
>   	drm_printf(p, "    available_caching: 0x%08X\n", man->available_caching);
>   	drm_printf(p, "    default_caching: 0x%08X\n", man->default_caching);
> -	if (mem_type != TTM_PL_SYSTEM)
> +	if (mem_type != TTM_PL_SYSTEM && man->func->debug)
>   		(*man->func->debug)(man, p);
>   }
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 92de8a6d7647..1e8fda1c9b3a 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -88,7 +88,7 @@  static void ttm_mem_type_debug(struct ttm_bo_device *bdev, struct drm_printer *p
 	drm_printf(p, "    size: %llu\n", man->size);
 	drm_printf(p, "    available_caching: 0x%08X\n", man->available_caching);
 	drm_printf(p, "    default_caching: 0x%08X\n", man->default_caching);
-	if (mem_type != TTM_PL_SYSTEM)
+	if (mem_type != TTM_PL_SYSTEM && man->func->debug)
 		(*man->func->debug)(man, p);
 }