From d5e111238deca783d6279ff6d943bf8c1922eb75 Mon Sep 17 00:00:00 2001 From: Johns Date: Fri, 25 Jan 2013 16:55:25 +0100 Subject: [PATCH] Improves VDPAU dissplay preemption handling. --- video.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/video.c b/video.c index ef83fb0..d5573f7 100644 --- a/video.c +++ b/video.c @@ -8321,6 +8321,8 @@ static void VdpauSyncRenderFrame(VdpauDecoder * decoder, } #endif +#if 1 + // FIXME: this part code should be no longer be needed with new mpeg fix while (atomic_read(&decoder->SurfacesFilled) >= VIDEO_SURFACES_MAX) { struct timespec abstime; @@ -8353,6 +8355,7 @@ static void VdpauSyncRenderFrame(VdpauDecoder * decoder, } VdpauSyncDisplayFrame(); } +#endif if (!decoder->Closing) { VideoSetPts(&decoder->PTS, decoder->Interlaced, frame); @@ -8463,13 +8466,6 @@ static void VdpauDisplayHandlerThread(void) struct timespec nowtime; VdpauDecoder *decoder; - if (VdpauPreemption) { // display preempted - if (VdpauPreemptionRecover()) { - usleep(15 * 1000); - return; - } - } - decoded = 0; pthread_mutex_lock(&VideoLockMutex); for (i = 0; i < VdpauDecoderN; ++i) { @@ -8515,6 +8511,13 @@ static void VdpauDisplayHandlerThread(void) return; } + if (VdpauPreemption) { // display preempted + if (VdpauPreemptionRecover()) { + clock_gettime(CLOCK_REALTIME, &VdpauFrameTime); + return; + } + } + pthread_mutex_lock(&VideoLockMutex); VdpauSyncDisplayFrame(); pthread_mutex_unlock(&VideoLockMutex); @@ -9700,6 +9703,10 @@ void VideoDrawRenderState(VideoHwDecoder * hw_decoder, uint32_t end; VdpauDecoder *decoder; + if (VdpauPreemption) { // display preempted + return; + } + decoder = &hw_decoder->Vdpau; if (decoder->VideoDecoder == VDP_INVALID_HANDLE) { // must be hardware decoder!