From f5fe7646ed8b56bb323c4546fa980030b915fca5 Mon Sep 17 00:00:00 2001 From: jianglianfang Date: Wed, 24 Jan 2024 11:01:35 +0800 Subject: [PATCH] sim: read the second buffer It can only read the contents of the first buffer, so fblen should be changed to ensure that it can read the second buffer as well. Signed-off-by: jianglianfang --- arch/sim/src/sim/posix/sim_x11framebuffer.c | 10 +++++----- arch/sim/src/sim/sim_framebuffer.c | 1 + tools/nxstyle.c | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/sim/src/sim/posix/sim_x11framebuffer.c b/arch/sim/src/sim/posix/sim_x11framebuffer.c index 4307871182..0187dad317 100644 --- a/arch/sim/src/sim/posix/sim_x11framebuffer.c +++ b/arch/sim/src/sim/posix/sim_x11framebuffer.c @@ -83,11 +83,11 @@ static unsigned short g_fbpixelwidth; static unsigned short g_fbpixelheight; static int g_fbbpp; static int g_fblen; -static int g_fbcount; static int g_shmcheckpoint = 0; static int b_useshm; static unsigned char *g_trans_framebuffer; +static unsigned int g_offset; /**************************************************************************** * Private Functions @@ -465,7 +465,6 @@ int sim_x11initialize(unsigned short width, unsigned short height, g_fbbpp = depth; g_fblen = *fblen; - g_fbcount = fbcount; /* Create conversion framebuffer */ @@ -541,6 +540,7 @@ int sim_x11setoffset(unsigned int offset) if (g_fbbpp == 32 && CONFIG_SIM_FBBPP == 16) { g_image->data = g_framebuffer + (offset << 1); + g_offset = offset; } else { @@ -620,9 +620,9 @@ int sim_x11update(void) if (g_fbbpp == 32 && CONFIG_SIM_FBBPP == 16) { - sim_x11depth16to32(g_framebuffer, - g_fblen * g_fbcount, - g_trans_framebuffer); + sim_x11depth16to32(g_image->data, + g_fblen, + g_trans_framebuffer + g_offset); } XSync(g_display, 0); diff --git a/arch/sim/src/sim/sim_framebuffer.c b/arch/sim/src/sim/sim_framebuffer.c index db7db7b7d0..3cfb66347e 100644 --- a/arch/sim/src/sim/sim_framebuffer.c +++ b/arch/sim/src/sim/sim_framebuffer.c @@ -470,6 +470,7 @@ int up_fbinitialize(int display) &g_planeinfo.fbmem, &g_planeinfo.fblen, &g_planeinfo.bpp, &g_planeinfo.stride, CONFIG_SIM_FRAMEBUFFER_COUNT); + g_planeinfo.fblen *= CONFIG_SIM_FRAMEBUFFER_COUNT; #endif return ret; diff --git a/tools/nxstyle.c b/tools/nxstyle.c index 358aefa9e7..bcf796203d 100644 --- a/tools/nxstyle.c +++ b/tools/nxstyle.c @@ -451,6 +451,7 @@ static const char *g_white_content_list[] = "AsyncBoth", "CurrentTime", "XUnmapWindow", + "XFree", /* Ref: * nuttx/arch/sim/src/sim_hostdecoder.*