mesa: enable GL name reuse by default for all drivers except virgl

v2: detect qemu, crossvm

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> (v1)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32715>
This commit is contained in:
Marek Olšák
2024-12-19 02:17:13 -05:00
committed by Marge Bot
parent b15c8fe3f1
commit 842c91300f
2 changed files with 17 additions and 10 deletions

View File

@@ -42,10 +42,12 @@
#include "syncobj.h"
#include "texobj.h"
#include "texturebindless.h"
#include "pipe/p_screen.h"
#include "util/hash_table.h"
#include "util/set.h"
#include "util/u_memory.h"
#include "util/u_process.h"
static void
free_shared_state(struct gl_context *ctx, struct gl_shared_state *shared);
@@ -71,7 +73,21 @@ _mesa_alloc_shared_state(struct gl_context *ctx,
return NULL;
simple_mtx_init(&shared->Mutex, mtx_plain);
shared->ReuseGLNames = options->reuse_gl_names == 1;
const char *driver_name = ctx->screen->get_name(ctx->screen);
bool is_virgl_guest = !strcmp(driver_name, "virgl");
const char *process_name = util_get_process_name();
bool is_virgl_host = strstr(process_name, "qemu-system") == process_name ||
strstr(process_name, "crosvm") ||
strstr(process_name, "virgl_test_server");
/* Enable GL name reuse for all drivers by default except virgl, which
* is hopelessly broken.
*
* To disable it, set reuse_gl_names=0 in the environment.
*/
if (!is_virgl_guest && !is_virgl_host)
shared->ReuseGLNames = options->reuse_gl_names != 0;
_mesa_InitHashTable(&shared->DisplayList, shared->ReuseGLNames);
_mesa_InitHashTable(&shared->TexObjects, shared->ReuseGLNames);

View File

@@ -383,7 +383,6 @@ TODO: document the other workarounds.
<option name="vblank_mode" value="0" />
<option name="allow_glsl_extension_directive_midshader" value="true" />
<option name="allow_glsl_120_subset_in_110" value="true" />
<option name="reuse_gl_names" value="1" />
<!-- This makes it use GL_NVX_gpu_memory_info to query memory info
instead of non-existent GLX_AMD_gpu_association. Yes, it checks
the vendor string, not the extension list. -->
@@ -883,14 +882,6 @@ TODO: document the other workarounds.
<option name="glsl_correct_derivatives_after_discard" value="true" />
</application>
<!-- Workaround for STAR WARS: Knights of the Old Republic relying on
non-specified OpenGL behavior (expecting texture names to be
small enough to fit in the static array).
-->
<application name="SWKOTOR (wine)" executable="swkotor.exe">
<option name="reuse_gl_names" value="1"/>
</application>
<application name="Assault Android Cactus (32-bit)" executable="cactus_demo.x86">
<option name="vs_position_always_precise" value="true" />
</application>