Does gbm_bo_map() implicitly synchronise?

Michel Dänzer michel.daenzer at mailbox.org
Mon Jun 17 14:55:27 UTC 2024


On 2024-06-17 16:52, Christian König wrote:
> Am 17.06.24 um 16:50 schrieb Michel Dänzer:
>> On 2024-06-17 12:29, Pierre Ossman wrote:
>>> Just to avoid any uncertainty, are both of these things done implicitly by gbm_bo_map()/gbm_bo_unmap()?
>>>
>>> I did test adding those steps just in case, but unfortunately did not see an improvement. My order was:
>>>
>>> 1. gbm_bo_import(GBM_BO_USE_RENDERING)
>>> 2. gbm_bo_get_fd()
>>> 3. Wait for client to request displaying the buffer
>>> 4. gbm_bo_map(GBM_BO_TRANSFER_READ)
>>> 5. select(fd+1, &fds, NULL, NULL, NULL)
>> *If* select() is needed, it needs to be before gbm_bo_map(), because the latter may perform a blit from the real BO to a staging one for CPU access.
> 
> But don't you then need to wait for the blit to finish?

No, gbm_bo_map() must handle that internally. When it returns, the CPU must see the correct contents.


>>> 6. ioctl(DMA_BUF_IOCTL_SYNC, &{ .flags = DMA_BUF_SYNC_START | DMA_BUF_SYNC_READ })
>> gbm_bo_map() should do this internally if needed.
>>
>>
>>> 7. pixman_blt()
>>> 8. gbm_bo_unmap()
>>
> 

-- 
Earthling Michel Dänzer            |                  https://redhat.com
Libre software enthusiast          |         Mesa and Xwayland developer



More information about the mesa-dev mailing list