diff options
-rwxr-xr-x | src/armsoc_dri2.c | 7 | ||||
-rw-r--r-- | src/armsoc_driver.h | 15 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/armsoc_dri2.c b/src/armsoc_dri2.c index a5658cd..8e95ecb 100755 --- a/src/armsoc_dri2.c +++ b/src/armsoc_dri2.c @@ -253,6 +253,8 @@ static Bool create_buffer(DrawablePtr pDraw, struct ARMSOCDRI2BufferRec *buf) #endif /* DRI2INFOREC_VERSION >= 6 */ } + DRI2_BUFFER_SET_FB(DRIBUF(buf)->flags, armsoc_bo_get_fb(bo) > 0 ? 1 : 0); + DRI2_BUFFER_SET_REUSED(DRIBUF(buf)->flags, 0); /* Register Pixmap as having a buffer that can be accessed externally, * so needs synchronised access */ ARMSOCRegisterExternalAccess(pPixmap); @@ -1027,6 +1029,7 @@ ARMSOCDRI2ReuseBufferNotify(DrawablePtr pDraw, DRI2BufferPtr buffer) ScreenPtr pScreen = pDraw->pScreen; ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); + DRI2_BUFFER_SET_REUSED(buffer->flags, 1); if (DRI2BufferBackLeft != buffer->attachment) { return; } @@ -1049,12 +1052,16 @@ ARMSOCDRI2ReuseBufferNotify(DrawablePtr pDraw, DRI2BufferPtr buffer) ret = armsoc_bo_add_fb(bo); if (ret) { WARNING_MSG("Falling back to blitting a flippable window"); + } else { + DRI2_BUFFER_SET_FB(buffer->flags, 1); } buf->previous_canflip = new_canflip; } else if (buf->previous_canflip == TRUE && new_canflip == FALSE && fb_id) { ret = armsoc_bo_rm_fb(bo); if (ret) { ERROR_MSG("Could not remove fb for a flippable to non-flippable window"); + } else { + DRI2_BUFFER_SET_FB(buffer->flags, 0); } buf->previous_canflip = new_canflip; } diff --git a/src/armsoc_driver.h b/src/armsoc_driver.h index 09af18d..ef2836f 100644 --- a/src/armsoc_driver.h +++ b/src/armsoc_driver.h @@ -105,6 +105,21 @@ extern _X_EXPORT Bool armsocDebug; ##__VA_ARGS__); \ } while (0) +#define DRI2_BUFFER_FB_MASK 0x02 /* FB: 1, non-FB: 0 */ +#define DRI2_BUFFER_MAPPED_MASK 0x04 /* mapped: 1, not-mapped: 0 */ +#define DRI2_BUFFER_REUSED_MASK 0x08 /* re-used: 1, re-created: 0 */ +#define DRI2_BUFFER_AGE_MASK 0x70 /* buffer age */ +#define DRI2_BUFFER_FLAG_MASK 0x7f /* dri2 buffer flag mask */ + +#define DRI2_BUFFER_GET_FB(flag) ((flag) & DRI2_BUFFER_FB_MASK) ? 1 : 0 +#define DRI2_BUFFER_SET_FB(flag, fb) (flag) |= (((fb) << 1) & DRI2_BUFFER_FB_MASK); +#define DRI2_BUFFER_GET_MAPPED(flag) ((flag) & DRI2_BUFFER_MAPPED_MASK) ? 1 : 0 +#define DRI2_BUFFER_SET_MAPPED(flag, mapped) (flag) |= (((mapped) << 2) & DRI2_BUFFER_MAPPED_MASK); +#define DRI2_BUFFER_GET_REUSED(flag) ((flag) & DRI2_BUFFER_REUSED_MASK) ? 1 : 0 +#define DRI2_BUFFER_SET_REUSED(flag, reused) (flag) |= (((reused) << 3) & DRI2_BUFFER_REUSED_MASK); +#define DRI2_BUFFER_GET_AGE(flag) ((flag) & DRI2_BUFFER_AGE_MASK) >> 4 +#define DRI2_BUFFER_SET_AGE(flag, age) (flag) |= (((age) << 4) & DRI2_BUFFER_AGE_MASK); + /** The driver's Screen-specific, "private" data structure. */ struct ARMSOCRec { /** |