Skip to content

Commit

Permalink
Merge branch 'contrib/github_pr_13294_v5.1' into 'release/v5.1'
Browse files Browse the repository at this point in the history
Flush rgb lcd PSRAM framebuffers after allocation (GitHub PR) (v5.1)

See merge request espressif/esp-idf!29394
  • Loading branch information
jack0c committed Mar 5, 2024
2 parents 005e665 + afc3ee8 commit 50eea05
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion components/esp_lcd/src/esp_lcd_panel_rgb.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,14 @@ static esp_err_t lcd_rgb_panel_alloc_frame_buffers(const esp_lcd_rgb_panel_confi
if (fb_in_psram) {
// the low level malloc function will help check the validation of alignment
rgb_panel->fbs[i] = heap_caps_aligned_calloc(psram_trans_align, 1, rgb_panel->fb_size, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
ESP_RETURN_ON_FALSE(rgb_panel->fbs[i], ESP_ERR_NO_MEM, TAG, "no mem for frame buffer");
// calloc not only allocates but also zero's the buffer. We have to make sure this is
// properly committed to the PSRAM, otherwise all sorts of visual corruption will happen.
ESP_RETURN_ON_ERROR(esp_cache_msync(rgb_panel->fbs[i], rgb_panel->fb_size, 0), TAG, "cache write back failed");
} else {
rgb_panel->fbs[i] = heap_caps_aligned_calloc(sram_trans_align, 1, rgb_panel->fb_size, MALLOC_CAP_INTERNAL | MALLOC_CAP_DMA);
ESP_RETURN_ON_FALSE(rgb_panel->fbs[i], ESP_ERR_NO_MEM, TAG, "no mem for frame buffer");
}
ESP_RETURN_ON_FALSE(rgb_panel->fbs[i], ESP_ERR_NO_MEM, TAG, "no mem for frame buffer");
}
}

Expand Down

0 comments on commit 50eea05

Please sign in to comment.