[Mesa-dev] [PATCH v6 0/3] asynchronous pbo transfer with glthread

Gregory Hainaut gregory.hainaut at gmail.com
Sun May 21 14:57:54 UTC 2017


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,

Gregory Hainaut (3):
  mesa/glthread: track buffer creation/destruction
  mesa/glthread: add tracking of PBO binding
  mapi/glthread: generate asynchronous code for PBO transfer

 src/mapi/glapi/gen/ARB_direct_state_access.xml |  18 +--
 src/mapi/glapi/gen/ARB_robustness.xml          |   2 +-
 src/mapi/glapi/gen/gl_API.dtd                  |  10 +-
 src/mapi/glapi/gen/gl_API.xml                  |  32 +++---
 src/mapi/glapi/gen/gl_marshal.py               |  23 +++-
 src/mapi/glapi/gen/marshal_XML.py              |  21 +++-
 src/mesa/main/glthread.h                       |  10 ++
 src/mesa/main/marshal.c                        | 149 ++++++++++++++++++++++++-
 src/mesa/main/marshal.h                        |  24 ++++
 src/mesa/main/mtypes.h                         |   5 +
 src/mesa/main/shared.c                         |  14 +++
 11 files changed, 269 insertions(+), 39 deletions(-)

-- 
2.11.0



More information about the mesa-dev mailing list