ui/spice: Destroy the temporary egl fb after the blit is submitted
PATCH 1/1 ui/spice: Destroy the temporary egl fb after the blit is submitted
The temporary egl fb scanout_tex_fb is only needed to facilitate the blit to the display surface's texture (ssd->ds->texture). Therefore, destroy it after the blit is submitted. And, also make sure that it is empty initialized before it is actually used.
--- ui/spice-display.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
ui/spice-display.c +2 -2
@@ -1191,12 +1191,12 @@ static bool spice_gl_blit_scanout_texture(SimpleSpiceDisplay *ssd,uint64_t modifier;bool ret; -egl_fb_destroy (scanout_tex_fb);egl_fb_setup_for_tex (scanout_tex_fb,surface_width (ssd->ds),surface_height (ssd->ds), ssd->ds->texture, false);egl_fb_blit (scanout_tex_fb, &ssd->guest_fb, false);glFlush (); +egl_fb_destroy (scanout_tex_fb);if (!ssd->new_scanout_texture) {return true;
@@ -1330,7 +1330,7 @@ static void qemu_spice_gl_update(DisplayChangeListener *dcl, }if (spice_remote_client && ssd->blit_scanout_texture) { -egl_fb scanout_tex_fb; +egl_fb scanout_tex_fb = {}; ret =spice_gl_blit_scanout_texture (ssd, &scanout_tex_fb);if (!ret) {
Signature · 1 line
2.49.0
Quoted 33 lines · Vivek Kasireddy
The temporary egl fb
scanout_tex_fbis only needed to facilitate the blit to the display surface's texture (ssd->ds->texture). Therefore, destroy it after the blit is submitted. And, also make sure that it is empty initialized before it is actually used.Fixes f851cd65 ("ui/spice: Blit the scanout texture if its memory layout is not linear")Reported-by Peter Maydell <[email protected]>Cc Marc-André Lureau <[email protected]>Signed-off-by Vivek Kasireddy <[email protected]>--- ui/spice-display.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)ui/spice-display.c +1
-1@@ -1191,12 +1191,12 @@ static bool spice_gl_blit_scanout_texture(SimpleSpiceDisplay *ssd,uint64_t modifier;bool ret; -egl_fb_destroy (scanout_tex_fb);egl_fb_setup_for_tex (scanout_tex_fb,surface_width (ssd->ds),surface_height (ssd->ds), ssd->ds->texture, false);egl_fb_blit (scanout_tex_fb, &ssd->guest_fb, false);glFlush (); +egl_fb_destroy (scanout_tex_fb);if (!ssd->new_scanout_texture) {return true;
ui/spice-display.c static void qemu_spice_gl_update(DisplayChangeListener *dcl, · line 1336
Quoted 8 lines
ui/spice-display.c +1
-1@@ -1330,7 +1330,7 @@ static void qemu_spice_gl_update(DisplayChangeListener *dcl, }if (spice_remote_client && ssd->blit_scanout_texture) { -egl_fb scanout_tex_fb; +egl_fb scanout_tex_fb = {}; ret =spice_gl_blit_scanout_texture (ssd, &scanout_tex_fb);if (!ret) {
It looks like we only call spice_gl_blit_scanout_texture() once -- would it make more sense to put the scanout_tx_fb variable inside that function rather than making its only callsite set it up? That way the function owns, sets up, uses and destroys the egl_fb.
thanks
-- PMM