virtual: add set_physical_size protocol
[platform/core/uifw/libtdm.git] / client / tdm_client.h
index c64391e..d0512cc 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
@@ -36,6 +36,8 @@
 #ifndef _TDM_CLIENT_H_
 #define _TDM_CLIENT_H_
 
+#include "tdm_client_types.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -49,8 +51,6 @@ extern "C" {
  * @endcode
  */
 
-#include <tdm_client_types.h>
-
 /**
  * @brief Create a TDM client object.
  * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
@@ -117,6 +117,18 @@ tdm_error
 tdm_client_handle_events(tdm_client *client);
 
 /**
+ * @brief Handle the events of the given file descriptor with millisecond timeout
+ * @details
+ * -1: infinite. 0: return immediately. Otherwise, waiting for ms_timeout milliseconds.
+ * @param[in] client A TDM client object
+ * @param[in] ms_timeout timeout value.
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ * @see #tdm_client_get_fd
+ */
+tdm_error
+tdm_client_handle_events_timeout(tdm_client *client, int ms_timeout);
+
+/**
  * @brief @b Deprecated. Wait for VBLANK.
  * @deprecated
  * @details After interval vblanks, a client vblank handler will be called.
@@ -226,6 +238,12 @@ tdm_client_output_get_dpms(tdm_client_output *output, tdm_output_dpms *dpms);
 
 /**
  * @brief Create the client vblank object of the given client output
+ * @details
+ * tdm client vblank basically uses the HW vblank resource. Therefore, if HW vblank
+ * is not available for some reasons, such as output disconnection and dpms off,
+ * #tdm_client_vblank_wait will return error. If you want it to work propery in spite
+ * of these reasons, you can use #tdm_client_vblank_set_enable_fake to get SW fake
+ * vblank events.
  * @param[in] output The client output object
  * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value.
  * @return A client vblank object if success. Otherwise, NULL.
@@ -241,6 +259,15 @@ void
 tdm_client_vblank_destroy(tdm_client_vblank *vblank);
 
 /**
+ * @brief Set the name to the client vblank object
+ * @param[in] vblank The client vblank object
+ * @param[in] name The client vblank name
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ */
+tdm_error
+tdm_client_vblank_set_name(tdm_client_vblank *vblank, const char *name);
+
+/**
  * @brief Set the sync value to the client vblank object
  * @details
  * If sync == 1, the user client vblank handler of #tdm_client_vblank_wait
@@ -277,8 +304,8 @@ tdm_client_vblank_set_offset(tdm_client_vblank *vblank, int offset_ms);
 /**
  * @brief Enable/Disable the fake vblank to the client vblank object
  * @details
- * If enable_fake == 0, #tdm_client_vblank_wait will return TDM_ERROR_DPMS_OFF
- * when DPMS off. Otherwise, #tdm_client_vblank_wait will return TDM_ERROR_NONE
+ * If enable_fake == 0, #tdm_client_vblank_wait will return error when HW vblank is
+ * not available. Otherwise, #tdm_client_vblank_wait will return TDM_ERROR_NONE
  * as success. Once #tdm_client_vblank_wait returns TDM_ERROR_NONE, the user client
  * vblank handler(#tdm_client_vblank_handler) SHOULD be called after the given
  * interval of #tdm_client_vblank_wait. Default is @b disable.
@@ -292,11 +319,13 @@ tdm_client_vblank_set_enable_fake(tdm_client_vblank *vblank, unsigned int enable
 /**
  * @brief Wait for a vblank
  * @details
- * This function will return TDM_ERROR_DPMS_OFF when DPMS off. However,
+ * This function will return error when HW vblank resource is not available. However,
  * #tdm_client_vblank_wait will return TDM_ERROR_NONE as success if
  * #tdm_client_vblank_set_enable_fake sets true. Once #tdm_client_vblank_wait
  * returns TDM_ERROR_NONE, the user client vblank handler(#tdm_client_vblank_handler)
- * SHOULD be called after the given interval.
+ * SHOULD be called after the given interval. \n
+ * The sequence value of tdm_client_vblank_handler is the relative value of fps.
+ * If fps = 10, this sequence value should be increased by 10 during 1 second.
  * @param[in] vblank The client vblank object
  * @param[in] interval The vblank interval
  * @param[in] func The user client vblank handler
@@ -375,6 +404,67 @@ tdm_client_vblank_set_enable_fake(tdm_client_vblank *vblank, unsigned int enable
 tdm_error
 tdm_client_vblank_wait(tdm_client_vblank *vblank, unsigned int interval, tdm_client_vblank_handler func, void *user_data);
 
+/**
+ * @brief Wait for a vblank with the target sequence number
+ * @details
+ * This function will return error when HW vblank resource is not available. However,
+ * #tdm_client_vblank_wait will return TDM_ERROR_NONE as success if
+ * #tdm_client_vblank_set_enable_fake sets true. Once #tdm_client_vblank_wait_seq
+ * returns TDM_ERROR_NONE, the user client vblank handler(#tdm_client_vblank_handler)
+ * SHOULD be called on reaching the target sequence.
+ * @param[in] vblank The client vblank object
+ * @param[in] sequence The target sequence number
+ * @param[in] func The user client vblank handler
+ * @param[in] user_data The user data
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ */
+tdm_error
+tdm_client_vblank_wait_seq(tdm_client_vblank *vblank, unsigned int sequence, tdm_client_vblank_handler func, void *user_data);
+
+/**
+ * @brief Check if the client vblank object is waiting a vblank event
+ * @param[in] vblank The client vblank object
+ * @return 1 if waiting. 0 if not waiting.
+ */
+unsigned int
+tdm_client_vblank_is_waiting(tdm_client_vblank *vblank);
+
+/* Virtual Output */
+#include <tbm_surface.h>
+
+tdm_client_voutput *
+tdm_client_create_voutput(tdm_client *client, const char *name, tdm_error *error);
+
+void
+tdm_client_voutput_destroy(tdm_client_voutput *voutput);
+
+tdm_error
+tdm_client_voutput_set_available_modes(tdm_client_voutput *voutput, const tdm_client_output_mode *modes, int count);
+
+tdm_error
+tdm_client_voutput_set_physical_size(tdm_client_voutput *voutput, unsigned int mmWidth, unsigned int mmHeight);
+
+tdm_error
+tdm_client_voutput_add_commit_handler(tdm_client_voutput *voutput, tdm_client_voutput_commit_handler *func);
+
+tdm_error
+tdm_client_voutput_get_committed_tbm_surface(tdm_client_voutput *voutput, tbm_surface_h surface);
+
+tdm_client_output *
+tdm_client_voutput_get_client_output(tdm_client_voutput *voutput, tdm_error *error);
+
+tdm_error
+tdm_client_output_get_available_modes(tdm_client_output *output, tdm_client_output_mode **modes, int *count);
+
+tdm_error
+tdm_client_output_set_mode(tdm_client_output *output, const tdm_client_output_mode *mode);
+
+tdm_error
+tdm_client_output_connect(tdm_client_output *output);
+
+tdm_error
+tdm_client_output_disconnect(tdm_client_output *output);
+/* End of Virtual Output */
 
 #ifdef __cplusplus
 }