From 3a0be26944ffe39f914d13e5f6d8ee9d13b15b4e Mon Sep 17 00:00:00 2001 From: Anton Fedchin Date: Fri, 7 Jul 2017 16:30:00 +0300 Subject: [PATCH] [dxva] clear video views on creation. --- xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp | 3 +++ xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/DXVAHD.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp index 649c965a77f12..72f6e335b4db0 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DXVA.cpp @@ -434,6 +434,7 @@ bool CDXVAContext::CreateSurfaces(D3D11_VIDEO_DECODER_DESC format, unsigned int { HRESULT hr = S_OK; ID3D11Device* pDevice = g_Windowing.Get3D11Device(); + ID3D11DeviceContext1* pContext = g_Windowing.GetImmediateContext(); CD3D11_TEXTURE2D_DESC texDesc(format.OutputFormat, FFALIGN(format.SampleWidth, alignment), @@ -451,6 +452,7 @@ bool CDXVAContext::CreateSurfaces(D3D11_VIDEO_DECODER_DESC format, unsigned int vdovDesc.DecodeProfile = format.Guid; vdovDesc.Texture2D.ArraySlice = 0; vdovDesc.ViewDimension = D3D11_VDOV_DIMENSION_TEXTURE2D; + float clearColor[] = { 0.0625f, 0.5f, 0.5f, 1.0f }; // black color in YUV size_t i; for (i = 0; i < count; ++i) @@ -462,6 +464,7 @@ bool CDXVAContext::CreateSurfaces(D3D11_VIDEO_DECODER_DESC format, unsigned int CLog::Log(LOGERROR, "%s - failed creating surfaces", __FUNCTION__); break; } + pContext->ClearView(surfaces[i], clearColor, nullptr, 0); } SAFE_RELEASE(texture); diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/DXVAHD.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/DXVAHD.cpp index eb5e325885e3b..d9f3b61f0e611 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/DXVAHD.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/DXVAHD.cpp @@ -361,6 +361,7 @@ bool CProcessorHD::CreateSurfaces() HRESULT hr; size_t idx; ID3D11Device* pD3DDevice = g_Windowing.Get3D11Device(); + ID3D11DeviceContext1* pContext = g_Windowing.GetImmediateContext(); // we cannot use texture array (like in decoder) for USAGE_DYNAMIC, so create separate textures CD3D11_TEXTURE2D_DESC texDesc(m_textureFormat, FFALIGN(m_width, 16), FFALIGN(m_height, 16), 1, 1, D3D11_BIND_DECODER, D3D11_USAGE_DYNAMIC, D3D11_CPU_ACCESS_WRITE); @@ -371,6 +372,7 @@ bool CProcessorHD::CreateSurfaces() ID3D11VideoProcessorInputView* views[32] = { nullptr }; CLog::Log(LOGDEBUG, "%s - Creating %d processor surfaces with format %d.", __FUNCTION__, m_size, m_textureFormat); + float clearColor[] = { 0.0625f, 0.5f, 0.5f, 1.0f }; // black color in YUV for (idx = 0; idx < m_size; idx++) { ID3D11Texture2D* pTexture = nullptr; @@ -382,6 +384,7 @@ bool CProcessorHD::CreateSurfaces() SAFE_RELEASE(pTexture); if (FAILED(hr)) break; + pContext->ClearView(views[idx], clearColor, nullptr, 0); } if (idx != m_size)