Skip to contentSkip to conversation

Add QEMU DirectFB display driver

PATCH NAK Julian Pidancet 10 participants 38 messages May 13, 2010 – May 20, 2010 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add QEMU DirectFB display driver

This patch implements a DirectFB driver for QEMU. It allows Qemu to draw a VM graphic output directly in the framebuffer of the host, without having to rely on X11.
DirectFB also provides with a generic interface take advantage of graphic hardware acceleration for a bunch of different supported cards.

In this driver, the DirectFB library gives Qemu a pointer to mapped video memory, which allows Qemu to update the display without extra copy. In the case where the guest framebuffer is not compatible with the host framebuffer, DirectFB surface blitting functions are used and can be accellerated wherever it is possible with the hardware.

DirectFB is a thin library heavily used in embedded or minimal systems which don't require X11 overhead. One use case would be to build a Xen-based client-class hypervisor, with a minimal dom0 running Qemu as device-model. The dom0 could render the domU graphical outputs on the physical screen using this patch without having X11 installed.

The other solution would be to use the DirectFB driver for SDL which would allow to do slightly the same as this patch. But that would mean having to deal with an additional layer in the graphical stack, which is not exactly what one wants from a performance or a complexity point of view.

---
 Makefile        |    4 +
 Makefile.objs   |    1 +
 configure       |   21 +++
 console.h       |    3 +
 directfb.c      |  394 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 qemu-options.hx |   10 ++
 sysemu.h        |    1 +
 vl.c            |   12 ++
 8 files changed, 446 insertions(+), 0 deletions(-)
 create mode 100644 directfb.c
Makefile +4 -0
index eb9e02b..6932c81 100644
@@ -106,6 +106,10 @@ sdl.o: sdl.c keymaps.h sdl_keysym.h sdl_zoom.h
 
 sdl.o audio/sdlaudio.o sdl_zoom.o baum.o: QEMU_CFLAGS += $(SDL_CFLAGS)
 
+directfb.o: directfb.c
+
+directfb.o: QEMU_CFLAGS += $(DIRECTFB_CFLAGS)
+
 acl.o: acl.h acl.c
 
 vnc.h: vnc-tls.h vnc-auth-vencrypt.h vnc-auth-sasl.h keymaps.h
Makefile.objs +1 -0
index ecdd53e..0904b07 100644
@@ -102,6 +102,7 @@ common-obj-y += $(addprefix audio/, $(audio-obj-y))
 common-obj-y += keymaps.o
 common-obj-$(CONFIG_SDL) += sdl.o sdl_zoom.o x_keymap.o
 common-obj-$(CONFIG_CURSES) += curses.o
+common-obj-$(CONFIG_DIRECTFB) += directfb.o
 common-obj-y += vnc.o acl.o d3des.o
 common-obj-y += vnc-encoding-zlib.o vnc-encoding-hextile.o
 common-obj-y += iov.o
configure +21 -0
index 36d028f..eb73415 100755
@@ -258,6 +258,7 @@ kvm=""
 kvm_para=""
 nptl=""
 sdl=""
+directfb="no"
 sparse="no"
 uuid=""
 vde=""
@@ -502,6 +503,10 @@ for opt do
   ;;
   --sysconfdir=*) sysconfdir="$optarg"
   ;;
+  --disable-directfb) directfb="no"
+  ;;
+  --enable-directfb) directfb="yes"
+  ;;
   --disable-sdl) sdl="no"
   ;;
   --enable-sdl) sdl="yes"
@@ -763,6 +768,8 @@ 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 "  --disable-directfb       disable DirectFB"
+echo "  --enable-directfb        enable DirectFB"
 echo "  --enable-cocoa           enable COCOA (Mac OS X only)"
 echo "  --audio-drv-list=LIST    set audio drivers list:"
 echo "                           Available drivers: $audio_possible_drivers"
@@ -1062,6 +1069,15 @@ if test "$sparse" != "no" ; then
 fi
 
 ##########################################
+# DirectFB probe
+
+if test "$directfb" = "yes" ; then
+  directfb_libs=`directfb-config --libs`
+  directfb_cflags=`directfb-config --cflags`
+  libs_softmmu="$directfb_libs $libs_softmmu"
+fi
+
+##########################################
 # SDL probe
 
 if $pkgconfig sdl --modversion >/dev/null 2>&1; then
@@ -1999,6 +2015,7 @@ if test "$darwin" = "yes" ; then
     echo "Cocoa support     $cocoa"
 fi
 echo "SDL support       $sdl"
+echo "DirectFB support  $directfb"
 echo "curses support    $curses"
 echo "curl support      $curl"
 echo "check support     $check_utests"
@@ -2169,6 +2186,10 @@ fi
 if test "$cocoa" = "yes" ; then
   echo "CONFIG_COCOA=y" >> $config_host_mak
 fi
+if test "$directfb" = "yes" ; then
+  echo "CONFIG_DIRECTFB=y" >> $config_host_mak
+  echo "DIRECTFB_CFLAGS=$directfb_cflags" >> $config_host_mak
+fi
 if test "$curses" = "yes" ; then
   echo "CONFIG_CURSES=y" >> $config_host_mak
 fi
console.h +3 -0
index 6def115..d1dd211 100644
@@ -335,6 +335,9 @@ void qemu_console_resize(DisplayState *ds, int width, int height);
 void qemu_console_copy(DisplayState *ds, int src_x, int src_y,
                        int dst_x, int dst_y, int w, int h);
 
+/* directfb.c */
+void directfb_display_init(DisplayState *ds);
+
 /* sdl.c */
 void sdl_display_init(DisplayState *ds, int full_screen, int no_frame);
 
directfb.c new file +394 -0

394 lines not on this page · raw message

qemu-options.hx +10 -0
index 12f6b51..a4bdfbe 100644
@@ -608,6 +608,16 @@ QEMU can display the VGA output when in text mode using a
 curses/ncurses interface.  Nothing is displayed in graphical mode.
 ETEXI
 
+#ifdef CONFIG_DIRECTFB
+DEF("directfb", 0, QEMU_OPTION_directfb,
+    "-directfb       enable DirectFB\n")
+#endif
+STEXI
+@item -directfb
+@findex -directfb
+Enable DirectFB.
+ETEXI
+
 #ifdef CONFIG_SDL
 DEF("no-frame", 0, QEMU_OPTION_no_frame,
     "-no-frame       open SDL window without a frame and window decorations\n",
sysemu.h +1 -0
index fa921df..a2cd5b0 100644
@@ -98,6 +98,7 @@ typedef enum DisplayType
     DT_CURSES,
     DT_SDL,
     DT_VNC,
+    DT_DIRECTFB,
     DT_NOGRAPHIC,
 } DisplayType;
 
vl.c +12 -0
index 85bcc84..e6235fa 100644
@@ -3199,6 +3199,11 @@ int main(int argc, char **argv, char **envp)
             case QEMU_OPTION_full_screen:
                 full_screen = 1;
                 break;
+#ifdef CONFIG_DIRECTFB
+            case QEMU_OPTION_directfb:
+                display_type = DT_DIRECTFB;
+                break;
+#endif
 #ifdef CONFIG_SDL
             case QEMU_OPTION_no_frame:
                 no_frame = 1;
@@ -3765,6 +3770,8 @@ int main(int argc, char **argv, char **envp)
     if (display_type == DT_DEFAULT) {
 #if defined(CONFIG_SDL) || defined(CONFIG_COCOA)
         display_type = DT_SDL;
+#elif defined(CONFIG_DIRECTFB)
+        display_type = DT_DIRECTFB;
 #else
         display_type = DT_VNC;
         vnc_display = "localhost:0,to=99";
@@ -3781,6 +3788,11 @@ int main(int argc, char **argv, char **envp)
         curses_display_init(ds, full_screen);
         break;
 #endif
+#if defined(CONFIG_DIRECTFB)
+    case DT_DIRECTFB:
+        directfb_display_init(ds);
+        break;
+#endif
 #if defined(CONFIG_SDL)
     case DT_SDL:
         sdl_display_init(ds, full_screen, no_frame);
Signature · 1 line
1.7.0
#1 lore raw
Quoted 5 lines

The other solution would be to use the DirectFB driver for SDL which would allow to do slightly the same as this patch. But that would mean having to deal with an additional layer in the graphical stack, which is not exactly what one wants from a performance or a complexity point of view.

I don't buy your complexity argument. Doesn't DirectFB-via-SDL already work? If not why not? I'm pretty sure fixing that would be way simpler than adding a whole new output backend.

Paul

#2 lore raw
Quoted 9 lines · Paul Brook
Quoted 5 lines

The other solution would be to use the DirectFB driver for SDL which would allow to do slightly the same as this patch. But that would mean having to deal with an additional layer in the graphical stack, which is not exactly what one wants from a performance or a complexity point of view.

I don't buy your complexity argument. Doesn't DirectFB-via-SDL already work? If not why not? I'm pretty sure fixing that would be way simpler than adding a whole new output backend.

Well, I can think of size as a reason. Not compiling in SDL, but directfb, would certainly shave off dependencies on a usually rather large SDL library. I also find SDL code less readable than Qemu code in general :).

That said, I don't want to take sides - just wanted to state the obvious.

Alex

#3 lore raw
In reply to Paul Brook
Quoted 10 lines · Paul Brook
Quoted 6 lines

The other solution would be to use the DirectFB driver for SDL which would allow to do slightly the same as this patch. But that would mean having to deal with an additional layer in the graphical stack, which is not exactly what one wants from a performance or a complexity point of view.

I don't buy your complexity argument. Doesn't DirectFB-via-SDL already work? If not why not? I'm pretty sure fixing that would be way simpler than adding a whole new output backend.

Yeah, I don't buy it either. I think performance data is probably the only way to justify this and I'm sceptical that if there is a performance advantage that it wouldn't be possible to just fix SDL's DirectFB support.

Regards,

Anthony Liguori

Quoted 3 lines

Paul

#4 lore raw
Quoted 12 lines · Anthony Liguori
Quoted 10 lines · Paul Brook
Quoted 6 lines

The other solution would be to use the DirectFB driver for SDL which would allow to do slightly the same as this patch. But that would mean having to deal with an additional layer in the graphical stack, which is not exactly what one wants from a performance or a complexity point of view.

I don't buy your complexity argument. Doesn't DirectFB-via-SDL already work? If not why not? I'm pretty sure fixing that would be way simpler than adding a whole new output backend.

Quoted 5 lines

Yeah, I don't buy it either. I think performance data is probably the only way to justify this and I'm sceptical that if there is a performance advantage that it wouldn't be possible to just fix SDL's DirectFB support.

I don't think wether fixing or not SDL is the debate here, the question would be more wether or not we want to add a lightweight display driver to qemu. Also, I think a DirectFB driver is fairly easy to maintain.

I will get some performance data as soon as I have some time.

By the way, sorry for the patch reposts, it seems that my smtp server had quite some trouble to relay messages last week.

Signature · 1 line
Julian
#5 lore raw
Quoted 16 lines · Julian Pidancet
Quoted 14 lines · Anthony Liguori
Quoted 12 lines · Paul Brook
Quoted 7 lines

The other solution would be to use the DirectFB driver for SDL which would allow to do slightly the same as this patch. But that would mean having to deal with an additional layer in the graphical stack, which is not exactly what one wants from a performance or a complexity point of view.

I don't buy your complexity argument. Doesn't DirectFB-via-SDL already work? If not why not? I'm pretty sure fixing that would be way simpler than adding a whole new output backend.

Quoted 8 lines
Quoted 6 lines

Yeah, I don't buy it either. I think performance data is probably the only way to justify this and I'm sceptical that if there is a performance advantage that it wouldn't be possible to just fix SDL's DirectFB support.

I don't think wether fixing or not SDL is the debate here, the question would be more wether or not we want to add a lightweight display driver to qemu. Also, I think a DirectFB driver is fairly easy to maintain.

Generally speaking, adding DirectFB doesn't seem like a net win to me. We still have to maintain SDL so now there's just more code to maintain. I'd rather there be one way of doing things that everybody focused on making work best than have two ways to do the same thing (if at all possible).

Regards,

Anthony Liguori

Quoted 5 lines

I will get some performance data as soon as I have some time.

By the way, sorry for the patch reposts, it seems that my smtp server had quite some trouble to relay messages last week.

#6 lore raw
In reply to Paul Brook
Quoted 7 lines · Paul Brook
Quoted 5 lines

The other solution would be to use the DirectFB driver for SDL which would allow to do slightly the same as this patch. But that would mean having to deal with an additional layer in the graphical stack, which is not exactly what one wants from a performance or a complexity point of view.

I don't buy your complexity argument. Doesn't DirectFB-via-SDL already work?

Run a guest. Switch to another (host) virtual terminal. Watch qemu continue drawing on the framebuffer. Doesn't count as "working" in my book.

Quoted 2 lines

If not why not? I'm pretty sure fixing that would be way simpler than adding a whole new output backend.

Didn't investigate where the bug is and how hard it would be to fix it.

cheers,
Gerd

#7 lore raw
Quoted 10 lines · Gerd Hoffmann
Quoted 7 lines · Paul Brook
Quoted 5 lines

The other solution would be to use the DirectFB driver for SDL which would allow to do slightly the same as this patch. But that would mean having to deal with an additional layer in the graphical stack, which is not exactly what one wants from a performance or a complexity point of view.

I don't buy your complexity argument. Doesn't DirectFB-via-SDL already work?

Run a guest. Switch to another (host) virtual terminal. Watch qemu continue drawing on the framebuffer. Doesn't count as "working" in my book.

A common theme with SDL seems to be that it does lots of things poorly. I wonder if we'd be better suited just dropping SDL and focusing on doing a few things well.

The fact that we have cocoa support in the tree is basically an admission of failure with SDL.

Regards,

Anthony Liguori

Quoted 9 lines
Quoted 2 lines

If not why not? I'm pretty sure fixing that would be way simpler than adding a whole new output backend.

Didn't investigate where the bug is and how hard it would be to fix it.

cheers,
Gerd

#8 lore raw
Quoted 11 lines · Anthony Liguori
Quoted 10 lines · Gerd Hoffmann
Quoted 8 lines · Paul Brook
Quoted 5 lines

The other solution would be to use the DirectFB driver for SDL which would allow to do slightly the same as this patch. But that would mean having to deal with an additional layer in the graphical stack, which is not exactly what one wants from a performance or a complexity point of view.

I don't buy your complexity argument. Doesn't DirectFB-via-SDL already work?

Quoted 6 lines
Quoted 2 lines

Run a guest. Switch to another (host) virtual terminal. Watch qemu continue drawing on the framebuffer. Doesn't count as "working" in my book.

A common theme with SDL seems to be that it does lots of things poorly. I wonder if we'd be better suited just dropping SDL and focusing on doing a few things well.

There's one thing that SDL does marvelously well - it's just one fairly small and self contained library that doesn't unleash dependency hell on the user.

Quoted 2 lines

The fact that we have cocoa support in the tree is basically an admission of failure with SDL.

I don't think so, the way i see it: someone had an itch (i.e. an application that does not integrate well with his windowing environment) and he scratched it.

Signature · 1 line
mailto:[email protected]
#9 lore raw
Quoted 11 lines · malc

There's one thing that SDL does marvelously well - it's just one fairly small and self contained library that doesn't unleash dependency hell on the user.

Quoted 3 lines

The fact that we have cocoa support in the tree is basically an admission of failure with SDL.

I don't think so, the way i see it: someone had an itch (i.e. an application that does not integrate well with his windowing environment) and he scratched it.

SDL doesn't integrate well into a modern Gnome desktop either. I don't see why we have Cocoa and not Gtk. If the answer is, someone needs to send patches, expect patches soon :-)

Regards,

Anthony Liguori

#10 lore raw
Quoted 9 lines · Anthony Liguori
Quoted 8 lines · malc

There's one thing that SDL does marvelously well - it's just one fairly small and self contained library that doesn't unleash dependency hell on the user.

Quoted 4 lines

The fact that we have cocoa support in the tree is basically an admission of
failure with SDL.

Quoted 9 lines
Quoted 4 lines

I don't think so, the way i see it: someone had an itch (i.e. an application that does not integrate well with his windowing environment) and he scratched it.

SDL doesn't integrate well into a modern Gnome desktop either. I don't see why we have Cocoa and not Gtk. If the answer is, someone needs to send patches, expect patches soon :-)

If those patches don't try to force Gnome on me (by removing SDL that is and being optional) let them come.

Signature · 1 line
mailto:[email protected]
#11 lore raw
Quoted 16 lines · malc
Quoted 14 lines · Anthony Liguori
Quoted 12 lines · malc

There's one thing that SDL does marvelously well - it's just one fairly small and self contained library that doesn't unleash dependency hell on the user.

Quoted 4 lines

The fact that we have cocoa support in the tree is basically an admission of
failure with SDL.

I don't think so, the way i see it: someone had an itch (i.e. an application that does not integrate well with his windowing environment) and he scratched it.

Quoted 7 lines
Quoted 4 lines

SDL doesn't integrate well into a modern Gnome desktop either. I don't see why we have Cocoa and not Gtk. If the answer is, someone needs to send patches, expect patches soon :-)

If those patches don't try to force Gnome on me (by removing SDL that is and being optional) let them come.

I'm trying to think of a project where the clean separation between multiple video outputs implemented in the backend and a separate frontend worked out. So far the only case that has a strikingly similar architecture coming to my mind is mplayer. And I wouldn't call mplayer's GUI story a huge success.

In fact, couldn't we rather keep all graphic output out of qemu and just expose VNC, possibly with self-made additions to the protocol to speed up local rendering (thinking an SHM extension here)? Then we could still offer a separate SDL based viewer that could do the same things it does now. But we'd also open up the gate for a whole new integration level with possible GUIs.

Alex

#12 lore raw
Quoted 24 lines · Alexander Graf
Quoted 21 lines · malc
Quoted 18 lines · Anthony Liguori
Quoted 4 lines · malc

There's one thing that SDL does marvelously well - it's just one fairly small and self contained library that doesn't unleash dependency hell on the user.

Quoted 8 lines
Quoted 4 lines

The fact that we have cocoa support in the tree is basically an admission of
failure with SDL.

I don't think so, the way i see it: someone had an itch (i.e. an application that does not integrate well with his windowing environment) and he scratched it.

SDL doesn't integrate well into a modern Gnome desktop either. I don't see why we have Cocoa and not Gtk. If the answer is, someone needs to send patches, expect patches soon :-)

Quoted 8 lines
Quoted 2 lines

If those patches don't try to force Gnome on me (by removing SDL that is and being optional) let them come.

I'm trying to think of a project where the clean separation between multiple video outputs implemented in the backend and a separate frontend worked out. So far the only case that has a strikingly similar architecture coming to my mind is mplayer. And I wouldn't call mplayer's GUI story a huge success.

Xine, VLC do have something resembling this separation too. As for mplayer's GUI, never used it, what i did (and still) use is my own video output device for mplayer, which is a lot faster than Xv, or anything else for that matter, on my hardware.

Quoted 8 lines

In fact, couldn't we rather keep all graphic output out of qemu and just expose VNC, possibly with self-made additions to the protocol to speed up local rendering (thinking an SHM extension here)? Then we could still offer a separate SDL based viewer that could do the same things it does now. But we'd also open up the gate for a whole new integration level with possible GUIs.

This idea is not new, nothing has come out of it till this day, so the answer to your question (couldn't we...) is probably: no, we couldn't.

Signature · 1 line
mailto:[email protected]
#13 lore raw
Quoted 11 lines · malc
Quoted 8 lines

In fact, couldn't we rather keep all graphic output out of qemu and just expose VNC, possibly with self-made additions to the protocol to speed up local rendering (thinking an SHM extension here)? Then we could still offer a separate SDL based viewer that could do the same things it does now. But we'd also open up the gate for a whole new integration level with possible GUIs.

This idea is not new, nothing has come out of it till this day, so the answer to your question (couldn't we...) is probably: no, we couldn't.

Because shared memory is just a graphics optimization and for most users, the difference between gtk-vnc and native SDL isn't noticable. So if a shared memory transport was the key missing piece, we'd have an awesome GUI based on gtk-vnc that just had slower graphics.

IMHO, the problem with an external GUI is that the interaction just gets too complicated.

Regards,

Anthony Liguori

#14 lore raw
Quoted 9 lines · Anthony Liguori
Quoted 8 lines · malc
Quoted 8 lines

In fact, couldn't we rather keep all graphic output out of qemu and just expose VNC, possibly with self-made additions to the protocol to speed up local rendering (thinking an SHM extension here)? Then we could still offer a separate SDL based viewer that could do the same things it does now. But we'd also open up the gate for a whole new integration level with possible GUIs.

Quoted 5 lines
Quoted 3 lines

This idea is not new, nothing has come out of it till this day, so the answer to your question (couldn't we...) is probably: no, we couldn't.

Because shared memory is just a graphics optimization and for most users, the difference between gtk-vnc and native SDL isn't noticable. So if a shared memory transport was the key missing piece, we'd have an awesome GUI based on gtk-vnc that just had slower graphics.

Well, there's also the missing QMP part :)

Quoted 1 line

IMHO, the problem with an external GUI is that the interaction just gets too complicated.

What interaction do you mean? I'm not advocating to move the GUI to a different project. I was more thinking of a separation like with perf where the kernel side does the recording and the userspace side does the displaying of profiling results. Qemu would run the VM and the tightly coupled viewer app would show it.

If you like, we could even move the backend qemu to "qemu-backend" and have the normally invoked binaries be the GUI application that just runs the respective qemu-backend application. That way it'd be 100% seamless for the average user, but qemu -demonize becomes really powerful.

Alex

#15 lore raw
Quoted 4 lines · Alexander Graf
Quoted 2 lines

IMHO, the problem with an external GUI is that the interaction just gets too complicated.

What interaction do you mean? I'm not advocating to move the GUI to a different project. I was more thinking of a separation like with perf where the kernel side does the recording and the userspace side does the displaying of profiling results. Qemu would run the VM and the tightly coupled viewer app would show it.

If it's the same project, why go through the extra work of plumbing everything through an RPC interface? I'm suggesting that we want to make writing a good GUI as easy as possible and IMHO that means not putting up an artificial constraint like everything needs to be done through RPC.

But we're putting the cart before the horse. Let's save this argument until we have some patches :-)

Regards,

Anthony Liguori

Quoted 6 lines

If you like, we could even move the backend qemu to "qemu-backend" and have the normally invoked binaries be the GUI application that just runs the respective qemu-backend application. That way it'd be 100% seamless for the average user, but qemu -demonize becomes really powerful.

Alex

#16 lore raw
In reply to Alexander Graf
Quoted 3 lines · Alexander Graf

I'm trying to think of a project where the clean separation between multiple video outputs implemented in the backend and a separate frontend worked out. So far the only case that has a strikingly similar architecture coming to my mind is mplayer. And I wouldn't call mplayer's GUI story a huge success.

In fact, couldn't we rather keep all graphic output out of qemu and just expose VNC, possibly with self-made additions to the protocol to speed up local rendering (thinking an SHM extension here)?

I think the whole reason this has failed is that if the GUI is a separate project, the path of least resistance is to use existing interfaces instead of inventing new ones. That means these GUIs tend to be restricted by whatever management interface exists which isn't actually good enough.

You really need to have the GUI as part of the main project such that when it needs a new interface, it can be added very easily.

Quoted 2 lines

Then we could still offer a separate SDL based viewer that could do the same things it does now. But we'd also open up the gate for a whole new integration level with possible GUIs.

You could, but I think it introduces more complexity which just is going to get in the way of building a good GUI.

Regards,

Anthony Liguori

Quoted 3 lines

Alex

#17 lore raw
Quoted 8 lines · Anthony Liguori
Quoted 3 lines · Alexander Graf

I'm trying to think of a project where the clean separation between multiple video outputs implemented in the backend and a separate frontend worked out. So far the only case that has a strikingly similar architecture coming to my mind is mplayer. And I wouldn't call mplayer's GUI story a huge success.

In fact, couldn't we rather keep all graphic output out of qemu and just expose VNC, possibly with self-made additions to the protocol to speed up local rendering (thinking an SHM extension here)?

I think the whole reason this has failed is that if the GUI is a separate project, the path of least resistance is to use existing interfaces instead of inventing new ones. That means these GUIs tend to be restricted by whatever management interface exists which isn't actually good enough.

You really need to have the GUI as part of the main project such that when it needs a new interface, it can be added very easily.

I agree on that part.

Quoted 5 lines
Quoted 3 lines

Then we could still offer a separate SDL based viewer that could do the same things it does now. But we'd also open up the gate for a whole new integration level with possible GUIs.

You could, but I think it introduces more complexity which just is going to get in the way of building a good GUI.

The main benefit I see by taking an always-vnc approach would be that everything becomes 100% networkable. There's nothing getting in your way because you're doing things on a remote machine. And you even get the same look&feel you got from the local connection because it's the same tool connecting you.

But yeah, maybe it does add too much complexity. I don't know.

Alex

#18 lore raw
Quoted 7 lines · Alexander Graf
Quoted 5 lines
Quoted 3 lines

Then we could still offer a separate SDL based viewer that could do the same things it does now. But we'd also open up the gate for a whole new integration level with possible GUIs.

You could, but I think it introduces more complexity which just is going to get in the way of building a good GUI.

The main benefit I see by taking an always-vnc approach would be that everything becomes 100% networkable. There's nothing getting in your way because you're doing things on a remote machine. And you even get the same look&feel you got from the local connection because it's the same tool connecting you.

My current thinking with GUIs is that network transparency is more trouble than it's worth.

The problem is, simple things end up being overly complicated. You can't just pop up a file dialog box to select a new CD-ROM ISO because you can't browse files on a remote machine. Instead, you need to have something like a "pool" concept or something like that.

Regards,

Anthony Liguori

Quoted 6 lines

But yeah, maybe it does add too much complexity. I don't know.

Alex

#19 lore raw
Quoted 4 lines · Anthony Liguori
Quoted 3 lines · Alexander Graf
Quoted 3 lines
Quoted 3 lines

Then we could still offer a separate SDL based viewer that could do the same things it does now. But we'd also open up the gate for a whole new integration level with possible GUIs.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

You could, but I think it introduces more complexity which just is going to get in the way of building a good GUI.

The main benefit I see by taking an always-vnc approach would be that everything becomes 100% networkable. There's nothing getting in your way because you're doing things on a remote machine. And you even get the same look&feel you got from the local connection because it's the same tool connecting you.

My current thinking with GUIs is that network transparency is more trouble than it's worth.

The problem is, simple things end up being overly complicated. You can't just pop up a file dialog box to select a new CD-ROM ISO because you can't browse files on a remote machine. Instead, you need to have something like a "pool" concept or something like that.

Yeah - VMware solved that by showing you a dialog with the remote file system. Pretty ugly. Another solution to that would be to only enable the dialog box when target == localhost.

As soon as we look at server workloads, we do need to have network transparency. But I guess most of this talk is moot anyways, since we have VNC now. So if there is someone willing to take up on a GUI, he can just do so the same as he could with a unified backend.

Alex

#20 lore raw

[Qemu-devel] qemu usage

In reply to Anthony Liguori

Hi

I am able to boot my custom kernel off of bare hardware, but when I try to boot this with qemu it hangs after first two lines of print about BIOS. i tried booting through qemu image and also via '-kernel' arg. same result in both cases. i verified that with same qeumu-system-x86_64 i could boot ubuntu kernel/initrd in qemu image and also with -kernel arg but not my kernel.

i'm using pc-bios dir as is with all its subdirs and using it as "-L path_to_pc-bios". can someone help me understand what could be going on.

appreciate your help.
kd

________________________________
From: Anthony Liguori <[email protected]>
To: Alexander Graf <[email protected]>
Cc: [email protected]; Paul Brook <[email protected]>; Julian Pidancet <[email protected]>; Gerd Hoffmann <[email protected]>
Sent: Mon, May 17, 2010 3:46:14 PM
Subject: Re: [Qemu-devel] [PATCH] Add QEMU DirectFB display driver

Quoted 3 lines · Alexander Graf

I'm trying to think of a project where the clean separation between multiple video outputs implemented in the backend and a separate frontend worked out. So far the only case that has a strikingly similar architecture coming to my mind is mplayer. And I wouldn't call mplayer's GUI story a huge success.

In fact, couldn't we rather keep all graphic output out of qemu and just expose VNC, possibly with self-made additions to the protocol to speed up local rendering (thinking an SHM extension here)?

I think the whole reason this has failed is that if the GUI is a separate project, the path of least resistance is to use existing interfaces instead of inventing new ones. That means these GUIs tend to be restricted by whatever management interface exists which isn't actually good enough.

You really need to have the GUI as part of the main project such that when it needs a new interface, it can be added very easily.

Quoted 2 lines

Then we could still offer a separate SDL based viewer that could do the same things it does now. But we'd also open up the gate for a whole new integration level with possible GUIs.

You could, but I think it introduces more complexity which just is going to get in the way of building a good GUI.

Regards,

Anthony Liguori

Quoted 3 lines

Alex

#21 lore raw
In reply to Anthony Liguori

Am 17.05.2010 23:43, schrieb Anthony Liguori:

Quoted 8 lines · malc
Quoted 7 lines

There's one thing that SDL does marvelously well - it's just one fairly small and self contained library that doesn't unleash dependency hell on the user.

Quoted 3 lines

The fact that we have cocoa support in the tree is basically an admission of failure with SDL.

Quoted 8 lines
Quoted 4 lines

I don't think so, the way i see it: someone had an itch (i.e. an application that does not integrate well with his windowing environment) and he scratched it.

SDL doesn't integrate well into a modern Gnome desktop either. I don't see why we have Cocoa and not Gtk. If the answer is, someone needs to send patches, expect patches soon :-)

So with this argument, we'll not only get a GTK backend, but Qt and Windows backends, too? But then you can't reasonably say any more that DirectFB would be too much additional code to maintain.

Kevin

#22 lore raw
Quoted 14 lines · Kevin Wolf

Am 17.05.2010 23:43, schrieb Anthony Liguori:

Quoted 13 lines · malc
Quoted 11 lines

There's one thing that SDL does marvelously well - it's just one fairly small and self contained library that doesn't unleash dependency hell on the user.

Quoted 3 lines

The fact that we have cocoa support in the tree is basically an admission of failure with SDL.

I don't think so, the way i see it: someone had an itch (i.e. an application that does not integrate well with his windowing environment) and he scratched it.

Quoted 7 lines
Quoted 3 lines

SDL doesn't integrate well into a modern Gnome desktop either. I don't see why we have Cocoa and not Gtk. If the answer is, someone needs to send patches, expect patches soon :-)

So with this argument, we'll not only get a GTK backend, but Qt and Windows backends, too? But then you can't reasonably say any more that DirectFB would be too much additional code to maintain.

My personal opinion is that SDL does a decent job at rendering a window in a X11 environment, but given the current SDL limitation with directfb, we need another output mechanism to cover that case, so that we can have multiple guests fullscreen on different host virtual terminals. This is an important use case for embedded environments.

I don't think GTK or Qt would add much to what SDL already offers, unless we want to develop our own management GUI for qemu, but I don't think is a very good idea.
I think it would be better to implement an accelerated frontend for rendering the framebuffer, like opengl or xv.

#23 lore raw
Quoted 2 lines · Stefano Stabellini

I think it would be better to implement an accelerated frontend for rendering the framebuffer, like opengl or xv.

Well. xv is pretty pointless IMHO. gl makes sense. But to have some effect this needs some major restructions in qemu, the current DisplayState infrastructure can't handle anything but a simple, stupid framebuffer. There isn't much to accelerate, except maybe scaling the guest display to fullscreen on the host.

qxl + spice will change that though. qxl is a paravirtualized gfx adapter. Guest sends rendering commands. The spice protocol sends the rendering commands over the wire to the spice client, which in turn will render them (and can use gl to accelerate that).

cheers,
Gerd

#24 lore raw
Quoted 10 lines · Gerd Hoffmann
Quoted 2 lines · Stefano Stabellini

I think it would be better to implement an accelerated frontend for rendering the framebuffer, like opengl or xv.

Well. xv is pretty pointless IMHO. gl makes sense. But to have some effect this needs some major restructions in qemu, the current DisplayState infrastructure can't handle anything but a simple, stupid framebuffer. There isn't much to accelerate, except maybe scaling the guest display to fullscreen on the host.

Quoted 4 lines

qxl + spice will change that though. qxl is a paravirtualized gfx
adapter. Guest sends rendering commands. The spice protocol sends the
rendering commands over the wire to the spice client, which in turn will render them (and can use gl to accelerate that).

Is the spice client going to live in qemu, or is it going to be separate?

#25 lore raw
Quoted 11 lines · Stefano Stabellini
Quoted 10 lines · Gerd Hoffmann
Quoted 2 lines · Stefano Stabellini

I think it would be better to implement an accelerated frontend for rendering the framebuffer, like opengl or xv.

Well. xv is pretty pointless IMHO. gl makes sense. But to have some effect this needs some major restructions in qemu, the current DisplayState infrastructure can't handle anything but a simple, stupid framebuffer. There isn't much to accelerate, except maybe scaling the guest display to fullscreen on the host.

Quoted 7 lines
Quoted 4 lines

qxl + spice will change that though. qxl is a paravirtualized gfx
adapter. Guest sends rendering commands. The spice protocol sends the
rendering commands over the wire to the spice client, which in turn will render them (and can use gl to accelerate that).

Is the spice client going to live in qemu, or is it going to be separate?

Separate.

project website: http://www.spice-space.org/
spice bits: http://cgit.freedesktop.org/~kraxel/spice/log/?h=api.v6
qemu patches: http://cgit.freedesktop.org/spice/qemu/log/?h=spice.v6.0

cheers,
Gerd

#26 lore raw
Quoted 17 lines · Gerd Hoffmann
Quoted 16 lines · Stefano Stabellini
Quoted 14 lines · Gerd Hoffmann
Quoted 2 lines · Stefano Stabellini

I think it would be better to implement an accelerated frontend for rendering the framebuffer, like opengl or xv.

Well. xv is pretty pointless IMHO. gl makes sense. But to have some effect this needs some major restructions in qemu, the current DisplayState infrastructure can't handle anything but a simple, stupid framebuffer. There isn't much to accelerate, except maybe scaling the guest display to fullscreen on the host.

qxl + spice will change that though. qxl is a paravirtualized gfx
adapter. Guest sends rendering commands. The spice protocol sends the
rendering commands over the wire to the spice client, which in turn will render them (and can use gl to accelerate that).

Quoted 8 lines
Quoted 2 lines

Is the spice client going to live in qemu, or is it going to be separate?

Separate.

project website: http://www.spice-space.org/
spice bits: http://cgit.freedesktop.org/~kraxel/spice/log/?h=api.v6
qemu patches: http://cgit.freedesktop.org/spice/qemu/log/?h=spice.v6.0

Then I guess we don't actually need any accelerated rendering in qemu, even though it might still be nice for avoiding a memcpy.

I am curious about one thing: if the spice client is running on the same host as the VM and qemu, is there any plan for sharing memory somehow between the two components? OR is it not believed to be necessary to reach good performances?

#27 lore raw
Quoted 4 lines · Stefano Stabellini

I am curious about one thing: if the spice client is running on the same host as the VM and qemu, is there any plan for sharing memory somehow between the two components? OR is it not believed to be necessary to reach good performances?

Well. We don't have shm for vnc. And I think the reason simply is that it feels fast enougth even without shm. Spice tries to reduce the network bandwith needed with image caching, so with spice the gains by using shm should be even smaller than with vnc.

I'm not aware of anyone trying + benchmark it, but I don't expect major gains.

cheers,
Gerd

#28 lore raw
In reply to Kevin Wolf
Quoted 18 lines · Kevin Wolf

Am 17.05.2010 23:43, schrieb Anthony Liguori:

Quoted 16 lines · malc
Quoted 15 lines

There's one thing that SDL does marvelously well - it's just one fairly small and self contained library that doesn't unleash dependency hell on the user.

Quoted 4 lines

The fact that we have cocoa support in the tree is basically an admission of failure with SDL.

I don't think so, the way i see it: someone had an itch (i.e. an application that does not integrate well with his windowing environment) and he scratched it.

Quoted 8 lines
Quoted 4 lines

SDL doesn't integrate well into a modern Gnome desktop either. I don't see why we have Cocoa and not Gtk. If the answer is, someone needs to send patches, expect patches soon :-)

So with this argument, we'll not only get a GTK backend, but Qt and Windows backends, too? But then you can't reasonably say any more that DirectFB would be too much additional code to maintain.

Yes, that's the point. Instead of having a single backend (SDL) and expecting SDL to do everything for us, we would support multiple backends (like DirectFB).

Regards,

Anthony Liguori

Quoted 2 lines

Kevin

#29 lore raw
In reply to Julian Pidancet
Quoted 3 lines · Julian Pidancet

This patch implements a DirectFB driver for QEMU. It allows Qemu to draw a VM graphic output directly in the framebuffer of the host, without having to rely on X11.

Managed to build it after hacking configure to use pkgconfig. Patch attached for reference.

Same bug as SDL on framebuffer: No sane console switching. Boot a guest, switch to another (host) virtual terminal, watch qemu continue drawing on your screen.

Guys, this is simply not acceptable. You are not alone on the machine.
If I switch away to another virtual terminal I want to see that other
terminals content and nothing else.

NACK.

cheers,
Gerd

Quoted 1 line

From 50f26301ba1f8a0588fcafc54b05fe508e084696 Mon Sep 17 00:00:00 2001

From: Gerd Hoffmann <[email protected]>
Date: Mon, 17 May 2010 13:54:59 +0200
Subject: [PATCH] fixups

---
 configure       |   18 +++++++++++++-----
 qemu-options.hx |    3 ++-
 2 files changed, 15 insertions(+), 6 deletions(-)
configure +13 -5
index b453e85..de4bf8f 100755
@@ -258,7 +258,7 @@ kvm=""
 kvm_para=""
 nptl=""
 sdl=""
-directfb="no"
+directfb=""
 sparse="no"
 uuid=""
 vde=""
@@ -1071,10 +1071,18 @@ fi
 ##########################################
 # DirectFB probe
 
-if test "$directfb" = "yes" ; then
-  directfb_libs=`directfb-config --libs`
-  directfb_cflags=`directfb-config --cflags`
-  libs_softmmu="$directfb_libs $libs_softmmu"
+if test "$directfb" != "no" ; then
+  if $pkgconfig directfb; then
+    directfb_libs=$($pkgconfig directfb --libs)
+    directfb_cflags=$($pkgconfig directfb --cflags)
+    libs_softmmu="$directfb_libs $libs_softmmu"
+    directfb=yes
+  else
+    if test "$directfb" = "yes" ; then
+      feature_not_found "directfb"
+    fi
+    directfb=no
+  fi
 fi
 
 ##########################################
qemu-options.hx +2 -1
index a4bdfbe..9597a48 100644
@@ -610,7 +610,8 @@ ETEXI
 
 #ifdef CONFIG_DIRECTFB
 DEF("directfb", 0, QEMU_OPTION_directfb,
-    "-directfb       enable DirectFB\n")
+    "-directfb       enable DirectFB\n",
+    QEMU_ARCH_ALL)
 #endif
 STEXI
 @item -directfb
Signature · 1 line
1.6.6.1
#30 lore raw
Quoted 12 lines · Gerd Hoffmann
Quoted 3 lines · Julian Pidancet

This patch implements a DirectFB driver for QEMU. It allows Qemu to draw a VM graphic output directly in the framebuffer of the host, without having to rely on X11.

Managed to build it after hacking configure to use pkgconfig. Patch attached for reference.

Same bug as SDL on framebuffer: No sane console switching. Boot a guest, switch to another (host) virtual terminal, watch qemu continue drawing on your screen.

Quoted 5 lines

Guys, this is simply not acceptable. You are not alone on the machine.
If I switch away to another virtual terminal I want to see that other
terminals content and nothing else.

NACK.

I completely agree with you.

I think the only way to fix this is to handle VT acquire and release events ourselves.
At this point I am not sure if it is worth doing it in the DirectFB frontend or in the SDL frontend directly (making sure we are not running on X11 first).

#31 lore raw

Hi,

Quoted 2 lines

I think the only way to fix this is to handle VT acquire and release events ourselves.

Hmm. I suspect sdl and directfb wanna do this too, so I'm not sure this will actually work out.

Quoted 3 lines

At this point I am not sure if it is worth doing it in the DirectFB frontend or in the SDL frontend directly (making sure we are not running on X11 first).

I didn't investigate who is at fault here. SDL docs doesn't mention console switching at all it seems (grep -i console in /usr/share/doc/SDL-devel-1.2.13/html doesn't find me anything). Which makes me assume no special actions by the app using SDL are required for it. Which in turn makes me think SDL is broken.

Which makes me think we should just go the direct route. No SDL. No directfb. No other funky library which provides us with nothing but bugs. Programming fbdev isn't that hard after all. Especially if you skip all the (IMHO pointless) video mode switching bits.

cheers,
Gerd

#32 lore raw
Quoted 18 lines · Gerd Hoffmann
   Hi,
Quoted 2 lines

I think the only way to fix this is to handle VT acquire and release events ourselves.

Hmm. I suspect sdl and directfb wanna do this too, so I'm not sure this will actually work out.

Quoted 3 lines

At this point I am not sure if it is worth doing it in the DirectFB frontend or in the SDL frontend directly (making sure we are not running on X11 first).

I didn't investigate who is at fault here. SDL docs doesn't mention console switching at all it seems (grep -i console in /usr/share/doc/SDL-devel-1.2.13/html doesn't find me anything). Which makes me assume no special actions by the app using SDL are required for it. Which in turn makes me think SDL is broken.

Quoted 4 lines

Which makes me think we should just go the direct route. No SDL. No directfb. No other funky library which provides us with nothing but bugs. Programming fbdev isn't that hard after all. Especially if you skip all the (IMHO pointless) video mode switching bits.

Agreed, actually I was thinking the same thing.
The only reason for using a library is to have the color/pixel conversion functions, that could be useful. However we have many of them already implemented in qemu so it shouldn't be difficult to roll our own.

Julian, what do you think?

#33 lore raw

Hi,

Quoted 9 lines
Quoted 4 lines

Which makes me think we should just go the direct route. No SDL. No directfb. No other funky library which provides us with nothing but bugs. Programming fbdev isn't that hard after all. Especially if you skip all the (IMHO pointless) video mode switching bits.

Agreed, actually I was thinking the same thing.
The only reason for using a library is to have the color/pixel conversion functions, that could be useful. However we have many of them already implemented in qemu so it shouldn't be difficult to roll our own.

Everybody implements its own conversion functions though. It probably makes sense to consolidate that stuff into a small conversion library, probably best based on PixelFormat, and make everybody use that.

cheers,
Gerd

#34 lore raw
Quoted 7 lines · Gerd Hoffmann
   Hi,
Quoted 5 lines
Quoted 4 lines

Which makes me think we should just go the direct route. No SDL. No directfb. No other funky library which provides us with nothing but bugs. Programming fbdev isn't that hard after all. Especially if you skip all the (IMHO pointless) video mode switching bits.

Quoted 9 lines
Quoted 4 lines

Agreed, actually I was thinking the same thing.
The only reason for using a library is to have the color/pixel conversion functions, that could be useful. However we have many of them already implemented in qemu so it shouldn't be difficult to roll our own.

Everybody implements its own conversion functions though. It probably makes sense to consolidate that stuff into a small conversion library, probably best based on PixelFormat, and make everybody use that.

Yeah definitely

#35 lore raw
In reply to Stefano Stabellini
Quoted 24 lines · Stefano Stabellini
Quoted 18 lines · Gerd Hoffmann
   Hi,
Quoted 2 lines

I think the only way to fix this is to handle VT acquire and release events ourselves.

Hmm. I suspect sdl and directfb wanna do this too, so I'm not sure this will actually work out.

Quoted 3 lines

At this point I am not sure if it is worth doing it in the DirectFB frontend or in the SDL frontend directly (making sure we are not running on X11 first).

I didn't investigate who is at fault here. SDL docs doesn't mention console switching at all it seems (grep -i console in /usr/share/doc/SDL-devel-1.2.13/html doesn't find me anything). Which makes me assume no special actions by the app using SDL are required for it. Which in turn makes me think SDL is broken.

Quoted 4 lines

Which makes me think we should just go the direct route. No SDL. No directfb. No other funky library which provides us with nothing but bugs. Programming fbdev isn't that hard after all. Especially if you skip all the (IMHO pointless) video mode switching bits.

Quoted 7 lines

Agreed, actually I was thinking the same thing.
The only reason for using a library is to have the color/pixel conversion functions, that could be useful. However we have many of them already implemented in qemu so it shouldn't be difficult to roll our own.

Julian, what do you think?

It also appears to me to be the good way to do this thing.

Gerd, it is true that the DirectFB suffers the same problem as the SDL driver regarding the VT switching. Actually I investigated the issue yesterday, and I found out that:
1) even though there is some VT handling in DirectFB, it is incomplete (I found "to be finished" mentions in the TODO file).
2) When we switch to another VT, Qemu continues to draw on the screen using the pointer acquired from DirectFB. There's no hooks we can set in DirectFB's VT code for Qemu to be notified when we change VT, in order to stop drawing.

So, even though DirectFB claims to handle multiple VTs, I agree that it currently sucks.

So after all, why not implementing our own VT switching and using directly the fbdev interface. I just checked the linux fbdev code to find out if it provides with a blitting method that could perform the pixel color conversion automatically for Qemu.

Unfortunately, from what I have read from the drivers/video/cfbimgblt.c file in the linux tree, there's no such thing, and it also means that we cannot take advantage of any kind of hardware pixel format conversion.

But anyway, I don't think software color conversion would be a problem, because it already exists in several places in Qemu.

Signature · 1 line
Julian
#36 lore raw
Quoted 2 lines · Julian Pidancet

So after all, why not implementing our own VT switching and using directly the fbdev interface.

It's a good idea. VT switching isn't hard to track reliably.

Being able to tell qemu, through the monitor, to attach/detach from a particular VT might be a nice easy bonus too.

Quoted 8 lines

I just checked the linux fbdev code to
find out if it provides with a blitting method that could perform the pixel color conversion automatically for Qemu.

Unfortunately, from what I have read from the drivers/video/cfbimgblt.c file in the linux tree, there's no such thing, and it also means that we cannot take advantage of any kind of hardware pixel format conversion.

I'm not sure if DirectFB provides that particular operation, but I have the impression it's the sort of thing DirectFB is intended for: A framebuffer, plus a variety of 2d acceleration methods (and other things like multi-buffering, video and alpha channel overlay).

-- Jamie

#37 lore raw
Quoted 5 lines · Jamie Lokier
Quoted 2 lines · Julian Pidancet

So after all, why not implementing our own VT switching and using directly the fbdev interface.

It's a good idea. VT switching isn't hard to track reliably.

Indeed, only problem is that the fbdev libs usually want to do that too.

Quoted 2 lines

Being able to tell qemu, through the monitor, to attach/detach from a particular VT might be a nice easy bonus too.

Yes, should be doable without too much effort.

Quoted 9 lines
Quoted 8 lines

I just checked the linux fbdev code to
find out if it provides with a blitting method that could perform the pixel color conversion automatically for Qemu.

Unfortunately, from what I have read from the drivers/video/cfbimgblt.c file in the linux tree, there's no such thing, and it also means that we cannot take advantage of any kind of hardware pixel format conversion.

Quoted 4 lines

I'm not sure if DirectFB provides that particular operation, but I have the impression it's the sort of thing DirectFB is intended for: A framebuffer, plus a variety of 2d acceleration methods (and other things like multi-buffering, video and alpha channel overlay).

As far I know acceleration depends on the directfb kernel drivers though, i.e. in 99% of the cases (standard distro installs) those are not available and software fallbacks are active anyway. So from a performance point of view directfb doesn't buy us much. And for the pixel conversion I'd prefer see some reorganization of the existing qemu code which is spread all over the place now ...

cheers,
Gerd