[PATCH 03/11] glx: Extend __GLXscreen::createContext to take attributes

Ian Romanick idr at freedesktop.org
Fri Dec 23 15:18:21 PST 2011


From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 glx/glxcmds.c      |   13 ++++++++++---
 glx/glxdri.c       |   10 +++++++++-
 glx/glxdri2.c      |    5 ++++-
 glx/glxdriswrast.c |    4 +++-
 glx/glxscreens.h   |    5 ++++-
 5 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index e9f6e12..ba6c69b 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -272,9 +272,16 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
     /*
     ** Allocate memory for the new context
     */
-    if (!isDirect)
-	glxc = pGlxScreen->createContext(pGlxScreen, config, shareglxc);
-    else
+    if (!isDirect) {
+	int err;
+
+	/* 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) {
 	return BadAlloc;
diff --git a/glx/glxdri.c b/glx/glxdri.c
index 326f539..7360c6f 100644
--- a/glx/glxdri.c
+++ b/glx/glxdri.c
@@ -608,7 +608,9 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
 static __GLXcontext *
 __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
 			    __GLXconfig *glxConfig,
-			    __GLXcontext *baseShareContext)
+			    __GLXcontext *baseShareContext,
+			    unsigned num_attribs,
+			    const uint32_t *attribs)
 {
     __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
     __GLXDRIcontext *context, *shareContext;
@@ -620,6 +622,12 @@ __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;
+
     shareContext = (__GLXDRIcontext *) baseShareContext;
     if (shareContext)
 	driShare = shareContext->driContext;
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 5e524db..18b5aad 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -386,7 +386,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 d064a05..59426f9 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -263,7 +263,9 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
 static __GLXcontext *
 __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
 			    __GLXconfig *glxConfig,
-			    __GLXcontext *baseShareContext)
+			    __GLXcontext *baseShareContext,
+			    unsigned num_attribs,
+			    const uint32_t *attribs)
 {
     __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
     __GLXDRIcontext *context, *shareContext;
diff --git a/glx/glxscreens.h b/glx/glxscreens.h
index eb29260..638e5a1 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.6.4



More information about the xorg-devel mailing list