[PATCH 03/11] glx: Extend __GLXscreen::createContext to take attributes
Ian Romanick
idr at freedesktop.org
Tue Apr 17 08:36:07 PDT 2012
On 04/17/2012 03:05 AM, Christopher James Halse Rogers wrote:
> On Fri, 2012-04-13 at 18:11 -0700, Ian Romanick wrote:
>> 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;
>
> This variable shadows the err defined at the top of the function, which
> is not used after this point; any reason why you didn't just reuse the
> existing variable?
>
>> +
>> + /* 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)
>
> You're missing int *error here. I don't _think_ it'll cause problems,
Right. DRI1 and DRISWRAST will never support the version of the
interface where num_attribs, attribs, or error are used. I've fixed
this (both places).
> but it does add an extra “assignment from incompatible pointer” warning
> (to the humongous list of other warnings the glx code generates ☹).
It's also on my todo list to start chipping away at that. Always the
glamours work! :)
>> {
>> __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)
>
> Also missing int *error here.
>
>> {
>> __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,
>
More information about the xorg-devel
mailing list