diff --git a/doc/releases/release-notes-4.1.rst b/doc/releases/release-notes-4.1.rst index cd207e67a7e..c8cfe497b5c 100644 --- a/doc/releases/release-notes-4.1.rst +++ b/doc/releases/release-notes-4.1.rst @@ -95,6 +95,8 @@ Drivers and Sensors * Added flag ``frame_incomplete`` to ``display_write`` that indicates whether a write is the last write of the frame, allowing display drivers to implement double buffering / tearing enable signal handling (:github:`81250`) + * Added ``frame_incomplete`` handling to SDL display driver (:dtcompatible:`zephyr,sdl-dc`) + (:github:`81250`) * Ethernet diff --git a/drivers/display/display_sdl.c b/drivers/display/display_sdl.c index 04370c85502..2c88e16bd75 100644 --- a/drivers/display/display_sdl.c +++ b/drivers/display/display_sdl.c @@ -260,9 +260,9 @@ static int sdl_display_write(const struct device *dev, const uint16_t x, sdl_display_write_bgr565(disp_data->buf, desc, buf); } - sdl_display_write_bottom(desc->height, desc->width, x, y, - disp_data->renderer, disp_data->mutex, disp_data->texture, - disp_data->buf, disp_data->display_on); + sdl_display_write_bottom(desc->height, desc->width, x, y, disp_data->renderer, + disp_data->mutex, disp_data->texture, disp_data->buf, + disp_data->display_on, desc->frame_incomplete); return 0; } diff --git a/drivers/display/display_sdl_bottom.c b/drivers/display/display_sdl_bottom.c index 0e995a341c9..e0fbd4a5fbb 100644 --- a/drivers/display/display_sdl_bottom.c +++ b/drivers/display/display_sdl_bottom.c @@ -5,6 +5,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include "display_sdl_bottom.h" + #include #include #include @@ -64,10 +66,9 @@ int sdl_display_init_bottom(uint16_t height, uint16_t width, uint16_t zoom_pct, return 0; } -void sdl_display_write_bottom(const uint16_t height, const uint16_t width, - const uint16_t x, const uint16_t y, - void *renderer, void *mutex, void *texture, - uint8_t *buf, bool display_on) +void sdl_display_write_bottom(const uint16_t height, const uint16_t width, const uint16_t x, + const uint16_t y, void *renderer, void *mutex, void *texture, + uint8_t *buf, bool display_on, bool frame_incomplete) { SDL_Rect rect; int err; @@ -85,7 +86,7 @@ void sdl_display_write_bottom(const uint16_t height, const uint16_t width, SDL_UpdateTexture(texture, &rect, buf, 4 * rect.w); - if (display_on) { + if (display_on && !frame_incomplete) { SDL_RenderClear(renderer); SDL_RenderCopy(renderer, texture, NULL, NULL); SDL_RenderPresent(renderer); diff --git a/drivers/display/display_sdl_bottom.h b/drivers/display/display_sdl_bottom.h index 54973777f1b..721cfa2b5a8 100644 --- a/drivers/display/display_sdl_bottom.h +++ b/drivers/display/display_sdl_bottom.h @@ -23,14 +23,12 @@ extern "C" { int sdl_display_init_bottom(uint16_t height, uint16_t width, uint16_t zoom_pct, bool use_accelerator, void **window, void **renderer, void **mutex, void **texture, void **read_texture); -void sdl_display_write_bottom(const uint16_t height, const uint16_t width, - const uint16_t x, const uint16_t y, - void *renderer, void *mutex, void *texture, - uint8_t *buf, bool display_on); -int sdl_display_read_bottom(const uint16_t height, const uint16_t width, - const uint16_t x, const uint16_t y, - void *renderer, void *buf, uint16_t pitch, - void *mutex, void *texture, void **read_texture); +void sdl_display_write_bottom(const uint16_t height, const uint16_t width, const uint16_t x, + const uint16_t y, void *renderer, void *mutex, void *texture, + uint8_t *buf, bool display_on, bool frame_incomplete); +int sdl_display_read_bottom(const uint16_t height, const uint16_t width, const uint16_t x, + const uint16_t y, void *renderer, void *buf, uint16_t pitch, + void *mutex, void *texture, void *read_texture); void sdl_display_blanking_off_bottom(void *renderer, void *texture); void sdl_display_blanking_on_bottom(void *renderer); void sdl_display_cleanup_bottom(void **window, void **renderer, void **mutex, void **texture,