You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/08/10 12:36:47 UTC
[nuttx-apps] 04/06: apps/testing : correct the dependency option of fb driver test
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-apps.git
commit 694fbd2f77ca4220418c939bc689aa321b9bc20d
Author: rongyichang <ro...@xiaomi.com>
AuthorDate: Wed Mar 15 18:44:29 2023 +0800
apps/testing : correct the dependency option of fb driver test
Signed-off-by: rongyichang <ro...@xiaomi.com>
---
testing/drivertest/Makefile | 3 ++-
testing/drivertest/drivertest_framebuffer.c | 16 +++++++++-------
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/testing/drivertest/Makefile b/testing/drivertest/Makefile
index ca30bdc8b..d3f64987f 100644
--- a/testing/drivertest/Makefile
+++ b/testing/drivertest/Makefile
@@ -103,8 +103,9 @@ endif
ifneq ($(CONFIG_AUDIO),)
MAINSRC += drivertest_audio.c
PROGNAME += cmocka_driver_audio
+endif
-ifneq ($(CONFIG_LCD_FRAMEBUFFER)$(CONFIG_SIM_FRAMEBUFFER),)
+ifneq ($(CONFIG_VIDEO_FB),)
MAINSRC += drivertest_framebuffer.c
PROGNAME += cmocka_driver_framebuffer
endif
diff --git a/testing/drivertest/drivertest_framebuffer.c b/testing/drivertest/drivertest_framebuffer.c
index 0e9d45e03..a92af7f29 100644
--- a/testing/drivertest/drivertest_framebuffer.c
+++ b/testing/drivertest/drivertest_framebuffer.c
@@ -207,25 +207,27 @@ static void draw_rect(FAR struct fb_info_s *fb_info, int x, int y,
{
int i = 0;
int j = 0;
- int offset = 0;
- uint32_t *fb_bpp32 = (uint32_t *)fb_info->fb_mem;
- uint16_t *fb_bpp16 = (uint16_t *)fb_info->fb_mem;
+ uint8_t *fb_tmp;
+ uint32_t *fb_bpp32;
+ uint16_t *fb_bpp16;
const uint8_t bpp = fb_info->plane_info.bpp;
const uint32_t xres = fb_info->video_info.xres;
const uint32_t yres = fb_info->video_info.yres;
for (j = y; j <= (y + h - 1) && j < yres; j++)
{
- offset = j * xres;
+ fb_tmp = fb_info->fb_mem + (j * fb_info->plane_info.stride);
for (i = x; i <= (x + w - 1) && x < xres; i++)
{
if (bpp == 32)
{
- *(fb_bpp32 + offset + i) = color;
+ fb_bpp32 = (uint32_t *)fb_tmp;
+ *(fb_bpp32 + i) = color;
}
else if (bpp == 16)
{
- *(fb_bpp16 + offset + i) = COLOR_888_TO_565(color);
+ fb_bpp16 = (uint16_t *)fb_tmp;
+ *(fb_bpp16 + i) = COLOR_888_TO_565(color);
}
}
}
@@ -288,7 +290,7 @@ static void test_case_fb_2(FAR void **state)
start_x = step_width * i;
if (i == step_num - 1)
{
- step_width = xres - start_x + 1;
+ step_width = xres - start_x;
}
draw_rect(&fb_state->fb_info, start_x, 0, step_width, yres,