mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 01:45:33 +00:00
d3d12bufferpool: Use d3dx12.h format table
The format table in SDK header defines all required information already. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6494>
This commit is contained in:
parent
0527f27204
commit
927e249557
1 changed files with 19 additions and 14 deletions
|
@ -116,6 +116,21 @@ gst_d3d12_buffer_pool_get_options (GstBufferPool * pool)
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_d3d12_buffer_pool_do_align (D3D12_RESOURCE_DESC & desc)
|
||||||
|
{
|
||||||
|
UINT width_align =
|
||||||
|
D3D12_PROPERTY_LAYOUT_FORMAT_TABLE::GetWidthAlignment (desc.Format);
|
||||||
|
UINT height_align =
|
||||||
|
D3D12_PROPERTY_LAYOUT_FORMAT_TABLE::GetHeightAlignment (desc.Format);
|
||||||
|
|
||||||
|
if (width_align > 1)
|
||||||
|
desc.Width = GST_ROUND_UP_N (desc.Width, (UINT64) width_align);
|
||||||
|
|
||||||
|
if (height_align > 1)
|
||||||
|
desc.Height = GST_ROUND_UP_N (desc.Height, height_align);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_d3d12_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
gst_d3d12_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
||||||
{
|
{
|
||||||
|
@ -173,20 +188,8 @@ gst_d3d12_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
||||||
desc[0] = CD3DX12_RESOURCE_DESC::Tex2D (params->d3d12_format.dxgi_format,
|
desc[0] = CD3DX12_RESOURCE_DESC::Tex2D (params->d3d12_format.dxgi_format,
|
||||||
params->aligned_info.width, params->aligned_info.height,
|
params->aligned_info.width, params->aligned_info.height,
|
||||||
params->array_size, 1, 1, 0, params->resource_flags);
|
params->array_size, 1, 1, 0, params->resource_flags);
|
||||||
switch (params->d3d12_format.dxgi_format) {
|
|
||||||
case DXGI_FORMAT_NV12:
|
gst_d3d12_buffer_pool_do_align (desc[0]);
|
||||||
case DXGI_FORMAT_P010:
|
|
||||||
case DXGI_FORMAT_P016:
|
|
||||||
desc[0].Width = GST_ROUND_UP_2 (desc[0].Width);
|
|
||||||
desc[0].Height = GST_ROUND_UP_2 (desc[0].Height);
|
|
||||||
break;
|
|
||||||
case DXGI_FORMAT_Y210:
|
|
||||||
case DXGI_FORMAT_Y216:
|
|
||||||
desc[0].Width = GST_ROUND_UP_2 (desc[0].Width);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto alloc = (GstD3D12Allocator *)
|
auto alloc = (GstD3D12Allocator *)
|
||||||
gst_d3d12_pool_allocator_new (self->device,
|
gst_d3d12_pool_allocator_new (self->device,
|
||||||
|
@ -216,6 +219,8 @@ gst_d3d12_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
||||||
GST_VIDEO_INFO_COMP_HEIGHT (¶ms->aligned_info, i),
|
GST_VIDEO_INFO_COMP_HEIGHT (¶ms->aligned_info, i),
|
||||||
params->array_size, 1, 1, 0, params->resource_flags);
|
params->array_size, 1, 1, 0, params->resource_flags);
|
||||||
|
|
||||||
|
gst_d3d12_buffer_pool_do_align (desc[i]);
|
||||||
|
|
||||||
auto alloc = (GstD3D12Allocator *)
|
auto alloc = (GstD3D12Allocator *)
|
||||||
gst_d3d12_pool_allocator_new (self->device,
|
gst_d3d12_pool_allocator_new (self->device,
|
||||||
&heap_props, params->heap_flags, &desc[i],
|
&heap_props, params->heap_flags, &desc[i],
|
||||||
|
|
Loading…
Reference in a new issue