Skip to contentSkip to conversation

run vnc without sdl

PATCH In review Glauber Costa 3 participants 4 messages May 21, 2009 – May 24, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 run vnc without sdl

commit f92f8afebe038a4eae9ad90a140c9529f94919a6
"Eliminate --disable-gfx-check and make VNC default when SDL not available" broke usage of vnc. Passing -vnc <something> now fails because it cannot initialize SDL.

---
 vl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
vl.c +1 -1
index e3cba75..74ad688 100644
@@ -5977,7 +5977,7 @@ int main(int argc, char **argv, char **envp)
         } else
 #endif
 #if defined(CONFIG_SDL) || defined(CONFIG_COCOA)
-        if (sdl) {
+        if (sdl && !vnc_display) {
 #if defined(CONFIG_SDL)
             sdl_display_init(ds, full_screen, no_frame);
 #elif defined(CONFIG_COCOA)
Signature · 1 line
1.5.6.6
#1 lore raw
Quoted 7 lines · Glauber Costa

commit f92f8afebe038a4eae9ad90a140c9529f94919a6
"Eliminate --disable-gfx-check and make VNC default when SDL not available" broke usage of vnc. Passing -vnc <something> now fails because it cannot initialize SDL.

What do you think about the attached? My goal with the original refactoring was to more cleanly separate things that's why I didn't want to introduce the !vnc_display.

Ideally, we could make the various display states register themselves and completely eliminate the #ifdefs...

Signature · 3 lines
Regards,

Anthony Liguori

commit e83ee25a46da8f612692337ce4a8207661163d09

Author: Anthony Liguori <[email protected]>
Date:   Thu May 21 16:54:00 2009 -0500

Refactor how display drivers are selected

My previous commit, f92f8afebe, broke -vnc (spotted by Glauber Costa). This is because it's necessary to tell when the no special display parameters have been passed and default to SDL or VNC appropriately.

This refactors the display selection logic to be less complicated which has the effect of fixing the regression mentioned above.

hw/fw_cfg.c +1 -1
index 39bd955..e605cda 100644
@@ -277,7 +277,7 @@ void *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
     }
     fw_cfg_add_bytes(s, FW_CFG_SIGNATURE, (uint8_t *)"QEMU", 4);
     fw_cfg_add_bytes(s, FW_CFG_UUID, qemu_uuid, 16);
-    fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)nographic);
+    fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)(display_type == DT_NOGRAPHIC));
     fw_cfg_add_i16(s, FW_CFG_NB_CPUS, (uint16_t)smp_cpus);
 
     register_savevm("fw_cfg", -1, 1, fw_cfg_save, fw_cfg_load, s);
qemu-char.c +3 -3
index 664cbfd..1c0c9f5 100644
@@ -571,7 +571,7 @@ static void fd_chr_update_read_handler(CharDriverState *chr)
     FDCharDriver *s = chr->opaque;
 
     if (s->fd_in >= 0) {
-        if (nographic && s->fd_in == 0) {
+        if (display_type == DT_NOGRAPHIC && s->fd_in == 0) {
         } else {
             qemu_set_fd_handler2(s->fd_in, fd_chr_read_poll,
                                  fd_chr_read, NULL, chr);
@@ -584,7 +584,7 @@ static void fd_chr_close(struct CharDriverState *chr)
     FDCharDriver *s = chr->opaque;
 
     if (s->fd_in >= 0) {
-        if (nographic && s->fd_in == 0) {
+        if (display_type == DT_NOGRAPHIC && s->fd_in == 0) {
         } else {
             qemu_set_fd_handler2(s->fd_in, NULL, NULL, NULL, NULL);
         }
@@ -714,7 +714,7 @@ static void term_init(void)
     tty.c_oflag |= OPOST;
     tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);
     /* if graphical mode, we allow Ctrl-C handling */
-    if (nographic)
+    if (display_type == DT_NOGRAPHIC)
         tty.c_lflag &= ~ISIG;
     tty.c_cflag &= ~(CSIZE|PARENB);
     tty.c_cflag |= CS8;
sysemu.h +10 -1
index 7d65804..4063533 100644
@@ -86,6 +86,15 @@ int tap_win32_init(VLANState *vlan, const char *model,
 /* SLIRP */
 void do_info_slirp(Monitor *mon);
 
+typedef enum DisplayType
+{
+    DT_DEFAULT,
+    DT_CURSES,
+    DT_SDL,
+    DT_VNC,
+    DT_NOGRAPHIC,
+} DisplayType;
+
 extern int bios_size;
 extern int cirrus_vga_enabled;
 extern int std_vga_enabled;
@@ -94,7 +103,7 @@ extern int xenfb_enabled;
 extern int graphic_width;
 extern int graphic_height;
 extern int graphic_depth;
-extern int nographic;
+extern DisplayType display_type;
 extern const char *keyboard_layout;
 extern int win2k_install_hack;
 extern int rtc_td_hack;
vl.c +41 -41

146 lines not on this page · raw message

#2 lore raw
Quoted 9 lines · Anthony Liguori
Quoted 7 lines · Glauber Costa

commit f92f8afebe038a4eae9ad90a140c9529f94919a6
"Eliminate --disable-gfx-check and make VNC default when SDL not available" broke usage of vnc. Passing -vnc <something> now fails because it cannot initialize SDL.

Quoted 6 lines

What do you think about the attached? My goal with the original refactoring was to more cleanly separate things that's why I didn't want to introduce the !vnc_display.

Ideally, we could make the various display states register themselves and completely eliminate the #ifdefs...

works for me.

#3 lore raw
In reply to Anthony Liguori
Quoted 6 lines · Anthony Liguori
Quoted 5 lines · Glauber Costa

commit f92f8afebe038a4eae9ad90a140c9529f94919a6
"Eliminate --disable-gfx-check and make VNC default when SDL not available" broke usage of vnc. Passing -vnc <something> now fails because it cannot initialize SDL.

Quoted 7 lines
Quoted 2 lines

What do you think about the attached? My goal with the original refactoring was to more cleanly separate things that's why I didn't want to introduce the !vnc_display.

Ideally, we could make the various display states register themselves and completely eliminate the #ifdefs...

IMO we should not mix bug fixes with refactoring. Ideally Glauber's fix should have been committed followed by this patch. If the refactoring introduces a new regression, we can then safely revert it.

Signature · 1 line
error compiling committee.c: too many arguments to function