libtdmincludedir = ${includedir}
libtdminclude_HEADERS = \
tdm.h \
+ tdm_common.h \
tdm_types.h \
tdm_list.h \
tdm_log.h \
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;
-
/**
* @brief The output change handler
* @details This handler will be called when the status of a output object is
--- /dev/null
+/**************************************************************************
+ *
+ * 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_COMMON_H_
+#define _TDM_COMMON_H_
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define TDM_NAME_LEN 64
+
+/**
+ * @file tdm_common.h
+ * @brief The header file which defines Enumerations and Structures for TDM
+ * frontend, backend and client.
+ */
+
+/**
+ * @brief The error enumeration
+ */
+typedef enum {
+ TDM_ERROR_NONE = 0, /**< none */
+ TDM_ERROR_BAD_REQUEST = -1, /**< bad request */
+ TDM_ERROR_OPERATION_FAILED = -2, /**< operaion failed */
+ TDM_ERROR_INVALID_PARAMETER = -3, /**< wrong input parameter */
+ TDM_ERROR_PERMISSION_DENIED = -4, /**< access denied */
+ TDM_ERROR_BUSY = -5, /**< hardware resource busy */
+ TDM_ERROR_OUT_OF_MEMORY = -6, /**< no free memory */
+ TDM_ERROR_BAD_MODULE = -7, /**< bad backend module */
+ TDM_ERROR_NOT_IMPLEMENTED = -8, /**< not implemented */
+ TDM_ERROR_NO_CAPABILITY = -9, /**< no capability */
+ TDM_ERROR_DPMS_OFF = -10, /**< dpms off */
+} tdm_error;
+
+/**
+ * @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;
+
+/**
+ * @brief The output connection status enumeration
+ */
+typedef enum {
+ TDM_OUTPUT_CONN_STATUS_DISCONNECTED, /**< output disconnected */
+ TDM_OUTPUT_CONN_STATUS_CONNECTED, /**< output connected */
+ TDM_OUTPUT_CONN_STATUS_MODE_SETTED, /**< output connected and setted a mode */
+} tdm_output_conn_status;
+
+/**
+ * @brief The DPMS enumeration
+ * @details bit compatible with the libdrm definitions.
+ */
+typedef enum {
+ TDM_OUTPUT_DPMS_ON, /**< On */
+ TDM_OUTPUT_DPMS_STANDBY, /**< StandBy */
+ TDM_OUTPUT_DPMS_SUSPEND, /**< Suspend */
+ TDM_OUTPUT_DPMS_OFF, /**< Off */
+} tdm_output_dpms;
+
+/**
+ * @brief The size structure
+ */
+typedef struct _tdm_size {
+ unsigned int h; /**< width */
+ unsigned int v; /**< height */
+} tdm_size;
+
+/**
+ * @brief The pos structure
+ */
+typedef struct _tdm_pos {
+ unsigned int x;
+ unsigned int y;
+ unsigned int w;
+ unsigned int h;
+} tdm_pos;
+
+/**
+ * @brief The value union
+ */
+typedef union {
+ void *ptr;
+ int32_t s32;
+ uint32_t u32;
+ int64_t s64;
+ uint64_t u64;
+} tdm_value;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _TDM_COMMON_H_ */
extern "C" {
#endif
-#define TDM_NAME_LEN 64
-
/**
* @file tdm_types.h
* @brief The header file which defines Enumerations and Structures for frontend and backend.
* @endcode
*/
-/**
- * @brief The error enumeration
- */
-typedef enum {
- TDM_ERROR_NONE = 0, /**< none */
- TDM_ERROR_BAD_REQUEST = -1, /**< bad request */
- TDM_ERROR_OPERATION_FAILED = -2, /**< operaion failed */
- TDM_ERROR_INVALID_PARAMETER = -3, /**< wrong input parameter */
- TDM_ERROR_PERMISSION_DENIED = -4, /**< access denied */
- TDM_ERROR_BUSY = -5, /**< hardware resource busy */
- TDM_ERROR_OUT_OF_MEMORY = -6, /**< no free memory */
- TDM_ERROR_BAD_MODULE = -7, /**< bad backend module */
- TDM_ERROR_NOT_IMPLEMENTED = -8, /**< not implemented */
- TDM_ERROR_NO_CAPABILITY = -9, /**< no capability */
-} tdm_error;
+#include <tdm_common.h>
/**
* @brief The transform enumeration(rotate, flip)
TDM_TRANSFORM_FLIPPED_270 = 7, /**< rotate 270 and horizontal flip */
} tdm_transform;
-/**
- * @brief The output connection status enumeration
- */
-typedef enum {
- TDM_OUTPUT_CONN_STATUS_DISCONNECTED, /**< output disconnected */
- TDM_OUTPUT_CONN_STATUS_CONNECTED, /**< output connected */
- TDM_OUTPUT_CONN_STATUS_MODE_SETTED, /**< output connected and setted a mode */
-} tdm_output_conn_status;
-
/**
* @brief The output connection status enumeration
* @details bit compatible with the libdrm definitions.
TDM_OUTPUT_TYPE_DSI, /**< DSI connection */
} tdm_output_type;
-/**
- * @brief The DPMS enumeration
- * @details bit compatible with the libdrm definitions.
- */
-typedef enum {
- TDM_OUTPUT_DPMS_ON, /**< On */
- TDM_OUTPUT_DPMS_STANDBY, /**< StandBy */
- TDM_OUTPUT_DPMS_SUSPEND, /**< Suspend */
- TDM_OUTPUT_DPMS_OFF, /**< Off */
-} tdm_output_dpms;
-
/**
* @brief The layer capability enumeration
* @details
char name[TDM_NAME_LEN];
} tdm_prop;
-/**
- * @brief The size structure
- */
-typedef struct _tdm_size {
- unsigned int h; /**< width */
- unsigned int v; /**< height */
-} tdm_size;
-
-/**
- * @brief The pos structure
- */
-typedef struct _tdm_pos {
- unsigned int x;
- unsigned int y;
- unsigned int w;
- unsigned int h;
-} tdm_pos;
-
-/**
- * @brief The value union
- */
-typedef union {
- void *ptr;
- int32_t s32;
- uint32_t u32;
- int64_t s64;
- uint64_t u64;
-} tdm_value;
-
/**
* @brief The info config structure
*/
Summary: Client library for Tizen Display Manager
Group: Development/Libraries
Requires: libtdm-client = %{version}
+Requires: libtdm-devel
%description client-devel
Tizen Display Manager Client Library headers
%manifest %{name}.manifest
%defattr(-,root,root,-)
%{_includedir}/tdm.h
+%{_includedir}/tdm_common.h
%{_includedir}/tdm_backend.h
%{_includedir}/tdm_helper.h
%{_includedir}/tdm_list.h
private_output = private_capture->private_output;
if (private_output->current_dpms_value > TDM_OUTPUT_DPMS_ON) {
TDM_ERR("output(%d) dpms: %s", private_output->pipe,
- dpms_str(private_output->current_dpms_value));
+ tdm_dpms_str(private_output->current_dpms_value));
_pthread_mutex_unlock(&private_display->lock);
return TDM_ERROR_BAD_REQUEST;
}
private_output = private_layer->private_output; \
private_display = private_output->private_display
-#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
-
-struct type_name {
- int type;
- const char *name;
-};
-
-#define type_name_fn(res) \
-const char * res##_str(int type) \
-{ \
- unsigned int i; \
- for (i = 0; i < ARRAY_SIZE(res##_names); i++) { \
- if (res##_names[i].type == type) \
- return res##_names[i].name; \
- } \
- return "(invalid)"; \
-}
-
-struct type_name dpms_names[] = {
- { TDM_OUTPUT_DPMS_ON, "on" },
- { TDM_OUTPUT_DPMS_STANDBY, "standby" },
- { TDM_OUTPUT_DPMS_SUSPEND, "suspend" },
- { TDM_OUTPUT_DPMS_OFF, "off" },
-};
-
-INTERN type_name_fn(dpms)
-
-struct type_name status_names[] = {
- { TDM_OUTPUT_CONN_STATUS_DISCONNECTED, "disconnected" },
- { TDM_OUTPUT_CONN_STATUS_CONNECTED, "connected" },
- { TDM_OUTPUT_CONN_STATUS_MODE_SETTED, "mode_setted" },
-};
-
-INTERN type_name_fn(status)
-
-INTERN const char*
-tdm_get_dpms_str(tdm_output_dpms dpms_value)
-{
- return dpms_str(dpms_value);
-}
-
INTERN tdm_error
_tdm_display_lock(tdm_display *dpy, const char *func)
{
if (private_output->current_dpms_value > TDM_OUTPUT_DPMS_ON) {
TDM_ERR("output(%d) dpms: %s", private_output->pipe,
- dpms_str(private_output->current_dpms_value));
+ tdm_dpms_str(private_output->current_dpms_value));
_pthread_mutex_unlock(&private_display->lock);
return TDM_ERROR_BAD_REQUEST;
}
if (private_output->current_dpms_value > TDM_OUTPUT_DPMS_ON) {
TDM_ERR("output(%d) dpms: %s", private_output->pipe,
- dpms_str(private_output->current_dpms_value));
+ tdm_dpms_str(private_output->current_dpms_value));
_pthread_mutex_unlock(&private_display->lock);
return TDM_ERROR_BAD_REQUEST;
}
if (!tdm_thread_in_display_thread(syscall(SYS_gettid))) {
if (type & TDM_OUTPUT_CHANGE_CONNECTION)
TDM_INFO("output(%d) changed: %s (%d)",
- private_output->pipe, status_str(value.u32), value.u32);
+ private_output->pipe, tdm_status_str(value.u32), value.u32);
if (type & TDM_OUTPUT_CHANGE_DPMS)
TDM_INFO("output(%d) changed: dpms %s (%d)",
- private_output->pipe, dpms_str(value.u32), value.u32);
+ private_output->pipe, tdm_dpms_str(value.u32), value.u32);
}
if (LIST_IS_EMPTY(change_handler_list))
#include <stdlib.h>
#include <sys/types.h>
+#include <tdm_common.h>
+
#ifdef __cplusplus
extern "C" {
#endif
#define FOURCC_STR(id) C(id, 0), C(id, 8), C(id, 16), C(id, 24)
#define FOURCC_ID(str) FOURCC(((char*)str)[0], ((char*)str)[1], ((char*)str)[2], ((char*)str)[3])
+
+#define TDM_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+struct tdm_type_name {
+ int type;
+ const char *name;
+};
+
+#define TDM_TYPE_NAME_FN(res) \
+static inline const char * tdm_##res##_str(int type) \
+{ \
+ unsigned int i; \
+ for (i = 0; i < TDM_ARRAY_SIZE(tdm_##res##_names); i++) { \
+ if (tdm_##res##_names[i].type == type) \
+ return tdm_##res##_names[i].name; \
+ } \
+ return "(invalid)"; \
+}
+
+static struct tdm_type_name tdm_dpms_names[] = {
+ { TDM_OUTPUT_DPMS_ON, "on" },
+ { TDM_OUTPUT_DPMS_STANDBY, "standby" },
+ { TDM_OUTPUT_DPMS_SUSPEND, "suspend" },
+ { TDM_OUTPUT_DPMS_OFF, "off" },
+};
+
+TDM_TYPE_NAME_FN(dpms)
+
+static struct tdm_type_name tdm_status_names[] = {
+ { TDM_OUTPUT_CONN_STATUS_DISCONNECTED, "disconnected" },
+ { TDM_OUTPUT_CONN_STATUS_CONNECTED, "connected" },
+ { TDM_OUTPUT_CONN_STATUS_MODE_SETTED, "mode_setted" },
+};
+
+TDM_TYPE_NAME_FN(status)
+
#ifdef __cplusplus
}
#endif
#include <stdio.h>
#include <string.h>
+#include <strings.h>
#include <stdlib.h>
#include <pthread.h>
#include <errno.h>
#define TDM_TRACE_END()
#endif
-#define prototype_name_fn(res) const char * res##_str(int type)
-
-prototype_name_fn(dpms);
-prototype_name_fn(status);
-
typedef enum {
TDM_CAPTURE_TARGET_OUTPUT,
TDM_CAPTURE_TARGET_LAYER,
struct list_head link;
} tdm_buffer_info;
-const char*
-tdm_get_dpms_str(tdm_output_dpms dpms_value);
-
int
tdm_display_check_module_abi(tdm_private_display *private_display, int abimaj, int abimin);
if (dpms_value != TDM_OUTPUT_DPMS_ON && !sw_timer) {
wl_resource_post_error(resource, WL_TDM_CLIENT_ERROR_DPMS_OFF,
- "dpms '%s'", tdm_get_dpms_str(dpms_value));
- TDM_ERR("dpms '%s'", tdm_get_dpms_str(dpms_value));
+ "dpms '%s'", tdm_dpms_str(dpms_value));
+ TDM_ERR("dpms '%s'", tdm_dpms_str(dpms_value));
return;
}