Skip to content

Commit 4020cab

Browse files
Michel Dänzerkeith-packard
Michel Dänzer
authored andcommitted
EXA/mixed: Update sys_pitch in MPH even when there's no system memory copy.
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]> Signed-off-by: Keith Packard <[email protected]>
1 parent a1dec7c commit 4020cab

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

exa/exa_mixed.c

+13-10
Original file line numberDiff line numberDiff line change
@@ -186,17 +186,20 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
186186
}
187187

188188
/* Need to re-create system copy if there's also a GPU copy */
189-
if (has_gpu_copy && pExaPixmap->sys_ptr) {
190-
free(pExaPixmap->sys_ptr);
191-
pExaPixmap->sys_ptr = NULL;
192-
pExaPixmap->sys_pitch = PixmapBytePad(width, depth);
193-
DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
194-
DamageDestroy(pExaPixmap->pDamage);
195-
pExaPixmap->pDamage = NULL;
196-
RegionEmpty(&pExaPixmap->validSys);
189+
if (has_gpu_copy) {
190+
if (pExaPixmap->sys_ptr) {
191+
free(pExaPixmap->sys_ptr);
192+
pExaPixmap->sys_ptr = NULL;
193+
DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
194+
DamageDestroy(pExaPixmap->pDamage);
195+
pExaPixmap->pDamage = NULL;
196+
RegionEmpty(&pExaPixmap->validSys);
197197

198-
if (pExaScr->deferred_mixed_pixmap == pPixmap)
199-
pExaScr->deferred_mixed_pixmap = NULL;
198+
if (pExaScr->deferred_mixed_pixmap == pPixmap)
199+
pExaScr->deferred_mixed_pixmap = NULL;
200+
}
201+
202+
pExaPixmap->sys_pitch = PixmapBytePad(width, depth);
200203
}
201204
}
202205

0 commit comments

Comments
 (0)