From 1e74da1af2e9baa27568498c0740f2d7e4a02524 Mon Sep 17 00:00:00 2001 From: CrystalP Date: Mon, 23 Oct 2023 20:35:25 -0400 Subject: [PATCH] [Windows] Disable video settings not supported by the DXVA processor. Brightness and contrast video settings were unconditionally enabled in Windows. Fixed by propagating the brightness, contrast and rotation capabilities of the dxva processor to the video settings screen. Rotation needs more work to enabled/disable according to renderer caps. --- .../VideoRenderers/HwDecRender/DXVAHD.cpp | 15 +++++++++++++++ .../VideoRenderers/HwDecRender/DXVAHD.h | 1 + .../VideoRenderers/WinRenderer.cpp | 19 +++---------------- .../VideoRenderers/windows/RendererBase.cpp | 12 ++++++++++++ .../VideoRenderers/windows/RendererBase.h | 2 ++ .../VideoRenderers/windows/RendererDXVA.cpp | 14 ++++++++++++++ .../VideoRenderers/windows/RendererDXVA.h | 1 + 7 files changed, 48 insertions(+), 16 deletions(-) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/DXVAHD.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/DXVAHD.cpp index cf2d73b750ab3..8147222f65bf8 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/DXVAHD.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/DXVAHD.cpp @@ -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; + } +} diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/DXVAHD.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/DXVAHD.h index 65d2537830020..943a64a0eb0a1 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/DXVAHD.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/DXVAHD.h @@ -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(); diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.cpp index 3ec27f8c6d3df..777600c139f8c 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/WinRenderer.cpp @@ -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 diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererBase.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererBase.cpp index 4156c403afb0c..296dc003fb406 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererBase.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererBase.cpp @@ -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; +} diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererBase.h b/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererBase.h index 475d471b96c13..0c7e8909b1464 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererBase.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererBase.h @@ -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; } diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererDXVA.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererDXVA.cpp index 6a2d0d955aafd..2ef7543242b6b 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererDXVA.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererDXVA.cpp @@ -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) diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererDXVA.h b/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererDXVA.h index 46fe5adef0378..02708d6d18fda 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererDXVA.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererDXVA.h @@ -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;