Port to Weston 1.3 API.
[profile/ivi/ico-uxf-weston-plugin.git] / src / ico_ivi_common_private.h
1 /*
2  * Copyright © 2010-2011 Intel Corporation
3  * Copyright © 2008-2011 Kristian Høgsberg
4  * Copyright © 2013 TOYOTA MOTOR CORPORATION.
5  *
6  * Permission to use, copy, modify, distribute, and sell this software and
7  * its documentation for any purpose is hereby granted without fee, provided
8  * that the above copyright notice appear in all copies and that both that
9  * copyright notice and this permission notice appear in supporting
10  * documentation, and that the name of the copyright holders not be used in
11  * advertising or publicity pertaining to distribution of the software
12  * without specific, written prior permission.  The copyright holders make
13  * no representations about the suitability of this software for any
14  * purpose.  It is provided "as is" without express or implied warranty.
15  *
16  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
17  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
18  * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
19  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
20  * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
21  * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
22  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23  */
24 /**
25  * @brief   The common functions that each Plugin is available.
26  *
27  * @date    Jul-26-2013
28  */
29
30 #ifndef _ICO_IVI_COMMON_PRIVATE_H_
31 #define _ICO_IVI_COMMON_PRIVATE_H_
32
33 /* Log for performance evaluations      */
34 #define PERFORMANCE_EVALUATIONS 1
35
36 /* Macros                               */
37 #define ICO_IVI_NODEID_2_HOSTID(nodeid)         (((unsigned int)nodeid) >> 8)
38 #define ICO_IVI_NODEID_2_DISPLAYNO(nodeid)      (((unsigned int)nodeid) & 0x0ff)
39 #define ICO_IVI_NODEDISP_2_NODEID(nodeid, displayno)  \
40                                                 ((nodeid << 8) | displayno)
41 #define ICO_IVI_SURFACEID_2_HOSTID(surfid)      (((unsigned int)surfid) >> 24)
42 #define ICO_IVI_SURFACEID_2_DISPLAYNO(surfid)   ((((unsigned int)surfid) >> 16) & 0x0ff)
43 #define ICO_IVI_SURFACEID_2_NODEID(surfid)      (((unsigned int)surfid) >> 16)
44 #define ICO_IVI_SURFACEID_BASE(nodeid)          (((unsigned int)nodeid) << 16)
45
46 /* System limit                         */
47 #define ICO_IVI_MAX_DISPLAY      (8)        /* Maximum numer of displays in a ECU   */
48 #define ICO_IVI_APPID_LENGTH     (80)       /* Maximum length of applicationId(AppCore) */
49                                             /* (with terminate NULL)                */
50 #define ICO_IVI_WINNAME_LENGTH   (40)       /* Maximum length of window name (with NULL)*/
51 #define ICO_IVI_ANIMATION_LENGTH (16)       /* Maximum length of animation name (w NULL)*/
52 #define ICO_IVI_MAX_COORDINATE   (16383)    /* Maximum X or Y coordinate            */
53
54 /* Fixed value                          */
55 #ifndef TRUE
56 #define TRUE    1
57 #endif
58 #ifndef FALSE
59 #define FALSE   0
60 #endif
61
62 /* Option flags                         */
63 #define ICO_IVI_OPTION_SHOW_SURFACE     0x0001  /* new surface show on create       */
64 #define ICO_IVI_OPTION_SHOW_NODISP      0x0002  /* show if display not exist        */
65 #define ICO_IVI_OPTION_SHOW_INPUTLAYER  0x0004  /* show input panel layer           */
66 #define ICO_IVI_OPTION_FIXED_ASPECT     0x0080  /* surface fixed aspect rate        */
67 #define ICO_IVI_OPTION_GPU_NODEPEND     0x8000  /* no use GPU dependent acceleration*/
68 #define ICO_IVI_OPTION_GPU_DEPENDINTEL  0x1000  /* use Intel GPU dependent acceleration*/
69                                                 /* depends for Intel GPU            */
70 /* Debug flags                          */
71 #define ICO_IVI_DEBUG_PERF_LOG          0x0001  /* performance log                  */
72
73 /* Function prototype                   */
74 int ico_ivi_get_mynode(void);               /* Get my node numner                   */
75 int ico_ivi_optionflag(void);               /* Get option flag                      */
76 int ico_ivi_debuglevel(void);               /* Get debug log level                  */
77 int ico_ivi_debugflag(void);                /* Get debug flag                       */
78                                             /* Get default animation name           */
79 const char *ico_ivi_default_animation_name(void);
80 int ico_ivi_default_animation_time(void);   /* Get default animation time(ms)       */
81 int ico_ivi_default_animation_fps(void);    /* Get animation frame rate(fps)        */
82
83 /* Debug Traces                         */
84 /* Define for debug write               */
85 #define UIFW_DEBUG_OUT  1   /* 1=Debug Print/0=No Debug Print           */
86
87 #if UIFW_DEBUG_OUT > 0
88 #define uifw_perf(fmt,...)  \
89     { if (ico_ivi_debugflag() & ICO_IVI_DEBUG_PERF_LOG) {weston_log("PRF>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} }
90 #define uifw_debug(fmt,...)  \
91     { if (ico_ivi_debuglevel() >= 5) {weston_log("DBG>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} }
92 #define uifw_trace(fmt,...)  \
93     { if (ico_ivi_debuglevel() >= 4) {weston_log("TRC>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} }
94
95 #ifdef UIFW_DETAIL_OUT
96 #if UIFW_DETAIL_OUT > 0
97 #define uifw_detail(fmt,...)  \
98     { if (ico_ivi_debuglevel() >= 5) {weston_log("DBG>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} }
99 #else
100 #define uifw_detail(fmt,...)
101 #endif
102 #else
103 #define uifw_detail(fmt,...)
104 #endif
105
106 #else  /*UIFW_DEBUG_OUT*/
107 #define uifw_perf(fmt,...)
108 #define uifw_debug(fmt,...)
109 #define uifw_trace(fmt,...)
110 #endif /*UIFW_DEBUG_OUT*/
111
112 #define uifw_info(fmt,...)  \
113     { if (ico_ivi_debuglevel() >= 3) {weston_log("INF>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} }
114 #define uifw_warn(fmt,...)  \
115     { if (ico_ivi_debuglevel() >= 2) {weston_log("WRN>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} }
116 #define uifw_error(fmt,...)  \
117     { if (ico_ivi_debuglevel() >= 1) {weston_log("ERR>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} }
118
119 #endif  /*_ICO_IVI_COMMON_PRIVATE_H_*/