mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-25 01:54:17 +00:00
libs: display: drm: support gst.vaapi.app.Display context for drm backend
Attributes for drm backend: - va-display : ponter of VADisplay - drm-device-fd : the DRM device file descriptor Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/409>
This commit is contained in:
parent
85284f4aac
commit
4ff4bcd725
3 changed files with 49 additions and 0 deletions
|
@ -396,6 +396,40 @@ gst_vaapi_display_drm_new_with_device (gint device)
|
||||||
GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY, GINT_TO_POINTER (device));
|
GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY, GINT_TO_POINTER (device));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_vaapi_display_drm_new_with_va_display:
|
||||||
|
* @va_display: a VADisplay #va_display
|
||||||
|
* @fd: an open DRM device (file descriptor) #fd
|
||||||
|
*
|
||||||
|
* Creates a #GstVaapiDisplay based on the VADisplay @va_display and
|
||||||
|
* the open DRM device @fd.
|
||||||
|
* The caller still owns the device file descriptor and must call close()
|
||||||
|
* when all #GstVaapiDisplay references are released.
|
||||||
|
*
|
||||||
|
* Return value: a newly allocated #GstVaapiDisplay object
|
||||||
|
*/
|
||||||
|
|
||||||
|
GstVaapiDisplay *
|
||||||
|
gst_vaapi_display_drm_new_with_va_display (VADisplay va_display, gint fd)
|
||||||
|
{
|
||||||
|
GstVaapiDisplay *display;
|
||||||
|
GstVaapiDisplayInfo info = {
|
||||||
|
.va_display = va_display,
|
||||||
|
.native_display = GINT_TO_POINTER (fd),
|
||||||
|
};
|
||||||
|
|
||||||
|
g_return_val_if_fail (fd >= 0, NULL);
|
||||||
|
|
||||||
|
display = g_object_new (GST_TYPE_VAAPI_DISPLAY_DRM, NULL);
|
||||||
|
if (!gst_vaapi_display_config (display,
|
||||||
|
GST_VAAPI_DISPLAY_INIT_FROM_VA_DISPLAY, &info)) {
|
||||||
|
gst_object_unref (display);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return display;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_vaapi_display_drm_get_device:
|
* gst_vaapi_display_drm_get_device:
|
||||||
* @display: a #GstVaapiDisplayDRM
|
* @display: a #GstVaapiDisplayDRM
|
||||||
|
|
|
@ -39,6 +39,9 @@ gst_vaapi_display_drm_new (const gchar * device_path);
|
||||||
GstVaapiDisplay *
|
GstVaapiDisplay *
|
||||||
gst_vaapi_display_drm_new_with_device (gint device);
|
gst_vaapi_display_drm_new_with_device (gint device);
|
||||||
|
|
||||||
|
GstVaapiDisplay *
|
||||||
|
gst_vaapi_display_drm_new_with_va_display (VADisplay va_display, gint fd);
|
||||||
|
|
||||||
gint
|
gint
|
||||||
gst_vaapi_display_drm_get_device (GstVaapiDisplayDRM * display);
|
gst_vaapi_display_drm_get_device (GstVaapiDisplayDRM * display);
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,9 @@
|
||||||
#if USE_WAYLAND
|
#if USE_WAYLAND
|
||||||
#include <gst/vaapi/gstvaapidisplay_wayland.h>
|
#include <gst/vaapi/gstvaapidisplay_wayland.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if USE_DRM
|
||||||
|
#include <gst/vaapi/gstvaapidisplay_drm.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_STATIC (GST_CAT_CONTEXT);
|
GST_DEBUG_CATEGORY_STATIC (GST_CAT_CONTEXT);
|
||||||
|
|
||||||
|
@ -117,6 +120,15 @@ gst_vaapi_video_context_get_display (GstContext * context, gboolean app_context,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if USE_DRM
|
||||||
|
if (!display) {
|
||||||
|
gint fd = -1;
|
||||||
|
if (gst_structure_get (structure, "drm-device-fd", G_TYPE_INT, &fd,
|
||||||
|
NULL)) {
|
||||||
|
display = gst_vaapi_display_drm_new_with_va_display (va_display, fd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
_init_context_debug ();
|
_init_context_debug ();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue