summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2017-06-16 15:44:52 -0400
committerAdam Jackson <ajax@redhat.com>2017-06-20 16:39:23 -0400
commit525db17e04d5cabaeefd20e38cebe7d606047a76 (patch)
treec2ec08968ec5c74cd8d57fa4dd03e7e02ab36187
parentecc5e362985d1f649c29ac5f93be19851eaf7d87 (diff)
glx/drisw: Use scratch GCs for swrastPutImage
The scratch GC defaults to the same state as our persistent GCs. Except for the "draw" GC, which would generate graphics exposures for... well, no reason really, PutImage doesn't generate graphics exposures. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Keith Packard <keithp@keithp.com>
-rw-r--r--glx/glxdriswrast.c33
1 files changed, 5 insertions, 28 deletions
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index 6b546d8ed..396b68911 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -82,9 +82,6 @@ struct __GLXDRIdrawable {
__GLXdrawable base;
__DRIdrawable *driDrawable;
__GLXDRIscreen *screen;
-
- GCPtr gc; /* scratch GC for span drawing */
- GCPtr swapgc; /* GC for swapping the color buffers */
};
/* white lie */
@@ -98,9 +95,6 @@ __glXDRIdrawableDestroy(__GLXdrawable * drawable)
(*core->destroyDrawable) (private->driDrawable);
- FreeGC(private->gc, (GContext) 0);
- FreeGC(private->swapgc, (GContext) 0);
-
__glXDrawableRelease(drawable);
free(private);
@@ -258,8 +252,6 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
XID drawId,
int type, XID glxDrawId, __GLXconfig * glxConfig)
{
- XID gcvals[2];
- int status;
__GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen;
__GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
__GLXDRIdrawable *private;
@@ -279,14 +271,6 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
private->base.swapBuffers = __glXDRIdrawableSwapBuffers;
private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer;
- gcvals[0] = GXcopy;
- private->gc =
- CreateGC(pDraw, GCFunction, gcvals, &status, (XID) 0, serverClient);
- gcvals[1] = FALSE;
- private->swapgc =
- CreateGC(pDraw, GCFunction | GCGraphicsExposures, gcvals, &status,
- (XID) 0, serverClient);
-
private->driDrawable =
(*driScreen->swrast->createNewDrawable) (driScreen->driScreen,
config->driConfig, private);
@@ -316,20 +300,13 @@ swrastPutImage(__DRIdrawable * draw, int op,
GCPtr gc;
__GLXcontext *cx = lastGLContext;
- switch (op) {
- case __DRI_SWRAST_IMAGE_OP_DRAW:
- gc = drawable->gc;
- break;
- case __DRI_SWRAST_IMAGE_OP_SWAP:
- gc = drawable->swapgc;
- break;
- default:
- return;
+ if ((gc = GetScratchGC(pDraw->depth, pDraw->pScreen))) {
+ ValidateGC(pDraw, gc);
+ gc->ops->PutImage(pDraw, gc, pDraw->depth, x, y, w, h, 0, ZPixmap,
+ data);
+ FreeScratchGC(gc);
}
- ValidateGC(pDraw, gc);
-
- gc->ops->PutImage(pDraw, gc, pDraw->depth, x, y, w, h, 0, ZPixmap, data);
if (cx != lastGLContext) {
lastGLContext = cx;
cx->makeCurrent(cx);