<div dir="ltr"><div>Reviewed-by: Marek Olšák <<a href="mailto:marek.olsak@amd.com">marek.olsak@amd.com</a>><br><br></div>Marek<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Mar 18, 2018 at 8:41 PM, Andres Gomez <span dir="ltr"><<a href="mailto:agomez@igalia.com" target="_blank">agomez@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Currently, any driver that does not support the ARB_compatibility<br>
extension will fail on GL3.1 context creation if the application does<br>
not request the forward-compatiblity flag.<br>
<br>
Restore the original check which changes mesa_api to API_OPENGL_CORE,<br>
only when:<br>
 - GL3.1 is requested, without the forward-compatiblity flag.<br>
 - driver does not support ARB_compatibility - as deduced by<br>
max_gl_compat_version.<br>
<br>
Fixes: a0c8b49284e ("mesa: enable OpenGL 3.1 with ARB_compatibility")<br>
<br>
v2:<br>
 - Improve commit log (Emil).<br>
 - Provide a correct explanation on the features documentation (Ian).<br>
<br>
Cc: Marek Olšák <<a href="mailto:marek.olsak@amd.com">marek.olsak@amd.com</a>><br>
Cc: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a>><br>
Cc: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
Cc: Eric Engestrom <<a href="mailto:eric.engestrom@imgtec.com">eric.engestrom@imgtec.com</a>><br>
Cc: Emil Velikov <<a href="mailto:emil.velikov@collabora.com">emil.velikov@collabora.com</a>><br>
Signed-off-by: Andres Gomez <<a href="mailto:agomez@igalia.com">agomez@igalia.com</a>><br>
Reviewed-by: Emil Velikov <<a href="mailto:emil.velikov@collabora.com">emil.velikov@collabora.com</a>><br>
---<br>
 docs/features.txt                      | 11 +++++++----<br>
 src/mesa/drivers/dri/common/<wbr>dri_util.c | 10 ++++++++++<br>
 2 files changed, 17 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/docs/features.txt b/docs/features.txt<br>
index 5eae34bf0df..a089d923ad7 100644<br>
--- a/docs/features.txt<br>
+++ b/docs/features.txt<br>
@@ -24,10 +24,13 @@ not started<br>
<br>
 # OpenGL Core and Compatibility context support<br>
<br>
-Some drivers do not support the Compatibility profile or ARB_compatibility.<br>
-Such drivers are limited to OpenGL 3.0 if the Core profile is not requested<br>
-by applications. Some of the later GL features are exposed in the 3.0 context<br>
-as extensions.<br>
+Some drivers do not support the Compatibility profile or the<br>
+ARB_compatibility extensions.  If an application does not request a<br>
+specific version without the forward-compatiblity flag, such drivers<br>
+will be limited to OpenGL 3.0.  If an application requests OpenGL 3.1,<br>
+it will get a context that may or may not have the ARB_compatibility<br>
+extension enabled.  Some of the later GL features are exposed in the 3.0<br>
+context as extensions.<br>
<br>
<br>
 Feature                                                 Status<br>
diff --git a/src/mesa/drivers/dri/common/<wbr>dri_util.c b/src/mesa/drivers/dri/common/<wbr>dri_util.c<br>
index 3f780d155b8..0b94d19fa5d 100644<br>
--- a/src/mesa/drivers/dri/common/<wbr>dri_util.c<br>
+++ b/src/mesa/drivers/dri/common/<wbr>dri_util.c<br>
@@ -379,6 +379,16 @@ driCreateContextAttribs(__<wbr>DRIscreen *screen, int api,<br>
        }<br>
     }<br>
<br>
+    /* The specific Mesa driver may not support the GL_ARB_compatibilty<br>
+     * extension or the compatibility profile.  In that case, we treat an<br>
+     * API_OPENGL_COMPAT 3.1 as API_OPENGL_CORE. We reject API_OPENGL_COMPAT<br>
+     * 3.2+ in any case.<br>
+     */<br>
+    if (mesa_api == API_OPENGL_COMPAT &&<br>
+        ctx_config.major_version == 3 && ctx_config.minor_version == 1 &&<br>
+        screen->max_gl_compat_version < 31)<br>
+       mesa_api = API_OPENGL_CORE;<br>
+<br>
     if (mesa_api == API_OPENGL_COMPAT<br>
         && ((ctx_config.major_version > 3)<br>
             || (ctx_config.major_version == 3 &&<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.16.1<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>