mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-15 22:01:27 +00:00
d3d12decoder: Fix barrier usage
Common state promotion and decay does not seem to be applied to decoder commands. Use barriers explicitly Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5877>
This commit is contained in:
parent
583fadc051
commit
9d5277e70e
1 changed files with 22 additions and 33 deletions
|
@ -1184,12 +1184,9 @@ gst_d3d12_decoder_end_picture (GstD3D12Decoder * decoder,
|
||||||
pre_barriers.push_back (CD3DX12_RESOURCE_BARRIER::Transition (resource,
|
pre_barriers.push_back (CD3DX12_RESOURCE_BARRIER::Transition (resource,
|
||||||
D3D12_RESOURCE_STATE_COMMON,
|
D3D12_RESOURCE_STATE_COMMON,
|
||||||
D3D12_RESOURCE_STATE_VIDEO_DECODE_READ));
|
D3D12_RESOURCE_STATE_VIDEO_DECODE_READ));
|
||||||
|
|
||||||
if (priv->session->reference_only) {
|
|
||||||
post_barriers.push_back (CD3DX12_RESOURCE_BARRIER::Transition (resource,
|
post_barriers.push_back (CD3DX12_RESOURCE_BARRIER::Transition (resource,
|
||||||
D3D12_RESOURCE_STATE_VIDEO_DECODE_READ,
|
D3D12_RESOURCE_STATE_VIDEO_DECODE_READ,
|
||||||
D3D12_RESOURCE_STATE_COMMON));
|
D3D12_RESOURCE_STATE_COMMON));
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
gst_d3d12_memory_get_subresource_index (dmem, 0, &subresource[0]);
|
gst_d3d12_memory_get_subresource_index (dmem, 0, &subresource[0]);
|
||||||
gst_d3d12_memory_get_subresource_index (dmem, 1, &subresource[1]);
|
gst_d3d12_memory_get_subresource_index (dmem, 1, &subresource[1]);
|
||||||
|
@ -1200,8 +1197,6 @@ gst_d3d12_decoder_end_picture (GstD3D12Decoder * decoder,
|
||||||
pre_barriers.push_back (CD3DX12_RESOURCE_BARRIER::Transition (resource,
|
pre_barriers.push_back (CD3DX12_RESOURCE_BARRIER::Transition (resource,
|
||||||
D3D12_RESOURCE_STATE_COMMON,
|
D3D12_RESOURCE_STATE_COMMON,
|
||||||
D3D12_RESOURCE_STATE_VIDEO_DECODE_READ, subresource[1]));
|
D3D12_RESOURCE_STATE_VIDEO_DECODE_READ, subresource[1]));
|
||||||
|
|
||||||
if (priv->session->reference_only) {
|
|
||||||
post_barriers.push_back (CD3DX12_RESOURCE_BARRIER::Transition (resource,
|
post_barriers.push_back (CD3DX12_RESOURCE_BARRIER::Transition (resource,
|
||||||
D3D12_RESOURCE_STATE_VIDEO_DECODE_READ,
|
D3D12_RESOURCE_STATE_VIDEO_DECODE_READ,
|
||||||
D3D12_RESOURCE_STATE_COMMON, subresource[0]));
|
D3D12_RESOURCE_STATE_COMMON, subresource[0]));
|
||||||
|
@ -1210,7 +1205,6 @@ gst_d3d12_decoder_end_picture (GstD3D12Decoder * decoder,
|
||||||
D3D12_RESOURCE_STATE_COMMON, subresource[1]));
|
D3D12_RESOURCE_STATE_COMMON, subresource[1]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (decoder_pic->output_buffer) {
|
if (decoder_pic->output_buffer) {
|
||||||
dmem = (GstD3D12Memory *)
|
dmem = (GstD3D12Memory *)
|
||||||
|
@ -1220,8 +1214,9 @@ gst_d3d12_decoder_end_picture (GstD3D12Decoder * decoder,
|
||||||
pre_barriers.push_back (CD3DX12_RESOURCE_BARRIER::Transition (out_resource,
|
pre_barriers.push_back (CD3DX12_RESOURCE_BARRIER::Transition (out_resource,
|
||||||
D3D12_RESOURCE_STATE_COMMON,
|
D3D12_RESOURCE_STATE_COMMON,
|
||||||
D3D12_RESOURCE_STATE_VIDEO_DECODE_WRITE));
|
D3D12_RESOURCE_STATE_VIDEO_DECODE_WRITE));
|
||||||
/* output resource is allocated with simultaneous-access flag.
|
post_barriers.push_back (CD3DX12_RESOURCE_BARRIER::Transition (out_resource,
|
||||||
* resource barrier to common state is not needed */
|
D3D12_RESOURCE_STATE_VIDEO_DECODE_WRITE,
|
||||||
|
D3D12_RESOURCE_STATE_COMMON));
|
||||||
}
|
}
|
||||||
|
|
||||||
dmem = (GstD3D12Memory *) gst_buffer_peek_memory (decoder_pic->buffer, 0);
|
dmem = (GstD3D12Memory *) gst_buffer_peek_memory (decoder_pic->buffer, 0);
|
||||||
|
@ -1233,12 +1228,9 @@ gst_d3d12_decoder_end_picture (GstD3D12Decoder * decoder,
|
||||||
pre_barriers.push_back (CD3DX12_RESOURCE_BARRIER::Transition (resource,
|
pre_barriers.push_back (CD3DX12_RESOURCE_BARRIER::Transition (resource,
|
||||||
D3D12_RESOURCE_STATE_COMMON,
|
D3D12_RESOURCE_STATE_COMMON,
|
||||||
D3D12_RESOURCE_STATE_VIDEO_DECODE_WRITE));
|
D3D12_RESOURCE_STATE_VIDEO_DECODE_WRITE));
|
||||||
|
|
||||||
if (priv->session->reference_only) {
|
|
||||||
post_barriers.push_back (CD3DX12_RESOURCE_BARRIER::Transition (resource,
|
post_barriers.push_back (CD3DX12_RESOURCE_BARRIER::Transition (resource,
|
||||||
D3D12_RESOURCE_STATE_VIDEO_DECODE_WRITE,
|
D3D12_RESOURCE_STATE_VIDEO_DECODE_WRITE,
|
||||||
D3D12_RESOURCE_STATE_COMMON));
|
D3D12_RESOURCE_STATE_COMMON));
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
gst_d3d12_memory_get_subresource_index (GST_D3D12_MEMORY_CAST (dmem), 1,
|
gst_d3d12_memory_get_subresource_index (GST_D3D12_MEMORY_CAST (dmem), 1,
|
||||||
&subresource[1]);
|
&subresource[1]);
|
||||||
|
@ -1249,8 +1241,6 @@ gst_d3d12_decoder_end_picture (GstD3D12Decoder * decoder,
|
||||||
pre_barriers.push_back (CD3DX12_RESOURCE_BARRIER::Transition (resource,
|
pre_barriers.push_back (CD3DX12_RESOURCE_BARRIER::Transition (resource,
|
||||||
D3D12_RESOURCE_STATE_COMMON,
|
D3D12_RESOURCE_STATE_COMMON,
|
||||||
D3D12_RESOURCE_STATE_VIDEO_DECODE_WRITE, subresource[1]));
|
D3D12_RESOURCE_STATE_VIDEO_DECODE_WRITE, subresource[1]));
|
||||||
|
|
||||||
if (priv->session->reference_only) {
|
|
||||||
post_barriers.push_back (CD3DX12_RESOURCE_BARRIER::Transition (resource,
|
post_barriers.push_back (CD3DX12_RESOURCE_BARRIER::Transition (resource,
|
||||||
D3D12_RESOURCE_STATE_VIDEO_DECODE_WRITE,
|
D3D12_RESOURCE_STATE_VIDEO_DECODE_WRITE,
|
||||||
D3D12_RESOURCE_STATE_COMMON, subresource[0]));
|
D3D12_RESOURCE_STATE_COMMON, subresource[0]));
|
||||||
|
@ -1258,7 +1248,6 @@ gst_d3d12_decoder_end_picture (GstD3D12Decoder * decoder,
|
||||||
D3D12_RESOURCE_STATE_VIDEO_DECODE_WRITE,
|
D3D12_RESOURCE_STATE_VIDEO_DECODE_WRITE,
|
||||||
D3D12_RESOURCE_STATE_COMMON, subresource[1]));
|
D3D12_RESOURCE_STATE_COMMON, subresource[1]));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
priv->cmd->cl->ResourceBarrier (pre_barriers.size (), &pre_barriers[0]);
|
priv->cmd->cl->ResourceBarrier (pre_barriers.size (), &pre_barriers[0]);
|
||||||
|
|
||||||
|
@ -1267,7 +1256,7 @@ gst_d3d12_decoder_end_picture (GstD3D12Decoder * decoder,
|
||||||
out_args.OutputSubresource = 0;
|
out_args.OutputSubresource = 0;
|
||||||
out_args.ConversionArguments.Enable = TRUE;
|
out_args.ConversionArguments.Enable = TRUE;
|
||||||
out_args.ConversionArguments.pReferenceTexture2D = resource;
|
out_args.ConversionArguments.pReferenceTexture2D = resource;
|
||||||
out_args.ConversionArguments.ReferenceSubresource = 0;
|
out_args.ConversionArguments.ReferenceSubresource = subresource[0];
|
||||||
} else {
|
} else {
|
||||||
out_args.pOutputTexture2D = resource;
|
out_args.pOutputTexture2D = resource;
|
||||||
out_args.OutputSubresource = subresource[0];
|
out_args.OutputSubresource = subresource[0];
|
||||||
|
|
Loading…
Reference in a new issue