Skip to contentSkip to conversation

sdl2 + virtio-gpu repost

RFC In review Dave Airlie 3 participants 15 messages Dec 10, 2013 – Dec 12, 2013 Kbuild

lore
Share & tools
lore
#0 lore raw

Hi,

This is a repost of the latest SDL2 UI layer along with virtio-gpu,

I've merged the SDL2 base and multi-head patches into one, and I've split out the display notifiers stuff and the sdl2 demo hack.

The virtio-gpu/vga wrapping is still unresolved, I've failed to find a cleaner way yet, hopefully Gerd will advise further, but having 4 virtio-gpu- objects we getting ugly fast. I've also included a doc on the basic queues used in the virtio-gpu and what commands are sent on them.

I'd really like to get the sdl2 base patch merged at least,

Dave.

#1 lore raw

PATCH 1/8 ui/sdl2 : initial port to SDL 2.0 (v2.0)

From: Dave Airlie <[email protected]>

I've ported the SDL1.2 code over, and rewritten it to use the SDL2 interface.

The biggest changes were in the input handling, where SDL2 has done a major overhaul, and I've had to include a generated translation file to get from SDL2 codes back to qemu compatible ones. I'm still not sure how the keyboard layout code works in qemu, so there may be further work if someone can point me a test case that works with SDL1.2 and doesn't with SDL2.

Some SDL env vars we used to set are no longer used by SDL2, Windows, OSX support is untested,

I don't think we can link to SDL1.2 and SDL2 at the same time, so I felt using --with-sdlabi=2.0 to select the new code should be fine, like how gtk does it.

v1.1: fix keys in text console
v1.2: fix shutdown, cleanups a bit of code, support ARGB cursor

v2.0: merge the SDL multihead patch into this, g_new the number of consoles needed, wrap DCL inside per-console structure.

---
 configure                    |  23 +-
 ui/Makefile.objs             |   4 +-
 ui/sdl.c                     |   3 +
 ui/sdl2.c                    | 981 +++++++++++++++++++++++++++++++++++++++++++
 ui/sdl2_scancode_translate.h | 260 ++++++++++++
 ui/sdl_keysym.h              |   3 +-
 6 files changed, 1267 insertions(+), 7 deletions(-)
 create mode 100644 ui/sdl2.c
 create mode 100644 ui/sdl2_scancode_translate.h
configure +19 -4
index 0666228..3b7490d 100755
@@ -171,6 +171,7 @@ docs=""
 fdt=""
 pixman=""
 sdl=""
+sdlabi="1.2"
 virtfs=""
 vnc="yes"
 sparse="no"
@@ -322,6 +323,7 @@ query_pkg_config() {
 }
 pkg_config=query_pkg_config
 sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
+sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
 
 # If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
 ARFLAGS="${ARFLAGS-rv}"
@@ -727,6 +729,8 @@ for opt do
   ;;
   --enable-sdl) sdl="yes"
   ;;
+  --with-sdlabi=*) sdlabi="$optarg"
+  ;;
   --disable-qom-cast-debug) qom_cast_debug="no"
   ;;
   --enable-qom-cast-debug) qom_cast_debug="yes"
@@ -1113,6 +1117,7 @@ echo "  --disable-strip          disable stripping binaries"
 echo "  --disable-werror         disable compilation abort on warning"
 echo "  --disable-sdl            disable SDL"
 echo "  --enable-sdl             enable SDL"
+echo "  --with-sdlabi            select preferred SDL ABI 1.2 or 2.0"
 echo "  --disable-gtk            disable gtk UI"
 echo "  --enable-gtk             enable gtk UI"
 echo "  --disable-virtfs         disable VirtFS"
@@ -1781,12 +1786,22 @@ fi
 
 # Look for sdl configuration program (pkg-config or sdl-config).  Try
 # sdl-config even without cross prefix, and favour pkg-config over sdl-config.
-if test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
-  sdl_config=sdl-config
+
+if test $sdlabi == "2.0"; then
+    sdl_config=$sdl2_config
+    sdlname=sdl2
+    sdlconfigname=sdl2_config
+else
+    sdlname=sdl
+    sdlconfigname=sdl_config
+fi
+
+if test "`basename $sdl_config`" != $sdlconfigname && ! has ${sdl_config}; then
+  sdl_config=$sdlconfigname
 fi
 
-if $pkg_config sdl --exists; then
-  sdlconfig="$pkg_config sdl"
+if $pkg_config $sdlname --exists; then
+  sdlconfig="$pkg_config $sdlname"
   _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
 elif has ${sdl_config}; then
   sdlconfig="$sdl_config"
ui/Makefile.objs +2 -2
index f33be47..721ad37 100644
@@ -9,12 +9,12 @@ vnc-obj-y += vnc-jobs.o
 
 common-obj-y += keymaps.o console.o cursor.o input.o qemu-pixman.o
 common-obj-$(CONFIG_SPICE) += spice-core.o spice-input.o spice-display.o
-common-obj-$(CONFIG_SDL) += sdl.o sdl_zoom.o x_keymap.o
+common-obj-$(CONFIG_SDL) += sdl.o sdl_zoom.o x_keymap.o sdl2.o
 common-obj-$(CONFIG_COCOA) += cocoa.o
 common-obj-$(CONFIG_CURSES) += curses.o
 common-obj-$(CONFIG_VNC) += $(vnc-obj-y)
 common-obj-$(CONFIG_GTK) += gtk.o x_keymap.o
 
-$(obj)/sdl.o $(obj)/sdl_zoom.o: QEMU_CFLAGS += $(SDL_CFLAGS) 
+$(obj)/sdl.o $(obj)/sdl_zoom.o $(obj)/sdl2.o: QEMU_CFLAGS += $(SDL_CFLAGS) 
 
 $(obj)/gtk.o: QEMU_CFLAGS += $(GTK_CFLAGS) $(VTE_CFLAGS)
ui/sdl.c +3 -0
index 9d8583c..736bb95 100644
@@ -26,6 +26,8 @@
 #undef WIN32_LEAN_AND_MEAN
 
 #include <SDL.h>
+
+#if SDL_MAJOR_VERSION == 1
 #include <SDL_syswm.h>
 
 #include "qemu-common.h"
@@ -966,3 +968,4 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
 
     atexit(sdl_cleanup);
 }
+#endif
ui/sdl2.c new file +981 -0

981 lines not on this page · raw message

ui/sdl2_scancode_translate.h new file +260 -0

260 lines not on this page · raw message

ui/sdl_keysym.h +2 -1
index ee90480..599d9fc 100644
@@ -200,6 +200,7 @@ static const name2keysym_t name2keysym[]={
 { "yacute",               0x0fd},
 { "thorn",                0x0fe},
 { "ydiaeresis",           0x0ff},
+#if SDL_MAJOR_VERSION == 1
 {"EuroSign", SDLK_EURO},
 
     /* modifiers */
@@ -272,6 +273,6 @@ static const name2keysym_t name2keysym[]={
 {"Num_Lock", SDLK_NUMLOCK},
 {"Pause", SDLK_PAUSE},
 {"Escape", SDLK_ESCAPE},
-
+#endif
 {NULL, 0},
 };
Signature · 1 line
1.8.3.1
#5 lore raw

PATCH 2/8 console: add state notifiers for ui<->display

In reply to Dave Airlie

From: Dave Airlie <[email protected]>

These are to be used for the UI to signal the video display, and vice-versa about changes in the state of a console, like size and offsets in relation to other consoles for input handling.

---
 include/ui/console.h |  8 +++++++-
 ui/console.c         | 26 ++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)
include/ui/console.h +7 -1
index 4156a87..f6e8957 100644
@@ -173,6 +173,9 @@ typedef struct DisplayChangeListenerOps {
                           int x, int y, int on);
     void (*dpy_cursor_define)(DisplayChangeListener *dcl,
                               QEMUCursor *cursor);
+
+    void (*dpy_notify_state)(DisplayChangeListener *dcl,
+			     int x, int y, uint32_t width, uint32_t height);
 } DisplayChangeListenerOps;
 
 struct DisplayChangeListener {
@@ -223,7 +226,8 @@ void dpy_text_resize(QemuConsole *con, int w, int h);
 void dpy_mouse_set(QemuConsole *con, int x, int y, int on);
 void dpy_cursor_define(QemuConsole *con, QEMUCursor *cursor);
 bool dpy_cursor_define_supported(QemuConsole *con);
-
+void dpy_notify_state(QemuConsole *con, int x, int y,
+                      uint32_t width, uint32_t height);
 static inline int surface_stride(DisplaySurface *s)
 {
     return pixman_image_get_stride(s->image);
@@ -274,6 +278,7 @@ typedef struct GraphicHwOps {
     void (*gfx_update)(void *opaque);
     void (*text_update)(void *opaque, console_ch_t *text);
     void (*update_interval)(void *opaque, uint64_t interval);
+    void (*notify_state)(void *opaque, int idx, int x, int y, uint32_t width, uint32_t height);
 } GraphicHwOps;
 
 QemuConsole *graphic_console_init(DeviceState *dev,
@@ -283,6 +288,7 @@ QemuConsole *graphic_console_init(DeviceState *dev,
 void graphic_hw_update(QemuConsole *con);
 void graphic_hw_invalidate(QemuConsole *con);
 void graphic_hw_text_update(QemuConsole *con, console_ch_t *chardata);
+void graphic_hw_notify_state(QemuConsole *con, int x, int y, uint32_t width, uint32_t height);
 
 QemuConsole *qemu_console_lookup_by_index(unsigned int index);
 QemuConsole *qemu_console_lookup_by_device(DeviceState *dev);
ui/console.c +26 -0
index 502e160..def11ea 100644
@@ -265,6 +265,16 @@ void graphic_hw_invalidate(QemuConsole *con)
     }
 }
 
+void graphic_hw_notify_state(QemuConsole *con, int x, int y, uint32_t width, uint32_t height)
+{
+    if (!con) {
+        con = active_console;
+    }
+    if (con && con->hw_ops->notify_state) {
+        con->hw_ops->notify_state(con->hw, con->index, x, y, width, height);
+    }
+}
+
 static void ppm_save(const char *filename, struct DisplaySurface *ds,
                      Error **errp)
 {
@@ -1525,6 +1535,22 @@ bool dpy_cursor_define_supported(QemuConsole *con)
     return false;
 }
 
+void dpy_notify_state(QemuConsole *con, int x, int y,
+                      uint32_t width, uint32_t height)
+{
+    DisplayState *s = con->ds;
+    DisplayChangeListener *dcl;
+
+    QLIST_FOREACH(dcl, &s->listeners, next) {
+        if (con != (dcl->con ? dcl->con : active_console)) {
+            continue;
+        }
+        if (dcl->ops->dpy_notify_state) {
+            dcl->ops->dpy_notify_state(dcl, x, y, width, height);
+        }
+    }
+}
+
 /***********************************************************/
 /* register display */
 
Signature · 1 line
1.8.3.1
#6 lore raw

PATCH 3/8 sdl2: add display notify change support

In reply to Dave Airlie

From: Dave Airlie <[email protected]>

this adds support for the callbacks from the console layer, when the gpu changes the layouts.

---
 ui/sdl2.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
ui/sdl2.c +10 -0
index 2eb3e9c..dd8cd2b 100644
@@ -880,6 +880,15 @@ static void sdl_mouse_define(DisplayChangeListener *dcl,
         SDL_SetCursor(guest_sprite);
 }
 
+static void sdl_notify_state(DisplayChangeListener *dcl,
+                             int x, int y, uint32_t width, uint32_t height)
+{
+    struct sdl2_console_state *scon = container_of(dcl, struct sdl2_console_state, dcl);
+
+    scon->x = x;
+    scon->y = y;
+}
+
 static void sdl_cleanup(void)
 {
     if (guest_sprite)
@@ -894,6 +903,7 @@ static const DisplayChangeListenerOps dcl_ops = {
     .dpy_refresh       = sdl_refresh,
     .dpy_mouse_set     = sdl_mouse_warp,
     .dpy_cursor_define = sdl_mouse_define,
+    .dpy_notify_state  = sdl_notify_state,
 };
 
 void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
Signature · 1 line
1.8.3.1
#7 lore raw

PATCH 4/8 sdl2: add UI to toggle head 1 on/off

In reply to Dave Airlie

From: Dave Airlie <[email protected]>

This just adds ctrl-alt-n to toggle head 1 on/off for testing and demo purposes.

---
 ui/sdl2.c | 7 +++++++
 1 file changed, 7 insertions(+)
ui/sdl2.c +7 -0
index dd8cd2b..c52dcd9 100644
@@ -522,6 +522,13 @@ static void handle_keydown(SDL_Event *ev)
     if (gui_key_modifier_pressed) {
         keycode = sdl_keyevent_to_keycode(&ev->key);
         switch (keycode) {
+        case 0x31:
+            /* spawn a new connected monitor if we have one */
+            if (sdl2_console[1].surface)
+                graphic_hw_notify_state(sdl2_console[1].dcl.con, 0, 0, 0, 0);
+            else
+                graphic_hw_notify_state(sdl2_console[1].dcl.con, 0, 0, 1024, 768);
+            break;
         case 0x21: /* 'f' key on US keyboard */
             toggle_full_screen(scon);
             gui_keysym = 1;
Signature · 1 line
1.8.3.1
#8 lore raw

PATCH 5/8 console: add ability to wrap a console.

In reply to Dave Airlie

From: Dave Airlie <[email protected]>

In order to implement virtio-vga on top of virtio-gpu we need to be able to wrap the first console virtio-gpu registers from inside virtio-vga which initialises after virtio-gpu. With this interface virtio-vga can store the virtio-gpu interfaces, and call them from its own ones.

---
 include/ui/console.h |  7 +++++++
 ui/console.c         | 13 +++++++++++++
 2 files changed, 20 insertions(+)
include/ui/console.h +7 -0
index f6e8957..2ad9238 100644
@@ -285,6 +285,13 @@ QemuConsole *graphic_console_init(DeviceState *dev,
                                   const GraphicHwOps *ops,
                                   void *opaque);
 
+void graphic_console_wrap(QemuConsole *con,
+			  DeviceState *dev,
+			  const GraphicHwOps *ops,
+			  void *opaque,
+                          const GraphicHwOps **orig_ops,
+                          void **orig_opaque);
+
 void graphic_hw_update(QemuConsole *con);
 void graphic_hw_invalidate(QemuConsole *con);
 void graphic_hw_text_update(QemuConsole *con, console_ch_t *chardata);
ui/console.c +13 -0
index def11ea..f2d6721 100644
@@ -1619,6 +1619,19 @@ QemuConsole *graphic_console_init(DeviceState *dev,
     return s;
 }
 
+void graphic_console_wrap(QemuConsole *con,
+			  DeviceState *dev,
+			  const GraphicHwOps *hw_ops,
+			  void *opaque,
+                          const GraphicHwOps **orig_ops,
+                          void **orig_opaque)
+{
+    *orig_opaque = con->hw;
+    *orig_ops = con->hw_ops;
+    con->hw_ops = hw_ops;
+    con->hw = opaque;
+}
+
 QemuConsole *qemu_console_lookup_by_index(unsigned int index)
 {
     if (index >= MAX_CONSOLES) {
Signature · 1 line
1.8.3.1
#9 lore raw

PATCH 6/8 virtio-gpu: v0.2 of the virtio based GPU code.

In reply to Dave Airlie

From: Dave Airlie <[email protected]>

This is the basic virtio-gpu which is

multi-head capable,
ARGB cursor support,
unaccelerated.

Some more info is in docs/specs/virtio-gpu.txt.

changes since v0.1:
add reset handling
fix display info response
fix cursor generation issues
drop 3d stuff that snuck in

---
 default-configs/x86_64-softmmu.mak |   1 +
 docs/specs/virtio-gpu.txt          |  89 +++++
 hw/display/Makefile.objs           |   2 +
 hw/display/virtgpu_hw.h            | 142 ++++++++
 hw/display/virtio-gpu.c            | 649 +++++++++++++++++++++++++++++++++++++
 hw/virtio/virtio-pci.c             |  49 +++
 hw/virtio/virtio-pci.h             |  15 +
 include/hw/pci/pci.h               |   1 +
 include/hw/virtio/virtio-gpu.h     |  89 +++++
 9 files changed, 1037 insertions(+)
 create mode 100644 docs/specs/virtio-gpu.txt
 create mode 100644 hw/display/virtgpu_hw.h
 create mode 100644 hw/display/virtio-gpu.c
 create mode 100644 include/hw/virtio/virtio-gpu.h
default-configs/x86_64-softmmu.mak +1 -0
index 31bddce..1a00b78 100644
@@ -9,6 +9,7 @@ CONFIG_VGA_PCI=y
 CONFIG_VGA_ISA=y
 CONFIG_VGA_CIRRUS=y
 CONFIG_VMWARE_VGA=y
+CONFIG_VIRTIO_GPU=y
 CONFIG_VMMOUSE=y
 CONFIG_SERIAL=y
 CONFIG_PARALLEL=y
docs/specs/virtio-gpu.txt new file +89 -0

89 lines not on this page · raw message

hw/display/Makefile.objs +2 -0
index 540df82..10e4066 100644
@@ -32,3 +32,5 @@ obj-$(CONFIG_TCX) += tcx.o
 obj-$(CONFIG_VGA) += vga.o
 
 common-obj-$(CONFIG_QXL) += qxl.o qxl-logger.o qxl-render.o
+
+obj-$(CONFIG_VIRTIO_GPU) += virtio-gpu.o
hw/display/virtgpu_hw.h new file +142 -0

142 lines not on this page · raw message

hw/display/virtio-gpu.c new file +649 -0

649 lines not on this page · raw message

hw/virtio/virtio-pci.c +49 -0

61 lines not on this page · raw message

hw/virtio/virtio-pci.h +15 -0
index 917bcc5..856046d 100644
@@ -24,6 +24,7 @@
 #include "hw/virtio/virtio-balloon.h"
 #include "hw/virtio/virtio-bus.h"
 #include "hw/virtio/virtio-9p.h"
+#include "hw/virtio/virtio-gpu.h"
 #ifdef CONFIG_VIRTFS
 #include "hw/9pfs/virtio-9p.h"
 #endif
@@ -39,6 +40,7 @@ typedef struct VirtIOSerialPCI VirtIOSerialPCI;
 typedef struct VirtIONetPCI VirtIONetPCI;
 typedef struct VHostSCSIPCI VHostSCSIPCI;
 typedef struct VirtIORngPCI VirtIORngPCI;
+typedef struct VirtIOGPUPCI VirtIOGPUPCI;
 
 /* virtio-pci-bus */
 
@@ -200,6 +202,19 @@ struct VirtIORngPCI {
     VirtIORNG vdev;
 };
 
+/*
+ * virtio-gpu-pci: This extends VirtioPCIProxy.
+ */
+#define TYPE_VIRTIO_GPU_PCI "virtio-gpu-pci"
+#define VIRTIO_GPU_PCI(obj) \
+        OBJECT_CHECK(VirtIOGPUPCI, (obj), TYPE_VIRTIO_GPU_PCI)
+
+struct VirtIOGPUPCI {
+    VirtIOPCIProxy parent_obj;
+    VirtIOGPU vdev;
+};
+
+
 /* Virtio ABI version, if we increment this, we break the guest driver. */
 #define VIRTIO_PCI_ABI_VERSION          0
 
include/hw/pci/pci.h +1 -0
index b783e68..fee5d6b 100644
@@ -80,6 +80,7 @@
 #define PCI_DEVICE_ID_VIRTIO_SCSI        0x1004
 #define PCI_DEVICE_ID_VIRTIO_RNG         0x1005
 #define PCI_DEVICE_ID_VIRTIO_9P          0x1009
+#define PCI_DEVICE_ID_VIRTIO_GPU         0x1010
 
 #define PCI_VENDOR_ID_REDHAT             0x1b36
 #define PCI_DEVICE_ID_REDHAT_BRIDGE      0x0001
include/hw/virtio/virtio-gpu.h new file +89 -0

89 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#10 lore raw

PATCH 7/8 virtio-vga: v1

In reply to Dave Airlie

From: Dave Airlie <[email protected]>

This is a virtio-vga device built on top of the virtio-gpu device.

---
 Makefile                           |   2 +-
 default-configs/x86_64-softmmu.mak |   1 +
 hw/display/Makefile.objs           |   1 +
 hw/display/virtio-vga.c            | 156 +++++++++++++++++++++++++++++++++++++
 hw/pci/pci.c                       |   2 +
 include/sysemu/sysemu.h            |   2 +-
 pc-bios/vgabios-virtio.bin         | Bin 0 -> 40448 bytes
 roms/Makefile                      |   2 +-
 roms/config.vga.virtio             |   6 ++
 vl.c                               |  13 ++++
 10 files changed, 182 insertions(+), 3 deletions(-)
 create mode 100644 hw/display/virtio-vga.c
 create mode 100644 pc-bios/vgabios-virtio.bin
 create mode 100644 roms/config.vga.virtio
Makefile +1 -1
index bdff4e4..a7dabe4 100644
@@ -291,7 +291,7 @@ bepo    cz
 
 ifdef INSTALL_BLOBS
 BLOBS=bios.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
-vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin \
+vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
 acpi-dsdt.aml q35-acpi-dsdt.aml \
 ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin \
 pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
default-configs/x86_64-softmmu.mak +1 -0
index 1a00b78..22d8587 100644
@@ -10,6 +10,7 @@ CONFIG_VGA_ISA=y
 CONFIG_VGA_CIRRUS=y
 CONFIG_VMWARE_VGA=y
 CONFIG_VIRTIO_GPU=y
+CONFIG_VIRTIO_VGA=y
 CONFIG_VMMOUSE=y
 CONFIG_SERIAL=y
 CONFIG_PARALLEL=y
hw/display/Makefile.objs +1 -0
index 10e4066..63427e9 100644
@@ -34,3 +34,4 @@ obj-$(CONFIG_VGA) += vga.o
 common-obj-$(CONFIG_QXL) += qxl.o qxl-logger.o qxl-render.o
 
 obj-$(CONFIG_VIRTIO_GPU) += virtio-gpu.o
+obj-$(CONFIG_VIRTIO_VGA) += virtio-vga.o
hw/display/virtio-vga.c new file +156 -0

156 lines not on this page · raw message

hw/pci/pci.c +2 -0
index 49eca95..9d92d92 100644
@@ -1655,6 +1655,8 @@ PCIDevice *pci_vga_init(PCIBus *bus)
         return pci_create_simple(bus, -1, "VGA");
     case VGA_VMWARE:
         return pci_create_simple(bus, -1, "vmware-svga");
+    case VGA_VIRTIO:
+        return pci_create_simple(bus, -1, "virtio-vga");
     case VGA_NONE:
     default: /* Other non-PCI types. Checking for unsupported types is already
                 done in vl.c. */
include/sysemu/sysemu.h +1 -1
index 495dae8..1d6ec39 100644
@@ -103,7 +103,7 @@ typedef enum DisplayType
 extern int autostart;
 
 typedef enum {
-    VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL,
+    VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL, VGA_VIRTIO
 } VGAInterfaceType;
 
 extern int vga_interface_type;
pc-bios/vgabios-virtio.bin new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..2b70d272f2704e7839712a61613844321b93b465
GIT binary patch
roms/Makefile +1 -1
index 1e04669..9e51a79 100644
@@ -1,5 +1,5 @@
 
-vgabios_variants := stdvga cirrus vmware qxl isavga
+vgabios_variants := stdvga cirrus vmware qxl isavga virtio
 vgabios_targets  := $(subst -isavga,,$(patsubst %,vgabios-%.bin,$(vgabios_variants)))
 pxerom_variants  := e1000 eepro100 ne2k_pci pcnet rtl8139 virtio
 pxerom_targets   := 8086100e 80861209 10500940 10222000 10ec8139 1af41000
roms/config.vga.virtio new file +6 -0
new file mode 100644
index 0000000..9a78983
@@ -0,0 +1,6 @@
+CONFIG_BUILD_VGABIOS=y
+CONFIG_VGA_BOCHS=y
+CONFIG_VGA_PCI=y
+CONFIG_OVERRIDE_PCI_ID=y
+CONFIG_VGA_VID=0x1af4
+CONFIG_VGA_DID=0x1010
vl.c +13 -0
index b0399de..1915ed6 100644
@@ -299,6 +299,7 @@ static struct {
     { .driver = "isa-cirrus-vga",       .flag = &default_vga       },
     { .driver = "vmware-svga",          .flag = &default_vga       },
     { .driver = "qxl-vga",              .flag = &default_vga       },
+    { .driver = "virtio-vga",           .flag = &default_vga       },
 };
 
 static QemuOptsList qemu_rtc_opts = {
@@ -2082,6 +2083,11 @@ static bool qxl_vga_available(void)
     return object_class_by_name("qxl-vga");
 }
 
+static bool virtio_vga_available(void)
+{
+    return object_class_by_name("virtio-vga");
+}
+
 static void select_vgahw (const char *p)
 {
     const char *opts;
@@ -2108,6 +2114,13 @@ static void select_vgahw (const char *p)
             fprintf(stderr, "Error: VMWare SVGA not available\n");
             exit(0);
         }
+    } else if (strstart(p, "virtio", &opts)) {
+        if (virtio_vga_available()) {
+            vga_interface_type = VGA_VIRTIO;
+        } else {
+            fprintf(stderr, "Error: Virtio VGA not available\n");
+            exit(0);
+        }
     } else if (strstart(p, "xenfb", &opts)) {
         vga_interface_type = VGA_XENFB;
     } else if (strstart(p, "qxl", &opts)) {
Signature · 1 line
1.8.3.1
#11 lore raw

PATCH 8/8 HACK: just to make things start easier with libvirt

In reply to Dave Airlie

From: Dave Airlie <[email protected]>

---
 hw/display/vga-pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/display/vga-pci.c +2 -1
index b3a45c8..e4bea17 100644
@@ -146,6 +146,7 @@ static int pci_std_vga_initfn(PCIDevice *dev)
     PCIVGAState *d = DO_UPCAST(PCIVGAState, dev, dev);
     VGACommonState *s = &d->vga;
 
+	return 0;
     /* vga + console init */
     vga_common_init(s, OBJECT(dev));
     vga_init(s, OBJECT(dev), pci_address_space(dev), pci_address_space_io(dev),
@@ -195,7 +196,7 @@ static void vga_class_init(ObjectClass *klass, void *data)
     k->romfile = "vgabios-stdvga.bin";
     k->vendor_id = PCI_VENDOR_ID_QEMU;
     k->device_id = PCI_DEVICE_ID_QEMU_VGA;
-    k->class_id = PCI_CLASS_DISPLAY_VGA;
+    k->class_id = 0;// PCI_CLASS_DISPLAY_VGA;
     dc->vmsd = &vmstate_vga_pci;
     dc->props = vga_pci_properties;
     set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
Signature · 1 line
1.8.3.1
#12 lore raw
In reply to Dave Airlie
Quoted 11 lines · Dave Airlie

Hi,

This is a repost of the latest SDL2 UI layer along with virtio-gpu,

I've merged the SDL2 base and multi-head patches into one, and I've split out the display notifiers stuff and the sdl2 demo hack.

The virtio-gpu/vga wrapping is still unresolved, I've failed to find a cleaner way yet, hopefully Gerd will advise further, but having 4 virtio-gpu- objects we getting ugly fast. I've also included a doc on the basic queues used in the virtio-gpu and what commands are sent on them.

Oh I added one more patch to use glib allocation routines in virtio-gpu, I forgot that was on my list!

Dave.

#13 lore raw
In reply to Dave Airlie

Am 10.12.2013 05:05, schrieb Dave Airlie:

Quoted 7 lines

Hi,

This is a repost of the latest SDL2 UI layer along with virtio-gpu,

I've merged the SDL2 base and multi-head patches into one, and I've split out the display notifiers stuff and the sdl2 demo hack.

Quoted 8 lines

The virtio-gpu/vga wrapping is still unresolved, I've failed to find a cleaner way yet, hopefully Gerd will advise further, but having 4 virtio-gpu- objects we getting ugly fast. I've also included a doc on the basic queues used in the virtio-gpu and what commands are sent on them.

I'd really like to get the sdl2 base patch merged at least,

Dave.

I did not review all patches in the series, but stopped at the first one which had style issues.

Please check your patches using scripts/checkpatch.pl.

Stefan

#14 lore raw
Quoted 13 lines · Stefan Weil

Am 10.12.2013 05:05, schrieb Dave Airlie:

Quoted 12 lines

Hi,

This is a repost of the latest SDL2 UI layer along with virtio-gpu,

I've merged the SDL2 base and multi-head patches into one, and I've split out the display notifiers stuff and the sdl2 demo hack.

The virtio-gpu/vga wrapping is still unresolved, I've failed to find a cleaner way yet, hopefully Gerd will advise further, but having 4 virtio-gpu- objects we getting ugly fast. I've also included a doc on the basic queues used in the virtio-gpu and what commands are sent on them.

Quoted 8 lines
Quoted 3 lines

I'd really like to get the sdl2 base patch merged at least,

Dave.

I did not review all patches in the series, but stopped at the first one which had style issues.

Please check your patches using scripts/checkpatch.pl.

To be fair most of this comes from ui/sdl.c not conforming to qemu code style, because the code predates the current qemu code style.

Nevertheless it is a good idea to hook up scripts/checkpatch.pl in the git pre-commit.

cheers,
Gerd

#2 lore raw

Re: [Qemu-devel] [PATCH 1/8] ui/sdl2 : initial port to SDL 2.0 (v2.0)

In reply to Dave Airlie

Hi,

Quoted 5 lines

The biggest changes were in the input handling, where SDL2 has done a major overhaul, and I've had to include a generated translation file to get from SDL2 codes back to qemu compatible ones. I'm still not sure how the keyboard layout code works in qemu, so there may be further work if someone can point me a test case that works with SDL1.2 and doesn't with SDL2.

I've picked it up, cleaned up a bit (more to be done), switched over to new input core. Simplified the keyboard mess, the new input support in SDL2 allows us to reduce it to a single+simple lookup table. Pushed here:

http://www.kraxel.org/cgit/qemu/log/?h=rebase/input-wip

cheers,
Gerd

#3 lore raw

Re: [Qemu-devel] [PATCH 1/8] ui/sdl2 : initial port to SDL 2.0 (v2.0)

Quoted 8 lines · Gerd Hoffmann

Hi,

Quoted 5 lines

The biggest changes were in the input handling, where SDL2 has done a major overhaul, and I've had to include a generated translation file to get from SDL2 codes back to qemu compatible ones. I'm still not sure how the keyboard layout code works in qemu, so there may be further work if someone can point me a test case that works with SDL1.2 and doesn't with SDL2.

Quoted 4 lines

I've picked it up, cleaned up a bit (more to be done), switched over to new input core. Simplified the keyboard mess, the new input support in SDL2 allows us to reduce it to a single+simple lookup table. Pushed here:

Oh thanks for that, looks a lot cleaner esp the input handling, let me know if there
is anything you'd like me to look at.

I wasn't sure if we wanted to keep the old text console switching stuff on console 0 or not,
I see you've ripped it out, I can't say I ever used it anyways.

I've also started reworking gtk for multi-head and have the basics working there as well.

Dave.

#4 lore raw

Re: [Qemu-devel] [PATCH 1/8] ui/sdl2 : initial port to SDL 2.0 (v2.0)

Quoted 9 lines · Dave Airlie
Quoted 8 lines · Gerd Hoffmann

Hi,

Quoted 5 lines

The biggest changes were in the input handling, where SDL2 has done a major overhaul, and I've had to include a generated translation file to get from SDL2 codes back to qemu compatible ones. I'm still not sure how the keyboard layout code works in qemu, so there may be further work if someone can point me a test case that works with SDL1.2 and doesn't with SDL2.

Quoted 8 lines
Quoted 4 lines

I've picked it up, cleaned up a bit (more to be done), switched over to new input core. Simplified the keyboard mess, the new input support in SDL2 allows us to reduce it to a single+simple lookup table. Pushed here:

Oh thanks for that, looks a lot cleaner esp the input handling, let me know if there
is anything you'd like me to look at.

Testing would be nice (but take care a bit, the branch is a moving target, i.e. rebases), other than that nothing for now.

I wanna get the input patch series out-of-the-door asap, probably with the sdl2 bits sprinkled in at the correct places so the whole thing is bisectable.

Quoted 3 lines

I wasn't sure if we wanted to keep the old text console switching stuff on console 0 or not,
I see you've ripped it out, I can't say I ever used it anyways.

It's pointless if we explicitly bind to a specific console. The switching would change active_console, but you wouldn't see it.

cheers,
Gerd