xref: /utopia/UTPA2-700.0.x/modules/graphic/drv/ge/drvGE.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1 //<MStar Software>
2 //******************************************************************************
3 // MStar Software
4 // Copyright (c) 2010 - 2012 MStar Semiconductor, Inc. All rights reserved.
5 // All software, firmware and related documentation herein ("MStar Software") are
6 // intellectual property of MStar Semiconductor, Inc. ("MStar") and protected by
7 // law, including, but not limited to, copyright law and international treaties.
8 // Any use, modification, reproduction, retransmission, or republication of all
9 // or part of MStar Software is expressly prohibited, unless prior written
10 // permission has been granted by MStar.
11 //
12 // By accessing, browsing and/or using MStar Software, you acknowledge that you
13 // have read, understood, and agree, to be bound by below terms ("Terms") and to
14 // comply with all applicable laws and regulations:
15 //
16 // 1. MStar shall retain any and all right, ownership and interest to MStar
17 //    Software and any modification/derivatives thereof.
18 //    No right, ownership, or interest to MStar Software and any
19 //    modification/derivatives thereof is transferred to you under Terms.
20 //
21 // 2. You understand that MStar Software might include, incorporate or be
22 //    supplied together with third party`s software and the use of MStar
23 //    Software may require additional licenses from third parties.
24 //    Therefore, you hereby agree it is your sole responsibility to separately
25 //    obtain any and all third party right and license necessary for your use of
26 //    such third party`s software.
27 //
28 // 3. MStar Software and any modification/derivatives thereof shall be deemed as
29 //    MStar`s confidential information and you agree to keep MStar`s
30 //    confidential information in strictest confidence and not disclose to any
31 //    third party.
32 //
33 // 4. MStar Software is provided on an "AS IS" basis without warranties of any
34 //    kind. Any warranties are hereby expressly disclaimed by MStar, including
35 //    without limitation, any warranties of merchantability, non-infringement of
36 //    intellectual property rights, fitness for a particular purpose, error free
37 //    and in conformity with any international standard.  You agree to waive any
38 //    claim against MStar for any loss, damage, cost or expense that you may
39 //    incur related to your use of MStar Software.
40 //    In no event shall MStar be liable for any direct, indirect, incidental or
41 //    consequential damages, including without limitation, lost of profit or
42 //    revenues, lost or damage of data, and unauthorized system use.
43 //    You agree that this Section 4 shall still apply without being affected
44 //    even if MStar Software has been modified by MStar in accordance with your
45 //    request or instruction for your use, except otherwise agreed by both
46 //    parties in writing.
47 //
48 // 5. If requested, MStar may from time to time provide technical supports or
49 //    services in relation with MStar Software to you for your use of
50 //    MStar Software in conjunction with your or your customer`s product
51 //    ("Services").
52 //    You understand and agree that, except otherwise agreed by both parties in
53 //    writing, Services are provided on an "AS IS" basis and the warranty
54 //    disclaimer set forth in Section 4 above shall apply.
55 //
56 // 6. Nothing contained herein shall be construed as by implication, estoppels
57 //    or otherwise:
58 //    (a) conferring any license or right to use MStar name, trademark, service
59 //        mark, symbol or any other identification;
60 //    (b) obligating MStar or any of its affiliates to furnish any person,
61 //        including without limitation, you and your customers, any assistance
62 //        of any kind whatsoever, or any information; or
63 //    (c) conferring any license or right under any intellectual property right.
64 //
65 // 7. These terms shall be governed by and construed in accordance with the laws
66 //    of Taiwan, R.O.C., excluding its conflict of law rules.
67 //    Any and all dispute arising out hereof or related hereto shall be finally
68 //    settled by arbitration referred to the Chinese Arbitration Association,
69 //    Taipei in accordance with the ROC Arbitration Law and the Arbitration
70 //    Rules of the Association by three (3) arbitrators appointed in accordance
71 //    with the said Rules.
72 //    The place of arbitration shall be in Taipei, Taiwan and the language shall
73 //    be English.
74 //    The arbitration award shall be final and binding to both parties.
75 //
76 //******************************************************************************
77 //<MStar Software>
78 ////////////////////////////////////////////////////////////////////////////////
79 //
80 // Copyright (c) 2008-2009 MStar Semiconductor, Inc.
81 // All rights reserved.
82 //
83 // Unless otherwise stipulated in writing, any and all information contained
84 // herein regardless in any format shall remain the sole proprietary of
85 // MStar Semiconductor Inc. and be kept in strict confidence
86 // ("MStar Confidential Information") by the recipient.
87 // Any unauthorized act including without limitation unauthorized disclosure,
88 // copying, use, reproduction, sale, distribution, modification, disassembling,
89 // reverse engineering and compiling of the contents of MStar Confidential
90 // Information is unlawful and strictly prohibited. MStar hereby reserves the
91 // rights to any and all damages, losses, costs and expenses resulting therefrom.
92 //
93 ////////////////////////////////////////////////////////////////////////////////
94 
95 ///////////////////////////////////////////////////////////////////////////////////////////////////
96 ///
97 /// @file   drvGE.h
98 /// @brief  GE Driver Interface
99 /// @author MStar Semiconductor Inc.
100 ///////////////////////////////////////////////////////////////////////////////////////////////////
101 
102 #ifndef _DRV_GE_H_
103 #define _DRV_GE_H_
104 
105 //#include "MsTypes.h"
106 #include "MsDevice.h"
107 #if defined(MSOS_TYPE_LINUX_KERNEL)
108 #include "autoconf.h"
109 #endif
110 
111 #ifdef ANDROID
112 #include <sys/mman.h>
113 #include <cutils/ashmem.h>
114 #include <cutils/log.h>
115 #endif
116 /*ALOGI*/
117 
118 #ifdef __cplusplus
119 extern "C"
120 {
121 #endif
122 
123 #ifdef _DRV_GE_C_
124 #define GFX_INTERFACE
125 #else
126 #define GFX_INTERFACE extern
127 #endif
128 
129 #if defined(MSOS_TYPE_LINUX)
130     #include <sys/types.h>
131     #include <unistd.h>
132 #elif defined(MSOS_TYPE_LINUX_KERNEL)
133     #define getpid()                pInstance
134 #else
135 #define getpid() 0UL
136 #endif
137 
138 typedef enum
139 {
140     E_GE_POOL_ID_INTERNAL_REGISTER=0,
141     E_GE_POOL_ID_INTERNAL_VARIABLE=1,
142 
143     E_GE_POOL_ID_NUM,
144     E_GE_POOL_ID_MAX = E_GE_POOL_ID_NUM,
145 } eGEPoolID;
146 
147 // #define GFX Utopia2.0 capibility
148 GFX_INTERFACE void*   g_pGFXResource[E_GE_POOL_ID_NUM];
149 
150 //-------------------------------------------------------------------------------------------------
151 //  Driver Capability
152 //-------------------------------------------------------------------------------------------------
153 #define GE_PERFORMANCE_TEST         0UL
154 #define GE_MUTEX_DBG                0UL
155 
156 #define GFX_CRITIAL_MSG(x)      (x)       // for dump debug message
157 #define GFX_DEBUG_MSG(x)        (x)       // for dump debug message
158 
159 #if defined(CONFIG_API_GFX) || defined(CONFIG_API_GFX_MODULE)
160 #else
161 #define CONFIG_GFX_TEXTOUT
162 #define CONFIG_GFX_TRAPZOID
163 #endif
164 
165 //-------------------------------------------------------------------------------------------------
166 //  Macro and Define
167 //-------------------------------------------------------------------------------------------------
168 #define GFX_UTOPIA20                            1UL       //Using Ioctl
169 #define GE_API_MUTEX                            1UL       //Using API mutex lock/unlock;  other is Drv mutex lock/unlock
170 #define GE_SWTABLE                              0UL       //Using virtul table as value stored
171 #define GE_RESOURCE_SEM                         0UL       //Resource protect semaphore for Muti GE engine.
172 #define GE_PALETTE_NUM                          256UL
173 #define GE_FB_ADDR_MIU_MASK_BIT                 (1UL)
174 
175 #if (defined(MSOS_TYPE_NOS))||(defined(MSOS_TYPE_OPTEE))
176 #define GE_LOCK_SUPPORT             0UL   //This is for MHEG5 HW semephore
177 #else
178 #define GE_LOCK_SUPPORT             1UL
179 #endif
180 
181 #define GE_DRV_VERSION                  /* Character String for DRV/API version             */  \
182     MSIF_TAG,                           /* 'MSIF'                                           */  \
183     MSIF_CLASS,                         /* '00'                                             */  \
184     MSIF_CUS,                           /* 0x0000                                           */  \
185     MSIF_MOD,                           /* 0x0000                                           */  \
186     MSIF_CHIP,                                                                                  \
187     MSIF_CPU,                                                                                   \
188     {'G','E','_','_'},                  /* IP__                                             */  \
189     {'1','7'},                          /* 0.0 ~ Z.Z                                        */  \
190     {'0','2'},                          /* 00 ~ 99                                          */  \
191     {'0','0','5','5','2','5','0','9'},  /* CL#                                              */  \
192     MSIF_OS
193 
194 #define ByteSwap16(x) (((x) & 0x00ffUL) << 8 | ((x) & 0xff00UL) >> 8)
195 #define ByteSwap32(x) \
196     ((((x) & 0xff000000UL) >> 24) | (((x) & 0x00ff0000UL) >>  8) | \
197      (((x) & 0x0000ff00UL) <<  8) | (((x) & 0x000000ffUL) << 24))
198 
199 #define GE_BIT0                         0x01UL
200 #define GE_BIT1                         0x02UL
201 #define GE_BIT2                         0x04UL
202 #define GE_BIT3                         0x08UL
203 #define GE_BIT4                         0x10UL
204 #define GE_BIT5                         0x20UL
205 #define GE_BIT6                         0x40UL
206 #define GE_BIT7                         0x80UL
207 #define GE_BIT8                         0x0100UL
208 #define GE_BIT9                         0x0200UL
209 #define GE_BIT10                        0x0400UL
210 #define GE_BIT11                        0x0800UL
211 #define GE_BIT12                        0x1000UL
212 #define GE_BIT13                        0x2000UL
213 #define GE_BIT14                        0x4000UL
214 #define GE_BIT15                        0x8000UL
215 
216 #ifdef ANDROID
217     #define printf  ALOGI
218 #elif defined MSOS_TYPE_LINUX_KERNEL
219     #define printf  printk
220 #endif
221 
222 
223 #if GE_MUTEX_DBG
224     #define CMD(eCmd)                   printf("\33[0;34m [%s][%d] eCmd =%d\33[m;\n",__FUNCTION__,__LINE__, eCmd);
225 #else
226     #define CMD(eCmd)                   do{}while(0);
227 #endif
228 
229 #if GE_MUTEX_DBG//#if defined(GE_MUTEX_DBG)
230     #define _GE_MUXTEX_ENTRY(pGECtx , POOL_ID)\
231             printf("[1] [%s, %d] GE Prepare Get Mutex ID=%d [PID, TID]=[%x, %x]\n",__FUNCTION__,__LINE__, POOL_ID, getpid(), MsOS_GetOSThreadID());\
232                 GE_Get_Resource(pGECtx,TRUE);\
233             printf("    [%s, %d] GE Got Mutex ID=%d [PID, TID]=[%x, %x]\n",__FUNCTION__,__LINE__, POOL_ID, getpid(), MsOS_GetOSThreadID());
234 
235 
236     #define _GE_MUXTEX_RETURN(pGECtx, POOL_ID)\
237             printf("[0] [%s, %d] GE Prepare Free Mutex ID=%d [PID, TID]=[%x, %x] \n",__FUNCTION__,__LINE__, POOL_ID, getpid(), MsOS_GetOSThreadID());\
238                 GE_Free_Resource(pGECtx, TRUE);\
239             printf("    [%s, %d] GE Free Mutex ID=%d [PID, TID]=[%x, %x]\n",__FUNCTION__,__LINE__, POOL_ID, getpid(), MsOS_GetOSThreadID());
240 #else
241     #define _GE_MUXTEX_ENTRY(pGECtx, POOL_ID)\
242         if(POOL_ID == E_GE_POOL_ID_INTERNAL_VARIABLE)\
243             GE_Get_Resource(pGECtx,TRUE);
244 
245     #define _GE_MUXTEX_RETURN(pGECtx, POOL_ID)\
246         if(POOL_ID == E_GE_POOL_ID_INTERNAL_VARIABLE)\
247             GE_Free_Resource(pGECtx, TRUE);
248 #endif
249 
250 
251 #if GE_MUTEX_DBG
252     #define _GE_SEMAPHORE_ENTRY(pGECtx , POOL_ID)\
253             printf("[1] [%s, %d] GE Prepare Get Semaphore ID=%d [PID, TID]=[%x, %x]\n",__FUNCTION__,__LINE__, POOL_ID, getpid(), MsOS_GetOSThreadID());\
254             MDrv_GE_Get_Semaphore(pGECtx, POOL_ID);\
255             printf("    [%s, %d] GE Got Semaphore ID=%d [PID, TID]=[%x, %x]\n",__FUNCTION__,__LINE__, POOL_ID, getpid(), MsOS_GetOSThreadID());
256 
257 
258     #define _GE_SEMAPHORE_RETURN(pGECtx, POOL_ID)\
259             printf("[0] [%s, %d] GE Prepare Free Semaphore ID=%d [PID, TID]=[%x, %x]\n",__FUNCTION__,__LINE__, POOL_ID, getpid(), MsOS_GetOSThreadID());\
260             MDrv_GE_Free_Semaphore(pGECtx, POOL_ID);\
261             printf("    [%s, %d] GE Free Semaphore ID=%d [PID, TID]=[%x, %x]\n",__FUNCTION__,__LINE__, POOL_ID, getpid(), MsOS_GetOSThreadID());
262 #else
263     #define _GE_SEMAPHORE_ENTRY(pGECtx, POOL_ID)\
264         if(POOL_ID == E_GE_POOL_ID_INTERNAL_REGISTER)\
265         MDrv_GE_Get_Semaphore(pGECtx, POOL_ID);\
266 
267     #define _GE_SEMAPHORE_RETURN(pGECtx, POOL_ID)\
268         if(POOL_ID == E_GE_POOL_ID_INTERNAL_REGISTER)\
269         MDrv_GE_Free_Semaphore(pGECtx, POOL_ID);
270 #endif
271 
272 
273 #define TLB_ENRTY_MAPPING_SIZE    (32UL*1024UL*1024UL)
274 #ifndef MSOS_TYPE_LINUX_KERNEL
275 #define PAGE_SIZE           4096UL
276 #endif
277 #define TLB_PER_ENTRY_SIZE      4UL
278 #define TLB_ENRTY_COUNT     TLB_ENRTY_MAPPING_SIZE/PAGE_SIZE
279 #define TLB_ENRTY_SIZE      TLB_ENRTY_COUNT*TLB_PER_ENTRY_SIZE
280 
281 //-------------------------------------------------------------------------------------------------
282 //  Type and Structure
283 //-------------------------------------------------------------------------------------------------
284 
285 /// Define GE bitblt down-scaling caps
286 typedef struct
287 {
288     /// Bitblt down scale range start
289     MS_U8 u8RangeMax;
290     /// Bitblt down scale range end
291     MS_U8 u8RangeMin;
292     /// Bitblt down scale continuous range end
293     MS_U8 u8ContinuousRangeMin;
294     /// Is full range support down scaling.
295     /// - TRUE: The down scale value between u8RangeMax to u8RangeMin is fully supported.
296     /// - FALSE: The down scale value between u8RangeMax to u8ContinuousRangeMin is fully supported.
297     ///          The down scale value between u8ContinuousRangeMin to u8RangeMin is supported
298     ///          if the value is power of two (e.g., 4, 8, 16, and 32).
299     MS_BOOL bFullRangeSupport;
300 
301     /// Help Maintain Functions GE_SetBltScaleRatio/GE_CalcBltScaleRatio
302     /// 1>>u8ShiftRangeMax = u8RangeMax
303     MS_U8 u8ShiftRangeMax;
304     /// 1>>u8ShiftRangeMin = u8RangeMin
305     MS_U8 u8ShiftRangeMin;
306     /// 1>>u8ShiftContinuousRangeMin = u8ContinuousRangeMin
307     MS_U8 u8ShiftContinuousRangeMin;
308 }GE_BLT_DownScaleCaps;
309 
310 /// Define GE chip property for different chip characteristic.
311 typedef struct
312 {
313     MS_U16 WordUnit;
314     MS_BOOL bSupportFourePixelMode;
315     MS_BOOL bFourPixelModeStable;
316     MS_BOOL bSupportMultiPixel;
317     MS_BOOL bSupportSpiltMode;
318     MS_BOOL bSupportTLBMode;
319     MS_BOOL bSupportTwoSourceBitbltMode;
320     GE_BLT_DownScaleCaps BltDownScaleCaps;
321     MS_U16 MIUSupportMaxNUM;
322 }GE_CHIP_PROPERTY;
323 
324 ///Define GE Return Value
325 typedef enum
326 {
327     /// fail
328     E_GE_FAIL = 0,
329     /// success
330     E_GE_OK,
331     /// address error
332     E_GE_FAIL_ADDR,
333     /// pitch error
334     E_GE_FAIL_PITCH,
335     /// function parameter error
336     E_GE_FAIL_PARAM,
337 
338     /// not support
339     E_GE_NOT_SUPPORT,
340 
341     /// pixel format error
342     E_GE_FAIL_FORMAT,
343     /// bitblit start address error
344     E_GE_FAIL_BLTADDR,
345     /// bitblt overlap (if STRETCH, ITALIC, MIRROR, ROTATE)
346     E_GE_FAIL_OVERLAP,
347     /// stretch bitblt fail
348     E_GE_FAIL_STRETCH,
349     /// italic bitblt fail (if MIRROR, ROTATE)
350     E_GE_FAIL_ITALIC,
351 
352     /// engine is locked by others
353     E_GE_FAIL_LOCKED,
354 
355     /// primitive will not be drawn
356     E_GE_NOT_DRAW,
357 
358     /// Dependent functions are not linked
359     E_GE_NO_DEPENDENT,
360 
361     /// context not inited.
362     E_GE_CTXMAG_FAIL,
363 
364     E_GE_LAST_RESULT,
365 
366 } GE_Result;
367 
368 ///Define GE Init Configuration
369 typedef struct
370 {
371     MS_U8                         u8Miu;
372     MS_U8                         u8Dither;
373     MS_U32                        u32VCmdQSize;                       /// MIN:4K, MAX:512K, <MIN:Disable
374     MS_PHY                        PhyVCmdQAddr;                       // 8-byte aligned
375     MS_BOOL                       bIsHK;                              /// Running as HK or Co-processor
376     MS_BOOL                       bIsCompt;                           /// Running as compatible mode. In compatible mode, the parameter checking loose for NOS APP compatibility.  TRUE=>compatible with 51/Chakra , FALSE=>linux OS style
377 } GE_Config;
378 
379 
380 #define GE_FLAG_BLT_ROTATE_SHFT     16UL
381 #define GE_FLAG_BLT_ROTATE_MASK     (0x3UL << GE_FLAG_BLT_ROTATE_SHFT)
382 
383 ///Define GE Primitive Drawing Flags
384 typedef enum
385 {
386     /// Line color gradient enable, color is gradient by major-axis
387     E_GE_FLAG_LINE_CONSTANT         = 0x00000000,
388 
389     /// Line color gradient enable, color is gradient by major-axis
390     E_GE_FLAG_LINE_GRADIENT         = 0x00000001,
391 
392     /// Rectangle horizonal color gradient enable
393     E_GE_FLAG_RECT_GRADIENT_X       = 0x00000002,
394     /// Rectangle vertical color gradient enable
395     E_GE_FLAG_RECT_GRADIENT_Y       = 0x00000004,
396 
397     /// Trapezoid horizonal color gradient enable
398     E_GE_FLAG_TRAPEZOID_GRADIENT_X  = 0x00000010,
399     /// Rectangle vertical color gradient enable
400     E_GE_FLAG_TRAPEZOID_GRADIENT_Y  = 0x00000020,
401 
402     /// Trapezoid flag: top & bottom in X direction parallel Trapezoid, excluded with E_GE_FLAG_TRAPEZOID_Y
403     E_GE_FLAG_TRAPEZOID_X             = 0x00000040,
404     /// Trapezoid flag: top & bottom in Y direction parallel Trapezoid, excluded with E_GE_FLAG_TRAPEZOID_X
405     E_GE_FLAG_TRAPEZOID_Y             = 0x00000080,
406     /// Support SRC/DST RECT overlap
407     ///@note OVERLAP does not support BLT_STRETCH, BLT_MIRROR, BLT_ROTATE, and different SRC/DST buffers.
408     E_GE_FLAG_BLT_OVERLAP           = 0x00000100,
409 
410     /// Stretch bitblt enable
411     ///@note STRETCH does not support BLT_OVERLAP
412     E_GE_FLAG_BLT_STRETCH           = 0x00000200,
413 
414     /// Bitblt italic style enable
415     ///@note ITALIC does not support BLT_MIRROR, BLT_ROTATE, BLT_OVERLAP
416     E_GE_FLAG_BLT_ITALIC            = 0x00000400,
417 
418     /// Horizontal mirror
419     ///@note MIRROR does not support FMT_I1, FMT_I2, FMT_I4, BLT_ITALIC, BLT_OVERLAP
420     E_GE_FLAG_BLT_MIRROR_H          = 0x00001000,
421     /// Vertical mirror
422     E_GE_FLAG_BLT_MIRROR_V          = 0x00002000,
423 
424     E_GE_FLAG_BLT_DST_MIRROR_H      = 0x00004000,
425 
426     E_GE_FLAG_BLT_DST_MIRROR_V      = 0x00008000,
427 
428     /// 90 deree clockwise rotation
429     ///@note ROTATE does not support italic, BLT_OVERLAP
430     E_GE_FLAG_BLT_ROTATE_90         = (0x01 << GE_FLAG_BLT_ROTATE_SHFT),
431     /// 180 degree clockwise rotation
432     E_GE_FLAG_BLT_ROTATE_180        = (0x02 << GE_FLAG_BLT_ROTATE_SHFT),
433     /// 270 degree clockwise rotation
434     E_GE_FLAG_BLT_ROTATE_270        = (0x03 << GE_FLAG_BLT_ROTATE_SHFT),
435 
436     /// BLT_STRETCH by nearest filter (default: BILINEAR)
437     E_GE_FLAG_STRETCH_NEAREST       = 0x00100000,
438 //    E_GE_FLAG_STRETCH_CLAMP         = 0x00200000,
439 
440     // (RESERVED)
441     E_GE_FLAG_BUF_TILE              = 0x01000000,
442 
443     E_GE_FLAG_BYPASS_STBCOEF         = 0x02000000,
444 
445 } GE_Flag;
446 
447 
448 ///Define Buffer Format
449 typedef enum
450 {
451     /// color format I1
452     E_GE_FMT_I1                     = E_MS_FMT_I1,
453     /// color format I2
454     E_GE_FMT_I2                     = E_MS_FMT_I2,
455     /// color format I4
456     E_GE_FMT_I4                     = E_MS_FMT_I4,
457     /// color format palette 256(I8)
458     E_GE_FMT_I8                     = E_MS_FMT_I8,
459     /// color format blinking display
460     E_GE_FMT_FaBaFgBg2266           = E_MS_FMT_FaBaFgBg2266,
461     /// color format for blinking display format
462     E_GE_FMT_1ABFgBg12355           = E_MS_FMT_1ABFgBg12355,
463     /// color format RGB565
464     E_GE_FMT_RGB565                 = E_MS_FMT_RGB565,
465     /// color format ARGB1555
466     /// @note <b>[URANUS] <em>ARGB1555 is only RGB555</em></b>
467     E_GE_FMT_ARGB1555               = E_MS_FMT_ARGB1555,
468     /// color format ARGB4444
469     E_GE_FMT_ARGB4444               = E_MS_FMT_ARGB4444,
470     /// color format ARGB1555 DST
471     E_GE_FMT_ARGB1555_DST           = E_MS_FMT_ARGB1555_DST,
472     /// color format YUV422
473     E_GE_FMT_YUV422                 = E_MS_FMT_YUV422,
474     /// color format ARGB8888
475     E_GE_FMT_ARGB8888               = E_MS_FMT_ARGB8888,
476     /// color format RGBA5551
477     E_GE_FMT_RGBA5551                = E_MS_FMT_RGBA5551,
478      /// color format RGBA4444
479     E_GE_FMT_RGBA4444               = E_MS_FMT_RGBA4444,
480     /// color format ABGR8888
481     E_GE_FMT_ABGR8888                = E_MS_FMT_ABGR8888,
482     /// New Color Format
483     /// color format BGRA5551
484     E_GE_FMT_BGRA5551               = E_MS_FMT_BGRA5551,
485     /// color format ABGR1555
486     E_GE_FMT_ABGR1555               = E_MS_FMT_ABGR1555,
487     /// color format ABGR4444
488     E_GE_FMT_ABGR4444               = E_MS_FMT_ABGR4444,
489     /// color format BGRA4444
490     E_GE_FMT_BGRA4444               = E_MS_FMT_BGRA4444,
491     /// color format BGR565
492     E_GE_FMT_BGR565               = E_MS_FMT_BGR565,
493     /// color format RGBA8888
494     E_GE_FMT_RGBA8888               = E_MS_FMT_RGBA8888,
495     /// color format RGBA8888
496     E_GE_FMT_BGRA8888               = E_MS_FMT_BGRA8888,
497 
498     E_GE_FMT_GENERIC                = E_MS_FMT_GENERIC,
499 
500 } GE_BufFmt;
501 
502 //GE TLB Mode
503 typedef enum
504 {
505     /// TLB for None
506     E_GE_TLB_NONE = 0,
507     /// TLB for Source
508     E_GE_TLB_SRC = 1,
509     /// TLB for Destination
510     E_GE_TLB_DST = 2,
511     /// TLB for Source and Destination
512     E_GE_TLB_SRC_DST = 3,
513 }GE_TLB_Mode;
514 
515 ///Define Colorkey Mode
516 typedef enum
517 {
518     /// max(Asrc,Adst)
519     E_GE_ACMP_OP_MAX                = 0,
520     /// min(Asrc,Adst)
521     E_GE_ACMP_OP_MIN                = 1,
522 
523 } GE_ACmpOp;
524 
525 
526 ///Define Colorkey Mode
527 typedef enum
528 {
529     /// color in coler key range is keying.
530     E_GE_CK_EQ                      = 0, // Color EQ CK is color key
531     /// color NOT in color key range is keing.
532     E_GE_CK_NE                      = 1, // Color NE CK is color key
533     /// Alpha in coler key range is keying.
534     E_GE_ALPHA_EQ                   = 2, // Color EQ Alpha is color key
535     /// Alpha NOT in color key range is keing.
536     E_GE_ALPHA_NE                   = 3, // Color NE Alpha is color key
537 } GE_CKOp;
538 
539 
540 ///Define AlphaTest Mode
541 typedef enum
542 {
543     /// color in coler key range is keying.
544     E_GE_ATEST_EQ                   = 0, // Alpha EQ threshold
545     /// color NOT in color key range is keing.
546     E_GE_ATEST_NE                   = 1, // Alpha NE threshold
547 
548 } GE_ATestOp;
549 
550 
551 ///Define Raster Operation
552 typedef enum
553 {
554     /// rop_result = 0;
555     E_GE_ROP2_ZERO                  = 0,
556     /// rop_result = ~( rop_src | rop_dst );
557     E_GE_ROP2_NOT_PS_OR_PD          = 1,
558     /// rop_result = ((~rop_src) & rop_dst);
559     E_GE_ROP2_NS_AND_PD             = 2,
560     /// rop_result = ~(rop_src);
561     E_GE_ROP2_NS                    = 3,
562     /// rop_result = (rop_src & (~rop_dst));
563     E_GE_ROP2_PS_AND_ND             = 4,
564     /// rop_result = ~(rop_dst);
565     E_GE_ROP2_ND                    = 5,
566     /// rop_result = ( rop_src ^ rop_dst);
567     E_GE_ROP2_PS_XOR_PD             = 6,
568     /// rop_result = ~(rop_src & rop_dst);
569     E_GE_ROP2_NOT_PS_AND_PD         = 7,
570     /// rop_result = (rop_src & rop_dst);
571     E_GE_ROP2_PS_AND_PD             = 8,
572     /// rop_result = ~(rop_dst ^ rop_src);
573     E_GE_ROP2_NOT_PS_XOR_PD         = 9,
574     /// rop_result = rop_dst;
575     E_GE_ROP2_PD                    = 10,
576     /// rop_result = (rop_dst | (~rop_src));
577     E_GE_ROP2_NS_OR_PD              = 11,
578     /// rop_result = rop_src;
579     E_GE_ROP2_PS                    = 12,
580     /// rop_result = (rop_src | (~rop_dst));
581     E_GE_ROP2_PS_OR_ND              = 13,
582     /// rop_result = (rop_dst | rop_src);
583     E_GE_ROP2_PD_OR_PS              = 14,
584     /// rop_result = 0xffffff;
585     E_GE_ROP2_ONE                   = 15,
586 
587 } GE_Rop2;
588 
589 
590 ///Define Raster Operation
591 typedef enum
592 {
593     /// once
594     E_GE_LINPAT_REP1                = 0,
595     /// 2 repeat
596     E_GE_LINPAT_REP2                = 1,
597     /// 3 repeat
598     E_GE_LINPAT_REP3                = 2,
599     /// 4 repeat
600     E_GE_LINPAT_REP4                = 3,
601 
602 } GE_LinePatRep;
603 
604 
605 ///Define Blending Operation
606 typedef enum
607 {
608     /// Cout = Csrc * A + Cdst * (1-A)
609     /// 1
610     E_GE_BLEND_ONE                  = 0,
611     /// constant
612     E_GE_BLEND_CONST                = 1,
613     /// source alpha
614     E_GE_BLEND_ASRC                 = 2,
615     /// destination alpha
616     E_GE_BLEND_ADST                 = 3,
617 
618     /// Cout = ( Csrc * (Asrc*Aconst) + Cdst * (1-Asrc*Aconst) ) / 2
619     E_GE_BLEND_ROP8_ALPHA           = 4,
620     /// Cout = ( Csrc * (Asrc*Aconst) + Cdst * (1-Asrc*Aconst) ) / ( Asrc*Aconst + Adst*(1-Asrc*Aconst) )
621     E_GE_BLEND_ROP8_SRCOVER         = 5,
622     /// Cout = ( Csrc * (Asrc*Aconst) + Cdst * (1-Asrc*Aconst) ) / ( Asrc*Aconst * (1-Adst) + Adst )
623     ///@note
624     /// <b>[URANUS] <em>It does not support BLEND_ALPHA, BLEND_SRCOVER, BLEND_DSTOVER</em></b>
625     E_GE_BLEND_ROP8_DSTOVER         = 6,
626     /// Cout = ( Csrc * Aconst)
627     E_GE_BLEND_ALPHA_ADST           = 7,
628     /// Cout = Csrc * A + Cdst * (1-A)
629     /// 0
630     E_GE_BLEND_ZERO                 = 8,
631     /// 1 - constant
632     E_GE_BLEND_CONST_INV            = 9,
633     /// 1 - source alpha
634     E_GE_BLEND_ASRC_INV             = 10,
635     /// 1 - destination alpha
636     E_GE_BLEND_ADST_INV             = 11,
637     /// Csrc * Adst * Asrc * Aconst + Cdst * Adst * (1 - Asrc * Aconst)
638     E_GE_BLEND_SRC_ATOP_DST         = 12,
639     /// (Cdst * Asrc * Aconst * Adst + Csrc * Asrc * Aconst * (1 - Adst)) / ((Asrc * Aconst * (1 - Adst) + Asrc * Aconst * Adst)
640     E_GE_BLEND_DST_ATOP_SRC         = 13,
641     /// ((1 - Adst) * Csrc * Asrc * Aconst + Adst * Cdst * (1 - Asrc * Aconst)) / (Asrc * Aconst * (1 - Adst) + Adst * (1 - Asrc * Aconst))
642     E_GE_BLEND_SRC_XOR_DST          = 14,
643     /// Csrc * (1 - Aconst)
644     E_GE_BLEND_INV_CONST            = 15,
645 
646 } GE_BlendOp;
647 
648 
649 ///Define alpha output selection
650 typedef enum
651 {
652     /// constant
653     E_GE_ALPHA_CONST                = 0,
654     /// source alpha
655     E_GE_ALPHA_ASRC                 = 1,
656     /// destination alpha
657     E_GE_ALPHA_ADST                 = 2,
658     /// Aout = Asrc*Aconst
659     E_GE_ALPHA_ROP8_SRC             = 3,
660     /// Aout = Asrc*Aconst * Adst
661     E_GE_ALPHA_ROP8_IN              = 4,
662     /// Aout = (1-Asrc*Aconst) * Adst
663     E_GE_ALPHA_ROP8_DSTOUT          = 5,
664     /// Aout = (1-Adst) * Asrc*Aconst
665     E_GE_ALPHA_ROP8_SRCOUT          = 6,
666     /// Aout = (Asrc*Aconst) + Adst*(1-Asrc*Aconst) or (Asrc*Aconst)*(1-Adst) + Adst
667     E_GE_ALPHA_ROP8_OVER            = 7,
668     /// 1 - Aconst
669     E_GE_ALPHA_ROP8_INV_CONST       = 8,
670     /// 1 - Asrc
671     E_GE_ALPHA_ROP8_INV_ASRC        = 9,
672     /// 1 - Adst
673     E_GE_ALPHA_ROP8_INV_ADST        = 10,
674     /// Adst * Asrc * Aconst + Adst * (1 - Asrc * Aconst) A atop B
675     E_GE_ALPHA_ROP8_SRC_ATOP_DST    = 11,
676     /// Asrc * Aconst * Adst + Asrc * Aconst * (1 - Adst) B atop A
677     E_GE_ALPHA_ROP8_DST_ATOP_SRC    = 12,
678     /// (1 - Adst) * Asrc * Aconst + Adst * (1 - Asrc * Aconst) A xor B
679     E_GE_ALPHA_ROP8_SRC_XOR_DST     = 13,
680     /// Asrc * Asrc * Aconst + Adst * (1 - Asrc * Aconst)
681     E_GE_ALPHA_ROP8_INV_SRC_ATOP_DST= 14,
682     /// Asrc * (1 - Asrc * Aconst) + Adst * Asrc * Aconst
683     E_GE_ALPHA_ROP8_INV_DST_ATOP_SRC= 15,
684 } GE_AlphaSrc;
685 
686 
687 //-------------------------------------------------
688 /// Define Virtual Command Buffer Size
689 typedef enum
690 {
691     /// 4K
692     E_GE_VCMD_4K = 0,
693     /// 8K
694     E_GE_VCMD_8K = 1,
695     /// 16K
696     E_GE_VCMD_16K = 2,
697     /// 32K
698     E_GE_VCMD_32K = 3,
699     /// 64K
700     E_GE_VCMD_64K = 4,
701     /// 128K
702     E_GE_VCMD_128K = 5,
703     /// 256K
704     E_GE_VCMD_256K = 6,
705     /// 512K
706     E_GE_VCMD_512K = 7,
707     /// 1024k
708     E_GE_VCMD_1024K = 8,
709 } GE_VcmqBufSize;
710 
711 /// Define DFB Blending Related:
712 typedef enum
713 {
714     E_GE_DFB_BLD_FLAG_COLORALPHA         = 0x0001,
715     E_GE_DFB_BLD_FLAG_ALPHACHANNEL       = 0x0002,
716     E_GE_DFB_BLD_FLAG_COLORIZE           = 0x0004,
717     E_GE_DFB_BLD_FLAG_SRCPREMUL          = 0x0008,
718     E_GE_DFB_BLD_FLAG_SRCPREMULCOL       = 0x0010,
719     E_GE_DFB_BLD_FLAG_DSTPREMUL          = 0x0020,
720     E_GE_DFB_BLD_FLAG_XOR                 = 0x0040,
721     E_GE_DFB_BLD_FLAG_DEMULTIPLY         = 0x0080,
722     E_GE_DFB_BLD_FLAG_SRCALPHAMASK       = 0x0100,
723     E_GE_DFB_BLD_FLAG_SRCCOLORMASK       = 0x0200,
724     E_GE_DFB_BLD_FLAG_ALL                 = 0x03FF,
725 }GE_DFBBldFlag;
726 
727 typedef enum
728 {
729     E_GE_DFB_BLD_OP_ZERO               = 0,
730     E_GE_DFB_BLD_OP_ONE                = 1,
731     E_GE_DFB_BLD_OP_SRCCOLOR          = 2,
732     E_GE_DFB_BLD_OP_INVSRCCOLOR       = 3,
733     E_GE_DFB_BLD_OP_SRCALPHA          = 4,
734     E_GE_DFB_BLD_OP_INVSRCALPHA       = 5,
735     E_GE_DFB_BLD_OP_DESTALPHA         = 6,
736     E_GE_DFB_BLD_OP_INVDESTALPHA      = 7,
737     E_GE_DFB_BLD_OP_DESTCOLOR         = 8,
738     E_GE_DFB_BLD_OP_INVDESTCOLOR      = 9,
739     E_GE_DFB_BLD_OP_SRCALPHASAT       = 10,
740 }GE_DFBBldOP;
741 
742 ///Define POINT
743 typedef struct
744 {
745     MS_U16                          x;
746     MS_U16                          y;
747 
748 } GE_Point;
749 
750 
751 ///Define the RECT
752 typedef struct
753 {
754     /// X start address
755     MS_U16                          x;
756     /// Y start address
757     MS_U16                          y;
758     /// width
759     MS_U16                          width;
760     /// height
761     MS_U16                          height;
762 
763 } GE_Rect;
764 
765 /*******************************************************************
766 // Define the Trapezoid                                            *
767 // [u16X0, u16Y0]: The Left point of top of Trapezoid;             *
768 // [u16X1, u16Y1]: The Left point of bottom of Trapezoid;          *
769 // [u16DeltaTop]: The Width of top of Trapezoid;                   *
770 // [u16DeltaBottom]: The Width of bottom of Trapezoid;             *
771 ********************************************************************/
772 typedef struct
773 {
774     /// x0 start address
775     MS_U16                          u16X0;
776     /// y0 start address
777     MS_U16                          u16Y0;
778     /// x1 start address
779     MS_U16                          u16X1;
780     /// y1 start address
781     MS_U16                          u16Y1;
782     /// delta of Top
783     MS_U16                          u16DeltaTop;
784     // delta of Bottom
785     MS_U16                          u16DeltaBottom;
786 } GE_Trapezoid;
787 
788 /****************************************************************************
789 *** Define the Normalized Implement definition of Trapezoid                 *
790 // [u16X0, u16Y0]: The Top-Left point of Trapezoid;                         *
791 // [u16X1]: DIRECTION_X-X of Top-Right Point; DIRECTION_Y-X of Bottom Edge; *
792 // [u16Y1]: DIRECTION_X-Y of Bottom Edge; DIRECTION_Y-Y of Top-Right Point; *
793 // [u32DeltaL]: The Delta Ratio of Left Edge;                               *
794 // [u32DeltaR]: The Delta Ratio of Right Edge;                              *
795 ****************************************************************************/
796 typedef struct
797 {
798     /// x0 start address
799     MS_U16                          u16X0;
800     /// y0 start address
801     MS_U16                          u16Y0;
802     /// x1 start address
803     MS_U16                          u16X1;
804     /// y1 start address
805     MS_U16                          u16Y1;
806     /// delta of x0
807     MS_U32                          u32DeltaL;
808     // delta of x1
809     MS_U32                          u32DeltaR;
810 } GE_Normalized_Trapezoid;
811 
812 typedef struct
813 {
814     /// Destination block
815     union
816     {
817         GE_Rect dstblk;
818         GE_Trapezoid dsttrapeblk;
819     };
820 
821 }GE_DstBitBltType;
822 
823 
824 ///Define the RECT
825 typedef struct
826 {
827     /// STBB INIT X
828     MS_U32                          init_x;
829     /// STBB INIT Y
830     MS_U32                          init_y;
831     /// STBB X
832     MS_U32                          x;
833     /// STBB Y
834     MS_U32                          y;
835 
836 } GE_ScaleInfo;
837 
838 
839 ///Define Buffer Format Information
840 typedef struct
841 {
842     /// Specified format
843     GE_BufFmt                       fmt;
844 
845     /// Base alignment in byte unit
846     MS_U8                           u8BaseAlign;
847     /// Pitch alignment in byte unit
848     MS_U8                           u8PitchAlign;
849     /// Non-1p mode base/pitch alignment in byte unit
850     MS_U8                           u8Non1pAlign;
851     /// Height alignment in pixel unit <b>(RESERVED)</b>
852     MS_U8                           u8HeightAlign;
853     /// StretchBlt base/pitch alignment in byte unit
854     MS_U8                           u8StretchAlign;
855     /// Tile mode base alignment in byte unit <b>(RESERVED)</b>
856     MS_U8                           u8TileBaseAlign;
857     /// Tile mode width alignment in pixel unit <b>(RESERVED)</b>
858     MS_U8                           u8TileWidthAlign;
859     /// Tile mode height alignment in pixel unit <b>(RESERVED)</b>
860     MS_U8                           u8TileHeightAlign;
861 
862     /// Format capability flags <b>(RESERVED)</b>
863     MS_U32                          u32CapFlags;
864 
865 } GE_FmtCaps;
866 
867 
868 ///Define Src/Dst Buffer Information
869 typedef struct
870 {
871     /// Specified format
872     GE_BufFmt                       srcfmt;
873     /// Specified format
874     GE_BufFmt                       dstfmt;
875     /// Base alignment in byte unit
876     MS_U16                          srcpit;
877     /// Pitch alignment in byte unit
878     MS_U16                          dstpit;
879     /// Height alignment in pixel unit <b>(RESERVED)</b>
880     MS_PHY                        srcaddr;
881     /// StretchBlt base/pitch alignment in byte unit
882     MS_PHY                        dstaddr;
883     /// GE TLB Mode
884     GE_TLB_Mode                     tlbmode;
885     /// GE TLB Entry source base address
886     MS_PHY                        tlbsrcaddr;
887     /// GE TLB Entry destination base address
888     MS_PHY                        tlbdstaddr;
889     /// GE TLB Entry Flush Table
890     MS_BOOL                         bEnflushtlbtable;
891 } GE_BufInfo;
892 
893 
894 /// GE dbg info
895 typedef struct
896 {
897     /// Specified format
898     MS_U8                       verctrl[32];
899     /// Specified format
900     MS_U16                       gedump[0x80];
901     /// Base alignment in byte unit
902     MS_U32                      semstaus;
903 } GE_DbgInfo;
904 
905 
906 typedef struct
907 {
908     MS_PHY PhyAddr;
909     GE_VcmqBufSize enBufSize;
910 } GE_VcmqBuffer;
911 
912 
913 /// GE SHM info
914 typedef struct
915 {
916     /// Upon evey init of shm handle, the counter will be increased by 1
917     MS_U32                       u32cnt;
918     /// Last entity id which invoke the GE semaphore.
919     MS_U32                       u32shmid;
920 } __attribute__((__packed__)) GE_ShmInfo;
921 
922 
923 //-------------------------------------------------
924 /// Define RGB color in LE
925 typedef struct
926 {
927     /// Blue
928     MS_U8 b;
929     /// Green
930     MS_U8 g;
931     /// Red
932     MS_U8 r;
933     /// Alpha
934     MS_U8 a;
935 } GE_RgbColor;
936 
937 
938 //-------------------------------------------------
939 /// Specify the blink data
940         //          1 A B Fg Bg
941         //          1 2 3  5  5
942 typedef struct
943 {
944     /// BG color (for blink mode use)
945     MS_U8                  background;             // 5 bits
946     /// FG color (for blink mode use)
947     MS_U8                  foreground;             // 5 bits
948     /// Control flag\n
949     union{
950         MS_U16             ctrl_flag;
951         struct{
952             MS_U16         Blink:3;                // 3 bits
953             MS_U16         Alpha:2;                // 2 bits
954             MS_U16         blink_en:1;
955             MS_U16         reserved1:10;
956         } Bits;
957         struct{
958             MS_U16 BlinkAlpha:4;
959             MS_U16 Alpha:2;
960             MS_U16 Blink:3;
961             MS_U16 reserved:7;
962         }Bits2;
963         struct{
964             MS_U16 Fa:2;
965             MS_U16 Ba:2;
966             MS_U16 reserved:12;
967 
968         }Bits3;
969     };
970 
971 
972 } GE_BlinkData;
973 
974 
975 /// define MHEG5 draw oval information
976 typedef struct
977 {
978     /// dst block info
979     GE_Rect       dstBlock;
980     /// Color format
981     GE_BufFmt fmt;
982     union
983     {
984         GE_RgbColor color;
985         GE_BlinkData blink_data;
986     };
987     MS_U32 u32LineWidth;
988 } GE_OVAL_FILL_INFO;
989 
990 
991 ///Define Buffer Usage Type
992 typedef enum
993 {
994     /// Desitination buffer for LINE, RECT, BLT
995     E_GE_BUF_DST                    = 0,
996     /// Source buffer for BLT
997     E_GE_BUF_SRC                    = 1,
998 } GE_BufType;
999 
1000 
1001 ///Define RGB2YUV conversion formula
1002 typedef enum
1003 {
1004     E_GE_YUV_RGB2YUV_PC             = 0,
1005     E_GE_YUV_RGB2YUV_255            = 1,
1006 
1007 } GE_Csc_Rgb2Yuv;
1008 
1009 ///Define output YUV color domain
1010 typedef enum
1011 {
1012     E_GE_YUV_OUT_255                = 0,
1013     E_GE_YUV_OUT_PC                 = 1,
1014 
1015 } GE_YUV_OutRange;
1016 
1017 ///Define input YUV color domain
1018 typedef enum
1019 {
1020     E_GE_YUV_IN_255                 = 0,
1021     E_GE_YUV_IN_127                 = 1,
1022 
1023 } GE_YUV_InRange;
1024 
1025 ///Define YOU 422 format
1026 typedef enum
1027 {
1028     E_GE_YUV_YVYU                   = 0,
1029     E_GE_YUV_YUYV                   = 1,
1030     E_GE_YUV_VYUY                   = 2,
1031     E_GE_YUV_UYVY                   = 3,
1032 
1033 } GE_YUV_422;
1034 
1035 ///Define paramter for YUV operation
1036 typedef struct
1037 {
1038     GE_Csc_Rgb2Yuv                  rgb2yuv;
1039     GE_YUV_OutRange                 out_range;
1040     GE_YUV_InRange                  in_range;
1041     GE_YUV_422                      dst_fmt;
1042     GE_YUV_422                      src_fmt;
1043 
1044 } GE_YUVMode;
1045 
1046 
1047 typedef enum
1048 {
1049     E_GE_WP_IN_RANGE                = 0,
1050     E_GE_WP_OUT_RANGE               = 1,
1051     E_GE_WP_DISABLE                 = 0xFF,
1052 
1053 } GE_WPType;
1054 
1055 
1056 typedef struct
1057 {
1058    void*            pInstance;
1059    MS_U32           u32GE_DRV_Version;
1060    MS_BOOL          bGEMode4MultiProcessAccess;
1061    MS_S32           s32CurrentProcess;
1062    MS_S32           s32CurrentThread;
1063    GE_BufInfo       pBufInfo;
1064 }GE_Context;
1065 
1066 
1067 typedef struct
1068 {
1069     MS_U32              flags;
1070     GE_Rect             src;
1071     GE_DstBitBltType    dst;
1072     GE_ScaleInfo*       scaleinfo;
1073 }PatchBitBltInfo;
1074 
1075 typedef enum
1076 {
1077    E_GE_DONOTHING = 0,
1078    E_GE_NEAREST = 1,
1079    E_GE_REPLACE_KEY_2_CUS = 2,
1080 
1081 }GE_StretchCKType;
1082 
1083 typedef enum
1084 {
1085     E_GE_ROTATE_0 = 0,
1086     E_GE_ROTATE_90 = 1,
1087     E_GE_ROTATE_180 = 2,
1088     E_GE_ROTATE_270 = 3,
1089 } GE_RotateAngle;
1090 
1091 typedef struct
1092 {
1093     MS_U16 GE0_Reg[0x80];
1094     MS_U16 GETLB_Reg[0x80];
1095     MS_U16 GECLK_Reg;
1096     MS_U32 GEPalette[256];
1097 }GE_STR_SAVE_AREA;
1098 
1099 typedef enum
1100 {
1101     E_GE_SAVE_REG_GE_EN        = 0x1000,
1102     E_GE_RESTORE_REG_GE_EN     = 0x2000,
1103     E_GE_DISABLE_REG_EN        = 0x3000,
1104 }GE_RESTORE_REG_ACTION;
1105 //-------------------------------------------------------------------------------------------------
1106 //  Function and Variable
1107 //-------------------------------------------------------------------------------------------------
1108 
1109 // GE Draw Functions
1110 GE_Result GE_Get_Resource(GE_Context *pGECtx, MS_BOOL bHWSemLock);
1111 GE_Result GE_Free_Resource(GE_Context *pGECtx, MS_BOOL bHWSemLock);
1112 
1113 
1114 void MDrv_GE_Exit(void* pInstance);
1115 GE_Result MDrv_GE_Reset(GE_Context *pGECtx);
1116 GE_Result MDrv_GE_SetDither(GE_Context *pGECtx, MS_BOOL enable);
1117 GE_Result MDrv_GE_SetOnePixelMode(GE_Context *pGECtx, MS_BOOL enable);
1118 GE_Result MDrv_GE_SetSrcColorKey(GE_Context *pGECtx, MS_BOOL enable, GE_CKOp ck_mode, MS_U32 ck_low, MS_U32 ck_high);
1119 GE_Result MDrv_GE_SetDstColorKey(GE_Context *pGECtx, MS_BOOL enable, GE_CKOp ck_mode, MS_U32 ck_low, MS_U32 ck_high);
1120 GE_Result MDrv_GE_SetIntensity(GE_Context *pGECtx, MS_U32 id, MS_U32 color);
1121 GE_Result MDrv_GE_GetIntensity(GE_Context *pGECtx, MS_U32 id, MS_U32 *color);
1122 GE_Result MDrv_GE_SetROP2(GE_Context *pGECtx, MS_BOOL enable, GE_Rop2 eRop2);
1123 GE_Result MDrv_GE_SetLinePattern(GE_Context *pGECtx, MS_BOOL enable, MS_U8 pattern, GE_LinePatRep eRep);
1124 GE_Result MDrv_GE_ResetLinePattern(GE_Context *pGECtx);
1125 GE_Result MDrv_GE_SetAlphaBlend(GE_Context *pGECtx, MS_BOOL enable, GE_BlendOp eBlendCoef);
1126 GE_Result MDrv_GE_SetAlphaBlendCoef(GE_Context *pGECtx, GE_BlendOp eBlendOp);
1127 GE_Result MDrv_GE_SetAlphaSrc(GE_Context *pGECtx, GE_AlphaSrc eAlphaSrc);
1128 GE_Result MDrv_GE_SetAlphaCmp(GE_Context *pGECtx, MS_BOOL enable, GE_ACmpOp eACmpOp);
1129 GE_Result MDrv_GE_SetAlphaTest(GE_Context *pGECtx, MS_BOOL enable, GE_ATestOp ck_mode, MS_U8 a_low, MS_U8 a_high);
1130 GE_Result MDrv_GE_SetAlphaConst(GE_Context *pGECtx, MS_U8 u8AlphaConst);
1131 GE_Result MDrv_GE_QueryDFBBldCaps(GE_Context *pGECtx, MS_U16 *pU16SupportedBldFlags);
1132 GE_Result MDrv_GE_EnableDFBBlending(GE_Context *pGECtx, MS_BOOL enable);
1133 GE_Result MDrv_GE_SetDFBBldFlags(GE_Context *pGECtx, MS_U16 u16DFBBldFlags);
1134 GE_Result MDrv_GE_SetDFBBldOP(GE_Context *pGECtx, GE_DFBBldOP geSrcBldOP, GE_DFBBldOP geDstBldOP);
1135 GE_Result MDrv_GE_SetDFBBldConstColor(GE_Context *pGECtx, GE_RgbColor geRgbColor);
1136 GE_Result MDrv_GE_SetDFBBldSrcColorMask(GE_Context *pGECtx, GE_RgbColor geRgbColor);
1137 GE_Result MDrv_GE_EnableTrapezoidAA(GE_Context *pGECtx, MS_BOOL bEnable);
1138 GE_Result MDrv_GE_EnableTrapSubPixCorr(GE_Context *pGECtx, MS_BOOL bEnable);
1139 GE_Result MDrv_GE_SetClipWindow(GE_Context *pGECtx, GE_Rect *rect);
1140 GE_Result MDrv_GE_GetClipWindow(GE_Context *pGECtx, GE_Rect *rect);
1141 GE_Result MDrv_GE_SetItalic(GE_Context *pGECtx, MS_U8 x_offset, MS_U8 y_offset, MS_U8 delta);
1142 GE_Result MDrv_GE_SetPalette(GE_Context *pGECtx, MS_U16 start, MS_U16 num, MS_U32 *palette);
1143 GE_Result MDrv_GE_GetPalette(GE_Context *pGECtx, MS_U16 start, MS_U16 num, MS_U32 *palette);
1144 GE_Result MDrv_GE_SetYUVMode(GE_Context *pGECtx, GE_YUVMode *mode);
1145 GE_Result MDrv_GE_SetSrcBuffer(GE_Context *pGECtx, GE_BufFmt src_fmt, MS_U16 pix_width, MS_U16 pix_height, MS_PHY addr, MS_U16 pitch, MS_U32 flags);
1146 GE_Result MDrv_GE_SetDstBuffer(GE_Context *pGECtx, GE_BufFmt dst_fmt, MS_U16 pix_width, MS_U16 pix_height, MS_PHY addr, MS_U16 pitch, MS_U32 flags);
1147 GE_Result MDrv_GE_DrawLine(GE_Context *pGECtx, GE_Point *v0, GE_Point *v1, MS_U32 color, MS_U32 color2, MS_U32 flags, MS_U32 width);
1148 GE_Result MDrv_GE_FillRect(GE_Context *pGECtx, GE_Rect *rect, MS_U32 color, MS_U32 color2, MS_U32 flags);
1149 GE_Result MDrv_GE_FillTrapezoid(GE_Context *pGECtx,GE_Trapezoid *pGeTrapezoid, MS_U32 u32ColorS, MS_U32 u32ColorE, MS_U32 u32Flags);
1150 GE_Result MDrv_GE_WaitIdle(GE_Context *pGECtx);
1151 GE_Result MDrv_GE_GetBufferInfo(GE_Context *pGECtx, GE_BufInfo *bufinfo);
1152 GE_Result MDrv_GE_BitBltEX(GE_Context *pGECtx,GE_Rect *src, GE_DstBitBltType *dst, MS_U32 flags, GE_ScaleInfo* scaleinfo);
1153 GE_Result MDrv_GE_BitBltEX_Trape(GE_Context *pGECtx,GE_Rect *pSrcRect, GE_DstBitBltType *pDstRect, MS_U32 u32Flags, GE_ScaleInfo* pScaleinfo);
1154 GE_Result MDrv_GE_BitBltByTwoSourceBuffer(GE_Context *pGECtx, GE_BufFmt dst_fmt, GE_Rect *pSrc0Rect, GE_Rect *pSrc1Rect, GE_Rect *pDestRect, MS_PHY addr, MS_U16 pitch, MS_U32 flags, GE_ScaleInfo* scaleinfo);
1155 // GE Utility Functions
1156 GE_Result MDrv_GE_GetFmtCaps(GE_Context *pGECtx, GE_BufFmt fmt, GE_BufType type, GE_FmtCaps *caps);
1157 GE_Result MDrv_GE_Init(void* pInstance, GE_Config *cfg, GE_Context **ppGECtx);
1158 GE_Result MDrv_GE_GetConfig(GE_Config *cfg);
1159 GE_Result MDrv_GE_WriteProtect(GE_Context *pGECtx, MS_U8 miu, MS_PHY addr_low, MS_PHY addr_high, GE_WPType eWPType);
1160 GE_Result MDrv_GE_SetAlpha_ARGB1555(GE_Context *pGECtx, MS_U8 coef);
1161 GE_Result MDrv_GE_GetAlpha_ARGB1555(GE_Context *pGECtx, MS_U8* coef);
1162 
1163 GE_Result MDrv_GE_SetTAGID(GE_Context *pGECtx, MS_U16 u16tag);
1164 GE_Result MDrv_GE_GetTAGID(GE_Context *pGECtx, MS_U16* u16tag);
1165 GE_Result MDrv_GE_WaitTAGID(GE_Context *pGECtx, MS_U16 tagID);
1166 GE_Result MDrv_GE_PollingTAGID(GE_Context *pGECtx, MS_U16 tagID);
1167 GE_Result MDrv_GE_GetNextTAGID(GE_Context *pGECtx, MS_BOOL bStepTagBefore, MS_U16* u16NextTagID);
1168 GE_Result MDrv_GE_SetNextTAGID(GE_Context *pGECtx, MS_U16 *tagID);
1169 GE_Result MDrv_GE_SetDbgLevel(GE_Context *pGECtx, MS_U32 level);
1170 GE_Result MDrv_GE_GetInfo(GE_Context *pGECtx, GE_DbgInfo* dbg);
1171 #ifdef CONFIG_UTOPIA_PROC_DBG_SUPPORT
1172 GE_Result MDrv_GE_GetGFXMdbInfo(GE_Context *pGECtx, MS_U64 *u64ReqHdl);
1173 #endif
1174 GE_Result MDrv_GE_GetStatus(GE_Context *pGECtx, MS_BOOL* bstatus);
1175 GE_Result MDrv_GE_EnableVCmdQueue(GE_Context *pGECtx, MS_U16 blEnable);
1176 GE_Result MDrv_GE_SetVCmdBuffer(GE_Context *pGECtx, MS_PHY PhyAddr, GE_VcmqBufSize enBufSize);
1177 GE_Result MDrv_GE_SetVCmd_W_Thread(GE_Context *pGECtx, MS_U8 u8W_Threshold);
1178 GE_Result MDrv_GE_SetVCmd_R_Thread(GE_Context *pGECtx, MS_U8 u8R_Threshold);
1179 GE_Result MDrv_GE_GetLibVer(GE_Context *pGECtx, const MSIF_Version **ppVersion);
1180 MS_U32    GE_Divide2Fixed(MS_U16 u16x, MS_U16 u16y, MS_U8 nInteger, MS_U8 nFraction);
1181 GE_Result MDrv_GE_SetStrBltSckType(GE_Context *pGECtx,GE_StretchCKType TYPE, MS_U32 *CLR);
1182 GE_Result MDrv_GE_Get_GetHK(GE_Context *pGECtx, MS_BOOL *bIsHK) ;
1183 GE_Result MDrv_GE_Set_SetHK(GE_Context *pGECtx, MS_BOOL bIsHK) ;
1184 GE_Result MDrv_GE_DrawOval(GE_Context *pGECtx, GE_OVAL_FILL_INFO* pOval);
1185 MS_U8  _GFXAPI_MIU_ID(MS_PHY ge_fbaddr);
1186 MS_PHY _GFXAPI_PHYS_ADDR_IN_MIU(MS_PHY ge_fbaddr) ;
1187 MS_PHY _GFXAPI_PHYS_ADDR_2_API(MS_U8 u8MIUId, MS_PHY ge_addrInMIU);
1188 GE_Result MDrv_GE_SetClock(GE_Context *pGECtx, MS_BOOL bEnable);
1189 GE_Result MDrv_GE_BitbltPerformance(GE_Context *pGECtx);
1190 GE_Result MDrv_GE_Chip_Proprity_Init(GE_Context *pGECtx, GE_CHIP_PROPERTY **pGeChipPro);
1191 MS_BOOL _GE_TextOutPatch(GE_Context *pGECtx);
1192 GE_Result MDrv_GE_SetPowerState(GE_Context *pGECtx, EN_POWER_MODE u16PowerState, void* pModule);
1193 GE_Result MDrv_GE_STR_SetPowerState(EN_POWER_MODE u16PowerState, void* pModule);
1194 GE_Result MDrv_GE_SetTLBMode(GE_Context *pGECtx, GE_TLB_Mode tlb_type);
1195 GE_Result MDrv_GE_SetTLBSrcBaseAddr(GE_Context *pGECtx, MS_PHY phyaddr);
1196 GE_Result MDrv_GE_SetTLBDstBaseAddr(GE_Context *pGECtx, MS_PHY phyaddr);
1197 GE_Result MDrv_GE_TLBFlushTable(GE_Context *pGECtx,MS_BOOL bEnable);
1198 GE_Result MDrv_GE_SetTLBTag(GE_Context *pGECtx,MS_U16 tag);
1199 GE_Result MDrv_GE_GetTLBSRCADDR(GE_Context *pGECtx, MS_PHY* addr);
1200 GE_Result MDrv_GE_GetTLBDSTADDR(GE_Context *pGECtx, MS_PHY* addr);
1201 GE_Result MDrv_GE_StopTLBFlush(GE_Context *pGECtx);
1202 GE_Result MDrv_GE_SetBurstMiuLen(GE_Context *pGECtx,MS_BOOL bEnable,MS_U32 u32BurstLen);
1203 GE_Result MDrv_GE_RestoreRegInfo(GE_Context *pGECtx,GE_RESTORE_REG_ACTION eRESTORE_ACTION,MS_U16 *value);
1204 
1205 #ifdef __cplusplus
1206 }
1207 #endif
1208 
1209 
1210 
1211 #endif // _DRV_GE_H_
1212 
1213