Skip to content

Commit 69dedab

Browse files
committed
Review fixes
1 parent d2e9a58 commit 69dedab

6 files changed

Lines changed: 13 additions & 39 deletions

File tree

ports/espressif/boards/waveshare_esp32_s3_amoled_241/mpconfigboard.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
#define CIRCUITPY_BOARD_I2C (0)
1212
#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO48, .sda = &pin_GPIO47}}
1313

14-
// Display refresh buffer: 2048 uint32_t words = 8KB on stack.
14+
// Display refresh buffer: 8192 bytes = 2048 uint32_t words on stack.
1515
// ESP32-S3 main task stack is 24KB; verified safe with this board.
16-
#define CIRCUITPY_DISPLAY_AREA_BUFFER_SIZE (2048)
16+
#define CIRCUITPY_DISPLAY_AREA_BUFFER_SIZE (8192)
1717

1818
// AMOLED Display (displayio + qspibus path) - initialized in board_init()
1919
#define CIRCUITPY_BOARD_DISPLAY (1)

py/circuitpy_mpconfig.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,11 +394,11 @@ typedef long mp_off_t;
394394
#define CIRCUITPY_DISPLAY_LIMIT (1)
395395
#endif
396396

397-
// Display area buffer size in uint32_t words for _refresh_area() VLA.
397+
// Display area buffer size in bytes for _refresh_area() VLA.
398398
// Allocated on stack; boards with larger displays can override per-board.
399-
// Default 128 words = 512 bytes.
399+
// Default 512 bytes = 128 uint32_t words.
400400
#ifndef CIRCUITPY_DISPLAY_AREA_BUFFER_SIZE
401-
#define CIRCUITPY_DISPLAY_AREA_BUFFER_SIZE (128)
401+
#define CIRCUITPY_DISPLAY_AREA_BUFFER_SIZE (512)
402402
#endif
403403

404404
#else

shared-module/busdisplay/BusDisplay.c

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ static void _send_pixels(busdisplay_busdisplay_obj_t *self, uint8_t *pixels, uin
214214
}
215215

216216
static bool _refresh_area(busdisplay_busdisplay_obj_t *self, const displayio_area_t *area) {
217-
uint32_t buffer_size = CIRCUITPY_DISPLAY_AREA_BUFFER_SIZE; // In uint32_ts
217+
uint32_t buffer_size = CIRCUITPY_DISPLAY_AREA_BUFFER_SIZE / sizeof(uint32_t); // In uint32_ts
218218

219219
displayio_area_t clipped;
220220
// Clip the area to the display by overlapping the areas. If there is no overlap then we're done.
@@ -262,8 +262,6 @@ static bool _refresh_area(busdisplay_busdisplay_obj_t *self, const displayio_are
262262

263263
uint16_t remaining_rows = displayio_area_height(&clipped);
264264

265-
bool async_bus = (self->bus.flush != NULL);
266-
267265
for (uint16_t j = 0; j < subrectangles; j++) {
268266
displayio_area_t subrectangle = {
269267
.x1 = clipped.x1,
@@ -286,31 +284,15 @@ static bool _refresh_area(busdisplay_busdisplay_obj_t *self, const displayio_are
286284
memset(mask, 0, mask_length * sizeof(mask[0]));
287285
memset(buffer, 0, buffer_size * sizeof(buffer[0]));
288286

289-
if (async_bus) {
290-
// Async path: fill_area overlaps with previous DMA transfer.
291-
// begin_transaction() waits for prior DMA to finish.
292-
displayio_display_core_fill_area(&self->core, &subrectangle, mask, buffer);
293-
294-
if (!displayio_display_bus_begin_transaction(&self->bus)) {
295-
return false;
296-
}
297-
displayio_display_bus_send_region_commands(&self->bus, &self->core, &subrectangle);
298-
_send_pixels(self, (uint8_t *)buffer, subrectangle_size_bytes);
299-
displayio_display_bus_end_transaction(&self->bus);
300-
} else {
301-
// Sync path: set region first, then fill and send.
302-
displayio_display_bus_set_region_to_update(&self->bus, &self->core, &subrectangle);
303-
304-
displayio_display_core_fill_area(&self->core, &subrectangle, mask, buffer);
287+
displayio_display_core_fill_area(&self->core, &subrectangle, mask, buffer);
305288

306-
if (!displayio_display_bus_is_free(&self->bus)) {
307-
return false;
308-
}
289+
displayio_display_bus_set_region_to_update(&self->bus, &self->core, &subrectangle);
309290

310-
displayio_display_bus_begin_transaction(&self->bus);
311-
_send_pixels(self, (uint8_t *)buffer, subrectangle_size_bytes);
312-
displayio_display_bus_end_transaction(&self->bus);
291+
if (!displayio_display_bus_begin_transaction(&self->bus)) {
292+
return false;
313293
}
294+
_send_pixels(self, (uint8_t *)buffer, subrectangle_size_bytes);
295+
displayio_display_bus_end_transaction(&self->bus);
314296

315297
// Run background tasks so they can run during an explicit refresh.
316298
// Auto-refresh won't run background tasks here because it is a background task itself.

shared-module/displayio/bus_core.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,6 @@ void displayio_display_bus_set_region_to_update(displayio_display_bus_t *self, d
255255
_displayio_display_bus_send_region_commands(self, display, area, true);
256256
}
257257

258-
void displayio_display_bus_send_region_commands(displayio_display_bus_t *self, displayio_display_core_t *display, displayio_area_t *area) {
259-
_displayio_display_bus_send_region_commands(self, display, area, false);
260-
}
261-
262258
void displayio_display_bus_flush(displayio_display_bus_t *self) {
263259
if (self->flush != NULL) {
264260
self->flush(self->bus);

shared-module/displayio/bus_core.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ void displayio_display_bus_end_transaction(displayio_display_bus_t *self);
5050

5151
void displayio_display_bus_set_region_to_update(displayio_display_bus_t *self, displayio_display_core_t *display, displayio_area_t *area);
5252

53-
// Send column/row window commands within an already-open transaction.
54-
// Caller must have called displayio_display_bus_begin_transaction() first.
55-
void displayio_display_bus_send_region_commands(displayio_display_bus_t *self, displayio_display_core_t *display, displayio_area_t *area);
56-
5753
// Drain any pending asynchronous transfers on the bus.
5854
// No-op for synchronous buses (FourWire, I2C, ParallelBus).
5955
void displayio_display_bus_flush(displayio_display_bus_t *self);

shared-module/framebufferio/FramebufferDisplay.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ static const displayio_area_t *_get_refresh_areas(framebufferio_framebufferdispl
117117

118118
#define MARK_ROW_DIRTY(r) (dirty_row_bitmask[r / 8] |= (1 << (r & 7)))
119119
static bool _refresh_area(framebufferio_framebufferdisplay_obj_t *self, const displayio_area_t *area, uint8_t *dirty_row_bitmask) {
120-
uint16_t buffer_size = CIRCUITPY_DISPLAY_AREA_BUFFER_SIZE; // In uint32_ts
120+
uint16_t buffer_size = CIRCUITPY_DISPLAY_AREA_BUFFER_SIZE / sizeof(uint32_t); // In uint32_ts
121121

122122
displayio_area_t clipped;
123123
// Clip the area to the display by overlapping the areas. If there is no overlap then we're done.

0 commit comments

Comments
 (0)