From 44768b233aa6238f774b0ff277accfd0393426e9 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Thu, 2 Jun 2022 06:06:48 +0900 Subject: [PATCH] qsvencoder: Do not copy if input is D3D11 texture In case that input is D3D11 texture, QSV seems to work regardless of the alignment. Actually the alignment requirement seems to make only sense for system memory. Other Intel GPU dependent implementations (new VA encoder, and MediaFoundation) do not require such alignment nor other vendor specific ones (NVENC and AMF) Part-of: --- subprojects/gst-plugins-bad/sys/qsv/gstqsvallocator_d3d11.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/qsv/gstqsvallocator_d3d11.cpp b/subprojects/gst-plugins-bad/sys/qsv/gstqsvallocator_d3d11.cpp index a88a584..0a784e7 100644 --- a/subprojects/gst-plugins-bad/sys/qsv/gstqsvallocator_d3d11.cpp +++ b/subprojects/gst-plugins-bad/sys/qsv/gstqsvallocator_d3d11.cpp @@ -396,8 +396,8 @@ gst_qsv_d3d11_allocator_upload (GstQsvAllocator * allocator, const GstVideoInfo * info, GstBuffer * buffer, GstBufferPool * pool) { GstMemory *mem; - GstD3D11Memory *dmem, *dst_dmem; - D3D11_TEXTURE2D_DESC desc, dst_desc; + GstD3D11Memory *dmem; + D3D11_TEXTURE2D_DESC desc; GstBuffer *dst_buf; GstFlowReturn flow_ret; @@ -434,13 +434,9 @@ gst_qsv_d3d11_allocator_upload (GstQsvAllocator * allocator, if (dmem->device != GST_D3D11_BUFFER_POOL (pool)->device) return gst_qsv_frame_upload_sysmem (info, buffer, dst_buf); - dst_dmem = (GstD3D11Memory *) gst_buffer_peek_memory (dst_buf, 0); gst_d3d11_memory_get_texture_desc (dmem, &desc); - gst_d3d11_memory_get_texture_desc (dst_dmem, &dst_desc); - if (desc.Width == dst_desc.Width && desc.Height == dst_desc.Height && - desc.Usage == D3D11_USAGE_DEFAULT) { - /* Identical size and non-staging texture, wrap without copying */ + if (desc.Usage == D3D11_USAGE_DEFAULT) { GST_TRACE ("Wrapping D3D11 buffer without copy"); gst_buffer_unref (dst_buf); -- 2.7.4