Skip to content

displayio common_hal_xxx_begin_transaction() routines not used or implemented safely #1619

@dhalbert

Description

@dhalbert

The common_hal routines common_hal_displayio_fourwire_begin_transaction() and common_hal_displayio_parallelbus_begin_transaction() return true or false depending on whether they've successfully started a display transaction. However, their return value is never checked: the callers assume that once called, the transaction has begun, even though the start-transaction has failed.

For ParallelBus, it doesn't matter, because there's no contention, and the routine always returns true. But for FourWire, the routine does a common_hal_busio_spi_try_lock(), which might fail and return false if someone else is holding the lock.

So either the return values should be checked, and the calling code should busy-wait or fail nicely, or the xxx_begin_transaction() routine should itself busy-wait.

If we do MICROPY_VM_HOOK_LOOP during the busy-wait, we have to avoid calling ourselves recursively, so a flag should be set that can be checked to avoid doing any displayio background operations while waiting.

These routines are either called directly in FourWire.send() and ParallelBus.send(), or via self->begin_transaction() in various Display methods.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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