dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm: omapdrm: Fix implicit dma_buf fencing
@ 2022-01-05 15:36 Ivaylo Dimitrov
  2022-01-06  9:45 ` [Openpvrsgx-devgroup] " Tony Lindgren
  2022-01-06 13:43 ` Tomi Valkeinen
  0 siblings, 2 replies; 6+ messages in thread
From: Ivaylo Dimitrov @ 2022-01-05 15:36 UTC (permalink / raw)
  To: tomba, sumit.semwal, christian.koenig
  Cc: philipp, Ivaylo Dimitrov, airlied, merlijn, openpvrsgx-devgroup,
	linux-kernel, dri-devel, linux-omap, linux-media

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);
 }
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Openpvrsgx-devgroup] [PATCH] drm: omapdrm: Fix implicit dma_buf fencing
  2022-01-05 15:36 [PATCH] drm: omapdrm: Fix implicit dma_buf fencing Ivaylo Dimitrov
@ 2022-01-06  9:45 ` Tony Lindgren
  2022-01-06 12:51   ` Merlijn Wajer
  2022-01-06 13:43 ` Tomi Valkeinen
  1 sibling, 1 reply; 6+ messages in thread
From: Tony Lindgren @ 2022-01-06  9:45 UTC (permalink / raw)
  To: OpenPVRSGX Linux Driver Group
  Cc: philipp, tomba, airlied, linux-kernel, dri-devel,
	christian.koenig, linux-omap, linux-media

* 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>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Openpvrsgx-devgroup] [PATCH] drm: omapdrm: Fix implicit dma_buf fencing
  2022-01-06  9:45 ` [Openpvrsgx-devgroup] " Tony Lindgren
@ 2022-01-06 12:51   ` Merlijn Wajer
  0 siblings, 0 replies; 6+ messages in thread
From: Merlijn Wajer @ 2022-01-06 12:51 UTC (permalink / raw)
  To: Tony Lindgren, OpenPVRSGX Linux Driver Group, Ivaylo Dimitrov
  Cc: philipp, tomba, airlied, linux-kernel, dri-devel,
	christian.koenig, linux-omap, linux-media

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm: omapdrm: Fix implicit dma_buf fencing
  2022-01-05 15:36 [PATCH] drm: omapdrm: Fix implicit dma_buf fencing Ivaylo Dimitrov
  2022-01-06  9:45 ` [Openpvrsgx-devgroup] " Tony Lindgren
@ 2022-01-06 13:43 ` Tomi Valkeinen
  2022-01-06 16:26   ` Ivaylo Dimitrov
  1 sibling, 1 reply; 6+ messages in thread
From: Tomi Valkeinen @ 2022-01-06 13:43 UTC (permalink / raw)
  To: Ivaylo Dimitrov, sumit.semwal, christian.koenig
  Cc: philipp, airlied, merlijn, openpvrsgx-devgroup, linux-kernel,
	dri-devel, linux-omap, linux-media

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm: omapdrm: Fix implicit dma_buf fencing
  2022-01-06 13:43 ` Tomi Valkeinen
@ 2022-01-06 16:26   ` Ivaylo Dimitrov
  2022-01-06 17:48     ` [Openpvrsgx-devgroup] " H. Nikolaus Schaller
  0 siblings, 1 reply; 6+ messages in thread
From: Ivaylo Dimitrov @ 2022-01-06 16:26 UTC (permalink / raw)
  To: Tomi Valkeinen, sumit.semwal, christian.koenig
  Cc: philipp, airlied, merlijn, openpvrsgx-devgroup, linux-kernel,
	dri-devel, linux-omap, linux-media

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Openpvrsgx-devgroup] [PATCH] drm: omapdrm: Fix implicit dma_buf fencing
  2022-01-06 16:26   ` Ivaylo Dimitrov
@ 2022-01-06 17:48     ` H. Nikolaus Schaller
  0 siblings, 0 replies; 6+ messages in thread
From: H. Nikolaus Schaller @ 2022-01-06 17:48 UTC (permalink / raw)
  To: Ivaylo Dimitrov
  Cc: Carl Philipp Klemm, David Airlie, Tomi Valkeinen,
	OpenPVRSGX Linux Driver Group, Linux Kernel Mailing List,
	DRI Development, christian.koenig, Linux-OMAP, linux-media

[-- Attachment #1: Type: text/plain, Size: 2026 bytes --]

Hi Ivo,

> Am 06.01.2022 um 17:26 schrieb Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>:
> 
> 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 :) .

https://01.org/linuxgraphics/gfx-docs/drm/process/stable-kernel-rules.html <https://01.org/linuxgraphics/gfx-docs/drm/process/stable-kernel-rules.html>

so I think you can use Option 2 after it got merged by Linus. I am not sure
if timing is good for 5.17-rc series. Anyways it should arrive in ca. 3 months
within 5.18-rc.

Maybe there is a "fast lane" I do not know...

BR,
Nikolaus



[-- Attachment #2: Type: text/html, Size: 3232 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-01-06 18:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-05 15:36 [PATCH] drm: omapdrm: Fix implicit dma_buf fencing Ivaylo Dimitrov
2022-01-06  9:45 ` [Openpvrsgx-devgroup] " Tony Lindgren
2022-01-06 12:51   ` Merlijn Wajer
2022-01-06 13:43 ` Tomi Valkeinen
2022-01-06 16:26   ` Ivaylo Dimitrov
2022-01-06 17:48     ` [Openpvrsgx-devgroup] " H. Nikolaus Schaller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).