diff options
author | Marek Olšák <marek.olsak@amd.com> | 2022-12-24 11:04:08 -0500 |
---|---|---|
committer | Marek Olšák <marek.olsak@amd.com> | 2023-01-01 16:00:07 -0500 |
commit | b9caddb4a72ab906f8f9df047ca0ffe811820917 (patch) | |
tree | 113b9bd49015b72836c34aa067d6f5a80c528e19 | |
parent | 83b31b11a595739e80f98be66d8b290af7670766 (diff) |
glthread,gallium: add a CAP to disable glBufferSubData optimization in glthread
it regresses performance on iris
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20379>
-rw-r--r-- | docs/gallium/screen.rst | 1 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_screen.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_get.c | 1 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_defines.h | 1 | ||||
-rw-r--r-- | src/mesa/main/consts_exts.h | 3 | ||||
-rw-r--r-- | src/mesa/main/glthread_bufferobj.c | 1 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_extensions.c | 3 |
7 files changed, 11 insertions, 0 deletions
diff --git a/docs/gallium/screen.rst b/docs/gallium/screen.rst index a14ec52a2e3..cc75a2869dc 100644 --- a/docs/gallium/screen.rst +++ b/docs/gallium/screen.rst @@ -638,6 +638,7 @@ The integer capabilities: * ``PIPE_CAP_MAX_CONSTANT_BUFFER_SIZE_UINT``: Maximum bound constant buffer size in bytes. This is unsigned integer with the maximum of 4GB - 1. This applies to all constant buffers used by UBOs, unlike ``PIPE_SHADER_CAP_MAX_CONST_BUFFER0_SIZE``, which is specifically for GLSL uniforms. * ``PIPE_CAP_HARDWARE_GL_SELECT``: Enable hardware accelerated GL_SELECT for this driver. * ``PIPE_CAP_DEVICE_PROTECTED_CONTEXT``: Whether the device supports protected / encrypted context which can manipulate protected / encrypted content (some devices might need protected contexts to access protected content, whereas ``PIPE_CAP_DEVICE_PROTECTED_SURFACE`` does not require any particular context to do so). +* ``PIPE_CAP_ALLOW_GLTHREAD_BUFFER_SUBDATA_OPT``: Whether to allow glthread to convert glBufferSubData to glCopyBufferSubData. This may improve or worsen performance depending on your driver. .. _pipe_capf: diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c index d073e732044..16c31819c89 100644 --- a/src/gallium/auxiliary/util/u_screen.c +++ b/src/gallium/auxiliary/util/u_screen.c @@ -497,6 +497,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen, case PIPE_CAP_QUERY_SPARSE_TEXTURE_RESIDENCY: case PIPE_CAP_CLAMP_SPARSE_TEXTURE_LOD: case PIPE_CAP_TIMELINE_SEMAPHORE_IMPORT: + case PIPE_CAP_ALLOW_GLTHREAD_BUFFER_SUBDATA_OPT: return 0; case PIPE_CAP_MAX_CONSTANT_BUFFER_SIZE_UINT: diff --git a/src/gallium/drivers/radeonsi/si_get.c b/src/gallium/drivers/radeonsi/si_get.c index a053be2e709..356f07979e7 100644 --- a/src/gallium/drivers/radeonsi/si_get.c +++ b/src/gallium/drivers/radeonsi/si_get.c @@ -165,6 +165,7 @@ static int si_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_GLSL_TESS_LEVELS_AS_INPUTS: case PIPE_CAP_DEVICE_RESET_STATUS_QUERY: case PIPE_CAP_TEXTURE_MULTISAMPLE: + case PIPE_CAP_ALLOW_GLTHREAD_BUFFER_SUBDATA_OPT: /* TODO: remove if it's slow */ return 1; case PIPE_CAP_TEXTURE_TRANSFER_MODES: diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index b97b546e555..702955278c5 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -1012,6 +1012,7 @@ enum pipe_cap PIPE_CAP_QUERY_TIMESTAMP_BITS, /** For EGL_EXT_protected_content */ PIPE_CAP_DEVICE_PROTECTED_CONTEXT, + PIPE_CAP_ALLOW_GLTHREAD_BUFFER_SUBDATA_OPT, PIPE_CAP_LAST, /* XXX do not add caps after PIPE_CAP_LAST! */ diff --git a/src/mesa/main/consts_exts.h b/src/mesa/main/consts_exts.h index 42ff9032305..cbc12ae3e34 100644 --- a/src/mesa/main/consts_exts.h +++ b/src/mesa/main/consts_exts.h @@ -992,5 +992,8 @@ struct gl_constants /** Use hardware accelerated GL_SELECT */ bool HardwareAcceleratedSelect; + + /** Allow GLThread to convert glBuffer */ + bool AllowGLThreadBufferSubDataOpt; }; #endif diff --git a/src/mesa/main/glthread_bufferobj.c b/src/mesa/main/glthread_bufferobj.c index aa64d0596a2..b21f3fd76f1 100644 --- a/src/mesa/main/glthread_bufferobj.c +++ b/src/mesa/main/glthread_bufferobj.c @@ -498,6 +498,7 @@ _mesa_marshal_BufferSubData_merged(GLuint target_or_name, GLintptr offset, * the buffer storage, but we don't know the buffer size in glthread. */ if (ctx->GLThread.SupportsBufferUploads && + ctx->Const.AllowGLThreadBufferSubDataOpt && data && offset > 0 && size > 0) { struct gl_buffer_object *upload_buffer = NULL; unsigned upload_offset = 0; diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 7e22cec7895..28ac4cb68bd 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -628,6 +628,9 @@ void st_init_limits(struct pipe_screen *screen, c->HardwareAcceleratedSelect = screen->get_param(screen, PIPE_CAP_HARDWARE_GL_SELECT); + + c->AllowGLThreadBufferSubDataOpt = + screen->get_param(screen, PIPE_CAP_ALLOW_GLTHREAD_BUFFER_SUBDATA_OPT); } |