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

Gregory Hainaut gregory.hainaut at gmail.com
Thu Jun 29 16:16:05 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
v7: Fredrik's suggestion (remove shadow hash table
and rename pixel_*pack_buffer_bound variables)
I rebased the code on latest master, it got extra conflict (gl_marshal.py) since
the resent from Timothy

Best regards,

Gregory Hainaut (3):
  mesa/glthread: track buffer 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 | 16 +++---
 src/mapi/glapi/gen/ARB_robustness.xml          |  2 +-
 src/mapi/glapi/gen/gl_API.dtd                  | 10 ++--
 src/mapi/glapi/gen/gl_API.xml                  | 30 +++++-----
 src/mapi/glapi/gen/gl_marshal.py               | 24 +++++++-
 src/mapi/glapi/gen/marshal_XML.py              | 21 +++++--
 src/mesa/main/glthread.h                       | 10 ++++
 src/mesa/main/marshal.c                        | 76 +++++++++++++++++++++++++-
 src/mesa/main/marshal.h                        |  8 +++
 9 files changed, 159 insertions(+), 38 deletions(-)

-- 
2.11.0



More information about the mesa-dev mailing list