From 660a02af5a2a6482fbe27ff984fc7f33968e1ae2 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Wed, 27 Mar 2019 09:16:41 +0100 Subject: [PATCH] vrend,caps: Add a caps feature check version When we add new feature checks on the host side that is used to enable a cap conditionally in the guest that was enabled unconditionally before we might end up with a feature regression when a new mesa version is used with an old virglrenderer version that doesn't check for that cap. To work around this problem add a version id to the caps that corresponds to the features that are actually checked on the host so that it can be checked in the guest whether this cap was actually checked for or whether it should be enabled unconditionally. The id should be incremented whenever a new feature check is added that might result in a feature regression in the guest when run on an old host. Signed-off-by: Gert Wollny Reviewed-by: Pohsien Wang Signed-off-by: Dave Airlie --- src/virgl_hw.h | 1 + src/vrend_renderer.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/virgl_hw.h b/src/virgl_hw.h index df4188c..bebf4ad 100644 --- a/src/virgl_hw.h +++ b/src/virgl_hw.h @@ -367,6 +367,7 @@ struct virgl_caps_v2 { uint32_t max_atomic_counter_buffers[6]; uint32_t max_combined_atomic_counters; uint32_t max_combined_atomic_counter_buffers; + uint32_t host_feature_check_version; }; union virgl_caps { diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index af1e70c..ab62264 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -8508,6 +8508,12 @@ static void vrend_renderer_fill_caps_v2(int gl_ver, int gles_ver, union virgl_c GLint max; GLfloat range[2]; + /* 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 */ + caps->v2.host_feature_check_version = 1; + glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, range); caps->v2.min_aliased_point_size = range[0]; caps->v2.max_aliased_point_size = range[1];