From 0a00c3765c3ba464bb4e9cde12e964c979421ed6 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 25 Sep 2012 13:50:33 +0100 Subject: [PATCH] sna: Accommodate changes to the Damage extension not unwrapping the GC commit 4dc2a76740d921c824a4d8193f39dd373475f02a Author: Adam Jackson Date: Thu Sep 20 17:57:00 2012 -0400 miext/damage: Only wrap into the GC ops chain if there's a listener (v3) leaves the GC->funcs still pointing to the damage layer as it calls into the driver functions, so we need to be careful to restore the correct function table after we manipulate the GC for fallbacks. Signed-off-by: Chris Wilson --- src/sna/fb/fb.h | 1 + src/sna/sna.h | 2 ++ src/sna/sna_accel.c | 9 +++++---- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/sna/fb/fb.h b/src/sna/fb/fb.h index adefaa19..e58e0396 100644 --- a/src/sna/fb/fb.h +++ b/src/sna/fb/fb.h @@ -278,6 +278,7 @@ typedef int FbStride; typedef struct { long changes; long serial; + GCFuncs *old_funcs; void *priv; FbBits and, xor; /* reduced rop values */ diff --git a/src/sna/sna.h b/src/sna/sna.h index 28dff6d2..031be728 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -171,6 +171,8 @@ static inline struct sna_pixmap *sna_pixmap_from_drawable(DrawablePtr drawable) struct sna_gc { long changes; long serial; + + GCFuncs *old_funcs; void *priv; }; diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index a2afce06..5e3280ec 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -3178,12 +3178,13 @@ static bool must_check sna_gc_move_to_cpu(GCPtr gc, DBG(("%s, changes=%lx\n", __FUNCTION__, changes)); assert(gc->ops == (GCOps *)&sna_gc_ops); - assert(gc->funcs == (GCFuncs *)&sna_gc_funcs); + gc->ops = (GCOps *)&sna_gc_ops__cpu; + + sgc->old_funcs = gc->funcs; + gc->funcs = (GCFuncs *)&sna_gc_funcs__cpu; sgc->priv = gc->pCompositeClip; gc->pCompositeClip = region; - gc->ops = (GCOps *)&sna_gc_ops__cpu; - gc->funcs = (GCFuncs *)&sna_gc_funcs__cpu; if (gc->clientClipType == CT_PIXMAP) { PixmapPtr clip = gc->clientClip; @@ -3238,7 +3239,7 @@ static void sna_gc_move_to_gpu(GCPtr gc) assert(gc->funcs == (GCFuncs *)&sna_gc_funcs__cpu); gc->ops = (GCOps *)&sna_gc_ops; - gc->funcs = (GCFuncs *)&sna_gc_funcs; + gc->funcs = sna_gc(gc)->old_funcs; gc->pCompositeClip = sna_gc(gc)->priv; }