mirror of
https://github.com/esphome/esphome.git
synced 2026-10-14 10:12:52 +00:00
[display] Keep to_color() inlined in both draw_pixels_at loops
With two call sites GCC at -Os stopped inlining to_color(), which cost a call and spills per pixel; flatten keeps it inlined, and the row loop now measures faster than before the change.
This commit is contained in:
@@ -73,8 +73,11 @@ static inline ESPHOME_ALWAYS_INLINE uint32_t read_packed_pixel(const uint8_t *pt
|
||||
}
|
||||
}
|
||||
|
||||
void Display::draw_pixels_at(int x_start, int y_start, int w, int h, const uint8_t *ptr, ColorOrder order,
|
||||
ColorBitness bitness, bool big_endian, int x_offset, int y_offset, int x_pad) {
|
||||
// flatten keeps to_color() inlined in both loops; GCC at -Os stops inlining
|
||||
// it once there are two call sites, which costs a call and spills per pixel.
|
||||
__attribute__((flatten)) void Display::draw_pixels_at(int x_start, int y_start, int w, int h, const uint8_t *ptr,
|
||||
ColorOrder order, ColorBitness bitness, bool big_endian,
|
||||
int x_offset, int y_offset, int x_pad) {
|
||||
const size_t line_stride = x_offset + w + x_pad; // length of each source line in pixels
|
||||
#ifdef USE_PSRAM
|
||||
// The source is row-major; when the display swaps the axes before writing,
|
||||
|
||||
Reference in New Issue
Block a user