aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/glx/glxdri2.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-07-06 09:12:35 +0200
committermarha <marha@users.sourceforge.net>2012-07-06 09:13:41 +0200
commit336bad93d146931c160d8517edfdf0bee49ad9f7 (patch)
treed0fbdb5a716e78aa6318c7ddd49bd3e09e13379f /xorg-server/glx/glxdri2.c
parentfc8f37239f3af088819c18f5632b2608954af73a (diff)
downloadvcxsrv-336bad93d146931c160d8517edfdf0bee49ad9f7.tar.gz
vcxsrv-336bad93d146931c160d8517edfdf0bee49ad9f7.tar.bz2
vcxsrv-336bad93d146931c160d8517edfdf0bee49ad9f7.zip
randrproto fontconfig mesa xserver git update 6 Jul 2012
Diffstat (limited to 'xorg-server/glx/glxdri2.c')
-rw-r--r--xorg-server/glx/glxdri2.c97
1 files changed, 93 insertions, 4 deletions
diff --git a/xorg-server/glx/glxdri2.c b/xorg-server/glx/glxdri2.c
index 7b76c3a5f..1e99179d4 100644
--- a/xorg-server/glx/glxdri2.c
+++ b/xorg-server/glx/glxdri2.c
@@ -59,6 +59,16 @@ typedef struct __GLXDRIscreen __GLXDRIscreen;
typedef struct __GLXDRIcontext __GLXDRIcontext;
typedef struct __GLXDRIdrawable __GLXDRIdrawable;
+
+#ifdef __DRI2_ROBUSTNESS
+#define ALL_DRI_CTX_FLAGS (__DRI_CTX_FLAG_DEBUG \
+ | __DRI_CTX_FLAG_FORWARD_COMPATIBLE \
+ | __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS)
+#else
+#define ALL_DRI_CTX_FLAGS (__DRI_CTX_FLAG_DEBUG \
+ | __DRI_CTX_FLAG_FORWARD_COMPATIBLE)
+#endif
+
struct __GLXDRIscreen {
__GLXscreen base;
__DRIscreen *driScreen;
@@ -381,7 +391,7 @@ __glXDRIscreenDestroy(__GLXscreen * baseScreen)
static Bool
dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
unsigned *major_ver, unsigned *minor_ver,
- uint32_t *flags, unsigned *error)
+ uint32_t *flags, int *api, int *reset, unsigned *error)
{
unsigned i;
@@ -395,6 +405,11 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
*major_ver = 1;
*minor_ver = 0;
+#ifdef __DRI2_ROBUSTNESS
+ *reset = __DRI_CTX_RESET_NO_NOTIFICATION;
+#else
+ (void) reset;
+#endif
for (i = 0; i < num_attribs; i++) {
switch (attribs[i * 2]) {
@@ -409,6 +424,42 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
break;
case GLX_RENDER_TYPE:
break;
+ case GLX_CONTEXT_PROFILE_MASK_ARB:
+ switch (attribs[i * 2 + 1]) {
+ case GLX_CONTEXT_CORE_PROFILE_BIT_ARB:
+ *api = __DRI_API_OPENGL_CORE;
+ break;
+ case GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB:
+ *api = __DRI_API_OPENGL;
+ break;
+ case GLX_CONTEXT_ES2_PROFILE_BIT_EXT:
+ *api = __DRI_API_GLES2;
+ break;
+ default:
+ *error = __glXError(GLXBadProfileARB);
+ return False;
+ }
+ break;
+#ifdef __DRI2_ROBUSTNESS
+ case GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB:
+ if (screen->dri2->base.version >= 4) {
+ *error = BadValue;
+ return False;
+ }
+
+ switch (attribs[i * 2 + 1]) {
+ case GLX_NO_RESET_NOTIFICATION_ARB:
+ *reset = __DRI_CTX_RESET_NO_NOTIFICATION;
+ break;
+ case GLX_LOSE_CONTEXT_ON_RESET_ARB:
+ *reset = __DRI_CTX_RESET_LOSE_CONTEXT;
+ break;
+ default:
+ *error = BadValue;
+ return False;
+ }
+ break;
+#endif
default:
/* If an unknown attribute is received, fail.
*/
@@ -419,11 +470,21 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
/* Unknown flag value.
*/
- if (*flags & ~(__DRI_CTX_FLAG_DEBUG | __DRI_CTX_FLAG_FORWARD_COMPATIBLE)) {
+ if ((*flags & ~ALL_DRI_CTX_FLAGS) != 0) {
*error = BadValue;
return False;
}
+ /* If the core profile is requested for a GL version is less than 3.2,
+ * request the non-core profile from the DRI driver. The core profile
+ * only makes sense for GL versions >= 3.2, and many DRI drivers that
+ * don't support OpenGL 3.2 may fail the request for a core profile.
+ */
+ if (*api == __DRI_API_OPENGL_CORE
+ && (*major_ver < 3 || (*major_ver < 3 && *minor_ver < 2))) {
+ *api == __DRI_API_OPENGL;
+ }
+
*error = Success;
return True;
}
@@ -447,11 +508,14 @@ create_driver_context(__GLXDRIcontext * context,
unsigned major_ver;
unsigned minor_ver;
uint32_t flags;
+ int reset;
+ int api;
if (num_attribs != 0) {
if (!dri2_convert_glx_attribs(num_attribs, attribs,
&major_ver, &minor_ver,
- &flags, (unsigned *) error))
+ &flags, &api, &reset,
+ (unsigned *) error))
return NULL;
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MAJOR_VERSION;
@@ -467,11 +531,19 @@ create_driver_context(__GLXDRIcontext * context,
*/
ctx_attribs[num_ctx_attribs++] = flags;
}
+
+#ifdef __DRI2_ROBUSTNESS
+ if (reset != __DRI_CTX_NO_RESET_NOTIFICATION) {
+ ctx_attribs[num_ctx_attribs++] =
+ __DRI_CTX_ATTRIB_RESET_NOTIFICATION;
+ ctx_attribs[num_ctx_attribs++] = reset;
+ }
+#endif
}
context->driContext =
(*screen->dri2->createContextAttribs)(screen->driScreen,
- __DRI_API_OPENGL,
+ api,
config->driConfig,
driShare,
num_ctx_attribs / 2,
@@ -786,7 +858,14 @@ initializeExtensions(__GLXDRIscreen * screen)
if (screen->dri2->base.version >= 3) {
__glXEnableExtension(screen->glx_enable_bits,
"GLX_ARB_create_context");
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_ARB_create_context_profile");
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_EXT_create_context_es2_profile");
LogMessage(X_INFO, "AIGLX: enabled GLX_ARB_create_context\n");
+ LogMessage(X_INFO, "AIGLX: enabled GLX_ARB_create_context_profile\n");
+ LogMessage(X_INFO,
+ "AIGLX: enabled GLX_EXT_create_context_es2_profile\n");
}
#endif
@@ -823,6 +902,16 @@ initializeExtensions(__GLXDRIscreen * screen)
}
#endif
+#ifdef __DRI2_ROBUSTNESS
+ if (strcmp(extensions[i]->name, __DRI2_ROBUSTNESS) == 0 &&
+ screen->dri2->base.version >= 3) {
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_ARB_create_context_robustness");
+ LogMessage(X_INFO,
+ "AIGLX: enabled GLX_ARB_create_context_robustness\n");
+ }
+#endif
+
/* Ignore unknown extensions */
}
}