From: Marek Olšák Date: Sun, 8 Mar 2020 21:43:26 +0000 (-0400) Subject: mesa: add Const.BufferCreateMapUnsynchronizedThreadSafe & MESA_MAP_THREAD_SAFE X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b8223244c38ad1c433b33b37bff3f19e7a9d2cfc;p=mesa.git mesa: add Const.BufferCreateMapUnsynchronizedThreadSafe & MESA_MAP_THREAD_SAFE Acked-by: Pierre-Eric Pelloux-Prayer Part-of: --- diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 3fd47ba6f9e..b7973e1c6ae 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -70,6 +70,9 @@ struct _mesa_index_buffer; */ #define MESA_MAP_NOWAIT_BIT 0x4000 +/* Mapping a buffer is allowed from any thread. */ +#define MESA_MAP_THREAD_SAFE_BIT 0x8000 + /** * Device driver function table. diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index db55117bc08..a8b75b32f52 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -4126,6 +4126,12 @@ struct gl_constants /** When drivers are OK with mapped buffers during draw and other calls. */ bool AllowMappedBuffersDuringExecution; + /** + * Whether buffer creation, unsynchronized mapping, unmapping, and + * deletion is thread-safe. + */ + bool BufferCreateMapUnsynchronizedThreadSafe; + /** GL_ARB_get_program_binary */ GLuint NumProgramBinaryFormats; diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index c95a3d4d2ac..33778df0afa 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -494,6 +494,8 @@ st_access_flags_to_transfer_flags(GLbitfield access, bool wholeBuffer) if (access & MESA_MAP_NOWAIT_BIT) flags |= PIPE_TRANSFER_DONTBLOCK; + if (access & MESA_MAP_THREAD_SAFE_BIT) + flags |= PIPE_TRANSFER_THREAD_SAFE; return flags; } diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index b0ee3e2210a..b6f6091fb3a 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -556,6 +556,9 @@ void st_init_limits(struct pipe_screen *screen, c->AllowMappedBuffersDuringExecution = screen->get_param(screen, PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION); + c->BufferCreateMapUnsynchronizedThreadSafe = + screen->get_param(screen, PIPE_CAP_MAP_UNSYNCHRONIZED_THREAD_SAFE); + c->UseSTD430AsDefaultPacking = screen->get_param(screen, PIPE_CAP_LOAD_CONSTBUF);