Wait for the VDPAU output surface to be idle in waitToRender()

This commit is contained in:
Cameron Gutman 2022-04-07 22:16:52 -05:00
parent 9790c218dc
commit 81d5e7f014
2 changed files with 13 additions and 1 deletions

View File

@ -474,6 +474,15 @@ void VDPAURenderer::renderOverlay(VdpOutputSurface destination, Overlay::Overlay
} }
} }
void VDPAURenderer::waitToRender()
{
VdpOutputSurface chosenSurface = m_OutputSurface[m_NextSurfaceIndex];
// Wait for the next render target surface to be idle before proceeding
VdpTime pts;
m_VdpPresentationQueueBlockUntilSurfaceIdle(m_PresentationQueue, chosenSurface, &pts);
}
void VDPAURenderer::renderFrame(AVFrame* frame) void VDPAURenderer::renderFrame(AVFrame* frame)
{ {
VdpStatus status; VdpStatus status;
@ -524,7 +533,9 @@ void VDPAURenderer::renderFrame(AVFrame* frame)
} }
} }
// Wait for this frame to be off the screen // Wait for this frame to be off the screen. This will usually be a no-op
// since it already happened in waitToRender(). However, that won't be the
// case is when frame pacing is enabled.
VdpTime pts; VdpTime pts;
m_VdpPresentationQueueBlockUntilSurfaceIdle(m_PresentationQueue, chosenSurface, &pts); m_VdpPresentationQueueBlockUntilSurfaceIdle(m_PresentationQueue, chosenSurface, &pts);

View File

@ -16,6 +16,7 @@ public:
virtual bool initialize(PDECODER_PARAMETERS params) override; virtual bool initialize(PDECODER_PARAMETERS params) override;
virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary** options) override; virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary** options) override;
virtual void notifyOverlayUpdated(Overlay::OverlayType type) override; virtual void notifyOverlayUpdated(Overlay::OverlayType type) override;
virtual void waitToRender() override;
virtual void renderFrame(AVFrame* frame) override; virtual void renderFrame(AVFrame* frame) override;
virtual bool needsTestFrame() override; virtual bool needsTestFrame() override;
virtual int getDecoderColorspace() override; virtual int getDecoderColorspace() override;