diff options
-rw-r--r-- | xbmc/addons/ScreenSaver.cpp | 6 | ||||
-rw-r--r-- | xbmc/cores/VideoRenderers/DXVAHD.cpp | 10 | ||||
-rw-r--r-- | xbmc/epg/GUIEPGGridContainer.cpp | 34 | ||||
-rw-r--r-- | xbmc/rendering/dx/RenderSystemDX.cpp | 29 | ||||
-rw-r--r-- | xbmc/utils/win32/memcpy_sse2.h | 2 |
5 files changed, 43 insertions, 38 deletions
diff --git a/xbmc/addons/ScreenSaver.cpp b/xbmc/addons/ScreenSaver.cpp index 4df3a667b2..07c2fb94ca 100644 --- a/xbmc/addons/ScreenSaver.cpp +++ b/xbmc/addons/ScreenSaver.cpp @@ -27,7 +27,7 @@ // What sound does a python screensaver make? #define SCRIPT_ALARM "sssssscreensaver" -#define SCRIPT_TIMEOUT 5 // seconds +#define SCRIPT_TIMEOUT 15 // seconds namespace ADDON { @@ -108,6 +108,10 @@ void CScreenSaver::Destroy() #ifdef HAS_PYTHON if (URIUtils::HasExtension(LibPath(), ".py")) { + /* FIXME: This is a hack but a proper fix is non-trivial. Basically this code + * makes sure the addon gets terminated after we've moved out of the screensaver window. + * If we don't do this, we may simply lockup. + */ g_alarmClock.Start(SCRIPT_ALARM, SCRIPT_TIMEOUT, "StopScript(" + LibPath() + ")", true, false); return; } diff --git a/xbmc/cores/VideoRenderers/DXVAHD.cpp b/xbmc/cores/VideoRenderers/DXVAHD.cpp index 247d1a6308..91b470b7fb 100644 --- a/xbmc/cores/VideoRenderers/DXVAHD.cpp +++ b/xbmc/cores/VideoRenderers/DXVAHD.cpp @@ -694,10 +694,12 @@ bool CProcessorHD::Render(CRect src, CRect dst, ID3D11Resource* target, ID3D11Vi m_pVideoContext->VideoProcessorSetOutputColorSpace(m_pVideoProcessor, &colorSpace); - ApplyFilter(D3D11_VIDEO_PROCESSOR_FILTER_BRIGHTNESS, CMediaSettings::GetInstance().GetCurrentVideoSettings().m_Brightness - , 0, 100, 50); - ApplyFilter(D3D11_VIDEO_PROCESSOR_FILTER_CONTRAST, CMediaSettings::GetInstance().GetCurrentVideoSettings().m_Contrast - , 0, 100, 50); + ApplyFilter(D3D11_VIDEO_PROCESSOR_FILTER_BRIGHTNESS, + CMediaSettings::GetInstance().GetCurrentVideoSettings().m_Brightness, 0, 100, 50); + ApplyFilter(D3D11_VIDEO_PROCESSOR_FILTER_CONTRAST, + CMediaSettings::GetInstance().GetCurrentVideoSettings().m_Contrast, 0, 100, 50); + ApplyFilter(D3D11_VIDEO_PROCESSOR_FILTER_HUE, 50, 0, 100, 50); + ApplyFilter(D3D11_VIDEO_PROCESSOR_FILTER_SATURATION, 50, 0, 100, 50); // Rotation m_pVideoContext->VideoProcessorSetStreamRotation(m_pVideoProcessor, DEFAULT_STREAM_INDEX, (rotation != 0), (D3D11_VIDEO_PROCESSOR_ROTATION)(rotation / 90)); diff --git a/xbmc/epg/GUIEPGGridContainer.cpp b/xbmc/epg/GUIEPGGridContainer.cpp index 8f7a70c870..b08bf5ce46 100644 --- a/xbmc/epg/GUIEPGGridContainer.cpp +++ b/xbmc/epg/GUIEPGGridContainer.cpp @@ -198,7 +198,7 @@ void CGUIEPGGridContainer::ProcessChannels(unsigned int currentTime, CDirtyRegio if (!m_focusedChannelLayout || !m_channelLayout) return; - int chanOffset = (int)floorf(m_channelScrollOffset / m_programmeLayout->Size(VERTICAL)); + int chanOffset = MathUtils::round_int(m_channelScrollOffset / m_programmeLayout->Size(VERTICAL)); int cacheBeforeChannel, cacheAfterChannel; GetChannelCacheOffsets(cacheBeforeChannel, cacheAfterChannel); @@ -243,7 +243,7 @@ void CGUIEPGGridContainer::RenderChannels() if (!m_focusedChannelLayout || !m_channelLayout) return; - int chanOffset = (int)floorf(m_channelScrollOffset / m_programmeLayout->Size(VERTICAL)); + int chanOffset = MathUtils::round_int(m_channelScrollOffset / m_programmeLayout->Size(VERTICAL)); /// Render channel names int cacheBeforeChannel, cacheAfterChannel; @@ -303,7 +303,7 @@ void CGUIEPGGridContainer::ProcessRuler(unsigned int currentTime, CDirtyRegionLi if (!m_rulerLayout || m_rulerItems.size()<=1 || (m_gridEnd - m_gridStart) == CDateTimeSpan(0, 0, 0, 0)) return; - int rulerOffset = (int)floorf(m_programmeScrollOffset / m_blockSize); + int rulerOffset = MathUtils::round_int(m_programmeScrollOffset / m_blockSize); CGUIListItemPtr item = m_rulerItems[0]; item->SetLabel(m_rulerItems[rulerOffset/m_rulerUnit+1]->GetLabel2()); CGUIListItem* lastitem = NULL; // dummy pointer needed to be passed as reference to ProcessItem() method @@ -350,7 +350,7 @@ void CGUIEPGGridContainer::RenderRuler() if (!m_rulerLayout || m_rulerItems.size()<=1 || (m_gridEnd - m_gridStart) == CDateTimeSpan(0, 0, 0, 0)) return; - int rulerOffset = (int)floorf(m_programmeScrollOffset / m_blockSize); + int rulerOffset = MathUtils::round_int(m_programmeScrollOffset / m_blockSize); /// Render single ruler item with date of selected programme g_graphicsContext.SetClipRegion(m_posX, m_posY, m_width, m_height); @@ -398,8 +398,8 @@ void CGUIEPGGridContainer::ProcessProgrammeGrid(unsigned int currentTime, CDirty if (!m_focusedProgrammeLayout || !m_programmeLayout || m_rulerItems.size()<=1 || (m_gridEnd - m_gridStart) == CDateTimeSpan(0, 0, 0, 0)) return; - int blockOffset = (int)floorf(m_programmeScrollOffset / m_blockSize); - int chanOffset = (int)floorf(m_channelScrollOffset / m_programmeLayout->Size(VERTICAL)); + int blockOffset = MathUtils::round_int(m_programmeScrollOffset / m_blockSize); + int chanOffset = MathUtils::round_int(m_channelScrollOffset / m_programmeLayout->Size(VERTICAL)); int cacheBeforeProgramme, cacheAfterProgramme; GetProgrammeCacheOffsets(cacheBeforeProgramme, cacheAfterProgramme); @@ -468,7 +468,7 @@ void CGUIEPGGridContainer::ProcessProgrammeGrid(unsigned int currentTime, CDirty // increment our X position posA2 += m_gridIndex[channel][block].width; // assumes focused & unfocused layouts have equal length - block += (int)(m_gridIndex[channel][block].originWidth / m_blockSize); + block += MathUtils::round_int(m_gridIndex[channel][block].originWidth / m_blockSize); } // increment our Y position @@ -482,8 +482,8 @@ void CGUIEPGGridContainer::RenderProgrammeGrid() if (!m_focusedProgrammeLayout || !m_programmeLayout || m_rulerItems.size()<=1 || (m_gridEnd - m_gridStart) == CDateTimeSpan(0, 0, 0, 0)) return; - int blockOffset = (int)floorf(m_programmeScrollOffset / m_blockSize); - int chanOffset = (int)floorf(m_channelScrollOffset / m_programmeLayout->Size(VERTICAL)); + int blockOffset = MathUtils::round_int(m_programmeScrollOffset / m_blockSize); + int chanOffset = MathUtils::round_int(m_channelScrollOffset / m_programmeLayout->Size(VERTICAL)); /// Render programmes int cacheBeforeProgramme, cacheAfterProgramme; @@ -554,7 +554,7 @@ void CGUIEPGGridContainer::RenderProgrammeGrid() // increment our X position posA2 += m_gridIndex[channel][block].width; // assumes focused & unfocused layouts have equal length - block += (int)(m_gridIndex[channel][block].originWidth / m_blockSize); + block += MathUtils::round_int(m_gridIndex[channel][block].originWidth / m_blockSize); } // increment our Y position @@ -1285,8 +1285,8 @@ bool CGUIEPGGridContainer::SelectItemFromPoint(const CPoint &point, bool justGri if (!m_focusedProgrammeLayout || !m_programmeLayout || (justGrid && point.x < 0)) return false; - int channel = (int)(point.y / m_channelHeight); - int block = (int)(point.x / m_blockSize); + int channel = MathUtils::round_int(point.y / m_channelHeight); + int block = MathUtils::round_int(point.x / m_blockSize); if (channel > m_channelsPerPage) channel = m_channelsPerPage - 1; if (channel >= m_channels) channel = m_channels - 1; @@ -1587,7 +1587,7 @@ CGUIListItemPtr CGUIEPGGridContainer::GetListItem(int offset, unsigned int flag) int item = m_channelCursor + m_channelOffset + offset; if (flag & INFOFLAG_LISTITEM_POSITION) - item = (int)(m_channelScrollOffset / m_channelLayout->Size(VERTICAL)); + item = MathUtils::round_int(m_channelScrollOffset / m_channelLayout->Size(VERTICAL)); if (flag & INFOFLAG_LISTITEM_WRAP) { @@ -1663,9 +1663,9 @@ GridItemsPtr *CGUIEPGGridContainer::GetClosestItem(const int &channel) int CGUIEPGGridContainer::GetItemSize(GridItemsPtr *item) { if (!item) - return (int) m_blockSize; /// stops it crashing + return MathUtils::round_int(m_blockSize); /// stops it crashing - return (int) (item->width / m_blockSize); + return MathUtils::round_int(item->width / m_blockSize); } int CGUIEPGGridContainer::GetBlock(const CGUIListItemPtr &item, const int &channel) @@ -2017,8 +2017,8 @@ void CGUIEPGGridContainer::UpdateLayout() m_channelPosY = m_posY + m_rulerHeight; m_rulerPosX = m_posX + m_channelWidth; m_rulerPosY = m_posY; - m_channelsPerPage = (int)(m_gridHeight / m_channelHeight); - m_programmesPerPage = (int)(m_gridWidth / m_blockSize) + 1; + m_channelsPerPage = MathUtils::round_int(m_gridHeight / m_channelHeight); + m_programmesPerPage = MathUtils::round_int(m_gridWidth / m_blockSize) + 1; // ensure that the scroll offsets are a multiple of our sizes m_channelScrollOffset = m_channelOffset * m_programmeLayout->Size(VERTICAL); diff --git a/xbmc/rendering/dx/RenderSystemDX.cpp b/xbmc/rendering/dx/RenderSystemDX.cpp index fe70da91a6..b1b9d1c387 100644 --- a/xbmc/rendering/dx/RenderSystemDX.cpp +++ b/xbmc/rendering/dx/RenderSystemDX.cpp @@ -812,24 +812,23 @@ bool CRenderSystemDX::CreateWindowSizeDependentResources() if (SUCCEEDED(hr)) { m_pSwapChain1->QueryInterface(__uuidof(IDXGISwapChain), reinterpret_cast<void**>(&m_pSwapChain)); + // this hackish way to disable stereo in windowed mode: + // - restart presenting, 0 in sync interval discards current frame also + // - wait until new frame will be drawn + // sleep value possible depends on hardware m.b. need a setting in as.xml + if (m_useWindowedDX && !bHWStereoEnabled && m_bHWStereoEnabled) + { + DXGI_PRESENT_PARAMETERS presentParams = {}; + presentParams.DirtyRectsCount = 0; + presentParams.pDirtyRects = NULL; + presentParams.pScrollRect = NULL; + m_pSwapChain1->Present1(0, DXGI_PRESENT_RESTART, &presentParams); + + Sleep(100); + } m_bHWStereoEnabled = bHWStereoEnabled; } dxgiFactory2->Release(); - - // this hackish way to disable stereo in windowed mode: - // - restart presenting, 0 in sync interval discards current frame also - // - wait until new frame will be drawn - // sleep value possible depends on hardware m.b. need a setting in as.xml - if (!bHWStereoEnabled && m_useWindowedDX && bNeedRecreate) - { - DXGI_PRESENT_PARAMETERS presentParams = {}; - presentParams.DirtyRectsCount = 0; - presentParams.pDirtyRects = NULL; - presentParams.pScrollRect = NULL; - m_pSwapChain1->Present1(0, DXGI_PRESENT_RESTART, &presentParams); - - Sleep(100); - } } else { diff --git a/xbmc/utils/win32/memcpy_sse2.h b/xbmc/utils/win32/memcpy_sse2.h index e6ea34a940..de9323831a 100644 --- a/xbmc/utils/win32/memcpy_sse2.h +++ b/xbmc/utils/win32/memcpy_sse2.h @@ -118,7 +118,7 @@ inline void convert_yuv420_nv12(uint8_t *const src[], const int srcStride[], int *d++ = *v++; } } - else + else if (i < chromaWidth) { xmm0 = _mm_load_si128((__m128i*)(v + i)); xmm1 = _mm_load_si128((__m128i*)(u + i)); |