mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
vadisplay_win32: Query profiles and entry points on init
Depending on driver, display can be initialized but fails on query calls. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4149>
This commit is contained in:
parent
fe63034dd4
commit
63c854c64b
1 changed files with 38 additions and 3 deletions
|
@ -44,6 +44,7 @@
|
|||
#include <dxgi.h>
|
||||
#include <va/va_win32.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
using namespace Microsoft::WRL;
|
||||
|
@ -239,6 +240,12 @@ gst_va_display_win32_new (const gchar * adapter_luid)
|
|||
DXGI_ADAPTER_DESC desc;
|
||||
gint64 adapter_luid_i64;
|
||||
gchar *desc_str;
|
||||
gint max_profiles, max_entry_points;
|
||||
gint num_profiles;
|
||||
VAStatus status;
|
||||
VADisplay dpy;
|
||||
std::vector < VAEntrypoint > entry_points;
|
||||
std::vector < VAProfile > profiles;
|
||||
|
||||
g_return_val_if_fail (adapter_luid != nullptr, nullptr);
|
||||
|
||||
|
@ -280,12 +287,40 @@ gst_va_display_win32_new (const gchar * adapter_luid)
|
|||
"path", adapter_luid, "adapter-luid", adapter_luid_i64, "device-id",
|
||||
desc.DeviceId, "vendor-id", desc.VendorId, nullptr);
|
||||
self->desc = desc_str;
|
||||
if (!gst_va_display_initialize (GST_VA_DISPLAY (self))) {
|
||||
gst_object_unref (self);
|
||||
return nullptr;
|
||||
if (!gst_va_display_initialize (GST_VA_DISPLAY (self)))
|
||||
goto error;
|
||||
|
||||
/* Validate device */
|
||||
dpy = gst_va_display_get_va_dpy (GST_VA_DISPLAY (self));
|
||||
|
||||
max_profiles = vaMaxNumProfiles (dpy);
|
||||
if (max_profiles <= 0)
|
||||
goto error;
|
||||
|
||||
max_entry_points = vaMaxNumEntrypoints (dpy);
|
||||
if (max_entry_points <= 0)
|
||||
goto error;
|
||||
|
||||
profiles.resize (max_profiles);
|
||||
|
||||
status = vaQueryConfigProfiles (dpy, &profiles[0], &num_profiles);
|
||||
if (status != VA_STATUS_SUCCESS || num_profiles <= 0)
|
||||
goto error;
|
||||
|
||||
entry_points.resize (max_entry_points);
|
||||
for (guint i = 0; i < num_profiles; i++) {
|
||||
gint num_entry_poinits;
|
||||
status = vaQueryConfigEntrypoints (dpy, profiles[i], &entry_points[0],
|
||||
&num_entry_poinits);
|
||||
if (status != VA_STATUS_SUCCESS)
|
||||
goto error;
|
||||
}
|
||||
|
||||
gst_object_ref_sink (self);
|
||||
|
||||
return GST_VA_DISPLAY (self);
|
||||
|
||||
error:
|
||||
gst_object_unref (self);
|
||||
return nullptr;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue