#include <tdm_common.h>
-/**
- * @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 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 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
- */
-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_SCALE = (1 << 4), /**< The pp device supports scale operation */
- TDM_PP_CAPABILITY_TRANSFORM = (1 << 5), /**< The pp device supports transform operation */
-} tdm_pp_capability;
-
-/**
- * @brief The capture capability enumeration
- */
-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_SCALE = (1 << 4), /**< The capture device supports scale operation */
- TDM_CAPTURE_CAPABILITY_TRANSFORM = (1 << 5), /**< The capture device supports transform operation */
-} tdm_capture_capability;
-
-/**
- * @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;
-
typedef enum {
TDM_EVENT_LOOP_READABLE = (1 << 0),
TDM_EVENT_LOOP_WRITABLE = (1 << 1),
typedef struct _tdm_prop {
unsigned int id;
char name[TDM_NAME_LEN];
+ tdm_value_type type;
} tdm_prop;
/**
} tdm_info_layer;
/**
+ * @brief The hwc window info structure
+ * @since 2.0.0
+ */
+typedef struct _tdm_hwc_window_info {
+ tdm_info_config src_config;
+ tdm_pos dst_pos;
+ tdm_transform transform;
+} tdm_hwc_window_info;
+
+/**
* @brief The pp info structre
*/
typedef struct _tdm_info_pp {
typedef struct _tdm_info_capture {
tdm_info_config dst_config;
tdm_transform transform;
- int oneshot;
+ tdm_capture_type type;
int frequency;
int flags;
} tdm_info_capture;
/**
+ * @brief Possible composition types for a given window
+ * @since 2.0.0
+ */
+typedef enum {
+
+ /** Set by the client for an invisible window. The value by default.
+ *
+ * The device ignores windows of this type.
+ */
+ TDM_COMPOSITION_NONE = 0,
+
+ /** The client will composite this window into the client target window
+ *
+ * User can choose this type for window to avoid a hardware composition for
+ * this window.
+ *
+ * The device must not request any composition type changes for windows of
+ * this type.
+ */
+ TDM_COMPOSITION_CLIENT = 1,
+
+ /** Set by the client before tdm_output_hwc_validate().
+ *
+ * Upon tdm_output_hwc_validate(), the device may request a change from this type to
+ * TDM_COMPOSITION_DEVICE or TDM_COMPOSITION_CLIENT. */
+ TDM_COMPOSITION_DEVICE_CANDIDATE = 2,
+
+ /** Set by the HWC after tdm_output_hwc_validate().
+ *
+ * The device will handle the composition of this window through a hardware
+ * overlay or other similar means.
+ *
+ * Upon tdm_output_hwc_validate(), the device may request a change from this type to
+ * TDM_COMPOSITION_CLIENT or TDM_COMPOSITION_DEVICE_CANDIDATE. */
+ TDM_COMPOSITION_DEVICE = 3,
+
+ /** Similar to DEVICE, but the position of this layer may also be set
+ * asynchronously through layer_set_cursor_position. If this functionality is not
+ * supported on a layer that the client sets to TDM_COMPOSITION_CURSOR, the
+ * device must request that the composition type of that layer is changed to
+ * TDM_COMPOSITION_CLIENT upon the next call to tdm_output_hwc_validate().
+ *
+ * Upon tdm_output_hwc_validate(), the device may request a change from this type to
+ * either TDM_COMPOSITION_DEVICE or TDM_COMPOSITION_CLIENT. Changing to
+ * TDM_COMPOSITION_DEVICE will prevent the use of layer_set_cursor_position but
+ * still permit the device to composite the layer. */
+ TDM_COMPOSITION_CURSOR = 4,
+
+} tdm_hwc_window_composition;
+
+/**
* @brief The tdm display object
*/
typedef void tdm_display;
typedef void tdm_layer;
/**
+ * @brief The tdm window object
+ * @since 2.0.0
+ */
+typedef void tdm_hwc_window;
+
+/**
* @brief The tdm capture object
*/
typedef void tdm_capture;
typedef void tdm_pp;
/**
+ * @brief The tdm vblank object
+ */
+typedef void tdm_vblank;
+
+/**
* @brief The vblank handler
* @see output_set_vblank_handler() function of #tdm_func_display
*/
void *user_data);
/**
- * @brief The commit handler
+ * @brief The output commit handler
* @see output_set_commit_handler() function of #tdm_func_display
*/
typedef void (*tdm_output_commit_handler)(tdm_output *output, unsigned int sequence,
void *user_data);
/**
- * @brief The tdm event source
+ * @brief The layer commit handler
+ */
+typedef void (*tdm_layer_commit_handler)(tdm_layer *layer, unsigned int sequence,
+ unsigned int tv_sec, unsigned int tv_usec,
+ void *user_data);
+
+/**
+ * @brief The done handler of a pp object
+ */
+typedef void (*tdm_pp_done_handler)(tdm_pp *pp, tbm_surface_h src,
+ tbm_surface_h dst, void *user_data);
+
+/**
+ * @brief The done handler of a capture object
*/
-typedef void tdm_event_loop_source;
+typedef void (*tdm_capture_done_handler)(tdm_capture *capture,
+ tbm_surface_h buffer, void *user_data);
/**
- * @brief The fd source handler
+ * @brief The create handler of a vblank object
*/
-typedef tdm_error (*tdm_event_loop_fd_handler)(int fd, tdm_event_loop_mask mask, void *user_data);
+typedef void (*tdm_vblank_create_handler)(tdm_vblank *vblank, void *user_data);
/**
- * @brief The timer source handler
+ * @brief The 'need to validate' handler of an output object
+ * @since 2.0.0
*/
-typedef tdm_error (*tdm_event_loop_timer_handler)(void *user_data);
+typedef void (*tdm_output_need_validate_handler)(tdm_output *output);
#ifdef __cplusplus
}