Does gbm_bo_map() implicitly synchronise?

Lucas Stach l.stach at pengutronix.de
Tue Jun 25 08:27:33 UTC 2024


Am Dienstag, dem 25.06.2024 um 09:56 +0200 schrieb Michel Dänzer:
> On 2024-06-24 21:08, James Jones wrote:
> > FWIW, the NVIDIA binary driver's implementation of gbm_bo_map/unmap()
> > 
> > 1) Don't do any synchronization against in-flight work. The assumption is that if the content is going to be read, the API writing the data has established that coherence. Likewise, if it's going to be written, the API reading it afterwards does any invalidates or whatever are needed for coherence.
> > 
> > 2) We don't blit anything or format convert, because our GBM implementation has no DMA engine access, and I'd like to keep it that way. Setting up a DMA-capable driver instance is much more expensive as far as runtime resources than setting up a simple allocator+mmap driver, at least in our driver architecture. Our GBM map just does an mmap(), and if it's not linear, you're not going to be able to interpret the data unless you've read up on our tiling formats. I'm aware this is different from Mesa, and no one has complained thus far.
> 
> I've seen at least one webkitgtk issue report about gbm_bo_map not working as intended with nvidia.
> 
> gbm_bo_map definitely has to handle tiling, that's one of its main purposes.
> 
Unfortunately gbm_bo_map is severely underspecified in that regard.
Gallium drivers always handled tiling as the map has been implemented
as a transfer, but i965 also didn't handle tiling and just returned a
mapping of the raw tiled storage.

> It also really has to handle implicit synchronization, since there's no GBM API for explicit synchronization.
> 
One could demand that the caller does something like eglClientWaitSync
on a sync object fencing the hardware operations. Implicit sync on
gbm_bo_map already is kind of a gray area, as GBM uses a different
context to implement the transfer than the rendering API. It will only
synchronize with commands flushed from the rendering context. Anything
still buffered in the rendering context is invisible to gbm.

Again, none of this is really specified anywhere. But I guess most
users at this point assume the Mesa behavior and will break if another
implementation doesn't do the same.

Regards,
Lucas



More information about the mesa-dev mailing list