drivers/video: add BRGA8888 support for goldfish gpu fb
Some checks are pending
Build Documentation / build-html (push) Waiting to run

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
This commit is contained in:
rongyichang 2025-01-04 13:17:54 +08:00 committed by Xiang Xiao
parent f64a48f4e5
commit 553406e801
2 changed files with 34 additions and 10 deletions

View file

@ -72,6 +72,19 @@ config GOLDFISH_GPU_FB
depends on VIDEO_FB
default n
choice
prompt "Select Goldfish GPU Framebuffer format"
default GOLDFISH_GPU_FB_RGB565
depends on GOLDFISH_GPU_FB
config GOLDFISH_GPU_FB_RGB565
bool "RGB565"
config GOLDFISH_GPU_FB_BGRA8888
bool "BGRA8888"
endchoice
config GOLDFISH_GPU_FB_PRIORITY
int "Goldfish GPU Framebuffer vsync task priority"
depends on GOLDFISH_GPU_FB

View file

@ -71,6 +71,8 @@ struct goldfish_gpu_fb_s
struct fb_videoinfo_s videoinfo;
struct file pipe;
int colorbuffer;
int colorformat;
int colortype;
};
/****************************************************************************
@ -377,8 +379,8 @@ static int goldfish_gpu_fb_commit(FAR struct goldfish_gpu_fb_s *fb,
ret = goldfish_gpu_fb_update_colorbuffer(&fb->pipe, fb->colorbuffer, 0, 0,
fb->videoinfo.xres,
fb->videoinfo.yres,
EGL_RGB565,
EGL_UNSIGNED_SHORT_5_6_5,
fb->colorformat,
fb->colortype,
buf,
fb->planeinfo.stride
* fb->videoinfo.yres);
@ -530,12 +532,28 @@ int goldfish_gpu_fb_register(int display)
fb->videoinfo.yres = ret;
#ifdef CONFIG_GOLDFISH_GPU_FB_BGRA8888
fb->colorformat = EGL_BGRA;
fb->colortype = EGL_UNSIGNED_BYTE;
fb->videoinfo.fmt = FB_FMT_RGB32;
fb->planeinfo.bpp = 32;
#else
fb->colorformat = EGL_RGB565;
fb->colortype = EGL_UNSIGNED_SHORT_5_6_5;
fb->videoinfo.fmt = FB_FMT_RGB16_565;
fb->planeinfo.bpp = 16;
#endif
fb->videoinfo.nplanes = 1;
fb->planeinfo.stride = fb->videoinfo.xres * (fb->planeinfo.bpp >> 3);
fb->planeinfo.yres_virtual = fb->videoinfo.yres * 2;
fb->planeinfo.xres_virtual = fb->videoinfo.xres;
/* Create the colorbuffer */
ret = goldfish_gpu_fb_create_colorbuffer(&fb->pipe,
fb->videoinfo.xres,
fb->videoinfo.yres,
EGL_RGB565);
fb->colorformat);
if (ret < 0)
{
gerr("Failed to create colorbuffer: %d\n", ret);
@ -544,13 +562,6 @@ int goldfish_gpu_fb_register(int display)
fb->colorbuffer = ret;
fb->videoinfo.nplanes = 1;
fb->videoinfo.fmt = FB_FMT_RGB16_565;
fb->planeinfo.bpp = 16;
fb->planeinfo.stride = fb->videoinfo.xres * (fb->planeinfo.bpp >> 3);
fb->planeinfo.yres_virtual = fb->videoinfo.yres * 2;
fb->planeinfo.xres_virtual = fb->videoinfo.xres;
fb->planeinfo.fblen = fb->planeinfo.stride * fb->planeinfo.yres_virtual;
fb->planeinfo.fbmem = kmm_zalloc(fb->planeinfo.fblen);