Commit fe19c29e authored by David Garbett's avatar David Garbett

DRI2: Check bo dimensions before reusing

With DRI2INFOREC_VERSION >= 6 we use ARMSOCDRI2ReuseBufferNotify to
determine when to reuse a back buffer, instead of bumping the serial
number in ARMSOCDRI2CreateBuffer.

However ARMSOCDRI2ReuseBufferNotify was only checking that both the old
buffer and the new buffer were both flippable or not-flippable. This is
not correct - just because the old buffer was flipped it doesn't mean it
can be now - the size may have changed. We therefore also need to verify
the buffer size matches the drawable.

Change-Id: Ie86537d3d21a8cfe58017ef4cf02f3292174cb50
parent 8ca85138
......@@ -1034,8 +1034,12 @@ ARMSOCDRI2ReuseBufferNotify(DrawablePtr pDraw, DRI2BufferPtr buffer)
return;
}
bo = boFromBuffer(buffer);
new_canflip = canflip(pDraw);
if (buf->previous_canflip == new_canflip) {
if (buf->previous_canflip == new_canflip &&
armsoc_bo_width(bo) == pDraw->width &&
armsoc_bo_height(bo) == pDraw->height) {
return;
}
......@@ -1046,7 +1050,6 @@ ARMSOCDRI2ReuseBufferNotify(DrawablePtr pDraw, DRI2BufferPtr buffer)
ERROR_MSG("Failed to create buffer");
}
} else {
bo = boFromBuffer(buffer);
fb_id = armsoc_bo_get_fb(bo);
if (buf->previous_canflip == FALSE && new_canflip == TRUE && fb_id == 0) {
ret = armsoc_bo_add_fb(bo);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment