From 9bb17b7b2c717f19b4128db8085b96f754034caf Mon Sep 17 00:00:00 2001 From: Tinyu Date: Thu, 18 Jun 2026 14:18:21 +0800 Subject: [PATCH] Use nonswapped RGB888 for LT8912B HDMI output. --- src/M5UnitPoEP4HDMI.h | 2 +- src/lgfx/v1/misc/colortype.hpp | 6 ++++++ src/lgfx/v1/misc/pixelcopy.hpp | 3 +++ src/lgfx/v1/platforms/esp32p4/Panel_LT8912B.hpp | 3 +-- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/M5UnitPoEP4HDMI.h b/src/M5UnitPoEP4HDMI.h index c3befa5..bda162e 100644 --- a/src/M5UnitPoEP4HDMI.h +++ b/src/M5UnitPoEP4HDMI.h @@ -36,7 +36,7 @@ class M5UnitPoEP4HDMI : public M5GFX uint16_t dsi_ldo_voltage_mv = 2500; uint32_t i2c_freq = 100000; - lgfx::color_depth_t output_depth = lgfx::rgb888_3Byte; + lgfx::color_depth_t output_depth = lgfx::rgb888_nonswapped; }; M5UnitPoEP4HDMI(void) : M5UnitPoEP4HDMI(config_t{}) {} diff --git a/src/lgfx/v1/misc/colortype.hpp b/src/lgfx/v1/misc/colortype.hpp index fd607db..36a7d46 100644 --- a/src/lgfx/v1/misc/colortype.hpp +++ b/src/lgfx/v1/misc/colortype.hpp @@ -713,6 +713,7 @@ namespace lgfx switch (dst_depth) { case argb8888_4Byte: return color_convert; case rgb888_3Byte : return color_convert; + case rgb888_nonswapped: return color_convert; case rgb666_3Byte : return color_convert; case rgb565_2Byte : return color_convert; case rgb332_1Byte : return no_convert; @@ -724,6 +725,7 @@ namespace lgfx switch (dst_depth) { case argb8888_4Byte: return color_convert; case rgb888_3Byte : return getSwap24; + case rgb888_nonswapped: return no_convert; case rgb666_3Byte : return color_convert; case rgb565_2Byte : return color_convert; case rgb332_1Byte : return color_convert; @@ -735,6 +737,7 @@ namespace lgfx switch (dst_depth) { case argb8888_4Byte: return getSwap32; case rgb888_3Byte : return color_convert; + case rgb888_nonswapped: return no_convert; case rgb666_3Byte : return color_convert; case rgb565_2Byte : return color_convert; case rgb332_1Byte : return color_convert; @@ -746,6 +749,7 @@ namespace lgfx switch (dst_depth) { case argb8888_4Byte: return color_convert; case rgb888_3Byte : return no_convert; + case rgb888_nonswapped: return color_convert; case rgb666_3Byte : return color_convert; case rgb565_2Byte : return color_convert; case rgb332_1Byte : return color_convert; @@ -757,6 +761,7 @@ namespace lgfx switch (dst_depth) { case argb8888_4Byte: return color_convert; case rgb888_3Byte : return color_convert; + case rgb888_nonswapped: return color_convert; case rgb666_3Byte : return color_convert; case rgb565_2Byte : return getSwap16; case rgb332_1Byte : return color_convert; @@ -842,6 +847,7 @@ namespace lgfx switch (depth_) { case argb8888_4Byte: revert_rgb888 = color_convert; break; case rgb888_3Byte: revert_rgb888 = color_convert; break; + case rgb888_nonswapped: revert_rgb888 = no_convert; break; case rgb666_3Byte: revert_rgb888 = color_convert; break; case rgb565_2Byte: revert_rgb888 = color_convert; break; case rgb332_1Byte: revert_rgb888 = color_convert; break; diff --git a/src/lgfx/v1/misc/pixelcopy.hpp b/src/lgfx/v1/misc/pixelcopy.hpp index a520639..9c738d4 100644 --- a/src/lgfx/v1/misc/pixelcopy.hpp +++ b/src/lgfx/v1/misc/pixelcopy.hpp @@ -108,6 +108,7 @@ namespace lgfx return (dst_depth == rgb565_2Byte) ? copy_rgb_affine : (dst_depth == rgb332_1Byte) ? copy_rgb_affine : (dst_depth == rgb888_3Byte) ? copy_rgb_affine + : (dst_depth == rgb888_nonswapped) ? copy_rgb_affine : (dst_depth == rgb666_3Byte) ? (std::is_same::value ? copy_rgb_affine : copy_rgb_affine) @@ -123,6 +124,7 @@ namespace lgfx : (src_depth == rgb332_1Byte) ? copy_rgb_affine : (src_depth == grayscale_8bit) ? copy_rgb_affine : (src_depth == rgb565_nonswapped) ? copy_rgb_affine + : (src_depth == rgb888_nonswapped) ? copy_rgb_affine : (src_depth == rgb888_3Byte) ? copy_rgb_affine : (std::is_same::value) ? copy_rgb_affine @@ -135,6 +137,7 @@ namespace lgfx return (dst_depth == rgb565_2Byte) ? copy_palette_affine : (dst_depth == rgb332_1Byte) ? copy_palette_affine : (dst_depth == rgb888_3Byte) ? copy_palette_affine + : (dst_depth == rgb888_nonswapped) ? copy_palette_affine : (dst_depth == rgb666_3Byte) ? copy_palette_affine : (dst_depth == grayscale_8bit) ? copy_palette_affine : (dst_depth == rgb565_nonswapped) ? copy_palette_affine diff --git a/src/lgfx/v1/platforms/esp32p4/Panel_LT8912B.hpp b/src/lgfx/v1/platforms/esp32p4/Panel_LT8912B.hpp index a5b72cf..558f1b7 100644 --- a/src/lgfx/v1/platforms/esp32p4/Panel_LT8912B.hpp +++ b/src/lgfx/v1/platforms/esp32p4/Panel_LT8912B.hpp @@ -85,7 +85,7 @@ namespace lgfx uint8_t lane_num = 2; bool use_draw_bitmap = false; - color_depth_t output_depth = rgb888_3Byte; + color_depth_t output_depth = rgb888_nonswapped; }; Panel_LT8912B(void) { _cfg.bus_shared = false; } @@ -97,7 +97,6 @@ namespace lgfx void display(uint_fast16_t x, uint_fast16_t y, uint_fast16_t w, uint_fast16_t h) override; color_depth_t setColorDepth(color_depth_t depth) override; - void setSleep(bool flg_sleep) override; void setPowerSave(bool flg_idle) override { setSleep(flg_idle); }