vblank: calculating SW target time properly
[platform/core/uifw/libtdm.git] / src / tdm_macro.h
index 98f25b4..acdc9f3 100644 (file)
@@ -74,8 +74,6 @@ extern "C" {
 #define TDM_SWAP(a, b)      ({ int t; t = a; a = b; b = t; })
 #define TDM_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
 
-#define TDM_NEVER_GET_HERE() TDM_WRN("** NEVER GET HERE **")
-
 #define TDM_SNPRINTF(p, len, fmt, ARG...)  \
        do { \
                if (p && len && *len > 0) { \
@@ -85,6 +83,10 @@ extern "C" {
                } \
        } while (0)
 
+/* common backend names *****************************************************/
+#define TDM_DEFAULT_MODULE        "libtdm-default.so"
+#define TDM_DUMMY_MODULE          "libtdm-dummy.so"
+
 /* dump directory ***********************************************************/
 #define TDM_DUMP_DIR    "/tmp"
 
@@ -210,6 +212,12 @@ static struct tdm_type_name tdm_conn_names[] = {
 };
 TDM_TYPE_NAME_FN(conn)
 
+static struct tdm_type_name tdm_capture_type_names[] = {
+       { TDM_CAPTURE_TYPE_ONESHOT, "none" },
+       { TDM_CAPTURE_TYPE_STREAM, "90" },
+};
+TDM_TYPE_NAME_FN(capture_type)
+
 static struct tdm_type_name tdm_transform_names[] = {
        { TDM_TRANSFORM_NORMAL, "none" },
        { TDM_TRANSFORM_90, "90" },
@@ -236,7 +244,8 @@ static struct tdm_type_name tdm_cb_type_names[] = {
        { TDM_THREAD_CB_NONE, "none" },
        { TDM_THREAD_CB_OUTPUT_COMMIT, "output-commit" },
        { TDM_THREAD_CB_OUTPUT_VBLANK, "output-vblank" },
-       { TDM_THREAD_CB_OUTPUT_CHANGE, "output-change" },
+       { TDM_THREAD_CB_OUTPUT_STATUS, "output-status" },
+       { TDM_THREAD_CB_OUTPUT_DPMS, "output-dpms" },
        { TDM_THREAD_CB_PP_DONE, "pp-done" },
        { TDM_THREAD_CB_CAPTURE_DONE, "capture-done" },
        { TDM_THREAD_CB_VBLANK_SW, "vblank-sw" },
@@ -368,6 +377,12 @@ TDM_BIT_NAME_FB(capture_caps)
                return; \
        } \
 }
+#define TDM_DBG_RETURN_VAL_IF_FAIL(cond, val) { \
+       if (!(cond))  { \
+               TDM_SNPRINTF(reply, len, "[%s %d] '%s' failed\n", __func__, __LINE__, #cond); \
+               return val; \
+       } \
+}
 #define TDM_DBG_GOTO_IF_FAIL(cond, dst) { \
        if (!(cond))  { \
                TDM_SNPRINTF(reply, len, "[%s %d] '%s' failed\n", __func__, __LINE__, #cond); \
@@ -446,6 +461,29 @@ static inline int TDM_MUTEX_IS_LOCKED(void)
 #define tdm_display_unlock(dpy)   _pthread_mutex_unlock(&((tdm_private_display *)dpy)->lock)
 
 
+/* debugging mutex ************************************************************/
+extern pthread_mutex_t tdm_debug_mutex_check_lock;
+extern const char *tdm_debug_mutex_lock_func;
+extern int tdm_debug_mutex_lock_line;
+
+#define _debug_pthread_mutex_lock(l) \
+       do { \
+               pthread_mutex_lock(l); \
+               pthread_mutex_lock(&tdm_debug_mutex_check_lock); \
+               tdm_debug_mutex_lock_func = __FUNCTION__; \
+               tdm_debug_mutex_lock_line = __LINE__; \
+               pthread_mutex_unlock(&tdm_debug_mutex_check_lock); \
+       } while (0)
+
+#define _debug_pthread_mutex_unlock(l) \
+       do { \
+               pthread_mutex_lock(&tdm_debug_mutex_check_lock); \
+               tdm_debug_mutex_lock_func = NULL; \
+               tdm_debug_mutex_lock_line = 0; \
+               pthread_mutex_unlock(&tdm_debug_mutex_check_lock); \
+               pthread_mutex_unlock(l); \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif