From 2a6137255856485d1f7fa71dcb3b3f09fae2ff83 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 23 May 2014 10:02:20 -0700 Subject: 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 --- glamor/glamor_core.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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; -- cgit v1.2.3