[vlc-devel] [PATCH 2/2] direct3d11: align GPU surfaces to 128 octets, the max required for any codec

Steve Lhomme robux4 at videolabs.io
Tue Mar 28 10:23:39 CEST 2017


Fixes #17856

--
replaces https://patches.videolan.org/patch/16121/
- remove old code that did the same but for 1 line
---
 modules/video_output/win32/direct3d11.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 555b0be603..6a8706ca63 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -684,15 +684,6 @@ static int AllocateTextures(vout_display_t *vd, const d3d_format_t *cfg,
     texDesc.ArraySize = pool_size;
     texDesc.Height = fmt->i_height;
     texDesc.Width = fmt->i_width;
-    /* add an extra line if needed, it will be cropped on display */
-    if (cfg->formatTexture == DXGI_FORMAT_NV12 || cfg->formatTexture == DXGI_FORMAT_P010)
-    {
-        texDesc.Width  = (texDesc.Width + 1) & ~1;
-        texDesc.Height = (texDesc.Height + 1) & ~1;
-    }
-    /* this is the actual decoding size that will be used */
-    fmt->i_height = texDesc.Height;
-    fmt->i_width = texDesc.Width;
 
     hr = ID3D11Device_CreateTexture2D( sys->d3ddevice, &texDesc, NULL, &slicedTexture );
     if (FAILED(hr)) {
@@ -1628,6 +1619,12 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
                  (char *)&fmt->i_chroma );
     fmt->i_chroma = sys->picQuadConfig->fourcc;
     DxgiFormatMask( sys->picQuadConfig->formatTexture, fmt );
+    if (is_d3d11_opaque(vd->source.i_chroma))
+    {
+        /* worst case scenario we need 128 alignment for HEVC */
+        fmt->i_width  = (fmt->i_width  + 0x7F) & ~0x7F;
+        fmt->i_height = (fmt->i_height + 0x7F) & ~0x7F;
+    }
 
     /* check the region pixel format */
     sys->d3dregion_format = GetOutputFormat(vd, VLC_CODEC_RGBA, 0, false, true);
-- 
2.11.1



More information about the vlc-devel mailing list