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 <zzyiwei@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
macos/master
Yiwei Zhang 4 years ago committed by Gert Wollny
parent d54bd30d63
commit caf4dc035d
  1. 1
      src/virgl_hw.h
  2. 7
      src/vrend_renderer.c

@ -595,6 +595,7 @@ struct virgl_caps_v2 {
struct virgl_supported_format_mask scanout; struct virgl_supported_format_mask scanout;
uint32_t capability_bits_v2; uint32_t capability_bits_v2;
uint32_t max_video_memory; uint32_t max_video_memory;
char renderer[64];
}; };
union virgl_caps { union virgl_caps {

@ -10210,13 +10210,17 @@ static void vrend_renderer_fill_caps_v2(int gl_ver, int gles_ver, union virgl_c
GLint max; GLint max;
GLfloat range[2]; GLfloat range[2];
uint32_t video_memory; 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 /* 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 * 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 * 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 * run on an old virgl host. Use it also to indicate non-cap fixes on the
* host that help enable features in the guest. */ * 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); glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, range);
caps->v2.min_aliased_point_size = range[0]; 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) { if (has_feature(feat_arb_buffer_storage) && !vrend_state.use_external_blob) {
const char *vendor = (const char *)glGetString(GL_VENDOR); 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)); 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. * Intel GPUs (aside from Atom, which doesn't expose GL4.5) are cache-coherent.

Loading…
Cancel
Save