diff options
26 files changed, 433 insertions, 314 deletions
diff --git a/addons/skin.estuary/xml/Includes_PVR.xml b/addons/skin.estuary/xml/Includes_PVR.xml index 3efc543411..938eb63dad 100644 --- a/addons/skin.estuary/xml/Includes_PVR.xml +++ b/addons/skin.estuary/xml/Includes_PVR.xml @@ -267,8 +267,8 @@ <rulerunit>6</rulerunit> <onleft>9000</onleft> <onright>60</onright> - <onup>$PARAM[control_onup_id]</onup> - <ondown>$PARAM[control_id]</ondown> + <onup>$PARAM[control_onupdown_id]</onup> + <ondown>$PARAM[control_onupdown_id]</ondown> <viewtype label="$PARAM[viewtype_label]">list</viewtype> <progresstexture border="$PARAM[progress_texture_border]" colordiffuse="button_focus">$PARAM[progress_texture]</progresstexture> <rulerdatelayout width="1700" height="45" condition="$PARAM[has_rulerdate_layout]"> diff --git a/addons/skin.estuary/xml/MyPVRGuide.xml b/addons/skin.estuary/xml/MyPVRGuide.xml index 409fdd7011..e6187ea079 100644 --- a/addons/skin.estuary/xml/MyPVRGuide.xml +++ b/addons/skin.estuary/xml/MyPVRGuide.xml @@ -114,7 +114,7 @@ <param name="control_id" value="50"/> <param name="control_orientation" value="vertical"/> <param name="control_top" value="55"/> - <param name="control_onup_id" value="11"/> + <param name="control_onupdown_id" value="11"/> <param name="viewtype_label" value="19298"/> <param name="progress_texture_border" value="0,60,18,14"/> <param name="progress_texture" value="windows/pvr/epg_progress_vertical.png"/> @@ -128,7 +128,7 @@ <param name="control_id" value="51"/> <param name="control_orientation" value="horizontal"/> <param name="control_top" value="55"/> - <param name="control_onup_id" value="11"/> + <param name="control_onupdown_id" value="11"/> <param name="viewtype_label" value="19297"/> <param name="progress_texture_border" value="5,10,5,10"/> <param name="progress_texture" value="windows/pvr/epg_progress_horizontal.png"/> @@ -142,7 +142,7 @@ <param name="control_id" value="52"/> <param name="control_orientation" value="vertical"/> <param name="control_top" value="0"/> - <param name="control_onup_id" value="52"/> + <param name="control_onupdown_id" value="52"/> <param name="viewtype_label" value="19301"/> <param name="progress_texture_border" value="0,60,18,14"/> <param name="progress_texture" value="windows/pvr/epg_progress_vertical.png"/> @@ -156,7 +156,7 @@ <param name="control_id" value="53"/> <param name="control_orientation" value="horizontal"/> <param name="control_top" value="0"/> - <param name="control_onup_id" value="53"/> + <param name="control_onupdown_id" value="53"/> <param name="viewtype_label" value="19300"/> <param name="progress_texture_border" value="5,10,5,10"/> <param name="progress_texture" value="windows/pvr/epg_progress_horizontal.png"/> diff --git a/system/shaders/GL/1.2/gl_yuv2rgb_basic.glsl b/system/shaders/GL/1.2/gl_yuv2rgb_basic.glsl index 08d4f5e241..57c3a1760b 100644 --- a/system/shaders/GL/1.2/gl_yuv2rgb_basic.glsl +++ b/system/shaders/GL/1.2/gl_yuv2rgb_basic.glsl @@ -122,7 +122,7 @@ vec4 process() #endif #if defined(XBMC_COL_CONVERSION) - rgb.rgb = pow(rgb.rgb, vec3(m_gammaSrc)); + rgb.rgb = pow(max(vec3(0), rgb.rgb), vec3(m_gammaSrc)); rgb.rgb = max(vec3(0), m_primMat * rgb.rgb); rgb.rgb = pow(rgb.rgb, vec3(m_gammaDstInv)); #endif diff --git a/system/shaders/GL/1.5/gl_yuv2rgb_basic.glsl b/system/shaders/GL/1.5/gl_yuv2rgb_basic.glsl index 48ce685e69..5bd2565ac2 100644 --- a/system/shaders/GL/1.5/gl_yuv2rgb_basic.glsl +++ b/system/shaders/GL/1.5/gl_yuv2rgb_basic.glsl @@ -93,7 +93,7 @@ vec4 process() rgb.a = m_alpha; #if defined(XBMC_COL_CONVERSION) - rgb.rgb = pow(rgb.rgb, vec3(m_gammaSrc)); + rgb.rgb = pow(max(vec3(0), rgb.rgb), vec3(m_gammaSrc)); rgb.rgb = max(vec3(0), m_primMat * rgb.rgb); rgb.rgb = pow(rgb.rgb, vec3(m_gammaDstInv)); diff --git a/system/shaders/yuv2rgb_d3d.fx b/system/shaders/yuv2rgb_d3d.fx index 4eb59dd6f0..eef7f16f01 100644 --- a/system/shaders/yuv2rgb_d3d.fx +++ b/system/shaders/yuv2rgb_d3d.fx @@ -129,7 +129,9 @@ float4 YUV2RGB(VS_OUTPUT In) : SV_TARGET float4 rgb = mul(YUV, g_ColorMatrix); #if defined(XBMC_COL_CONVERSION) - rgb.rgb = pow(max(0.0, mul(pow(rgb, g_gammaSrc), g_primMat)), g_gammaDstInv).rgb; + rgb.rgb = pow(max(0.0, rgb.rgb), g_gammaSrc); + rgb.rgb = max(0.0, mul(rgb, g_primMat).rgb); + rgb.rgb = pow(rgb.rgb, g_gammaDstInv); #endif return output4(rgb, In.TextureY); } diff --git a/tools/buildsteps/windows/vswhere.bat b/tools/buildsteps/windows/vswhere.bat index 5688605ab1..7c8e7c0133 100644 --- a/tools/buildsteps/windows/vswhere.bat +++ b/tools/buildsteps/windows/vswhere.bat @@ -24,7 +24,7 @@ IF "%arch%"=="x86" ( ) IF "%vcstore%"=="store" ( - SET sdkver=10.0.14393.0 + SET sdkver=10.0.16299.0 SET toolsdir="win10-%toolsdir%" ) diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp index bc50cdd426..e681ba4c06 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp @@ -54,8 +54,7 @@ // amcodec include extern "C" { -#include <codec.h> -#include <amports/amstream.h> +#include <amcodec/codec.h> } // extern "C" CEvent g_aml_sync_event; @@ -345,44 +344,6 @@ typedef struct vframe_states int buf_avail_num; } vframe_states_t; -static int aml_ioctl_get(CODEC_HANDLE h, int subcmd, unsigned long paramter) -{ - struct am_ioctl_parm parm; - memset(&parm, 0, sizeof(parm)); - parm.cmd = subcmd; - parm.data_32 = *(unsigned int *)paramter; - if (ioctl(h, AMSTREAM_IOC_GET, (unsigned long)&parm) < 0) - { - CLog::Log(LOGERROR, "aml_ioctl_get failed: subcmd=%x, errno=%d", subcmd, errno); - return -1; - } - *(unsigned int *)paramter = parm.data_32; - return 0; -} - - -#ifndef AMSTREAM_IOC_MAGIC -#define AMSTREAM_IOC_MAGIC 'S' -#endif - -#ifndef AMSTREAM_IOC_VF_STATUS -#define AMSTREAM_IOC_VF_STATUS _IOR(AMSTREAM_IOC_MAGIC, 0x60, unsigned long) -#endif - -#ifndef AMSTREAM_IOC_GET_3D_TYPE -#define AMSTREAM_IOC_GET_3D_TYPE _IOW((AMSTREAM_IOC_MAGIC), 0x3d, unsigned int) -#endif - - -enum -{ - VPP_3D_MODE_NULL = 0, - VPP_3D_MODE_LR, - VPP_3D_MODE_TB, - VPP_3D_MODE_LA, - VPP_3D_MODE_FA -}; - /*************************************************************************/ /*************************************************************************/ void dumpfile_open(am_private_t *para) @@ -2267,65 +2228,6 @@ void CAMLCodec::SetVideoSaturation(const int saturation) SysfsUtils::SetInt("/sys/class/video/saturation", saturation); } -bool CAMLCodec::SetVideo3dMode(const int mode3d) -{ - bool result = true; - if (SysfsUtils::Has("/sys/class/ppmgr/ppmgr_3d_mode")) - { - CLog::Log(LOGDEBUG, "CAMLCodec::SetVideo3dMode:mode3d(0x%x)", mode3d); - SysfsUtils::SetInt("/sys/class/ppmgr/ppmgr_3d_mode", mode3d); - } - else - { - CLog::Log(LOGINFO, "CAMLCodec::SetVideo3dMode: ppmgr_3d support not found in kernel."); - result = false; - } - return result; -} - -std::string CAMLCodec::GetStereoMode() -{ - std::string stereoMode; - - //Get Decoder Stereo mode - int decoder_sm(VPP_3D_MODE_NULL); - aml_ioctl_get(am_private->vcodec.handle, AMSTREAM_IOC_GET_3D_TYPE, (unsigned long)&decoder_sm); - - switch (decoder_sm) - { - case VPP_3D_MODE_LR: - stereoMode = "left_right"; - break; - case VPP_3D_MODE_TB: - stereoMode = "top_bottom"; - break; - case VPP_3D_MODE_LA: - case VPP_3D_MODE_FA: - default: - switch(m_processInfo.GetVideoSettings().m_StereoMode) - { - case RENDER_STEREO_MODE_SPLIT_VERTICAL: - stereoMode = "left_right"; - break; - case RENDER_STEREO_MODE_SPLIT_HORIZONTAL: - stereoMode = "top_bottom"; - break; - default: - stereoMode = m_hints.stereo_mode; - break; - } - } - - if (m_processInfo.GetVideoSettings().m_StereoInvert) - { - if (stereoMode == "top_bottom") - stereoMode = "bottom_top"; - else if (stereoMode == "left_right") - stereoMode = "right_left"; - } - return stereoMode; -} - void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect) { // this routine gets called every video frame @@ -2362,20 +2264,20 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect) update = true; } - // video stereo mode/view. - RENDER_STEREO_MODE stereo_mode = g_graphicsContext.GetStereoMode(); - if (m_stereo_mode != stereo_mode) + // GUI stereo mode/view. + RENDER_STEREO_MODE guiStereoMode = g_graphicsContext.GetStereoMode(); + if (m_guiStereoMode != guiStereoMode) { - m_stereo_mode = stereo_mode; + m_guiStereoMode = guiStereoMode; update = true; } - RENDER_STEREO_VIEW stereo_view = g_graphicsContext.GetStereoView(); - if (m_stereo_view != stereo_view) + RENDER_STEREO_VIEW guiStereoView = g_graphicsContext.GetStereoView(); + if (m_guiStereoView != guiStereoView) { // left/right/top/bottom eye, // this might change every other frame. // we do not care but just track it. - m_stereo_view = stereo_view; + m_guiStereoView = guiStereoView; } // dest_rect @@ -2427,9 +2329,9 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect) { float xscale = display.Width() / gui.Width(); float yscale = display.Height() / gui.Height(); - if (m_stereo_mode == RENDER_STEREO_MODE_SPLIT_VERTICAL) + if (m_guiStereoMode == RENDER_STEREO_MODE_SPLIT_VERTICAL) xscale /= 2.0; - else if (m_stereo_mode == RENDER_STEREO_MODE_SPLIT_HORIZONTAL) + else if (m_guiStereoMode == RENDER_STEREO_MODE_SPLIT_HORIZONTAL) yscale /= 2.0; dst_rect.x1 *= xscale; dst_rect.x2 *= xscale; @@ -2437,75 +2339,21 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect) dst_rect.y2 *= yscale; } - if (m_stereo_mode == RENDER_STEREO_MODE_MONO) + if (m_guiStereoMode == RENDER_STEREO_MODE_MONO) { - std::string mode = GetStereoMode(); - if (mode == "left_right") - { - if (!SetVideo3dMode(MODE_3D_TO_2D_L)) - { - // fall back to software scaling if no hw support - // was found - dst_rect.x2 *= 2.0; - } - } - else if (mode == "right_left") - { - if (!SetVideo3dMode(MODE_3D_TO_2D_R)) - { - // fall back to software scaling if no hw support - // was found - dst_rect.x2 *= 2.0; - } - } - else if (mode == "top_bottom") - { - if (!SetVideo3dMode(MODE_3D_TO_2D_T)) - { - // fall back to software scaling if no hw support - // was found - dst_rect.y2 *= 2.0; - } - } - else if (mode == "bottom_top") - { - if (!SetVideo3dMode(MODE_3D_TO_2D_B)) - { - // fall back to software scaling if no hw support - // was found - dst_rect.y2 *= 2.0; - } - } - else - SetVideo3dMode(MODE_3D_DISABLE); + std::string videoStereoMode = m_processInfo.GetVideoStereoMode(); + if (videoStereoMode == "left_right" || videoStereoMode == "righ_left") + dst_rect.x2 *= 2.0; + else if (videoStereoMode == "top_bottom" || videoStereoMode == "bottom_top") + dst_rect.y2 *= 2.0; } - else if (m_stereo_mode == RENDER_STEREO_MODE_SPLIT_VERTICAL) + else if (m_guiStereoMode == RENDER_STEREO_MODE_SPLIT_VERTICAL) { dst_rect.x2 *= 2.0; - SetVideo3dMode(MODE_3D_DISABLE); } - else if (m_stereo_mode == RENDER_STEREO_MODE_SPLIT_HORIZONTAL) + else if (m_guiStereoMode == RENDER_STEREO_MODE_SPLIT_HORIZONTAL) { dst_rect.y2 *= 2.0; - SetVideo3dMode(MODE_3D_DISABLE); - } - else if (m_stereo_mode == RENDER_STEREO_MODE_INTERLACED) - { - std::string mode = GetStereoMode(); - if (mode == "left_right") - SetVideo3dMode(MODE_3D_LR); - else if (mode == "right_left") - SetVideo3dMode(MODE_3D_LR_SWITCH); - else if (mode == "row_interleaved_lr") - SetVideo3dMode(MODE_3D_LR); - else if (mode == "row_interleaved_rl") - SetVideo3dMode(MODE_3D_LR_SWITCH); - else - SetVideo3dMode(MODE_3D_DISABLE); - } - else - { - SetVideo3dMode(MODE_3D_DISABLE); } #if 1 @@ -2525,8 +2373,8 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect) CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:gui(%s)", s_gui.c_str()); CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:m_dst_rect(%s)", s_m_dst_rect.c_str()); CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:dst_rect(%s)", s_dst_rect.c_str()); - CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:m_stereo_mode(%d)", m_stereo_mode); - CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:m_stereo_view(%d)", m_stereo_view); + CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:m_guiStereoMode(%d)", m_guiStereoMode); + CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:m_guiStereoView(%d)", m_guiStereoView); #endif // goofy 0/1 based difference in aml axis coordinates. diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h index 378c237c3b..7d119842a9 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h @@ -71,8 +71,6 @@ private: void SetVideoContrast(const int contrast); void SetVideoBrightness(const int brightness); void SetVideoSaturation(const int saturation); - bool SetVideo3dMode(const int mode3d); - std::string GetStereoMode(); bool OpenAmlVideo(const CDVDStreamInfo &hints); void CloseAmlVideo(); std::string GetVfmMap(const std::string &name); @@ -96,8 +94,8 @@ private: CRect m_display_rect; int m_view_mode = -1; - RENDER_STEREO_MODE m_stereo_mode = RENDER_STEREO_MODE_OFF; - RENDER_STEREO_VIEW m_stereo_view = RENDER_STEREO_VIEW_OFF; + RENDER_STEREO_MODE m_guiStereoMode = RENDER_STEREO_MODE_OFF; + RENDER_STEREO_VIEW m_guiStereoView = RENDER_STEREO_VIEW_OFF; float m_zoom = -1.0f; int m_contrast = -1; int m_brightness = -1; diff --git a/xbmc/platform/win10/Win10App.cpp b/xbmc/platform/win10/Win10App.cpp index 9b895c4c4f..4c2c3e48a9 100644 --- a/xbmc/platform/win10/Win10App.cpp +++ b/xbmc/platform/win10/Win10App.cpp @@ -28,6 +28,7 @@ #include "settings/AdvancedSettings.h" #include "platform/Environment.h" #include "utils/log.h" +#include "utils/SystemInfo.h" #include "windowing/win10/WinEventsWin10.h" #include "Win10App.h" @@ -83,7 +84,6 @@ void App::Initialize(CoreApplicationView^ applicationView) // Called when the CoreWindow object is created (or re-created). void App::SetWindow(CoreWindow^ window) { - DX::CoreWindowHolder::Get()->SetWindow(window); } // Initializes scene resources, or loads a previously saved app state. @@ -105,6 +105,10 @@ void App::Run() CAppParamParser appParamParser; appParamParser.Parse(m_argv.data(), m_argv.size()); + + if (CSysInfo::GetWindowsDeviceFamily() == CSysInfo::Xbox) + g_application.SetStandAlone(true); + // Create and run the app XBMC_Run(true, appParamParser); } @@ -136,8 +140,18 @@ void App::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ m_argv.clear(); push_back(m_argv, std::string("dummy")); + if (args->Kind == ActivationKind::Launch) + { + auto launchArgs = static_cast<LaunchActivatedEventArgs^>(args); + if (launchArgs->PrelaunchActivated) + { + // opt-out of Prelaunch + CoreApplication::Exit(); + return; + } + } // Check for protocol activation - if (args->Kind == ActivationKind::Protocol) + else if (args->Kind == ActivationKind::Protocol) { auto protocolArgs = static_cast< ProtocolActivatedEventArgs^>(args); Platform::String^ argval = protocolArgs->Uri->ToString(); diff --git a/xbmc/pvr/windows/GUIEPGGridContainer.cpp b/xbmc/pvr/windows/GUIEPGGridContainer.cpp index 4121c762f1..355d152555 100644 --- a/xbmc/pvr/windows/GUIEPGGridContainer.cpp +++ b/xbmc/pvr/windows/GUIEPGGridContainer.cpp @@ -1674,6 +1674,62 @@ void CGUIEPGGridContainer::GoToDate(const CDateTime &date) SetBlock(offset); } +void CGUIEPGGridContainer::GoToTop() +{ + if (m_orientation == VERTICAL) + { + if (m_gridModel->HasChannelItems()) + GoToChannel(0); + } + else + { + if (m_gridModel->HasProgrammeItems()) + GoToBlock(0); + } +} + +void CGUIEPGGridContainer::GoToBottom() +{ + if (m_orientation == VERTICAL) + { + if (m_gridModel->HasChannelItems()) + GoToChannel(m_gridModel->ChannelItemsSize() - 1); + } + else + { + if (m_gridModel->HasProgrammeItems()) + GoToBlock(m_gridModel->ProgrammeItemsSize() - 1); + } +} + +void CGUIEPGGridContainer::GoToMostLeft() +{ + if (m_orientation == VERTICAL) + { + if (m_gridModel->HasProgrammeItems()) + GoToBlock(m_gridModel->ProgrammeItemsSize() - 1); + } + else + { + if (m_gridModel->HasChannelItems()) + GoToChannel(m_gridModel->ChannelItemsSize() - 1); + } +} + +void CGUIEPGGridContainer::GoToMostRight() +{ + if (m_orientation == VERTICAL) + { + if (m_gridModel->HasProgrammeItems()) + GoToBlock(0); + } + else + { + if (m_gridModel->HasChannelItems()) + GoToChannel(0); + } +} + void CGUIEPGGridContainer::SetTimelineItems(const std::unique_ptr<CFileItemList> &items, const CDateTime &gridStart, const CDateTime &gridEnd) { int iRulerUnit; diff --git a/xbmc/pvr/windows/GUIEPGGridContainer.h b/xbmc/pvr/windows/GUIEPGGridContainer.h index f0c06abf80..901a853898 100644 --- a/xbmc/pvr/windows/GUIEPGGridContainer.h +++ b/xbmc/pvr/windows/GUIEPGGridContainer.h @@ -87,6 +87,10 @@ namespace PVR void GoToEnd(); void GoToNow(); void GoToDate(const CDateTime &date); + void GoToTop(); + void GoToBottom(); + void GoToMostLeft(); + void GoToMostRight(); void SetTimelineItems(const std::unique_ptr<CFileItemList> &items, const CDateTime &gridStart, const CDateTime &gridEnd); /*! diff --git a/xbmc/pvr/windows/GUIWindowPVRGuide.cpp b/xbmc/pvr/windows/GUIWindowPVRGuide.cpp index d48e28795b..5e79ad6729 100644 --- a/xbmc/pvr/windows/GUIWindowPVRGuide.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRGuide.cpp @@ -236,10 +236,67 @@ bool CGUIWindowPVRGuideBase::GetDirectory(const std::string &strDirectory, CFile return true; } +bool CGUIWindowPVRGuideBase::ShouldNavigateToGridContainer(int iAction) +{ + CGUIEPGGridContainer *epgGridContainer = GetGridControl(); + CGUIControl* control = GetControl(CONTROL_LSTCHANNELGROUPS); + if (epgGridContainer && control && + GetFocusedControlID() == control->GetID()) + { + int iNavigationId = control->GetAction(iAction).GetNavigation(); + + control = epgGridContainer; + while (control != this) // navigation target could be the grid control or one of its parent controls. + { + if (iNavigationId == control->GetID()) + { + // channel group selector control's target for the action is the grid control + return true; + } + control = control->GetParentControl(); + } + } + return false; +} + bool CGUIWindowPVRGuideBase::OnAction(const CAction &action) { switch (action.GetID()) { + case ACTION_MOVE_UP: + case ACTION_MOVE_DOWN: + case ACTION_MOVE_LEFT: + case ACTION_MOVE_RIGHT: + { + // Check whether grid container is configured as channel group selector's navigation target for the given action. + if (ShouldNavigateToGridContainer(action.GetID())) + { + CGUIEPGGridContainer *epgGridContainer = GetGridControl(); + if (epgGridContainer) + { + CGUIWindowPVRBase::OnAction(action); + + switch (action.GetID()) + { + case ACTION_MOVE_UP: + epgGridContainer->GoToBottom(); + return true; + case ACTION_MOVE_DOWN: + epgGridContainer->GoToTop(); + return true; + case ACTION_MOVE_LEFT: + epgGridContainer->GoToMostRight(); + return true; + case ACTION_MOVE_RIGHT: + epgGridContainer->GoToMostLeft(); + return true; + default: + break; + } + } + } + break; + } case REMOTE_0: if (GetCurrentDigitCount() == 0) { diff --git a/xbmc/pvr/windows/GUIWindowPVRGuide.h b/xbmc/pvr/windows/GUIWindowPVRGuide.h index 571b3f8357..327c7dcdee 100644 --- a/xbmc/pvr/windows/GUIWindowPVRGuide.h +++ b/xbmc/pvr/windows/GUIWindowPVRGuide.h @@ -71,6 +71,8 @@ namespace PVR bool OnContextButtonNow(); bool OnContextButtonDate(); + bool ShouldNavigateToGridContainer(int iAction); + void StartRefreshTimelineItemsThread(); void StopRefreshTimelineItemsThread(); diff --git a/xbmc/rendering/dx/DeviceResources.h b/xbmc/rendering/dx/DeviceResources.h index 786c590595..3475802dbb 100644 --- a/xbmc/rendering/dx/DeviceResources.h +++ b/xbmc/rendering/dx/DeviceResources.h @@ -46,7 +46,7 @@ namespace DX // games attempt to render at 60 frames per second at full fidelity. // The decision to render at full fidelity across all platforms and form factors // should be deliberate. - static const bool SupportHighResolutions = false; + static const bool SupportHighResolutions = true; // The default thresholds that define a "high resolution" display. If the thresholds // are exceeded and SupportHighResolutions is false, the dimensions will be scaled diff --git a/xbmc/rendering/dx/RenderContext.h b/xbmc/rendering/dx/RenderContext.h index 9cb877dd83..9c63471747 100644 --- a/xbmc/rendering/dx/RenderContext.h +++ b/xbmc/rendering/dx/RenderContext.h @@ -39,30 +39,5 @@ namespace DX { return dynamic_cast<CWinSystemWin10DX&>(CServiceBroker::GetRenderSystem()); } - - class CoreWindowHolder - { - public: - static std::shared_ptr<CoreWindowHolder> Get() - { - static std::shared_ptr<CoreWindowHolder> instance(new CoreWindowHolder()); - return instance; - } - - ~CoreWindowHolder() { m_coreWindow.Release(); } - - void SetWindow(Windows::UI::Core::CoreWindow^ window) - { - m_coreWindow = window; - } - - Windows::UI::Core::CoreWindow^ GetWindow() - { - return m_coreWindow.Get(); - } - - private: - Platform::Agile<Windows::UI::Core::CoreWindow^> m_coreWindow; - }; #endif } diff --git a/xbmc/rendering/gles/RenderSystemGLES.cpp b/xbmc/rendering/gles/RenderSystemGLES.cpp index 3e44589e66..911ab5d3e1 100644 --- a/xbmc/rendering/gles/RenderSystemGLES.cpp +++ b/xbmc/rendering/gles/RenderSystemGLES.cpp @@ -667,15 +667,7 @@ GLint CRenderSystemGLES::GUIShaderGetBrightness() bool CRenderSystemGLES::SupportsStereo(RENDER_STEREO_MODE mode) const { - switch(mode) - { - case RENDER_STEREO_MODE_INTERLACED: - if (g_sysinfo.HasHW3DInterlaced()) - return true; - - default: - return CRenderSystemBase::SupportsStereo(mode); - } + return CRenderSystemBase::SupportsStereo(mode); } GLint CRenderSystemGLES::GUIShaderGetModel() diff --git a/xbmc/utils/AMLUtils.cpp b/xbmc/utils/AMLUtils.cpp index 5666236e93..9ba833838f 100644 --- a/xbmc/utils/AMLUtils.cpp +++ b/xbmc/utils/AMLUtils.cpp @@ -54,22 +54,6 @@ bool aml_present() return has_aml == 1; } -bool aml_hw3d_present() -{ - static int has_hw3d = -1; - if (has_hw3d == -1) - { - if (SysfsUtils::Has("/sys/class/ppmgr/ppmgr_3d_mode") || - SysfsUtils::Has("/sys/class/amhdmitx/amhdmitx0/config")) - has_hw3d = 1; - else - has_hw3d = 0; - if (has_hw3d) - CLog::Log(LOGNOTICE, "AML 3D support detected"); - } - return has_hw3d == 1; -} - bool aml_wired_present() { static int has_wired = -1; @@ -138,10 +122,6 @@ bool aml_permissions() { CLog::Log(LOGERROR, "AML: no rw on /sys/class/audiodsp/digital_raw"); } - if (!SysfsUtils::HasRW("/sys/class/ppmgr/ppmgr_3d_mode")) - { - CLog::Log(LOGERROR, "AML: no rw on /sys/class/ppmgr/ppmgr_3d_mode"); - } if (!SysfsUtils::HasRW("/sys/class/amhdmitx/amhdmitx0/config")) { CLog::Log(LOGERROR, "AML: no rw on /sys/class/amhdmitx/amhdmitx0/config"); diff --git a/xbmc/utils/AMLUtils.h b/xbmc/utils/AMLUtils.h index a012d1b0ae..1fc7dab3e3 100644 --- a/xbmc/utils/AMLUtils.h +++ b/xbmc/utils/AMLUtils.h @@ -54,7 +54,6 @@ enum AML_SUPPORT_H264_4K2K bool aml_present(); bool aml_permissions(); -bool aml_hw3d_present(); bool aml_wired_present(); bool aml_support_hevc(); bool aml_support_hevc_4k2k(); diff --git a/xbmc/utils/CPUInfo.cpp b/xbmc/utils/CPUInfo.cpp index 14a5171aa1..abb702caaa 100644 --- a/xbmc/utils/CPUInfo.cpp +++ b/xbmc/utils/CPUInfo.cpp @@ -157,7 +157,11 @@ CCPUInfo::CCPUInfo(void) m_cores[core.m_id] = core; } #elif defined(TARGET_WINDOWS_STORE) - CLog::Log(LOGDEBUG, "%s is not implemented", __FUNCTION__); + SYSTEM_INFO siSysInfo; + GetNativeSystemInfo(&siSysInfo); + m_cpuCount = siSysInfo.dwNumberOfProcessors; + m_cpuModel = "Unknown"; + #elif defined(TARGET_WINDOWS_DESKTOP) using KODI::PLATFORM::WINDOWS::FromW; @@ -688,18 +692,10 @@ const CoreInfo &CCPUInfo::GetCoreInfo(int nCoreId) bool CCPUInfo::readProcStat(unsigned long long& user, unsigned long long& nice, unsigned long long& system, unsigned long long& idle, unsigned long long& io) { -#if defined(TARGET_WINDOWS_STORE) - // introduced in 10.0.15063.0 - // auto diagnostic = Windows::System::Diagnostics::SystemDiagnosticInfo::GetForCurrentSystem(); - // auto usage = diagnostic->CpuUsage; - - // user = report->UserTime.Duration; - // system = report->KernelTime.Duration; - // idle = report->IdleTime.Duration; +#if defined(TARGET_WINDOWS) nice = 0; io = 0; - return false; -#elif defined (TARGET_WINDOWS_DESKTOP) +#if defined (TARGET_WINDOWS_DESKTOP) FILETIME idleTime; FILETIME kernelTime; FILETIME userTime; @@ -710,8 +706,6 @@ bool CCPUInfo::readProcStat(unsigned long long& user, unsigned long long& nice, // returned "kernelTime" includes "idleTime" system = (uint64_t(kernelTime.dwHighDateTime) << 32) + uint64_t(kernelTime.dwLowDateTime) - idle; user = (uint64_t(userTime.dwHighDateTime) << 32) + uint64_t(userTime.dwLowDateTime); - nice = 0; - io = 0; if (m_cpuFreqCounter && PdhCollectQueryData(m_cpuQueryLoad) == ERROR_SUCCESS) { @@ -744,6 +738,31 @@ bool CCPUInfo::readProcStat(unsigned long long& user, unsigned long long& nice, else for (std::map<int, CoreInfo>::iterator it = m_cores.begin(); it != m_cores.end(); ++it) it->second.m_fPct = double(m_lastUsedPercentage); // use CPU average as fallback +#endif // TARGET_WINDOWS_DESKTOP +#if defined(TARGET_WINDOWS_STORE) && defined(NTDDI_WIN10_RS2) && (NTDDI_VERSION >= NTDDI_WIN10_RS2) + // introduced in 10.0.15063.0 + if (Windows::Foundation::Metadata::ApiInformation::IsTypePresent("Windows.System.Diagnostics.SystemDiagnosticInfo")) + { + try + { + auto diagnostic = Windows::System::Diagnostics::SystemDiagnosticInfo::GetForCurrentSystem(); + auto usage = diagnostic->CpuUsage; + auto report = usage->GetReport(); + + user = report->UserTime.Duration; + idle = report->IdleTime.Duration; + system = report->KernelTime.Duration - idle; + return true; + } + catch (...) + { + // requires Win10 CU (10.0.15063) or later + return false; + } + } + else +#endif // TARGET_WINDOWS_STORE + return false; #elif defined(TARGET_FREEBSD) long *cptimes; size_t len; @@ -864,16 +883,22 @@ bool CCPUInfo::readProcStat(unsigned long long& user, unsigned long long& nice, std::string CCPUInfo::GetCoresUsageString() const { std::string strCores; - for (std::map<int, CoreInfo>::const_iterator it = m_cores.begin(); it != m_cores.end(); ++it) + if (!m_cores.empty()) { - if (!strCores.empty()) - strCores += ' '; - if (it->second.m_fPct < 10.0) - strCores += StringUtils::Format("CPU%d: %1.1f%%", it->first, it->second.m_fPct); - else - strCores += StringUtils::Format("CPU%d: %3.0f%%", it->first, it->second.m_fPct); + for (std::map<int, CoreInfo>::const_iterator it = m_cores.begin(); it != m_cores.end(); ++it) + { + if (!strCores.empty()) + strCores += ' '; + if (it->second.m_fPct < 10.0) + strCores += StringUtils::Format("CPU%d: %1.1f%%", it->first, it->second.m_fPct); + else + strCores += StringUtils::Format("CPU%d: %3.0f%%", it->first, it->second.m_fPct); + } + } + else + { + strCores += StringUtils::Format("%3.0f%%", double(m_lastUsedPercentage)); } - return strCores; } diff --git a/xbmc/utils/SystemInfo.cpp b/xbmc/utils/SystemInfo.cpp index 6633a73fa9..c4ff3198c0 100644 --- a/xbmc/utils/SystemInfo.cpp +++ b/xbmc/utils/SystemInfo.cpp @@ -828,17 +828,6 @@ bool CSysInfo::IsAeroDisabled() return false; } -bool CSysInfo::HasHW3DInterlaced() -{ -#if defined(TARGET_ANDROID) -#if defined(HAS_LIBAMCODEC) - if (aml_hw3d_present()) - return true; -#endif -#endif - return false; -} - CSysInfo::WindowsVersion CSysInfo::m_WinVer = WindowsVersionUnknown; bool CSysInfo::IsWindowsVersion(WindowsVersion ver) diff --git a/xbmc/utils/SystemInfo.h b/xbmc/utils/SystemInfo.h index b5b21199c0..25a93cd627 100644 --- a/xbmc/utils/SystemInfo.h +++ b/xbmc/utils/SystemInfo.h @@ -126,7 +126,6 @@ public: bool HasInternet(); bool HasVideoToolBoxDecoder(); bool IsAeroDisabled(); - bool HasHW3DInterlaced(); static bool IsWindowsVersion(WindowsVersion ver); static bool IsWindowsVersionAtLeast(WindowsVersion ver); static WindowsVersion GetWindowsVersion(); diff --git a/xbmc/windowing/win10/WinEventsWin10.cpp b/xbmc/windowing/win10/WinEventsWin10.cpp index 2ca96d804c..51562ccd09 100644 --- a/xbmc/windowing/win10/WinEventsWin10.cpp +++ b/xbmc/windowing/win10/WinEventsWin10.cpp @@ -29,6 +29,7 @@ #include "messaging/ApplicationMessenger.h" #include "platform/win10/input/RemoteControlXbox.h" #include "rendering/dx/DeviceResources.h" +#include "platform/win10/AsyncHelpers.h" #include "rendering/dx/RenderContext.h" #include "utils/log.h" #include "utils/SystemInfo.h" @@ -108,6 +109,21 @@ void CWinEventsWin10::InitEventHandlers(CoreWindow^ window) window->SizeChanged += ref new TypedEventHandler<CoreWindow^, WindowSizeChangedEventArgs^>([&](CoreWindow^ wnd, WindowSizeChangedEventArgs^ args) { OnWindowSizeChanged(wnd, args); }); +#if defined(NTDDI_WIN10_RS2) && (NTDDI_VERSION >= NTDDI_WIN10_RS2) + try + { + window->ResizeStarted += ref new TypedEventHandler<CoreWindow^, Platform::Object^>([&](CoreWindow^ wnd, Platform::Object^ args) { + OnWindowResizeStarted(wnd, args); + }); + window->ResizeCompleted += ref new TypedEventHandler<CoreWindow^, Platform::Object^>([&](CoreWindow^ wnd, Platform::Object^ args) { + OnWindowResizeCompleted(wnd, args); + }); + } + catch (Platform::Exception^ ex) + { + // Win10 Creators Update is required + } +#endif window->Closed += ref new TypedEventHandler<CoreWindow^, CoreWindowEventArgs^>([&](CoreWindow^ wnd, CoreWindowEventArgs^ args) { OnWindowClosed(wnd, args); }); @@ -191,8 +207,51 @@ void CWinEventsWin10::UpdateWindowSize() // Window event handlers. void CWinEventsWin10::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args) { - DX::Windowing().OnResize(args->Size.Width, args->Size.Height); - UpdateWindowSize(); + CLog::Log(LOGDEBUG, __FUNCTION__": window size changed."); + m_logicalWidth = args->Size.Width; + m_logicalHeight = args->Size.Height; + m_bResized = true; + + if (m_sizeChanging) + return; + + HandleWindowSizeChanged(); +} + +void CWinEventsWin10::OnWindowResizeStarted(Windows::UI::Core::CoreWindow^ sender, Platform::Object ^ args) +{ + CLog::Log(LOGDEBUG, __FUNCTION__": window resize started."); + m_logicalPosX = sender->Bounds.X; + m_logicalPosY = sender->Bounds.Y; + m_sizeChanging = true; +} + +void CWinEventsWin10::OnWindowResizeCompleted(Windows::UI::Core::CoreWindow^ sender, Platform::Object ^ args) +{ + CLog::Log(LOGDEBUG, __FUNCTION__": window resize completed."); + m_sizeChanging = false; + + if (m_logicalPosX != sender->Bounds.X || m_logicalPosY != sender->Bounds.Y) + m_bMoved = true; + + HandleWindowSizeChanged(); +} + +void CWinEventsWin10::HandleWindowSizeChanged() +{ + CLog::Log(LOGDEBUG, __FUNCTION__": window size/move handled."); + if (m_bMoved) + { + // it will get position from CoreWindow + DX::Windowing().OnMove(0, 0); + } + if (m_bResized) + { + DX::Windowing().OnResize(m_logicalWidth, m_logicalHeight); + UpdateWindowSize(); + } + m_bResized = false; + m_bMoved = false; } void CWinEventsWin10::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args) @@ -487,7 +546,7 @@ void CWinEventsWin10::OnOrientationChanged(DisplayInformation^ sender, Platform: void CWinEventsWin10::OnDisplayContentsInvalidated(DisplayInformation^ sender, Platform::Object^ args) { - //critical_section::scoped_lock lock(m_deviceResources->GetCriticalSection()); + CLog::Log(LOGDEBUG, __FUNCTION__": onevent."); DX::DeviceResources::Get()->ValidateDevice(); } diff --git a/xbmc/windowing/win10/WinEventsWin10.h b/xbmc/windowing/win10/WinEventsWin10.h index c7b1845869..98348ed5e3 100644 --- a/xbmc/windowing/win10/WinEventsWin10.h +++ b/xbmc/windowing/win10/WinEventsWin10.h @@ -26,6 +26,7 @@ #include "interfaces/IAnnouncer.h" #include "windowing/WinEvents.h" #include <concurrent_queue.h> +#include <cmath> class CWinEventsWin10 : public IWinEvents , public ANNOUNCEMENT::IAnnouncer @@ -41,6 +42,8 @@ public: // Window event handlers. void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args); + void OnWindowResizeStarted(Windows::UI::Core::CoreWindow^ sender, Platform::Object^ args); + void OnWindowResizeCompleted(Windows::UI::Core::CoreWindow^ sender, Platform::Object^ args); void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args); static void OnWindowActivationChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowActivatedEventArgs^ args); static void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args); @@ -65,10 +68,21 @@ public: void Announce(ANNOUNCEMENT::AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data) override; private: + friend class CWinSystemWin10; + void UpdateWindowSize(); void Kodi_KeyEvent(unsigned int vkey, unsigned scancode, unsigned keycode, bool isDown); + void HandleWindowSizeChanged(); + Concurrency::concurrent_queue<XBMC_Event> m_events; Windows::Media::SystemMediaTransportControls^ m_smtc{ nullptr }; + bool m_bResized{ false }; + bool m_bMoved{ false }; + bool m_sizeChanging{ false }; + float m_logicalWidth{ 0 }; + float m_logicalHeight{ 0 }; + float m_logicalPosX{ 0 }; + float m_logicalPosY{ 0 }; }; #endif // WINDOW_EVENTS_WIN10_H diff --git a/xbmc/windowing/win10/WinSystemWin10.cpp b/xbmc/windowing/win10/WinSystemWin10.cpp index 4cd86ae1a8..d545c19c87 100644 --- a/xbmc/windowing/win10/WinSystemWin10.cpp +++ b/xbmc/windowing/win10/WinSystemWin10.cpp @@ -25,17 +25,18 @@ #include "guilib/gui3d.h" #include "guilib/GraphicContext.h" #include "messaging/ApplicationMessenger.h" +#include "platform/win10/AsyncHelpers.h" #include "platform/win10/input/RemoteControlXbox.h" #include "platform/win32/CharsetConverter.h" #include "powermanagement/win10/Win10PowerSyscall.h" #include "rendering/dx/DirectXHelper.h" +#include "rendering/dx/RenderContext.h" #include "ServiceBroker.h" #include "settings/AdvancedSettings.h" #include "settings/DisplaySettings.h" #include "settings/Settings.h" #include "threads/SingleLock.h" #include "utils/log.h" -#include "utils/CharsetConverter.h" #include "utils/SystemInfo.h" #include "windowing/windows/VideoSyncD3D.h" #include "WinEventsWin10.h" @@ -43,9 +44,16 @@ #pragma pack(push,8) +#include <collection.h> #include <tpcshrd.h> #include <ppltasks.h> +using namespace Windows::Graphics::Display; +#if defined(NTDDI_WIN10_RS2) && (NTDDI_VERSION >= NTDDI_WIN10_RS2) +using namespace Windows::Graphics::Display::Core; +#endif +using namespace Windows::UI::ViewManagement; + CWinSystemWin10::CWinSystemWin10() : CWinSystemBase() , m_nPrimary(0) @@ -96,6 +104,7 @@ bool CWinSystemWin10::InitWindowSystem() bool CWinSystemWin10::DestroyWindowSystem() { + m_bWindowCreated = false; RestoreDesktopResolution(m_nScreen); return true; } @@ -174,9 +183,12 @@ void CWinSystemWin10::FinishWindowResize(int newWidth, int newHeight) m_nWidth = newWidth; m_nHeight = newHeight; - auto appView = Windows::UI::ViewManagement::ApplicationView::GetForCurrentView(); - appView->PreferredLaunchViewSize = Windows::Foundation::Size(m_nWidth, m_nHeight); - appView->PreferredLaunchWindowingMode = Windows::UI::ViewManagement::ApplicationViewWindowingMode::PreferredLaunchViewSize; + float dpi = DX::DeviceResources::Get()->GetDpi(); + int dipsWidth = round(DX::ConvertPixelsToDips(m_nWidth, dpi)); + int dipsHeight = round(DX::ConvertPixelsToDips(m_nHeight, dpi)); + + ApplicationView::PreferredLaunchViewSize = Windows::Foundation::Size(dipsWidth, dipsHeight); + ApplicationView::PreferredLaunchWindowingMode = ApplicationViewWindowingMode::PreferredLaunchViewSize; } void CWinSystemWin10::AdjustWindow(bool forceResize) @@ -191,7 +203,7 @@ void CWinSystemWin10::AdjustWindow(bool forceResize) if (!isInFullscreen) { if (appView->TryEnterFullScreenMode()) - appView->PreferredLaunchWindowingMode = Windows::UI::ViewManagement::ApplicationViewWindowingMode::FullScreen; + ApplicationView::PreferredLaunchWindowingMode = ApplicationViewWindowingMode::FullScreen; } } else // m_state == WINDOW_STATE_WINDOWED @@ -203,16 +215,21 @@ void CWinSystemWin10::AdjustWindow(bool forceResize) int viewWidth = appView->VisibleBounds.Width; int viewHeight = appView->VisibleBounds.Height; - if (viewHeight != m_nHeight || viewWidth != m_nWidth) + + float dpi = DX::DeviceResources::Get()->GetDpi(); + int dipsWidth = round(DX::ConvertPixelsToDips(m_nWidth, dpi)); + int dipsHeight = round(DX::ConvertPixelsToDips(m_nHeight, dpi)); + + if (viewHeight != dipsHeight || viewWidth != dipsWidth) { - if (!appView->TryResizeView(Windows::Foundation::Size(m_nWidth, m_nHeight))) + if (!appView->TryResizeView(Windows::Foundation::Size(dipsWidth, dipsHeight))) { CLog::LogF(LOGDEBUG, __FUNCTION__, "resizing ApplicationView failed."); } } - appView->PreferredLaunchViewSize = Windows::Foundation::Size(m_nWidth, m_nHeight); - appView->PreferredLaunchWindowingMode = Windows::UI::ViewManagement::ApplicationViewWindowingMode::PreferredLaunchViewSize; + ApplicationView::PreferredLaunchViewSize = Windows::Foundation::Size(dipsWidth, dipsHeight); + ApplicationView::PreferredLaunchWindowingMode = ApplicationViewWindowingMode::PreferredLaunchViewSize; } } @@ -265,7 +282,7 @@ bool CWinSystemWin10::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool } m_IsAlteringWindow = true; - //ReleaseBackBuffer(); + ReleaseBackBuffer(); if (changeScreen) { @@ -322,7 +339,7 @@ bool CWinSystemWin10::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool if (changeScreen) CenterCursor(); - //CreateBackBuffer(); + CreateBackBuffer(); m_IsAlteringWindow = false; return true; } @@ -395,9 +412,61 @@ bool CWinSystemWin10::ChangeResolution(const RESOLUTION_INFO& res, bool forceCha if (!details) return false; - CLog::Log(LOGDEBUG, "%s is not implemented", __FUNCTION__); +#if defined(NTDDI_WIN10_RS2) && (NTDDI_VERSION >= NTDDI_WIN10_RS2) + if (Windows::Foundation::Metadata::ApiInformation::IsTypePresent("Windows.Graphics.Display.Core.HdmiDisplayInformation")) + { + bool changed = false; + auto hdmiInfo = HdmiDisplayInformation::GetForCurrentView(); + if (hdmiInfo != nullptr) + { + // default mode not in list of supported display modes + if (res.iScreenWidth == details->ScreenWidth && res.iScreenHeight == details->ScreenHeight + && fabs(res.fRefreshRate - details->RefreshRate) <= 0.00001) + { + Wait(hdmiInfo->SetDefaultDisplayModeAsync()); + changed = true; + } + else + { + bool needStereo = g_graphicsContext.GetStereoMode() == RENDER_STEREO_MODE_HARDWAREBASED; + auto hdmiModes = hdmiInfo->GetSupportedDisplayModes(); + + HdmiDisplayMode^ selected = nullptr; + for (auto mode : Windows::Foundation::Collections::to_vector(hdmiModes)) + { + if (res.iScreenWidth == mode->ResolutionWidthInRawPixels && res.iScreenHeight == mode->ResolutionHeightInRawPixels + && fabs(res.fRefreshRate - mode->RefreshRate) <= 0.00001) + { + selected = mode; + if (needStereo == mode->StereoEnabled) + break; + } + } + + if (selected != nullptr) + { + changed = Wait(hdmiInfo->RequestSetCurrentDisplayModeAsync(selected)); + } + } + } - return true; + // changing display mode doesn't cause OnResize event + // for CoreWindow, so we "emulate" it manually + if (changed && m_bWindowCreated) + { + float dpi = DisplayInformation::GetForCurrentView()->LogicalDpi; + float dipsW = DX::ConvertPixelsToDips(m_nWidth, dpi); + float dipsH = DX::ConvertPixelsToDips(m_nHeight, dpi); + + DX::Windowing().OnResize(dipsW, dipsH); + dynamic_cast<CWinEventsWin10*>(m_winEvents.get())->UpdateWindowSize(); + } + return changed; + } +#endif + + CLog::LogFunction(LOGDEBUG, __FUNCTION__, "Not supported."); + return false; } void CWinSystemWin10::UpdateResolutions() @@ -428,6 +497,24 @@ void CWinSystemWin10::UpdateResolutions() UpdateDesktopResolution(CDisplaySettings::GetInstance().GetResolutionInfo(RES_DESKTOP), 0, w, h, refreshRate, dwFlags); CLog::Log(LOGNOTICE, "Primary mode: %s", CDisplaySettings::GetInstance().GetResolutionInfo(RES_DESKTOP).strMode.c_str()); +#if defined(NTDDI_WIN10_RS2) && (NTDDI_VERSION >= NTDDI_WIN10_RS2) + if (Windows::Foundation::Metadata::ApiInformation::IsTypePresent("Windows.Graphics.Display.Core.HdmiDisplayInformation")) + { + auto hdmiInfo = HdmiDisplayInformation::GetForCurrentView(); + if (hdmiInfo != nullptr) + { + auto hdmiModes = hdmiInfo->GetSupportedDisplayModes(); + for (auto mode : Windows::Foundation::Collections::to_vector(hdmiModes)) + { + RESOLUTION_INFO res; + UpdateDesktopResolution(res, 0, mode->ResolutionWidthInRawPixels, mode->ResolutionHeightInRawPixels, mode->RefreshRate, 0); + AddResolution(res); + CLog::Log(LOGNOTICE, "Additional mode: %s %s", res.strMode.c_str(), mode->Is2086MetadataSupported ? "(HDR)" : ""); + } + } + } +#endif + // Desktop resolution of the other screens if (m_MonitorsInfo.size() >= 2) { @@ -481,24 +568,24 @@ bool CWinSystemWin10::UpdateResolutionsInternal() { MONITOR_DETAILS md = {}; - auto displayInfo = Windows::Graphics::Display::DisplayInformation::GetForCurrentView(); + auto displayInfo = DisplayInformation::GetForCurrentView(); bool flipResolution = false; switch (displayInfo->NativeOrientation) { - case Windows::Graphics::Display::DisplayOrientations::Landscape: + case DisplayOrientations::Landscape: switch (displayInfo->CurrentOrientation) { - case Windows::Graphics::Display::DisplayOrientations::Portrait: - case Windows::Graphics::Display::DisplayOrientations::PortraitFlipped: + case DisplayOrientations::Portrait: + case DisplayOrientations::PortraitFlipped: flipResolution = true; break; } break; - case Windows::Graphics::Display::DisplayOrientations::Portrait: + case DisplayOrientations::Portrait: switch (displayInfo->CurrentOrientation) { - case Windows::Graphics::Display::DisplayOrientations::Landscape: - case Windows::Graphics::Display::DisplayOrientations::LandscapeFlipped: + case DisplayOrientations::Landscape: + case DisplayOrientations::LandscapeFlipped: flipResolution = true; break; } @@ -507,8 +594,29 @@ bool CWinSystemWin10::UpdateResolutionsInternal() md.ScreenWidth = flipResolution ? displayInfo->ScreenHeightInRawPixels : displayInfo->ScreenWidthInRawPixels; md.ScreenHeight = flipResolution ? displayInfo->ScreenWidthInRawPixels : displayInfo->ScreenHeightInRawPixels; - // note that refresh rate information is not available on Win10 UWP - md.RefreshRate = 60; + if (Windows::Foundation::Metadata::ApiInformation::IsTypePresent("Windows.Graphics.Display.Core.HdmiDisplayInformation")) + { +#if defined(NTDDI_WIN10_RS2) && (NTDDI_VERSION >= NTDDI_WIN10_RS2) + auto hdmiInfo = HdmiDisplayInformation::GetForCurrentView(); + if (hdmiInfo != nullptr) + { + auto currentMode = hdmiInfo->GetCurrentDisplayMode(); + md.RefreshRate = currentMode->RefreshRate; + md.Bpp = currentMode->BitsPerPixel; + } + else +#endif + { + md.RefreshRate = 60.0; + md.Bpp = 24; + } + } + else + { + // note that refresh rate information is not available on Win10 UWP + md.RefreshRate = 60.0; + md.Bpp = 24; + } md.Interlaced = false; m_MonitorsInfo.push_back(md); @@ -517,7 +625,7 @@ bool CWinSystemWin10::UpdateResolutionsInternal() if (dispatcher->HasThreadAccess) handler->Invoke(); else - Concurrency::create_task(dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::High, handler)).wait(); + Wait(dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::High, handler)); return true; } @@ -632,14 +740,11 @@ std::string CWinSystemWin10::GetClipboardText() auto contentView = Windows::ApplicationModel::DataTransfer::Clipboard::GetContent(); if (contentView->Contains(Windows::ApplicationModel::DataTransfer::StandardDataFormats::Text)) { - Concurrency::create_task(contentView->GetTextAsync()).then([&unicode_text](Platform::String^ str) - { - unicode_text.append(str->Data()); - }).wait(); + auto text = Wait(contentView->GetTextAsync()); + unicode_text.append(text->Data()); } - g_charsetConverter.wToUTF8(unicode_text, utf8_text); - return utf8_text; + return KODI::PLATFORM::WINDOWS::FromW(unicode_text); } void CWinSystemWin10::NotifyAppFocusChange(bool bGaining) @@ -649,10 +754,6 @@ void CWinSystemWin10::NotifyAppFocusChange(bool bGaining) void CWinSystemWin10::UpdateStates(bool fullScreen) { - //m_fullscreenState = CServiceBroker::GetSettings().GetBool(CSettings::SETTING_VIDEOSCREEN_FAKEFULLSCREEN) - // ? WINDOW_FULLSCREEN_STATE_FULLSCREEN_WINDOW - // : WINDOW_FULLSCREEN_STATE_FULLSCREEN; - m_fullscreenState = WINDOW_FULLSCREEN_STATE_FULLSCREEN_WINDOW; // currently only this allowed m_windowState = WINDOW_WINDOW_STATE_WINDOWED; // currently only this allowed } diff --git a/xbmc/windowing/win10/WinSystemWin10.h b/xbmc/windowing/win10/WinSystemWin10.h index 8c9c35cd00..b988e0c911 100644 --- a/xbmc/windowing/win10/WinSystemWin10.h +++ b/xbmc/windowing/win10/WinSystemWin10.h @@ -72,7 +72,7 @@ struct MONITOR_DETAILS // Windows desktop info int ScreenWidth; int ScreenHeight; - int RefreshRate; + float RefreshRate; int Bpp; bool Interlaced; diff --git a/xbmc/windowing/win10/WinSystemWin10DX.cpp b/xbmc/windowing/win10/WinSystemWin10DX.cpp index 86100216b0..f36c98d899 100644 --- a/xbmc/windowing/win10/WinSystemWin10DX.cpp +++ b/xbmc/windowing/win10/WinSystemWin10DX.cpp @@ -74,6 +74,7 @@ bool CWinSystemWin10DX::CreateNewWindow(const std::string& name, bool fullScreen { CGenericTouchInputHandler::GetInstance().RegisterHandler(&CGenericTouchActionHandler::GetInstance()); CGenericTouchInputHandler::GetInstance().SetScreenDPI(DX::DisplayMetrics::Dpi100); + ChangeResolution(res, true); } return created; } @@ -122,6 +123,7 @@ bool CWinSystemWin10DX::ResizeWindow(int newWidth, int newHeight, int newLeft, i void CWinSystemWin10DX::OnMove(int x, int y) { + m_deviceResources->SetWindowPos(m_coreWindow->Bounds); } bool CWinSystemWin10DX::DPIChanged(WORD dpi, RECT windowRect) const @@ -155,6 +157,9 @@ bool CWinSystemWin10DX::IsStereoEnabled() void CWinSystemWin10DX::OnResize(int width, int height) { + if (!m_deviceResources) + return; + if (!m_IsAlteringWindow) ReleaseBackBuffer(); |