ui: Add enabled field to egl_fb struct
PATCH 1/1 ui: Add enabled field to egl_fb struct
Add a switch to enable/disable a egl_fb to make sure a egl_fb can only be flushed when it's enabled.
For example, the cursor plane might be disabled by guest Apps on purpose. With the "enabled" field, a cursor plane can be ignored when it's disabled by guest Apps.
Against branch: work/intel-vgpu
Signed-off-by Tina Zhang <[email protected]>
Cc Gerd Hoffmann <[email protected]>
--- hw/vfio/display.c | 5 +++++ include/ui/egl-helpers.h | 1 + ui/egl-headless.c | 12 ++++++++---- ui/gtk-egl.c | 11 ++++++++--- 4 files changed, 22 insertions(+), 7 deletions(-)
hw/vfio/display.c +5 -0
@@ -182,6 +182,11 @@ static void vfio_display_dmabuf_update(void *opaque) cursor->hot_y, cursor->pos_x, cursor->pos_y); + }else { +/* Cursor plane is disabled */ +dpy_gl_cursor_position (vdev->display_con, + false, false, +0 ,0 ,0 ,0 ); } dpy_gl_update(vdev->display_con, 0, 0,
include/ui/egl-helpers.h +1 -0
@@ -14,6 +14,7 @@ typedef struct egl_fb {GLuint texture;GLuint framebuffer;bool delete_texture; +bool enabled; } egl_fb;void egl_log_error (const char *func,const char *call);
ui/egl-headless.c +8 -4
@@ -103,9 +103,13 @@ static void egl_cursor_position(DisplayChangeListener *dcl, uint32_t pos_x, uint32_t pos_y) {egl_dpy *edpy =container_of (dcl, egl_dpy, dcl); - - edpy->pos_x = pos_x; - edpy->pos_y = pos_y; +if (!have_pos) { + edpy->cursor_fb.enabled = false; + }else { + edpy->cursor_fb.enabled = true ; + edpy->pos_x = pos_x; + edpy->pos_y = pos_y; + } } static void egl_release_dmabuf(DisplayChangeListener *dcl,
@@ -127,7 +131,7 @@ static void egl_scanout_flush(DisplayChangeListener *dcl,assert (surface_height (edpy->ds) == edpy->guest_fb.height);assert (surface_format (edpy->ds) == PIXMAN_x8r8g8b8); -if (edpy->cursor_fb.texture) { +if (edpy->cursor_fb.texture && edpy->cursor_fb.enabled) {/* have cursor -> render using textures */ egl_texture_blit (edpy->gls, &edpy->blit_fb, &edpy->guest_fb, !edpy->y_0_top);
ui/gtk-egl.c +8 -3
@@ -249,8 +249,13 @@ void gd_egl_cursor_position(DisplayChangeListener *dcl, {VirtualConsole *vc =container_of (dcl, VirtualConsole, gfx.dcl); - vc->gfx.cursor_x = pos_x; - vc->gfx.cursor_y = pos_y; +if (!have_pos) { + vc->gfx.cursor_fb.enabled = false; + }else { + vc->gfx.cursor_fb.enabled = true; + vc->gfx.cursor_x = pos_x; + vc->gfx.cursor_y = pos_y; + } } void gd_egl_release_dmabuf(DisplayChangeListener *dcl,
@@ -287,7 +292,7 @@ void gd_egl_scanout_flush(DisplayChangeListener *dcl,egl_fb_setup_default (&vc->gfx.win_fb, ww, wh);egl_texture_blit (vc->gfx.gls, &vc->gfx.win_fb, &vc->gfx.guest_fb, vc->gfx.y0_top); -if (vc->gfx.cursor_fb.texture) { +if (vc->gfx.cursor_fb.texture && vc->gfx.cursor_fb.enabled) {egl_texture_blend (vc->gfx.gls, &vc->gfx.win_fb, &vc->gfx.cursor_fb, vc->gfx.y0_top, vc->gfx.cursor_x, vc->gfx.cursor_y);
Signature · 1 line
2.7.4