This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 553406e801 drivers/video: add BRGA8888 support for goldfish gpu fb
553406e801 is described below
commit 553406e80113be76e907d95ee487566834977205
Author: rongyichang <[email protected]>
AuthorDate: Sat Jan 4 13:17:54 2025 +0800
drivers/video: add BRGA8888 support for goldfish gpu fb
Signed-off-by: rongyichang <[email protected]>
---
drivers/video/Kconfig | 13 +++++++++++++
drivers/video/goldfish_gpu_fb.c | 31 +++++++++++++++++++++----------
2 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index b33401a55d..d87a277153 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -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
diff --git a/drivers/video/goldfish_gpu_fb.c b/drivers/video/goldfish_gpu_fb.c
index 7c5f44d3fa..323f953999 100644
--- a/drivers/video/goldfish_gpu_fb.c
+++ b/drivers/video/goldfish_gpu_fb.c
@@ -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);