Skip to contentSkip to conversation

qemu vnc.c

Qemu-devel Andrzej Zaborowski 3 participants 8 messages Jan 13, 2008 – Jan 16, 2008

lore
Share & tools
lore
#1 lore raw
Quoted 5 lines · Andrzej Zaborowski

Log message:
Reduce redundant timer ticks in VNC, by Anders Melchiorsen.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/vnc.c?cvsroot=qemu&r1=1.31&r2=1.32

That is great, thanks. However, I have found a small error in the original patch. An additional vga_hw_update() is needed when accepting the VNC connection.

Without this fix, resolution changes are not caught while no client is connected, and the display can be clipped when reconnecting.

I am also resending my patch for disabling VGA refresh with -nographic

Cheers,
Anders.

vnc.c +3 -0
index b5921a3..64889de 100644
@@ -1904,6 +1904,9 @@ static void vnc_listen_read(void *opaque)
     struct sockaddr_in addr;
     socklen_t addrlen = sizeof(addr);
 
+    /* Catch-up */
+    vga_hw_update();
+
     vs->csock = accept(vs->lsock, (struct sockaddr *)&addr, &addrlen);
     if (vs->csock != -1) {
 	VNC_DEBUG("New client on socket %d\n", vs->csock);
qemu/vl.c +1 -8
index 30c9537..8d67314 100644
@@ -4902,13 +4902,6 @@ static void dumb_resize(DisplayState *ds, int w, int h)
 {
 }
 
-static void dumb_refresh(DisplayState *ds)
-{
-#if defined(CONFIG_SDL)
-    vga_hw_update();
-#endif
-}
-
 static void dumb_display_init(DisplayState *ds)
 {
     ds->data = NULL;
@@ -4916,7 +4909,7 @@ static void dumb_display_init(DisplayState *ds)
     ds->depth = 0;
     ds->dpy_update = dumb_update;
     ds->dpy_resize = dumb_resize;
-    ds->dpy_refresh = dumb_refresh;
+    ds->dpy_refresh = NULL;
 }
 
 /***********************************************************/
#2 lore raw

Hi,

Quoted 1 line · Anders Melchiorsen

[an attached patch]

Since you attached the patch, I will not quote the part that I am commenting on.

By your change to dumb_refresh() you are affecting definitely more than just VNC. I have doubts that this is intended, or good.

Ciao,
Dscho

#3 lore raw
Quoted 2 lines · Johannes Schindelin

Since you attached the patch, I will not quote the part that I am commenting on.

Yes, I attach to preserve formatting. Am I supposed to put it inline? Anyway, here it is, for discussion:

qemu/vl.c +1 -8
index 30c9537..8d67314 100644
@@ -4902,13 +4902,6 @@ static void dumb_resize(DisplayState *ds, int w, int h)
 {
 }
 
-static void dumb_refresh(DisplayState *ds)
-{
-#if defined(CONFIG_SDL)
-    vga_hw_update();
-#endif
-}
-
 static void dumb_display_init(DisplayState *ds)
 {
     ds->data = NULL;
@@ -4916,7 +4909,7 @@ static void dumb_display_init(DisplayState *ds)
     ds->depth = 0;
     ds->dpy_update = dumb_update;
     ds->dpy_resize = dumb_resize;
-    ds->dpy_refresh = dumb_refresh;
+    ds->dpy_refresh = NULL;
 }
 
 /***********************************************************/
Quoted 2 lines

By your change to dumb_refresh() you are affecting definitely more than just VNC. I have doubts that this is intended, or good.

This patch is not for VNC, but for -nographic. I resent it because it is part of my timer optimization crusade as well.

About the "good" part: I tried stepping through the dumb_refresh() call before removing it, and it ended up doing nothing. Is it needed anyway? (in that case, the VNC patch is also wrong, as it stops the periodic timer when no client is connected).

Also, the CONFIG_SDL thing that can make the function into a noop made me quite confident that nothing globally important was going on with the refresh.

Cheers,
Anders.

#4 lore raw

Hi,

Quoted 32 lines · Anders Melchiorsen
qemu/vl.c +1 -8
index 30c9537..8d67314 100644
@@ -4902,13 +4902,6 @@ static void dumb_resize(DisplayState *ds, int w, int h)
 {
 }
 
-static void dumb_refresh(DisplayState *ds)
-{
-#if defined(CONFIG_SDL)
-    vga_hw_update();
-#endif
-}
-
 static void dumb_display_init(DisplayState *ds)
 {
     ds->data = NULL;
@@ -4916,7 +4909,7 @@ static void dumb_display_init(DisplayState *ds)
     ds->depth = 0;
     ds->dpy_update = dumb_update;
     ds->dpy_resize = dumb_resize;
-    ds->dpy_refresh = dumb_refresh;
+    ds->dpy_refresh = NULL;
 }
 
 /***********************************************************/
Quoted 4 lines

By your change to dumb_refresh() you are affecting definitely more than just VNC. I have doubts that this is intended, or good.

Quoted 7 lines

This patch is not for VNC, but for -nographic. I resent it because it is part of my timer optimization crusade as well.

About the "good" part: I tried stepping through the dumb_refresh() call before removing it, and it ended up doing nothing. Is it needed anyway? (in that case, the VNC patch is also wrong, as it stops the periodic timer when no client is connected).

With stepping, you mean that you took one specific setup, and did not inspect what vga_hw_update actually does?

Quoted 3 lines

Also, the CONFIG_SDL thing that can make the function into a noop made me quite confident that nothing globally important was going on with the refresh.

I haven't looked that deeply myself, but your explanations do not give me a cozy feeling about your patch.

Ciao,
Dscho

#5 lore raw
Quoted 2 lines · Johannes Schindelin

I haven't looked that deeply myself, but your explanations do not give me a cozy feeling about your patch.

I see your point, and I would love to discuss the merits of the patch (which is why I sent it in the first place). However, your gut feeling alone does not give me much to work with.

Anders.

#6 lore raw

Hi,

Quoted 8 lines · Anders Melchiorsen
Quoted 2 lines · Johannes Schindelin

I haven't looked that deeply myself, but your explanations do not give me a cozy feeling about your patch.

I see your point, and I would love to discuss the merits of the patch (which is why I sent it in the first place). However, your gut feeling alone does not give me much to work with.

Okay, I tried to be nice. It is not my "gut feeling" that was offended, but my intelligence. So I try to be more explicit.

You said that you tried stepping through the code, and that it apparently did not change anything. Sorry, that is not good enough for me.

Quoted 1 line

From just a cursory inspection, I know that there are possibly different

console instances stored in the active_console variable.

_At least_ you have to enumerate which type they can be, and what their hw_update() does, and why they are not affected by your patch.

Your analysis must be _more_ thorough than mine, because you provided the patch. And no, a non-static analysis is not sufficient.

Hth,
Dscho

#7 lore raw
In reply to Anders Melchiorsen
Quoted 17 lines · Anders Melchiorsen
qemu/vl.c +0 -7
@@ -4902,13 +4902,6 @@ static void dumb_resize(DisplayState *ds, int w, int h)
 {
 }
 
-static void dumb_refresh(DisplayState *ds)
-{
-#if defined(CONFIG_SDL)
-    vga_hw_update();
-#endif
-}
-
 static void dumb_display_init(DisplayState *ds)
 {
     ds->data = NULL;

qemu/vl.c static void dumb_display_init(DisplayState *ds) · line 4913

Quoted 6 lines
qemu/vl.c +1 -1
@@ -4916,7 +4909,7 @@ static void dumb_display_init(DisplayState *ds)
     ds->depth = 0;
     ds->dpy_update = dumb_update;
     ds->dpy_resize = dumb_resize;
-    ds->dpy_refresh = dumb_refresh;
+    ds->dpy_refresh = NULL;
 }

Hi again.

My understanding is that the vga_hw_update() call pushes VRAM contents into whatever ->data buffer the display (SDL, VNC, etc.) has provided, and calls ->dpy_update() to have it shown. As the dumb driver has no data area, this is not needed.

The ->dpy_refresh pointer can safely be NULL, as it is only called from gui_update(). The gui_update() function is a timer callback that is only set up if the ->dpy_refresh value is indeed non-NULL.

All the removed code was added in this patch,

http://www.mail-archive.com/[email protected]/msg10829.html

Stefan, can you maybe confirm that this part of your patch is in fact not needed?

Cheers,
Anders.