add tdm_common.h to share enumeration and structure with client
[platform/core/uifw/libtdm.git] / include / tdm.h
index 04cbcb5..47afc19 100644 (file)
@@ -1,36 +1,36 @@
 /**************************************************************************
-
-libtdm
-
-Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
-
-Contact: Eunchul Kim <chulspro.kim@samsung.com>,
-         JinYoung Jeon <jy0.jeon@samsung.com>,
-         Taeheon Kim <th908.kim@samsung.com>,
-         YoungJun Cho <yj44.cho@samsung.com>,
-         SooChan Lim <sc1.lim@samsung.com>,
-         Boram Park <sc1.lim@samsung.com>
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
+ *
+ * libtdm
+ *
+ * Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Contact: Eunchul Kim <chulspro.kim@samsung.com>,
*          JinYoung Jeon <jy0.jeon@samsung.com>,
*          Taeheon Kim <th908.kim@samsung.com>,
*          YoungJun Cho <yj44.cho@samsung.com>,
*          SooChan Lim <sc1.lim@samsung.com>,
*          Boram Park <sc1.lim@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
 **************************************************************************/
 
 #ifndef _TDM_H_
@@ -52,26 +52,17 @@ extern "C" {
  * @brief The header file for a frontend user.
  * @par Example
  * @code
  #include <tdm.h>    //for a frontend user
* #include <tdm.h>    //for a frontend user
  * @endcode
  */
 
 /**
  * @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 change enumeration of #tdm_output_change_handler
- */
 typedef enum {
-       TDM_OUTPUT_CHANGE_CONNECTION    = (1 << 0), /**< connection chagne */
-       TDM_OUTPUT_CHANGE_DPMS          = (1 << 1), /**< dpms change */
-} tdm_output_change_type;
+       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 change handler
@@ -79,9 +70,9 @@ typedef enum {
  * changed in runtime.
  */
 typedef void (*tdm_output_change_handler)(tdm_output *output,
-                                          tdm_output_change_type type,
-                                          tdm_value value,
-                                          void *user_data);
+                                                                                 tdm_output_change_type type,
+                                                                                 tdm_value value,
+                                                                                 void *user_data);
 
 /**
  * @brief Initialize a display object
@@ -140,7 +131,7 @@ tdm_display_handle_events(tdm_display *dpy);
  */
 tdm_error
 tdm_display_get_capabilities(tdm_display *dpy,
-                             tdm_display_capability *capabilities);
+                                                        tdm_display_capability *capabilities);
 
 /**
  * @brief Get the pp capabilities of a display object.
@@ -150,7 +141,7 @@ tdm_display_get_capabilities(tdm_display *dpy,
  */
 tdm_error
 tdm_display_get_pp_capabilities(tdm_display *dpy,
-                                tdm_pp_capability *capabilities);
+                                                               tdm_pp_capability *capabilities);
 
 /**
  * @brief Get the pp available format array of a display object.
@@ -161,7 +152,7 @@ tdm_display_get_pp_capabilities(tdm_display *dpy,
  */
 tdm_error
 tdm_display_get_pp_available_formats(tdm_display *dpy,
-                                     const tbm_format **formats, int *count);
+                                                                        const tbm_format **formats, int *count);
 
 /**
  * @brief Get the pp available size of a display object.
@@ -176,7 +167,7 @@ tdm_display_get_pp_available_formats(tdm_display *dpy,
  */
 tdm_error
 tdm_display_get_pp_available_size(tdm_display *dpy, int *min_w, int *min_h,
-                                  int *max_w, int *max_h, int *preferred_align);
+                                                                 int *max_w, int *max_h, int *preferred_align);
 
 /**
  * @brief Get the capture capabilities of a display object.
@@ -186,7 +177,7 @@ tdm_display_get_pp_available_size(tdm_display *dpy, int *min_w, int *min_h,
  */
 tdm_error
 tdm_display_get_capture_capabilities(tdm_display *dpy,
-                                     tdm_capture_capability *capabilities);
+                                                                        tdm_capture_capability *capabilities);
 
 /**
  * @brief Get the capture available format array of a display object.
@@ -197,7 +188,7 @@ tdm_display_get_capture_capabilities(tdm_display *dpy,
  */
 tdm_error
 tdm_display_get_catpure_available_formats(tdm_display *dpy,
-                const tbm_format **formats, int *count);
+                                                                                 const tbm_format **formats, int *count);
 
 /**
  * @brief Get the output counts which a display object has.
@@ -240,7 +231,7 @@ tdm_display_create_pp(tdm_display *dpy, tdm_error *error);
  */
 tdm_error
 tdm_output_get_model_info(tdm_output *output, const char **maker,
-                          const char **model, const char **name);
+                                                 const char **model, const char **name);
 
 /**
  * @brief Get the connection status of a output object.
@@ -262,8 +253,8 @@ tdm_output_get_conn_status(tdm_output *output, tdm_output_conn_status *status);
  */
 tdm_error
 tdm_output_add_change_handler(tdm_output *output,
-                              tdm_output_change_handler func,
-                              void *user_data);
+                                                         tdm_output_change_handler func,
+                                                         void *user_data);
 
 /**
  * @brief Remove a output change handler
@@ -274,8 +265,8 @@ tdm_output_add_change_handler(tdm_output *output,
  */
 void
 tdm_output_remove_change_handler(tdm_output *output,
-                                 tdm_output_change_handler func,
-                                 void *user_data);
+                                                                tdm_output_change_handler func,
+                                                                void *user_data);
 
 /**
  * @brief Get the connection type of a output object.
@@ -316,7 +307,7 @@ tdm_output_get_layer(tdm_output *output, int index, tdm_error *error);
  */
 tdm_error
 tdm_output_get_available_properties(tdm_output *output, const tdm_prop **props,
-                                    int *count);
+                                                                       int *count);
 
 /**
  * @brief Get the available mode array of a output object.
@@ -327,7 +318,7 @@ tdm_output_get_available_properties(tdm_output *output, const tdm_prop **props,
  */
 tdm_error
 tdm_output_get_available_modes(tdm_output *output,
-                               const tdm_output_mode **modes, int *count);
+                                                          const tdm_output_mode **modes, int *count);
 
 /**
  * @brief Get the available size of a output object.
@@ -342,7 +333,7 @@ tdm_output_get_available_modes(tdm_output *output,
  */
 tdm_error
 tdm_output_get_available_size(tdm_output *output, int *min_w, int *min_h,
-                              int *max_w, int *max_h, int *preferred_align);
+                                                         int *max_w, int *max_h, int *preferred_align);
 
 /**
  * @brief Get the physical size of a output object.
@@ -353,7 +344,7 @@ tdm_output_get_available_size(tdm_output *output, int *min_w, int *min_h,
  */
 tdm_error
 tdm_output_get_physical_size(tdm_output *output, unsigned int *mmWidth,
-                             unsigned int *mmHeight);
+                                                        unsigned int *mmHeight);
 
 /**
  * @brief Get the subpixel of a output object.
@@ -406,7 +397,7 @@ tdm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value);
  */
 tdm_error
 tdm_output_wait_vblank(tdm_output *output, int interval, int sync,
-                       tdm_output_vblank_handler func, void *user_data);
+                                          tdm_output_vblank_handler func, void *user_data);
 
 /**
  * @brief Commit changes for a output object
@@ -420,7 +411,7 @@ tdm_output_wait_vblank(tdm_output *output, int interval, int sync,
  */
 tdm_error
 tdm_output_commit(tdm_output *output, int sync, tdm_output_commit_handler func,
-                  void *user_data);
+                                 void *user_data);
 
 /**
  * @brief Set one of available modes of a output object
@@ -476,7 +467,7 @@ tdm_output_create_capture(tdm_output *output, tdm_error *error);
  */
 tdm_error
 tdm_layer_get_capabilities(tdm_layer *layer,
-                           tdm_layer_capability *capabilities);
+                                                  tdm_layer_capability *capabilities);
 
 /**
  * @brief Get the available format array of a layer object.
@@ -487,7 +478,7 @@ tdm_layer_get_capabilities(tdm_layer *layer,
  */
 tdm_error
 tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats,
-                                int *count);
+                                                               int *count);
 
 /**
  * @brief Get the available property array of a layer object.
@@ -498,7 +489,7 @@ tdm_layer_get_available_formats(tdm_layer *layer, const tbm_format **formats,
  */
 tdm_error
 tdm_layer_get_available_properties(tdm_layer *layer, const tdm_prop **props,
-                                   int *count);
+                                                                  int *count);
 
 /**
  * @brief Get the zpos of a layer object.
@@ -508,13 +499,19 @@ tdm_layer_get_available_properties(tdm_layer *layer, const tdm_prop **props,
  * - A frontend user only can set the relative zpos to VIDEO layers via #tdm_layer_set_video_pos
  * - The zpos of video layers is less than GRAPHIC layers or more than GRAPHIC
  * layers. ie, ..., -2, -1, 4, 5, ... (if 0 <= GRAPHIC layer's zpos < 4).
+ *   -------------------------------- graphic layer  3 <-- top most layer
+ *   -------------------------------- graphic layer  2
+ *   -------------------------------- graphic layer  1
+ *   -------------------------------- graphic layer  0
+ *   -------------------------------- video   layer -1
+ *   -------------------------------- video   layer -2 <-- lowest layer
  * @param[in] layer A layer object
  * @param[out] zpos The zpos
  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
  * @see tdm_layer_set_video_pos, tdm_layer_capability
  */
 tdm_error
-tdm_layer_get_zpos(tdm_layer *layer, unsigned int *zpos);
+tdm_layer_get_zpos(tdm_layer *layer, int *zpos);
 
 /**
  * @brief Set the property which has a given id.
@@ -539,7 +536,9 @@ tdm_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value);
 /**
  * @brief Set the geometry information to a layer object
  * @details The geometry information will be applied when the output object
- * of a layer object is committed.
+ * of a layer object is committed. If a layer has TDM_LAYER_CAPABILITY_NO_CROP
+ * capability, a layer will ignore the pos(crop) information of #tdm_info_layer's
+ * src_config.
  * @param[in] layer A layer object
  * @param[in] info The geometry information
  * @return #TDM_ERROR_NONE if success. Otherwise, error value.
@@ -580,6 +579,16 @@ tdm_error
 tdm_layer_unset_buffer(tdm_layer *layer);
 
 /**
+ * @brief Get a displaying TDM buffer from a layer object
+ * @details A displaying TDM buffer is a current showing buffer on screen
+ * that is set to layer object and applied output object of a layer object.
+ * @param[in] layer A layer object
+ * @return A TDM buffer if success. Otherwise, NULL.
+ */
+tbm_surface_h
+tdm_layer_get_displaying_buffer(tdm_layer *layer, tdm_error *error);
+
+/**
  * @brief Set a TBM surface_queue to a layer object
  * @details A TBM surface_queue will be applied when the output object
  * of a layer object is committed. and TDM layer will be automatically updated
@@ -636,6 +645,15 @@ tdm_capture *
 tdm_layer_create_capture(tdm_layer *layer, tdm_error *error);
 
 /**
+ * @brief Get buffer flags from a layer object
+ * @param[in] layer A layer object
+ * @param[out] flags a buffer flags value
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ */
+tdm_error
+tdm_layer_get_buffer_flags(tdm_layer *layer, unsigned int *flags);
+
+/**
  * @brief Destroy a pp object
  * @param[in] pp A pp object
  * @see tdm_display_create_pp
@@ -715,7 +733,7 @@ tdm_capture_commit(tdm_capture *capture);
  * @see tdm_buffer_add_release_handler, tdm_buffer_remove_release_handler
  */
 typedef void (*tdm_buffer_release_handler)(tbm_surface_h buffer,
-                void *user_data);
+                                                                                  void *user_data);
 
 /**
  * @brief Add a release handler to a TDM buffer
@@ -732,7 +750,7 @@ typedef void (*tdm_buffer_release_handler)(tbm_surface_h buffer,
  */
 tdm_error
 tdm_buffer_add_release_handler(tbm_surface_h buffer,
-                               tdm_buffer_release_handler func, void *user_data);
+                                                          tdm_buffer_release_handler func, void *user_data);
 
 /**
  * @brief Remove a release handler from a TDM buffer
@@ -743,7 +761,7 @@ tdm_buffer_add_release_handler(tbm_surface_h buffer,
  */
 void
 tdm_buffer_remove_release_handler(tbm_surface_h buffer,
-                                  tdm_buffer_release_handler func, void *user_data);
+                                                                 tdm_buffer_release_handler func, void *user_data);
 
 #ifdef __cplusplus
 }