<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Feb 14, 2018 7:38 AM, "Eric Engestrom" <<a href="mailto:eric.engestrom@imgtec.com">eric.engestrom@imgtec.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Brendan King <<a href="mailto:Brendan.King@imgtec.com">Brendan.King@imgtec.com</a>><br>
<br>
Don't assume the screen supports OpenGL when creating a new context,<br>
use an API that the screen supports.<br>
<br>
Signed-off-by: Brendan King <<a href="mailto:Brendan.King@imgtec.com">Brendan.King@imgtec.com</a>><br>
Reviewed-by: Eric Engestrom <<a href="mailto:eric.engestrom@imgtec.com">eric.engestrom@imgtec.com</a>><br>
[Eric: rebased on current git HEAD]<br>
Signed-off-by: Eric Engestrom <<a href="mailto:eric.engestrom@imgtec.com">eric.engestrom@imgtec.com</a>><br>
---<br>
src/mesa/drivers/dri/common/<wbr>dri_util.c | 14 +++++++++++++-<br>
1 file changed, 13 insertions(+), 1 deletion(-)<br>
<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 e6a7d2391a78c45d45a1..<wbr>3f32b34132e75228e0e0 100644<br>
--- a/src/mesa/drivers/dri/common/<wbr>dri_util.c<br>
+++ b/src/mesa/drivers/dri/common/<wbr>dri_util.c<br>
@@ -49,6 +49,7 @@<br>
#include "main/debug_output.h"<br>
#include "main/errors.h"<br>
#include "main/macros.h"<br>
+#include "util/bitscan.h"<br>
<br>
const char __dri2ConfigOptions[] =<br>
DRI_CONF_BEGIN<br>
@@ -325,7 +326,11 @@ driCreateContextAttribs(__<wbr>DRIscreen *screen, int api,<br>
mesa_api = API_OPENGLES;<br>
break;<br>
case __DRI_API_GLES2:<br>
+ ctx_config.major_version = 2;<br>
+ mesa_api = API_OPENGLES2;<br>
+ break;<br>
case __DRI_API_GLES3:<br>
+ ctx_config.major_version = 3;<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">Are you sure about this change? Doesn't seem related, and I'm about 20% sure there was some reason for the current thing.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
mesa_api = API_OPENGLES2;<br>
break;<br>
case __DRI_API_OPENGL_CORE:<br>
@@ -514,7 +519,14 @@ static __DRIcontext *<br>
driCreateNewContext(__<wbr>DRIscreen *screen, const __DRIconfig *config,<br>
__DRIcontext *shared, void *data)<br>
{<br>
- return driCreateNewContextForAPI(<wbr>screen, __DRI_API_OPENGL,<br>
+ int apifs;<br>
+<br>
+ apifs = ffs(screen->api_mask);<br>
+<br>
+ if (!apifs)<br>
+ return NULL;<br>
+<br>
+ return driCreateNewContextForAPI(<wbr>screen, apifs - 1,<br>
config, shared, data);<br>
}<br>
<font color="#888888"><br>
--<br>
Cheers,<br>
Eric<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></blockquote></div><br></div></div></div>