correct email address
[platform/core/uifw/libtdm.git] / include / tdm_helper.h
index a6791aa..62f3cb3 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
 #ifndef _TDM_HELPER_H_
 #define _TDM_HELPER_H_
 
-#include "tdm_types.h"
 #include <tbm_surface.h>
 
+#include "tdm_types.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -65,8 +66,6 @@ tdm_helper_get_time(void);
  * - TBM_FORMAT_YUV420
  * - TBM_FORMAT_NV12
  * - TBM_FORMAT_NV21
- * - TBM_FORMAT_YUYV
- * - TBM_FORMAT_UYVY
  * The filename extension should be "png" for TBM_FORMAT_ARGB8888 and TBM_FORMAT_XRGB8888
  * or "yuv" for YUV formats.
  * @param[in] buffer A TDM buffer
@@ -76,23 +75,38 @@ void
 tdm_helper_dump_buffer(tbm_surface_h buffer, const char *file);
 
 /**
+ * @brief Dump a buffer.
+ * @details
+ * The filename will includes the buffer information. (width, height, format)
+ * @param[in] buffer A TDM buffer
+ * @param[in] file The path of file.
+ */
+void
+tdm_helper_dump_buffer_str(tbm_surface_h buffer, char *dir, char *str);
+
+/**
  * @brief fill a buffer with 0 for given pos.
  * @details
  * This function supports only if a buffer has below formats.
  * - TBM_FORMAT_ARGB8888
  * - TBM_FORMAT_XRGB8888
- * - TBM_FORMAT_YVU420
- * - TBM_FORMAT_YUV420
- * - TBM_FORMAT_NV12
- * - TBM_FORMAT_NV21
- * - TBM_FORMAT_YUYV
- * - TBM_FORMAT_UYVY
  * @param[in] buffer A TDM buffer
  */
 void
 tdm_helper_clear_buffer_pos(tbm_surface_h buffer, tdm_pos *pos);
 
 /**
+ * @brief fill a buffer with 0 for given pos.
+ * @details
+ * This function supports only if a buffer has below formats.
+ * - TBM_FORMAT_ARGB8888
+ * - TBM_FORMAT_XRGB8888
+ * @param[in] buffer A TDM buffer
+ */
+void
+tdm_helper_clear_buffer_color(tbm_surface_h buffer, tdm_pos *pos, unsigned int color);
+
+/**
  * @brief fill a buffer with 0.
  * @details
  * This function supports only if a buffer has below formats.
@@ -102,14 +116,23 @@ tdm_helper_clear_buffer_pos(tbm_surface_h buffer, tdm_pos *pos);
  * - TBM_FORMAT_YUV420
  * - TBM_FORMAT_NV12
  * - TBM_FORMAT_NV21
- * - TBM_FORMAT_YUYV
- * - TBM_FORMAT_UYVY
  * @param[in] buffer A TDM buffer
  */
 void
 tdm_helper_clear_buffer(tbm_surface_h buffer);
 
 /**
+ * @brief Get the buffer full size.
+ * @details
+ * In some hardware, the buffer width or height is aligned with the fixed size.
+ * eg. 8, 16, etc. In this case, the real size of buffer could be bigger than
+ * the buffer size of tbm_surface_info_s.
+ * @param[in] buffer A TDM buffer
+ */
+void
+tdm_helper_get_buffer_full_size(tbm_surface_h buffer, int *buffer_w, int *buffer_h);
+
+/**
  * @brief convert the source buffer to the destination buffer with given rectangles
  * trannsform
  * @details
@@ -128,10 +151,6 @@ tdm_helper_convert_buffer(tbm_surface_h srcbuf, tbm_surface_h dstbuf,
  * @details
  * This function will dup the fd of the given enviroment variable. The Caller
  * @b SHOULD close the fd.
- * \n
- * In DRM system, a drm-master-fd @b SHOULD be shared between TDM backend and
- * TBM backend in display server side by using "TDM_DRM_MASTER_FD"
- * and "TBM_DRM_MASTER_FD".
  * @param[in] env The given enviroment variable
  * @return fd if success. Otherwise, -1.
  * @see #tdm_helper_set_fd()
@@ -140,10 +159,6 @@ int tdm_helper_get_fd(const char *env);
 
 /**
  * @brief Set the given fd to the give enviroment variable.
- * @details
- * In DRM system, a drm-master-fd @b SHOULD be shared between TDM backend and
- * TBM backend in display server side by using "TDM_DRM_MASTER_FD"
- * and "TBM_DRM_MASTER_FD".
  * @param[in] env The given enviroment variable
  * @param[in] fd The given fd
  * @see #tdm_helper_get_fd()
@@ -151,6 +166,56 @@ int tdm_helper_get_fd(const char *env);
 void tdm_helper_set_fd(const char *env, int fd);
 
 /**
+ * @brief Start the dump debugging.
+ * @details
+ * Start tdm dump.
+ * Make dump file when tdm_layer_set_buffer() function is called.
+ * Set the dump count to 1.
+ * @param[in] dumppath The given dump path
+ * @param[in] count The dump count number
+ * @see #tdm_helper_dump_stop()
+ */
+void
+tdm_helper_dump_start(char *dumppath, int *count);
+
+/**
+ * @brief Stop the dump debugging.
+ * @details
+ * Stop tdm dump.
+ * Set the dump count to 0.
+ * @see #tdm_helper_dump_start()
+ */
+void
+tdm_helper_dump_stop(void);
+
+/**
+ * @brief The tdm helper capture handler
+ * @details
+ * This handler will be called when composit image produced.
+ * @see #tdm_helper_capture_output() function
+ */
+typedef void (*tdm_helper_capture_handler)(tbm_surface_h buffer, void *user_data);
+
+/**
+ * @brief Make an output's image surface.
+ * @details Composit specific output's all layer's buffer to dst_buffer surface.
+ * After composing, tdm_helper_capture_handler func will be called.
+ * @param[in] output A output object
+ * @param[in] dst_buffer A surface composite image saved
+ * @param[in] x A horizontal position of composite image on dst_buffer
+ * @param[in] y A vertical position of composite image on dst_buffer
+ * @param[in] w A composite image width
+ * @param[in] h A composite image height
+ * @param[in] func A composing done handler
+ * @param[in] user_data The user data
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ */
+tdm_error
+tdm_helper_capture_output(tdm_output *output, tbm_surface_h dst_buffer,
+                                                 int x, int y, int w, int h,
+                                                 tdm_helper_capture_handler func, void *data);
+
+/**
  * @brief Fill the display information to the reply buffer as string.
  * @param[in] dpy A display object
  * @param[out] reply the string buffer to be filled by this function.
@@ -159,6 +224,22 @@ void tdm_helper_set_fd(const char *env, int fd);
 void
 tdm_helper_get_display_information(tdm_display *dpy, char *reply, int *len);
 
+/**
+ * @brief Get whether the commit-per-vblank functionality is enabled or not for the output.
+ * @param[in] output An output the functionality has to be checked for
+ * @return -1 if error occurred, 1 if enabled, 0 if disabled.
+ */
+int
+tdm_helper_output_commit_per_vblank_enabled(tdm_output *output);
+
+/**
+ * @brief Get whether the vblank timer is expired or not for the output.
+ * @param[in] output An output the functionality has to be checked for
+ * @return -1 if error occurred, 1 if enabled, 0 if disabled.
+ */
+unsigned int
+tdm_helper_output_vblank_timer_expired(tdm_output *output);
+
 #ifdef __cplusplus
 }
 #endif