From caf4dc035dfeb7006d75b7a3f0855f8910beceb8 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Fri, 4 Jun 2021 05:35:55 +0000 Subject: [PATCH] vrend: forward the host renderer hardware info Some game engines rely on the real hardware info to adjust default graphics quality and other attributes. Signed-off-by: Yiwei Zhang Reviewed-by: Gert Wollny --- src/virgl_hw.h | 1 + src/vrend_renderer.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/virgl_hw.h b/src/virgl_hw.h index dce8cbc..d258d17 100644 --- a/src/virgl_hw.h +++ b/src/virgl_hw.h @@ -595,6 +595,7 @@ struct virgl_caps_v2 { struct virgl_supported_format_mask scanout; uint32_t capability_bits_v2; uint32_t max_video_memory; + char renderer[64]; }; union virgl_caps { diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 5c7022a..1c115ce 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -10210,13 +10210,17 @@ static void vrend_renderer_fill_caps_v2(int gl_ver, int gles_ver, union virgl_c GLint max; GLfloat range[2]; uint32_t video_memory; + const char *renderer = (const char *)glGetString(GL_RENDERER); /* Count this up when you add a feature flag that is used to set a CAP in * the guest that was set unconditionally before. Then check that flag and * this value to avoid regressions when a guest with a new mesa version is * run on an old virgl host. Use it also to indicate non-cap fixes on the * host that help enable features in the guest. */ - caps->v2.host_feature_check_version = 4; + caps->v2.host_feature_check_version = 5; + + /* Forward host GL_RENDERER to the guest. */ + strncpy(caps->v2.renderer, renderer, sizeof(caps->v2.renderer) - 1); glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, range); caps->v2.min_aliased_point_size = range[0]; @@ -10475,7 +10479,6 @@ static void vrend_renderer_fill_caps_v2(int gl_ver, int gles_ver, union virgl_c if (has_feature(feat_arb_buffer_storage) && !vrend_state.use_external_blob) { const char *vendor = (const char *)glGetString(GL_VENDOR); - const char *renderer = (const char*)glGetString(GL_RENDERER); bool is_mesa = ((strstr(renderer, "Mesa") != NULL) || (strstr(renderer, "DRM") != NULL)); /* * Intel GPUs (aside from Atom, which doesn't expose GL4.5) are cache-coherent.