MI GFX API

Version 2.06


1. API LIST

The MI GFX module provides the following APIs:

Name of API Function
MI_GFX_Open Open GFX device
MI_GFX_Close Close GFX device
MI_GFX_WaitAllDone Wait until all GFX tasks are completed
MI_GFX_QuickFill Add quick fill operation to the task
MI_GFX_GetAlphaThresholdValue Get alpha threshold value
MI_GFX_SetAlphaThresholdValue Set alpha threshold value
MI_GFX_Bitblit Add a raster bitmap to the task to perform move operations with additional functions
MI_GFX_SetPalette Set palette for Index Color format
MI_GFX_InitDev Initialize GFX device
MI_GFX_DeInitDev De-initialize GFX device

1.1. MI_GFX_Open

  • Function

    Call this interface to open GFX device and initialize hardware system

  • Syntax

    MI_ S32 MI_GFX_Open();
    
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see error code for details

  • Requirement

    • Header: mi_gfx.h

    • Library: libmi_gfx.a

  • Note

    • Before performing any GFX related operations, call this interface and make sure GFX device is opened.

    • Calling this interface after the GFX device has been initialized will return a “module initialized” message.

  • Example

    /*declaration*/
    
    MI_S32 s32Ret = 0;
    
    /* open GFX device*/
    
    s32Ret = MI_GFX_Open();
    
    if (MI_OK != s32Ret)
    
    {
    
        return -1;
    
    }
    
    /* close GFX device*/
    
    MI_GFX_Close();
    

1.2. MI_GFX_Close

  • Function

    Call this interface to close GFX device

  • Syntax

    MI_ S32 MI_GFX_Close();
    
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see error code for  details

  • Requirement

    • Header: mi_gfx.h

    • Library: libmi_gfx.a

  • Note

    The number of times of calling MI_GFX_Open and the number of times of calling MI_GFX_Close must be consistent. Repeated calling is allowed. When the number of Opens is the same as the number of Closes, the GFX API will no longer be able to be called.


1.3. MI_GFX_WaitAllDone

  • Function

    Call this interface to wait for completion of all or specified GFX tasks.

  • Syntax

    MI_S32 MI_GFX_WaitAllDone(MI_BOOL bWaitAllDone, MI_penU16 u16TargetFence);
    
  • Parameter

    Parameter Name Description Input/Output
    bWaitAllDone Wait until all GFX tasks are completed Input
    u16TargetFence Wait until specified fence is reached. This parameter takes effect only when bWaitAllDone is FALSE. Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see error code for  details

  • Requirement

    • Header: mi_gfx.h mi_gfx_datatype.h

    • Library: libmi_gfx.a

  • Note

    This interface is a blocking interface which will block operations until all the GFX tasks are completed.


1.4. MI_GFX_QuickFill

  • Function

    Fill the data value u32ColorVal to the destination address with pstDst. pstDstRect is the function which does the color fill against the memory in the output region.

  • Syntax

    MI_S32 MI_GFX_QuickFill(MI_GFX_Surface_t *pstDst, MI_GFX_Rect_t *pstDstRect,MI_U32 u32ColorVal, MI_U16 *pu16Fence);
    
  • Parameter

    Parameter Name Description Input/Output
    pstDst Destination bitmap Input
    pstDstRect Operating area in destination bitmap Input
    u32ColorVal Color fill value Input
    pu16Fence Returned fence pointer Output
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see error code for details

  • Requirement

    • Header: mi_gfx.h mi_gfx_datatype.h

    • Library: libmi_gfx.a

  • Note

    • Since this operation directly fills u32ColorVal in the specified area of the bitmap, if blue is to be filled to a specified bitmap, you should specify the corresponding blue fill value in accordance with the bitmap format.

    • If, for example, the bitmap format is ARGB1555 and the color to be filled is blue, then u32ColorVal should be set to 0x801F (wherein the alpha bit is 1).

    • The sequence of u32ColorVal from high to low is A8:R8:G8:B8. If the Dst format is YUV, then A8 is invalid, R corresponds to Y, G corresponds to U, and B corresponds to V.


1.5. MI_GFX_GetAlphaThresholdValue

  • Function

    Get alpha threshold value. This function is used for destination image with pixel format of ARGB1555. If the foreground bitmap and background bitmap alpha operation result is smaller than this threshold value, the alpha bit of the resultant pixel is taken as 0; if the operation result is greater than or equal to this threshold value, the alpha bit of the pixel is taken as 1.

  • Syntax

    MI_S32 MI_GFX_GetAlphaThresholdValue(MI_U8 *pu8ThresholdValue);
    
  • Parameter

    Parameter Name Description Input/Output
    pu8ThresholdValue Pointer to alpha threshold value Output
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see error code for details

  • Requirement

    • Header: mi_gfx.h mi_gfx_datatype.h

    • Library: libmi_gfx.a

  • Note

    Not supported currently


1.6. MI_GFX_SetAlphaThresholdValue

  • Function

    Set alpha threshold value. When foreground and background perform bitblit operation, hardware will generate the intermediate bitmap format of ARGB8888, irrespective of the format of the foreground and background bitmaps. In the case where the destination image pixel format is ARGB1555, the alpha bit of the resultant pixel is taken as 0 if the foreground bitmap and background bitmap alpha operation result is smaller than this threshold value, and the alpha bit of the pixel is taken as 1 if the operation result is greater than or equal to this threshold value.

  • Syntax

    MI_S32 MI_GFX_SetAlphaThresholdValue(MI_U8 u8ThresholdValue);
    
  • Parameter

    Parameter Name Description Input/Output
    u8ThresholdValue Alpha threshold value Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see error code for details

  • Requirement

    • Header: mi_gfx.h mi_gfx_datatype.h

    • Library: libmi_gfx.a

  • Note

    Currently not supported.


1.7. MI_GFX_BitBlit

  • Function

    The foreground bitmap (pstSrc) is compared with the specified area (pstSrcRect, pstDstRect) of the destination bitmap (pstDst), and the computed bitmap is copied to the specified area (pstDstRect) of the destination bitmap (pstDst).

    MI_GFX_Opt_t structure contains GFX operation function configuration information, for example, the decision about whether or not to perform ROP operation and the ROP command code; the decision about whether or not to do colorkey and the colorkey configuration value; the decision about whether or not to do region reduction (clip operation) and the specified clip region; and the decision about whether or not to do image mirroring, alpha blending, etc. These operations can be enabled at the same time.

  • Syntax

    MI_S32 MI_GFX_BitBlit(MI_GFX_Surface_t *pstSrc, MI_GFX_Rect_t *pstSrcRect, MI_GFX_Surface_t *pstDst, MI_GFX_Rect_t *pstDstRect, MI_GFX_Opt_t *pstOpt, MI_U16 *pu16Fence);
    
  • Parameter

    Parameter Name Description Input/Output
    pstSrc Source bitmap Input
    pstSrcRect Source bitmap operation region Input
    pstDst Destination bitmap Input
    pstDstRect Destination bitmap operation region Input
    pstOpt Operating parameter setting structure Input
    pu16Fence Pointer to the returned fence Output
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see error code for details

  • Requirement

    • Header: mi_gfx.h mi_gfx_datatype.h

    • Library: libmi_gfx.a

  • Note

    • Before calling this interface, be sure to call MI_GFX_Open to open the GFX device, and call the corresponding Fill or Bitblit operations.

    • Destination bitmap must be consistent with background bitmap in color space. The color space of foreground bitmap can be different from that of background/destination bitmap. In this case, color space conversion function will be performed automatically.

    • In the case where the foreground source bitmap differs from the destination bitmap in size, if scaling is enabled, the scaling will be done to the set region; if not, cutting and movement will be done according to the minimum value of the set public area.

    • For Clip operation:

      • If it is a clip in the area, the cut area must have a common intersection with the operation area; otherwise, an error will be returned.

      • If it is an out-of-area clip, the cut area cannot completely cover the operation area; otherwise, an error code will be returned. In other words, the actual update area cannot be empty.


1.8. MI_GFX_SetPalette

  • Function

    Set Palette for Index Color (I2/I4/I8).

  • Syntax

    MI_S32 MI_GFX_SetPalette(MI_GFX_ColorFmt_e eColorFmt, MI_GFX_Palette_t* pstPalette);
    
  • Parameter

    Parameter Name Description Input/Output
    eColorFmt Specific Index Color format Input
    pstPalette Data array of corresponding Index Color Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see error code for details

  • Requirement

    • Header: mi_gfx.h mi_gfx_datatype.h

    • Library: libmi_gfx.a

  • Note

    pstPalette is an array of MI_GFX_PaletteEntry_t data with capacity 256. Each MI_GFX_PaletteEntry_t referenced by array subscript represents an RGB color to an Index Color.

  • Example

    1.  MI_GFX_Palette_t myPal;
    
    2.  MI_GFX_PaletteEntry_t index_0;
    
    3.  MI_GFX_PaletteEntry_t index_1;
    
    4.  index_0.RGB.u8A = 0x40;
    
    5.  index_0.RGB.u8R = 0xFF;
    
    6.  index_0.RGB.u8G = 0;
    
    7.  index_0.RGB.u8B = 0;
    
    8.  index_1.RGB.u8A = 0x40;
    
    9.  index_1.RGB.u8R = 0;
    
    10. index_1.RGB.u8G = 0xFF;
    
    11. index_1.RGB.u8B = 0;
    
    12. myPal.aunPalette[0] = index_0;
    
    13. myPal.aunPalette[1] = index_1;
    
    14. myPal.u16PalStart = 0
    
    15. myPal.u16PalEnd = 1;
    
    16. MI_GFX_SetPalette(E_MI_GFX_FMT_I8,&myPal); .
    

1.9. MI_GFX_InitDev

  • Function

    Initialize GFX device.

  • Syntax

    MI_S32 MI_GFX_InitDev([MI_GFX_InitParam_t](#214-mi_gfx_initparam_t) *pstInitParam);
    
  • Parameters

    Parameter Name Description Input/Output
    pstInitParam Initialization Parameter Input
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see error code for details

  • Requirement

    • Header: mi_gfx.h mi_gfx_datatype.h

    • Library: libmi_gfx.a


1.10. MI_GFX_DeInitDev

  • Function

    De-initialize GFX device.

  • Syntax

    MI_S32 MI_GFX_DeInitDev(void);
    
  • Return Value

    • Zero: Successful

    • Non-zero: Failed, see error code for details

  • Requirement

    • Header: mi_gfx.h mi_gfx_datatype.h

    • Library: libmi_gfx.a

  • Note

    • This interface should be called after the device has been initialized; otherwise, a failed message will be returned.

    • If this interface is not called after the app exited, the GFX device will be auto de-initialized.


2. GFX DATA TYPE

The GFX related data types are defined in the table below:

Function Description
MI_GFX_ColorFmt_e Corresponding GFX surface color format
MI_GFX_Rect_t Operation region attribute
MI_GFX_ColorKeyOp_e Colorkey mode
MI_GFX_Rotate_e Supported rotation angle operation
MI_GFX_ColorKeyValue_t Colorkey color attribute
MI_GFX_ColorKeyInfo_t Colorkey operation structure (bitmap concerned)
MI_GFX_DfbBldOp_e User-defined alpha blending mode
MI_GFX_Mirror_e Image mirror attribute
MI_GFX_Surface_t Bitmap surface structure
MI_Gfx_DfbBlendFlags_e GFX blending attribute structure
MI_GFX_Opt_t GFX operation additional attribute structure
MI_GFX_PaletteEntry_t RGB color structure for an index color
MI_GFX_Palette_t Palette structure for certain range of index colors
MI_GFX_InitParam_t Define the initialized parameter of GFX device

2.1. MI_GFX_ColorFmt_e

  • Description

    Color format supported by GFX

  • Definition

    typedef enum
    
    {
    
        E_MI_GFX_FMT_I1 = 0, /* MS_ColorFormat */
    
        E_MI_GFX_FMT_I2,
    
        E_MI_GFX_FMT_I4,
    
        E_MI_GFX_FMT_I8,
    
        E_MI_GFX_FMT_FABAFGBG2266,
    
        E_MI_GFX_FMT_1ABFGBG12355,
    
        E_MI_GFX_FMT_RGB565,
    
        E_MI_GFX_FMT_ARGB1555,
    
        E_MI_GFX_FMT_ARGB4444,
    
        E_MI_GFX_FMT_ARGB1555_DST,
    
        E_MI_GFX_FMT_YUV422,
    
        E_MI_GFX_FMT_ARGB8888,
    
        E_MI_GFX_FMT_RGBA5551,
    
        E_MI_GFX_FMT_RGBA4444,
    
        E_MI_GFX_FMT_ABGR8888,
    
        E_MI_GFX_FMT_BGRA5551,
    
        E_MI_GFX_FMT_ABGR1555,
    
        E_MI_GFX_FMT_ABGR4444,
    
        E_MI_GFX_FMT_BGRA4444,
    
        E_MI_GFX_FMT_BGR565,
    
        E_MI_GFX_FMT_RGBA8888,
    
        E_MI_GFX_FMT_BGRA8888,
    
        E_MI_GFX_FMT_MAX
    
    } MI_GFX_ColorFmt_e;
    
  • Note

    Color format supported by corresponding surface, which, during bitblt operation, corresponds to SrcSurface, DstSurface color format.


2.2. MI_GFX_Rect_t

  • Description

    GFX operation region attribute

  • Definition

    typedef struct MI_GFX_Rect_s
    
    {
    
        MI_S32 s32Xpos;
    
        MI_S32 s32Ypos;
    
        MI_U32 u32Width;
    
        MI_U32 u32Height;
    
    } MI_GFX_Rect_t;
    
  • Member

    Member Description
    s32Xpos The starting abscissa of the operation region, in pixels. Valid range: [0, bitmap width).
    s32Ypos The starting ordinate of the operation region, in pixels. Valid range: [0, bitmap height).
    u32Width Width of the operation region, in pixels. Valid range: (0,0xFFF]
    u32Height Height of the operation region, in pixels. Valid range: (0,0xFFF]
  • Note

    • If the operation area partially intersects with the bitmap, the intersection part is the area involved in the operation; if the operation area does not intersect with the bitmap, the corresponding error code is returned.

    • The operating range must be within the scope of SurFace; otherwise, there will be no operation.


2.3. MI_GFX_ColorKeyOp_e

  • Description

    GFX colorkey operation mode

  • Definition

    typedef enum
    
    {
    
        E_MI_GFX_RGB_OP_EQUAL = 0,
    
        E_MI_GFX_RGB_OP_NOT_EQUAL,
    
        E_MI_GFX_ALPHA_OP_EQUAL,
    
        E_MI_GFX_ALPHA_OP_NOT_EQUAL,
    
        E_MI_GFX_ARGB_OP_EQUAL,
    
        E_MI_GFX_ARGB_OP_NOT_EQUAL,
    
        E_MI_GFX_CKEY_OP_BUTT,
    
    } MI_GFX_ColorKey_e;
    
  • Member

    Member Description
    E_MI_GFX_RGB_OP_EQUAL RGB equal colorkey operation
    E_MI_GFX_RGB_OP_NOT_EQUAL RGB unequal colorkey operation
    E_MI_GFX_ ALPHA_OP_EQUAL ALPHA equal colorkey operation
    E_MI_GFX_ ALPHA_OP_NOT_EQUAL ALPHA unequal colorkey operation
    E_MI_GFX_ ARGB_OP_EQUAL RGB equal colorkey operation
    E_MI_GFX_ARGB_OP_NOT_EQUAL RGB unequal colorkey operation
    E_MI_GFX_CKEY_OP_BUTT Invalid colorkey operation
  • Note

    When performing color key operation against bitmap, you can select foreground, background, and set the key value as equal or not equal.


2.4. MI_GFX_Rotate_e

  • Description

    Supported rotation angle operation

  • Definition

    typedef enum
    
    {
    
        E_MI_GFX_ROTATE_0 = 0
    
        E_MI_GFX_ROTATE_90
    
        E_MI_GFX_ROTATE_180
    
        E_MI_GFX_ROTATE_270
    
    } MI_GFX_Rotate_e;
    

2.5. MI_GFX_ColorKeyValue_t

  • Description

    Corresponding colorkey color value

  • Definition

    typedef struct MI_GFX_ColorKey_s
    
    {
    
        MI_U32 u32ColorStart;
    
        MI_U32 u32ColorEnd;
    
    } MI_GFX_ColorKeyValue_t;
    
  • Member

    Member Description
    u32ColorStart ColorKey color range start value
    u32ColorEnd ColorKey color range end value
  • Note

    When only one single color value is to go through colorkey operation, set u32ColorStart = u32ColorEnd = colorVal.


2.6. MI_GFX_ColorKeyInfo_t

  • Description

    Corresponding colorkey color value

  • Definition

    typedef struct MI_GFX_ColorKeyInfo_s
    
    {
    
        MI_BOOL bEnColorKey;
    
        MI_GFX_ColorKeyOp_e eCKeyOp;
    
        MI_GFX_ColorFmt_e eCKeyFmt;
    
        MI_GFX_ColorKeyValue_t stCKeyVal;
    
    } MI_GFX_ColorKeyInfo_t;
    
  • Member

    Member Description
    bEnColorKey ColorKey operation enable
    eCKeyOp ColorKey operation mode
    stCKeyVal ColorKey color range
    eCKeyFmt ColorKey color format
  • Note

    Colorkey operation mode works on Surface.


2.7. MI_GFX_DfbBldOp_e

  • Description

    Alpha blending operation

  • Definition

    typedef enum
    
    {
    
        E_MI_GFX_DFB_BLD_ZERO = 0,
    
        E_MI_GFX_DFB_BLD_ONE,
    
        E_MI_GFX_DFB_BLD_SRCCOLOR,
    
        E_MI_GFX_DFB_BLD_INVSRCCOLOR,
    
        E_MI_GFX_DFB_BLD_SRCALPHA,
    
        E_MI_GFX_DFB_BLD_INVSRCALPHA,
    
        E_MI_GFX_DFB_BLD_DESTALPHA,
    
        E_MI_GFX_DFB_BLD_INVDESTALPHA,
    
        E_MI_GFX_DFB_BLD_DESTCOLOR,
    
        E_MI_GFX_DFB_BLD_INVDESTCOLOR,
    
        E_MI_GFX_DFB_BLD_SRCALPHASAT,
    
        E_MI_GFX_DFB_BLD_NONE,
    
        E_MI_GFX_DFB_BLD_MAX,
    
    } MI_GFX_DfbBldOp_e;
    
  • Member

    Member Description
    E_MI_GFX_DFB_BLD_OP_ZERO 0
    E_MI_GFX_DFB_BLD_OP_ONE 1
    E_MI_GFX_DFB_BLD_OP_SRCCOLOR sc
    E_MI_GFX_DFB_BLD_OP_INVSRCCOLOR 1-sc
    E_MI_GFX_DFB_BLD_OP_SRCALPHA sa
    E_MI_GFX_DFB_BLD_OP_INVSRCALPHA 1-sa
    E_MI_GFX_DFB_BLD_OP_DESTCOLOR dc
    E_MI_GFX_DFB_BLD_OP_INVDESTCOLOR 1-dc
    E_MI_GFX_DFB_BLD_OP_DESTALPHA da
    E_MI_GFX_DFB_BLD_OP_INVDESTALPHA 1-da
    E_MI_GFX_DFB_BLD_OP_SRCALPHASAT min(1-da, sa)+1
    E_MI_GFX_BLD_MAX Invalid alpha blending mode
  • Note

    When the foreground bitmap and the background bitmap are superimposed, the superposition mode of the Src1 channel and the Src2 channel can be set separately. Currently 11 overlay modes are supported. Gotten when MI_GFX_DfbBldOp_e is called.


2.8. MI_GFX_Mirror_e

  • Description

    Image mirror attribute

  • Definition

    typedef enum
    
    {
    
        E_MI_GFX_MIRROR_NONE = 0,
    
        E_MI_GFX_MIRROR_HORIZONTAL,
    
        E_MI_GFX_MIRROR_VERTICAL,
    
        E_MI_GFX_MIRROR_BOTH,
    
        E_MI_GFX_MIRROR_MAX
    
    } MI_GFX_Mirror_e;
    
  • Member

    Member Description
    E_MI_GFX_MIRROR_NONE Output image mirror operation disabled
    E_MI_GFX_MIRROR_HORIZONTAL Output image horizontal mirror
    E_MI_GFX_MIRROR_VERTICAL Output image vertical mirror
    E_MI_GFX_MIRROR_BOTH Output image horizontal + vertical mirror
    E_MI_GFX_MIRROR_MAX Invalid mirror type

2.9. MI_GFX_Surface_t

  • Description

    Bitmap surface structure

  • Definition

    typedef struct MI_GFX_Surface_s
    
    {
    
        MI_PHY phyAddr;
    
        MI_GFX_ColorFmt_e eColorFmt;
    
        MI_U32 u32Width;
    
        MI_U32 u32Height;
    
        MI_U32 u32Stride;
    
    } MI_GFX_Surface_t;
    
  • Member

    Member Description
    u32PhyAddr Bitmap start address
    eColorFmt Bitmap format
    u32Height Bitmap height
    u32Width Bitmap width
    u32Stride Bitmap stride
  • Note

    • For bitmap format with pixel format greater than or equal to one byte, the bitmap start address and stride must align according to the pixel format. For bitmap format with pixel format less than one byte, the bitmap start address and stride must be byte-aligned.

    • For bitmap format with pixel format less than one byte, the horizontal start address and width must be pixel-aligned.

    • For bitmap in YCbCr422 format, the horizontal start address and width must be even numbers.


2.10. MI_Gfx_DfbBlendFlags_e

  • Description

    GFX blending attribute structure

  • Definition

    typedef enum
    
    {
    
        E_MI_GFX_DFB_BLEND_NOFX = 0x00000000,
    
        E_MI_GFX_DFB_BLEND_COLORALPHA = 0x00000001,
    
        E_MI_GFX_DFB_BLEND_ALPHACHANNEL = 0x00000002,
    
        E_MI_GFX_DFB_BLEND_COLORIZE = 0x00000004,
    
        E_MI_GFX_DFB_BLEND_SRC_PREMULTIPLY = 0x00000008,
    
        E_MI_GFX_DFB_BLEND_SRC_PREMULTCOLOR = 0x00000010,
    
        E_MI_GFX_DFB_BLEND_DST_PREMULTIPLY = 0x00000020,
    
        E_MI_GFX_DFB_BLEND_XOR = 0x00000040,
    
        E_MI_GFX_DFB_BLEND_DEMULTIPLY = 0x00000080,
    
        E_MI_GFX_DFB_BLEND_SRC_COLORKEY = 0x00000100,
    
        E_MI_GFX_DFB_BLEND_DST_COLORKEY = 0x00000200,
    
        E_MI_GFX_DFB_BLEND_MAX = 0x3FF
    
    } MI_Gfx_DfbBlendFlags_e;
    
  • Member

    Member Description
    E_MI_GFX_DFB_BLEND_NOFX No operation
    E_MI_GFX_DFB_BLEND_COLORALPHA Modulate source alpha value with global alpha factor
    E_MI_GFX_DFB_BLEND_ALPHACHANNEL Combine with source alpha value
    E_MI_GFX_DFB_BLEND_COLORIZE Modulate source colors with global color factors
    E_MI_GFX_DFB_BLEND_SRC_PREMULTIPLY Premultiply source colors with (modulated) source alpha value
    E_MI_GFX_DFB_BLEND_SRC_PREMULTCOLOR Premultiply source colors with global alpha factor only
    E_MI_GFX_DFB_BLEND_DST_PREMULTIPLY Premultiply destination colors with destination alpha value
    E_MI_GFX_DFB_BLEND_XOR XOR comes right before blending, after load, modulate and premultiply operations
    E_MI_GFX_DFB_BLEND_DEMULTIPLY It is better not to use the conversion from premultiplied to non-premultiplied!
    E_MI_GFX_DFB_BLEND_SRC_COLORKEY If the source matches the color key, keep the destination
    E_MI_GFX_DFB_BLEND_DST_COLORKEY If the destination does not match the color key, keep the destination
    E_MI_GFX_DFB_BLEND_MAX Enable all operation

2.11. MI_GFX_Opt_t

  • Description

    GFX operation attribute structure

  • Definition

    ty typedef struct MI_GFX_Opt_s
    
    {
    
        MI_GFX_Rect_t stClipRect;
    
        MI_GFX_ColorKeyInfo_t stSrcColorKeyInfo;
    
        MI_GFX_ColorKeyInfo_t stDstColorKeyInfo;
    
        MI_GFX_DfbBldOp_e eSrcDfbBldOp;
    
        MI_GFX_DfbBldOp_e eDstDfbBldOp;
    
        MI_GFX_Mirror_e eMirror;
    
        MI_GFX_Rotate_e eRotate;
    
        MI_Gfx_DfbBlendFlags_e eDFBBlendFlag;
    
        MI_U32 u32GlobalSrcConstColor;
    
        MI_U32 u32GlobalDstConstColor;
    
    } MI_GFX_Opt_t;
    
  • Member

    Member Description
    eDFBBlendFlag Dfb blending operation flags
    stSrcColorKeyInfo Source surface colorkey operation
    stDstColorKeyInfo Destination surface colorkey operation
    stClipRect Clip region definition
    eMirror Mirror type
    eSrcDfbBldOp Source surface BLEND operation type
    eDstDfbBldOp Destination surface BLEND operation type
    eRotate Supported rotation angle: 0, 90, 180, 270°
    u32GlobalSrcConstColor const color for dfb blending operation
    u32GlobalDstConstColor const color for dfb blending operation

2.12. MI_GFX_PaletteEntry_t

  • Description

    RGB color definition for an Index Color

  • Definition

    typedef union
    
    {
    
        /// ARGB8888 byte order
    
        struct
    
        {
    
            MI_U8 u8A;
    
            MI_U8 u8R;
    
            MI_U8 u8G;
    
            MI_U8 u8B;
    
        } RGB;
    
        // u8Data[0] = u8A
    
        // u8Data[1] = u8R
    
        // u8Data[2] = u8G
    
        // u8Data[3] = u8B
    
        MI_U8 u8Data[4];
    
    } MI_GFX_PaletteEntry_t;
    
  • Member

    Member Description
    RGB Color component structure for an Index Color
    u8Data Byte order RGB data for an Index Color
  • Note

    Please pay attention to the remark in the definition, which will help you understand the color value’s memory layout.


2.13. MI_GFX_Palette_t

  • Description

    Palette structure for certain range of Index Colors

  • Definition

    typedef struct MI_GFX_Palette_s
    
    {
    
        MI_GFX_PaletteEntry_t aunPalette[256];
    
        MI_U16 u16PalStart;
    
        MI_U16 u16PalEnd;
    
    }MI_GFX_Palette_t;
    
  • Member

    Member Description
    aunPalette Array of RGB colors
    u16PalStart Starting index
    u16PalEnd Ending index
  • Related Data Type and Interface

    MI_GFX_PaletteEntry_t.


2.14. MI_GFX_InitParam_t

  • Description

    GFX device initialization parameter.

  • Definition

    typedef struct MI_GFX_InitParam_s
    
    {
    
        MI_U32 u32DevId;
    
        MI_U8 *u8Data;
    
    } MI_GFX_InitParam_t;
    
  • Member

    Member Description
    u32DevId Device ID
    u8Data Data pointer buffer
  • Related Data Type and Interface

    MI_GFX_InitDev


3. GFX ERROR CODE

The GFX API error codes are as listed in the table below:

Error Code Macro Definition Description
0xA00D2003 MI_ERR_GFX_INVALID_PARAM Invalid parameter
0xA00D2002 MI_ERR_GFX_DEV_BUSY GFX device busy
0xA00D2220 MI_ERR_GFX_NOT_INIT Device not initialized
0xA00D2221 MI_ERR_GFX_DRV_NOT_SUPPORT Unsupported operation
0xA00D2222 MI_ERR_GFX_DRV_FAIL_FORMAT Unsupported format
0xA00D2223 MI_ERR_GFX_NON_ALIGN_ADDRESS Address not aligned
0xA00D2224 MI_ERR_GFX_NON_ALIGN_PITCH Pitch not aligned
0xA00D2225 MI_ERR_GFX_DRV_FAIL_OVERLAP Overlap region found in Option
0xA00D2226 MI_ERR_GFX_DRV_FAIL_STRETCH Stretch failed
0xA00D2228 MI_ERR_GFX_DRV_FAIL_LOCKED Device locked by other use
0xA00D2229 MI_ERR_GFX_DRV_FAIL_BLTADDR Bitblit start address error