d3d12decoder: Remove ID3D12Device4 interface requirement
Old OS may not support the interface. And allow 11_0 feature level hardware. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5870>
This commit is contained in:
parent
4e5d4a45a3
commit
1c5bba4b6b
subprojects/gst-plugins-bad/sys/d3d12
@ -241,7 +241,7 @@ struct DecoderCmdData
|
|||||||
CloseHandle (event_handle);
|
CloseHandle (event_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
ComPtr<ID3D12Device4> device;
|
ComPtr<ID3D12Device> device;
|
||||||
|
|
||||||
ComPtr<ID3D12VideoDevice> video_device;
|
ComPtr<ID3D12VideoDevice> video_device;
|
||||||
ComPtr<ID3D12VideoDecodeCommandList> cl;
|
ComPtr<ID3D12VideoDecodeCommandList> cl;
|
||||||
@ -443,13 +443,9 @@ gst_d3d12_decoder_open (GstD3D12Decoder * decoder, GstElement * element)
|
|||||||
|
|
||||||
auto priv = decoder->priv;
|
auto priv = decoder->priv;
|
||||||
auto cmd = std::make_unique < DecoderCmdData > ();
|
auto cmd = std::make_unique < DecoderCmdData > ();
|
||||||
auto device_handle = gst_d3d12_device_get_device_handle (decoder->device);
|
HRESULT hr;
|
||||||
|
|
||||||
auto hr = device_handle->QueryInterface (IID_PPV_ARGS (&cmd->device));
|
cmd->device = gst_d3d12_device_get_device_handle (decoder->device);
|
||||||
if (!gst_d3d12_result (hr, decoder->device)) {
|
|
||||||
GST_ERROR_OBJECT (element, "ID3D12Device4 interface is unavailable");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
hr = cmd->device.As (&cmd->video_device);
|
hr = cmd->device.As (&cmd->video_device);
|
||||||
if (!gst_d3d12_result (hr, decoder->device)) {
|
if (!gst_d3d12_result (hr, decoder->device)) {
|
||||||
@ -457,13 +453,6 @@ gst_d3d12_decoder_open (GstD3D12Decoder * decoder, GstElement * element)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = cmd->device->CreateCommandList1 (0, D3D12_COMMAND_LIST_TYPE_VIDEO_DECODE,
|
|
||||||
D3D12_COMMAND_LIST_FLAG_NONE, IID_PPV_ARGS (&cmd->cl));
|
|
||||||
if (!gst_d3d12_result (hr, decoder->device)) {
|
|
||||||
GST_ERROR_OBJECT (element, "Couldn't create command list");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D12_COMMAND_QUEUE_DESC desc = { };
|
D3D12_COMMAND_QUEUE_DESC desc = { };
|
||||||
desc.Type = D3D12_COMMAND_LIST_TYPE_VIDEO_DECODE;
|
desc.Type = D3D12_COMMAND_LIST_TYPE_VIDEO_DECODE;
|
||||||
desc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
|
desc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
|
||||||
@ -1166,9 +1155,16 @@ gst_d3d12_decoder_end_picture (GstD3D12Decoder * decoder,
|
|||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = priv->cmd->cl->Reset (task_data->ca.Get ());
|
if (!priv->cmd->cl) {
|
||||||
|
hr = priv->cmd->device->CreateCommandList (0,
|
||||||
|
D3D12_COMMAND_LIST_TYPE_VIDEO_DECODE,
|
||||||
|
task_data->ca.Get (), nullptr, IID_PPV_ARGS (&priv->cmd->cl));
|
||||||
|
} else {
|
||||||
|
hr = priv->cmd->cl->Reset (task_data->ca.Get ());
|
||||||
|
}
|
||||||
|
|
||||||
if (!gst_d3d12_result (hr, decoder->device)) {
|
if (!gst_d3d12_result (hr, decoder->device)) {
|
||||||
GST_ERROR_OBJECT (decoder, "Couldn't reset command list");
|
GST_ERROR_OBJECT (decoder, "Couldn't configure command list");
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -593,20 +593,13 @@ gst_d3d12_device_new_internal (const GstD3D12DeviceConstructData * data)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = D3D12CreateDevice (adapter.Get (), D3D_FEATURE_LEVEL_12_0,
|
hr = D3D12CreateDevice (adapter.Get (), D3D_FEATURE_LEVEL_11_0,
|
||||||
IID_PPV_ARGS (&device));
|
IID_PPV_ARGS (&device));
|
||||||
if (FAILED (hr)) {
|
if (FAILED (hr)) {
|
||||||
GST_WARNING ("Could not create device, hr: 0x%x", (guint) hr);
|
GST_WARNING ("Could not create device, hr: 0x%x", (guint) hr);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ComPtr < ID3D12Device4 > device4;
|
|
||||||
hr = device.As (&device4);
|
|
||||||
if (FAILED (hr)) {
|
|
||||||
GST_WARNING ("ID3D12Device4 interface unavailable");
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
ComPtr < ID3D12Fence > copy_fence;
|
ComPtr < ID3D12Fence > copy_fence;
|
||||||
hr = device->CreateFence (0,
|
hr = device->CreateFence (0,
|
||||||
D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS (©_fence));
|
D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS (©_fence));
|
||||||
|
@ -68,7 +68,6 @@ plugin_init (GstPlugin * plugin)
|
|||||||
for (guint i = 0; i < 12; i++) {
|
for (guint i = 0; i < 12; i++) {
|
||||||
GstD3D12Device *device = nullptr;
|
GstD3D12Device *device = nullptr;
|
||||||
ID3D12Device *device_handle;
|
ID3D12Device *device_handle;
|
||||||
ComPtr < ID3D12Device4 > device4;
|
|
||||||
ComPtr < ID3D12VideoDevice > video_device;
|
ComPtr < ID3D12VideoDevice > video_device;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
@ -77,11 +76,6 @@ plugin_init (GstPlugin * plugin)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
device_handle = gst_d3d12_device_get_device_handle (device);
|
device_handle = gst_d3d12_device_get_device_handle (device);
|
||||||
hr = device_handle->QueryInterface (IID_PPV_ARGS (&device4));
|
|
||||||
if (FAILED (hr)) {
|
|
||||||
gst_object_unref (device);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
hr = device_handle->QueryInterface (IID_PPV_ARGS (&video_device));
|
hr = device_handle->QueryInterface (IID_PPV_ARGS (&video_device));
|
||||||
if (FAILED (hr)) {
|
if (FAILED (hr)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user