d3d12: Promote decoder and videosink rank to primary

It's proven that d3d12 performs better than d3d11 while
consumes less resources in various cases.
Assign primary+ rank to decoder and videosink in case of Windows10/11,
so that it can be tested widely

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7045>
This commit is contained in:
Seungha Yang 2024-06-18 00:33:37 +09:00 committed by GStreamer Marge Bot
parent f40d947c4a
commit 339c81bac8
3 changed files with 32 additions and 7 deletions

View file

@ -143,3 +143,14 @@ gst_d3d12_need_transform (gfloat rotation_x, gfloat rotation_y,
return FALSE;
}
gboolean
gst_d3d12_is_windows_10_or_greater (void)
{
static gboolean ret = FALSE;
GST_D3D12_CALL_ONCE_BEGIN {
ret = g_win32_check_windows_version (10, 0, 0, G_WIN32_OS_ANY);
} GST_D3D12_CALL_ONCE_END;
return ret;
}

View file

@ -58,4 +58,6 @@ gboolean gst_d3d12_need_transform (gfloat rotation_x,
gfloat scale_x,
gfloat scale_y);
gboolean gst_d3d12_is_windows_10_or_greater (void);
G_END_DECLS

View file

@ -72,6 +72,13 @@ plugin_init (GstPlugin * plugin)
return TRUE;
}
guint sink_rank = GST_RANK_NONE;
guint decoder_rank = GST_RANK_NONE;
bool have_video_device = false;
if (gst_d3d12_is_windows_10_or_greater ())
decoder_rank = GST_RANK_PRIMARY + 2;
/* Enumerate devices to register decoders per device and to get the highest
* feature level */
/* AMD seems to be supporting up to 12 cards, and 8 for NVIDIA */
@ -93,18 +100,20 @@ plugin_init (GstPlugin * plugin)
continue;
}
have_video_device = true;
gst_d3d12_mpeg2_dec_register (plugin, device, video_device.Get (),
GST_RANK_NONE);
decoder_rank);
gst_d3d12_h264_dec_register (plugin, device, video_device.Get (),
GST_RANK_NONE);
decoder_rank);
gst_d3d12_h265_dec_register (plugin, device, video_device.Get (),
GST_RANK_NONE);
decoder_rank);
gst_d3d12_vp8_dec_register (plugin, device, video_device.Get (),
GST_RANK_NONE);
decoder_rank);
gst_d3d12_vp9_dec_register (plugin, device, video_device.Get (),
GST_RANK_NONE);
decoder_rank);
gst_d3d12_av1_dec_register (plugin, device, video_device.Get (),
GST_RANK_NONE);
decoder_rank);
gst_d3d12_h264_enc_register (plugin, device, video_device.Get (),
GST_RANK_NONE);
@ -112,6 +121,9 @@ plugin_init (GstPlugin * plugin)
gst_object_unref (device);
}
if (gst_d3d12_is_windows_10_or_greater () && have_video_device)
sink_rank = GST_RANK_PRIMARY + 1;
gst_element_register (plugin,
"d3d12convert", GST_RANK_NONE, GST_TYPE_D3D12_CONVERT);
gst_element_register (plugin,
@ -119,7 +131,7 @@ plugin_init (GstPlugin * plugin)
gst_element_register (plugin,
"d3d12upload", GST_RANK_NONE, GST_TYPE_D3D12_UPLOAD);
gst_element_register (plugin,
"d3d12videosink", GST_RANK_NONE, GST_TYPE_D3D12_VIDEO_SINK);
"d3d12videosink", sink_rank, GST_TYPE_D3D12_VIDEO_SINK);
gst_element_register (plugin,
"d3d12testsrc", GST_RANK_NONE, GST_TYPE_D3D12_TEST_SRC);
gst_element_register (plugin,