xref: /utopia/UTPA2-700.0.x/mxlib/include/apiDMS_Type.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   apiDMS.h
98 /// @brief  DMS Interface
99 /// @author MStar Semiconductor Inc.
100 ///////////////////////////////////////////////////////////////////////////////////////////////////
101 
102 #ifndef _API_DMS_TYPE_H_
103 #define _API_DMS_TYPE_H_
104 
105 #include "MsCommon.h"
106 #include "MsDevice.h"
107 
108 #ifdef __cplusplus
109 extern "C" {
110 #endif
111 #include "UFO.h"
112 //-------------------------------------------------------------------------------------------------
113 //  Macro and Define
114 //-------------------------------------------------------------------------------------------------
115 // library information
116 #define MSIF_DMS_LIB_CODE               {'M','W','S','_'}
117 #define MSIF_DMS_LIBVER                 {'0','0'}
118 #define MSIF_DMS_BUILDNUM               {'0','0'}
119 #define MSIF_DMS_CHANGELIST             {'0','0','0','0','0','0','0','1'}
120 
121 #define DMS_API_VERSION                 /* Character String for DRV/API version             */  \
122     MSIF_TAG,                           /* 'MSIF'    */  \
123     MSIF_CLASS,                         /* '00'      */  \
124     MSIF_CUS,                           /* 0x0000    */  \
125     MSIF_MOD,                           /* 0x0000    */  \
126     MSIF_CHIP,                                           \
127     MSIF_CPU,                                            \
128     MSIF_DMS_LIB_CODE  ,                /* IP__      */  \
129     MSIF_DMS_LIBVER    ,                /* 0.0 ~ Z.Z */  \
130     MSIF_DMS_BUILDNUM  ,                /* 00 ~ 99   */  \
131     MSIF_DMS_CHANGELIST,                /* CL#       */  \
132     MSIF_OS
133 
134 #define VERSION_ST_DMS_DISPFRAMEFORMAT      1
135 #define VERSION_ST_DMS_COLORDESCRIPTION     1
136 #define VERSION_ST_DMS_DOLBYHDRINFO         1
137 #define VERSION_ST_DMS_HDRINFO              1
138 #define VERSION_ST_DMS_DISP_FRM_INFO_EXT    1
139 #define VERSION_ST_DMS_COLORHWFORMAT        1
140 #define VERSION_ST_DMS_COLORSWFORMAT        1
141 #define VERSION_ST_DMS_FRAMEFORMAT          1
142 
143 #define VERSION_ST_DMS_INITDATA             1
144 #define VERSION_ST_DMS_SETWIN_INFO          1
145 #define VERSION_ST_DMS_GETWIN_INFO          1
146 
147 //-------------------------------------------------------------------------------------------------
148 //  Type and Structure
149 //-------------------------------------------------------------------------------------------------
150 /// Define return value of MApi_DMS
151 typedef enum
152 {
153     E_DMS_FAIL = 0,
154     E_DMS_OK = 1,
155 } EN_DMS_RESULT;
156 
157 typedef enum
158 {
159     E_DMS_DISP_FRM_INFO_EXT_TYPE_10BIT,                // in MVC case it is L view 2 bit
160     E_DMS_DISP_FRM_INFO_EXT_TYPE_INTERLACE = 1,        // interlace bottom 8bit will share the same enum value
161     E_DMS_DISP_FRM_INFO_EXT_TYPE_DOLBY_EL = 1,         // with dolby enhance layer 8bit
162     E_DMS_DISP_FRM_INFO_EXT_TYPE_10BIT_INTERLACE = 2,  // interlace bottom 2bit will share the same enum
163     E_DMS_DISP_FRM_INFO_EXT_TYPE_10BIT_DOLBY_EL = 2,   // value with dolby enhance layer 2bit
164     E_DMS_DISP_FRM_INFO_EXT_TYPE_10BIT_MVC,            // R view 2 bit
165     E_DMS_DISP_FRM_INFO_EXT_TYPE_INTERLACE_MVC,
166     E_DMS_DISP_FRM_INFO_EXT_TYPE_10BIT_INTERLACE_MVC = 5, // MVC interlace R-View 2bit will share the
167     E_DMS_DISP_FRM_INFO_EXT_TYPE_DOLBY_META = 5,          // same enum with dolby meta data
168     E_DMS_DISP_FRM_INFO_EXT_TYPE_MFCBITLEN,
169     E_DMS_DISP_FRM_INFO_EXT_TYPE_MFCBITLEN_MVC,
170     E_DMS_DISP_FRM_INFO_EXT_TYPE_MAX,
171 } EN_DMS_DISP_FRM_INFO_EXT_TYPE;
172 
173 typedef enum
174 {
175     E_DMS_CODEC_TYPE_NONE,
176     E_DMS_CODEC_TYPE_MPEG2,
177     E_DMS_CODEC_TYPE_H263,
178     E_DMS_CODEC_TYPE_MPEG4,
179     E_DMS_CODEC_TYPE_DIVX311,
180     E_DMS_CODEC_TYPE_DIVX412,
181     E_DMS_CODEC_TYPE_FLV,
182     E_DMS_CODEC_TYPE_VC1_ADV,
183     E_DMS_CODEC_TYPE_VC1_MAIN,
184     E_DMS_CODEC_TYPE_RV8,
185     E_DMS_CODEC_TYPE_RV9,
186     E_DMS_CODEC_TYPE_H264,
187     E_DMS_CODEC_TYPE_AVS,
188     E_DMS_CODEC_TYPE_MJPEG,
189     E_DMS_CODEC_TYPE_MVC,
190     E_DMS_CODEC_TYPE_VP8,
191     E_DMS_CODEC_TYPE_HEVC,
192     E_DMS_CODEC_TYPE_VP9,
193     E_DMS_CODEC_TYPE_HEVC_DV,
194     E_DMS_CODEC_TYPE_MAX,
195 } EN_DMS_CODECTYPE;
196 
197 typedef enum
198 {
199     E_DMS_FRAME_TYPE_I,
200     E_DMS_FRAME_TYPE_P,
201     E_DMS_FRAME_TYPE_B,
202     E_DMS_FRAME_TYPE_OTHER,
203     E_DMS_FRAME_TYPE_MAX,
204 } EN_DMS_FRAMETYPE;
205 
206 typedef enum
207 {
208     E_DMS_FIELD_TYPE_NONE,
209     E_DMS_FIELD_TYPE_TOP,
210     E_DMS_FIELD_TYPE_BOTTOM,
211     E_DMS_FIELD_TYPE_BOTH,
212     E_DMS_FIELD_TYPE_MAX,
213 } EN_DMS_FIELDTYPE;
214 
215 typedef enum
216 {
217     E_DMS_VIEW_TYPE_CENTER,
218     E_DMS_VIEW_TYPE_LEFT,
219     E_DMS_VIEW_TYPE_RIGHT,
220     E_DMS_VIEW_TYPE_TOP,
221     E_DMS_VIEW_TYPE_BOTTOM,
222     E_DMS_VIEW_TYPE_MAX,
223 } EN_DMS_VIEWTYPE;
224 
225 typedef enum
226 {
227     E_DMS_COLOR_FORMAT_HW_HVD,                 //YUV420 HVD tiled format
228     E_DMS_COLOR_FORMAT_HW_MVD,                 //YUV420 MVD tiled format
229     E_DMS_COLOR_FORMAT_SW_YUV420_PLANAR,       //YUV420 Planar
230     E_DMS_COLOR_FORMAT_SW_RGB565,              //RGB565
231     E_DMS_COLOR_FORMAT_SW_ARGB8888,            //ARGB8888
232     E_DMS_COLOR_FORMAT_YUYV,                   //YUV422 YUYV
233     E_DMS_COLOR_FORMAT_SW_RGB888,              //RGB888
234     E_DMS_COLOR_FORMAT_10BIT_TILE,             //YUV420 tiled 10 bits mode
235     E_DMS_COLOR_FORMAT_SW_YUV420_SEMIPLANAR,   //YUV420 SemiPlanar
236     E_DMS_COLOR_FORMAT_YUYV_CSC_BIT601,        //YUV422 YUYV from RGB2YUV bit601 mode
237     E_DMS_COLOR_FORMAT_YUYV_CSC_255,           //YUV422 YUYV from RGB2YUV 0~255 mode
238     E_DMS_COLOR_FORMAT_HW_EVD,                 //YUV420 EVD tiled format
239     E_DMS_COLOR_FORMAT_MAX,
240 } EN_DMS_COLORFORMAT;
241 
242 typedef enum
243 {
244     E_DMS_STATUS_NOT_SUPPORT            = 0x0,
245     E_DMS_STATUS_INITIALIZED              = 0x1,
246     E_DMS_STATUS_SUPPORT_MULTI_WINDOW = (0x1<<1),
247     E_DMS_STATUS_SUPPORT_VSYNC_BRIDGE  = (0x1<<2),
248     E_DMS_STATUS_SUPPORT_AVSYNC         = (0x1<<3),
249     E_DMS_STATUS_SUPPORT_SECURE_VIDEO  = (0x1<<4),
250 } EN_DMS_STATUS;
251 
252 typedef enum
253 {
254     E_DMS_AR_DEFAULT = 0,
255     E_DMS_AR_16x9,
256     E_DMS_AR_4x3,
257     E_DMS_AR_AUTO,
258     E_DMS_AR_MAX,
259 } EN_DMS_ASPECT_RATIO;
260 
261 //DMS window define
262 typedef struct
263 {
264     MS_U32 u32x;
265     MS_U32 u32y;
266     MS_U32 u32width;
267     MS_U32 u32height;
268 } ST_DMS_WINDOW;
269 
270 //DMS Init struct
271 typedef struct
272 {
273     MS_U32 u32Version;                         /// ST_DMS_INITDATA version
274     MS_U32 u32Length;                         /// sizeof(ST_DMS_INITDATA)
275     MS_PHY phyBuffAddr;                          /// DMS buffer start address
276     MS_U32 u32BuffSize;
277 } ST_DMS_INITDATA;
278 
279 //DMS set window info
280 typedef struct DLL_PACKED
281 {
282     MS_U32 u32Version;                         /// ST_DMS_SETWIN_INFO version
283     MS_U32 u32Length;                         /// sizeof(ST_DMS_SETWIN_INFO)
284     MS_BOOL bXCWinInfoValid;
285     ST_DMS_WINDOW stDispWin;
286     ST_DMS_WINDOW stCropWin;
287     EN_DMS_ASPECT_RATIO enARC;
288     ST_DMS_WINDOW stOutputWin;
289 } ST_DMS_SETWIN_INFO;
290 
291 //DMS get window info
292 typedef struct DLL_PACKED
293 {
294     MS_U32 u32Version;                           /// ST_DMS_GETWIN_INFO version
295     MS_U32 u32Length;                           /// sizeof(ST_DMS_GETWIN_INFO)
296     MS_BOOL bXCWinInfoValid;
297     ST_DMS_WINDOW stDispWin;
298     ST_DMS_WINDOW stCropWin;
299     MS_U32 u16DeviceID;
300     MS_U32 enInputSourceType;
301     EN_DMS_ASPECT_RATIO enARC;
302     ST_DMS_WINDOW stOutputWin;
303     MS_U32 u32ZOrder;
304 } ST_DMS_GETWIN_INFO;
305 
306 ////Frame Info set
307 typedef struct DLL_PACKED
308 {
309     MS_U32 u32Version;                         /// ST_DMS_COLORDESCRIPTION version
310     MS_U32 u32Length;                         /// sizeof(ST_DMS_COLORDESCRIPTION)
311     //color_description: indicates the chromaticity/opto-electronic coordinates of the source primaries
312     MS_U8 u8ColorPrimaries;
313     MS_U8 u8TransferCharacteristics;
314     // matrix coefficients in deriving YUV signal from RGB
315     MS_U8 u8MatrixCoefficients;
316 } ST_DMS_COLORDESCRIPTION;
317 
318 typedef struct DLL_PACKED
319 {
320     MS_U32 u32Version;                         /// ST_DMS_DOLBYHDRINFO version
321     MS_U32 u32Length;                         /// sizeof(ST_DMS_DOLBYHDRINFO)
322     // bit[0:1] 0: Disable 1:Single layer 2: Dual layer, bit[2] 0:Base Layer 1:Enhance Layer
323     MS_U8  u8DVMode;
324     MS_PHY phyHDRMetadataAddr;
325     MS_U32 u32HDRMetadataSize;
326     MS_PHY phyHDRRegAddr;
327     MS_U32 u32HDRRegSize;
328     MS_PHY phyHDRLutAddr;
329     MS_U32 u32HDRLutSize;
330     MS_U8  u8DMEnable;
331     MS_U8  u8CompEnable;
332     MS_U8  u8CurrentIndex;
333 } ST_DMS_DOLBYHDRINFO;
334 
335 typedef struct DLL_PACKED
336 {
337     MS_U32 u32Version;                         /// ST_DMS_HDRINFO version
338     MS_U32 u32Length;                         /// sizeof(ST_DMS_HDRINFO)
339     // bit[0]: MS_ColorDescription present or valid, bit[1]: MS_MasterColorDisplay present or valid
340     MS_U32 u32FrmInfoExtAvail;
341     // mastering color display: color volumne of a display
342     ST_DMS_COLORDESCRIPTION   stColorDescription;
343     //DMS_MasterColorDisplay stMasterColorDisplay;
344     ST_DMS_DOLBYHDRINFO       stDolbyHDRInfo;
345 } ST_DMS_HDRINFO;
346 
347 typedef struct DLL_PACKED
348 {
349     MS_U32 u32Version;                         /// ST_DMS_COLORHWFORMAT version
350     MS_U32 u32Length;                         /// sizeof(ST_DMS_COLORHWFORMAT)
351     MS_PHY phyLumaAddr;
352     MS_PHY phyChromaAddr;
353     MS_PHY phyLumaAddr2Bit;
354     MS_PHY phyChromaAddr2Bit;
355     MS_U32 u32LumaPitch;
356     MS_U32 u32ChromaPitch;
357     MS_U32 u32LumaPitch2Bit;
358     MS_U32 u32ChromaPitch2Bit;
359     MS_U32 u32MFCodecInfo;
360     MS_PHY phyMFCBITLEN;
361     MS_PHY phyLumaAddr_subsample;
362     MS_PHY phyChromaAddr_subsample;
363     MS_U16 u16Pitch_subsample;
364     MS_U8  u8TileMode_subsample;
365 } ST_DMS_COLORHWFORMAT;
366 
367 typedef struct DLL_PACKED
368 {
369     MS_U32 u32Version;                         /// ST_DMS_FRAMEFORMAT version
370     MS_U32 u32Length;                         /// sizeof(ST_DMS_FRAMEFORMAT)
371     EN_DMS_FRAMETYPE eFrameType;
372     EN_DMS_FIELDTYPE eFieldType;
373     EN_DMS_VIEWTYPE eViewType;
374     MS_U32 u32Width;
375     MS_U32 u32Height;
376     MS_U32 u32CropLeft;
377     MS_U32 u32CropRight;
378     MS_U32 u32CropTop;
379     MS_U32 u32CropBottom;
380     ST_DMS_COLORHWFORMAT sHWFormat;
381     MS_U32 u32Idx;
382     MS_U32 u32PriData;
383     MS_U8 u8LumaBitdepth;
384     MS_U8 u8ChromaBitdepth;
385 } ST_DMS_FRAMEFORMAT;
386 
387 //
388 typedef struct DLL_PACKED
389 {
390     MS_U32 u32Version;                           /// ST_DMS_DispFrameFormat version
391     MS_U32 u32Length;                           /// sizeof(ST_DMS_DispFrameFormat)
392     MS_U32 OverlayID;
393     ST_DMS_FRAMEFORMAT sFrames[2];
394     EN_DMS_COLORFORMAT eColorFormat;
395     MS_U32 FrameNum;
396     MS_PHY u64Pts;
397     MS_U32 CodecType;
398     MS_U32 u32FrameRate;
399     MS_U32 u32AspectWidth;
400     MS_U32 u32AspectHeight;
401     MS_U32 u32VdecStreamVersion;
402     MS_U32 u32VdecStreamId;
403     MS_U32 u32UniqueId;
404     MS_U8 u8AspectRate;
405     MS_U8 u8Interlace;
406     MS_U8 u8FrcMode;
407     MS_U8 u83DMode;
408     MS_U8 u8BottomFieldFirst;
409     MS_U8 u8FreezeThisFrame;
410     MS_U8 u8ToggleTime;
411     MS_U8 u8MCUMode;
412     MS_U8 u8FieldCtrl;          // control one field mode, always top or bot when FF or FR
413     MS_U8 u8ApplicationType;
414     MS_U8 u83DLayout;           // 3D layout from SEI, the possible value is OMX_3D_LAYOUT enum in OMX_Video.h
415     MS_U8 u8ColorInXVYCC;
416     MS_U8 u8LowLatencyMode;     // for CTS or other application, drop new frame when render too fast
417     MS_U8 u8VdecComplexity;
418     MS_U8 u8HTLBTableId;
419     MS_U8 u8HTLBEntriesSize;
420     MS_U8 u8AFD;               //active frame code
421     ST_DMS_HDRINFO sHDRInfo;
422     MS_U16 u16MIUBandwidth;
423     MS_U16 u16Bitrate;
424     MS_U32 u32TileMode;
425     MS_PHY phyHTLBEntriesAddr;
426 } ST_DMS_DISPFRAMEFORMAT;
427 
428 typedef struct
429 {
430     MS_U32 u32R;
431     MS_U32 u32G;
432     MS_U32 u32B;
433     MS_U32 u32A;
434 } ST_DMS_COLOR;
435 
436 #ifdef __cplusplus
437 }
438 #endif
439 
440 #endif
441 
442