virtual:add virtual backend
[platform/core/uifw/libtdm.git] / include / tdm_common.h
index 79cdf69..328f837 100644 (file)
@@ -9,7 +9,7 @@
  *          Taeheon Kim <th908.kim@samsung.com>,
  *          YoungJun Cho <yj44.cho@samsung.com>,
  *          SooChan Lim <sc1.lim@samsung.com>,
- *          Boram Park <sc1.lim@samsung.com>
+ *          Boram Park <boram1288.park@samsung.com>
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
@@ -43,6 +43,8 @@ extern "C" {
 #endif
 
 #define TDM_NAME_LEN        64
+#define TDM_PATH_LEN        1024
+#define TDM_VBLANK_DEFAULT_NAME   "Unknown"
 
 /**
  * @file tdm_common.h
@@ -65,9 +67,110 @@ typedef enum {
        TDM_ERROR_NOT_IMPLEMENTED       = -8, /**< not implemented */
        TDM_ERROR_NO_CAPABILITY         = -9, /**< no capability */
        TDM_ERROR_DPMS_OFF              = -10, /**< dpms off */
+       TDM_ERROR_OUTPUT_DISCONNECTED   = -11, /**< output disconnected */
+       TDM_ERROR_PROTOCOL_ERROR        = -12, /**< protocol error */
+       TDM_ERROR_TIMEOUT               = -13, /**< timeout */
 } tdm_error;
 
 /**
+ * @brief The transform enumeration(rotate, flip)
+ */
+typedef enum {
+       TDM_TRANSFORM_NORMAL            = 0, /**< no transform */
+       TDM_TRANSFORM_90                = 1, /**< rotate 90 */
+       TDM_TRANSFORM_180               = 2, /**< rotate 180 */
+       TDM_TRANSFORM_270               = 3, /**< rotate 270 */
+       TDM_TRANSFORM_FLIPPED           = 4, /**< no rotate and horizontal flip */
+       TDM_TRANSFORM_FLIPPED_90        = 5, /**< rotate 90 and horizontal flip */
+       TDM_TRANSFORM_FLIPPED_180       = 6, /**< rotate 180 and horizontal flip */
+       TDM_TRANSFORM_FLIPPED_270       = 7, /**< rotate 270 and horizontal flip */
+} tdm_transform;
+
+/**
+ * @brief The output capability enumeration
+ * @details
+ * If a backend module provides #TDM_OUTPUT_CAPABILITY_EXTENDED_DPMS, we can set
+ * an extended DPMS mode to an output which a backend module supports.
+ * Don't use the low-4bit for an extended DPMS mode value. It's used for default
+ * DPMS modes.
+ */
+typedef enum {
+       TDM_OUTPUT_CAPABILITY_ASYNC_DPMS         = (1 << 0), /**< if a outupt supports asynchronous DPMS operation */
+       TDM_OUTPUT_CAPABILITY_HWC                = (1 << 1), /**< if a outupt supports hwc operation @since 2.0.0*/
+       TDM_OUTPUT_CAPABILITY_EXTENDED_DPMS      = (1 << 2), /**< if a outupt supports extended DPMS operation @since 2.0.0 */
+} tdm_output_capability;
+
+/**
+ * @brief The layer capability enumeration
+ * @details
+ * A layer can have one of CURSOR, PRIMARY and OVERLAY capability. And a layer
+ * also can have one of GRAPHIC and VIDEO capability. And a layer also can have
+ * SCALE and TRANSFORM capability.\n
+ * @par Example
+ * @code
+ *  //For example
+ *  capabilities = TDM_LAYER_CAPABILITY_PRIMARY | TDM_LAYER_CAPABILITY_GRAPHIC;
+ *  capabilities = TDM_LAYER_CAPABILITY_OVERLAY | TDM_LAYER_CAPABILITY_GRAPHIC | TDM_LAYER_CAPABILITY_SCALE;
+ *  capabilities = TDM_LAYER_CAPABILITY_OVERLAY | TDM_LAYER_CAPABILITY_GRAPHIC | TDM_LAYER_CAPABILITY_SCALE | TDM_LAYER_CAPABILITY_TRANSFORM;
+ *  capabilities = TDM_LAYER_CAPABILITY_CURSOR | TDM_LAYER_CAPABILITY_GRAPHIC;
+ *  capabilities = TDM_LAYER_CAPABILITY_OVERLAY | TDM_LAYER_CAPABILITY_VIDEO;
+ * @endcode
+ * @remark
+ * - When a video plays, in most of cases, video buffers will be displayed to
+ * a GRAPHIC layer after converting RGB buffers via PP. In this case, a backend
+ * module doesn't need to offer VIDEO layer.
+ * - But in case that s vendor wants to handle a video by their own way,
+ * a backend module offer VIDEO layers. And a display server will pass a video
+ * buffer to a VIDEO layer without converting.
+ */
+typedef enum {
+       TDM_LAYER_CAPABILITY_CURSOR         = (1 << 0), /**< cursor */
+       TDM_LAYER_CAPABILITY_PRIMARY        = (1 << 1), /**< primary */
+       TDM_LAYER_CAPABILITY_OVERLAY        = (1 << 2), /**< overlay */
+       TDM_LAYER_CAPABILITY_GRAPHIC        = (1 << 4), /**< graphic */
+       TDM_LAYER_CAPABILITY_VIDEO          = (1 << 5), /**< video */
+       TDM_LAYER_CAPABILITY_SCALE          = (1 << 8), /**< if a layer has scale capability  */
+       TDM_LAYER_CAPABILITY_TRANSFORM      = (1 << 9), /**< if a layer has transform capability  */
+       TDM_LAYER_CAPABILITY_SCANOUT        = (1 << 10), /**< if a layer allows a scanout buffer only */
+       TDM_LAYER_CAPABILITY_RESEVED_MEMORY = (1 << 11), /**< if a layer allows a reserved buffer only */
+       TDM_LAYER_CAPABILITY_NO_CROP        = (1 << 12), /**< if a layer has no cropping capability */
+} tdm_layer_capability;
+
+/**
+ * @brief The pp capability enumeration
+ * @details The scale, transform and CSC functionalities seem the default functions of PP.
+ * If hardware device doesn't support one of them, we'd better let a developer know
+ * what a backend doesn't support like TDM_PP_CAPABILITY_NO_CSC.
+ */
+typedef enum {
+       TDM_PP_CAPABILITY_SYNC           = (1 << 0), /**< The pp device supports synchronous operation */
+       TDM_PP_CAPABILITY_ASYNC          = (1 << 1), /**< The pp device supports asynchronous operation */
+       TDM_PP_CAPABILITY_SCANOUT        = (1 << 4), /**< The pp device supports only scanout buffer */
+       TDM_PP_CAPABILITY_NO_CSC         = (1 << 5), /**< The pp device doesn't supports Color Space Conversion */
+} tdm_pp_capability;
+
+/**
+ * @brief The capture capability enumeration
+ * @details The scale, transform and CSC functionalities seem the default functions of capture.
+ * If hardware device doesn't support one of them, we'd better let a developer know
+ * what a backend doesn't support like TDM_PP_CAPABILITY_NO_CSC.
+ */
+typedef enum {
+       TDM_CAPTURE_CAPABILITY_OUTPUT    = (1 << 0), /**< The capture device supports to dump a output */
+       TDM_CAPTURE_CAPABILITY_LAYER     = (1 << 1), /**< The capture device supports to dump a layer */
+       TDM_CAPTURE_CAPABILITY_ONESHOT   = (1 << 4), /**< The capture device supports oneshot dump */
+       TDM_CAPTURE_CAPABILITY_STREAM    = (1 << 5), /**< The capture device supports streamp sump */
+} tdm_capture_capability;
+
+/**
+ * @brief The capture type enumeration
+ */
+typedef enum {
+       TDM_CAPTURE_TYPE_ONESHOT    = (1 << 0), /**< The oneshot capture */
+       TDM_CAPTURE_TYPE_STREAM     = (1 << 1), /**< The stream capture */
+} tdm_capture_type;
+
+/**
  * @brief The output change enumeration of #tdm_output_change_handler
  */
 typedef enum {
@@ -85,17 +188,77 @@ typedef enum {
 } tdm_output_conn_status;
 
 /**
+ * @brief The output connection status enumeration
+ * @details bit compatible with the libdrm definitions.
+ */
+typedef enum {
+       TDM_OUTPUT_TYPE_Unknown,        /**< unknown */
+       TDM_OUTPUT_TYPE_VGA,            /**< VGA connection */
+       TDM_OUTPUT_TYPE_DVII,           /**< DVII connection */
+       TDM_OUTPUT_TYPE_DVID,           /**< DVID connection */
+       TDM_OUTPUT_TYPE_DVIA,           /**< DVIA connection */
+       TDM_OUTPUT_TYPE_Composite,      /**< Composite connection */
+       TDM_OUTPUT_TYPE_SVIDEO,         /**< SVIDEO connection */
+       TDM_OUTPUT_TYPE_LVDS,           /**< LVDS connection */
+       TDM_OUTPUT_TYPE_Component,      /**< Component connection */
+       TDM_OUTPUT_TYPE_9PinDIN,        /**< 9PinDIN connection */
+       TDM_OUTPUT_TYPE_DisplayPort,    /**< DisplayPort connection */
+       TDM_OUTPUT_TYPE_HDMIA,          /**< HDMIA connection */
+       TDM_OUTPUT_TYPE_HDMIB,          /**< HDMIB connection */
+       TDM_OUTPUT_TYPE_TV,             /**< TV connection */
+       TDM_OUTPUT_TYPE_eDP,            /**< eDP connection */
+       TDM_OUTPUT_TYPE_VIRTUAL,        /**< Virtual connection for WiFi Display */
+       TDM_OUTPUT_TYPE_DSI,            /**< DSI connection */
+} tdm_output_type;
+
+/**
  * @brief The DPMS enumeration
  * @details bit compatible with the libdrm definitions.
  */
 typedef enum {
-       TDM_OUTPUT_DPMS_ON,         /**< On */
-       TDM_OUTPUT_DPMS_STANDBY,    /**< StandBy */
-       TDM_OUTPUT_DPMS_SUSPEND,    /**< Suspend */
-       TDM_OUTPUT_DPMS_OFF,        /**< Off */
+       TDM_OUTPUT_DPMS_ON,         /**< On, Vsync On */
+       TDM_OUTPUT_DPMS_STANDBY,    /**< StandBy, Vsync On */
+       TDM_OUTPUT_DPMS_SUSPEND,    /**< Suspend, Vsync Off */
+       TDM_OUTPUT_DPMS_OFF,        /**< Off, Vsync Off */
+       TDM_OUTPUT_DPMS_AOD = 0x10, /**< AOD, Vsync On, extended DPMS mode */
 } tdm_output_dpms;
 
 /**
+ * @brief The output mode type enumeration
+ * @details bit compatible with the libdrm definitions.
+ */
+typedef enum {
+       TDM_OUTPUT_MODE_TYPE_BUILTIN    = (1 << 0),
+       TDM_OUTPUT_MODE_TYPE_CLOCK_C    = ((1 << 1) | TDM_OUTPUT_MODE_TYPE_BUILTIN),
+       TDM_OUTPUT_MODE_TYPE_CRTC_C     = ((1 << 2) | TDM_OUTPUT_MODE_TYPE_BUILTIN),
+       TDM_OUTPUT_MODE_TYPE_PREFERRED  = (1 << 3),
+       TDM_OUTPUT_MODE_TYPE_DEFAULT    = (1 << 4),
+       TDM_OUTPUT_MODE_TYPE_USERDEF    = (1 << 5),
+       TDM_OUTPUT_MODE_TYPE_DRIVER     = (1 << 6),
+} tdm_output_mode_type;
+
+/**
+ * @brief The output mode flag enumeration
+ * @details bit compatible with the libdrm definitions.
+ */
+typedef enum {
+       TDM_OUTPUT_MODE_FLAG_PHSYNC     = (1 << 0),
+       TDM_OUTPUT_MODE_FLAG_NHSYNC     = (1 << 1),
+       TDM_OUTPUT_MODE_FLAG_PVSYNC     = (1 << 2),
+       TDM_OUTPUT_MODE_FLAG_NVSYNC     = (1 << 3),
+       TDM_OUTPUT_MODE_FLAG_INTERLACE  = (1 << 4),
+       TDM_OUTPUT_MODE_FLAG_DBLSCAN    = (1 << 5),
+       TDM_OUTPUT_MODE_FLAG_CSYNC      = (1 << 6),
+       TDM_OUTPUT_MODE_FLAG_PCSYNC     = (1 << 7),
+       TDM_OUTPUT_MODE_FLAG_NCSYNC     = (1 << 8),
+       TDM_OUTPUT_MODE_FLAG_HSKEW      = (1 << 9), /* hskew provided */
+       TDM_OUTPUT_MODE_FLAG_BCAST      = (1 << 10),
+       TDM_OUTPUT_MODE_FLAG_PIXMUX     = (1 << 11),
+       TDM_OUTPUT_MODE_FLAG_DBLCLK     = (1 << 12),
+       TDM_OUTPUT_MODE_FLAG_CLKDIV2    = (1 << 13),
+} tdm_output_mode_flag;
+
+/**
  * @brief The size structure
  */
 typedef struct _tdm_size {
@@ -114,6 +277,18 @@ typedef struct _tdm_pos {
 } tdm_pos;
 
 /**
+ * @brief The tdm value type enumeration
+ */
+typedef enum {
+       TDM_VALUE_TYPE_UNKNOWN,
+       TDM_VALUE_TYPE_PTR,
+       TDM_VALUE_TYPE_INT32,
+       TDM_VALUE_TYPE_UINT32,
+       TDM_VALUE_TYPE_INT64,
+       TDM_VALUE_TYPE_UINT64,
+} tdm_value_type;
+
+/**
  * @brief The value union
  */
 typedef union {