All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/2] spice patch queue
@ 2014-09-29 10:20 Gerd Hoffmann
  2014-09-29 10:20 ` [Qemu-devel] [PULL 1/2] console: add graphic_console_set_hwops Gerd Hoffmann
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2014-09-29 10:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

  Hi,

Short spice patch queue, adding a new graphic_console_set_hwops function
to the console core, which in turn allows to simplify switching between
vga and native mode in qxl.

please pull,
  Gerd

The following changes since commit 81ab11a7a524d12412a59ef49c6b270671e62ea0:

  Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2014-09-26 15:41:50 +0100)

are available in the git repository at:


  git://anongit.freedesktop.org/spice/qemu tags/pull-spice-20140929-1

for you to fetch changes up to 151623353f4a3da4daec29d658c10ef3b57bd462:

  qxl: use graphic_console_set_hwops (2014-09-29 10:20:09 +0200)

----------------------------------------------------------------
add and use graphic_console_set_hwops

----------------------------------------------------------------
Gerd Hoffmann (2):
      console: add graphic_console_set_hwops
      qxl: use graphic_console_set_hwops

 hw/display/qxl.c     | 49 +++++++++----------------------------------------
 include/ui/console.h |  3 +++
 ui/console.c         | 11 +++++++++--
 3 files changed, 21 insertions(+), 42 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PULL 1/2] console: add graphic_console_set_hwops
  2014-09-29 10:20 [Qemu-devel] [PULL 0/2] spice patch queue Gerd Hoffmann
@ 2014-09-29 10:20 ` Gerd Hoffmann
  2014-09-29 10:20 ` [Qemu-devel] [PULL 2/2] qxl: use graphic_console_set_hwops Gerd Hoffmann
  2014-09-30 10:01 ` [Qemu-devel] [PULL 0/2] spice patch queue Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2014-09-29 10:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Anthony Liguori

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: Gerd Hoffmann <kraxel@redhat.com>
---
 include/ui/console.h |  3 +++
 ui/console.c         | 11 +++++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/include/ui/console.h b/include/ui/console.h
index cde0faf..22ef8ca 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -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);
diff --git a/ui/console.c b/ui/console.c
index f819382..258af5d 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -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);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PULL 2/2] qxl: use graphic_console_set_hwops
  2014-09-29 10:20 [Qemu-devel] [PULL 0/2] spice patch queue Gerd Hoffmann
  2014-09-29 10:20 ` [Qemu-devel] [PULL 1/2] console: add graphic_console_set_hwops Gerd Hoffmann
@ 2014-09-29 10:20 ` Gerd Hoffmann
  2014-09-30 10:01 ` [Qemu-devel] [PULL 0/2] spice patch queue Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2014-09-29 10:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Simply switch function pointers when entering/leaving vga mode.
Allows to remove wrapper functions which do nothing but dispatch
calls depending on the current qxl mode.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/display/qxl.c | 49 +++++++++----------------------------------------
 1 file changed, 9 insertions(+), 40 deletions(-)

diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 55d13a7..93b3518 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -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);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PULL 0/2] spice patch queue
  2014-09-29 10:20 [Qemu-devel] [PULL 0/2] spice patch queue Gerd Hoffmann
  2014-09-29 10:20 ` [Qemu-devel] [PULL 1/2] console: add graphic_console_set_hwops Gerd Hoffmann
  2014-09-29 10:20 ` [Qemu-devel] [PULL 2/2] qxl: use graphic_console_set_hwops Gerd Hoffmann
@ 2014-09-30 10:01 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2014-09-30 10:01 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU Developers

On 29 September 2014 11:20, Gerd Hoffmann <kraxel@redhat.com> wrote:
>   Hi,
>
> Short spice patch queue, adding a new graphic_console_set_hwops function
> to the console core, which in turn allows to simplify switching between
> vga and native mode in qxl.
>
> please pull,
>   Gerd
>
> The following changes since commit 81ab11a7a524d12412a59ef49c6b270671e62ea0:
>
>   Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2014-09-26 15:41:50 +0100)
>
> are available in the git repository at:
>
>
>   git://anongit.freedesktop.org/spice/qemu tags/pull-spice-20140929-1
>
> for you to fetch changes up to 151623353f4a3da4daec29d658c10ef3b57bd462:
>
>   qxl: use graphic_console_set_hwops (2014-09-29 10:20:09 +0200)
>
> ----------------------------------------------------------------
> add and use graphic_console_set_hwops
>
> ----------------------------------------------------------------

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-30 10:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-29 10:20 [Qemu-devel] [PULL 0/2] spice patch queue Gerd Hoffmann
2014-09-29 10:20 ` [Qemu-devel] [PULL 1/2] console: add graphic_console_set_hwops Gerd Hoffmann
2014-09-29 10:20 ` [Qemu-devel] [PULL 2/2] qxl: use graphic_console_set_hwops Gerd Hoffmann
2014-09-30 10:01 ` [Qemu-devel] [PULL 0/2] spice patch queue Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.