55 lines
1.7 KiB
Diff
55 lines
1.7 KiB
Diff
From b788d8ee10adf01acd6d139ea7f73ab6f58fcc45 Mon Sep 17 00:00:00 2001
|
|
From: Imagination Technologies <powervr@imgtec.com>
|
|
Date: Thu, 23 Nov 2017 15:50:21 +0000
|
|
Subject: [PATCH 016/168] dri: use a supported API in driCreateNewContext
|
|
|
|
Don't assume the screen supports OpenGL when creating a new context,
|
|
use an API that the screen supports.
|
|
---
|
|
src/gallium/frontends/dri/dri_util.c | 14 +++++++++++++-
|
|
1 file changed, 13 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/gallium/frontends/dri/dri_util.c b/src/gallium/frontends/dri/dri_util.c
|
|
index e8729dac712..6c3ce760ab0 100644
|
|
--- a/src/gallium/frontends/dri/dri_util.c
|
|
+++ b/src/gallium/frontends/dri/dri_util.c
|
|
@@ -48,6 +48,7 @@
|
|
#include "main/version.h"
|
|
#include "main/debug_output.h"
|
|
#include "main/errors.h"
|
|
+#include "util/bitscan.h"
|
|
|
|
driOptionDescription __dri2ConfigOptions[] = {
|
|
DRI_CONF_SECTION_DEBUG
|
|
@@ -489,7 +490,11 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
|
|
mesa_api = API_OPENGLES;
|
|
break;
|
|
case __DRI_API_GLES2:
|
|
+ ctx_config.major_version = 2;
|
|
+ mesa_api = API_OPENGLES2;
|
|
+ break;
|
|
case __DRI_API_GLES3:
|
|
+ ctx_config.major_version = 3;
|
|
mesa_api = API_OPENGLES2;
|
|
break;
|
|
case __DRI_API_OPENGL_CORE:
|
|
@@ -675,7 +680,14 @@ static __DRIcontext *
|
|
driCreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
|
|
__DRIcontext *shared, void *data)
|
|
{
|
|
- return driCreateNewContextForAPI(screen, __DRI_API_OPENGL,
|
|
+ int apifs;
|
|
+
|
|
+ apifs = ffs(screen->api_mask);
|
|
+
|
|
+ if (!apifs)
|
|
+ return NULL;
|
|
+
|
|
+ return driCreateNewContextForAPI(screen, apifs - 1,
|
|
config, shared, data);
|
|
}
|
|
|
|
--
|
|
2.17.1
|
|
|