mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
ui/dbus: fix texture sharing
The DBus listener naively create, update and destroy textures without taking into account other listeners. The texture were shared, but texture update was unnecessarily duplicated. Teach DisplayGLCtx to do optionally shared texture handling. This is only implemented for DBus display at this point, however the same infrastructure could potentially be used for other future combinations. Reported-by: Akihiko Odaki <akihiko.odaki@gmail.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
c84ab0a500
commit
589089feee
4 changed files with 64 additions and 11 deletions
28
ui/console.c
28
ui/console.c
|
@ -1073,6 +1073,27 @@ static void displaychangelistener_gfx_switch(DisplayChangeListener *dcl,
|
|||
}
|
||||
}
|
||||
|
||||
static void dpy_gfx_create_texture(QemuConsole *con, DisplaySurface *surface)
|
||||
{
|
||||
if (con->gl && con->gl->ops->dpy_gl_ctx_create_texture) {
|
||||
con->gl->ops->dpy_gl_ctx_create_texture(con->gl, surface);
|
||||
}
|
||||
}
|
||||
|
||||
static void dpy_gfx_destroy_texture(QemuConsole *con, DisplaySurface *surface)
|
||||
{
|
||||
if (con->gl && con->gl->ops->dpy_gl_ctx_destroy_texture) {
|
||||
con->gl->ops->dpy_gl_ctx_destroy_texture(con->gl, surface);
|
||||
}
|
||||
}
|
||||
|
||||
static void dpy_gfx_update_texture(QemuConsole *con, DisplaySurface *surface,
|
||||
int x, int y, int w, int h)
|
||||
{
|
||||
if (con->gl && con->gl->ops->dpy_gl_ctx_update_texture) {
|
||||
con->gl->ops->dpy_gl_ctx_update_texture(con->gl, surface, x, y, w, h);
|
||||
}
|
||||
}
|
||||
|
||||
static void displaychangelistener_display_console(DisplayChangeListener *dcl,
|
||||
QemuConsole *con,
|
||||
|
@ -1086,6 +1107,9 @@ static void displaychangelistener_display_console(DisplayChangeListener *dcl,
|
|||
if (!dummy) {
|
||||
dummy = qemu_create_placeholder_surface(640, 480, nodev);
|
||||
}
|
||||
if (con) {
|
||||
dpy_gfx_create_texture(con, dummy);
|
||||
}
|
||||
displaychangelistener_gfx_switch(dcl, dummy, TRUE);
|
||||
return;
|
||||
}
|
||||
|
@ -1105,6 +1129,7 @@ static void displaychangelistener_display_console(DisplayChangeListener *dcl,
|
|||
con->scanout.texture.width,
|
||||
con->scanout.texture.height);
|
||||
} else if (con->scanout.kind == SCANOUT_SURFACE) {
|
||||
dpy_gfx_create_texture(con, con->surface);
|
||||
displaychangelistener_gfx_switch(dcl, con->surface, TRUE);
|
||||
}
|
||||
}
|
||||
|
@ -1637,6 +1662,7 @@ void dpy_gfx_update(QemuConsole *con, int x, int y, int w, int h)
|
|||
if (!qemu_console_is_visible(con)) {
|
||||
return;
|
||||
}
|
||||
dpy_gfx_update_texture(con, con->surface, x, y, w, h);
|
||||
QLIST_FOREACH(dcl, &s->listeners, next) {
|
||||
if (con != (dcl->con ? dcl->con : active_console)) {
|
||||
continue;
|
||||
|
@ -1681,12 +1707,14 @@ void dpy_gfx_replace_surface(QemuConsole *con,
|
|||
|
||||
con->scanout.kind = SCANOUT_SURFACE;
|
||||
con->surface = surface;
|
||||
dpy_gfx_create_texture(con, surface);
|
||||
QLIST_FOREACH(dcl, &s->listeners, next) {
|
||||
if (con != (dcl->con ? dcl->con : active_console)) {
|
||||
continue;
|
||||
}
|
||||
displaychangelistener_gfx_switch(dcl, surface, FALSE);
|
||||
}
|
||||
dpy_gfx_destroy_texture(con, old_surface);
|
||||
qemu_free_displaysurface(old_surface);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue