Package version up to 2.7.1
[platform/core/uifw/libtdm.git] / include / tdm_types.h
index c64a351..d9ab984 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
@@ -38,6 +38,8 @@
 
 #include <tbm_surface.h>
 
+#include "tdm_common.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -57,8 +59,6 @@ extern "C" {
  * @endcode
  */
 
-#include <tdm_common.h>
-
 typedef enum {
        TDM_EVENT_LOOP_READABLE = (1 << 0),
        TDM_EVENT_LOOP_WRITABLE = (1 << 1),
@@ -67,6 +67,14 @@ typedef enum {
 } tdm_event_loop_mask;
 
 /**
+ * @brief The display capability enumeration
+ */
+typedef enum {
+       TDM_DISPLAY_CAPABILITY_PP       = (1 << 0), /**< if hardware supports pp operation */
+       TDM_DISPLAY_CAPABILITY_CAPTURE  = (1 << 1), /**< if hardware supports capture operation */
+} tdm_display_capability;
+
+/**
  * @brief The output mode structure
  */
 typedef struct _tdm_output_mode {
@@ -107,6 +115,15 @@ typedef struct _tdm_info_layer {
 } tdm_info_layer;
 
 /**
+ * @brief The region structure
+ * @since 2.0.0
+ */
+typedef struct _tdm_region {
+       unsigned int num_rects;
+       tdm_pos const *rects;
+} tdm_region;
+
+/**
  * @brief The hwc window info structure
  * @since 2.0.0
  */
@@ -144,105 +161,100 @@ typedef struct _tdm_info_capture {
  */
 typedef enum {
 
-       /** Set by the client for an invisible window. The value by default.
+       /** The composition type for an invisible window. The value by default.
         *
-        * The device ignores windows of this type.
+        * The backend ignores windows of this type.
         */
-       TDM_COMPOSITION_NONE = 0,
+       TDM_HWC_WIN_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 compostion type for an window to be compsoited by the client.
         *
-        * User has to set this type for the window which has the TDM_COMPOSITION_CLIENT_CANDIDATE
-        * type. (see the TDM_COMPOSITION_CLIENT_CANDIDATE type)
+        * When the client sets this composition type,
+        * the backend MUST NOT modify this composition type into other types.
         *
-        * The device must not request any composition type changes for windows of
-        * this type.
+        * When the backend changes TDM_HWC_WIN_COMPOSITION_DEVICE or TDM_HWC_WIN_COMPOSITION_CURSOR
+        * to this composition type at the time of tdm_hwc_validate and
+        * tdm_hwc_get_changed_composition_types,
+        * the client has to composite this window with gl or other drawing operations.
         */
-       TDM_COMPOSITION_CLIENT = 1,
+       TDM_HWC_WIN_COMPOSITION_CLIENT = 1,
 
-       /* Set by the HWC after tdm_output_hwc_validate().
-        *
-        * If the HWC decided that it doesn't want/can't to continue the composition for
-        * the window through a hardware overlay or other similar way it'll change
-        * a type to the TDM_COMPOSITION_CLIENT_CANDIDATE type.
-        *
-        * This transition can happen only if the window has the TDM_COMPOSITION_DEVICE
-        * type already.
-        *
-        * If an user changed type of a window from the TDM_COMPOSITION_DEVICE
-        * type to the the TDM_COMPOSITION_CLIENT type, the type
-        * will be rejected to the TDM_COMPOSITION_CLIENT_CANDIDATE type.
+       /** The compostion type for an window to be set to the hw overlay.
         *
-        * The user has to composite this window itself.
-        *
-        * The underlying hardware overlay is owned by this window till a type being
-        * changed to the TDM_COMPOSITION_CLIENT type, but it's not possible to set a
-        * buffer for this window after a type's been changed to the
-        * TDM_COMPOSITION_CLIENT_CANDIDATE type.
-        *
-        * This transitional state is used to get rid of blinking at a transition from
-        * the TDM_COMPOSITION_DEVICE type to the
-        * TDM_COMPOSITION_CLIENT type where the hw     has to wait till a buffer, which was
-        * on a hw overlay, get composited to the fb_target and only after this happens
-        * unset(or set another window on) this hw overlay.
-        *
-        * User has to inform the HWC (the HWC got no way to know when it happens) after a buffer,
-        * which was on a hw overlay, get composited to the fb_target by setting a type of this
-        * window to the TDM_COMPOSITION_CLIENT type, it causes a type of this window being changed
-        * to TDM_COMPOSITION_CLIENT.
+        * The client sets this composition type to the visible windows before requesting
+        * the tdm_hwc_validate.
+        * Nomally, the backend leave it if the backend sets the window to the hw overlay.
+        * If the backend does not set the window to the hw overlay at the time of
+        * tdm_hwc_validate, the backend changes the composition type of the window into
+        * TDM_HWC_WIN_COMPOSITION_CLIENT.
         */
-       TDM_COMPOSITION_CLIENT_CANDIDATE = 2,
-
+       TDM_HWC_WIN_COMPOSITION_DEVICE = 3,
 
-       /** Set by the client before tdm_output_hwc_validate().
+       /** The compostion type for an window to be set to the cursor hw overlay.
         *
-        * 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 = 3,
+        * The client sets this composition type to the cursor window before requesting
+        * the tdm_hwc_validate.
+        * If the backend does not support the cursor hw overlay, the backend can change
+        * the comopsition type into the TDM_HWC_WIN_COMPOSITION_CLIENT.
+        */
+       TDM_HWC_WIN_COMPOSITION_CURSOR = 4,
 
-       /** 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 = 4,
-
-       /** 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().
+       /** The compostion type for an window to be set to the video hw overlay.
         *
-        * 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 = 5,
-
+        * The client sets this composition type to the video window before requesting
+        * the tdm_hwc_validate.
+        * If the backend does not support the video hw overlay, the backend can change
+        * the comopsition type into the TDM_HWC_WIN_COMPOSITION_CLIENT.
+        * Normally, this VIDEO window displays under the primary hw overlayer of the output.
+        */
+       TDM_HWC_WIN_COMPOSITION_VIDEO = 5,
 } tdm_hwc_window_composition;
 
+typedef enum {
+       TDM_HWC_WIN_CONSTRAINT_NONE = 0,
+       /** If the client needs to render to a specific buffer for compositing
+        *  with TDM_HWC_WIN_COMPOSITION_DEVICE, the backend needs to set
+        *  TDM_HWC_WIN_CONSTRAINT_BUFFER_QUEUE to hwc_window until the hwc_window is not
+        *  TDM_HWC_WIN_COMPOSITION_DEVICE. The client gets the tbm_surface_queue_h through
+        *  the tdm_hwc_window_aquire_buffer_queue. It will render the frames on
+        *  the buffers which gets from the tbm_surface_queue_h.
+        */
+       TDM_HWC_WIN_CONSTRAINT_BUFFER_QUEUE = (1 << 0),
+} tdm_hwc_window_constraint;
+
 /**
  * @brief The tdm display object
  */
 typedef void tdm_display;
 
 /**
+ * @brief The tdm backend object
+ */
+typedef void tdm_module;
+
+/**
  * @brief The tdm output object
  */
 typedef void tdm_output;
 
 /**
+ * @brief The tdm voutput object
+ */
+typedef void tdm_voutput;
+
+/**
  * @brief The tdm layer object
  */
 typedef void tdm_layer;
 
 /**
- * @brief The tdm window object
+ * @brief The tdm hwc object
+ * @since 2.0.0
+ */
+typedef void tdm_hwc;
+
+/**
+ * @brief The tdm hwc window object
  * @since 2.0.0
  */
 typedef void tdm_hwc_window;
@@ -263,6 +275,30 @@ typedef void tdm_pp;
 typedef void tdm_vblank;
 
 /**
+ * @brief The output create handler
+ * @details This handler will be called when the output object is
+ * createed in runtime.
+ */
+typedef void (*tdm_output_create_handler)(tdm_display *dpy, tdm_output *output, void *user_data);
+
+/**
+ * @brief The output destroy handler
+ * @details This handler will be called when the output object is
+ * destroied in runtime.
+ */
+typedef void (*tdm_output_destroy_handler)(tdm_output *output, void *user_data);
+
+/**
+ * @brief The output change handler
+ * @details This handler will be called when the status of a output object is
+ * changed in runtime.
+ */
+typedef void (*tdm_output_change_handler)(tdm_output *output,
+                                                                                 tdm_output_change_type type,
+                                                                                 tdm_value value,
+                                                                                 void *user_data);
+
+/**
  * @brief The vblank handler
  * @see output_set_vblank_handler() function of #tdm_func_display
  */
@@ -279,6 +315,12 @@ typedef void (*tdm_output_commit_handler)(tdm_output *output, unsigned int seque
                                                                                  void *user_data);
 
 /**
+ * @brief The output mode change request handler
+ */
+typedef void (*tdm_output_mode_change_request_handler)(tdm_output *output,
+                                                                                                          unsigned int index, void *user_data);
+
+/**
  * @brief The layer commit handler
  */
 typedef void (*tdm_layer_commit_handler)(tdm_layer *layer, unsigned int sequence,
@@ -298,11 +340,23 @@ typedef void (*tdm_capture_done_handler)(tdm_capture *capture,
                                                                                 tbm_surface_h buffer, void *user_data);
 
 /**
- * @brief The 'need to validate' handler of an output object
- * @since 2.0.0
+ * @brief The create handler of a vblank object
+ */
+typedef void (*tdm_vblank_create_handler)(tdm_vblank *vblank, void *user_data);
+
+/**
+ * @brief The hwc commit handler
+ * @see hwc_set_commit_handler() function of #tdm_func_hwc
  */
-typedef void (*tdm_output_need_validate_handler)(tdm_output *output);
+typedef void (*tdm_hwc_commit_handler)(tdm_hwc *hwc, unsigned int sequence,
+                                                                         unsigned int tv_sec, unsigned int tv_usec,
+                                                                         void *user_data);
+
+typedef void (*tdm_voutput_commit_handler)(tdm_voutput *voutput, unsigned int sequence,
+                                                                                  unsigned int tv_sec, unsigned int tv_usec,
+                                                                                  void *user_data);
 
+typedef void (*tdm_voutput_commit_func)(tdm_voutput *voutput, tbm_surface_h buffer);
 #ifdef __cplusplus
 }
 #endif