[PATCH 03/11] glx: Extend __GLXscreen::createContext to take attributes
Ian Romanick
idr at freedesktop.org
Fri Apr 13 18:11:45 PDT 2012
From: Ian Romanick <ian.d.romanick at intel.com>
The attributes will be used for glXCreateContextAttribsARB additions
in follow-on patches.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Jesse Barnes <jbarnes at virtuousgeek.org>
---
glx/glxcmds.c | 12 ++++++++++--
glx/glxdri.c | 10 +++++++++-
glx/glxdri2.c | 5 ++++-
glx/glxdriswrast.c | 4 +++-
glx/glxscreens.h | 5 ++++-
5 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 5c70afa..f754104 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -276,8 +276,16 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
/*
** Allocate memory for the new context
*/
- if (!isDirect)
- glxc = pGlxScreen->createContext(pGlxScreen, config, shareglxc);
+ 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) {
diff --git a/glx/glxdri.c b/glx/glxdri.c
index 9b8b66f..a4463ef 100644
--- a/glx/glxdri.c
+++ b/glx/glxdri.c
@@ -599,7 +599,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;
@@ -611,6 +613,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 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..5543ab7 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -257,7 +257,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 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.6.5
More information about the xorg-devel
mailing list