提交 1c1f9498 编写于 作者: G Gerd Hoffmann

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: NGerd Hoffmann <kraxel@redhat.com>
上级 81ab11a7
...@@ -292,6 +292,9 @@ typedef struct GraphicHwOps { ...@@ -292,6 +292,9 @@ typedef struct GraphicHwOps {
QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head, QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head,
const GraphicHwOps *ops, const GraphicHwOps *ops,
void *opaque); void *opaque);
void graphic_console_set_hwops(QemuConsole *con,
const GraphicHwOps *hw_ops,
void *opaque);
void graphic_hw_update(QemuConsole *con); void graphic_hw_update(QemuConsole *con);
void graphic_hw_invalidate(QemuConsole *con); void graphic_hw_invalidate(QemuConsole *con);
......
...@@ -1677,6 +1677,14 @@ DisplayState *init_displaystate(void) ...@@ -1677,6 +1677,14 @@ DisplayState *init_displaystate(void)
return display_state; 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, QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head,
const GraphicHwOps *hw_ops, const GraphicHwOps *hw_ops,
void *opaque) void *opaque)
...@@ -1691,8 +1699,7 @@ QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head, ...@@ -1691,8 +1699,7 @@ QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head,
ds = get_alloc_displaystate(); ds = get_alloc_displaystate();
trace_console_gfx_new(); trace_console_gfx_new();
s = new_console(ds, GRAPHIC_CONSOLE, head); s = new_console(ds, GRAPHIC_CONSOLE, head);
s->hw_ops = hw_ops; graphic_console_set_hwops(s, hw_ops, opaque);
s->hw = opaque;
if (dev) { if (dev) {
object_property_set_link(OBJECT(s), OBJECT(dev), "device", object_property_set_link(OBJECT(s), OBJECT(dev), "device",
&error_abort); &error_abort);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册