Mesa (9.1): glx: Initialize OpenGL version to 1.0
Carl Worth
cworth at kemper.freedesktop.org
Thu Oct 3 23:15:58 UTC 2013
Module: Mesa
Branch: 9.1
Commit: 68473d07d44835dad202597ee7957663f81808d2
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=68473d07d44835dad202597ee7957663f81808d2
Author: Rico Schüller <kgbricola at web.de>
Date: Sun Sep 1 21:30:19 2013 +0200
glx: Initialize OpenGL version to 1.0
The old code in dri2_glx suffered from a typographical error that caused
the default version to be 2.1 instead of 1.2 (minimum required by the
Linux OpenGL ABI). drisw_glx had a similar error resulting in a default
version of 0.1.
Some driver/card combinations (r200/RV280, i915/915G) don't support
OpenGL 2.1. These create in some corner cases an indirect context
instead of a direct context when calling glXCreateContextAttribsARB().
This happens because of a bad default value. To avoid this, just used
the default value specified by the GLX_ARB_create_context specification:
"The default values for GLX_CONTEXT_MAJOR_VERSION_ARB and
GLX_CONTEXT_MINOR_VERSION_ARB are 1 and 0 respectively. In this
case, implementations will typically return the most recent version
of OpenGL they support which is backwards compatible with OpenGL 1.0
(e.g. 3.0, 3.1 + GL_ARB_compatibility, or 3.2 compatibility
profile)"
Refactor all the default value setting to dri2_convert_glx_attribs, and
make sure the correct defaults are set in that one place.
Signed-off-by: Rico Schüller <kgbricola at web.de>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Bugzilla http://bugs.winehq.org/show_bug.cgi?id=34238
Cc: "9.1 9.2" <mesa-stable at lists.freedesktop.org>
(cherry picked from commit 8b302e1635534bfc6ed3ad671f2428470b3a765d)
Conflicts:
src/glx/dri2_glx.c
src/glx/dri_common.c
src/glx/drisw_glx.c
---
src/glx/dri2_glx.c | 8 ++++----
src/glx/dri_common.c | 12 ++++++------
src/glx/drisw_glx.c | 8 ++++----
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 1b636cd..6853801 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -254,11 +254,11 @@ dri2_create_context_attribs(struct glx_screen *base,
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) config_base;
__DRIcontext *shared = NULL;
- uint32_t minor_ver = 1;
- uint32_t major_ver = 2;
- uint32_t flags = 0;
+ uint32_t minor_ver;
+ uint32_t major_ver;
+ uint32_t flags;
unsigned api;
- int reset = __DRI_CTX_RESET_NO_NOTIFICATION;
+ int reset;
uint32_t ctx_attribs[2 * 5];
unsigned num_ctx_attribs = 0;
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index 1bf20ec..37c72f4 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -465,8 +465,13 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
uint32_t profile;
int render_type = GLX_RGBA_TYPE;
+ *major_ver = 1;
+ *minor_ver = 0;
+ *reset = __DRI_CTX_RESET_NO_NOTIFICATION;
+ *flags = 0;
+ *api = __DRI_API_OPENGL;
+
if (num_attribs == 0) {
- *api = __DRI_API_OPENGL;
return true;
}
@@ -477,10 +482,6 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
return false;
}
- *major_ver = 1;
- *minor_ver = 0;
- *reset = __DRI_CTX_RESET_NO_NOTIFICATION;
-
for (i = 0; i < num_attribs; i++) {
switch (attribs[i * 2]) {
case GLX_CONTEXT_MAJOR_VERSION_ARB:
@@ -520,7 +521,6 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
}
}
- *api = __DRI_API_OPENGL;
if (!got_profile) {
if (*major_ver > 3 || (*major_ver == 3 && *minor_ver >= 2))
*api = __DRI_API_OPENGL_CORE;
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 832e964..1fd7ee9 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -427,11 +427,11 @@ drisw_create_context_attribs(struct glx_screen *base,
struct drisw_screen *psc = (struct drisw_screen *) base;
__DRIcontext *shared = NULL;
- uint32_t minor_ver = 1;
- uint32_t major_ver = 0;
- uint32_t flags = 0;
+ uint32_t minor_ver;
+ uint32_t major_ver;
+ uint32_t flags;
unsigned api;
- int reset = __DRI_CTX_RESET_NO_NOTIFICATION;
+ int reset;
uint32_t ctx_attribs[2 * 4];
unsigned num_ctx_attribs = 0;
More information about the mesa-commit
mailing list