MI FB API
1. Development Process¶
1.1. Configure MI_FB startup parameters¶
MI_FB startup parameters are managed in config.ini. m_fbdevList defined in the ROOTsection of config.ini describes the entry of GUI or mouse layer parameters of the current platform.
1. FB_DEVICE describes the configuration information superimposed on the GUI of the video display unit;
2. FB_VIDEO and FB_BUF_ID0_PATH describe the configuration information superimposed on GUI of the video processing unit;
3. FB_CURSOR describes the configuration information of the mouse layer, the mouse layer will be superimposed on GUI.
[ROOT] m_fbdevList = {\ FB_DEVICE,\ FB_CURSOR,\ FB_VIDEO,\ } [FB_DEVICE] FB_HWLAYER_ID = 1; FB_HWWIN_ID = 0; FB_HWWIN_FORMAT = 5; FB_HWLAYER_OUTPUTCOLOR = 0; FB_WIDTH = 800; FB_HEIGHT = 480; FB_TIMING_WIDTH = 1920; FB_TIMING_HEIGHT = 1080; FB_MMAP_NAME = E_MMAP_ID_FB; FB_BUFFER_LEN = 8192 #unit:Kbyte, total size = FB_BUFFER_LEN*1024 [FB_CURSOR] FB_HWLAYER_ID = 0; FB_HWWIN_ID = 0; FB_HWWIN_FORMAT = 6; FB_HWLAYER_OUTPUTCOLOR = 0; FB_MMAP_NAME = E_MMAP_ID_HW_CURSOR; [FB_VIDEO] FB_BUF_ID = 0 FB_BUF_CNT = 3 FB_HWWIN_FORMAT = 6 FB_WIDTH = 1920 FB_HEIGHT = 1080 FB_TIMMING_WIDTH = 1920 FB_TIMMING_HEIGHT = 1080 [FB_BUF_ID0_PATH] FB_MOD = 34 FB_DEV = 1 FB_CHN = 0 FB_PORT = 0 FB_GWIN_ID = 7
Note:
Adding multiple GUI layers (if supported by the chip) needs to add the new section name to m_fbdevList for management, otherwise it will not take effect. For example: the current INI configuration has a section of FB_DEVICE describing the information of a GUI layer, you can add a section of FB_DEVICE1 to describe another GUI layer, add the section name of FB_DEVICE1 to m_fbdevList.
The growth order of /dev/fbxxx device nodes is consistent with the order in m_fbdevList.
The description of each configuration parameter in config.ini is as follows:
Parameter | Description |
---|---|
FB_HWLAYER_ID | The current graphics layer ID |
FB_HWWIN_ID | Hardware device ID (determine which output PATH of the video layer device DISP is superimposed on) |
FB_HWWIN_FORMAT | Describe the canvas pixel format |
FB_HWLAYER_OUTPUTCOLOR | Describe the color space (YUV/RGB) output by the current overlay |
FB_WIDTH | Describe the visible area range (xres) |
FB_HEIGHT | Describe the visible area range (yres) |
FB_TIMING_WIDTH | Describe the display device resolution (display width) |
FB_TIMING_HEIGHT | Describe the display device resolution (display height) |
FB_MMAP_NAME | Video memory application related parameters (default is E_MMAP_ID_FB) |
FB_BUFFER_LEN | Describe the video memory size (unit: Kbyte) |
FB_BUF_ID | Associate the FB_BUF_ID0_PATH field |
FB_BUF_CNT | Calculate the video memory size of the graphics layer superimposed on the video processing unit |
FB_MOD | Superimpose the graphics layer MODULE ID of video processing unit |
FB_DEV | Superimpose the graphics layer DEV ID of video processing unit |
FB_CHN | Superimpose the graphics layer CHN ID of video processing unit |
FB_PORT | Superimpose the graphics layer PORT ID of video processing unit |
2. API INTRODUCTION¶
As shown below, the FB APIs are divided into several types.
2.1. File Operation Type¶
This type provides interfaces to operation of SigmaStar FB. By calling the interfaces, you can manipulate the overlay as you do with file operation. These interfaces are standard interfaces provided by Linux, offering such functions as open, close, write, read and lseek, etc. Description of these standard interfaces will not be given here in this document.
2.2. Memory Map Type¶
This type provides an interfaces to map physical memory to the user's virtual memory space. These interfaces are standard interfaces provided by Linux, offering such functions as mmap and munmap, etc. Description of these standard interfaces will not be given here in this document.
2.3. Memory Control and Status Query Type¶
This type provides interfaces to set properties like pixel format and color depth. These interfaces are standard interfaces provided by Linux, and are used quite frequently. We will give a brief account of these interfaces in this document.
2.4. Interlayer Effect Control and Status Query Type¶
The SigmaStar FB can manage multiple graphic overlay. Each layer in the graphic overlay can set attributes including alpha information and display region. These functions are new functions provided by SigmaStar FB, as opposed to Linux framebuffer. In this document, we will concentrate upon these new functions, which are realized by extending the command parameters of the standard Linux Framebuffer ioctl function.
The SigmaStar FB user interface is implemented in the form of ioctl, as illustrated below:
int ioctl(int fd, unsigned long cmd, …… );
This function is a Linux standard interface equipped with variable parameters. For SigmaStar FB, however, only three parameters are required. Therefore, the syntax would be:
int ioctl (int fd, unsigned long cmd, CMD_DATA_TYPE *cmddata);
Wherein, CMD_DATA_TYPE will vary with the parameter cmd. Detailed descriptions of the three parameters are provided in the table below:
Table 1-1: Parameters of ioctl Function
Parameter | Description | Input/Output |
---|---|---|
Fd | Framebuffer device file descriptor, which is the return value after calling the open function to open the Framebuffer device. | Input |
Cmd | The main commands (command control word) are as listed below: FBIOGET_VSCREENINFO: Get screen variable information FBIOPUT_VSCREENINFO: Set screen variable information FBIOGET_FSCREENINFO: Get screen fixed information FBIOPAN_DISPLAY: Set PAN display FBIOGET_SCREEN_LOCATION: Get overlay display region FBIOSET_SCREEN_LOCATION: Set overlay display region FBIOGET_SHOW: Get overlay display status FBIOSET_SHOW: Set overlay display status FBIOGET_GLOBAL_ALPHA: Get overlay Alpha attribute FBIOSET_GLOBAL_ALPHA: Set overlay Alpha attribute FBIOGET_COLORKEY: Get overlay colorkey attribute FBIOSET_COLORKEY: Set overlay colorkey attribute FBIOGET_DISPLAYLAYER_ATTRIBUTES: Get overlay attribute FBIOSET_DISPLAYLAYER_ATTRIBUTES: Set overlay attribute FBIOGET_CURSOR_ATTRIBUTE: Get cursor attribute FBIOSET_CURSOR_ATTRIBUTE: Set cursor attribute |
Input |
cmddata | The foregoing commands correspond respectively to the following data types: Get or set screen variable information: struct fb_var_screeninfo * Get screen fixed information: struct fb_fix_screeninfo * Set PAN display: struct fb_var_screeninfo * Get or set screen overlay coordinate origin: MI_FB_CursorAttr_t * Get or set overlay display status: MI_BOOL * Get or set overlay Alpha: MI_FB_GlobalAlpha_t * Get or set overlay colorkey: MI_FB_ColorKey_t* Get or set overlay attribute: MI_FB_DisplayLayerAttr_t* Get or set cursor graphic layer attribute: MI_FB_CursorAttr_t* |
Input/Output |
3. STANDARD FUNCTION¶
3.1. FBIOGET_VSCREENINFO¶
-
Function
Get screen variable information
-
Syntax
int ioctl (int fd,FBIOGET_VSCREENINFO,struct fb_var_screeninfo *var);
-
Description
Use this interface to get screen variable information, including primarily resolution and pixel format. For detailed description of the information, please refer to section “struct fb_var_screeninfo.”
-
Parameter
Parameter Name Description Input/Output fd Framebuffer device file descriptor Input FBIOGET_VSCREENINFO ioctl number Input var Variable information structure pointer Output -
Return Value
-
0: Successful.
-
-1: Failed.
-
-
Requirement
- Header file: fb.h
-
Related Interface
3.2. FBIOPUT_VSCREENINFO¶
-
Function
Set Framebuffer screen resolution and pixel format, etc.
-
Syntax
int ioctl (int fd,FBIOPUT_VSCREENINFO, struct fb_var_screeninfo *var);
-
Description
Use this interface to set screen resolution and pixel format
-
Parameter
Parameter Name Description Input/Output fd Framebuffer device file descriptor Input FBIOPUT_VSCREENINFO ioctl number Input var Variable information structure pointer Input -
Return Value
-
0: Successful.
-
-1: Failed.
-
-
Requirement
- Header file: fb.h
-
Note
The actual resolution and offset must be guaranteed to be within the virtual resolution range. Otherwise, system will automatically adjust the actual resolution to keep it within the coverage of the virtual resolution range.
-
Related Interface
3.3. FBIOGET_FSCREENINFO¶
-
Function
Get Framebuffer fixed information
-
Syntax
int ioctl (int fd,FBIOGET_FSCREENINFO, struct fb_fix_screeninfo *fix);
-
Description
Use this interface to get Framebuffer fixed information, including memory start physical address, memory size and line spacing, etc. For detailed description, please refer to the section “”
-
Parameter
Parameter Name Description Input/Output fd Framebuffer device file descriptor Input FBIOGET_FSCREENINFO ioctl number Input fix Fixed information structure pointer Output -
Return Value
-
0: Successful.
-
-1: Failed.
-
-
Requirement
- Header file: fb.h
3.4. FBIOPAN_DISPLAY¶
-
Function
Set to display from different offsets in the virtual resolution
-
Syntax
int ioctl (int fd,FBIOPAN_DISPLAY, struct fb_var_screeninfo *var);
-
Description
Use this interface to set the display position from different offsets in the virtual resolution; the actual resolution remains unchanged. As shown in the figure below, (xres_virtual, yres_virtual) means the virtual resolution, (xres, yres) the resolution actually shown, and (xoffset, yoffset) the offset used.
-
Parameter
Parameter Name Description Input/Output fd Framebuffer device file descriptor Input FBIOPAN_DISPLAY ioctl number Input var Variable information structure pointer Input -
Return Value
-
0: Successful.
-
-1: Failed.
-
-
Requirement
- Header file: fb.h
-
Note
The actual resolution and offset must be guaranteed to be within the virtual resolution range. Otherwise, the setting will fail.
Figure 2-1: Setting the Display Position from Different Offsets in the Virtual Resolution
4. EXTENDED FUNCTION¶
4.1. FBIOGET_SCREEN_LOCATION¶
-
Function
Get overlay screen display region
-
Syntax
int ioctl (int fd,FBIOGET_SCREEN_LOCATION,MI_FB_Rectangle_t* pstRectangle);
-
Description
Use this interface to get overlay screen display region
-
Parameter
Parameter Name Description Input/Output fd Framebuffer device file descriptor Input FBIOGET_SCREEN_LOCATION ioctl number Input pstRectangle Pointer to MI_FB_Rectangle_t structure, including (x,y) coordinates, width, and height. It refers to the overlay screen display region. Output -
Return Value
-
0: Successful.
-
-1: Failed.
-
-
Requirement
- Header file: mstarFb.h
-
Related Interface
4.2. FBIOSET_SCREEN_LOCATION¶
-
Function
Set overlay screen display region
-
Syntax
int ioctl (int fd,FBIOSET_SCREEN_LOCATION,MI_FB_Rectangle_t* pstRectangle);
-
Description
Use this interface to set overlay screen display region
-
Parameter
Parameter Name Description Input/Output fd Framebuffer device file descriptor Input FBIOSET_SCREEN_LOCATION ioctl number Input pstRectangle Pointer to MI_FB_Rectangle_t structure, including (x,y) coordinates, width, and height. It refers to the overlay screen display region. Input -
Return Value
-
0: Successful.
-
-1: Failed.
-
-
Requirement
- Header file: mstarFb.h
-
Related Interface
4.3. FBIOGET_SHOW¶
-
Function
Get current overlay display status
-
Syntax
int ioctl (int fd,FBIOGET_SHOW,MI_BOOL *bShow);
-
Description
Use this interface to get current overlay display status
-
Parameter
Parameter Name Description Input/Output Fd Framebuffer device file descriptor Input FBIOGET_SHOW ioctl number Input bShow Indicate the current overlay status: *bShow = MS_TRUE: Current overlay is in Show status *bShow = MS_FALSE: Current overlay is in Hidden status Output -
Return Value
-
0: Successful.
-
-1: Failed.
-
-
Requirement
- Header file: mstarFb.h
-
Related Interface
4.4. FBIOSET_SHOW¶
-
Function
Show or hide the overlay
-
Syntax
int ioctl (int fd,FBIOSET_SHOW,MI_BOOL *bShow);
-
Description
Use this interface to set the overlay display status: show or hide
-
Parameter
Parameter Name Description Input/Output fd Framebuffer device file descriptor Input FBIOSET_SHOW ioctl number Input bShow Display status of the overlay: *bShow = MS_TRUE: Show the current overlay *bShow = MS_FALSE: Hide the current overlay Input -
Return Value
-
0: Successful.
-
-1: Failed.
-
-
Requirement
- Header file: mstarFb.h
-
Related Interface
4.5. FBIOGET_GLOBAL_ALPHA¶
-
Function
Get overlay Alpha setting
-
Syntax
int ioctl (int fd,FBIOGET_GLOBAL_ALPHA,MI_FB_GlobalAlpha_t *pstAlpha);
-
Description
Use this interface to get current overlay Alpha setting
-
Parameter
Parameter Name Description Input/Output fd Framebuffer device file descriptor Input FBIOGET_GLOBAL_ALPHA ioctl number Input pstAlpha Pointer to MI_FB_GlobalAlpha_t structure Output -
Return Value
-
0: Successful.
-
-1: Failed.
-
-
Requirement
- Header file: mstarFb.h
-
Related Interface
4.6. FBIOSET_GLOBAL_ALPHA¶
-
Function
Set overlay Alpha
-
Syntax
int ioctl (int fd,FBIOSET_GLOBAL_ALPHA, MI_FB_GlobalAlpha_t *pstAlpha);
-
Description
Use this interface to set current overlay Alpha function
-
Parameter
Parameter Name Description Input/Output fd Framebuffer device file descriptor Input FBIOSET_GLOBAL_ALPHA ioctl number Input pstAlpha Pointer to MI_FB_GlobalAlpha_t structure Input -
Return Value
-
0: Successful.
-
-1: Failed.
-
-
Requirement
- Header file: mstarFb.h
-
Related Interface
4.7. FBIOGET_COLORKEY¶
-
Function
Get overlay colorkey
-
Syntax
int ioctl (int fd,FBIOGET_COLORKEY,MI_FB_ColorKey_t* pstColorKey);
-
Description
Use this interface to get overlay colorkey
-
Parameter
Parameter Name Description Input/Output Fd Framebuffer device file descriptor Input FBIOGET_COLORKEY ioctl number Input pstColorKey Pointer to MI_FB_ColorKey_t structure Output -
Return Value
-
0: Successful.
-
-1: Failed.
-
-
Requirement
- Header file: mstarFb.h
-
Related Interface
4.8. FBIOSET_COLORKEY¶
-
Function
Set the overlay colorkey
-
Syntax
int ioctl (int fd,FBIOSET_COLORKEY,MI_FB_ColorKey_t* pstColorKey);
-
Description
Use this interface to set current overlay colorkey function
-
Parameter
Parameter Name Description Input/Output fd Framebuffer device file descriptor Input FBIOSET_COLORKEY ioctl number Input pstColorKey Pointer to MI_FB_ColorKey_t structure Input -
Return Value
-
0: Successful.
-
-1: Failed.
-
-
Requirement
- Header file: mstarFb.h
-
Related Interface
4.9. FBIOSET_DISPLAYLAYER_ATTRIBUTES¶
-
Function
Set graphic layer information
-
Syntax
int ioctl (int fd,FBIOSET_DISPLAYLAYER_ATTRIBUTES, MI_FB_DisplayLayerAttr_t* pstLayerInfo);
-
Description
This interface is used to set graphic layer information, including screen display position, canvas resolution, memory resolution, screen display resolution, and capability of pre-multiplication of the graphic layer. For more details, see description with respect to MI_FB_DisplayLayerAttr_t.
-
Parameter
Parameter Name Description Input/Output fd Framebuffer device file descriptor Input FBIOSET_DISPLAYLAYER_ATTRIBUTES ioctl number Input pstLayerInfo Pointer to MI_FB_DisplayLayerAttr_t structure Output -
Return Value
-
0: Successful.
-
-1: Failed.
-
-
Requirement
- Header file: mstarFb.h
-
Related Interface
4.10. FBIOGET_DISPLAYLAYER_ATTRIBUTES¶
-
Function
Get graphic layer information
-
Syntax
int ioctl (int fd, FBIOGET_DISPLAYLAYER_ATTRIBUTES, MI_FB_DisplayLayerAttr_t * pstLayerInfo);
-
Description
Used to get graphic layer information, including screen display position, memory resolution, screen display resolution, and capability of pre-multiplication of the graphic layer.
-
Parameter
Parameter Name Description Input/Output fd Framebuffer device file descriptor Input FBIOGET_DISPLAYLAYER_ATTRIBUTES ioctl number Input pstLayerInfo Pointer to graphic layer information structure Output -
Return Value
-
0: Successful.
-
-1: Failed.
-
-
Requirement
- Header file: mstarFb.h
-
Related Interface
5. CURSOR RELATED FUNCTION¶
5.1. FBIOGET_CURSOR_ATTRIBUTE¶
-
Function
Get cursor graphic layer information
-
Syntax
int ioctl (int fd, FBIOGET_CURSOR_ATTRIBUTE, MI_FB_CursorAttr_t *pstCursorAttr)
-
Description
Get cursor graphic layer information, including hotspot, position, Alpha, Colorkey, and visibility.
-
Parameter
Parameter Name Description Input/Output fd Framebuffer device file descriptor Input FBIOGET_CURSOR_ATTRIBUTE ioctl number Input pstCursorAttr Pointer to MI_FB_CursorAttr_t structure Output -
Return Value
-
0: Successful.
-
-1: Failed.
-
-
Requirement
- Header file: mstarFb.h
-
Related Interface
5.2. FBIOSET_CURSOR_ATTRIBUTE¶
-
Function
Set cursor graphic layer information
-
Syntax
int ioctl (int fd, FBIOSET_CURSOR_ATTRIBUTE, MI_FB_CursorAttr_t *pstCursorAttr)
-
Description
Set cursor graphic layer information, including hotspot, position, Alpha, Colorkey, and visibility
-
Parameter
Parameter Name Description Input/Output fd Framebuffer device file descriptor Input FBIOSET_CURSOR_ATTRIBUTE ioctl number Input pstCursorAttr Pointer to MI_FB_CursorAttr_t structure Output -
Return Value
-
0: Successful.
-
-1: Failed.
-
-
Requirement
- Header file: mstarFb.h
-
Related Interface
6. ERROR CODE¶
The following table lists all error codes that may appear when the return value of the various functions is smaller than 0. These error codes originate from the standard Linux error code definitions. For details, please refer to the Linux Kernel source code errno_base.h. To check the error message, print the Linux standard error code errno or use strerror(errno).
Table 5-1: Error Code
Error Code | Macro Definition | Description |
---|---|---|
1 | EPERM | Invalid operation |
12 | ENOMEM | No memory |
14 | EFAULT | Invalid parameter pointer address |
22 | EINVAL | Invalid parameter |
7. FB DATA TYPE¶
7.1. Standard Data Type¶
7.1.1. struct fb_bitfield¶
-
Description
Bit field information for setting pixel format
-
Definition
struct fb_bitfield { u32 offset; /* beginning of bitfield */ u32 length; /* length of bitfield */ u32 msb_right; /* != 0: Most significant bit is right */ };
-
Member
Member Description Supportability offset Color component start bit Supported length Length of the bit occupied by the color component Supported msb_right Whether the bit on the right is the most significant bit. Only 0 is supported. That is, the leftmost bit is the most significant bit.
7.1.2. struct fb_var_screeninfo¶
-
Description
Variable screen information
-
Definition
struct fb_var_screeninfo { u32 xres; /* visible resolution */ u32 yres; u32 xres_virtual; /* virtual resolution */ u32 yres_virtual; u32 xoffset; /* offset from virtual to visible */ u32 yoffset; /* resolution */ u32 bits_per_pixel; /* guess what */ u32 grayscale; /* != 0 Graylevels instead of colors */ struct fb_bitfield red; /* bitfield in fb mem if true color, */ struct fb_bitfield green; /* else only length is significant */ struct fb_bitfield blue; struct fb_bitfield transp; /* transparency */ u32 nonstd; /* != 0 Non standard pixel format */ u32 activate; /* see FB_ACTIVATE_* */ u32 height; /* height of picture in mm */ u32 width; /* width of picture in mm */ u32 accel_flags; /* (OBSOLETE) see fb_info.flags */ /* Timing: All values in pixclocks, except pixclock (of course) */ u32 pixclock; /* pixel clock in ps (pico seconds) */ u32 left_margin; /* time from sync to picture */ u32 right_margin; /* time from picture to sync */ u32 upper_margin; /* time from sync to picture */ u32 lower_margin; u32 hsync_len; /* length of horizontal sync */ u32 vsync_len; /* length of vertical sync */ u32 sync; /* see FB_SYNC_* */ u32 vmode; /* see FB_VMODE_* */ u32 rotate; /* angle we rotate counter clockwise */ u32 reserved[5]; /* Reserved for future compatibility */ };
-
Member
Member Description Supportability xres Visible screen width (number of pixels) Supported yres Visible screen height (number of pixels) Supported xres_virtual Virtual screen width (image width in memory). When the value is smaller than xres, xres will be modified to be equal to that value. Supported yres_virtual Virtual screen height (image height in memory). When the value is smaller than yres, yres will be modified to be equal to that value. If used in combination with xres_virtual, this parameter can pan image quickly in horizontal or vertical direction. Supported xoffset Number of offset pixels in x direction Supported, default is 0 yoffset Number of offset pixels in y direction Supported, default is 0 bits_per_pixel Number of bits occupied by each pixel Supported grayscale Grayscale Not supported, default is 0 (color) red Red bit field information in the color component Supported green Green bit field information in the color component Supported blue Blue bit field information in the color component Supported transp Alpha bit field information in the color component Supported nonstd Indicates whether standard pixel format is used Not supported, default is 0 (standard pixel format supported) Member Description Supportability activate Set the time of activation Not supported, default is FB_ACTIVATE_NOW (activated immediately) height Screen height, unit is mm Not supported, default is -1 width Screen width, unit is mm Not supported, default is -1 accel_flags Acceleration flag Not supported, default is -1 pixclock Time required to show a pixel, unit is ns Not supported, default is -1 left_margin Represent the left blanking signal, the right blanking signal, and the horizontal synchronization duration. The sum of these values is equal to the horizontal retrace time in unit of dot clock. Not supported, default is 64 right_margin hsync_len upper_margin Represent the upper blanking signal, the lower blanking signal, and the vertical synchronization duration. The sum of these values is equal to the vertical retrace time in unit of dot clock. Not supported, default is -1 lower_margin vsync_len sync Signal synchronization method Not supported, default is -1 vmode Scan mode Not supported, default is -1 rotate Angle of rotation clockwise Not supported, default is 0 (no rotation) -
Note
The default resolution of the HD device graphics layer is 1280x720; the default resolution of the SD device graphics layer is 720x576, and the cursor layer default resolution is 128x128. The pixel format is ARGB1555.
-
Related Data Type and Interface
7.1.3. struct fb_fix_screeninfo¶
-
Description
Fixed screen information
-
Definition
struct fb_fix_screeninfo { char id[16]; /* identification string eg "TT Builtin" */ unsigned long smem_start; /* Start of frame buffer mem (physical address) */ u32 smem_len; /* Length of frame buffer mem */ u32 type; /* see FB_TYPE_* */ u32 type_aux; /* Interleave for interleaved Planes */ u32 visual; /* see FB_VISUAL_* */ u16 xpanstep; /* zero if no hardware panning */ u16 ypanstep; /* zero if no hardware panning */ u16 ywrapstep; /* zero if no hardware ywrap */ u32 line_length; /* length of a line in bytes */ unsigned long mmio_start; /* Start of Memory Mapped I/O (physical address) */ u32 mmio_len; /* Length of Memory Mapped I/O */ u32 accel; /* Indicate to driver which specific chip/card we have */ u16 reserved[3]; /* Reserved for future compatibility */ };
-
Member
Member Description Supportability id Device driver name Supported smem_start Memory start physical address Supported smem_len Memory size Supported type Graphics card type Fixed to FB_TYPE_PACKED_PIXELS(pixel values closely packed) type_aux Auxiliary type Not supported. Undefined graphics card type under FB_TYPE_PACKED_PIXELS. visual Color mode Not supported, default is FB_VISUAL_TRUECOLOR (true color) xpanstep Support horizontal PAN display or not:
0: Not supported
ǂ 0: Supported. The value in this case is used to indicate the pixel value per step in the horizontal directionFixed to 1 ypanstep Support vertical PAN display or not:
0: Not supported
ǂ 0: Supported. The value in this case is used to indicate the pixel value per step in the vertical directionFixed to 1 ywrapstep Smilar to ypanstep, except that when it is displayed to the bottom, it can be returned to the beginning of the video memory for display. Not supported, default is 0 line_length Number of bytes per line Supported mmio_start Memory map I/O start address Not supported, default is 0 mmio_len Memory map I/O length Not supported, default is 0 accel Indicate the hardware acceleration device supported Not supported, default is FB_ACCEL_NONE (no acceleration) reserved Reserved Not supported, default is 0 -
Related Data Type and Interface
7.2. Extended Data Type¶
7.2.1. MI_FB_ColorFmt_e¶
-
Description
Collection of pixel formats supported by SigmaStar FB
-
Definition
typedef enum { E_MI_FB_COLOR_FMT_RGB565 = 1, E_MI_FB_COLOR_FMT_ARGB4444 =2, E_MI_FB_COLOR_FMT_ARGB8888 =5, E_MI_FB_COLOR_FMT_ARGB1555 =6, E_MI_FB_COLOR_FMT_YUV422 =9, /// Invalid color format. E_MI_FB_COLOR_FMT_INVALID = 12, }MI_FB_ColorFmt_e;
-
Member
Member Description E_MI_FB_COLOR_FMT_RGB565 RGB565 format E_MI_FB_COLOR_FMT_ARGB4444 ARGB444 format E_MI_FB_COLOR_FMT_ARGB8888 ARGB8888 format E_MI_FB_COLOR_FMT_ARGB1555 ARGB1555 format E_MI_FB_COLOR_FMT_YUV422 YUV422 format E_MI_FB_COLOR_FMT_INVALID Invalid pixel format -
Related Data Type and Interface
7.2.2. MI_FB_DisplayLayerAttrMaskbit_e¶
-
Description
Indicate which members in the MI_FB_DisplayLayerAttr_t structure have been updated
-
Definition
typedef enum { E_MI_FB_DISPLAYLAYER_ATTR_MASK_DISP_POS = 0x1, E_MI_FB_DISPLAYLAYER_ATTR_MASK_DISP_SIZE = 0x2, E_MI_FB_DISPLAYLAYER_ATTR_MASK_BUFFER_SIZE = 0x4, E_MI_FB_DISPLAYLAYER_ATTR_MASK_SCREEN_SIZE = 0x8, E_MI_FB_DISPLAYLAYER_ATTR_MASK_PREMUL = 0x10, E_MI_FB_DISPLAYLAYER_ATTR_MASK_COLOR_FMB = 0x20, E_MI_FB_DISPLAYLAYER_ATTR_MASK_OUTPUT_COLORSPACE = 0x40, E_MI_FB_DISPLAYLAYER_ATTR_MASK_DST_DISP = 0x80, } MI_FB_DisplayLayerAttrMaskbit_e;
-
Member
Member Description E_MI_FB_DISPLAYLAYER_ATTR_MASK_DISP_POS Overlay position changed E_MI_FB_DISPLAYLAYER_ATTR_MASK_DISP_SIZE Width or height of overlay screen display region changed E_MI_FB_DISPLAYLAYER_ATTR_MASK_BUFFER_SIZE Display resolution changed E_MI_FB_DISPLAYLAYER_ATTR_MASK_SCREEN_SIZE Screen resolution changed E_MI_FB_DISPLAYLAYER_ATTR_MASK_PREMUL Pre-multiplication attribute changed E_MI_FB_DISPLAYLAYER_ATTR_MASK_COLOR_FMB FB color format attribute changed E_MI_FB_DISPLAYLAYER_ATTR_MASK_OUTPUT_COLORSPACE Overlay output color space changed E_MI_FB_DISPLAYLAYER_ATTR_MASK_DST_DISP Overlay output to display chain target module changed -
Related Data Type and Interface
7.2.3. MI_FB_GlobalAlpha_t¶
-
Description
Alpha information structure
-
Definition
typedef struct MI_FB_GlobalAlpha_s { MI_BOOL bAlphaEnable; /* alpha enable flag */ MI_BOOL bAlphaChannel; /* alpha channel enable flag */ MI_BOOL bAlphaInvert; /* alpha invert flag */ MI_U8 u8Alpha0; /* alpha0 value */ MI_U8 u8Alpha1; /* alpha1 value */ MI_U8 u8GlobalAlpha; /* global alpha value */ MI_U8 u8Reserved; } MI_FB_GlobalAlpha_t;
-
Member
Member Description bAlphaEnable Alpha overlay enable, default is 1 bAlphaChannel Alpha channel enable, default is 0 bAlphaInvert Alpha invert flag, used to that 0 is opaque in argb1555 format. u8Alpha0 Alpha0 value. Range: 0~255, default is 255. In RGB1:5:5:5 format, when the most significant bit is 0, this value will be chosen as the Alpha overlay value. u8Alpha1 Alpha1 value. Range: 0~255, default is 255. In RGB1:5:5:5 format, when the most significant bit is 1, this value will be chosen as the Alpha overlay value. u8GlobalAlpha Global Alpha value. Range: 0~255, default is 255. Works when Alpha channel is enabled. u8Reserved Reserved -
Note
Alpha0 just for cursor, alpha0 is 0 for UI.
Alpha overlay is implemented only when Alpha overlay function is enabled. Otherwise, the upper layer overlay will replace the lower layer overlay.
The formula for Alpha overlay value calculation can be divided into the following cases:
-
When Alpha channel is enabled, global Alpha will be included in the overlay.
-
If global Alpha and pixel Alpha overlay are not supported, the Alpha overlay value is calculated as: u8GlobalAlpha
-
If global Alpha and pixel Alpha overlay are supported, the Alpha overlay value is calculated as: u8GlobalAlpha * pixel
-
-
When Alpha channel is not enabled, the Alpha overlay value is equal to the pixel Alpha value, that is: pixel
-
-
Related Data Type and Interface
7.2.4. MI_FB_ColorKey_t¶
-
Description
Colorkey information structure for setting colorkey attribute
-
Definition
typedef struct MI_FB_ColorKey_s { MI_BOOL bKeyEnable; MI_U8 u8Red; MI_U8 u8Green; MI_U8 u8Blue; } MI_FB_ColorKey_t
-
Member
Member Description bKeyEnable Colorkey enable.
TRUE: Enable
FALSE: Not enableu8Red Colorkey R component value u8Green Colorkey G component value u8Blue Colorkey B component value -
Related Data Type and Interface
7.2.5. MI_FB_Rectangle_t¶
-
Description
MI_FB_Rectangle_t structure for describing overlay display region
-
Definition
typedef struct MI_FB_Rectangle_s { MI_U32 u32Xpos; MI_U32 u32Ypos; MI_U32 u32Width; MI_U32 u32Height; }MI_FB_Rectangle_t;
-
Member
Member Description u32Xpos Upper left corner x coordinate u32Ypos Upper left corner y coordinate u32Width Width u32Height Height -
Related Data Type and Interface
7.2.6. MI_FB_DisplayLayerAttr_t¶
-
Description
MI_FB_DisplayLayerAttr_t structure for describing the overlay attribute information
-
Definition
typedef struct MI_FB_DisplayLayerAttr_s { MI_U32 u32Xpos; /**the x pos of orign point in screen*/ MI_U32 u32YPos; /**the y pos of orign point in screen*/ MI_U32 u32dstWidth; /**display buffer dest with in screen*/ MI_U32 u32dstHeight; /**display buffer dest hight in screen*/ MI_U32 u32DisplayWidth; /**the width of display buf in fb */ MI_U32 u32DisplayHeight; /**the height of display buf in fb. */ MI_U32 u32ScreenWidth; /**the width of screen */ MI_U32 u32ScreenHeight; /** the height of screen */ MI_BOOL bPreMul; /**the data drawed in buffer whether is premultiply alpha or not*/ MI_FB_ColorFmt_e eFbColorFmt; /**the color format of framebuffer*/ MI_FB_OutputColorSpace_e eFbOutputColorSpace; /**output color space*/ MI_FB_DstDisplayplane_e eFbDestDisplayPlane; /**destination displayplane*/ MI_U32 u32SetAttrMask; /** display attribute modify mask*/ }MI_FB_DisplayLayerAttr_t;
-
Member
Member Description u32Xpos The x-axis origin of the graphics layer on the screen u32YPos The y-axis origin of the graphics layer on the screen u32dstWidth The display width of the graphics layer on the screen u32dstHeight The display height of the graphics layer on the screen u32DisplayWidth Width of memory resolution u32DisplayHeight Height of memory resolution u32ScreenWidth Width of screen display resolution u32ScreenHeight Height of screen display resolution bPreMul Whether the data in FB is pre-multiplied eFbColorFmt FB pixel format u32SetAttrMask Parameter modification mask bit when setting graphics layer information eFbOutputColorSpace Set the overlay output color space eFbDestDisplayPlane Set the overlay output to display chain target module. Default is E_MI_FB_DST_OP0. -
Related Data Type and Interface
7.2.7. MI_FB_OutputColorSpace_e¶
-
Description
FB overlay output color space
-
Definition
typedef enum { E_MI_FB_OUTPUT_RGB = 0, E_MI_FB_OUTPUT_YUV = 1 }MI_FB_OutputColorSpace_e
-
Member
Member Description E_MI_FB_OUTPUT_RGB RGB Color Space E_MI_FB_OUTPUT_YUV YUV Color Space -
Related Data Type and Interface
7.2.8. MI_FB_DstDisplayplane_e¶
-
Description
FB overlay output to display chain target module. By configuring different Display chains, you can select the image adjustment process that the overlay participates in.
-
Definition
typedef enum { E_MI_FB_DST_OP0 = 0, E_MI_FB_DST_OP1 = 1, E_MI_FB_DST_INVALID }MI_FB_DstDisplayplane_e
-
Member
Member Description E_MI_FB_DST_OP0 OP path E_MI_FB_DST_OP1 OP1 path E_MI_FB_DST_INVALID MIXER2OP1 -
Note
This interface is only valid for Ikayaki series chips.
-
Related Data Type and Interface
7.2.9. MI_FB_CursorAttrMaskbit_e¶
-
Description
Describe which attributes in the MI_FB_CursorAttr_t structure has been updated
-
Definition
typedef enum { E_MI_FB_CURSOR_ATTR_MASK_ICON = 0x1, E_MI_FB_CURSOR_ATTR_MASK_POS = 0x2, E_MI_FB_CURSOR_ATTR_MASK_ALPHA = 0x4, E_MI_FB_CURSOR_ATTR_SHOW = 0x8, E_MI_FB_CURSOR_ATTR_HIDE = 0x10, E_MI_FB_CURSOR_ATTR_MASK = 0x1F } MI_FB_CursorAttrMaskbit_e;
-
Member
Member Description E_MI_FB_CURSOR_ATTR_MASK_ICON Cursor icon changed E_MI_FB_CURSOR_ATTR_MASK_POS Cursor position changed E_MI_FB_CURSOR_ATTR_MASK_ALPHA Alpha changed E_MI_FB_CURSOR_ATTR_SHOW Show cursor E_MI_FB_CURSOR_ATTR_MASK_HIDE Hide cursor E_MI_FB_CURSOR_ATTR_MASK Indicate all cursor attributes that can be configured -
Related Data Type and Interface
7.2.10. MI_FB_CursorImage_t¶
-
Description
MI_FB_CursorImage_t structure for describing cursor icon data information
-
Definition
typedef struct MI_FB_CursorImage_s { MI_U32 u32Width; /**width, unit pixel*/ MI_U32 u32Height; /**Height, unit pixel*/ MI_U32 u32Pitch; /**Pitch, unit pixel*/ MI_FB_ColorFmt_e eColorFmt; /**Color format*/ const char* data; }MI_FB_CursorImage_t;
-
Member
Member Description u32Width Icon width u32Height Icon height u32Pitch Pitch eColorFmt Icon data pixel format data Icon data -
Note
The maximum value of icon width and height is 128
-
Related Data Type and Interface
7.2.11. MI_FB_CursorAttr_t¶
-
Description
MI_FB_CursorAttr_t structure for describing cursor icon information
-
Definition
typedef struct MI_FB_CursorAttr_s { MI_U32 u32XPos; MI_U32 u32YPos; MI_U32 u32HotSpotX; MI_U32 u32HotSpotY; MI_FB_GlobalAlpha_t stAlpha; MI_FB_ColorKey_t stColorKey; MI_BOOL bShown; MI_FB_CursorImage_t stCursorImageInfo; MS_U16 u16CursorAttrMask; }MI_FB_CursorAttr_t;
-
Member
Member Description u32XPos X coordinate of cursor position u32YPos Y coordinate of cursor position u32HotSpotX X coordinate of cursor hotspot u32HotSpotY Y coordinate of cursor hotspot stAlpha Cursor graphics layer alpha information of MI_FB_GlobalAlpha_t structure stColorKey Cursor graphics layer colorkey information of MI_FB_ColorKey_t structure bShown Cursor visibility. TRUE means visible, and FALSE means invisible. MI_FB_CursorImage_t Icon data information u16CursorAttrMask Set the cursor graphics layer parameter modification mask bit -
Related Data Type and Interface
8. PROCFS INTRODUCTION¶
8.1. cat¶
-
Debug info
# cat /proc/mi_modules/mi_fb0 ############################OnDumpOSDAttr#################################### Framebuffer id = MStar FB0 xres=1280, yres=720 xres_virtual=1280, yres_virtual=1440 xoffset=0,yoffset=0 fix.line_length=0xa00 Bytes fix.smem_start=0xf800000 Memory Size=0x400000 Bytes Gop ID=0 Gwin ID=0 Open Count=1 Visible State=0 MIU Sel=0 ColorSpace=YUV ColorFomrmat=ARGB1555 StretchWindow Pos[0,0] StretchWindow Src[1280,720],StretchWindow Dst[1920,1080] Gwin Pos[0,0] Gwin Size[1280,720] Gwin PhyAddr=0x0 ColorKey Enable=0 ColorKey Val=[0,0,0] Enable Alpha Blend=1 Enalbe Multi Alpha=0 Global Alpha Val=0x0 Alpha0=0x0,Alpha1=0x0,(Only for ARGB1555) GOP Hstart=192 Current TimingWidth=1920,TimingWidth=1080,hstar=192 ##################################end########################################## #########################OnDumpHwcursorAttr#################################### Cursor Gop ID=4 Cursor Gwin ID=6 Cursor MIU Sel=0 Cursor PhyAddr=0x166000 Cursor ColorFmt=ARGB8888 Cursor Icon Width=44,Height=56 Cursor HotSpot[18,9] Cursor request pos[712,207] Cursor Visible=1 Cursor Gwin Pos[694,198] Cursor Gwin Size[44,56] Cursor Gwin Pitch=0x200 Bytes Curosr StretchWindow pos[0,0] Cursor StretchWin Src[1280,720],Dst[1920,1080] Cursor ColorKey Enable=0 Cursor ColorKey Value=[0xff,0xff,0xff] ############################OnDumpHwcursorAttr#################################
-
Debug info analysis
Record the current Fbdev and Hwcursor usage status and OSD layer/OSD device/Hwcursor attributes, and can dynamically obtain information, which is convenient for debugging and testing.
-
Parameter Description
Parameter Description OSD info Framebuffer id Framebuffer device ID xres Visible resolution width yres Visible resolution height xres_virtual Virtual resolution width yres_virtual Virtual resolution height xoffset X offset from visible resolution to virtual resolution yoffset Y offset from visible resolution to virtual resolution fix.line_length Bytes per line of virtual resolution fix.smem_start Start address in frame buffer Memory Size Frame buffer memory size, unit: byte OSD device info Gop ID Hardware ID of the layer Gwin ID ID of the hardware display window Open Count Open count of this layer. Add 1 when the user calls open(); minus 1 when calling close() Visible State Display status of this layer. Value: 1: visible; 0: invisible. The user calls FBIOSET_SHOW to set the layer state. MIU Sel The physical memory number for storing frame buffer data. For MSR620 devices, the value is 0. ColorSpace The color space of the layer output. Value: YUV: Output YUV color space, default value; RGB: Output RGB color space. ColorFomrmat Layer color format. Value: ARGB1555, ARGB4444, ARGB8888, RGB565. Update after the user sets the format item in the variable screen. StretchWindow Pos The starting position of the layer on display device. Unit: pixel, default is 0, user can call FBIOSET_SCREEN_LOCATION to set it StretchWindow Src The width and height of the original resolution of the layer. Unit: pixel. Use the hardware zoom function to zoom in to the current timing. Update after the user sets the visible resolution in the variable screen. StretchWindow Dst The width and height of the layer on the display device. By default it is set to output timing size. Set by FBIOSET_SCREEN_LOCATION. Gwin Pos The starting position of the layer display window. Unit: pixel, for OSD, the value is always (0,0) Gwin Size The width and height of the layer display window. Unit: pixel. For OSD, this value is always set to the width and height of the visible resolution. Update after the user sets the visible resolution in the variable screen. Gwin PhyAddr The physical address of the layer currently displayed data ColorKey Enable Enable colorKey or not. Value: 0: N; 1: Y; User can set it by FBIOSET_COLORKEY ColorKey Val RED/GREEN/BLUE channels of ColorKey. Value range of each channel: 0-255. ColorKey val value is in RGB888 format. Users can update it after setting FBIOSET_COLORKEY. Enable Alpha Blend Enable Alpha Blend or not. Value: 0: N; 1: Y, default. Users can update it after setting FBIOSET_GLOBAL_ALPHA. Pixel alpha config is invalid when disabled it. Only pixel alpha is valid when it is enabled and Multi Alpha is disabled. (For ARGB1555 format, Alpha bit is 1, using Global Alpha as pixel alpha; Alpha bit is 0, using 0xff as pixel alpha.) When this item and Multi Alpha are enabled, the pixel alpha and Global Alpha are both valid. Enable Multi Alpha Enable Multi Alpha or not. Value: 0: Y; 1: N, default value. Enable Multi Alpha, then Global Alpha are valid. Global Alpha Val Global Alpha Alpha0 In ARGB1555 format, when the highest bit is 0, select Alpha0 as the Alpha blending value. Value: 0~255, the default is 0. Alpha1 In ARGB1555 format, when the highest bit is 1, select Alpha1 as the Alpha blending value. Value: 0~255, the default is 0. GOP Hstart The offset of the layer hardware to the display window. This value is related to the current output timing. When the output timing changes, the layer driver is notified by FBIOSET_DISPLAYLAYER_ATTRIBUTES and the u32SetAttrMask value of MI_FB_DisplayLayerAttr_s contains the E_MI_FB_DISPLAYLAYER_ATTR_MASK_SCREEN_SIZE mask bit. The layer driver will set the corresponding hstart value according to the current timing Current TimingWidth The width and height of the current output timing and the offset relative to the display window that should be set for the layer hardware under the current timing. Used in conjunction with GOP Hstart to check whether the hstart value set to the hardware layer is consistent with the current timing. Current TimingHeight hstar Hwcursor info Cursor Gop ID Cursor layer hardware ID Cursor Gwin ID Cursor layer hardware display window ID Cursor MIU Sel The physical memory number for storing cursor icon data. For MSR620 devices, the value is 0. Cursor PhyAddr The physical address of the cursor layer currently displayed data Cursor ColorFmt The cursor layer format. Value: ARGB1555,ARGB4444,ARGB8888,RGB565. User can set it by FBIOSET_CURSOR_ATTRIBUTE Cursor Icon Width The width and height of the cursor icon. Unit: pixel, user can set it by FBIOSET_CURSOR_ATTRIBUTE. Cursor HotSpot Cursor icon hotspot information. Unit: pixel. Hotspot information is usually related to the cursor icon, and user can set it by FBIOSET_CURSOR_ATTRIBUTE Cursor request pos Cursor request position. Unit: pixel. User can set it by FBIOSET_CURSOR_ATTRIBUTE. Cursor Visible Cursor visible or not. Value: 0: N; 1: Y. User can set it by FBIOSET_CURSOR_ATTRIBUTE. Cursor Gwin Pos Cursor Gwin starting position. Unit: pixel. Cursor Gwin Pitch Bytes per line of the cursor layer. The value is fixed at 0x200. Curosr StretchWindow pos Cursor layer starting position on the display device. Unit: pixel. Cursor StretchWin Src Original size of cursor layer. Unit: pixel. This value is usually the same as the OSD display resolution. Cursor StretchWin Dst The width and height of the cursor layer on the display device. The value is the same as the output timing. Cursor ColorKey Enable Cursor ColorKey enable or not. Value: 0: N; 1: Y. User can set it by FBIOSET_CURSOR_ATTRIBUTE. Cursor ColorKey Value RED/GREEN/BLUE channels of cursor colorKey. Value range of each channel: 0-255. ColorKey val value is in RGB888 format. Users can update after setting FBIOSET_CURSOR_ATTRIBUTE.
8.2. echo¶
Function | Turn on or off the specified layer |
---|---|
Command | echo GUI_SHOW [LayerID] [Status] > /proc/mi_modules/mi_fb0 |
Parameter Description | [LayerID] Layer id [Status] on / off |
Example | echo GUI_SHOW 0 on > /proc/mi_modules/mi_fb0 Turn on the layer fb0 echo GUI_SHOW 0 off > /proc/mi_modules/mi_fb0 Turn off the layer fb0 |
Function | Turn on or off the HW cursor |
---|---|
Command | echo CURSOR_SHOW [Status] > /proc/mi_modules/mi_fb0 |
Parameter Description | [Status] on / off |
Example | echo CURSOR_SHOW on > /proc/mi_modules/mi_fb0 Turn on the cursor echo CURSOR_SHOW off > /proc/mi_modules/mi_fb0 Turn off the cursor |
Function | Set Colorkey for the specified layer |
---|---|
Command | echo GUI_SET_CLRKEY [LayerID] [Red] [Green] [Blue] > /proc/mi_modules/mi_fb0 |
Parameter Description | [LayerID] Layer id [Red] Red component, hex , in ARGB888 format. [Green] Green component, hex, in ARGB888 format. [Blue] Blue component, hex, in ARGB888 format. |
Example | echo GUI_SET_CLRKEY 0 ff 00 00 > /proc/mi_modules/mi_fb0 Set the Colorkey of fb0 to red. |
Function | Dump the current displayed cursor icon |
---|---|
Command | echo CURSOR_DUMP [Path] >/proc/mi_modules/mi_fb0 |
Parameter Description | [Path] Path to save dump data |
Example | echo CURSOR_DUMP /mnt > /proc/mi_modules/mi_fb0 Dump cursor icon to /mnt, the file name is CursorData.raw, open with 7yuv, set the width and height to 128, and display Rawdata according to the cursor format setting. |
Function | Set the pixel alpha value for alpha bit0 and alpha bi1 of ARGB1555 format respectively. Because currently msr620 does not support this feature, it has not been implemented yet |
---|---|
Command | echo GUI_SETALPHA_ARGB1555 [LayerID] [Alpha0] [Alpha1]> /proc/mi_modules/mi_fb0 |
Parameter Description | [LayerID] Layer id [Alpha0] alpha0 value [Alpha1] alpha1 value |
Example | None |