1
0

Accepting request 122414 from X11:XOrg

- no longer use obsolete %run_permissions; replaced it by 
  %set_permissions (bnc#764101)

- added patches to implement GLX_ARB_create_context extensions
  required for OpenGL 3.0 support (not upstream yet)

OBS-URL: https://build.opensuse.org/request/show/122414
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/xorg-x11-server?expand=0&rev=235
This commit is contained in:
Stephan Kulow 2012-05-29 09:37:34 +00:00 committed by Git OBS Bridge
commit 54181ac183
13 changed files with 1192 additions and 1 deletions

View File

@ -0,0 +1,51 @@
From 277985e545626c9a9bd82aafddac4f935d95a4e2 Mon Sep 17 00:00:00 2001
From: Ian Romanick <ian.d.romanick@intel.com>
Date: Mon, 5 Dec 2011 10:55:20 -0800
Subject: [PATCH 01/11] glx: Fix mishandling of shared contexts
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
---
glx/glxcmds.c | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 24fed8f..6fa10fe 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -251,20 +251,20 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
&shareglxc, &err))
return err;
- if (shareglxc->isDirect) {
- /*
- ** NOTE: no support for sharing display lists between direct
- ** contexts, even if they are in the same address space.
- */
-#if 0
- /* Disabling this code seems to allow shared display lists
- * and texture objects to work. We'll leave it disabled for now.
- */
+ /* Page 26 (page 32 of the PDF) of the GLX 1.4 spec says:
+ *
+ * "The server context state for all sharing contexts must exist
+ * in a single address space or a BadMatch error is generated."
+ *
+ * If the share context is indirect, force the new context to also be
+ * indirect. If the shard context is direct but the new context
+ * cannot be direct, generate BadMatch.
+ */
+ if (shareglxc->isDirect && !isDirect) {
client->errorValue = shareList;
return BadMatch;
-#endif
}
- else {
+ else if (!shareglxc->isDirect) {
/*
** Create an indirect context regardless of what the client asked
** for; this way we can share display list space with shareList.
--
1.7.3.4

View File

@ -0,0 +1,58 @@
From 2bbacf1fb21b98e8b9481931f131c176a0f78dc5 Mon Sep 17 00:00:00 2001
From: Ian Romanick <ian.d.romanick@intel.com>
Date: Fri, 2 Dec 2011 21:14:46 -0800
Subject: [PATCH 02/11] glx: Don't track GLClientmajorVersion or GLClientminorVersion
Nothing uses these fields anywhere in the server.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
---
glx/glxcmds.c | 2 --
glx/glxext.c | 2 --
glx/glxserver.h | 2 --
3 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 6fa10fe..5c70afa 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -2396,8 +2396,6 @@ __glXDisp_ClientInfo(__GLXclientState * cl, GLbyte * pc)
if (!memchr(buf, 0, (client->req_len << 2) - sizeof(xGLXClientInfoReq)))
return BadLength;
- cl->GLClientmajorVersion = req->major;
- cl->GLClientminorVersion = req->minor;
free(cl->GLClientextensions);
cl->GLClientextensions = strdup(buf);
diff --git a/glx/glxext.c b/glx/glxext.c
index acd696e..599f029 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -281,8 +281,6 @@ glxClientCallback(CallbackListPtr *list, pointer closure, pointer data)
** By default, assume that the client supports
** GLX major version 1 minor version 0 protocol.
*/
- cl->GLClientmajorVersion = 1;
- cl->GLClientminorVersion = 0;
cl->client = pClient;
break;
diff --git a/glx/glxserver.h b/glx/glxserver.h
index 7076848..87c94d9 100644
--- a/glx/glxserver.h
+++ b/glx/glxserver.h
@@ -145,8 +145,6 @@ struct __GLXclientStateRec {
/* Back pointer to X client record */
ClientPtr client;
- int GLClientmajorVersion;
- int GLClientminorVersion;
char *GLClientextensions;
};
--
1.7.3.4

View File

@ -0,0 +1,141 @@
From 71a819742edf386ace3cfaacc7dfe24b00f5ff7e Mon Sep 17 00:00:00 2001
From: Ian Romanick <ian.d.romanick@intel.com>
Date: Mon, 5 Dec 2011 10:56:07 -0800
Subject: [PATCH 03/11] glx: Extend __GLXscreen::createContext to take attributes
The attributes will be used for glXCreateContextAttribsARB additions
in follow-on patches.
v2: Add missing 'int *error' parameters noticed by Christopher James
Halse Rogers.
v3: Remove redundant 'int err;' declaration noticed by Christopher
James Halse Rogers. This was supposed to be in v2, but I missed it.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
---
glx/glxcmds.c | 10 ++++++++--
glx/glxdri.c | 12 +++++++++++-
glx/glxdri2.c | 5 ++++-
glx/glxdriswrast.c | 12 +++++++++++-
glx/glxscreens.h | 5 ++++-
5 files changed, 38 insertions(+), 6 deletions(-)
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 5c70afa..308c14a 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -276,8 +276,14 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
/*
** Allocate memory for the new context
*/
- if (!isDirect)
- glxc = pGlxScreen->createContext(pGlxScreen, config, shareglxc);
+ if (!isDirect) {
+ /* Without any attributes, the only error that the driver should be
+ * able to generate is BadAlloc. As result, just drop the error
+ * returned from the driver on the floor.
+ */
+ glxc = pGlxScreen->createContext(pGlxScreen, config, shareglxc,
+ 0, NULL, &err);
+ }
else
glxc = __glXdirectContextCreate(pGlxScreen, config, shareglxc);
if (!glxc) {
diff --git a/glx/glxdri.c b/glx/glxdri.c
index 9b8b66f..bc49f29 100644
--- a/glx/glxdri.c
+++ b/glx/glxdri.c
@@ -599,7 +599,10 @@ __glXDRIscreenDestroy(__GLXscreen * baseScreen)
static __GLXcontext *
__glXDRIscreenCreateContext(__GLXscreen * baseScreen,
__GLXconfig * glxConfig,
- __GLXcontext * baseShareContext)
+ __GLXcontext * baseShareContext,
+ unsigned num_attribs,
+ const uint32_t *attribs,
+ int *error)
{
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
__GLXDRIcontext *context, *shareContext;
@@ -611,6 +614,13 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
drm_context_t hwContext;
ScreenPtr pScreen = baseScreen->pScreen;
+ /* DRI1 cannot support createContextAttribs, so these parameters will
+ * never be used.
+ */
+ (void) num_attribs;
+ (void) attribs;
+ (void) error;
+
shareContext = (__GLXDRIcontext *) baseShareContext;
if (shareContext)
driShare = shareContext->driContext;
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index aa38295..656b577 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -380,7 +380,10 @@ __glXDRIscreenDestroy(__GLXscreen * baseScreen)
static __GLXcontext *
__glXDRIscreenCreateContext(__GLXscreen * baseScreen,
__GLXconfig * glxConfig,
- __GLXcontext * baseShareContext)
+ __GLXcontext * baseShareContext,
+ unsigned num_attribs,
+ const uint32_t *attribs,
+ int *error)
{
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
__GLXDRIcontext *context, *shareContext;
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index c69b4d2..b478398 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -257,7 +257,10 @@ __glXDRIscreenDestroy(__GLXscreen * baseScreen)
static __GLXcontext *
__glXDRIscreenCreateContext(__GLXscreen * baseScreen,
__GLXconfig * glxConfig,
- __GLXcontext * baseShareContext)
+ __GLXcontext * baseShareContext,
+ unsigned num_attribs,
+ const uint32_t *attribs,
+ int *error)
{
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
__GLXDRIcontext *context, *shareContext;
@@ -265,6 +268,13 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
const __DRIcoreExtension *core = screen->core;
__DRIcontext *driShare;
+ /* DRISWRAST won't support createContextAttribs, so these parameters will
+ * never be used.
+ */
+ (void) num_attribs;
+ (void) attribs;
+ (void) error;
+
shareContext = (__GLXDRIcontext *) baseShareContext;
if (shareContext)
driShare = shareContext->driContext;
diff --git a/glx/glxscreens.h b/glx/glxscreens.h
index d5420ee..7ef4657 100644
--- a/glx/glxscreens.h
+++ b/glx/glxscreens.h
@@ -117,7 +117,10 @@ struct __GLXscreen {
__GLXcontext *(*createContext) (__GLXscreen * screen,
__GLXconfig * modes,
- __GLXcontext * shareContext);
+ __GLXcontext * shareContext,
+ unsigned num_attribs,
+ const uint32_t *attribs,
+ int *error);
__GLXdrawable *(*createDrawable) (ClientPtr client,
__GLXscreen * context,
--
1.7.3.4

View File

@ -0,0 +1,84 @@
From e453ac810a2020d0b8a21f67bd0e4712558fd57b Mon Sep 17 00:00:00 2001
From: Ian Romanick <ian.d.romanick@intel.com>
Date: Mon, 5 Dec 2011 13:48:19 -0800
Subject: [PATCH 04/11] glx: Add tracking for GLX_ARB_create_context and GLX_ARB_create_context_profile
The formatting of the extension data table was mangled by indent.
This patch also undoes that and adds approripate control comments so
that indent won't do it again.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
---
glx/extension_string.c | 34 +++++++++++++++++++---------------
glx/extension_string.h | 4 +++-
2 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/glx/extension_string.c b/glx/extension_string.c
index 866f8bf..6a1a6c6 100644
--- a/glx/extension_string.c
+++ b/glx/extension_string.c
@@ -67,23 +67,27 @@ struct extension_info {
static const struct extension_info known_glx_extensions[] = {
/* GLX_ARB_get_proc_address is implemented on the client. */
- {GLX(ARB_multisample), VER(1, 4), Y,},
-
- {GLX(EXT_import_context), VER(0, 0), Y,},
- {GLX(EXT_texture_from_pixmap), VER(0, 0), Y,},
- {GLX(EXT_visual_info), VER(0, 0), Y,},
- {GLX(EXT_visual_rating), VER(0, 0), Y,},
-
- {GLX(MESA_copy_sub_buffer), VER(0, 0), N,},
- {GLX(OML_swap_method), VER(0, 0), Y,},
- {GLX(SGI_make_current_read), VER(1, 3), N,},
- {GLX(SGI_swap_control), VER(0, 0), N,},
- {GLX(SGIS_multisample), VER(0, 0), Y,},
- {GLX(SGIX_fbconfig), VER(1, 3), Y,},
- {GLX(SGIX_pbuffer), VER(1, 3), Y,},
- {GLX(SGIX_visual_select_group), VER(0, 0), Y,},
- {GLX(INTEL_swap_event), VER(1, 4), N,},
- {NULL}
+ /* *INDENT-OFF* */
+ { GLX(ARB_create_context), VER(0,0), N, },
+ { GLX(ARB_create_context_profile), VER(0,0), N, },
+ { GLX(ARB_multisample), VER(1,4), Y, },
+
+ { GLX(EXT_import_context), VER(0,0), Y, },
+ { GLX(EXT_texture_from_pixmap), VER(0,0), Y, },
+ { GLX(EXT_visual_info), VER(0,0), Y, },
+ { GLX(EXT_visual_rating), VER(0,0), Y, },
+
+ { GLX(MESA_copy_sub_buffer), VER(0,0), N, },
+ { GLX(OML_swap_method), VER(0,0), Y, },
+ { GLX(SGI_make_current_read), VER(1,3), N, },
+ { GLX(SGI_swap_control), VER(0,0), N, },
+ { GLX(SGIS_multisample), VER(0,0), Y, },
+ { GLX(SGIX_fbconfig), VER(1,3), Y, },
+ { GLX(SGIX_pbuffer), VER(1,3), Y, },
+ { GLX(SGIX_visual_select_group), VER(0,0), Y, },
+ { GLX(INTEL_swap_event), VER(1,4), N, },
+ { NULL }
+ /* *INDENT-ON* */
};
/**
diff --git a/glx/extension_string.h b/glx/extension_string.h
index e02213f..947bf89 100644
--- a/glx/extension_string.h
+++ b/glx/extension_string.h
@@ -36,7 +36,9 @@
enum {
/* GLX_ARB_get_proc_address is implemented on the client. */
- ARB_multisample_bit = 0,
+ ARB_create_context_bit = 0,
+ ARB_create_context_profile_bit,
+ ARB_multisample_bit,
EXT_import_context_bit,
EXT_texture_from_pixmap_bit,
EXT_visual_info_bit,
--
1.7.3.4

View File

@ -0,0 +1,210 @@
From 228d954789f97baf230c97c29a515abb8fd4b6d1 Mon Sep 17 00:00:00 2001
From: Ian Romanick <ian.d.romanick@intel.com>
Date: Mon, 5 Dec 2011 13:52:01 -0800
Subject: [PATCH 05/11] glx: Optionally call DRI2 createContextAttribs from __glXDRIscreenCreateContext
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
---
glx/glxdri2.c | 156 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 151 insertions(+), 5 deletions(-)
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 656b577..ba09cbd 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -47,6 +47,7 @@
#include "glxserver.h"
#include "glxutil.h"
#include "glxdricommon.h"
+#include <GL/glxtokens.h>
#include "glapitable.h"
#include "glapi.h"
@@ -377,6 +378,143 @@ __glXDRIscreenDestroy(__GLXscreen * baseScreen)
free(screen);
}
+static Bool
+dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
+ unsigned *major_ver, unsigned *minor_ver,
+ uint32_t *flags, unsigned *error)
+{
+ unsigned i;
+
+ if (num_attribs == 0)
+ return True;
+
+ if (attribs == NULL) {
+ *error = BadImplementation;
+ return False;
+ }
+
+ *major_ver = 1;
+ *minor_ver = 0;
+
+ for (i = 0; i < num_attribs; i++) {
+ switch (attribs[i * 2]) {
+ case GLX_CONTEXT_MAJOR_VERSION_ARB:
+ *major_ver = attribs[i * 2 + 1];
+ break;
+ case GLX_CONTEXT_MINOR_VERSION_ARB:
+ *minor_ver = attribs[i * 2 + 1];
+ break;
+ case GLX_CONTEXT_FLAGS_ARB:
+ *flags = attribs[i * 2 + 1];
+ break;
+ case GLX_RENDER_TYPE:
+ break;
+ default:
+ /* If an unknown attribute is received, fail.
+ */
+ *error = BadValue;
+ return False;
+ }
+ }
+
+ /* Unknown flag value.
+ */
+ if (*flags & ~(__DRI_CTX_FLAG_DEBUG | __DRI_CTX_FLAG_FORWARD_COMPATIBLE)) {
+ *error = BadValue;
+ return False;
+ }
+
+ *error = Success;
+ return True;
+}
+
+static void
+create_driver_context(__GLXDRIcontext * context,
+ __GLXDRIscreen * screen,
+ __GLXDRIconfig * config,
+ __DRIcontext * driShare,
+ unsigned num_attribs,
+ const uint32_t *attribs,
+ int *error)
+{
+ context->driContext = NULL;
+
+#if __DRI_DRI2_VERSION >= 3
+ if (screen->dri2->base.version >= 3) {
+ uint32_t ctx_attribs[3 * 2];
+ unsigned num_ctx_attribs = 0;
+ unsigned dri_err = 0;
+ unsigned major_ver;
+ unsigned minor_ver;
+ uint32_t flags;
+
+ if (num_attribs != 0) {
+ if (!dri2_convert_glx_attribs(num_attribs, attribs,
+ &major_ver, &minor_ver,
+ &flags, (unsigned *) error))
+ return NULL;
+
+ ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MAJOR_VERSION;
+ ctx_attribs[num_ctx_attribs++] = major_ver;
+ ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MINOR_VERSION;
+ ctx_attribs[num_ctx_attribs++] = minor_ver;
+
+ if (flags != 0) {
+ ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_FLAGS;
+
+ /* The current __DRI_CTX_FLAG_* values are identical to the
+ * GLX_CONTEXT_*_BIT values.
+ */
+ ctx_attribs[num_ctx_attribs++] = flags;
+ }
+ }
+
+ context->driContext =
+ (*screen->dri2->createContextAttribs)(screen->driScreen,
+ __DRI_API_OPENGL,
+ config->driConfig,
+ driShare,
+ num_ctx_attribs / 2,
+ ctx_attribs,
+ &dri_err,
+ context);
+
+ switch (dri_err) {
+ case __DRI_CTX_ERROR_SUCCESS:
+ *error = Success;
+ break;
+ case __DRI_CTX_ERROR_NO_MEMORY:
+ *error = BadAlloc;
+ break;
+ case __DRI_CTX_ERROR_BAD_API:
+ *error = __glXError(GLXBadProfileARB);
+ break;
+ case __DRI_CTX_ERROR_BAD_VERSION:
+ case __DRI_CTX_ERROR_BAD_FLAG:
+ *error = __glXError(GLXBadFBConfig);
+ break;
+ case __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE:
+ case __DRI_CTX_ERROR_UNKNOWN_FLAG:
+ default:
+ *error = BadValue;
+ break;
+ }
+
+ return;
+ }
+#endif
+
+ if (num_attribs != 0) {
+ *error = BadValue;
+ return;
+ }
+
+ context->driContext =
+ (*screen->dri2->createNewContext) (screen->driScreen,
+ config->driConfig,
+ driShare, context);
+}
+
static __GLXcontext *
__glXDRIscreenCreateContext(__GLXscreen * baseScreen,
__GLXconfig * glxConfig,
@@ -397,8 +535,10 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
driShare = NULL;
context = calloc(1, sizeof *context);
- if (context == NULL)
+ if (context == NULL) {
+ *error = BadAlloc;
return NULL;
+ }
context->base.destroy = __glXDRIcontextDestroy;
context->base.makeCurrent = __glXDRIcontextMakeCurrent;
@@ -407,10 +547,8 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
context->base.wait = __glXDRIcontextWait;
- context->driContext =
- (*screen->dri2->createNewContext) (screen->driScreen,
- config->driConfig,
- driShare, context);
+ create_driver_context(context, screen, config, driShare, num_attribs,
+ attribs, error);
if (context->driContext == NULL) {
free(context);
return NULL;
@@ -646,6 +784,14 @@ initializeExtensions(__GLXDRIscreen * screen)
__glXEnableExtension(screen->glx_enable_bits, "GLX_INTEL_swap_event");
LogMessage(X_INFO, "AIGLX: enabled GLX_INTEL_swap_event\n");
+#if __DRI_DRI2_VERSION >= 3
+ if (screen->dri2->base.version >= 3) {
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_ARB_create_context");
+ LogMessage(X_INFO, "AIGLX: enabled GLX_ARB_create_context\n");
+ }
+#endif
+
if (DRI2HasSwapControl(pScreen)) {
__glXEnableExtension(screen->glx_enable_bits, "GLX_SGI_swap_control");
__glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_swap_control");
--
1.7.3.4

View File

@ -0,0 +1,102 @@
From 975f069a92f8bd85f9d0ce4916f2c1c4a3cea339 Mon Sep 17 00:00:00 2001
From: Ian Romanick <ian.d.romanick@intel.com>
Date: Fri, 9 Dec 2011 17:28:21 -0800
Subject: [PATCH 06/11] glx: Implement GLX SetClientInfoARB protocol
v2: Bump glproto version to 1.4.15. This patch uses structure names
that only exist in that glproto version and later. Noticed by
Christopher James Halse Rogers.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
---
configure.ac | 2 +-
glx/clientinfo.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 48 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 6a41ea8..de7526f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -777,7 +777,7 @@ DRI2PROTO="dri2proto >= 2.6"
XINERAMAPROTO="xineramaproto"
BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
DGAPROTO="xf86dgaproto >= 2.0.99.1"
-GLPROTO="glproto >= 1.4.14"
+GLPROTO="glproto >= 1.4.15"
DMXPROTO="dmxproto >= 2.2.99.1"
VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1"
WINDOWSWMPROTO="windowswmproto"
diff --git a/glx/clientinfo.c b/glx/clientinfo.c
index 15bbf15..b26ac1a 100644
--- a/glx/clientinfo.c
+++ b/glx/clientinfo.c
@@ -26,17 +26,62 @@
#include "glxserver.h"
#include "indirect_dispatch.h"
+#include "glxbyteorder.h"
+#include "unpack.h"
int
__glXDisp_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc)
{
- return BadRequest;
+ xGLXSetClientInfoARBReq *req = (xGLXSetClientInfoARBReq *) pc;
+ char *gl_extensions;
+ char *glx_extensions;
+
+ /* Verify that the size of the packet matches the size inferred from the
+ * sizes specified for the various fields.
+ */
+ const unsigned expected_size = sz_xGLXSetClientInfoARBReq
+ + (req->numVersions * 8)
+ + __GLX_PAD(req->numGLExtensionBytes)
+ + __GLX_PAD(req->numGLXExtensionBytes);
+
+ if (req->length != (expected_size / 4))
+ return BadLength;
+
+ /* Verify that the actual length of the GL extension string matches what's
+ * encoded in protocol packet.
+ */
+ gl_extensions = (char *) (req + 1) + (req->numVersions * 8);
+ if (req->numGLExtensionBytes != 0
+ && memchr(gl_extensions, 0,
+ __GLX_PAD(req->numGLExtensionBytes)) == NULL)
+ return BadLength;
+
+ /* Verify that the actual length of the GLX extension string matches
+ * what's encoded in protocol packet.
+ */
+ glx_extensions = gl_extensions + __GLX_PAD(req->numGLExtensionBytes);
+ if (req->numGLXExtensionBytes != 0
+ && memchr(glx_extensions, 0,
+ __GLX_PAD(req->numGLXExtensionBytes)) == NULL)
+ return BadLength;
+
+ free(cl->GLClientextensions);
+ cl->GLClientextensions = strdup(gl_extensions);
+
+ return 0;
}
int
__glXDispSwap_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc)
{
- return BadRequest;
+ xGLXSetClientInfoARBReq *req = (xGLXSetClientInfoARBReq *) pc;
+
+ req->length = bswap_16(req->length);
+ req->numVersions = bswap_32(req->numVersions);
+ req->numGLExtensionBytes = bswap_32(req->numGLExtensionBytes);
+ req->numGLXExtensionBytes = bswap_32(req->numGLXExtensionBytes);
+
+ return __glXDisp_SetClientInfoARB(cl, pc);
}
int
--
1.7.3.4

View File

@ -0,0 +1,64 @@
From 232ab8f5869905e7a8eb736b4625366c9f316e9c Mon Sep 17 00:00:00 2001
From: Ian Romanick <ian.d.romanick@intel.com>
Date: Sat, 10 Dec 2011 15:09:57 -0800
Subject: [PATCH 07/11] glx: Initialize all context fields together
v2: Fix whitespace error noticed by Christopher James Halse Rogers.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
---
glx/glxcmds.c | 26 +++++++++-----------------
1 files changed, 9 insertions(+), 17 deletions(-)
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 308c14a..571ae50 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -290,26 +290,10 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
return BadAlloc;
}
- /*
- ** Initially, setup the part of the context that could be used by
- ** a GL core that needs windowing information (e.g., Mesa).
+ /* Initialize the GLXcontext structure.
*/
glxc->pGlxScreen = pGlxScreen;
glxc->config = config;
-
- /*
- ** Register this context as a resource.
- */
- if (!AddResource(gcId, __glXContextRes, (pointer) glxc)) {
- (*glxc->destroy) (glxc);
- client->errorValue = gcId;
- return BadAlloc;
- }
-
- /*
- ** Finally, now that everything is working, setup the rest of the
- ** context.
- */
glxc->id = gcId;
glxc->share_id = shareList;
glxc->idExists = GL_TRUE;
@@ -317,6 +301,14 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
glxc->isDirect = isDirect;
glxc->renderMode = GL_RENDER;
+ /* Register this context as a resource.
+ */
+ if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) {
+ (*glxc->destroy) (glxc);
+ client->errorValue = gcId;
+ return BadAlloc;
+ }
+
__glXAddToContextList(glxc);
return Success;
--
1.7.3.4

View File

@ -0,0 +1,37 @@
From e18884c868215b5dabc1f2fac73dd9c763074394 Mon Sep 17 00:00:00 2001
From: Ian Romanick <ian.d.romanick@intel.com>
Date: Sat, 10 Dec 2011 15:11:57 -0800
Subject: [PATCH 08/11] glx: Initialize remaining context fields
There is no reason to assume the screen's context allocated
initialized these fields, so don't.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
---
glx/glxcmds.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 571ae50..8a9a1d3 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -299,7 +299,14 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
glxc->idExists = GL_TRUE;
glxc->isCurrent = GL_FALSE;
glxc->isDirect = isDirect;
+ glxc->hasUnflushedCommands = GL_FALSE;
glxc->renderMode = GL_RENDER;
+ glxc->feedbackBuf = NULL;
+ glxc->feedbackBufSize = 0;
+ glxc->selectBuf = NULL;
+ glxc->selectBufSize = 0;
+ glxc->drawPriv = NULL;
+ glxc->readPriv = NULL;
/* Register this context as a resource.
*/
--
1.7.3.4

View File

@ -0,0 +1,81 @@
From 660e48e6c6a9df08655c286ac3a9ffa45eb44c26 Mon Sep 17 00:00:00 2001
From: Ian Romanick <ian.d.romanick@intel.com>
Date: Sat, 10 Dec 2011 15:15:18 -0800
Subject: [PATCH 09/11] glx: Use one function to add a context to all global tables
Instead of having separate __glXAddContextToList and AddResource
functions, just have one function that does both steps.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
---
glx/glxcmds.c | 6 ++----
glx/glxext.c | 11 +++++++++--
glx/glxext.h | 2 +-
3 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 8a9a1d3..d9d2201 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -308,16 +308,14 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
glxc->drawPriv = NULL;
glxc->readPriv = NULL;
- /* Register this context as a resource.
+ /* Add the new context to the various global tables of GLX contexts.
*/
- if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) {
+ if (!__glXAddContext(glxc)) {
(*glxc->destroy) (glxc);
client->errorValue = gcId;
return BadAlloc;
}
- __glXAddToContextList(glxc);
-
return Success;
}
diff --git a/glx/glxext.c b/glx/glxext.c
index 599f029..8d168d8 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -157,11 +157,18 @@ DrawableGone(__GLXdrawable * glxPriv, XID xid)
return True;
}
-void
-__glXAddToContextList(__GLXcontext * cx)
+Bool
+__glXAddContext(__GLXcontext * cx)
{
+ /* Register this context as a resource.
+ */
+ if (!AddResource(cx->id, __glXContextRes, (pointer)cx)) {
+ return False;
+ }
+
cx->next = glxAllContexts;
glxAllContexts = cx;
+ return True;
}
static void
diff --git a/glx/glxext.h b/glx/glxext.h
index 7cd5cb4..9b0978b 100644
--- a/glx/glxext.h
+++ b/glx/glxext.h
@@ -38,7 +38,7 @@
extern GLboolean __glXFreeContext(__GLXcontext * glxc);
extern void __glXFlushContextCache(void);
-extern void __glXAddToContextList(__GLXcontext * cx);
+extern Bool __glXAddContext(__GLXcontext * cx);
extern void __glXErrorCallBack(GLenum code);
extern void __glXClearErrorOccured(void);
extern GLboolean __glXErrorOccured(void);
--
1.7.3.4

View File

@ -0,0 +1,81 @@
From ce0cf92a76cb220a89b10b8f6b0a57c5cf69a97f Mon Sep 17 00:00:00 2001
From: Ian Romanick <ian.d.romanick@intel.com>
Date: Fri, 16 Dec 2011 14:42:51 -0800
Subject: [PATCH 10/11] glx: Make several functions available outside the glxcmds.c compilation unit
validGlxScreen, validGlxFBConfig, validGlxContext, and
__glXdirectContextCreate will soon be used by createcontext.c.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
---
glx/glxcmds.c | 8 ++++----
glx/glxcontext.h | 13 +++++++++++++
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index d9d2201..d483bbf 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -50,7 +50,7 @@
#include "indirect_table.h"
#include "indirect_util.h"
-static int
+_X_HIDDEN int
validGlxScreen(ClientPtr client, int screen, __GLXscreen ** pGlxScreen,
int *err)
{
@@ -67,7 +67,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen ** pGlxScreen,
return TRUE;
}
-static int
+_X_HIDDEN int
validGlxFBConfig(ClientPtr client, __GLXscreen * pGlxScreen, XID id,
__GLXconfig ** config, int *err)
{
@@ -131,7 +131,7 @@ validGlxFBConfigForWindow(ClientPtr client, __GLXconfig * config,
return TRUE;
}
-static int
+_X_HIDDEN int
validGlxContext(ClientPtr client, XID id, int access_mode,
__GLXcontext ** context, int *err)
{
@@ -200,7 +200,7 @@ __glXdirectContextDestroy(__GLXcontext * context)
free(context);
}
-static __GLXcontext *
+_X_HIDDEN __GLXcontext *
__glXdirectContextCreate(__GLXscreen * screen,
__GLXconfig * modes, __GLXcontext * shareContext)
{
diff --git a/glx/glxcontext.h b/glx/glxcontext.h
index ef2c4db..b803a7f 100644
--- a/glx/glxcontext.h
+++ b/glx/glxcontext.h
@@ -121,4 +121,17 @@ struct __GLXcontext {
void __glXContextDestroy(__GLXcontext * context);
+extern int validGlxScreen(ClientPtr client, int screen,
+ __GLXscreen ** pGlxScreen, int *err);
+
+extern int validGlxFBConfig(ClientPtr client, __GLXscreen * pGlxScreen,
+ XID id, __GLXconfig ** config, int *err);
+
+extern int validGlxContext(ClientPtr client, XID id, int access_mode,
+ __GLXcontext ** context, int *err);
+
+extern __GLXcontext *__glXdirectContextCreate(__GLXscreen * screen,
+ __GLXconfig * modes,
+ __GLXcontext * shareContext);
+
#endif /* !__GLX_context_h__ */
--
1.7.3.4

View File

@ -0,0 +1,245 @@
From feae6434d2653bcfcaf617932c1b4893d51a1ef4 Mon Sep 17 00:00:00 2001
From: Ian Romanick <ian.d.romanick@intel.com>
Date: Fri, 16 Dec 2011 14:44:55 -0800
Subject: [PATCH 11/11] glx: Implement protocol for glXCreateContextAttribsARB
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
---
glx/createcontext.c | 213 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 212 insertions(+), 1 deletions(-)
diff --git a/glx/createcontext.c b/glx/createcontext.c
index 9c1eab3..025c423 100644
--- a/glx/createcontext.c
+++ b/glx/createcontext.c
@@ -24,13 +24,224 @@
#include <dix-config.h>
#endif
+#include <GL/glxtokens.h>
#include "glxserver.h"
+#include "glxext.h"
#include "indirect_dispatch.h"
+#define ALL_VALID_FLAGS \
+ (GLX_CONTEXT_DEBUG_BIT_ARB | GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB)
+
+static Bool
+validate_GL_version(int major_version, int minor_version)
+{
+ if (major_version <= 0 || minor_version < 0)
+ return False;
+
+ switch (major_version) {
+ case 1:
+ if (minor_version > 5)
+ return False;
+ break;
+
+ case 2:
+ if (minor_version > 1)
+ return False;
+ break;
+
+ case 3:
+ if (minor_version > 3)
+ return False;
+ break;
+
+ default:
+ break;
+ }
+
+ return True;
+}
+
+static Bool
+validate_render_type(uint32_t render_type)
+{
+ switch (render_type) {
+ case GLX_RGBA_TYPE:
+ case GLX_COLOR_INDEX_TYPE:
+ return True;
+ default:
+ return False;
+ }
+}
+
int
__glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
{
- return BadRequest;
+ ClientPtr client = cl->client;
+ xGLXCreateContextAttribsARBReq *req = (xGLXCreateContextAttribsARBReq *) pc;
+ int32_t *attribs = (req->numAttribs != 0) ? (int32_t *) (req + 1) : NULL;
+ unsigned i;
+ int major_version = 1;
+ int minor_version = 0;
+ uint32_t flags = 0;
+ uint32_t render_type = GLX_RGBA_TYPE;
+ __GLXcontext *ctx = NULL;
+ __GLXcontext *shareCtx = NULL;
+ __GLXscreen *glxScreen;
+ __GLXconfig *config;
+ int err;
+
+ /* Verify that the size of the packet matches the size inferred from the
+ * sizes specified for the various fields.
+ */
+ const unsigned expected_size = (sz_xGLXCreateContextAttribsARBReq
+ + (req->numAttribs * 8)) / 4;
+
+ if (req->length != expected_size)
+ return BadLength;
+
+ LEGAL_NEW_RESOURCE(req->context, client);
+
+ /* The GLX_ARB_create_context spec says:
+ *
+ * "* If <config> is not a valid GLXFBConfig, GLXBadFBConfig is
+ * generated."
+ *
+ * On the client, the screen comes from the FBConfig, so GLXBadFBConfig
+ * should be issued if the screen is nonsense.
+ */
+ if (!validGlxScreen(client, req->screen, &glxScreen, &err))
+ return __glXError(GLXBadFBConfig);
+
+ if (!validGlxFBConfig(client, glxScreen, req->fbconfig, &config, &err))
+ return __glXError(GLXBadFBConfig);
+
+ /* Validate the context with which the new context should share resources.
+ */
+ if (req->shareList != None) {
+ if (!validGlxContext(client, req->shareList, DixReadAccess,
+ &shareCtx, &err))
+ return err;
+
+ /* The crazy condition is because C doesn't have a logical XOR
+ * operator. Comparing directly for equality may fail if one is 1 and
+ * the other is 2 even though both are logically true.
+ */
+ if (!!req->isDirect != !!shareCtx->isDirect) {
+ client->errorValue = req->shareList;
+ return BadMatch;
+ }
+
+ /* The GLX_ARB_create_context spec says:
+ *
+ * "* If the server context state for <share_context>...was
+ * created on a different screen than the one referenced by
+ * <config>...BadMatch is generated."
+ */
+ if (glxScreen != shareCtx->pGlxScreen) {
+ client->errorValue = shareCtx->pGlxScreen->pScreen->myNum;
+ return BadMatch;
+ }
+ }
+
+ for (i = 0; i < req->numAttribs; i++) {
+ switch (attribs[i * 2]) {
+ case GLX_CONTEXT_MAJOR_VERSION_ARB:
+ major_version = attribs[2 * i + 1];
+ break;
+
+ case GLX_CONTEXT_MINOR_VERSION_ARB:
+ minor_version = attribs[2 * i + 1];
+ break;
+
+ case GLX_CONTEXT_FLAGS_ARB:
+ flags = attribs[2 * i + 1];
+ break;
+
+ case GLX_RENDER_TYPE:
+ render_type = attribs[2 * i + 1];
+ break;
+
+ default:
+ return BadValue;
+ }
+ }
+
+ /* The GLX_ARB_create_context spec says:
+ *
+ * "If attributes GLX_CONTEXT_MAJOR_VERSION_ARB and
+ * GLX_CONTEXT_MINOR_VERSION_ARB, when considered together
+ * with attributes GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB and
+ * GLX_RENDER_TYPE, specify an OpenGL version and feature set
+ * that are not defined, BadMatch is generated.
+ *
+ * ...Feature deprecation was introduced with OpenGL 3.0, so
+ * forward-compatible contexts may only be requested for
+ * OpenGL 3.0 and above. Thus, examples of invalid
+ * combinations of attributes include:
+ *
+ * - Major version < 1 or > 3
+ * - Major version == 1 and minor version < 0 or > 5
+ * - Major version == 2 and minor version < 0 or > 1
+ * - Major version == 3 and minor version > 2
+ * - Forward-compatible flag set and major version < 3
+ * - Color index rendering and major version >= 3"
+ */
+ if (!validate_GL_version(major_version, minor_version))
+ return BadMatch;
+
+ if (major_version < 3
+ && ((flags & GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB) != 0))
+ return BadMatch;
+
+ if (major_version >= 3 && render_type == GLX_COLOR_INDEX_TYPE)
+ return BadMatch;
+
+ if (!validate_render_type(render_type))
+ return BadValue;
+
+ if ((flags & ~ALL_VALID_FLAGS) != 0)
+ return BadValue;
+
+ /* Allocate memory for the new context
+ */
+ if (req->isDirect) {
+ ctx = __glXdirectContextCreate(glxScreen, config, shareCtx);
+ err = BadAlloc;
+ }
+ else {
+ ctx = glxScreen->createContext(glxScreen, config, shareCtx,
+ req->numAttribs, (uint32_t *) attribs,
+ &err);
+ }
+
+ if (ctx == NULL)
+ return err;
+
+ ctx->pGlxScreen = glxScreen;
+ ctx->config = config;
+ ctx->id = req->context;
+ ctx->share_id = req->shareList;
+ ctx->idExists = True;
+ ctx->isCurrent = False;
+ ctx->isDirect = req->isDirect;
+ ctx->hasUnflushedCommands = False;
+ ctx->renderMode = GL_RENDER;
+ ctx->feedbackBuf = NULL;
+ ctx->feedbackBufSize = 0;
+ ctx->selectBuf = NULL;
+ ctx->selectBufSize = 0;
+ ctx->drawPriv = NULL;
+ ctx->readPriv = NULL;
+
+ /* Add the new context to the various global tables of GLX contexts.
+ */
+ if (!__glXAddContext(ctx)) {
+ (*ctx->destroy) (ctx);
+ client->errorValue = req->context;
+ return BadAlloc;
+ }
+
+ return Success;
}
int
--
1.7.3.4

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Fri May 25 14:44:36 UTC 2012 - sndirsch@suse.com
- no longer use obsolete %run_permissions; replaced it by
%set_permissions (bnc#764101)
-------------------------------------------------------------------
Tue May 22 08:50:21 UTC 2012 - sndirsch@suse.com
- added patches to implement GLX_ARB_create_context extensions
required for OpenGL 3.0 support (not upstream yet)
-------------------------------------------------------------------
Wed May 9 16:40:01 UTC 2012 - sndirsch@suse.com

View File

@ -185,6 +185,20 @@ Patch213: xorg-server-xdmcp.patch
Patch220: Use-external-tool-for-creating-backtraces-on-crashes.patch
# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch222: sync-fix.patch
# Patches to implement GLX_ARB_create_context extensions required for OpenGL 3.0 support
# http://lists.x.org/archives/xorg-devel/2012-April/030452.html
# git://people.freedesktop.org/~idr/xserver.git
Patch300: u_0001-glx-Fix-mishandling-of-shared-contexts.patch
Patch301: u_0002-glx-Don-t-track-GLClientmajorVersion-or-GLClientmino.patch
Patch302: u_0003-glx-Extend-__GLXscreen-createContext-to-take-attribu.patch
Patch303: u_0004-glx-Add-tracking-for-GLX_ARB_create_context-and-GLX_.patch
Patch304: u_0005-glx-Optionally-call-DRI2-createContextAttribs-from-_.patch
Patch305: u_0006-glx-Implement-GLX-SetClientInfoARB-protocol.patch
Patch306: u_0007-glx-Initialize-all-context-fields-together.patch
Patch307: u_0008-glx-Initialize-remaining-context-fields.patch
Patch308: u_0009-glx-Use-one-function-to-add-a-context-to-all-global-.patch
Patch309: u_0010-glx-Make-several-functions-available-outside-the-glx.patch
Patch310: u_0011-glx-Implement-protocol-for-glXCreateContextAttribsAR.patch
%description
This package contains the X.Org Server.
@ -307,6 +321,17 @@ cp %{SOURCE96} .
### Disable backtrace generation patch for now
#%patch220 -p1
%patch222 -p1
%patch300 -p1
%patch301 -p1
%patch302 -p1
%patch303 -p1
%patch304 -p1
%patch305 -p1
%patch306 -p1
%patch307 -p1
%patch308 -p1
%patch309 -p1
%patch310 -p1
%build
autoreconf -fi
@ -423,7 +448,7 @@ install -D xorg-x11-server.macros %{buildroot}%{_sysconfdir}/rpm/macros.xorg-ser
%post
%ifnarch s390 s390x
%{fillup_only -an displaymanager}
%run_permissions
%set_permissions /usr/bin/Xorg
if [ -f etc/X11/xorg.conf ]; then
# Document how to restore previous input driver behaviour in xorg.conf files created
# on openSUSE <= 11.1