X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Ftdm_types.h;h=d9ab9848ce5d4e6f476090a3e8a816ef0c8014cc;hb=8beab8406229bf9f2f26954b98031f5537ffbe39;hp=cd3ca4c781fd27cd3d251d46523156e8243bf32d;hpb=28a0b0177f7f59b6577592edf538ecb1f978fd40;p=platform%2Fcore%2Fuifw%2Flibtdm.git diff --git a/include/tdm_types.h b/include/tdm_types.h index cd3ca4c..d9ab984 100644 --- a/include/tdm_types.h +++ b/include/tdm_types.h @@ -1,36 +1,36 @@ /************************************************************************** - -libtdm - -Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. - -Contact: Eunchul Kim , - JinYoung Jeon , - Taeheon Kim , - YoungJun Cho , - SooChan Lim , - Boram Park - -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 , + * JinYoung Jeon , + * Taeheon Kim , + * YoungJun Cho , + * SooChan Lim , + * Boram Park + * + * 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_TYPES_H_ @@ -38,224 +38,325 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include +#include "tdm_common.h" + #ifdef __cplusplus extern "C" { #endif -#define TDM_NAME_LEN 64 - -typedef enum -{ - TDM_ERROR_NONE = 0, - 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; - -typedef enum -{ - TDM_TRANSFORM_NORMAL = 0, - TDM_TRANSFORM_90 = 1, - TDM_TRANSFORM_180 = 2, - TDM_TRANSFORM_270 = 3, - TDM_TRANSFORM_FLIPPED = 4, - TDM_TRANSFORM_FLIPPED_90 = 5, - TDM_TRANSFORM_FLIPPED_180 = 6, - TDM_TRANSFORM_FLIPPED_270 = 7, - TDM_TRANSFORM_MAX = 8 -} tdm_transform; - -typedef enum -{ - TDM_OUTPUT_CONN_STATUS_DISCONNECTED, - TDM_OUTPUT_CONN_STATUS_CONNECTED, - TDM_OUTPUT_CONN_STATUS_MODE_SETTED, - TDM_OUTPUT_CONN_STATUS_MAX, -} tdm_output_conn_status; - -/* bit compatible with the libdrm definitions. */ -typedef enum -{ - TDM_OUTPUT_TYPE_Unknown, - TDM_OUTPUT_TYPE_VGA, - TDM_OUTPUT_TYPE_DVII, - TDM_OUTPUT_TYPE_DVID, - TDM_OUTPUT_TYPE_DVIA, - TDM_OUTPUT_TYPE_Composite, - TDM_OUTPUT_TYPE_SVIDEO, - TDM_OUTPUT_TYPE_LVDS, - TDM_OUTPUT_TYPE_Component, - TDM_OUTPUT_TYPE_9PinDIN, - TDM_OUTPUT_TYPE_DisplayPort, - TDM_OUTPUT_TYPE_HDMIA, - TDM_OUTPUT_TYPE_HDMIB, - TDM_OUTPUT_TYPE_TV, - TDM_OUTPUT_TYPE_eDP, - TDM_OUTPUT_TYPE_VIRTUAL, - TDM_OUTPUT_TYPE_DSI, - TDM_OUTPUT_TYPE_MAX, -} tdm_output_type; - -/* bit compatible with the drm definitions. */ -typedef enum -{ - TDM_OUTPUT_DPMS_ON, - TDM_OUTPUT_DPMS_STANDBY, - TDM_OUTPUT_DPMS_SUSPEND, - TDM_OUTPUT_DPMS_OFF, - TDM_OUTPUT_DPMS_MAX, -} tdm_output_dpms; - -typedef enum -{ - TDM_DISPLAY_CAPABILITY_PP = (1<<0), - TDM_DISPLAY_CAPABILITY_CAPTURE = (1<<1), +/** + * @file tdm_types.h + * @brief The header file which defines Enumerations and Structures for frontend and backend. + * @details + * Both frontend(@ref tdm.h) and backend(@ref tdm_backend.h) header files + * include @ref tdm_types.h + * @par Example + * @code + * #include //for a frontend user + * @endcode + * @code + * #include //for a vendor to implement a backend module + * @endcode + */ + +typedef enum { + TDM_EVENT_LOOP_READABLE = (1 << 0), + TDM_EVENT_LOOP_WRITABLE = (1 << 1), + TDM_EVENT_LOOP_HANGUP = (1 << 2), + TDM_EVENT_LOOP_ERROR = (1 << 3), +} tdm_event_loop_mask; + +/** + * @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; -typedef enum -{ - TDM_LAYER_CAPABILITY_CURSOR = (1<<0), - TDM_LAYER_CAPABILITY_PRIMARY = (1<<1), - TDM_LAYER_CAPABILITY_OVERLAY = (1<<2), - TDM_LAYER_CAPABILITY_SCALE = (1<<4), - TDM_LAYER_CAPABILITY_TRANSFORM = (1<<5), - TDM_LAYER_CAPABILITY_GRAPHIC = (1<<8), - TDM_LAYER_CAPABILITY_VIDEO = (1<<9), -} tdm_layer_capability; - -typedef enum -{ - TDM_PP_CAPABILITY_SYNC = (1<<0), - TDM_PP_CAPABILITY_ASYNC = (1<<1), - TDM_PP_CAPABILITY_SCALE = (1<<4), - TDM_PP_CAPABILITY_TRANSFORM = (1<<5), -} tdm_pp_capability; - -typedef enum -{ - TDM_CAPTURE_CAPABILITY_OUTPUT = (1<<0), - TDM_CAPTURE_CAPABILITY_LAYER = (1<<1), - TDM_CAPTURE_CAPABILITY_SCALE = (1<<4), - TDM_CAPTURE_CAPABILITY_TRANSFORM = (1<<5), -} tdm_capture_capability; - -/* bit compatible with the drm definitions. */ -typedef enum -{ - TDM_OUTPUT_MODE_TYPE_BUILTIN = (1<<0), - TDM_OUTPUT_MODE_TYPE_CLOCK_C = ((1<<1) | TDM_OUTPUT_MODE_TYPE_BUILTIN), - TDM_OUTPUT_MODE_TYPE_CRTC_C = ((1<<2) | TDM_OUTPUT_MODE_TYPE_BUILTIN), - TDM_OUTPUT_MODE_TYPE_PREFERRED = (1<<3), - TDM_OUTPUT_MODE_TYPE_DEFAULT = (1<<4), - TDM_OUTPUT_MODE_TYPE_USERDEF = (1<<5), - TDM_OUTPUT_MODE_TYPE_DRIVER = (1<<6), -} tdm_output_mode_type; - -/* bit compatible with the drm definitions. */ -typedef enum -{ - TDM_OUTPUT_MODE_FLAG_PHSYNC = (1<<0), - TDM_OUTPUT_MODE_FLAG_NHSYNC = (1<<1), - TDM_OUTPUT_MODE_FLAG_PVSYNC = (1<<2), - TDM_OUTPUT_MODE_FLAG_NVSYNC = (1<<3), - TDM_OUTPUT_MODE_FLAG_INTERLACE = (1<<4), - TDM_OUTPUT_MODE_FLAG_DBLSCAN = (1<<5), - TDM_OUTPUT_MODE_FLAG_CSYNC = (1<<6), - TDM_OUTPUT_MODE_FLAG_PCSYNC = (1<<7), - TDM_OUTPUT_MODE_FLAG_NCSYNC = (1<<8), - TDM_OUTPUT_MODE_FLAG_HSKEW = (1<<9), /* hskew provided */ - TDM_OUTPUT_MODE_FLAG_BCAST = (1<<10), - TDM_OUTPUT_MODE_FLAG_PIXMUX = (1<<11), - TDM_OUTPUT_MODE_FLAG_DBLCLK = (1<<12), - TDM_OUTPUT_MODE_FLAG_CLKDIV2 = (1<<13), -} tdm_output_mode_flag; - -typedef struct _tdm_output_mode -{ - unsigned int width; - unsigned int height; - unsigned int refresh; - unsigned int flags; - unsigned int type; - char name[TDM_NAME_LEN]; +/** + * @brief The output mode structure + */ +typedef struct _tdm_output_mode { + unsigned int clock; + unsigned int hdisplay, hsync_start, hsync_end, htotal, hskew; + unsigned int vdisplay, vsync_start, vsync_end, vtotal, vscan; + unsigned int vrefresh; + unsigned int flags; + unsigned int type; + char name[TDM_NAME_LEN]; } tdm_output_mode; -typedef struct _tdm_prop -{ - unsigned int id; - char name[TDM_NAME_LEN]; +/** + * @brief The property structure + */ +typedef struct _tdm_prop { + unsigned int id; + char name[TDM_NAME_LEN]; + tdm_value_type type; } tdm_prop; -typedef struct _tdm_size { - unsigned int h; - unsigned int v; -} tdm_size; - -typedef struct _tdm_pos -{ - unsigned int x; - unsigned int y; - unsigned int w; - unsigned int h; -} tdm_pos; - -typedef union -{ - void *ptr; - int32_t s32; - uint32_t u32; - int64_t s64; - uint64_t u64; -} tdm_value; - -typedef struct _tdm_info_config -{ - tdm_size size; - tdm_pos pos; - tbm_format format; +/** + * @brief The info config structure + */ +typedef struct _tdm_info_config { + tdm_size size; + tdm_pos pos; + tbm_format format; } tdm_info_config; -typedef struct _tdm_info_layer -{ - tdm_info_config src_config; - tdm_pos dst_pos; - tdm_transform transform; +/** + * @brief The layer info structre + */ +typedef struct _tdm_info_layer { + tdm_info_config src_config; + tdm_pos dst_pos; + tdm_transform transform; } tdm_info_layer; -typedef struct _tdm_info_pp -{ - tdm_info_config src_config; - tdm_info_config dst_config; - tdm_transform transform; - int sync; +/** + * @brief The region structure + * @since 2.0.0 + */ +typedef struct _tdm_region { + unsigned int num_rects; + tdm_pos const *rects; +} tdm_region; + +/** + * @brief The hwc window info structure + * @since 2.0.0 + */ +typedef struct _tdm_hwc_window_info { + tdm_info_config src_config; + tdm_pos dst_pos; + tdm_transform transform; +} tdm_hwc_window_info; + +/** + * @brief The pp info structre + */ +typedef struct _tdm_info_pp { + tdm_info_config src_config; + tdm_info_config dst_config; + tdm_transform transform; + int sync; + int flags; } tdm_info_pp; -typedef struct _tdm_info_capture -{ - tdm_info_config dst_config; - tdm_transform transform; - int oneshot; - int frequency; +/** + * @brief The capture info structre + */ +typedef struct _tdm_info_capture { + tdm_info_config dst_config; + tdm_transform transform; + tdm_capture_type type; + int frequency; + int flags; } tdm_info_capture; +/** + * @brief Possible composition types for a given window + * @since 2.0.0 + */ +typedef enum { + + /** The composition type for an invisible window. The value by default. + * + * The backend ignores windows of this type. + */ + TDM_HWC_WIN_COMPOSITION_NONE = 0, + + /** The compostion type for an window to be compsoited by the client. + * + * When the client sets this composition type, + * the backend MUST NOT modify this composition type into other types. + * + * When the backend changes TDM_HWC_WIN_COMPOSITION_DEVICE or TDM_HWC_WIN_COMPOSITION_CURSOR + * to this composition type at the time of tdm_hwc_validate and + * tdm_hwc_get_changed_composition_types, + * the client has to composite this window with gl or other drawing operations. + */ + TDM_HWC_WIN_COMPOSITION_CLIENT = 1, + + /** The compostion type for an window to be set to the hw overlay. + * + * The client sets this composition type to the visible windows before requesting + * the tdm_hwc_validate. + * Nomally, the backend leave it if the backend sets the window to the hw overlay. + * If the backend does not set the window to the hw overlay at the time of + * tdm_hwc_validate, the backend changes the composition type of the window into + * TDM_HWC_WIN_COMPOSITION_CLIENT. + */ + TDM_HWC_WIN_COMPOSITION_DEVICE = 3, + + /** The compostion type for an window to be set to the cursor hw overlay. + * + * The client sets this composition type to the cursor window before requesting + * the tdm_hwc_validate. + * If the backend does not support the cursor hw overlay, the backend can change + * the comopsition type into the TDM_HWC_WIN_COMPOSITION_CLIENT. + */ + TDM_HWC_WIN_COMPOSITION_CURSOR = 4, + + /** The compostion type for an window to be set to the video hw overlay. + * + * The client sets this composition type to the video window before requesting + * the tdm_hwc_validate. + * If the backend does not support the video hw overlay, the backend can change + * the comopsition type into the TDM_HWC_WIN_COMPOSITION_CLIENT. + * Normally, this VIDEO window displays under the primary hw overlayer of the output. + */ + TDM_HWC_WIN_COMPOSITION_VIDEO = 5, +} tdm_hwc_window_composition; + +typedef enum { + TDM_HWC_WIN_CONSTRAINT_NONE = 0, + /** If the client needs to render to a specific buffer for compositing + * with TDM_HWC_WIN_COMPOSITION_DEVICE, the backend needs to set + * TDM_HWC_WIN_CONSTRAINT_BUFFER_QUEUE to hwc_window until the hwc_window is not + * TDM_HWC_WIN_COMPOSITION_DEVICE. The client gets the tbm_surface_queue_h through + * the tdm_hwc_window_aquire_buffer_queue. It will render the frames on + * the buffers which gets from the tbm_surface_queue_h. + */ + TDM_HWC_WIN_CONSTRAINT_BUFFER_QUEUE = (1 << 0), +} tdm_hwc_window_constraint; + +/** + * @brief The tdm display object + */ typedef void tdm_display; + +/** + * @brief The tdm backend object + */ +typedef void tdm_module; + +/** + * @brief The tdm output object + */ typedef void tdm_output; + +/** + * @brief The tdm voutput object + */ +typedef void tdm_voutput; + +/** + * @brief The tdm layer object + */ typedef void tdm_layer; -typedef void tdm_buffer; + +/** + * @brief The tdm hwc object + * @since 2.0.0 + */ +typedef void tdm_hwc; + +/** + * @brief The tdm hwc window object + * @since 2.0.0 + */ +typedef void tdm_hwc_window; + +/** + * @brief The tdm capture object + */ typedef void tdm_capture; + +/** + * @brief The tdm pp object + */ typedef void tdm_pp; +/** + * @brief The tdm vblank object + */ +typedef void tdm_vblank; + +/** + * @brief The output create handler + * @details This handler will be called when the output object is + * createed in runtime. + */ +typedef void (*tdm_output_create_handler)(tdm_display *dpy, tdm_output *output, void *user_data); + +/** + * @brief The output destroy handler + * @details This handler will be called when the output object is + * destroied in runtime. + */ +typedef void (*tdm_output_destroy_handler)(tdm_output *output, void *user_data); + +/** + * @brief The output change handler + * @details This handler will be called when the status of a output object is + * changed in runtime. + */ +typedef void (*tdm_output_change_handler)(tdm_output *output, + tdm_output_change_type type, + tdm_value value, + void *user_data); + +/** + * @brief The vblank handler + * @see output_set_vblank_handler() function of #tdm_func_display + */ typedef void (*tdm_output_vblank_handler)(tdm_output *output, unsigned int sequence, - unsigned int tv_sec, unsigned int tv_usec, void *user_data); -typedef void (*tdm_output_commit_handler)(tdm_output *output, unsigned int sequence, - unsigned int tv_sec, unsigned int tv_usec, void *user_data); - + unsigned int tv_sec, unsigned int tv_usec, + void *user_data); +/** + * @brief The output commit handler + * @see output_set_commit_handler() function of #tdm_func_display + */ +typedef void (*tdm_output_commit_handler)(tdm_output *output, unsigned int sequence, + unsigned int tv_sec, unsigned int tv_usec, + void *user_data); + +/** + * @brief The output mode change request handler + */ +typedef void (*tdm_output_mode_change_request_handler)(tdm_output *output, + unsigned int index, void *user_data); + +/** + * @brief The layer commit handler + */ +typedef void (*tdm_layer_commit_handler)(tdm_layer *layer, unsigned int sequence, + unsigned int tv_sec, unsigned int tv_usec, + void *user_data); + +/** + * @brief The done handler of a pp object + */ +typedef void (*tdm_pp_done_handler)(tdm_pp *pp, tbm_surface_h src, + tbm_surface_h dst, void *user_data); + +/** + * @brief The done handler of a capture object + */ +typedef void (*tdm_capture_done_handler)(tdm_capture *capture, + tbm_surface_h buffer, void *user_data); + +/** + * @brief The create handler of a vblank object + */ +typedef void (*tdm_vblank_create_handler)(tdm_vblank *vblank, void *user_data); + +/** + * @brief The hwc commit handler + * @see hwc_set_commit_handler() function of #tdm_func_hwc + */ +typedef void (*tdm_hwc_commit_handler)(tdm_hwc *hwc, unsigned int sequence, + unsigned int tv_sec, unsigned int tv_usec, + void *user_data); + +typedef void (*tdm_voutput_commit_handler)(tdm_voutput *voutput, unsigned int sequence, + unsigned int tv_sec, unsigned int tv_usec, + void *user_data); + +typedef void (*tdm_voutput_commit_func)(tdm_voutput *voutput, tbm_surface_h buffer); #ifdef __cplusplus } #endif