display: rename current BGR_565 format into RGB_565X
The format currently expected by devices and sample display
application for BGR_565 is actually RGB_565 format with bytes
swapped (not B / R swapped). That is:
PIXEL_FORMAT_RGB_565:
* @code{.unparsed}
* 7......0 15.....8
* | gggBbbbb RrrrrGgg | ...
* @endcode
current PIXEL_FORMAT_BGR_565:
* @code{.unparsed}
* 7......0 15.....8
* | RrrrrGgg gggBbbbb | ...
* @endcode
This is explained in both st7796s display driver but also is
what is generated by the sample display application. As a video
format (ex: V4L2), such format is not mentioned as BGR (for
which R and B are swapped) but RGB_565X.
Within the whole Zephyr tree, rename the curremt BGR_565 format
into RGB_565X in order to emphasis that this is a byte swapped
format rather than a B/G component swapped format.
This also correct the description of the format in display.h
file, which wasn't correct based on what was being used by
display driver or sample display app.
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
This commit is contained in:
committed by
Fabio Baltieri
parent
9d205d65f9
commit
b13d9a0510
@@ -4,7 +4,7 @@
|
||||
if DISPLAY
|
||||
|
||||
choice ST7789V_PIXEL_FORMAT
|
||||
default ST7789V_BGR565
|
||||
default ST7789V_RGB565X
|
||||
endchoice
|
||||
|
||||
if LVGL
|
||||
|
||||
@@ -16,7 +16,7 @@ configdefault SDMMC_STM32_CLOCK_CHECK
|
||||
if DISPLAY
|
||||
|
||||
choice ST7789V_PIXEL_FORMAT
|
||||
default ST7789V_BGR565
|
||||
default ST7789V_RGB565X
|
||||
endchoice
|
||||
|
||||
# Required to enable LCD backlight
|
||||
|
||||
@@ -25,7 +25,7 @@ config MIPI_DBI_STM32_FMC_MEM_BARRIER
|
||||
if DISPLAY
|
||||
|
||||
choice ST7789V_PIXEL_FORMAT
|
||||
default ST7789V_BGR565
|
||||
default ST7789V_RGB565X
|
||||
endchoice
|
||||
|
||||
endif # DISPLAY
|
||||
|
||||
@@ -326,6 +326,20 @@ Display
|
||||
* For ILI9341 controller, display mirroring configuration has been updated to conform with
|
||||
the described behavior of the sample ``samples/drivers/display``. (:github:`99267`).
|
||||
|
||||
* The ``PIXEL_FORMAT_BGR_565`` pixel format has been renamed to
|
||||
:c:macro:`PIXEL_FORMAT_RGB_565X` to correctly reflect that it is a
|
||||
byte-swapped version of RGB_565, not a channel-swapped format.
|
||||
Applications using ``PIXEL_FORMAT_BGR_565`` must update to use
|
||||
:c:macro:`PIXEL_FORMAT_RGB_565X`. (:github:`99276`)
|
||||
|
||||
* The devicetree macro ``PANEL_PIXEL_FORMAT_BGR_565`` has been renamed to
|
||||
:c:macro:`PANEL_PIXEL_FORMAT_RGB_565X`. (:github:`99276`)
|
||||
|
||||
* The Kconfig options ``SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_BGR_565`` and
|
||||
``ST7789V_BGR565`` have been renamed to
|
||||
:kconfig:option:`SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_RGB_565X` and :kconfig:option:`ST7789V_RGB565X`
|
||||
respectively. (:github:`99276`)
|
||||
|
||||
DMA
|
||||
===
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@ choice SDL_DISPLAY_DEFAULT_PIXEL_FORMAT
|
||||
config SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_RGB_565
|
||||
bool "RGB 565"
|
||||
|
||||
config SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_BGR_565
|
||||
bool "BGR 565"
|
||||
config SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_RGB_565X
|
||||
bool "RGB 565X"
|
||||
|
||||
config SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_L_8
|
||||
bool "Grayscale 8bit"
|
||||
|
||||
@@ -24,7 +24,7 @@ config ST7789V_RGB888
|
||||
config ST7789V_RGB565
|
||||
bool "RGB565"
|
||||
|
||||
config ST7789V_BGR565
|
||||
bool "BGR565"
|
||||
config ST7789V_RGB565X
|
||||
bool "RGB565X"
|
||||
|
||||
endchoice
|
||||
|
||||
@@ -294,7 +294,7 @@ ili9xxx_set_pixel_format(const struct device *dev,
|
||||
uint8_t tx_data;
|
||||
uint8_t bytes_per_pixel;
|
||||
|
||||
if (pixel_format == PIXEL_FORMAT_RGB_565 || pixel_format == PIXEL_FORMAT_BGR_565) {
|
||||
if (pixel_format == PIXEL_FORMAT_RGB_565 || pixel_format == PIXEL_FORMAT_RGB_565X) {
|
||||
bytes_per_pixel = 2U;
|
||||
tx_data = ILI9XXX_PIXSET_MCU_16_BIT | ILI9XXX_PIXSET_RGB_16_BIT;
|
||||
} else if (pixel_format == PIXEL_FORMAT_RGB_888) {
|
||||
@@ -323,7 +323,7 @@ static int ili9xxx_set_orientation(const struct device *dev,
|
||||
struct ili9xxx_data *data = dev->data;
|
||||
|
||||
int r;
|
||||
uint8_t tx_data = data->pixel_format == PIXEL_FORMAT_BGR_565
|
||||
uint8_t tx_data = data->pixel_format == PIXEL_FORMAT_RGB_565X
|
||||
? ILI9XXX_MADCTL_BGR : 0;
|
||||
if (config->quirks->cmd_set == CMD_SET_1) {
|
||||
if (orientation == DISPLAY_ORIENTATION_NORMAL) {
|
||||
@@ -368,7 +368,7 @@ static void ili9xxx_get_capabilities(const struct device *dev,
|
||||
memset(capabilities, 0, sizeof(struct display_capabilities));
|
||||
|
||||
capabilities->supported_pixel_formats =
|
||||
PIXEL_FORMAT_RGB_565 | PIXEL_FORMAT_RGB_888 | PIXEL_FORMAT_BGR_565;
|
||||
PIXEL_FORMAT_RGB_565 | PIXEL_FORMAT_RGB_888 | PIXEL_FORMAT_RGB_565X;
|
||||
capabilities->current_pixel_format = data->pixel_format;
|
||||
|
||||
if (data->orientation == DISPLAY_ORIENTATION_NORMAL ||
|
||||
@@ -394,8 +394,8 @@ static int ili9xxx_configure(const struct device *dev)
|
||||
/* pixel format */
|
||||
if (config->pixel_format == PANEL_PIXEL_FORMAT_RGB_565) {
|
||||
pixel_format = PIXEL_FORMAT_RGB_565;
|
||||
} else if (config->pixel_format == PANEL_PIXEL_FORMAT_BGR_565) {
|
||||
pixel_format = PIXEL_FORMAT_BGR_565;
|
||||
} else if (config->pixel_format == PANEL_PIXEL_FORMAT_RGB_565X) {
|
||||
pixel_format = PIXEL_FORMAT_RGB_565X;
|
||||
} else if (config->pixel_format == PANEL_PIXEL_FORMAT_RGB_888) {
|
||||
pixel_format = PIXEL_FORMAT_RGB_888;
|
||||
} else {
|
||||
|
||||
@@ -254,7 +254,7 @@ static int mcux_lcdifv3_init(const struct device *dev)
|
||||
lcdifv3_buffer_config_t buffer_config = config->buffer_config;
|
||||
lcdifv3_display_config_t display_config = config->display_config;
|
||||
/* Set the Pixel format */
|
||||
if (config->pixel_format == PIXEL_FORMAT_BGR_565) {
|
||||
if (config->pixel_format == PIXEL_FORMAT_RGB_565X) {
|
||||
buffer_config.pixelFormat = kLCDIFV3_PixelFormatRGB565;
|
||||
} else if (config->pixel_format == PIXEL_FORMAT_RGB_888) {
|
||||
buffer_config.pixelFormat = kLCDIFV3_PixelFormatRGB888;
|
||||
@@ -289,7 +289,7 @@ static const struct display_driver_api mcux_lcdifv3_api = {
|
||||
|
||||
#define GET_PIXEL_FORMAT(id) \
|
||||
((DT_INST_ENUM_IDX(id, pixel_format) == 0) \
|
||||
? PIXEL_FORMAT_BGR_565 \
|
||||
? PIXEL_FORMAT_RGB_565X \
|
||||
: ((DT_INST_ENUM_IDX(id, pixel_format) == 1) ? PIXEL_FORMAT_RGB_888 \
|
||||
: PIXEL_FORMAT_ARGB_8888))
|
||||
|
||||
|
||||
@@ -189,8 +189,8 @@ static int sdl_display_init(const struct device *dev)
|
||||
PIXEL_FORMAT_MONO10
|
||||
#elif defined(CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_RGB_565)
|
||||
PIXEL_FORMAT_RGB_565
|
||||
#elif defined(CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_BGR_565)
|
||||
PIXEL_FORMAT_BGR_565
|
||||
#elif defined(CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_RGB_565X)
|
||||
PIXEL_FORMAT_RGB_565X
|
||||
#elif defined(CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_L_8)
|
||||
PIXEL_FORMAT_L_8
|
||||
#elif defined(CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_AL_88)
|
||||
@@ -296,8 +296,8 @@ static void sdl_display_write_rgb565(uint8_t *disp_buf,
|
||||
}
|
||||
}
|
||||
|
||||
static void sdl_display_write_bgr565(uint8_t *disp_buf,
|
||||
const struct display_buffer_descriptor *desc, const void *buf)
|
||||
static void sdl_display_write_rgb565x(uint8_t *disp_buf,
|
||||
const struct display_buffer_descriptor *desc, const void *buf)
|
||||
{
|
||||
uint32_t w_idx;
|
||||
uint32_t h_idx;
|
||||
@@ -415,8 +415,8 @@ static int sdl_display_write(const struct device *dev, const uint16_t x,
|
||||
sdl_display_write_mono(disp_data->buf, desc, buf, false);
|
||||
} else if (disp_data->current_pixel_format == PIXEL_FORMAT_RGB_565) {
|
||||
sdl_display_write_rgb565(disp_data->buf, desc, buf);
|
||||
} else if (disp_data->current_pixel_format == PIXEL_FORMAT_BGR_565) {
|
||||
sdl_display_write_bgr565(disp_data->buf, desc, buf);
|
||||
} else if (disp_data->current_pixel_format == PIXEL_FORMAT_RGB_565X) {
|
||||
sdl_display_write_rgb565x(disp_data->buf, desc, buf);
|
||||
} else if (disp_data->current_pixel_format == PIXEL_FORMAT_L_8) {
|
||||
sdl_display_write_l8(disp_data->buf, desc, buf);
|
||||
} else if (disp_data->current_pixel_format == PIXEL_FORMAT_AL_88) {
|
||||
@@ -493,8 +493,8 @@ static void sdl_display_read_rgb565(const uint8_t *read_buf,
|
||||
}
|
||||
}
|
||||
|
||||
static void sdl_display_read_bgr565(const uint8_t *read_buf,
|
||||
const struct display_buffer_descriptor *desc, void *buf)
|
||||
static void sdl_display_read_rgb565x(const uint8_t *read_buf,
|
||||
const struct display_buffer_descriptor *desc, void *buf)
|
||||
{
|
||||
uint32_t w_idx;
|
||||
uint32_t h_idx;
|
||||
@@ -641,8 +641,8 @@ static int sdl_display_read(const struct device *dev, const uint16_t x, const ui
|
||||
sdl_display_read_mono(disp_data->read_buf, desc, buf, false);
|
||||
} else if (disp_data->current_pixel_format == PIXEL_FORMAT_RGB_565) {
|
||||
sdl_display_read_rgb565(disp_data->read_buf, desc, buf);
|
||||
} else if (disp_data->current_pixel_format == PIXEL_FORMAT_BGR_565) {
|
||||
sdl_display_read_bgr565(disp_data->read_buf, desc, buf);
|
||||
} else if (disp_data->current_pixel_format == PIXEL_FORMAT_RGB_565X) {
|
||||
sdl_display_read_rgb565x(disp_data->read_buf, desc, buf);
|
||||
} else if (disp_data->current_pixel_format == PIXEL_FORMAT_L_8) {
|
||||
sdl_display_read_l8(disp_data->read_buf, desc, buf);
|
||||
} else if (disp_data->current_pixel_format == PIXEL_FORMAT_AL_88) {
|
||||
@@ -679,7 +679,7 @@ static int sdl_display_clear(const struct device *dev)
|
||||
bgcolor = 0xFFu;
|
||||
break;
|
||||
case PIXEL_FORMAT_RGB_565:
|
||||
case PIXEL_FORMAT_BGR_565:
|
||||
case PIXEL_FORMAT_RGB_565X:
|
||||
size = config->width * config->height * 2U;
|
||||
break;
|
||||
case PIXEL_FORMAT_AL_88:
|
||||
@@ -757,7 +757,7 @@ static void sdl_display_get_capabilities(
|
||||
PIXEL_FORMAT_MONO01 |
|
||||
PIXEL_FORMAT_MONO10 |
|
||||
PIXEL_FORMAT_RGB_565 |
|
||||
PIXEL_FORMAT_BGR_565 |
|
||||
PIXEL_FORMAT_RGB_565X |
|
||||
PIXEL_FORMAT_L_8 |
|
||||
PIXEL_FORMAT_AL_88;
|
||||
capabilities->current_pixel_format = disp_data->current_pixel_format;
|
||||
@@ -777,7 +777,7 @@ static int sdl_display_set_pixel_format(const struct device *dev,
|
||||
case PIXEL_FORMAT_MONO01:
|
||||
case PIXEL_FORMAT_MONO10:
|
||||
case PIXEL_FORMAT_RGB_565:
|
||||
case PIXEL_FORMAT_BGR_565:
|
||||
case PIXEL_FORMAT_RGB_565X:
|
||||
case PIXEL_FORMAT_L_8:
|
||||
case PIXEL_FORMAT_AL_88:
|
||||
disp_data->current_pixel_format = pixel_format;
|
||||
|
||||
@@ -212,7 +212,7 @@ static int st7735r_write(const struct device *dev,
|
||||
|
||||
|
||||
if (!(config->madctl & ST7735R_MADCTL_BGR) != !config->rgb_is_inverted) {
|
||||
fmt = PIXEL_FORMAT_BGR_565;
|
||||
fmt = PIXEL_FORMAT_RGB_565X;
|
||||
} else {
|
||||
fmt = PIXEL_FORMAT_RGB_565;
|
||||
}
|
||||
@@ -262,8 +262,8 @@ static void st7735r_get_capabilities(const struct device *dev,
|
||||
* It is a workaround for supporting buggy modules that display RGB as BGR.
|
||||
*/
|
||||
if (!(config->madctl & ST7735R_MADCTL_BGR) != !config->rgb_is_inverted) {
|
||||
capabilities->supported_pixel_formats = PIXEL_FORMAT_BGR_565;
|
||||
capabilities->current_pixel_format = PIXEL_FORMAT_BGR_565;
|
||||
capabilities->supported_pixel_formats = PIXEL_FORMAT_RGB_565X;
|
||||
capabilities->current_pixel_format = PIXEL_FORMAT_RGB_565X;
|
||||
} else {
|
||||
capabilities->supported_pixel_formats = PIXEL_FORMAT_RGB_565;
|
||||
capabilities->current_pixel_format = PIXEL_FORMAT_RGB_565;
|
||||
@@ -282,7 +282,7 @@ static int st7735r_set_pixel_format(const struct device *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((pixel_format == PIXEL_FORMAT_BGR_565) &&
|
||||
if ((pixel_format == PIXEL_FORMAT_RGB_565X) &&
|
||||
(config->madctl & ST7735R_MADCTL_BGR)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -184,8 +184,8 @@ static int st7789v_write(const struct device *dev,
|
||||
}
|
||||
if (IS_ENABLED(CONFIG_ST7789V_RGB565)) {
|
||||
pixfmt = PIXEL_FORMAT_RGB_565;
|
||||
} else if (IS_ENABLED(CONFIG_ST7789V_BGR565)) {
|
||||
pixfmt = PIXEL_FORMAT_BGR_565;
|
||||
} else if (IS_ENABLED(CONFIG_ST7789V_RGB565X)) {
|
||||
pixfmt = PIXEL_FORMAT_RGB_565X;
|
||||
} else {
|
||||
pixfmt = PIXEL_FORMAT_RGB_888;
|
||||
}
|
||||
@@ -225,9 +225,9 @@ static void st7789v_get_capabilities(const struct device *dev,
|
||||
#ifdef CONFIG_ST7789V_RGB565
|
||||
capabilities->supported_pixel_formats = PIXEL_FORMAT_RGB_565;
|
||||
capabilities->current_pixel_format = PIXEL_FORMAT_RGB_565;
|
||||
#elif CONFIG_ST7789V_BGR565
|
||||
capabilities->supported_pixel_formats = PIXEL_FORMAT_BGR_565;
|
||||
capabilities->current_pixel_format = PIXEL_FORMAT_BGR_565;
|
||||
#elif CONFIG_ST7789V_RGB565X
|
||||
capabilities->supported_pixel_formats = PIXEL_FORMAT_RGB_565X;
|
||||
capabilities->current_pixel_format = PIXEL_FORMAT_RGB_565X;
|
||||
#else
|
||||
capabilities->supported_pixel_formats = PIXEL_FORMAT_RGB_888;
|
||||
capabilities->current_pixel_format = PIXEL_FORMAT_RGB_888;
|
||||
@@ -240,8 +240,8 @@ static int st7789v_set_pixel_format(const struct device *dev,
|
||||
{
|
||||
#ifdef CONFIG_ST7789V_RGB565
|
||||
if (pixel_format == PIXEL_FORMAT_RGB_565) {
|
||||
#elif CONFIG_ST7789V_BGR565
|
||||
if (pixel_format == PIXEL_FORMAT_BGR_565) {
|
||||
#elif CONFIG_ST7789V_RGB565X
|
||||
if (pixel_format == PIXEL_FORMAT_RGB_565X) {
|
||||
#else
|
||||
if (pixel_format == PIXEL_FORMAT_RGB_888) {
|
||||
#endif
|
||||
|
||||
@@ -105,19 +105,19 @@ static int st7796s_get_pixelfmt(const struct device *dev)
|
||||
* Zephyr uses little endian byte order when the pixel format has
|
||||
* multiple bytes.
|
||||
*
|
||||
* For BGR565, Red is placed in byte 1 and Blue in byte 0.
|
||||
* For RGB565, Red is placed in byte 0 and Blue in byte 1.
|
||||
* For RGB565, Red is placed in byte 1 and Blue in byte 0.
|
||||
* For RGB565X, Red is placed in byte 0 and Blue in byte 1.
|
||||
*
|
||||
* This is not an issue when using a 16-bit interface.
|
||||
* For RGB565, this would map to Red being in D[11:15] and
|
||||
* Blue in D[0:4] and vice versa for BGR565.
|
||||
* Blue in D[0:4] and vice versa for RGB565X.
|
||||
*
|
||||
* However this is an issue when using a 8-bit interface.
|
||||
* For BGR565, Blue is placed in byte 0 as mentioned earlier.
|
||||
* For RGB565, Blue is placed in byte 0 as mentioned earlier.
|
||||
* However the controller expects Red to be in D[3:7] of byte 0.
|
||||
*
|
||||
* Hence we report pixel format as RGB when MADCTL setting is BGR
|
||||
* and vice versa.
|
||||
* Hence we report pixel format as RGB565 when MADCTL setting is
|
||||
* RGB565X and vice versa.
|
||||
*/
|
||||
if (config->dbi_config.mode == MIPI_DBI_MODE_8080_BUS_8_BIT) {
|
||||
/*
|
||||
@@ -129,7 +129,7 @@ static int st7796s_get_pixelfmt(const struct device *dev)
|
||||
config->rgb_is_inverted) {
|
||||
return PIXEL_FORMAT_RGB_565;
|
||||
} else {
|
||||
return PIXEL_FORMAT_BGR_565;
|
||||
return PIXEL_FORMAT_RGB_565X;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ static int st7796s_get_pixelfmt(const struct device *dev)
|
||||
config->rgb_is_inverted) {
|
||||
return PIXEL_FORMAT_RGB_565;
|
||||
} else {
|
||||
return PIXEL_FORMAT_BGR_565;
|
||||
return PIXEL_FORMAT_RGB_565X;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -286,7 +286,7 @@ static int mipi_dbi_esp32_write_display(const struct device *dev,
|
||||
struct mipi_dbi_esp32_data *drv_data = dev->data;
|
||||
int ret;
|
||||
|
||||
if (pixfmt != PIXEL_FORMAT_RGB_565 && pixfmt != PIXEL_FORMAT_BGR_565) {
|
||||
if (pixfmt != PIXEL_FORMAT_RGB_565 && pixfmt != PIXEL_FORMAT_RGB_565X) {
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ static int mipi_dbi_dcnano_lcdif_write_display(const struct device *dev,
|
||||
fbConfig.format = kLCDIF_PixelFormatARGB8888;
|
||||
bytes_per_pixel = 4U;
|
||||
break;
|
||||
case PIXEL_FORMAT_BGR_565:
|
||||
case PIXEL_FORMAT_RGB_565X:
|
||||
fbConfig.inOrder = kLCDIF_PixelInputOrderABGR;
|
||||
case PIXEL_FORMAT_RGB_565:
|
||||
fbConfig.format = kLCDIF_PixelFormatRGB565;
|
||||
|
||||
@@ -23,8 +23,8 @@ config MIPI_DSI_MCUX_2L_SMARTDMA
|
||||
depends on DMA_MCUX_SMARTDMA
|
||||
help
|
||||
Use SMARTDMA. This accelerator will automatically
|
||||
convert RGB565 input data to BGR565 (little endian to big endian),
|
||||
and write it to the MIPI DSI.
|
||||
convert RGB565 input data to RGB565X, and write it
|
||||
to the MIPI DSI.
|
||||
|
||||
config MIPI_DSI_MCUX_NXP_DCNANO_LCDIF
|
||||
bool "Use NXP DCNano DBI controller with MIPI DSI"
|
||||
|
||||
@@ -62,16 +62,16 @@ enum display_pixel_format {
|
||||
*/
|
||||
PIXEL_FORMAT_RGB_565 = BIT(4),
|
||||
/**
|
||||
* 16-bit RGB format packed into two bytes: 5 blue bits [15:11], 6
|
||||
* green bits [10:5], 5 red bits [4:0]. For example, in little-endian machine:
|
||||
* 16-bit RGB format packed into two bytes. Byte swapped version of
|
||||
* the PIXEL_FORMAT_RGB_565 format.
|
||||
*
|
||||
* @code{.unparsed}
|
||||
* 7......0 15.....8
|
||||
* | gggRrrrr BbbbbGgg | ...
|
||||
* | RrrrrGgg gggBbbbb | ...
|
||||
* @endcode
|
||||
*
|
||||
*/
|
||||
PIXEL_FORMAT_BGR_565 = BIT(5),
|
||||
PIXEL_FORMAT_RGB_565X = BIT(5),
|
||||
PIXEL_FORMAT_L_8 = BIT(6), /**< 8-bit Grayscale/Luminance, equivalent to */
|
||||
/**< GRAY, GREY, GRAY8, Y8, R8, etc... */
|
||||
PIXEL_FORMAT_AL_88 = BIT(7), /**< 8-bit Grayscale/Luminance with alpha */
|
||||
@@ -90,7 +90,7 @@ enum display_pixel_format {
|
||||
(((fmt & PIXEL_FORMAT_MONO10) >> 2) * 1U) + \
|
||||
(((fmt & PIXEL_FORMAT_ARGB_8888) >> 3) * 32U) + \
|
||||
(((fmt & PIXEL_FORMAT_RGB_565) >> 4) * 16U) + \
|
||||
(((fmt & PIXEL_FORMAT_BGR_565) >> 5) * 16U) + \
|
||||
(((fmt & PIXEL_FORMAT_RGB_565X) >> 5) * 16U) + \
|
||||
(((fmt & PIXEL_FORMAT_L_8) >> 6) * 8U) + \
|
||||
(((fmt & PIXEL_FORMAT_AL_88) >> 7) * 16U))
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#define PANEL_PIXEL_FORMAT_MONO10 (0x1 << 2) /* 1=Black 0=White */
|
||||
#define PANEL_PIXEL_FORMAT_ARGB_8888 (0x1 << 3)
|
||||
#define PANEL_PIXEL_FORMAT_RGB_565 (0x1 << 4)
|
||||
#define PANEL_PIXEL_FORMAT_BGR_565 (0x1 << 5)
|
||||
#define PANEL_PIXEL_FORMAT_RGB_565X (0x1 << 5)
|
||||
#define PANEL_PIXEL_FORMAT_L_8 (0x1 << 6)
|
||||
#define PANEL_PIXEL_FORMAT_AL_88 (0x1 << 7)
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ int set_lvgl_rendering_cb(lv_display_t *display)
|
||||
display);
|
||||
break;
|
||||
case PIXEL_FORMAT_RGB_565:
|
||||
case PIXEL_FORMAT_BGR_565:
|
||||
case PIXEL_FORMAT_RGB_565X:
|
||||
lv_display_set_color_format(display, LV_COLOR_FORMAT_RGB565);
|
||||
lv_display_set_flush_cb(display, lvgl_flush_cb_16bit);
|
||||
lv_display_add_event_cb(display, lvgl_rounder_cb, LV_EVENT_INVALIDATE_AREA,
|
||||
|
||||
@@ -119,8 +119,8 @@ static uint16_t get_rgb565_color(enum corner corner, uint8_t grey)
|
||||
return color;
|
||||
}
|
||||
|
||||
static void fill_buffer_bgr565(enum corner corner, uint8_t grey, uint8_t *buf,
|
||||
size_t buf_size)
|
||||
static void fill_buffer_rgb565x(enum corner corner, uint8_t grey, uint8_t *buf,
|
||||
size_t buf_size)
|
||||
{
|
||||
uint16_t color = get_rgb565_color(corner, grey);
|
||||
|
||||
@@ -295,9 +295,9 @@ int main(void)
|
||||
fill_buffer_fnc = fill_buffer_rgb565;
|
||||
buf_size *= 2;
|
||||
break;
|
||||
case PIXEL_FORMAT_BGR_565:
|
||||
case PIXEL_FORMAT_RGB_565X:
|
||||
bg_color = 0xFFu;
|
||||
fill_buffer_fnc = fill_buffer_bgr565;
|
||||
fill_buffer_fnc = fill_buffer_rgb565x;
|
||||
buf_size *= 2;
|
||||
break;
|
||||
case PIXEL_FORMAT_L_8:
|
||||
|
||||
@@ -114,8 +114,8 @@ static uint16_t get_rgb565_color(enum corner corner, uint8_t grey)
|
||||
return color;
|
||||
}
|
||||
|
||||
static void fill_buffer_bgr565(enum corner corner, uint8_t grey, uint8_t *buf,
|
||||
size_t buf_size)
|
||||
static void fill_buffer_rgb565x(enum corner corner, uint8_t grey, uint8_t *buf,
|
||||
size_t buf_size)
|
||||
{
|
||||
uint16_t color = get_rgb565_color(corner, grey);
|
||||
|
||||
@@ -287,9 +287,9 @@ int test_display(void)
|
||||
fill_buffer_fnc = fill_buffer_rgb565;
|
||||
buf_size *= 2;
|
||||
break;
|
||||
case PIXEL_FORMAT_BGR_565:
|
||||
case PIXEL_FORMAT_RGB_565X:
|
||||
bg_color = 0xFFu;
|
||||
fill_buffer_fnc = fill_buffer_bgr565;
|
||||
fill_buffer_fnc = fill_buffer_rgb565x;
|
||||
buf_size *= 2;
|
||||
break;
|
||||
case PIXEL_FORMAT_L_8:
|
||||
|
||||
@@ -43,7 +43,7 @@ static inline uint8_t bytes_per_pixel(enum display_pixel_format pixel_format)
|
||||
case PIXEL_FORMAT_RGB_888:
|
||||
return 3;
|
||||
case PIXEL_FORMAT_RGB_565:
|
||||
case PIXEL_FORMAT_BGR_565:
|
||||
case PIXEL_FORMAT_RGB_565X:
|
||||
case PIXEL_FORMAT_AL_88:
|
||||
return 2;
|
||||
case PIXEL_FORMAT_L_8:
|
||||
|
||||
@@ -89,12 +89,12 @@ tests:
|
||||
- native_sim/native/64
|
||||
extra_configs:
|
||||
- CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_RGB_565=y
|
||||
drivers.display.read_write.sdl.bgr565:
|
||||
drivers.display.read_write.sdl.rgb565x:
|
||||
platform_allow:
|
||||
- native_sim
|
||||
- native_sim/native/64
|
||||
extra_configs:
|
||||
- CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_BGR_565=y
|
||||
- CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_RGB_565X=y
|
||||
drivers.display.read_write.ili9340:
|
||||
tags:
|
||||
- shield
|
||||
|
||||
Reference in New Issue
Block a user