drivers: display: display_sdl: implement display_show
Adds frame synchronization to every frame. This prevents frame tearing. Signed-off-by: Martin Stumpf <finomnis@gmail.com>
This commit is contained in:
parent
2e0687cfd2
commit
abc296ff65
4 changed files with 17 additions and 16 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "display_sdl_bottom.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue