[Intel-gfx] [PATCH] DRI2: Fix cleanup if scheduling page flip failed.

Pauli Nieminen suokkos at gmail.com
Fri Mar 26 22:25:29 CET 2010


Cleanup code could have decreased reference count for front buffer to zero
destroying prematurely.

If scheduling page flip fails the state of buffers has to be cleaned. That
includes everything that exchange buffers did before trying to queue the
flip operation.

Calling I830DRI2ExchangeBuffers to quarentees correct clean up.

Signed-off-by: Pauli Nieminen <suokkos at gmail.com>
---
 src/i830_dri.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/src/i830_dri.c b/src/i830_dri.c
index 321faf6..3aff58c 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -469,7 +469,6 @@ I830DRI2ScheduleFlip(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front,
 {
 	ScreenPtr screen = draw->pScreen;
 	I830DRI2BufferPrivatePtr front_priv, back_priv;
-	dri_bo *tmp_bo;
 	DRI2FrameEventPtr flip_info;
 	Bool ret;
 
@@ -485,7 +484,6 @@ I830DRI2ScheduleFlip(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front,
 
 	front_priv = front->driverPrivate;
 	back_priv = back->driverPrivate;
-	tmp_bo = i830_get_pixmap_bo(front_priv->pixmap);
 
 	I830DRI2ExchangeBuffers(draw, front, back);
 
@@ -497,9 +495,7 @@ I830DRI2ScheduleFlip(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front,
 
 	/* Unwind in case of failure */
 	if (!ret) {
-	    i830_set_pixmap_bo(back_priv->pixmap,
-			       i830_get_pixmap_bo(front_priv->pixmap));
-	    i830_set_pixmap_bo(front_priv->pixmap, tmp_bo);
+	    I830DRI2ExchangeBuffers(draw, front, back);
 	    return FALSE;
 	}
 
-- 
1.6.3.3




More information about the Intel-gfx mailing list