diff --git a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12decoder.cpp b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12decoder.cpp index 8ef898a5fe..719deda92c 100644 --- a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12decoder.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12decoder.cpp @@ -241,7 +241,7 @@ struct DecoderCmdData CloseHandle (event_handle); } - ComPtr device; + ComPtr device; ComPtr video_device; ComPtr cl; @@ -443,13 +443,9 @@ gst_d3d12_decoder_open (GstD3D12Decoder * decoder, GstElement * element) auto priv = decoder->priv; 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)); - if (!gst_d3d12_result (hr, decoder->device)) { - GST_ERROR_OBJECT (element, "ID3D12Device4 interface is unavailable"); - return FALSE; - } + cmd->device = gst_d3d12_device_get_device_handle (decoder->device); hr = cmd->device.As (&cmd->video_device); if (!gst_d3d12_result (hr, decoder->device)) { @@ -457,13 +453,6 @@ gst_d3d12_decoder_open (GstD3D12Decoder * decoder, GstElement * element) 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 = { }; desc.Type = D3D12_COMMAND_LIST_TYPE_VIDEO_DECODE; desc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE; @@ -1166,9 +1155,16 @@ gst_d3d12_decoder_end_picture (GstD3D12Decoder * decoder, 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)) { - GST_ERROR_OBJECT (decoder, "Couldn't reset command list"); + GST_ERROR_OBJECT (decoder, "Couldn't configure command list"); return GST_FLOW_ERROR; } diff --git a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12device.cpp b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12device.cpp index f46ae3f621..a4b96f8c68 100644 --- a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12device.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12device.cpp @@ -593,20 +593,13 @@ gst_d3d12_device_new_internal (const GstD3D12DeviceConstructData * data) return nullptr; } - hr = D3D12CreateDevice (adapter.Get (), D3D_FEATURE_LEVEL_12_0, + hr = D3D12CreateDevice (adapter.Get (), D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS (&device)); if (FAILED (hr)) { GST_WARNING ("Could not create device, hr: 0x%x", (guint) hr); return nullptr; } - ComPtr < ID3D12Device4 > device4; - hr = device.As (&device4); - if (FAILED (hr)) { - GST_WARNING ("ID3D12Device4 interface unavailable"); - return nullptr; - } - ComPtr < ID3D12Fence > copy_fence; hr = device->CreateFence (0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS (©_fence)); diff --git a/subprojects/gst-plugins-bad/sys/d3d12/plugin.cpp b/subprojects/gst-plugins-bad/sys/d3d12/plugin.cpp index cd77244c52..a065463197 100644 --- a/subprojects/gst-plugins-bad/sys/d3d12/plugin.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d12/plugin.cpp @@ -68,7 +68,6 @@ plugin_init (GstPlugin * plugin) for (guint i = 0; i < 12; i++) { GstD3D12Device *device = nullptr; ID3D12Device *device_handle; - ComPtr < ID3D12Device4 > device4; ComPtr < ID3D12VideoDevice > video_device; HRESULT hr; @@ -77,11 +76,6 @@ plugin_init (GstPlugin * plugin) break; 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)); if (FAILED (hr)) {