Mesa (master): vl: round next_msc to integer frame, and kill skew_msc

Maarten Lankhorst mlankhorst at kemper.freedesktop.org
Mon Jan 21 22:50:02 UTC 2013


Module: Mesa
Branch: master
Commit: 3a91e7955ace2885cfb23089852018a8037ca134
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3a91e7955ace2885cfb23089852018a8037ca134

Author: Maarten Lankhorst <maarten.lankhorst at canonical.com>
Date:   Sat Jan 19 23:03:53 2013 +0100

vl: round next_msc to integer frame, and kill skew_msc

This reduces jitter slightly in a cleaner way, without desynchronizing mplayer2 as badly
when falling behind.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst at canonical.com>
Reviewed-by: Christian König <christian.koenig at amd.com>

---

 src/gallium/auxiliary/vl/vl_winsys_dri.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri.c b/src/gallium/auxiliary/vl/vl_winsys_dri.c
index 95aabac..560c914 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri.c
@@ -65,7 +65,7 @@ struct vl_dri_screen
    xcb_dri2_wait_sbc_cookie_t wait_cookie;
    xcb_dri2_get_buffers_cookie_t buffers_cookie;
 
-   int64_t last_ust, ns_frame, last_msc, next_msc, skew_msc;
+   int64_t last_ust, ns_frame, last_msc, next_msc;
 };
 
 static const unsigned int attachments[1] = { XCB_DRI2_ATTACHMENT_BUFFER_BACK_LEFT };
@@ -81,9 +81,6 @@ vl_dri2_handle_stamps(struct vl_dri_screen* scrn,
    if (scrn->last_ust && scrn->last_msc && (ust > scrn->last_ust) && (msc > scrn->last_msc))
       scrn->ns_frame = (ust - scrn->last_ust) / (msc - scrn->last_msc);
 
-   if (scrn->next_msc && (scrn->next_msc < msc))
-      scrn->skew_msc++;
-
    scrn->last_ust = ust;
    scrn->last_msc = msc;
 }
@@ -282,7 +279,7 @@ vl_screen_set_next_timestamp(struct vl_screen *vscreen, uint64_t stamp)
    struct vl_dri_screen *scrn = (struct vl_dri_screen*)vscreen;
    assert(scrn);
    if (stamp && scrn->last_ust && scrn->ns_frame && scrn->last_msc)
-      scrn->next_msc = ((int64_t)stamp - scrn->last_ust) / scrn->ns_frame + scrn->last_msc + scrn->skew_msc;
+      scrn->next_msc = ((int64_t)stamp - scrn->last_ust + scrn->ns_frame/2) / scrn->ns_frame + scrn->last_msc;
    else
       scrn->next_msc = 0;
 }




More information about the mesa-commit mailing list