[PATCH 05/11] drm/rockchip: Test for imported buffers with drm_gem_is_imported()

Thomas Zimmermann tzimmermann at suse.de
Tue Apr 15 06:54:21 UTC 2025


Hi

Am 15.04.25 um 06:00 schrieb Andy Yan:
>
> Hi Thomas,
>
> At 2025-04-14 21:48:12, "Thomas Zimmermann" <tzimmermann at suse.de> wrote:
>> Instead of testing import_attach for imported GEM buffers, invoke
>> drm_gem_is_imported() to do the test. The helper tests the dma_buf
>> itself while import_attach is just an artifact of the import. Prepares
>> to make import_attach optional.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
>> Cc: Sandy Huang <hjc at rock-chips.com>
>> Cc: "Heiko Stübner" <heiko at sntech.de>
>> Cc: Andy Yan <andy.yan at rock-chips.com>
>> ---
>> drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
>> index 6330b883efc3..e44396d46dc1 100644
>> --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
>> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
>> @@ -332,7 +332,7 @@ void rockchip_gem_free_object(struct drm_gem_object *obj)
>> 	struct rockchip_drm_private *private = drm->dev_private;
>> 	struct rockchip_gem_object *rk_obj = to_rockchip_obj(obj);
>>
>> -	if (obj->import_attach) {
>> +	if (drm_gem_is_imported(obj)) {
>
> After applying this patch, when I tested glmark2-es2-wayland under Weston, the weston would freeze.
> It seems it goto the else path.
>
>   I'm still conducting further analysis to figure out the exact cause.

Thanks for testing. We test if obj->dma_buf is set and refers back to 
obj. One of these fields has likely been cleared already to NULL during 
the object cleanup. Other drivers also call drm_gem_is_imported() in 
their object cleanup and I've not heard about any regressions.

Best regards
Thomas

>
>> 		if (private->domain) {
>> 			rockchip_gem_iommu_unmap(rk_obj);
>> 		} else {
>> -- 
>> 2.49.0

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)



More information about the dri-devel mailing list