xf86-video-intel: 2 commits - src/intel_video.c src/intel_video.h

Daniel Vetter danvet at kemper.freedesktop.org
Mon Jul 26 14:11:28 PDT 2010


 src/intel_video.c |   45 ++++++++++++++++++++++-----------------------
 src/intel_video.h |    2 +-
 2 files changed, 23 insertions(+), 24 deletions(-)

New commits:
commit f46a8dfce59013ce593c15f7166598d0fff9198f
Author: Daniel Vetter <daniel.vetter at ffwll.ch>
Date:   Mon Jul 26 23:02:02 2010 +0200

    video: kill do { ... } while (ret != -EINTR) loops
    
    Chris Wilson likes to sprinkle these all over, but in this
    case it's just misleading. libdrm already does this for us.
    
    Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>

diff --git a/src/intel_video.c b/src/intel_video.c
index a6b2684..a9d4942 100644
--- a/src/intel_video.c
+++ b/src/intel_video.c
@@ -215,9 +215,7 @@ static Bool drmmode_has_overlay(intel_screen_private *intel)
 
 	gp.param = I915_PARAM_HAS_OVERLAY;
 	gp.value = &has_overlay;
-	do {
-		ret = drmCommandWriteRead(intel->drmSubFD, DRM_I915_GETPARAM, &gp, sizeof(gp));
-	} while (ret == -EINTR);
+	ret = drmCommandWriteRead(intel->drmSubFD, DRM_I915_GETPARAM, &gp, sizeof(gp));
 
 	return !! has_overlay;
 }
@@ -240,10 +238,8 @@ static void drmmode_overlay_update_attrs(intel_screen_private *intel)
 	attrs.gamma4 = adaptor_priv->gamma4;
 	attrs.gamma5 = adaptor_priv->gamma5;
 
-	do {
-		ret = drmCommandWriteRead(intel->drmSubFD, DRM_I915_OVERLAY_ATTRS,
-					  &attrs, sizeof(attrs));
-	} while (ret == -EINTR);
+	ret = drmCommandWriteRead(intel->drmSubFD, DRM_I915_OVERLAY_ATTRS,
+				  &attrs, sizeof(attrs));
 }
 
 static void drmmode_overlay_off(intel_screen_private *intel)
@@ -253,10 +249,8 @@ static void drmmode_overlay_off(intel_screen_private *intel)
 
 	request.flags = 0;
 
-	do {
-		ret = drmCommandWrite(intel->drmSubFD, DRM_I915_OVERLAY_PUT_IMAGE,
-				      &request, sizeof(request));
-	} while (ret == -EINTR);
+	ret = drmCommandWrite(intel->drmSubFD, DRM_I915_OVERLAY_PUT_IMAGE,
+			      &request, sizeof(request));
 }
 
 static Bool
@@ -319,10 +313,8 @@ drmmode_overlay_put_image(intel_screen_private *intel,
 			request.flags |= I915_OVERLAY_Y_SWAP;
 	}
 
-	do {
-		ret = drmCommandWrite(intel->drmSubFD, DRM_I915_OVERLAY_PUT_IMAGE,
-				      &request, sizeof(request));
-	} while (ret == -EINTR);
+	ret = drmCommandWrite(intel->drmSubFD, DRM_I915_OVERLAY_PUT_IMAGE,
+			      &request, sizeof(request));
 	if (ret)
 		return FALSE;
 
commit 1cb69b9a77b7afbb4358757556065e10a6b15ea8
Author: Daniel Vetter <daniel.vetter at ffwll.ch>
Date:   Mon Jul 26 23:00:20 2010 +0200

    video: kernel overlay needs triple buffering
    
    The kernel overlay code does asynchronous overlay flips. So keep
    onto two old buffers, for otherwise the rendering of the next
    frame might overwrite the contents of the currently still displaying
    one. With ~25fps videos and ~50 Hz screens that's rather unlikely,
    still, fix it.
    
    Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>

diff --git a/src/intel_video.c b/src/intel_video.c
index 197cb79..a6b2684 100644
--- a/src/intel_video.c
+++ b/src/intel_video.c
@@ -332,8 +332,9 @@ drmmode_overlay_put_image(intel_screen_private *intel,
 		adaptor_priv->reusable = TRUE;
 	}
 
-	tmp = adaptor_priv->old_buf;
-	adaptor_priv->old_buf = adaptor_priv->buf;
+	tmp = adaptor_priv->old_buf[1];
+	adaptor_priv->old_buf[1] = adaptor_priv->old_buf[0];
+	adaptor_priv->old_buf[0] = adaptor_priv->buf;
 	adaptor_priv->buf = tmp;
 
 	return TRUE;
@@ -488,7 +489,8 @@ static XF86VideoAdaptorPtr I830SetupImageVideoOverlay(ScreenPtr screen)
 	adaptor_priv->saturation = 146;	/* 128/112 * 128 */
 	adaptor_priv->desired_crtc = NULL;
 	adaptor_priv->buf = NULL;
-	adaptor_priv->old_buf = NULL;
+	adaptor_priv->old_buf[0] = NULL;
+	adaptor_priv->old_buf[1] = NULL;
 	adaptor_priv->gamma5 = 0xc0c0c0;
 	adaptor_priv->gamma4 = 0x808080;
 	adaptor_priv->gamma3 = 0x404040;
@@ -590,7 +592,8 @@ static XF86VideoAdaptorPtr I830SetupImageVideoTextured(ScreenPtr screen)
 		adaptor_priv->textured = TRUE;
 		adaptor_priv->videoStatus = 0;
 		adaptor_priv->buf = NULL;
-		adaptor_priv->old_buf = NULL;
+		adaptor_priv->old_buf[0] = NULL;
+		adaptor_priv->old_buf[1] = NULL;
 
 		adaptor_priv->rotation = RR_Rotate_0;
 		adaptor_priv->SyncToVblank = 1;
@@ -608,10 +611,14 @@ static XF86VideoAdaptorPtr I830SetupImageVideoTextured(ScreenPtr screen)
 
 static void intel_free_video_buffers(intel_adaptor_private *adaptor_priv)
 {
-	if (adaptor_priv->old_buf) {
-		drm_intel_bo_disable_reuse(adaptor_priv->old_buf);
-		drm_intel_bo_unreference(adaptor_priv->old_buf);
-		adaptor_priv->old_buf = NULL;
+	int i;
+
+	for (i = 0; i < 2; i++) {
+		if (adaptor_priv->old_buf[i]) {
+			drm_intel_bo_disable_reuse(adaptor_priv->old_buf[i]);
+			drm_intel_bo_unreference(adaptor_priv->old_buf[i]);
+			adaptor_priv->old_buf[i] = NULL;
+		}
 	}
 
 	if (adaptor_priv->buf) {
diff --git a/src/intel_video.h b/src/intel_video.h
index d567eac..5920d30 100644
--- a/src/intel_video.h
+++ b/src/intel_video.h
@@ -52,7 +52,7 @@ typedef struct {
 	Time offTime;
 	Time freeTime;
 	/** YUV data buffers */
-	drm_intel_bo *buf, *old_buf;
+	drm_intel_bo *buf, *old_buf[2];
 	Bool reusable;
 
 	Bool textured;


More information about the xorg-commit mailing list