On Thu, Jul 6, 2023 at 10:57 PM Dongwon Kim <dongwon.kim@intel.com> wrote:
> Skip refresh if a new dmabuf (guest scanout frame) has already been
> submitted and ready to be drawn because the scanout will be updated
> with new frame anyway.
>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
> Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>
> Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> ui/gtk-egl.c | 4 ++++
> ui/gtk-gl-area.c | 4 ++++
> 2 files changed, 8 insertions(+)
>
> diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
> index d59b8cd7d7..859aa8185e 100644
> --- a/ui/gtk-egl.c
> +++ b/ui/gtk-egl.c
> @@ -144,6 +144,10 @@ void gd_egl_refresh(DisplayChangeListener *dcl)
> gd_update_monitor_refresh_rate(
> vc, vc->window ? vc->window : vc->gfx.drawing_area);
>
> + if (vc->gfx.guest_fb.dmabuf &&
> vc->gfx.guest_fb.dmabuf->draw_submitted) {
> + return;
> + }
> +
> if (!vc->gfx.esurface) {
> gd_egl_init(vc);
> if (!vc->gfx.esurface) {
> diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c
> index 7367dfd793..7da75bd025 100644
> --- a/ui/gtk-gl-area.c
> +++ b/ui/gtk-gl-area.c
> @@ -123,6 +123,10 @@ void gd_gl_area_refresh(DisplayChangeListener *dcl)
>
> gd_update_monitor_refresh_rate(vc, vc->window ? vc->window :
> vc->gfx.drawing_area);
>
> + if (vc->gfx.guest_fb.dmabuf &&
> vc->gfx.guest_fb.dmabuf->draw_submitted) {
> + return;
> + }
> +
> if (!vc->gfx.gls) {
> if (!gtk_widget_get_realized(vc->gfx.drawing_area)) {
> return;
> --
> 2.34.1
>
>
>
--
Marc-André Lureau