Skip to content

Commit

Permalink
The power options menu closes dialog when toggle HDR is done.
Browse files Browse the repository at this point in the history
GetOSHDRStatus() changed to bool (true = Windows HDR ON)
  • Loading branch information
thexai committed Jan 5, 2020
1 parent a0d9723 commit 0ec0ca9
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 9 deletions.
2 changes: 2 additions & 0 deletions addons/skin.estuary/xml/DialogButtonMenu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@
<item>
<label>$LOCALIZE[13037]</label>
<onclick>ToggleDisplayHDR()</onclick>
<onclick>dialog.close(all,true)</onclick>
<visible>System.IsHDRDisplayOff</visible>
</item>
<item>
<label>$LOCALIZE[13038]</label>
<onclick>ToggleDisplayHDR()</onclick>
<onclick>dialog.close(all,true)</onclick>
<visible>System.IsHDRDisplayOn</visible>
</item>
<item>
Expand Down
5 changes: 4 additions & 1 deletion xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/DXVAHD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ bool CProcessorHD::InitProcessor()
if (0 != (m_vcaps.FeatureCaps & D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_LEGACY))
CLog::LogF(LOGWARNING, "the video driver does not support full video processing capabilities.");

if (!DX::Windowing()->IsHDROutput())
m_bSupportHDR10 = false;

m_max_back_refs = 0;
m_max_fwd_refs = 0;
m_procIndex = 0;
Expand Down Expand Up @@ -529,7 +532,7 @@ bool CProcessorHD::Render(CRect src, CRect dst, ID3D11Resource* target, CRenderB
// makes target available for processing in shaders
videoCtx1->VideoProcessorSetOutputShaderUsage(m_pVideoProcessor.Get(), 1);

// only used for DXVA HW tone mapping HDR to SDR
// only used for DXVA HW tone mapping HDR to SDR
if (!DX::Windowing()->IsHDROutput() && m_bSupportHDR10 &&
views[2]->color_transfer == AVCOL_TRC_SMPTE2084 && views[2]->primaries == AVCOL_PRI_BT2020)
{
Expand Down
6 changes: 4 additions & 2 deletions xbmc/guilib/guiinfo/SystemGUIInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,10 +571,12 @@ bool CSystemGUIInfo::GetBool(bool& value, const CGUIListItem *gitem, int context
value = CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_showExitButton;
return true;
case SYSTEM_IS_HDR_DISPLAY_OFF:
value = (1 == CServiceBroker::GetWinSystem()->GetOSHDRStatus());
value = CServiceBroker::GetWinSystem()->IsHDRDisplay() &&
!CServiceBroker::GetWinSystem()->GetOSHDRStatus();
return true;
case SYSTEM_IS_HDR_DISPLAY_ON:
value = (2 == CServiceBroker::GetWinSystem()->GetOSHDRStatus());
value = CServiceBroker::GetWinSystem()->IsHDRDisplay() &&
CServiceBroker::GetWinSystem()->GetOSHDRStatus();
return true;
case SYSTEM_HAS_LOGINSCREEN:
value = CServiceBroker::GetSettingsComponent()->GetProfileManager()->UsingLoginScreen();
Expand Down
2 changes: 1 addition & 1 deletion xbmc/interfaces/builtins/GUIBuiltins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,6 @@ CBuiltins::CommandMap CGUIBuiltins::GetOperations() const
{"setstereomode", {"Changes the stereo mode of the GUI. Params can be: toggle, next, previous, select, tomono or any of the supported stereomodes (off, split_vertical, split_horizontal, row_interleaved, hardware_based, anaglyph_cyan_red, anaglyph_green_magenta, anaglyph_yellow_blue, monoscopic)", 1, SetStereoMode}},
{"takescreenshot", {"Takes a Screenshot", 0, Screenshot}},
{"toggledirtyregionvisualization", {"Enables/disables dirty-region visualization", 0, ToggleDirty}},
{"toggledisplayhdr", {"Toggles display HDR On/Off and restarts Kodi. Function always invert current status e.g. OFF->ON->OFF->ON. In Windows is equivalent to Windows HDR switch in display settings", 0, ToggleDisplayHDR}}
{"toggledisplayhdr", {"Toggles display HDR On/Off. Function always invert current state. In Windows is equivalent to Windows HDR switch in display settings", 0, ToggleDisplayHDR}}
};
}
2 changes: 1 addition & 1 deletion xbmc/rendering/dx/DeviceResources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ void DX::DeviceResources::ResizeBuffers()
}
}

isHdrEnabled = (2 == DX::Windowing()->GetOSHDRStatus());
isHdrEnabled = DX::Windowing()->GetOSHDRStatus();

if (m_swapChain != nullptr)
{
Expand Down
2 changes: 1 addition & 1 deletion xbmc/windowing/WinSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class CWinSystemBase
std::shared_ptr<CDPMSSupport> GetDPMSManager();
virtual bool SetHDR(const VideoPicture* videoPicture) { return false; };
virtual bool IsHDRDisplay() { return false; };
virtual int GetOSHDRStatus() { return 0; };
virtual bool GetOSHDRStatus() { return false; };

static const char* SETTING_WINSYSTEM_IS_HDR_DISPLAY;

Expand Down
7 changes: 5 additions & 2 deletions xbmc/windowing/windows/WinSystemWin32DX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,12 @@ bool CWinSystemWin32DX::IsHDRDisplay()
return false;
}

int CWinSystemWin32DX::GetOSHDRStatus()
bool CWinSystemWin32DX::GetOSHDRStatus()
{
return CWIN32Util::GetWindowsHDRStatus();
if (CWIN32Util::GetWindowsHDRStatus() == 2)
return true;

return false;
}

bool CWinSystemWin32DX::IsHDROutput() const
Expand Down
2 changes: 1 addition & 1 deletion xbmc/windowing/windows/WinSystemWin32DX.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class CWinSystemWin32DX : public CWinSystemWin32, public CRenderSystemDX
// HDR OS/display override
bool SetHDR(const VideoPicture* videoPicture) override;
bool IsHDRDisplay() override;
int GetOSHDRStatus() override;
bool GetOSHDRStatus() override;

// HDR support
bool IsHDROutput() const;
Expand Down

0 comments on commit 0ec0ca9

Please sign in to comment.