[Mesa-dev] [PATCH] dri_util: fallback to core with drivers not supporting compat for 3.1

Andres Gomez agomez at igalia.com
Fri Mar 2 22:55:46 UTC 2018


2599b92eb97 changed Mesa's behavior to allow Compatiblity profile with
3.1, and fail when the driver doesn't implement it, if the Core
profile is not requested by applications.

Formerly, when requesting a 3.1 Compatibility profile Mesa would
always fall back into a Core profile. We go back to that behavior now
so, if the specific driver is not supporting 3.1 with Compatibility
profile, we will keep falling back into 3.1 Core.

Fixes: a0c8b49284e ("mesa: enable OpenGL 3.1 with ARB_compatibility")

Cc: Marek Olšák <marek.olsak at amd.com>
Cc: Ian Romanick <ian.d.romanick at intel.com>
Cc: Kenneth Graunke <kenneth at whitecape.org>
Cc: Eric Engestrom <eric.engestrom at imgtec.com>
Cc: Emil Velikov <emil.velikov at collabora.com>
Signed-off-by: Andres Gomez <agomez at igalia.com>
---
 docs/features.txt                      |  4 ++--
 src/mesa/drivers/dri/common/dri_util.c | 10 ++++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/docs/features.txt b/docs/features.txt
index 5eae34bf0df..d53dd805b1d 100644
--- a/docs/features.txt
+++ b/docs/features.txt
@@ -25,8 +25,8 @@ not started
 # OpenGL Core and Compatibility context support
 
 Some drivers do not support the Compatibility profile or ARB_compatibility.
-Such drivers are limited to OpenGL 3.0 if the Core profile is not requested
-by applications. Some of the later GL features are exposed in the 3.0 context
+Such drivers are limited to use OpenGL 3.1 and later in Core
+profile. Some of the later GL features are exposed in the 3.0 context
 as extensions.
 
 
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index a34f38d6114..53461dfb4e0 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -381,6 +381,16 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
 	}
     }
 
+    /* The specific Mesa driver may not support the GL_ARB_compatibilty
+     * extension or the compatibility profile.  In that case, we treat an
+     * API_OPENGL_COMPAT 3.1 as API_OPENGL_CORE. We reject API_OPENGL_COMPAT
+     * 3.2+ in any case.
+     */
+    if (mesa_api == API_OPENGL_COMPAT &&
+        ctx_config.major_version == 3 && ctx_config.minor_version == 1 &&
+        screen->max_gl_compat_version < 31)
+       mesa_api = API_OPENGL_CORE;
+
     if (mesa_api == API_OPENGL_COMPAT
         && ((ctx_config.major_version > 3)
             || (ctx_config.major_version == 3 &&
-- 
2.16.1



More information about the mesa-dev mailing list