From: Michel Dänzer <[email protected]>

Otherwise sys_pitch will be stale when a system memory copy is allocated.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=38322 and a crash when
unlocking the screen with xscreensaver, reported by Janne Huttunen.

Signed-off-by: Michel Dänzer <[email protected]>
Tested-by: Janne Huttunen <[email protected]>
Tested-by: Jan Kriho <[email protected]>
---

v2: Still only do this when there's a GPU copy, otherwise the rest of the
    function calling the lower layer should take care of it.

 exa/exa_mixed.c |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c
index fd1afb2..cf01b48 100644
--- a/exa/exa_mixed.c
+++ b/exa/exa_mixed.c
@@ -186,17 +186,20 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, 
int height, int depth,
         }
 
        /* Need to re-create system copy if there's also a GPU copy */
-       if (has_gpu_copy && pExaPixmap->sys_ptr) {
-           free(pExaPixmap->sys_ptr);
-           pExaPixmap->sys_ptr = NULL;
-           pExaPixmap->sys_pitch = PixmapBytePad(width, depth);
-           DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
-           DamageDestroy(pExaPixmap->pDamage);
-           pExaPixmap->pDamage = NULL;
-           RegionEmpty(&pExaPixmap->validSys);
+       if (has_gpu_copy) {
+           if (pExaPixmap->sys_ptr) {
+               free(pExaPixmap->sys_ptr);
+               pExaPixmap->sys_ptr = NULL;
+               DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
+               DamageDestroy(pExaPixmap->pDamage);
+               pExaPixmap->pDamage = NULL;
+               RegionEmpty(&pExaPixmap->validSys);
 
-           if (pExaScr->deferred_mixed_pixmap == pPixmap)
-               pExaScr->deferred_mixed_pixmap = NULL;
+               if (pExaScr->deferred_mixed_pixmap == pPixmap)
+                   pExaScr->deferred_mixed_pixmap = NULL;
+           }
+
+           pExaPixmap->sys_pitch = PixmapBytePad(width, depth);
        }
     }
 
-- 
1.7.5.4

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to