add and use graphic_console_set_hwops

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJUKTH9AAoJEEy22O7T6HE4VBcP/RDShZFrM6f0YCziiAcSoPUi
 Ig7i6CiIGGYj9kgg/MeJz4pxWVjx6Ef/MctflPDE2nq59NxrQAZsEoi+oY0oY8II
 iqU1Hqq2keTlal50DfiWmI2o0wxvoh1pPKDVBwqpN+uYP4mpq9TxfAmUPxJfy3o+
 sUvN1ZI6FqULU///FarM6qqgILS3cUFBOyzdhYaazT6To+8G9GViZcoy+yzo0QNO
 j0A6wcNS7Bur2Yp5AVwLVDwBAyB82mmCjLCAuLueSnVc41b9XdpZIsaVt3wHYaYI
 39s4bSYIzcHhnH9438A1/LtD4xoaVqNpuZUqVTzZ74HlXnLa/peZwVeNEPTBYZm0
 mRksp7+nL08qNtSGy31621vo/a/qFkiM2ZlHssVDZXfZRWNij7dR4cZC8mzV54Vj
 FkpIFKGK3F+dncvWnIi8fAij5j+U5ccp5QqjOweTg9mOcXUk9xU1+2R0QML6R9Lv
 +nuL5G+70lNWIDAZcVmyFzcAoU/DLf8W/KlJSouWHNDV/NcqTabA00FGMN7HNW57
 CehQIpbkXikrVzeyvNGnkSqUIQD+obZYKDBm+jc52DKC3Ple3V1dNoLgiCczVvTr
 zXJTJaWX4N1GVl+qFFsxq3rgQrCncHlqqC8onaKo4uCZRbHXNTH8mbHm0ijvvsp/
 9UgRG1+2cIwHhO8Wtu4A
 =y4G/
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/spice/tags/pull-spice-20140929-1' into staging

add and use graphic_console_set_hwops

# gpg: Signature made Mon 29 Sep 2014 11:18:37 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/spice/tags/pull-spice-20140929-1:
  qxl: use graphic_console_set_hwops
  console: add graphic_console_set_hwops

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2014-09-29 19:28:15 +01:00
commit 70d3a7a7b8
3 changed files with 21 additions and 42 deletions

View File

@ -132,6 +132,8 @@ static void qxl_reset_memslots(PCIQXLDevice *d);
static void qxl_reset_surfaces(PCIQXLDevice *d);
static void qxl_ring_set_dirty(PCIQXLDevice *qxl);
static void qxl_hw_update(void *opaque);
void qxl_set_guest_bug(PCIQXLDevice *qxl, const char *msg, ...)
{
trace_qxl_set_guest_bug(qxl->id);
@ -1076,6 +1078,10 @@ static const QXLInterface qxl_interface = {
.client_monitors_config = interface_client_monitors_config,
};
static const GraphicHwOps qxl_ops = {
.gfx_update = qxl_hw_update,
};
static void qxl_enter_vga_mode(PCIQXLDevice *d)
{
if (d->mode == QXL_MODE_VGA) {
@ -1085,6 +1091,7 @@ static void qxl_enter_vga_mode(PCIQXLDevice *d)
#if SPICE_SERVER_VERSION >= 0x000c03 /* release 0.12.3 */
spice_qxl_driver_unload(&d->ssd.qxl);
#endif
graphic_console_set_hwops(d->ssd.dcl.con, d->vga.hw_ops, &d->vga);
qemu_spice_create_host_primary(&d->ssd);
d->mode = QXL_MODE_VGA;
vga_dirty_log_start(&d->vga);
@ -1097,6 +1104,7 @@ static void qxl_exit_vga_mode(PCIQXLDevice *d)
return;
}
trace_qxl_exit_vga_mode(d->id);
graphic_console_set_hwops(d->ssd.dcl.con, &qxl_ops, d);
vga_dirty_log_stop(&d->vga);
qxl_destroy_primary(d, QXL_SYNC);
}
@ -1756,41 +1764,8 @@ static void qxl_send_events(PCIQXLDevice *d, uint32_t events)
static void qxl_hw_update(void *opaque)
{
PCIQXLDevice *qxl = opaque;
VGACommonState *vga = &qxl->vga;
switch (qxl->mode) {
case QXL_MODE_VGA:
vga->hw_ops->gfx_update(vga);
break;
case QXL_MODE_COMPAT:
case QXL_MODE_NATIVE:
qxl_render_update(qxl);
break;
default:
break;
}
}
static void qxl_hw_invalidate(void *opaque)
{
PCIQXLDevice *qxl = opaque;
VGACommonState *vga = &qxl->vga;
if (qxl->mode == QXL_MODE_VGA) {
vga->hw_ops->invalidate(vga);
return;
}
}
static void qxl_hw_text_update(void *opaque, console_ch_t *chardata)
{
PCIQXLDevice *qxl = opaque;
VGACommonState *vga = &qxl->vga;
if (qxl->mode == QXL_MODE_VGA) {
vga->hw_ops->text_update(vga, chardata);
return;
}
qxl_render_update(qxl);
}
static void qxl_dirty_surfaces(PCIQXLDevice *qxl)
@ -2049,12 +2024,6 @@ static int qxl_init_common(PCIQXLDevice *qxl)
return 0;
}
static const GraphicHwOps qxl_ops = {
.invalidate = qxl_hw_invalidate,
.gfx_update = qxl_hw_update,
.text_update = qxl_hw_text_update,
};
static int qxl_init_primary(PCIDevice *dev)
{
PCIQXLDevice *qxl = DO_UPCAST(PCIQXLDevice, pci, dev);

View File

@ -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);

View File

@ -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);