[Mesa-dev] RESEND v6 asynchronous pbo transfer with glthread

Timothy Arceri tarceri at itsqueeze.com
Thu Jun 22 09:49:31 UTC 2017


I rebased this on master to test if it made any difference on top
of Mareks glthread updates for Civ6 (since it reduces some syncs
there). It didn't make any noticable difference but since its been
almost 2 months since Gregory send it, I thought I might as well
resend as it didn't get any feedback previously. I haven't been
following the previous series so would be good to get comment
from those that have. :)

Thanks,
Tim

--- V6 Cover letter from Gregory below ---

Hello Mesa developers,

Please find a new version to handle invalid buffer handles.

Allow to handle this kind of case:
   genBuffer(&pbo);
   BindBuffer(pbo)
   DeleteBuffer(pbo);
   BindBuffer(rand_pbo)
   TexSubImage2D(user_memory_pointer); // Data transfer will be synchronous

There are various subtely to handle multi threaded shared context. In order to
keep the code sane, I've considered a buffer invalid when it is deleted by a
context even it is still bound to others contexts. It will force a synchronous
transfer which is always safe.

An example could be
   Ctx A: glGenBuffers(1, &pbo);
   Ctx A: glBindBuffer(PIXEL_UNPACK_BUFFER, pbo);
   Ctx B: glDeleteBuffers(1, &pbo);
   Ctx A: glTexSubImage2D(...); // will be synchronous, even though it
   _could_ be asynchronous (because the PBO that was generated first is
   still bound!)

V3: I mixed up the number so I jumped right away to v4...
V4: improve commments based on Nicolai feedback
V5: Properly delete element of the new hash (first patch)
v6: Rebase on latest master
Note: crash related to unsafe X call will be handled by
"Disable glthread if libX11 isn't thread-safe" series

Best regards,




More information about the mesa-dev mailing list