1
0
xorg-x11-server/u_0003-glx-Extend-__GLXscreen-createContext-to-take-attribu.patch

142 lines
5.4 KiB
Diff
Raw Normal View History

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