qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PULL 4/9] sdl: restore optimized redraw


From: Peter Maydell
Subject: Re: [Qemu-devel] [PULL 4/9] sdl: restore optimized redraw
Date: Fri, 27 Apr 2018 14:08:32 +0100

On 16 February 2018 at 11:54, Gerd Hoffmann <address@hidden> wrote:
> From: Anatoly Trosinenko <address@hidden>
>
> The documentation on SDL_RenderPresent function states that
> "the backbuffer should be considered invalidated after each present",
> so copy the entire texture on each redraw.
>
> On the other hand, SDL_UpdateTexture function is described as
> "fairly slow function", so restrict it to just the changed pixels.
>
> Also added SDL_RenderClear call, as suggested in the documentation
> page on SDL_RenderPresent.
>
> Signed-off-by: Anatoly Trosinenko <address@hidden>
> Message-id: address@hidden
> Signed-off-by: Gerd Hoffmann <address@hidden>
> ---
>  ui/sdl2-2d.c | 21 ++++++---------------
>  1 file changed, 6 insertions(+), 15 deletions(-)
>
> diff --git a/ui/sdl2-2d.c b/ui/sdl2-2d.c
> index 8ab68d67b9..1f34817bae 100644
> --- a/ui/sdl2-2d.c
> +++ b/ui/sdl2-2d.c
> @@ -36,6 +36,8 @@ void sdl2_2d_update(DisplayChangeListener *dcl,
>      struct sdl2_console *scon = container_of(dcl, struct sdl2_console, dcl);
>      DisplaySurface *surf = qemu_console_surface(dcl->con);
>      SDL_Rect rect;
> +    size_t surface_data_offset = surface_bytes_per_pixel(surf) * x +
> +                                 surface_stride(surf) * y;
>
>      assert(!scon->opengl);
>

Hi. Coverity points out (CID 1390598) that this change adds
a use of 'surf' before the "if (!surf) { return; }" check.
I suspect the calculation of surface_data_offset should be
done lower in the function, after all the early-exit checks.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]