summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-05-23 10:02:20 -0700
committerKeith Packard <keithp@keithp.com>2014-06-02 11:10:19 -0700
commit2a6137255856485d1f7fa71dcb3b3f09fae2ff83 (patch)
tree87f5351631b07b5c3dc2756310fa13b78bfd45d0
parent536d238edfd33ebcf317d142089ce8f0738b2141 (diff)
glamor: Kludge-around UXA not using glamor_gc_destroy
Glamor now has a bit of work to do in DestroyGC, but UXA has it's own GC funcs which don't (currently) call glamor_gc_destroy. Here's an ugly hack which swaps in a working GCFuncs array at run time. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--glamor/glamor_core.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/glamor/glamor_core.c b/glamor/glamor_core.c
index 31cf3dce6..381961441 100644
--- a/glamor/glamor_core.c
+++ b/glamor/glamor_core.c
@@ -326,6 +326,8 @@ GCOps glamor_gc_ops = {
.PushPixels = glamor_push_pixels,
};
+static GCFuncs glamor_fixup_gc_funcs;
+
/**
* uxa_validate_gc() sets the ops to glamor's implementations, which may be
* accelerated or may sync the card and fall back to fb.
@@ -343,6 +345,18 @@ glamor_validate_gc(GCPtr gc, unsigned long changes, DrawablePtr drawable)
fbGetRotatedPixmap(gc) = 0;
}
+ /* XXX kludge alert -- check to see if our destroy_gc is going to be called,
+ * if not, try to work around that
+ */
+ if (gc->funcs->DestroyGC != glamor_destroy_gc) {
+ ErrorF("Driver not using glamor_destroy_gc, working around that");
+ if (gc->funcs->DestroyGC != miDestroyGC)
+ ErrorF("Driver also not using miDestroyGC. This may well crash or leak memory.");
+ glamor_fixup_gc_funcs = *gc->funcs;
+ glamor_fixup_gc_funcs.DestroyGC = glamor_destroy_gc;
+ gc->funcs = &glamor_fixup_gc_funcs;
+ }
+
if (gc->fillStyle == FillTiled) {
PixmapPtr old_tile, new_tile;