[PATCH 5/5] drm/simpledrm: Synchronize access to GEM BOs

Thomas Zimmermann tzimmermann at suse.de
Fri Sep 23 10:43:54 UTC 2022


Hi

Am 23.09.22 um 10:06 schrieb Javier Martinez Canillas:
> On 9/22/22 15:09, Thomas Zimmermann wrote:
>> Synchronize CPU access to GEM BOs with other drivers when updating the
>> screen buffer. Imported buffers might otherwise contain stale data.
>>
> 
> Can you please elaborate what the problem is? The framebuffers memory is
> setup by the firmware and would never come from an imported dma-buf, so
> could the GEM BOs even be shared with other drivers?
> 
> Or is this done just for the sake of correctness ?

This isn't about the scanout buffer that we get from the firmware. This 
is about synchronizing access to the GEM BO memory buffers. Our BOs' 
memory buffer are allocated from SHMEM or could be imported via dma-buf. 
In the latter case, another driver or hardware might modify their 
content concurrently. We need to synchronize before reading the memory 
from our CPU. The pattern is

   1) sync BO memory content via begin_cpu_access()
   2) blit from BO mem to scanout buffer
   3) release BO memory via end_cpu_access()

Best regards
Thomas

>   
>> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
>> ---
> 
> The change looks good to me though if is for the latter.
> 
> Reviewed-by: Javier Martinez Canillas <javierm at redhat.com>
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20220923/c5aa01f8/attachment.sig>


More information about the dri-devel mailing list