diff --git a/mythtv/libs/libmythui/mythrender_vdpau.cpp b/mythtv/libs/libmythui/mythrender_vdpau.cpp index 4bc6649..8efda03 100644 --- a/mythtv/libs/libmythui/mythrender_vdpau.cpp +++ b/mythtv/libs/libmythui/mythrender_vdpau.cpp @@ -484,9 +484,61 @@ void MythRenderVDPAU::WaitForFlip(void) INIT_ST VdpTime dummy = 0; - usleep(2000); - vdp_st = vdp_presentation_queue_block_until_surface_idle( - m_flipQueue, surface, &dummy); +// usleep(2000); +#if 0 + { + //LOCK_RENDER + //CHECK_STATUS() + QString out; + VdpTime time; + VdpPresentationQueueStatus status; + bool this_idle = false; + bool some_idle = false; + for (int i = 0; i < m_surfaces.size(); i++) + { + VdpOutputSurface surf = m_outputSurfaces[m_surfaces[i]].m_id; + vdp_presentation_queue_query_surface_status(m_flipQueue, surf, + &status, &time); + if (VDP_PRESENTATION_QUEUE_STATUS_IDLE == status) + { + some_idle = true; + if (surf == surface) + this_idle = true; + out += "I"; + } + else if (VDP_PRESENTATION_QUEUE_STATUS_QUEUED == status) + out += "Q"; + else if (VDP_PRESENTATION_QUEUE_STATUS_VISIBLE == status) + out += "V"; + } + //VERBOSE(VB_IMPORTANT, LOC + QString("Queue status: %1").arg(out)); + if (!some_idle || !this_idle) + { + VERBOSE(VB_PLAYBACK, LOC + "NO SURFACES AVAILABLE"); + } + VERBOSE(VB_PLAYBACK, LOC + QString("Queue: current %1 some %2 (%3) - %4") + .arg(this_idle).arg(some_idle).arg(out).arg((long long)(time/1000000))); + } +#endif + + VdpTime now, time; + VdpPresentationQueueStatus status; + VERBOSE(VB_IMPORTANT, LOC + "vdp_presentation_queue_block_until_surface_idle() -- start"); + bool idle_surface = false; + while (!idle_surface) + { + vdp_presentation_queue_query_surface_status(m_flipQueue, surface, + &status, &time); + vdp_st = vdp_presentation_queue_get_time(m_flipQueue, &now); + CHECK_ST + if (status == VDP_PRESENTATION_QUEUE_STATUS_IDLE) + idle_surface = true; + VERBOSE(VB_IMPORTANT, LOC + QString("vdp_presentation_queue_status time = %1 now = %2").arg((long long)time).arg((long long)now)); + usleep(1000); + } +// vdp_st = vdp_presentation_queue_block_until_surface_idle( +// m_flipQueue, surface, &dummy); + VERBOSE(VB_IMPORTANT, LOC + QString("vdp_presentation_queue_block_until_surface_idle() -- end - %1").arg((long long)(dummy/1000000))); CHECK_ST } @@ -1541,6 +1593,8 @@ bool MythRenderVDPAU::GetProcs(void) vdp_presentation_queue_get_time); GET_PROC(VDP_FUNC_ID_PRESENTATION_QUEUE_SET_BACKGROUND_COLOR, vdp_presentation_queue_set_background_color); + GET_PROC(VDP_FUNC_ID_PRESENTATION_QUEUE_QUERY_SURFACE_STATUS, + vdp_presentation_queue_query_surface_status); GET_PROC(VDP_FUNC_ID_DECODER_CREATE, vdp_decoder_create); GET_PROC(VDP_FUNC_ID_DECODER_DESTROY, vdp_decoder_destroy); GET_PROC(VDP_FUNC_ID_DECODER_RENDER, vdp_decoder_render); @@ -1756,6 +1810,7 @@ void MythRenderVDPAU::ResetProcs(void) vdp_presentation_queue_target_create_x11 = NULL; vdp_presentation_queue_get_time = NULL; vdp_presentation_queue_set_background_color = NULL; + vdp_presentation_queue_query_surface_status = NULL; vdp_decoder_create = NULL; vdp_decoder_destroy = NULL; vdp_decoder_render = NULL;