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>
This commit is contained in:
@@ -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:
|
||||
|
||||
|
@@ -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:
|
||||
|
@@ -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:
|
||||
|
@@ -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! */
|
||||
|
@@ -992,5 +992,8 @@ struct gl_constants
|
||||
|
||||
/** Use hardware accelerated GL_SELECT */
|
||||
bool HardwareAcceleratedSelect;
|
||||
|
||||
/** Allow GLThread to convert glBuffer */
|
||||
bool AllowGLThreadBufferSubDataOpt;
|
||||
};
|
||||
#endif
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user