From c14d755f3d3ea0f1501da5da021d59f26379d1f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 18 Oct 2021 08:16:23 -0400 Subject: [PATCH] glthread: add an option to make glCheckFramebufferStatus a no-op Acked-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/auxiliary/pipe-loader/driinfo_gallium.h | 1 + src/gallium/auxiliary/util/u_driconf.c | 1 + src/gallium/include/frontend/api.h | 1 + src/mapi/glapi/gen/ARB_framebuffer_object.xml | 3 ++- src/mesa/main/mtypes.h | 7 +++++++ src/mesa/state_tracker/st_extensions.c | 1 + src/util/00-mesa-defaults.conf | 1 + src/util/driconf.h | 4 ++++ 8 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h index 3b630f77698..d93856dd35d 100644 --- a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h +++ b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h @@ -31,6 +31,7 @@ DRI_CONF_SECTION_DEBUG DRI_CONF_GLSL_CORRECT_DERIVATIVES_AFTER_DISCARD(false) DRI_CONF_GLSL_IGNORE_WRITE_TO_READONLY_VAR(false) DRI_CONF_ALLOW_DRAW_OUT_OF_ORDER(false) + DRI_CONF_GLTHREAD_NOP_CHECK_FRAMEBUFFER_STATUS(false) DRI_CONF_FORCE_COMPAT_PROFILE(false) DRI_CONF_FORCE_GL_NAMES_REUSE(false) DRI_CONF_TRANSCODE_ETC(false) diff --git a/src/gallium/auxiliary/util/u_driconf.c b/src/gallium/auxiliary/util/u_driconf.c index 8ace8474766..531a55c2753 100644 --- a/src/gallium/auxiliary/util/u_driconf.c +++ b/src/gallium/auxiliary/util/u_driconf.c @@ -58,6 +58,7 @@ u_driconf_fill_st_options(struct st_config_options *options, query_bool_option(force_glsl_abs_sqrt); query_bool_option(allow_glsl_cross_stage_interpolation_mismatch); query_bool_option(allow_draw_out_of_order); + query_bool_option(glthread_nop_check_framebuffer_status); query_bool_option(ignore_map_unsynchronized); query_bool_option(force_gl_names_reuse); query_bool_option(transcode_etc); diff --git a/src/gallium/include/frontend/api.h b/src/gallium/include/frontend/api.h index 5b9f9c63d6d..6514d87d81a 100644 --- a/src/gallium/include/frontend/api.h +++ b/src/gallium/include/frontend/api.h @@ -234,6 +234,7 @@ struct st_config_options bool force_glsl_abs_sqrt; bool allow_glsl_cross_stage_interpolation_mismatch; bool allow_draw_out_of_order; + bool glthread_nop_check_framebuffer_status; bool ignore_map_unsynchronized; bool force_integer_tex_nearest; bool force_gl_names_reuse; diff --git a/src/mapi/glapi/gen/ARB_framebuffer_object.xml b/src/mapi/glapi/gen/ARB_framebuffer_object.xml index 295175c8816..44f274691c1 100644 --- a/src/mapi/glapi/gen/ARB_framebuffer_object.xml +++ b/src/mapi/glapi/gen/ARB_framebuffer_object.xml @@ -220,7 +220,8 @@ - + diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 4bb2d8844d5..f8f12c03152 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -4305,6 +4305,13 @@ struct gl_constants * produce 0 instead of leaving the texture content undefined). */ bool NoClippingOnCopyTex; + + /** + * Force glthread to always return GL_FRAMEBUFFER_COMPLETE to prevent + * synchronization. Used for apps that call it every frame or multiple times + * a frame, but always getting framebuffer completeness. + */ + bool GLThreadNopCheckFramebufferStatus; }; diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index f27051115d1..5e731bec413 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -1840,6 +1840,7 @@ void st_init_extensions(struct pipe_screen *screen, } consts->AllowDrawOutOfOrder = options->allow_draw_out_of_order; + consts->GLThreadNopCheckFramebufferStatus = options->glthread_nop_check_framebuffer_status; bool prefer_nir = PIPE_SHADER_IR_NIR == screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_PREFERRED_IR); diff --git a/src/util/00-mesa-defaults.conf b/src/util/00-mesa-defaults.conf index 9809352c9b3..8fe9a8941bd 100644 --- a/src/util/00-mesa-defaults.conf +++ b/src/util/00-mesa-defaults.conf @@ -766,6 +766,7 @@ TODO: document the other workarounds.