From: Adam Jackson Date: Thu, 26 Sep 2019 18:42:16 +0000 (-0400) Subject: drisw: Simplify GC setup X-Git-Url: https://git.libre-soc.org/?p=mesa.git;a=commitdiff_plain;h=3c0eb762e27f9028a8f59e2fa31603292e02d9ef drisw: Simplify GC setup There's no reason to have two GCs here. The only difference between them is that swapgc would generate graphics exposures, except we only ever use this GC for PutImage, and PutImage doesn't generate graphics exposures. We also don't need to explicitly ChangeGC to GXCopy, because that's the default. Reviewed-by: Eric Anholt --- diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c index f38dbbca2df..b3e00f9a4e0 100644 --- a/src/glx/drisw_glx.c +++ b/src/glx/drisw_glx.c @@ -32,23 +32,14 @@ #include static Bool -XCreateGCs(struct drisw_drawable * pdp, - Display * dpy, XID drawable, int visualid) +driswCreateGCs(struct drisw_drawable * pdp, + Display * dpy, XID drawable, int visualid) { - XGCValues gcvalues; long visMask; XVisualInfo visTemp; int num_visuals; - /* create GC's */ pdp->gc = XCreateGC(dpy, drawable, 0, NULL); - pdp->swapgc = XCreateGC(dpy, drawable, 0, NULL); - - gcvalues.function = GXcopy; - gcvalues.graphics_exposures = False; - XChangeGC(dpy, pdp->gc, GCFunction, &gcvalues); - XChangeGC(dpy, pdp->swapgc, GCFunction, &gcvalues); - XChangeGC(dpy, pdp->swapgc, GCGraphicsExposures, &gcvalues); /* visual */ visTemp.visualid = visualid; @@ -152,7 +143,6 @@ XDestroyDrawable(struct drisw_drawable * pdp, Display * dpy, XID drawable) free(pdp->visinfo); XFreeGC(dpy, pdp->gc); - XFreeGC(dpy, pdp->swapgc); } /** @@ -212,24 +202,13 @@ swrastXPutImage(__DRIdrawable * draw, int op, Display *dpy = pdraw->psc->dpy; Drawable drawable; XImage *ximage; - GC gc; + GC gc = pdp->gc; if (!pdp->ximage || shmid != pdp->shminfo.shmid) { if (!XCreateDrawable(pdp, shmid, dpy)) return; } - switch (op) { - case __DRI_SWRAST_IMAGE_OP_DRAW: - gc = pdp->gc; - break; - case __DRI_SWRAST_IMAGE_OP_SWAP: - gc = pdp->swapgc; - break; - default: - return; - } - drawable = pdraw->xDrawable; ximage = pdp->ximage; ximage->bytes_per_line = stride ? stride : bytes_per_line(w * ximage->bits_per_pixel, 32); @@ -699,7 +678,7 @@ driswCreateDrawable(struct glx_screen *base, XID xDrawable, pdp->base.drawable = drawable; pdp->base.psc = &psc->base; - ret = XCreateGCs(pdp, psc->base.dpy, xDrawable, modes->visualID); + ret = driswCreateGCs(pdp, psc->base.dpy, xDrawable, modes->visualID); if (!ret) { free(pdp); return NULL; diff --git a/src/glx/drisw_priv.h b/src/glx/drisw_priv.h index 259fc864f6a..816d1d87cc9 100644 --- a/src/glx/drisw_priv.h +++ b/src/glx/drisw_priv.h @@ -62,7 +62,6 @@ struct drisw_drawable __GLXDRIdrawable base; GC gc; - GC swapgc; __DRIdrawable *driDrawable; XVisualInfo *visinfo;