diff mbox series

drm: omapdrm: Fix implicit dma_buf fencing

Message ID 1641397018-29872-1-git-send-email-ivo.g.dimitrov.75@gmail.com (mailing list archive)
State New, archived
Headers show
Series drm: omapdrm: Fix implicit dma_buf fencing | expand

Commit Message

Ivaylo Dimitrov Jan. 5, 2022, 3:36 p.m. UTC
Currently omapdrm driver does not initialize dma_buf_export_info resv
member, which leads to a new dma_resv being allocated and attached to
the exported dma_buf. This leads to the issue that fences created on
dma_buf objects imported by other drivers are ignored by omapdrm, as only
fences in gem object resv are waited on. This leads to various issues like
displaying incomplete frames.

Fix that by initializing dma_buf resv to the resv of the gem object being
exported.

Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
---
 drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Tony Lindgren Jan. 6, 2022, 9:45 a.m. UTC | #1
* Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> [220105 15:38]:
> Fix that by initializing dma_buf resv to the resv of the gem object being
> exported.

Nice find! This also fixes my wlroots test case with termite running on
sway where termite would only partially update when switching between
desktops, so:

Tested-by: Tony Lindgren <tony@atomide.com>
Merlijn Wajer Jan. 6, 2022, 12:51 p.m. UTC | #2
Hi,

On 06/01/2022 10:45, Tony Lindgren wrote:
> * Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> [220105 15:38]:
>> Fix that by initializing dma_buf resv to the resv of the gem object being
>> exported.
> 
> Nice find! This also fixes my wlroots test case with termite running on
> sway where termite would only partially update when switching between
> desktops, so:
> 
> Tested-by: Tony Lindgren <tony@atomide.com>

You can also add my:

Tested-by: Merlijn Wajer <merlijn@wizzup.org>

Cheers,
Merlijn
Tomi Valkeinen Jan. 6, 2022, 1:43 p.m. UTC | #3
Hi,

On 05/01/2022 17:36, Ivaylo Dimitrov wrote:
> Currently omapdrm driver does not initialize dma_buf_export_info resv
> member, which leads to a new dma_resv being allocated and attached to
> the exported dma_buf. This leads to the issue that fences created on
> dma_buf objects imported by other drivers are ignored by omapdrm, as only
> fences in gem object resv are waited on. This leads to various issues like
> displaying incomplete frames.
> 
> Fix that by initializing dma_buf resv to the resv of the gem object being
> exported.
> 
> Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
> ---
>   drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c b/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c
> index f1f93cabb61e..a111e5c91925 100644
> --- a/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c
> +++ b/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c
> @@ -88,6 +88,7 @@ struct dma_buf *omap_gem_prime_export(struct drm_gem_object *obj, int flags)
>   	exp_info.size = omap_gem_mmap_size(obj);
>   	exp_info.flags = flags;
>   	exp_info.priv = obj;
> +	exp_info.resv = obj->resv;
>   
>   	return drm_gem_dmabuf_export(obj->dev, &exp_info);
>   }

Thanks! Pushed to drm-misc-next.

  Tomi
Ivaylo Dimitrov Jan. 6, 2022, 4:26 p.m. UTC | #4
Hi,

On 6.01.22 г. 15:43 ч., Tomi Valkeinen wrote:
> Hi,
> 
> On 05/01/2022 17:36, Ivaylo Dimitrov wrote:
>> Currently omapdrm driver does not initialize dma_buf_export_info resv
>> member, which leads to a new dma_resv being allocated and attached to
>> the exported dma_buf. This leads to the issue that fences created on
>> dma_buf objects imported by other drivers are ignored by omapdrm, as only
>> fences in gem object resv are waited on. This leads to various issues 
>> like
>> displaying incomplete frames.
>>
>> Fix that by initializing dma_buf resv to the resv of the gem object being
>> exported.
>>
>> Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
>> ---
>>   drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c 
>> b/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c
>> index f1f93cabb61e..a111e5c91925 100644
>> --- a/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c
>> +++ b/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c
>> @@ -88,6 +88,7 @@ struct dma_buf *omap_gem_prime_export(struct 
>> drm_gem_object *obj, int flags)
>>       exp_info.size = omap_gem_mmap_size(obj);
>>       exp_info.flags = flags;
>>       exp_info.priv = obj;
>> +    exp_info.resv = obj->resv;
>>       return drm_gem_dmabuf_export(obj->dev, &exp_info);
>>   }
> 
> Thanks! Pushed to drm-misc-next.
> 

Thanks,

I think lts kernels shall get that fix too, but I have no idea how :) .

Ivo.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c b/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c
index f1f93cabb61e..a111e5c91925 100644
--- a/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c
+++ b/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c
@@ -88,6 +88,7 @@  struct dma_buf *omap_gem_prime_export(struct drm_gem_object *obj, int flags)
 	exp_info.size = omap_gem_mmap_size(obj);
 	exp_info.flags = flags;
 	exp_info.priv = obj;
+	exp_info.resv = obj->resv;
 
 	return drm_gem_dmabuf_export(obj->dev, &exp_info);
 }