summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2010-07-26 23:00:20 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2010-07-26 23:00:20 +0200
commit1cb69b9a77b7afbb4358757556065e10a6b15ea8 (patch)
treea2026f45358d1d9a4109cc7d62d9edd8afe44339 /src
parent68df6b2790891683ee2e58daaad34ef17ae344f5 (diff)
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@ffwll.ch>
Diffstat (limited to 'src')
-rw-r--r--src/intel_video.c23
-rw-r--r--src/intel_video.h2
2 files changed, 16 insertions, 9 deletions
diff --git a/src/intel_video.c b/src/intel_video.c
index 197cb795..a6b26843 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 d567eace..5920d30b 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;