Skip to content

Commit

Permalink
Merge pull request xbmc#23988 from CrystalP/fix-dxva-caps
Browse files Browse the repository at this point in the history
[Windows] Disable video settings not supported by the DXVA processor.
  • Loading branch information
CrystalP authored Oct 24, 2023
2 parents 6629108 + 1e74da1 commit 3e13d1a
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 16 deletions.
15 changes: 15 additions & 0 deletions xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/DXVAHD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,3 +660,18 @@ bool CProcessorHD::SetConversion(const ProcessorConversion& conversion)

return true;
}

bool CProcessorHD::Supports(ERENDERFEATURE feature) const
{
switch (feature)
{
case RENDERFEATURE_BRIGHTNESS:
return m_procCaps.m_Filters[D3D11_VIDEO_PROCESSOR_FILTER_BRIGHTNESS].bSupported;
case RENDERFEATURE_CONTRAST:
return m_procCaps.m_Filters[D3D11_VIDEO_PROCESSOR_FILTER_CONTRAST].bSupported;
case RENDERFEATURE_ROTATION:
return (m_procCaps.m_vcaps.FeatureCaps & D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ROTATION);
default:
return false;
}
}
1 change: 1 addition & 0 deletions xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/DXVAHD.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class CProcessorHD : public ID3DResource
static bool IsSuperResolutionSuitable(const VideoPicture& picture);
void TryEnableVideoSuperResolution();
bool IsVideoSuperResolutionEnabled() const { return m_superResolutionEnabled; }
bool Supports(ERENDERFEATURE feature) const;

protected:
bool ReInit();
Expand Down
19 changes: 3 additions & 16 deletions xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,23 +272,10 @@ bool CWinRenderer::Flush(bool saveBuffers)

bool CWinRenderer::Supports(ERENDERFEATURE feature) const
{
if(feature == RENDERFEATURE_BRIGHTNESS)
return true;

if(feature == RENDERFEATURE_CONTRAST)
return true;

if (feature == RENDERFEATURE_STRETCH ||
feature == RENDERFEATURE_NONLINSTRETCH ||
feature == RENDERFEATURE_ZOOM ||
feature == RENDERFEATURE_VERTICAL_SHIFT ||
feature == RENDERFEATURE_PIXEL_RATIO ||
feature == RENDERFEATURE_ROTATION ||
feature == RENDERFEATURE_POSTPROCESS ||
feature == RENDERFEATURE_TONEMAP)
return true;
if (!m_bConfigured)
return false;

return false;
return m_renderer->Supports(feature);
}

bool CWinRenderer::Supports(ESCALINGMETHOD method) const
Expand Down
12 changes: 12 additions & 0 deletions xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -770,3 +770,15 @@ bool CRendererBase::IntendToRenderAsHDR(const VideoPicture& picture)

return streamIsHDR && canDisplayHDR;
}

bool CRendererBase::Supports(ERENDERFEATURE feature) const
{
if (feature == RENDERFEATURE_BRIGHTNESS || feature == RENDERFEATURE_CONTRAST ||
feature == RENDERFEATURE_STRETCH || feature == RENDERFEATURE_NONLINSTRETCH ||
feature == RENDERFEATURE_ZOOM || feature == RENDERFEATURE_VERTICAL_SHIFT ||
feature == RENDERFEATURE_PIXEL_RATIO || feature == RENDERFEATURE_ROTATION ||
feature == RENDERFEATURE_POSTPROCESS || feature == RENDERFEATURE_TONEMAP)
return true;

return false;
}
2 changes: 2 additions & 0 deletions xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ class CRendererBase
virtual CRenderInfo GetRenderInfo();
virtual bool Configure(const VideoPicture &picture, float fps, unsigned int orientation);
virtual bool Supports(ESCALINGMETHOD method) const = 0;
virtual bool Supports(ERENDERFEATURE feature) const;

virtual bool WantsDoublePass() { return false; }
virtual bool NeedBuffer(int idx) { return false; }

Expand Down
14 changes: 14 additions & 0 deletions xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererDXVA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,20 @@ void CRendererDXVA::FillBuffersSet(CRenderBuffer* (&buffers)[8])
}
}

bool CRendererDXVA::Supports(ERENDERFEATURE feature) const
{
if (feature == RENDERFEATURE_BRIGHTNESS || feature == RENDERFEATURE_CONTRAST ||
feature == RENDERFEATURE_ROTATION)
{
if (m_processor)
return m_processor->Supports(feature);

return false;
}

return CRendererBase::Supports(feature);
}

bool CRendererDXVA::Supports(ESCALINGMETHOD method) const
{
if (method == VS_SCALINGMETHOD_DXVA_HARDWARE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class CRendererDXVA : public CRendererHQ

CRenderInfo GetRenderInfo() override;
bool Supports(ESCALINGMETHOD method) const override;
bool Supports(ERENDERFEATURE feature) const override;
bool WantsDoublePass() override { return true; }
bool Configure(const VideoPicture& picture, float fps, unsigned orientation) override;
bool NeedBuffer(int idx) override;
Expand Down

0 comments on commit 3e13d1a

Please sign in to comment.