[PATCH 01/10] dri2: Fix can_exchange() to allow page-flipping on more mesa versions.

Mario Kleiner mario.kleiner at tuebingen.mpg.de
Thu Mar 1 10:11:14 PST 2012

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 <mario.kleiner at tuebingen.mpg.de>
 src/nouveau_dri2.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/nouveau_dri2.c b/src/nouveau_dri2.c
index 3aa5ec5..5b62425 100644
--- a/src/nouveau_dri2.c
+++ b/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;

More information about the xorg-devel mailing list