summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Barnes <jbarnes@virtuousgeek.org>2010-06-01 13:46:15 -0700
committerJesse Barnes <jbarnes@virtuousgeek.org>2010-06-01 13:46:15 -0700
commitf2272402035574c206a0e3383c55373c440fd928 (patch)
tree5823e776a18fe71b955d681cc6fe44803de9b924
parenta386a003e7b0ff7100434dccd51fedd822454a6c (diff)
DRI2: fix new buffer exchange check
Chris's new buffer exchange check is a good one, but we don't want to hit the immediate blit fallback path if it fails. We still want to schedule a blit for sometime in the future, and we need to use it wherever an exchange might occur (like the secondary flip check or the currently disabled CanExchange check). Fixes https://bugs.freedesktop.org/show_bug.cgi?id=28252. Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
-rw-r--r--src/i830_dri.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/i830_dri.c b/src/i830_dri.c
index 83d953d3..b1189c36 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -494,6 +494,32 @@ I830DRI2ScheduleFlip(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front,
flip_info);
}
+static Bool
+can_exchange(DRI2BufferPtr front, DRI2BufferPtr back)
+{
+ I830DRI2BufferPrivatePtr front_priv = front->driverPrivate;
+ I830DRI2BufferPrivatePtr back_priv = back->driverPrivate;
+ PixmapPtr front_pixmap = front_priv->pixmap;
+ PixmapPtr back_pixmap = back_priv->pixmap;
+
+ if (front_pixmap->drawable.width != back_pixmap->drawable.width)
+ return FALSE;
+
+ if (front_pixmap->drawable.height != back_pixmap->drawable.height)
+ return FALSE;
+
+ /* XXX should we be checking depth instead of bpp? */
+#if 0
+ if (front_pixmap->drawable.depth != back_pixmap->drawable.depth)
+ return FALSE;
+#else
+ if (front_pixmap->drawable.bitsPerPixel != back_pixmap->drawable.bitsPerPixel)
+ return FALSE;
+#endif
+
+ return TRUE;
+}
+
void I830DRI2FrameEventHandler(unsigned int frame, unsigned int tv_sec,
unsigned int tv_usec, void *event_data)
{
@@ -522,6 +548,7 @@ void I830DRI2FrameEventHandler(unsigned int frame, unsigned int tv_sec,
/* If we can still flip... */
if (DRI2CanFlip(drawable) && !intel->shadow_present &&
intel->use_pageflipping &&
+ can_exchange(event->front, event->back) &&
I830DRI2ScheduleFlip(event->client, drawable, event->front,
event->back, event->event_complete,
event->event_data)) {
@@ -533,7 +560,8 @@ void I830DRI2FrameEventHandler(unsigned int frame, unsigned int tv_sec,
case DRI2_SWAP: {
int swap_type;
- if (DRI2CanExchange(drawable)) {
+ if (DRI2CanExchange(drawable) && can_exchange(event->front,
+ event->back)) {
I830DRI2ExchangeBuffers(drawable,
event->front, event->back);
swap_type = DRI2_EXCHANGE_COMPLETE;
@@ -608,32 +636,6 @@ void I830DRI2FlipEventHandler(unsigned int frame, unsigned int tv_sec,
xfree(flip);
}
-static Bool
-can_swap(DRI2BufferPtr front, DRI2BufferPtr back)
-{
- I830DRI2BufferPrivatePtr front_priv = front->driverPrivate;
- I830DRI2BufferPrivatePtr back_priv = back->driverPrivate;
- PixmapPtr front_pixmap = front_priv->pixmap;
- PixmapPtr back_pixmap = back_priv->pixmap;
-
- if (front_pixmap->drawable.width != back_pixmap->drawable.width)
- return FALSE;
-
- if (front_pixmap->drawable.height != back_pixmap->drawable.height)
- return FALSE;
-
- /* XXX should we be checking depth instead of bpp? */
-#if 0
- if (front_pixmap->drawable.depth != back_pixmap->drawable.depth)
- return FALSE;
-#else
- if (front_pixmap->drawable.bitsPerPixel != back_pixmap->drawable.bitsPerPixel)
- return FALSE;
-#endif
-
- return TRUE;
-}
-
/*
* ScheduleSwap is responsible for requesting a DRM vblank event for the
* appropriate frame.
@@ -674,9 +676,6 @@ I830DRI2ScheduleSwap(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front,
if (pipe == -1)
goto blit_fallback;
- if (!can_swap(front, back))
- goto blit_fallback;
-
/* Truncate to match kernel interfaces; means occasional overflow
* misses, but that's generally not a big deal */
*target_msc &= 0xffffffff;
@@ -714,7 +713,8 @@ I830DRI2ScheduleSwap(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front,
/* Flips need to be submitted one frame before */
if (intel->use_pageflipping &&
!intel->shadow_present &&
- DRI2CanFlip(draw)) {
+ DRI2CanFlip(draw) &&
+ can_exchange(front, back)) {
swap_type = DRI2_FLIP;
flip = 1;
}