Skip to content

Instantly share code, notes, and snippets.

@dsd
Created April 28, 2014 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsd/bf3564fa7a800b25cc23 to your computer and use it in GitHub Desktop.
Save dsd/bf3564fa7a800b25cc23 to your computer and use it in GitHub Desktop.
armsoc: rough patch to make flippable state transition handling independent of serial number (DRI2 no longer looks at this)
diff --git a/src/armsoc_dri2.c b/src/armsoc_dri2.c
index f69dbe8..e82bb64 100644
--- a/src/armsoc_dri2.c
+++ b/src/armsoc_dri2.c
@@ -626,26 +626,30 @@ ARMSOCDRI2ScheduleSwap(ClientPtr client, DrawablePtr pDraw,
src_bo = boFromBuffer(pSrcBuffer);
dst_bo = boFromBuffer(pDstBuffer);
- src_fb_id = armsoc_bo_get_fb(src_bo);
- dst_fb_id = armsoc_bo_get_fb(dst_bo);
-
new_canflip = canflip(pDraw);
if ((src->previous_canflip != new_canflip) ||
(dst->previous_canflip != new_canflip)) {
/* The drawable has transitioned between being flippable and
- * non-flippable or vice versa. Bump the serial number to force
- * the DRI2 buffers to be re-allocated during the next frame so
- * that:
- * - It is able to be scanned out
- * (if drawable is now flippable), or
- * - It is not taking up possibly scarce scanout-able memory
- * (if drawable is now not flippable)
+ * non-flippable or vice versa. Add a framebuffer if desired,
+ * or remove the one it has in order to save potentially
+ * scarce scanout memory.
*/
-
- PixmapPtr pPix = pScreen->GetWindowPixmap((WindowPtr)pDraw);
- pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ if (new_canflip) {
+ if (armsoc_bo_get_fb(src_bo) == 0)
+ armsoc_bo_add_fb(src_bo);
+ if (armsoc_bo_get_fb(dst_bo) == 0)
+ armsoc_bo_add_fb(dst_bo);
+ } else {
+ if (armsoc_bo_get_fb(src_bo) != 0)
+ armsoc_bo_rm_fb(src_bo);
+ if (armsoc_bo_get_fb(dst_bo) != 0)
+ armsoc_bo_rm_fb(dst_bo);
+ }
}
+ src_fb_id = armsoc_bo_get_fb(src_bo);
+ dst_fb_id = armsoc_bo_get_fb(dst_bo);
+
src->previous_canflip = new_canflip;
dst->previous_canflip = new_canflip;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment