Commit 1c1f9498 authored by Gerd Hoffmann's avatar Gerd Hoffmann
Browse files

console: add graphic_console_set_hwops



Add a function to allow display emulations to switch the hwops
function pointers.  This is useful for devices which have two
completely different operation modes.  Typical case is the vga
compatibility mode vs. native mode in qxl and the upcoming
virtio-vga device.

Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent 81ab11a7
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -292,6 +292,9 @@ typedef struct GraphicHwOps {
QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head,
                                  const GraphicHwOps *ops,
                                  void *opaque);
void graphic_console_set_hwops(QemuConsole *con,
                               const GraphicHwOps *hw_ops,
                               void *opaque);

void graphic_hw_update(QemuConsole *con);
void graphic_hw_invalidate(QemuConsole *con);
+9 −2
Original line number Diff line number Diff line
@@ -1677,6 +1677,14 @@ DisplayState *init_displaystate(void)
    return display_state;
}

void graphic_console_set_hwops(QemuConsole *con,
                               const GraphicHwOps *hw_ops,
                               void *opaque)
{
    con->hw_ops = hw_ops;
    con->hw = opaque;
}

QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head,
                                  const GraphicHwOps *hw_ops,
                                  void *opaque)
@@ -1691,8 +1699,7 @@ QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head,
    ds = get_alloc_displaystate();
    trace_console_gfx_new();
    s = new_console(ds, GRAPHIC_CONSOLE, head);
    s->hw_ops = hw_ops;
    s->hw = opaque;
    graphic_console_set_hwops(s, hw_ops, opaque);
    if (dev) {
        object_property_set_link(OBJECT(s), OBJECT(dev), "device",
                                 &error_abort);