[PATCH 1/2] glxdriswrast: Use CreateGC, not CreateScratchGC.

Jamey Sharp jamey at minilop.net
Wed May 19 17:16:45 PDT 2010


On Wed, May 19, 2010 at 4:40 PM, Keith Packard <keithp at keithp.com> wrote:
> On Wed, 19 May 2010 15:25:43 -0700, Jamey Sharp <jamey at minilop.net> wrote:
>> As long as the drawable provided to CreateGC has the same screen and
>> depth as were passed to CreateScratchGC, these functions are basically
>> identical.
>
> One would think that graphicsExposures should be set to FALSE for
> scratch GCs as well, but they aren't. Very strange.

That's done by CreateGCperDepth and GetScratchGC. Anyway,
__glXDRIscreenCreateDrawable only wants graphicsExposures disabled on
one of its drawables.

>> Since this code was using CreateScratchGC and not GetScratchGC,
>> FreeScratchGC would always call FreeGC, so just call it directly.
>
> I'm having a hard time caring; drivers don't call CreateGC either, so it
> seems like we can pick one of these to export.

It seems nicer to pick CreateGC, which allows the GC to be configured.

In this particular case, __glXDRIscreenCreateDrawable has a ClientPtr,
so I actually wondered if it should be subjecting both GC allocations
to access checks.

> In fact, we could export only CreateScratchGC and FreeScratchGC, making
> it impossible for driver writers to call FreeGC after calling GetScratchGC.

I'm still hopeful that scratch GCs will turn out to be a pointless
complication on modern hardware, in which case everything should just
use CreateGC/FreeGC.

Jamey


More information about the xorg-devel mailing list