2010-01-25 16:15:01 +00:00
|
|
|
/*
|
|
|
|
* gstvaapidisplay.h - VA display abstraction
|
|
|
|
*
|
2012-01-16 09:41:10 +00:00
|
|
|
* Copyright (C) 2010-2011 Splitted-Desktop Systems
|
2013-11-22 04:57:18 +00:00
|
|
|
* Author: Gwenole Beauchesne <gwenole.beauchesne@splitted-desktop.com>
|
2013-01-29 13:14:45 +00:00
|
|
|
* Copyright (C) 2011-2013 Intel Corporation
|
2013-11-22 04:57:18 +00:00
|
|
|
* Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
|
2010-01-25 16:15:01 +00:00
|
|
|
*
|
2010-05-03 07:07:27 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2.1
|
|
|
|
* of the License, or (at your option) any later version.
|
2010-01-25 16:15:01 +00:00
|
|
|
*
|
2010-05-03 07:07:27 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
2010-01-25 16:15:01 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2010-05-03 07:07:27 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2010-01-25 16:15:01 +00:00
|
|
|
*
|
2010-05-03 07:07:27 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free
|
|
|
|
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301 USA
|
2010-01-25 16:15:01 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GST_VAAPI_DISPLAY_H
|
|
|
|
#define GST_VAAPI_DISPLAY_H
|
|
|
|
|
2012-07-20 09:45:15 +00:00
|
|
|
#include <va/va.h>
|
2010-01-25 16:15:01 +00:00
|
|
|
#include <gst/gst.h>
|
2012-08-27 15:11:37 +00:00
|
|
|
#include <gst/vaapi/gstvaapitypes.h>
|
2010-04-20 13:36:04 +00:00
|
|
|
#include <gst/vaapi/gstvaapiprofile.h>
|
2013-07-09 12:03:01 +00:00
|
|
|
#include <gst/vaapi/video-format.h>
|
2010-01-25 16:15:01 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2016-10-13 03:53:17 +00:00
|
|
|
#define GST_TYPE_VAAPI_DISPLAY (gst_vaapi_display_get_type ())
|
2013-05-07 09:39:34 +00:00
|
|
|
#define GST_VAAPI_DISPLAY(obj) \
|
2016-10-13 03:53:17 +00:00
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VAAPI_DISPLAY, GstVaapiDisplay))
|
|
|
|
#define GST_VAAPI_IS_DISPLAY(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VAAPI_DISPLAY))
|
2010-01-25 16:15:01 +00:00
|
|
|
|
2014-12-02 10:23:29 +00:00
|
|
|
/**
|
2014-12-10 17:02:55 +00:00
|
|
|
* GST_VAAPI_DISPLAY_GET_CLASS_TYPE:
|
2014-12-02 10:23:29 +00:00
|
|
|
* @display: a #GstVaapiDisplay
|
|
|
|
*
|
2014-12-10 17:02:55 +00:00
|
|
|
* Returns the #display class type
|
2014-12-02 10:23:29 +00:00
|
|
|
*/
|
2014-12-10 17:02:55 +00:00
|
|
|
#define GST_VAAPI_DISPLAY_GET_CLASS_TYPE(display) \
|
|
|
|
gst_vaapi_display_get_class_type (GST_VAAPI_DISPLAY (display))
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GST_VAAPI_DISPLAY_VADISPLAY_TYPE:
|
|
|
|
* @display: a #GstVaapiDisplay
|
|
|
|
*
|
|
|
|
* Returns the underlying VADisplay @display type.
|
|
|
|
*/
|
|
|
|
#define GST_VAAPI_DISPLAY_VADISPLAY_TYPE(display) \
|
2014-12-02 10:23:29 +00:00
|
|
|
gst_vaapi_display_get_display_type (GST_VAAPI_DISPLAY (display))
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GST_VAAPI_DISPLAY_VADISPLAY:
|
|
|
|
* @display_: a #GstVaapiDisplay
|
|
|
|
*
|
|
|
|
* Macro that evaluates to the #VADisplay of @display.
|
|
|
|
*/
|
|
|
|
#define GST_VAAPI_DISPLAY_VADISPLAY(display) \
|
|
|
|
gst_vaapi_display_get_display (GST_VAAPI_DISPLAY (display))
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GST_VAAPI_DISPLAY_LOCK:
|
|
|
|
* @display: a #GstVaapiDisplay
|
|
|
|
*
|
|
|
|
* Locks @display
|
|
|
|
*/
|
|
|
|
#define GST_VAAPI_DISPLAY_LOCK(display) \
|
|
|
|
gst_vaapi_display_lock (GST_VAAPI_DISPLAY (display))
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GST_VAAPI_DISPLAY_UNLOCK:
|
|
|
|
* @display: a #GstVaapiDisplay
|
|
|
|
*
|
|
|
|
* Unlocks @display
|
|
|
|
*/
|
|
|
|
#define GST_VAAPI_DISPLAY_UNLOCK(display) \
|
|
|
|
gst_vaapi_display_unlock (GST_VAAPI_DISPLAY (display))
|
|
|
|
|
2012-01-12 11:46:34 +00:00
|
|
|
typedef struct _GstVaapiDisplayInfo GstVaapiDisplayInfo;
|
2010-01-25 16:15:01 +00:00
|
|
|
typedef struct _GstVaapiDisplay GstVaapiDisplay;
|
|
|
|
|
2020-01-16 10:49:21 +00:00
|
|
|
/**
|
|
|
|
* GstVaapiDriverQuirks:
|
|
|
|
* @GST_VAAPI_DRIVER_QUIRK_NO_CHECK_SURFACE_PUT_IMAGE: if driver
|
|
|
|
* crashes when try to put an image in a reused surface.
|
|
|
|
* https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2016
|
2020-02-04 18:27:23 +00:00
|
|
|
* @GST_VAAPI_DRIVER_QUIRK_NO_CHECK_VPP_COLOR_STD: if driver does not
|
|
|
|
* properly report supported vpp color standards.
|
2020-02-16 11:21:28 +00:00
|
|
|
* @GST_VAAPI_DRIVER_QUIRK_MISSING_RGBA_IMAGE_FORMAT: i965 driver doesn't
|
|
|
|
* report to support ARGB format, but if it's forced to create a RGBA
|
|
|
|
* surface, it works. Driver issue:
|
|
|
|
* https://github.com/intel/intel-vaapi-driver/issues/500
|
2019-11-25 06:16:30 +00:00
|
|
|
* @GST_VAAPI_DRIVER_QUIRK_JPEG_ENC_SHIFT_VALUE_BY_50: if the driver shifts
|
|
|
|
* the value by 50 when calculating quantization from quality level
|
2020-04-30 06:19:29 +00:00
|
|
|
* @GST_VAAPI_DRIVER_QUIRK_HEVC_ENC_SLICE_NOT_SPAN_TILE: The requirement
|
|
|
|
* that one slice should not span tiles when tile is enabled.
|
2020-07-29 08:17:31 +00:00
|
|
|
* @GST_VAAPI_DRIVER_QUIRK_JPEG_DEC_BROKEN_FORMATS: i965 driver does not
|
|
|
|
* report all the handled formats for JPEG decoding.
|
2020-01-16 10:49:21 +00:00
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GST_VAAPI_DRIVER_QUIRK_NO_CHECK_SURFACE_PUT_IMAGE = (1U << 0),
|
2020-02-04 18:27:23 +00:00
|
|
|
GST_VAAPI_DRIVER_QUIRK_NO_CHECK_VPP_COLOR_STD = (1U << 1),
|
2020-02-16 11:21:28 +00:00
|
|
|
GST_VAAPI_DRIVER_QUIRK_MISSING_RGBA_IMAGE_FORMAT = (1U << 3),
|
2019-11-25 06:16:30 +00:00
|
|
|
GST_VAAPI_DRIVER_QUIRK_JPEG_ENC_SHIFT_VALUE_BY_50 = (1U << 4),
|
2020-04-30 06:19:29 +00:00
|
|
|
GST_VAAPI_DRIVER_QUIRK_HEVC_ENC_SLICE_NOT_SPAN_TILE = (1U << 5),
|
2020-07-29 08:17:31 +00:00
|
|
|
GST_VAAPI_DRIVER_QUIRK_JPEG_DEC_BROKEN_FORMATS = (1U << 6),
|
2020-01-16 10:49:21 +00:00
|
|
|
} GstVaapiDriverQuirks;
|
|
|
|
|
2012-07-25 07:16:02 +00:00
|
|
|
/**
|
|
|
|
* GstVaapiDisplayType:
|
|
|
|
* @GST_VAAPI_DISPLAY_TYPE_ANY: Automatic detection of the display type.
|
|
|
|
* @GST_VAAPI_DISPLAY_TYPE_X11: VA/X11 display.
|
|
|
|
* @GST_VAAPI_DISPLAY_TYPE_GLX: VA/GLX display.
|
2012-07-24 07:45:25 +00:00
|
|
|
* @GST_VAAPI_DISPLAY_TYPE_WAYLAND: VA/Wayland display.
|
2012-08-01 13:44:02 +00:00
|
|
|
* @GST_VAAPI_DISPLAY_TYPE_DRM: VA/DRM display.
|
2015-02-20 14:27:53 +00:00
|
|
|
* @GST_VAAPI_DISPLAY_TYPE_EGL: VA/EGL display.
|
2012-07-25 07:16:02 +00:00
|
|
|
*/
|
2013-12-20 12:27:07 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GST_VAAPI_DISPLAY_TYPE_ANY = 0,
|
|
|
|
GST_VAAPI_DISPLAY_TYPE_X11,
|
|
|
|
GST_VAAPI_DISPLAY_TYPE_GLX,
|
|
|
|
GST_VAAPI_DISPLAY_TYPE_WAYLAND,
|
|
|
|
GST_VAAPI_DISPLAY_TYPE_DRM,
|
2015-02-20 14:27:53 +00:00
|
|
|
GST_VAAPI_DISPLAY_TYPE_EGL,
|
2012-09-04 11:40:04 +00:00
|
|
|
} GstVaapiDisplayType;
|
2012-07-25 07:16:02 +00:00
|
|
|
|
|
|
|
#define GST_VAAPI_TYPE_DISPLAY_TYPE \
|
|
|
|
(gst_vaapi_display_type_get_type())
|
|
|
|
|
|
|
|
GType
|
2013-12-20 12:27:07 +00:00
|
|
|
gst_vaapi_display_type_get_type (void) G_GNUC_CONST;
|
2012-07-25 07:16:02 +00:00
|
|
|
|
2016-10-13 03:53:17 +00:00
|
|
|
GType
|
|
|
|
gst_vaapi_display_get_type (void) G_GNUC_CONST;
|
|
|
|
|
2013-12-13 11:00:35 +00:00
|
|
|
gboolean
|
2013-12-20 12:27:07 +00:00
|
|
|
gst_vaapi_display_type_is_compatible (GstVaapiDisplayType type1,
|
2013-12-13 11:00:35 +00:00
|
|
|
GstVaapiDisplayType type2);
|
|
|
|
|
2012-01-12 11:46:34 +00:00
|
|
|
/**
|
|
|
|
* GstVaapiDisplayInfo:
|
|
|
|
*
|
|
|
|
* Generic class to retrieve VA display info
|
|
|
|
*/
|
2013-12-20 12:27:07 +00:00
|
|
|
struct _GstVaapiDisplayInfo
|
|
|
|
{
|
|
|
|
GstVaapiDisplay *display;
|
|
|
|
gchar *display_name;
|
|
|
|
VADisplay va_display;
|
|
|
|
gpointer native_display;
|
2012-01-12 11:46:34 +00:00
|
|
|
};
|
|
|
|
|
2012-08-28 08:55:59 +00:00
|
|
|
/**
|
|
|
|
* GstVaapiDisplayProperties:
|
|
|
|
* @GST_VAAPI_DISPLAY_PROP_RENDER_MODE: rendering mode (#GstVaapiRenderMode).
|
|
|
|
* @GST_VAAPI_DISPLAY_PROP_ROTATION: rotation angle (#GstVaapiRotation).
|
2012-08-28 11:59:50 +00:00
|
|
|
* @GST_VAAPI_DISPLAY_PROP_HUE: hue (float: [-180 ; 180], default: 0).
|
|
|
|
* @GST_VAAPI_DISPLAY_PROP_SATURATION: saturation (float: [0 ; 2], default: 1).
|
|
|
|
* @GST_VAAPI_DISPLAY_PROP_BRIGHTNESS: brightness (float: [-1 ; 1], default: 0).
|
|
|
|
* @GST_VAAPI_DISPLAY_PROP_CONTRAST: contrast (float: [0 ; 2], default: 1).
|
2012-08-28 08:55:59 +00:00
|
|
|
*/
|
|
|
|
#define GST_VAAPI_DISPLAY_PROP_RENDER_MODE "render-mode"
|
|
|
|
#define GST_VAAPI_DISPLAY_PROP_ROTATION "rotation"
|
2012-08-28 11:59:50 +00:00
|
|
|
#define GST_VAAPI_DISPLAY_PROP_HUE "hue"
|
|
|
|
#define GST_VAAPI_DISPLAY_PROP_SATURATION "saturation"
|
|
|
|
#define GST_VAAPI_DISPLAY_PROP_BRIGHTNESS "brightness"
|
|
|
|
#define GST_VAAPI_DISPLAY_PROP_CONTRAST "contrast"
|
2012-08-28 08:55:59 +00:00
|
|
|
|
2013-05-07 09:39:34 +00:00
|
|
|
GstVaapiDisplay *
|
2013-12-20 12:27:07 +00:00
|
|
|
gst_vaapi_display_new_with_display (VADisplay va_display);
|
2010-01-25 16:15:01 +00:00
|
|
|
|
2013-05-07 09:39:34 +00:00
|
|
|
void
|
2013-12-20 12:27:07 +00:00
|
|
|
gst_vaapi_display_replace (GstVaapiDisplay ** old_display_ptr,
|
|
|
|
GstVaapiDisplay * new_display);
|
2010-03-10 12:25:19 +00:00
|
|
|
|
2010-03-17 07:59:31 +00:00
|
|
|
void
|
2013-12-20 12:27:07 +00:00
|
|
|
gst_vaapi_display_lock (GstVaapiDisplay * display);
|
2010-03-17 07:59:31 +00:00
|
|
|
|
|
|
|
void
|
2013-12-20 12:27:07 +00:00
|
|
|
gst_vaapi_display_unlock (GstVaapiDisplay * display);
|
2010-03-17 07:59:31 +00:00
|
|
|
|
2010-03-26 11:35:20 +00:00
|
|
|
void
|
2013-12-20 12:27:07 +00:00
|
|
|
gst_vaapi_display_sync (GstVaapiDisplay * display);
|
2010-03-26 11:35:20 +00:00
|
|
|
|
|
|
|
void
|
2013-12-20 12:27:07 +00:00
|
|
|
gst_vaapi_display_flush (GstVaapiDisplay * display);
|
2010-03-26 11:35:20 +00:00
|
|
|
|
2014-12-10 17:02:55 +00:00
|
|
|
GstVaapiDisplayType
|
|
|
|
gst_vaapi_display_get_class_type (GstVaapiDisplay * display);
|
|
|
|
|
2012-07-25 07:16:02 +00:00
|
|
|
GstVaapiDisplayType
|
2013-12-20 12:27:07 +00:00
|
|
|
gst_vaapi_display_get_display_type (GstVaapiDisplay * display);
|
2012-07-25 07:16:02 +00:00
|
|
|
|
2014-07-25 09:24:39 +00:00
|
|
|
const gchar *
|
|
|
|
gst_vaapi_display_get_display_name (GstVaapiDisplay * display);
|
|
|
|
|
2010-01-25 16:15:01 +00:00
|
|
|
VADisplay
|
2013-12-20 12:27:07 +00:00
|
|
|
gst_vaapi_display_get_display (GstVaapiDisplay * display);
|
2010-01-25 16:15:01 +00:00
|
|
|
|
2010-03-22 08:44:38 +00:00
|
|
|
guint
|
2013-12-20 12:27:07 +00:00
|
|
|
gst_vaapi_display_get_width (GstVaapiDisplay * display);
|
2010-03-22 08:44:38 +00:00
|
|
|
|
|
|
|
guint
|
2013-12-20 12:27:07 +00:00
|
|
|
gst_vaapi_display_get_height (GstVaapiDisplay * display);
|
2010-03-22 08:44:38 +00:00
|
|
|
|
|
|
|
void
|
2013-12-20 12:27:07 +00:00
|
|
|
gst_vaapi_display_get_size (GstVaapiDisplay * display, guint * pwidth,
|
|
|
|
guint * pheight);
|
2010-03-22 08:44:38 +00:00
|
|
|
|
2010-03-22 09:32:01 +00:00
|
|
|
void
|
2013-12-20 12:27:07 +00:00
|
|
|
gst_vaapi_display_get_pixel_aspect_ratio (GstVaapiDisplay * display,
|
|
|
|
guint * par_n, guint * par_d);
|
2010-03-22 09:32:01 +00:00
|
|
|
|
2013-12-20 13:01:45 +00:00
|
|
|
gboolean
|
|
|
|
gst_vaapi_display_has_video_processing (GstVaapiDisplay * display);
|
|
|
|
|
2013-12-20 14:31:14 +00:00
|
|
|
GArray *
|
|
|
|
gst_vaapi_display_get_decode_profiles (GstVaapiDisplay * display);
|
2010-04-20 13:36:04 +00:00
|
|
|
|
|
|
|
gboolean
|
2013-12-20 12:27:07 +00:00
|
|
|
gst_vaapi_display_has_decoder (GstVaapiDisplay * display,
|
|
|
|
GstVaapiProfile profile, GstVaapiEntrypoint entrypoint);
|
2010-04-20 13:36:04 +00:00
|
|
|
|
2013-12-20 14:31:14 +00:00
|
|
|
GArray *
|
|
|
|
gst_vaapi_display_get_encode_profiles (GstVaapiDisplay * display);
|
2010-04-20 13:36:04 +00:00
|
|
|
|
2020-07-29 14:32:55 +00:00
|
|
|
GArray *
|
|
|
|
gst_vaapi_display_get_encode_profiles_by_codec (GstVaapiDisplay * display,
|
|
|
|
GstVaapiCodec codec);
|
|
|
|
|
2010-03-04 17:41:34 +00:00
|
|
|
gboolean
|
2013-12-20 12:27:07 +00:00
|
|
|
gst_vaapi_display_has_encoder (GstVaapiDisplay * display,
|
|
|
|
GstVaapiProfile profile, GstVaapiEntrypoint entrypoint);
|
2010-03-04 17:41:34 +00:00
|
|
|
|
2013-12-20 14:15:05 +00:00
|
|
|
GArray *
|
|
|
|
gst_vaapi_display_get_image_formats (GstVaapiDisplay * display);
|
2010-03-10 10:43:31 +00:00
|
|
|
|
2010-03-04 17:41:34 +00:00
|
|
|
gboolean
|
2013-12-20 12:27:07 +00:00
|
|
|
gst_vaapi_display_has_image_format (GstVaapiDisplay * display,
|
|
|
|
GstVideoFormat format);
|
2010-03-04 17:41:34 +00:00
|
|
|
|
2013-12-20 14:15:05 +00:00
|
|
|
GArray *
|
|
|
|
gst_vaapi_display_get_subpicture_formats (GstVaapiDisplay * display);
|
2010-03-10 10:43:31 +00:00
|
|
|
|
2010-03-04 17:41:34 +00:00
|
|
|
gboolean
|
2013-12-20 12:27:07 +00:00
|
|
|
gst_vaapi_display_has_subpicture_format (GstVaapiDisplay * display,
|
|
|
|
GstVideoFormat format, guint * flags_ptr);
|
2010-03-04 17:41:34 +00:00
|
|
|
|
2012-08-27 14:02:49 +00:00
|
|
|
gboolean
|
2013-12-20 12:27:07 +00:00
|
|
|
gst_vaapi_display_has_property (GstVaapiDisplay * display, const gchar * name);
|
2012-08-27 14:02:49 +00:00
|
|
|
|
2012-08-27 15:11:37 +00:00
|
|
|
gboolean
|
2013-12-20 12:27:07 +00:00
|
|
|
gst_vaapi_display_get_render_mode (GstVaapiDisplay * display,
|
|
|
|
GstVaapiRenderMode * pmode);
|
2012-08-27 15:11:37 +00:00
|
|
|
|
|
|
|
gboolean
|
2013-12-20 12:27:07 +00:00
|
|
|
gst_vaapi_display_set_render_mode (GstVaapiDisplay * display,
|
|
|
|
GstVaapiRenderMode mode);
|
2012-08-27 15:11:37 +00:00
|
|
|
|
2012-08-22 06:18:11 +00:00
|
|
|
GstVaapiRotation
|
2013-12-20 12:27:07 +00:00
|
|
|
gst_vaapi_display_get_rotation (GstVaapiDisplay * display);
|
2012-08-22 06:18:11 +00:00
|
|
|
|
|
|
|
gboolean
|
2013-12-20 12:27:07 +00:00
|
|
|
gst_vaapi_display_set_rotation (GstVaapiDisplay * display,
|
|
|
|
GstVaapiRotation rotation);
|
2012-08-22 06:18:11 +00:00
|
|
|
|
2014-05-20 09:36:40 +00:00
|
|
|
const gchar *
|
|
|
|
gst_vaapi_display_get_vendor_string (GstVaapiDisplay * display);
|
|
|
|
|
2014-12-03 10:39:24 +00:00
|
|
|
gboolean
|
|
|
|
gst_vaapi_display_has_opengl (GstVaapiDisplay * display);
|
|
|
|
|
2016-09-22 07:34:38 +00:00
|
|
|
void
|
|
|
|
gst_vaapi_display_reset_texture_map (GstVaapiDisplay * display);
|
|
|
|
|
2020-01-16 10:49:21 +00:00
|
|
|
gboolean
|
|
|
|
gst_vaapi_display_has_driver_quirks (GstVaapiDisplay * display, guint quirks);
|
|
|
|
|
2018-06-13 15:54:23 +00:00
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVaapiDisplay, gst_object_unref)
|
2016-10-13 03:53:17 +00:00
|
|
|
|
2010-01-25 16:15:01 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* GST_VAAPI_DISPLAY_H */
|