Skip to content

GRAY16 direct-write sizing: getBitsPerPixel() returns 1, but clients send 4bpp #93

Description

@balloob

Found while bringing Firmware_NRF54 to parity (see OpenDisplay/Firmware_NRF54#2).

getBitsPerPixel() in src/display_service.cpp returns 1 for COLOR_SCHEME_GRAY16 (only BWGBRY→4, BWRY→2, GRAY4→2 are special-cased), so the direct-write path sizes a 16-gray upload as ceil(w/8)*h bytes — a 1bpp image.

But the client stack sends 16-gray as 4bpp (2 pixels/byte): py-opendisplay routes GRAYSCALE_16 through encode_4bpp() (src/opendisplay/encoding/images.py:97-100), i.e. 4× the byte count the firmware expects. The compressed path enforces the declared size exactly, so a client GRAY16 upload should be length-rejected (or, uncompressed, auto-complete at 1/4 of the image).

The nRF54 port deliberately expects 4bpp for GRAY16 (opendisplay_display_color.c), matching the client. Suggest aligning this firmware to 4bpp for GRAY16 as well — unless there's a known GRAY16 panel path that really consumes a 1-bit plane here, in which case the client side is the bug and that should be decided explicitly.

🤖 Generated with Claude Code

https://claude.ai/code/session_012g2e8mr132vcizx92WsgiR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions