Mesa (master): drisw: Simplify GC setup
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Sep 27 15:45:40 UTC 2019
Module: Mesa
Branch: master
Commit: 3c0eb762e27f9028a8f59e2fa31603292e02d9ef
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3c0eb762e27f9028a8f59e2fa31603292e02d9ef
Author: Adam Jackson <ajax at redhat.com>
Date: Thu Sep 26 14:42:16 2019 -0400
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 <eric at anholt.net>
---
src/glx/drisw_glx.c | 29 ++++-------------------------
src/glx/drisw_priv.h | 1 -
2 files changed, 4 insertions(+), 26 deletions(-)
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 <assert.h>
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;
More information about the mesa-commit
mailing list