Skip to content

Fix AtomGL PR review feedback#14

Open
drlinux wants to merge 17 commits into
atomvm:mainfrom
drlinux:fix/pr13-review-fixes
Open

Fix AtomGL PR review feedback#14
drlinux wants to merge 17 commits into
atomvm:mainfrom
drlinux:fix/pr13-review-fixes

Conversation

@drlinux

@drlinux drlinux commented Jun 19, 2026

Copy link
Copy Markdown

Replacement for PR #13 after addressing review comments and the compile/runtime issues.

drlinux added 15 commits June 20, 2026 13:58
Add display_color_to_rgb565() and display_color_to_surface() helpers
for converting internal display color values (0xRRGGBBAA format) to
RGB565 and surface-ready format.  Fix missing & 0xFF mask on the red
channel extraction in rgba8888_color_to_rgb565().  Use the new helpers
consistently for brcolor and fgcolor fields.

Signed-off-by: Ibrahim YILMAZ <ibrahim@drlinux.org>
When a primitive has transparent background (brcolor == 0), partial-alpha
pixels were previously blended against the current framebuffer content,
which is unreliable with double-buffered region rendering: the work
framebuffer contains uninitialized PSRAM data rather than the intended
lower display-list layer.

Add dcs_lcd_resolve_pixel_rgb565() and per-primitive pixel resolution
functions that walk the display list to find the solid colour from the
next lower opaque item.  Partial-alpha transparent pixels now blend
over that resolved lower-layer pixel instead of framebuffer memory.

This enables correct anti-aliased uFont text rendering over transparent
backgrounds on RGB LCD displays.

Signed-off-by: Ibrahim YILMAZ <ibrahim@drlinux.org>
…l byte order

Add update_region (partial screen update) and draw_rgb565_raw (direct
RGB565 binary draw) to the pre-ack list so callers receive an immediate
acknowledgement without risk of mailbox queue timeout.

Fix epd_draw_pixel to write RGBA bytes individually instead of relying
on uint32_t endianness.  The previous code wrote alpha in the MSB of a
uint32_t, which on little-endian ESP32 placed the R and B channels in
reversed positions relative to the declared RGBA byte order.

Signed-off-by: Ibrahim YILMAZ <ibrahim@drlinux.org>
Add a new display driver for RGB LCD panels using the esp_lcd RGB
interface (ESP-IDF 5+).  The driver supports:

- Double framebuffering in PSRAM for tear-free rendering
- Full-screen and region-based partial updates (update_region)
- Direct raw RGB565 pixel drawing (draw_rgb565_raw)
- base64-encoded RLE RGB565 images with nearest-neighbour scaling
- Fullscreen background image storage in PSRAM with per-line
  restore before each region update
- Frame buffer mirroring across inactive framebuffers

The RGB LCD driver is only compiled when ESP-IDF >= 5.  Compatible
strings: "waveshare,esp32-s3-touch-lcd-7" and "esp_lcd,rgb".

Signed-off-by: Ibrahim YILMAZ <ibrahim@drlinux.org>
…ansparent compositing

Add documentation for the new RGB LCD display driver to
display-drivers.md, including all configuration options, compat
strings, and an example configuration.

Document the update_region and draw_rgb565_raw port commands.

Update the primitives documentation to describe the display-list
transparent background compositing behaviour for anti-aliased
uFont text.

Signed-off-by: Ibrahim YILMAZ <ibrahim@drlinux.org>
Signed-off-by: Ibrahim YILMAZ <ibrahim@drlinux.org>
Signed-off-by: Ibrahim YILMAZ <ibrahim@drlinux.org>
When update_region, draw_rgb565_raw, or the RLE cover path write only
their target region to the work framebuffer and then switch to it,
the rest of the screen content is lost because the work FB contains
stale data.

Fix: copy the full active framebuffer to the work FB before writing
the region pixels, so the entire screen state is preserved across
all framebuffer switches.

Signed-off-by: Ibrahim YILMAZ <ibrahim@drlinux.org>
Signed-off-by: Ibrahim YILMAZ <ibrahim@drlinux.org>
epd_draw_pixel wrote 0x00BBGGRR with wrong byte shifts, breaking text
color. Guard uFont surface allocation with size_t math to avoid overflow.

Signed-off-by: Ibrahim YILMAZ <ibrahim@drlinux.org>
Reject non-positive scale factors and out-of-range source offsets at parse
time and before pointer arithmetic to avoid divide-by-zero and OOB reads.

Signed-off-by: Ibrahim YILMAZ <ibrahim@drlinux.org>
panel_reset and panel_init early returns leaked the scanline buffer and
driver struct. Add rgb_lcd_free_driver and call it on those error paths.

Signed-off-by: Ibrahim YILMAZ <ibrahim@drlinux.org>
Remove draw_rgb565_raw port command per maintainer feedback. Reuse its
framebuffer logic in draw_rgb565_region and call it from draw_buffer so
double-buffered panels stay consistent across region updates.

Signed-off-by: Ibrahim YILMAZ <ibrahim@drlinux.org>
Accept {:rgb565, width, height, binary} alongside rgba8888 in image and
scaled_cropped_image tuples. Validate binary size at parse time and render
rgb565 pixels in the DCS LCD draw path.

Signed-off-by: Ibrahim YILMAZ <ibrahim@drlinux.org>
Replace draw_rgb565_raw documentation with draw_buffer and describe the
rgb565 image tuple format for direct buffer delivery.

Signed-off-by: Ibrahim YILMAZ <ibrahim@drlinux.org>
@drlinux drlinux force-pushed the fix/pr13-review-fixes branch from ff7fdd9 to da07048 Compare June 20, 2026 11:58
Blend transparent RGBA pixels over restored background with optional
lower-layer resolve instead of stalling on alpha==0. Restore
RRGGBBAA uFont fgcolor layout. Accept draw_buffer binary tuples and
persist partial cover draws into background_buffer.

Signed-off-by: Ibrahim YILMAZ <ibrahim@drlinux.org>
@drlinux drlinux force-pushed the fix/pr13-review-fixes branch from da07048 to 21eea4a Compare June 20, 2026 11:59
dcs_lcd_draw_image_x computed the RGBA source row pointer using the
clamped line width instead of item->width. When an RGBA image is drawn
partially off-screen (e.g. a scrolling marquee title), the stride is too
small and every row after the first reads from the wrong offset, showing
garbage pixels. Use item->width for the stride, matching the rgb565 path.

Signed-off-by: Ibrahim YILMAZ <ibrahim@drlinux.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant