diff options
author | Haihao Xiang <haihao.xiang@intel.com> | 2021-01-27 12:05:44 +0800 |
---|---|---|
committer | GStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2021-01-29 14:08:42 +0000 |
commit | 4ff4bcd725290c8f1a52e791496f164c3090ecaa (patch) | |
tree | 442c4f3fa6a3ceff6c9c3848248fc676b1e82e1c /gst-libs | |
parent | 85284f4aacc9cfc059c59aa033166fedc247e117 (diff) |
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>
Diffstat (limited to 'gst-libs')
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapidisplay_drm.c | 34 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapidisplay_drm.h | 3 |
2 files changed, 37 insertions, 0 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidisplay_drm.c b/gst-libs/gst/vaapi/gstvaapidisplay_drm.c index 7f4d3996..c4e5001d 100644 --- a/gst-libs/gst/vaapi/gstvaapidisplay_drm.c +++ b/gst-libs/gst/vaapi/gstvaapidisplay_drm.c @@ -397,6 +397,40 @@ gst_vaapi_display_drm_new_with_device (gint 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: * @display: a #GstVaapiDisplayDRM * diff --git a/gst-libs/gst/vaapi/gstvaapidisplay_drm.h b/gst-libs/gst/vaapi/gstvaapidisplay_drm.h index 5424b324..199c6eae 100644 --- a/gst-libs/gst/vaapi/gstvaapidisplay_drm.h +++ b/gst-libs/gst/vaapi/gstvaapidisplay_drm.h @@ -39,6 +39,9 @@ gst_vaapi_display_drm_new (const gchar * device_path); GstVaapiDisplay * gst_vaapi_display_drm_new_with_device (gint device); +GstVaapiDisplay * +gst_vaapi_display_drm_new_with_va_display (VADisplay va_display, gint fd); + gint gst_vaapi_display_drm_get_device (GstVaapiDisplayDRM * display); |