Browse files

dri2: Fix can_exchange() to allow page-flipping on more mesa versions.

can_exchange() returns false and thereby prevents page
flipping on some drawables where page flipping would
work fine. This due to non-matching drawable depths values
between front buffer pixmap and back buffer pixmap, because
front buffer pixmaps inherit the depth of the screen, typically
24 bits, whereas the depth value of back buffer pixmaps for a
given RGB8 or RGBA8 visual depends on the mesa version in use,
either 24 bits or 32 bits.

Use bitsPerPixel instead of depth to decide if drawable
is flippable. This will still catch really incompatible
formats like 32 bpp vs. 16 bpp buffers.

Tested for screen DefaultDepth 24 and also 30 bits
(for RGB10 framebuffers) on NV-50.

The problem was fixed in the same way in the ati & intel ddx.

Signed-off-by: Mario Kleiner <>
Signed-off-by: Ben Skeggs <>
  • Loading branch information...
1 parent b0d7f4d commit 4da68cedbefef4f72c00bb088e179071490882c8 @kleinerm kleinerm committed with Mar 1, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/nouveau_dri2.c
2 src/nouveau_dri2.c
@@ -160,7 +160,7 @@ can_exchange(DrawablePtr draw, PixmapPtr dst_pix, PixmapPtr src_pix)
return ((DRI2CanFlip(draw) && pNv->has_pageflip)) &&
dst_pix->drawable.width == src_pix->drawable.width &&
dst_pix->drawable.height == src_pix->drawable.height &&
- dst_pix->drawable.depth == src_pix->drawable.depth &&
+ dst_pix->drawable.bitsPerPixel == src_pix->drawable.bitsPerPixel &&
dst_pix->devKind == src_pix->devKind;

0 comments on commit 4da68ce

Please sign in to comment.