Commit 0bdd370ab720 ("dri2: hold extra buffer ref during swap") started
increasing pPixmap->refcnt for DRI2BufferFrontLeft, but that gets never
decremented in OMAPDRI2DestroyBuffer.
Let's fix the issue by pairing the increment with a decrement in
OMAPDRI2DestroyBuffer. Otherwise we get a segfault after rotating an
sgx accelerated opengl es app and then terminating it.
Fixes: 0bdd370ab720 ("dri2: hold extra buffer ref during swap")
Cc: Laurent Pinchart <[email protected]>
Cc: Matthijs van Duin <[email protected]>
Cc: Merlijn Wajer <[email protected]>
Cc: Rob Clark <[email protected]>
Cc: Sebastian Reichel <[email protected]>
Cc: Tomi Valkeinen <[email protected]>
Signed-off-by: Tony Lindgren <[email protected]>
---
src/omap_dri2.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/omap_dri2.c b/src/omap_dri2.c
--- a/src/omap_dri2.c
+++ b/src/omap_dri2.c
@@ -316,7 +316,11 @@ OMAPDRI2DestroyBuffer(DrawablePtr pDraw, DRI2BufferPtr
buffer)
pPriv->pThirdBuffer = NULL;
}
- pScreen->DestroyPixmap(buf->pPixmap);
+ /* Pair refcount increment done in OMAPDRI2CreateBuffer */
+ if (buffer->attachment == DRI2BufferFrontLeft && buf->pPixmap->refcnt)
+ buf->pPixmap->refcnt--;
+ else
+ pScreen->DestroyPixmap(buf->pPixmap);
free(buf);
}
--
2.24.1
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel