设计说明
源码和框架说明
源码说明
本模块源代码的目录结构如下:
文件名 |
含义 |
---|---|
drv_fb.c |
显示驱动框架 |
drv_de.c |
显示引擎驱动 |
drv_rgb.c |
RGB 显示接口驱动 |
drv_lvds.c |
LVDS 显示接口驱动 |
drv_dsi.c |
MIPI-DSI 显示接口驱动 |
drv_dbi.c |
MIPI-DBI 显示接口驱动 |
disp_com.h |
显示驱动共用的头文件,定义了共用数据结构、全局函数等 |
disp_conf.h |
显示接口配置文件 |
disp_ccm.h |
CCM 色彩矩阵配置文件 |
disp_gamma.h |
Gamma 配置文件 |
文件名 |
含义 |
---|---|
panel_com.c |
LCD 屏公用代码 |
panel_com.h |
显示驱动共用的头文件,其中定义了共用数据结构、全局函数等 |
panel-simple.c |
为 RGB 和 LVDS 接口提供的一款通用的 LCD 驱动 |
panel_dsi.c |
为 MIPI-DSI 屏幕封装的函数,方便屏幕适配 |
panel_dsi.h |
为 MIPI-DSI 屏幕封装的函数的头文件 |
panel_dbi.c |
为 MIPI-DBI 协议封装的函数,方便屏幕适配 |
panel_dbi.h |
为 MIPI-DBI 协议封装函数的头文件 |
panel_xxxx.c |
为屏驱 IC 适配的专用驱动 |
文件名 |
含义 |
---|---|
aic_hal_rgb.c |
RGB 显示接口 HAL 层,操作 RGB 接口寄存器 |
aic_hal_de.c |
DE 显示引擎 HAL 层,操作 DE 接口寄存器 |
aic_hal_dsi.c |
MIPI-DSI 显示接口 HAL 层,操作 DSI 接口寄存器 |
aic_hal_dbi.c |
MIPI-DBI 显示接口 HAL 层,操作 DBI 接口寄存器 |
软硬件设计
在 Chip 运行过程中,显示接口只能输出一种标准信号,其数据链路是确定的。显示接口硬件框图如下所示:


MIPI-DBI 协议
Mobile Industry Processor Interface - Display Bus Interface (MIPI-DBI) 是一种用于显示接口的协议,主要用于移动设备中的显示屏连接。MIPI-DBI 是软件虚拟出来的 device,为 MIPI-DBI 协议提供支持。MIPI-DBI 协议支持多种类型的数据传输方式:
-
Type A: Motorola 6800
-
Type B: Intel 8080
-
Type C: SPI
ArtInChip 平台支持 MIPI-DBI 协议中的 Type B 和 Type C,可以与使用这两种类型的 MIPI-DBI 接口的显示屏进行通信。
结构体定义
- struct platform_driverDE 和 DI 在显示框架上属于同级模块,都是 DSS 的 component,使用 struct platform_driver 来表示。
struct platform_driver { const char *name; int component_type; int (*probe)(void); void (*remove)(void); union { struct di_funcs *di_funcs; struct de_funcs *de_funcs; }; };
- struct aic_panelLCD panel 使用 struct aic_panel 来表示。严格来说,panel component 不算一个 driver,只是一些屏参数和回调函数的集合。
struct aic_panel { const char *name; struct aic_panel_funcs *funcs; struct aic_panel_callbacks callbacks; const struct display_timing *timings; union { struct panel_rgb *rgb; struct panel_lvds *lvds; struct panel_dsi *dsi; struct panel_dbi *dbi; }; int connector_type; };
-
struct aic_panel_funcs*funcs; 由 panel 提供,供 fb 调用的回调
-
struct aic_panel_callbackscallbacks; 由 DE/DI 提供,供 panel 调用的回调
-
在 panel 提供的 struct aic_panel_funcs 中,会调用 DE/DI 提供的 struct aic_panel_callbacks。
callbacks 的设计是为了满足 DE、DI、panel 三个硬件模块的初始化时序,包含先后顺序、延迟大小等。时序约束主要来自 panel 侧。
-
关键流程设计
初始化流程

-
DE 和 DI 匹配
DE 和 DI 匹配是通过遍历 drivers 指针数组,通过 component_type 来匹配 menuconfig 指定的 DI。
DE/DI 的 driver 存放在一个指针数组中。DE 默认使能,DI 通过 menuconfig 选择一种接口标准。static struct platform_driver *drivers[] = { #ifdef AIC_DISP_DE_DRV &artinchip_de_driver, #endif #ifdef AIC_DISP_RGB &artinchip_rgb_driver, #endif #ifdef AIC_DISP_LVDS &artinchip_lvds_driver, #endif #ifdef AIC_DISP_MIPI_DSI &artinchip_dsi_driver #endif #ifdef AIC_DISP_MIPI_DBI &artinchip_dbi_driver #endif };
-
Panel 的匹配panel_com.c 保存了一个 panel 指针数组,通过 menuconfig 选择其中一个。
static struct aic_panel *panels[] = { #if defined(AIC_DISP_RGB) && defined(AIC_SIMPLE_PANEL) &aic_panel_rgb, #endif #if defined(AIC_DISP_LVDS) && defined(AIC_SIMPLE_PANEL) &aic_panel_lvds, #endif #ifdef AIC_DSI_SIMPLE_PANEL &dsi_simple, #endif #ifdef AIC_PANEL_DSI_XM91080 &dsi_xm91080, #endif #ifdef AIC_PANEL_DSI_ST7797 &dsi_st7797, #endif #ifdef AIC_PANEL_DSI_ST7703 &dsi_st7703, #endif ... };
struct aic_panel*aic_find_panel(u32connector_type)
会遍历 panels 指针数组,获取一个跟 DI 匹配的 LCD panel。simple panel 为不需要初始化操作的 LCD 提供驱动支持,例如 RGB、LVDS 屏幕。
数据结构说明
本节段介绍了多个结构体和枚举类型的代码示例,用于描述和管理显示框架缓冲区 (Framebuffer) 的配置,包括矩形区域、点坐标、大小、像素格式、缓冲区属性、图层数据、颜色键、Alpha 混合、CCM(Color Correction Matrix)、Gamma 校正以及屏幕信息。
mpp_types.h
路径:bsp/artinchip/include/uapi/mpp_types.h
-
struct mpp_rect
struct mpp_rect { int x; int y; int width; int height; };
-
struct mpp_point
struct mpp_point { int x; int y; };
-
struct mpp_size
struct mpp_size { int width; int height; };
-
enum mpp_pixel_format
enum mpp_pixel_format { MPP_FMT_ARGB_8888 = 0x00, MPP_FMT_ABGR_8888 = 0x01, MPP_FMT_RGBA_8888 = 0x02, MPP_FMT_BGRA_8888 = 0x03, MPP_FMT_XRGB_8888 = 0x04, MPP_FMT_XBGR_8888 = 0x05, MPP_FMT_RGBX_8888 = 0x06, MPP_FMT_BGRX_8888 = 0x07, MPP_FMT_RGB_888 = 0x08, MPP_FMT_BGR_888 = 0x09, MPP_FMT_ARGB_1555 = 0x0a, MPP_FMT_ABGR_1555 = 0x0b, MPP_FMT_RGBA_5551 = 0x0c, MPP_FMT_BGRA_5551 = 0x0d, MPP_FMT_RGB_565 = 0x0e, MPP_FMT_BGR_565 = 0x0f, MPP_FMT_ARGB_4444 = 0x10, MPP_FMT_ABGR_4444 = 0x11, MPP_FMT_RGBA_4444 = 0x12, MPP_FMT_BGRA_4444 = 0x13, MPP_FMT_YUV420P = 0x20, MPP_FMT_NV12 = 0x21, MPP_FMT_NV21 = 0x22, MPP_FMT_YUV422P = 0x23, MPP_FMT_NV16 = 0x24, MPP_FMT_NV61 = 0x25, MPP_FMT_YUYV = 0x26, MPP_FMT_YVYU = 0x27, MPP_FMT_UYVY = 0x28, MPP_FMT_VYUY = 0x29, MPP_FMT_YUV400 = 0x2a, MPP_FMT_YUV444P = 0x2b, MPP_FMT_YUV420_64x32_TILE = 0x30, MPP_FMT_YUV420_128x16_TILE = 0x31, MPP_FMT_YUV422_64x32_TILE = 0x32, MPP_FMT_YUV422_128x16_TILE = 0x33, MPP_FMT_MAX, };
artinchip_fb.h
路径: bsp/artinchip/include/uapi/artinchip_fb.h
-
struct aicfb_layer_num
/** * struct aicfb_layer_num - aicfb layer number * @vi_num: number of video layers * @ui_num: number of UI layers * * total_layer_num = vi_num + ui_num * * layer id range: [0, total_layer_num - 1] */ struct aicfb_layer_num { unsigned int vi_num; unsigned int ui_num; };
-
struct aicfb_layer_capability
/** * struct aicfb_layer_capability - aicfb layer capability * @layer_id: the layer id * @layer_type: the layer type * 0: UI layer * 1: Video layer * @max_width: the max pixels per line * @max_height: the max lines * @cap_flags: flags of layer capability */ struct aicfb_layer_capability { unsigned int layer_id; unsigned int layer_type; unsigned int max_width; unsigned int max_height; unsigned int cap_flags; };
-
struct aicfb_buffer
/** * struct aicfb_buffer - aicfb frame buffer * @phy_addr[3]: address of frame buffer * single addr for interleaved fomart with 1 plane, * double addr for semi-planar fomart with 2 planes, * triple addr for planar format with 3 planes * @size: width and height of aicfb_buffer * @stride[3]: stride for all planes * @crop_en: corp disable/enable ctrl * 0: disable crop the buffer * 1: enable crop the buffer * @crop: crop info * @format: color format * @buf_flags: aicfb buffer flags */ struct aicfb_buffer { unsigned int phy_addr[AICFB_PLANE_NUM]; unsigned int dmabuf_fd[AICFB_PLANE_NUM]; unsigned int stride[AICFB_PLANE_NUM]; struct aic_size size; unsigned int crop_en; struct aic_rect crop; enum aic_pixel_format format; unsigned int buf_flags; };
-
struct aicfb_layer_data
/** * struct aicfb_layer_data - aicfb layer data * @enable * 0: disable the layer * 1: enable the layer * @layer_id: the layer id * * @rect_id: the rectanglular window id of the layer * only used by layers with multi-rectangular windows * for example: if the layer has 4 rectangular windows, * rect_id can be 0,1,2 or 3 for different windows * * @scale_size: scaling size * if the layer can be scaled. the scaling size can be different * from the input buffer. the input buffer can be original aicfb_buffer * or crop aicfb_buffer, otherwise, the scaling size will be ignore * * @pos: left-top x/y coordinate of the screen in pixels * @buf: frame buffer */ struct aicfb_layer_data { unsigned int enable; unsigned int layer_id; unsigned int rect_id; struct aic_size scale_size; struct aic_point pos; struct aicfb_buffer buf; };
-
struct aicfb_config_lists
/** * struct aicfb_config_lists - aicfb config lists * @num: the total number of layer data config lists * @layers[]: the array of aicfb_layer_data lists */ struct aicfb_config_lists { unsigned int num; struct aicfb_layer_data layers[]; };
-
struct aicfb_alpha_config
/** * struct aicfb_alpha_config - aicfb layer alpha blending config * * @layer_id: the layer id * * @enable * 0: disable alpha * 1: enable alpha * * @mode: alpha mode * 0: pixel alpha mode * 1: global alpha mode * 2: mixder alpha mode(alpha = pixel alpha * global alpha / 255) * * @value: global alpha value (0~255) * used by global alpha mode and mixer alpha mode * */ struct aicfb_alpha_config { unsigned int layer_id; unsigned int enable; unsigned int mode; unsigned int value; };
-
struct aicfb_ck_config
/** * struct aicfb_ck_config - aicfb layer color key blending config * * @layer_id: the layer id * * @ck_enable * 0: disable color key * 1: enable color key * * * @ck_value: color key rgb value to match the layer pixels * bit[31:24]: reserved * bit[23:16]: R value * bit[15:8]: G value * bit[7:0]: B value * */ struct aicfb_ck_config { unsigned int layer_id; unsigned int enable; unsigned int value; };
-
struct aicfb_disp_prop
/* * struct aicfb_disp_prop - aicfb display property * * @bright: bright in percent, range [0, 100], 50 means no effect * @contrast: contrast in percent, range [0, 100], 50 means no effect * @saturation: saturation in percent, range [0, 100], 50 means no effect * @hue: hue in percent, range [0, 100], 50 means no effect */ struct aicfb_disp_prop { unsigned int bright; unsigned int contrast; unsigned int saturation; unsigned int hue; };
-
struct aicfb_ccm_config
struct aicfb_ccm_config { unsigned int enable; int ccm_table[12]; };
-
struct aicfb_gamma_config
enum gamma_lut { GAMMA_RED, GAMMA_GREEN, GAMMA_BLUE, }; struct aicfb_gamma_config { unsigned int enable; unsigned int gamma_lut[3][16]; };
-
struct aicfb_screeninfo
/* * struct aicfb_screeninfo - aicfb screen info * * @format: color format * @bits_per_pixel: bits per pixel * @stride: stride of screen * @width: screen width in pixels * @height: screen height in pixels * @framebuffer: start of frame buffer mem * @smem_len: length of frame buffer mem */ struct aicfb_screeninfo { enum mpp_pixel_format format; unsigned int bits_per_pixel; unsigned int stride; unsigned int width; unsigned int height; unsigned char *framebuffer; unsigned int smem_len; };
-
ioctl 命令
#define AICFB_WAIT_FOR_VSYNC _IOW(IOC_TYPE_FB, 0x20, unsigned int) /** get layer number */ #define AICFB_GET_LAYER_NUM _IOR(IOC_TYPE_FB, 0x21, struct aicfb_layer_num) /** get layer capability */ #define AICFB_GET_LAYER_CAPABILITY _IOWR(IOC_TYPE_FB, 0x22,\ struct aicfb_layer_capability) /** get layer config data */ #define AICFB_GET_LAYER_CONFIG _IOWR(IOC_TYPE_FB, 0x23, \ struct aicfb_layer_data) /** update layer config data */ #define AICFB_UPDATE_LAYER_CONFIG _IOW(IOC_TYPE_FB, 0x24, \ struct aicfb_layer_data) /** update layer config data lists */ #define AICFB_UPDATE_LAYER_CONFIG_LISTS _IOW(IOC_TYPE_FB, 0x25, \ struct aicfb_config_lists) /** get layer alpha blendig config */ #define AICFB_GET_ALPHA_CONFIG _IOWR(IOC_TYPE_FB, 0x26, \ struct aicfb_alpha_config) /** update layer alpha blendig config */ #define AICFB_UPDATE_ALPHA_CONFIG _IOW(IOC_TYPE_FB, 0x27, \ struct aicfb_alpha_config) /** get layer color key config */ #define AICFB_GET_CK_CONFIG _IOWR(IOC_TYPE_FB, 0x28, struct aicfb_ck_config) /** update layer color key config */ #define AICFB_UPDATE_CK_CONFIG _IOW(IOC_TYPE_FB, 0x29, struct aicfb_ck_config) /** pan display */ #define AICFB_PAN_DISPLAY _IOR(IOC_TYPE_FB, 0x43, unsigned int) /** set display property */ #define AICFB_SET_DISP_PROP _IOW(IOC_TYPE_FB, 0x60, struct aicfb_disp_prop) /** get display property */ #define AICFB_GET_DISP_PROP _IOR(IOC_TYPE_FB, 0x61, struct aicfb_disp_prop) /** update ccm config */ #define AICFB_UPDATE_CCM_CONFIG _IOR(IOC_TYPE_FB, 0x65, struct aicfb_ccm_config) /** get ccm config */ #define AICFB_GET_CCM_CONFIG _IOR(IOC_TYPE_FB, 0x66, struct aicfb_ccm_config) /** update gamma config */ #define AICFB_UPDATE_GAMMA_CONFIG _IOR(IOC_TYPE_FB, 0x67, struct aicfb_gamma_config) /** get gamma config */ #define AICFB_GET_GAMMA_CONFIG _IOR(IOC_TYPE_FB, 0x68, struct aicfb_gamma_config) /* get screen info */ #define AICFB_GET_SCREENINFO _IOR(IOC_TYPE_FB, 0x62, struct aicfb_screeninfo) /* enable aic fb, calls panel enable callback */ #define AICFB_POWERON _IOR(IOC_TYPE_FB, 0x63, unsigned int) /* disable aic fb, calls panel disable callback */ #define AICFB_POWEROFF _IOR(IOC_TYPE_FB, 0x64, unsigned int)
接口设计
Luban-Lite SDK 通过 MPP 中间件,对外提供一套统一的接口来控制显示驱动,屏蔽操作系统内核和裸机方案的差异。
-
获取图层个数
-
获取图层能力
-
获取图层配置数据
-
更新图层配置数据
-
支持同时更新多图层配置数据
-
支持图层 scaler 设置
-
支持 alpha blending 设置
-
支持 color key 设置
-
支持 disp prop 色彩设置
-
支持 CCM 色彩矩阵设置
-
支持 Gamma 设置
MPP 接口
函数原型 |
struct mpp_fb *mpp_fb_open(void); |
---|---|
功能说明 |
获取一个 mpp_fb 句柄 |
参数定义 |
void |
返回值 |
非空:成功 NULL:失败 |
注意事项 |
无 |
函数原型 |
void mpp_fb_close(struct mpp_fb *fb); |
---|---|
功能说明 |
释放 mpp_fb 句柄 |
参数定义 |
fb: mpp_fb 句柄 |
返回值 |
void |
注意事项 |
无 |
函数原型 |
int mpp_fb_probe(void); |
---|---|
功能说明 |
probe fb |
参数定义 |
void |
返回值 |
0:成功 <0:失败 |
注意事项 |
多次调用也只会 probe 一次,需要在 mpp_fb_open() 操作前调用 |
函数原型 |
int mpp_fb_ioctl(struct mpp_fb *fb, int cmd, void *args); |
---|---|
功能说明 |
ioctl 调用,控制显示驱动 |
参数定义 |
fb: MPP FB 文件句柄 CMD: 操作命名 args: ioctl 调用私有数据 |
返回值 |
0:成功 <0:失败 |
注意事项 |
无 |
ioctl CMD
函数原型 |
int mpp_fb_ioctl(int fd, unsigned long cmd, unsigned int *pvalue); |
---|---|
功能说明 |
等待 Vsync 信号 |
参数定义 |
CMD: AICFB_WAIT_FOR_VSYNC pvalue:该值无意义,可为 NULL |
返回值 |
0:成功 -1:失败 |
注意事项 |
无 |
函数原型 |
int mpp_fb_ioctl(int fd, unsigned long cmd, struct aicfb_layer_num *pvalue); |
---|---|
功能说明 |
获取显示图层的个数, 包括 UI 图层个数和 Video 图层 |
参数定义 |
CMD: AICFB_GET_LAYER_NUM player_num: 参考结构体struct aicfb_layer_num 定义 |
返回值 |
0:成功 -1:失败 |
注意事项 |
无 |
函数原型 |
int mpp_fb_ioctl(int fd, unsigned long cmd, struct aicfb_layer_capability *player_cap); |
---|---|
功能说明 |
获取当前图层的能力 |
参数定义 |
CMD: AICFB_GET_LAYER_CAPABILITY player_cap: 参考结构体 struct aicfb_layer_capability 定义 |
返回值 |
0:成功 -1:失败 |
注意事项 |
调用接口前要先填写结构体中的 layer_id |
函数原型 |
int mpp_fb_ioctl(int fd, unsigned long cmd, struct aicfb_layer_data *player_conf); |
---|---|
功能说明 |
获取图层配置信息 |
参数定义 |
CMD: AICFB_GET_LAYER_CONFIG player_conf: 参考结构体 struct aicfb_layer_data 定义 |
返回值 |
0:成功 -1:失败 |
注意事项 |
调用接口前要先填写结构体中的 layer_id,如果是多矩形窗口要同时填写 rect_win_id |
函数原型 |
int mpp_fb_ioctl(int fd, unsigned long cmd, struct aicfb_layer_data *player_conf) |
---|---|
功能说明 |
更新图层配置信息 |
参数定义 |
CMD: AICFB_UPDATE_LAYER_CONFIG player_ocnf:参考结构体 struct aicfb_layer_data 定义 |
返回值 |
0: 成功 -1:失败 |
注意事项 |
如果是仅更新图层的部分 config data 信息, 可以先调用接口 AICFB_GET_LAYER_CONFIG,获取当前图层信息, 然后再修改要更新的图像信息,最后再调用此接口更新图层信息 |
函数原型 |
int mpp_fb_ioctl(int fd, unsigned long cmd, struct aicfb_config_lists *player_lists); |
---|---|
功能说明 |
更新图层配置数据列表 |
参数定义 |
CMD: AICFB_UPDATE_LAYER_CONFIG_LISTS aicfb_config_lists player_lists: 参考结构体 struct aicfb_config_lists 定义 |
返回值 |
0:成功 -1:失败 |
注意事项 |
通过此接口可以同时更新多个图层或者多个窗口的配置信息 通过此接口调用的好处是相关图层配置的更新可以同时生效 |
函数原型 |
int mpp_fb_ioctl(int fd, unsigned long cmd, struct aicfb_alpha_config *alpha); |
---|---|
功能说明 |
获取当前图层的 Alpha 配置 |
参数定义 |
CMD: AICFB_GET_ALPHA_CONFIG alpha: 参结考构体 struct aicfb_alpha_config 定义 |
返回值 |
0:成功 -1:失败 |
注意事项 |
无 |
函数原型 |
int mpp_fb_ioctl(int fd, unsigned long cmd, struct aicfb_alpha_config *alpha); |
---|---|
功能说明 |
更新当前图层的 Alpha 配置 |
参数定义 |
CMD: AICFB_UPDATE_ALPHA_CONFIG alpha: 参结考构体 struct aicfb_alpha_config 定义 |
返回值 |
0:成功 -1:失败 |
注意事项 |
无 |
函数原型 |
int mpp_fb_ioctl(int fd, unsigned long cmd, struct aicfb_ck_config *player_ck); |
---|---|
功能说明 |
获取当前图层的 CK 配置 |
参数定义 |
CMD: AICFB_GET_CK_CONFIG player_ck: 参考结构体 >struct aicfb_ck_config 定义 |
返回值 |
0:成功 -1:当前图层不支持 color key |
注意事项 |
无 |
函数原型 |
int mpp_fb_ioctl(int fd, unsigned long cmd, struct aicfb_ck_config *player_ck); |
---|---|
功能说明 |
更新当前图层的 CK 配置 |
参数定义 |
CMD: AICFB_SET_CK_CONFIG player_ck: 参考结构体 struct aicfb_ck_config 定义 |
返回值 |
0: 成功 -1:当前图层不支持 color key |
注意事项 |
无 |
函数原型 |
int mpp_fb_ioctl(int fd, unsigned long cmd, struct aicfb_ccm_config *ccm); |
---|---|
功能说明 |
获取 DE 当前的 CCM 色彩矩阵配置 |
参数定义 |
CMD: AICFB_GET_CCM_CONFIG ccm: 参考结构体 struct aicfb_ccm_config 定义 |
返回值 |
0: 成功 -1:失败 |
注意事项 |
支持 D13x/D12x 系列 |
函数原型 |
int mpp_fb_ioctl(int fd, unsigned long cmd, struct aicfb_ccm_config *ccm); |
---|---|
功能说明 |
更新 DE 的 CCM 色彩矩阵配置 |
参数定义 |
CMD: AICFB_UPDATE_CCM_CONFIG ccm: 参考结构体 >struct aicfb_ccm_config 定义 |
返回值 |
0: 成功 -1:失败 |
注意事项 |
支持 D13x/D12x 系列 |
函数原型 |
int mpp_fb_ioctl(int fd, unsigned long cmd, struct aicfb_gamma_config *gamma); |
---|---|
功能说明 |
获取 DE 当前的 Gamma 配置 |
参数定义 |
CMD: AICFB_GET_GAMMA_CONFIG gamma: 参考结构体 struct aicfb_gamma_config 定义 |
返回值 |
0: 成功 -1:失败 |
注意事项 |
支持 D13x/D12x 系列 |
函数原型 |
int mpp_fb_ioctl(int fd, unsigned long cmd, struct aicfb_gamma_config *gamma); |
---|---|
功能说明 |
更新 DE 的 Gamma 配置 |
参数定义 |
CMD: AICFB_UPDATE_GAMMA_CONFIG gamma: 参考结构体 struct aicfb_gamma_config 定义 |
返回值 |
0: 成功 -1:失败 |
注意事项 |
支持 D13x/D12x 系列 |
函数原型 |
int mpp_fb_ioctl(int fd, unsigned long cmd, struct aicfb_screeninfo *pscreen_size); |
---|---|
功能说明 |
获取当前 LCD 外设 和 framebuffer 信息 |
参数定义 |
CMD: AICFB_GET_SCREEN_SIZE pscreen_size: 结构体 struct aicfb_screeninfo |
返回值 |
0:成功 -1:失败 |
注意事项 |
无 |
函数原型 |
int mpp_fb_ioctl(int fd, unsigned long cmd, unsigned int zero); |
---|---|
功能说明 |
enable LCD 外设 |
参数定义 |
CMD: AICFB_POWERON zero: NULL |
返回值 |
0:成功 -1:失败 |
注意事项 |
多次调用只会 enable 一次 |
函数原型 |
int mpp_fb_ioctl(int fd, unsigned long cmd, unsigned int zero); |
---|---|
功能说明 |
disable LCD 外设 |
参数定义 |
CMD: AICFB_POWEROFF zero: NULL |
返回值 |
0:成功 -1:失败 |
注意事项 |
无 |
Demo
MPP FB 接口使用
int main(void) { struct aicfb_screeninfo 9nfo = {0}; struct mpp_fb *fb; int zero, ret; mpp_fb_probe(); // 探测 MPP FB fb = mpp_fb_open(); // 打开 MPP FB 句柄 if (!fb) return -1; /* Enable lcd panel */ ret = mpp_fb_ioctl(fb, AICFB_POWERON, &zero); if (ret) return -1; /* Get screen info */ ret = mpp_fb_ioctl(fb, AICFB_GET_SCREENINFO, &info); if (ret) return -1; /* Clear framebuffer */ memset(info.framebuffer, 0x00, info.smem_len); /* Framebuffer is a cached buffer, flush cache is required */ aicos_dcache_clean_invalid_range((unsigned long *)info.framebuffer, info.smem_len); mpp_fb_close(fb); // 关闭 MPP FB 句柄 return 0; }