mirror of
https://github.com/esphome/esphome.git
synced 2026-10-14 10:12:52 +00:00
[image] Only build the column walk when PSRAM is present
Without PSRAM the frame buffer is in uncached RAM where a strided write costs nothing, so the second copy of the loops bought only flash. Adds the transparent binary and grayscale paths to the host benchmark.
This commit is contained in:
@@ -44,11 +44,15 @@ void Image::draw(int x, int y, display::Display *display, Color color_on, Color
|
||||
// image read and the frame buffer write sequential. When the display swaps
|
||||
// the axes before writing, walking columns keeps the write sequential
|
||||
// instead; a strided write costs more than a strided read.
|
||||
#ifdef USE_PSRAM
|
||||
if (display->pixel_axes_swapped()) {
|
||||
this->draw_<false>(x, y, display, color_on, color_off, x_start, x_end, y_start, y_end);
|
||||
} else {
|
||||
this->draw_<true>(x, y, display, color_on, color_off, x_start, x_end, y_start, y_end);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
// Without PSRAM the frame buffer is in uncached RAM, where the strided write
|
||||
// is free, so one copy of the loops is enough.
|
||||
this->draw_<true>(x, y, display, color_on, color_off, x_start, x_end, y_start, y_end);
|
||||
}
|
||||
|
||||
template<bool ROWS_OUTER>
|
||||
|
||||
@@ -76,6 +76,21 @@ static void ImageDraw_RGB_Rotated(benchmark::State &state) {
|
||||
}
|
||||
BENCHMARK(ImageDraw_RGB_Rotated);
|
||||
|
||||
static void ImageDraw_Binary_Transparent(benchmark::State &state) {
|
||||
draw_image(state, IMAGE_TYPE_BINARY, TRANSPARENCY_CHROMA_KEY);
|
||||
}
|
||||
BENCHMARK(ImageDraw_Binary_Transparent);
|
||||
|
||||
static void ImageDraw_Grayscale_ChromaKey(benchmark::State &state) {
|
||||
draw_image(state, IMAGE_TYPE_GRAYSCALE, TRANSPARENCY_CHROMA_KEY);
|
||||
}
|
||||
BENCHMARK(ImageDraw_Grayscale_ChromaKey);
|
||||
|
||||
static void ImageDraw_Grayscale_Alpha(benchmark::State &state) {
|
||||
draw_image(state, IMAGE_TYPE_GRAYSCALE, TRANSPARENCY_ALPHA_CHANNEL);
|
||||
}
|
||||
BENCHMARK(ImageDraw_Grayscale_Alpha);
|
||||
|
||||
static void ImageDraw_RGB_Alpha(benchmark::State &state) {
|
||||
draw_image(state, IMAGE_TYPE_RGB, TRANSPARENCY_ALPHA_CHANNEL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user