All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xentop.c: Change curses painting behavior to avoid flicker
@ 2012-07-04 18:55 Jason McCarver
  2012-07-17 13:24 ` Ian Jackson
  0 siblings, 1 reply; 6+ messages in thread
From: Jason McCarver @ 2012-07-04 18:55 UTC (permalink / raw)
  To: xen-devel; +Cc: ian.jackson, ian.campbell, stefano.stabellini

Currently, xentop calls clear() before drawing the screen and calling
refresh().  This causes the entire screen to be repainted from scratch
on each call to refresh().  It is inefficient and causes visible flicker
when using xentop.

This patch fixes this by calling erase() instead of clear() which overwrites
the current screen with blanks instead.  The screen is then drawn as usual
in the top() function and refresh() is called.  This method allows curses
to only repaint the characters that have changed since the last call
to refresh(), thus avoiding the flicker and sending fewer characters to
the terminal.

In the event the screen becomes corrupted, this patch accepts a CTRL-L
keystroke from the user which will call clear() and force a repaint of
the entire screen.

Signed-off-by: Jason McCarver <slam@parasite.cc>

diff -r 42f76d536b11 -r b1bf5533d565 tools/xenstat/xentop/xentop.c
--- a/tools/xenstat/xentop/xentop.c	Tue Jul 03 13:39:01 2012 +0100
+++ b/tools/xenstat/xentop/xentop.c	Wed Jul 04 13:53:25 2012 -0500
@@ -57,6 +57,7 @@
 #endif
 
 #define KEY_ESCAPE '\x1B'
+#define KEY_REPAINT '\x0C'
 
 #ifdef HOST_SunOS
 /* Old curses library on Solaris takes non-const strings. Also, ERR interferes
@@ -383,6 +384,9 @@ static int handle_key(int ch)
 		case 'd': case 'D':
 			set_prompt("Delay(sec)", set_delay);
 			break;
+		case KEY_REPAINT:
+			clear();
+			break;
 		case 'q': case 'Q': case KEY_ESCAPE:
 			return 0;
 		}
@@ -1201,7 +1205,7 @@ int main(int argc, char **argv)
 		do {
 			gettimeofday(&curtime, NULL);
 			if(ch != ERR || (curtime.tv_sec - oldtime.tv_sec) >= delay) {
-				clear();
+				erase();
 				top();
 				oldtime = curtime;
 				refresh();

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

* Re: [PATCH] xentop.c: Change curses painting behavior to avoid flicker
  2012-07-04 18:55 [PATCH] xentop.c: Change curses painting behavior to avoid flicker Jason McCarver
@ 2012-07-17 13:24 ` Ian Jackson
  2012-07-17 23:39   ` slam
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Jackson @ 2012-07-17 13:24 UTC (permalink / raw)
  To: Jason McCarver; +Cc: xen-devel, Ian Campbell, Stefano Stabellini

Jason McCarver writes ("[PATCH] xentop.c: Change curses painting behavior to avoid flicker"):
> Currently, xentop calls clear() before drawing the screen and calling
> refresh().  This causes the entire screen to be repainted from scratch
> on each call to refresh().  It is inefficient and causes visible flicker
> when using xentop.
> 
> This patch fixes this by calling erase() instead of clear() which overwrites
> the current screen with blanks instead.  The screen is then drawn as usual
> in the top() function and refresh() is called.  This method allows curses
> to only repaint the characters that have changed since the last call
> to refresh(), thus avoiding the flicker and sending fewer characters to
> the terminal.
> 
> In the event the screen becomes corrupted, this patch accepts a CTRL-L
> keystroke from the user which will call clear() and force a repaint of
> the entire screen.
> 
> Signed-off-by: Jason McCarver <slam@parasite.cc>

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

However, I think this needs to wait for Xen 4.3.  We are currently in
the freeze for the 4.2 release.

Ian.

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

* Re: [PATCH] xentop.c: Change curses painting behavior to avoid flicker
  2012-07-17 13:24 ` Ian Jackson
@ 2012-07-17 23:39   ` slam
  2012-07-18  7:50     ` Ian Campbell
  2012-07-18 10:46     ` Ian Jackson
  0 siblings, 2 replies; 6+ messages in thread
From: slam @ 2012-07-17 23:39 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel, Ian Campbell, Stefano Stabellini

On Tue, 17 Jul 2012 14:24:22 +0100
Ian Jackson <Ian.Jackson@eu.citrix.com> wrote:

> Jason McCarver writes ("[PATCH] xentop.c: Change curses painting behavior to avoid flicker"):
> > Currently, xentop calls clear() before drawing the screen and calling
> > refresh().  This causes the entire screen to be repainted from scratch
> > on each call to refresh().  It is inefficient and causes visible flicker
> > when using xentop.
> > 
> > This patch fixes this by calling erase() instead of clear() which overwrites
> > the current screen with blanks instead.  The screen is then drawn as usual
> > in the top() function and refresh() is called.  This method allows curses
> > to only repaint the characters that have changed since the last call
> > to refresh(), thus avoiding the flicker and sending fewer characters to
> > the terminal.
> > 
> > In the event the screen becomes corrupted, this patch accepts a CTRL-L
> > keystroke from the user which will call clear() and force a repaint of
> > the entire screen.
> > 
> > Signed-off-by: Jason McCarver <slam@parasite.cc>
> 
> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
> 
> However, I think this needs to wait for Xen 4.3.  We are currently in
> the freeze for the 4.2 release.
> 
> Ian.

I apologize in advance for the newb questions.  Is there anything I need
to do to help this patch make it into 4.3?  Will I need to re-post it
to the list again at a later date, or is my first post of this
sufficient assuming the patch remains unchanged?

Jason

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

* Re: [PATCH] xentop.c: Change curses painting behavior to avoid flicker
  2012-07-17 23:39   ` slam
@ 2012-07-18  7:50     ` Ian Campbell
  2012-07-18 10:46     ` Ian Jackson
  1 sibling, 0 replies; 6+ messages in thread
From: Ian Campbell @ 2012-07-18  7:50 UTC (permalink / raw)
  To: slam; +Cc: xen-devel, Ian Jackson, Stefano Stabellini

On Wed, 2012-07-18 at 00:39 +0100, slam wrote:
> On Tue, 17 Jul 2012 14:24:22 +0100
> Ian Jackson <Ian.Jackson@eu.citrix.com> wrote:
> 
> > Jason McCarver writes ("[PATCH] xentop.c: Change curses painting behavior to avoid flicker"):
> > > Currently, xentop calls clear() before drawing the screen and calling
> > > refresh().  This causes the entire screen to be repainted from scratch
> > > on each call to refresh().  It is inefficient and causes visible flicker
> > > when using xentop.
> > > 
> > > This patch fixes this by calling erase() instead of clear() which overwrites
> > > the current screen with blanks instead.  The screen is then drawn as usual
> > > in the top() function and refresh() is called.  This method allows curses
> > > to only repaint the characters that have changed since the last call
> > > to refresh(), thus avoiding the flicker and sending fewer characters to
> > > the terminal.
> > > 
> > > In the event the screen becomes corrupted, this patch accepts a CTRL-L
> > > keystroke from the user which will call clear() and force a repaint of
> > > the entire screen.
> > > 
> > > Signed-off-by: Jason McCarver <slam@parasite.cc>
> > 
> > Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
> > 
> > However, I think this needs to wait for Xen 4.3.  We are currently in
> > the freeze for the 4.2 release.
> > 
> > Ian.
> 
> I apologize in advance for the newb questions.  Is there anything I need
> to do to help this patch make it into 4.3?  Will I need to re-post it
> to the list again at a later date, or is my first post of this
> sufficient assuming the patch remains unchanged?

I'd recommend reposting once 4.3 opens just to remind us.

Ian.

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

* Re: [PATCH] xentop.c: Change curses painting behavior to avoid flicker
  2012-07-17 23:39   ` slam
  2012-07-18  7:50     ` Ian Campbell
@ 2012-07-18 10:46     ` Ian Jackson
  2012-09-14  9:06       ` Ian Campbell
  1 sibling, 1 reply; 6+ messages in thread
From: Ian Jackson @ 2012-07-18 10:46 UTC (permalink / raw)
  To: slam; +Cc: xen-devel, Ian Campbell, Stefano Stabellini

slam writes ("Re: [PATCH] xentop.c: Change curses painting behavior to avoid flicker"):
> I apologize in advance for the newb questions.  Is there anything I need
> to do to help this patch make it into 4.3?  Will I need to re-post it
> to the list again at a later date, or is my first post of this
> sufficient assuming the patch remains unchanged?

No need to apologise.  In theory I'd hope we remember this but in
practice we don't have any formal tracking.

So if you can, please do repost this after 4.2 is released.

Thanks,
Ian.

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

* Re: [PATCH] xentop.c: Change curses painting behavior to avoid flicker
  2012-07-18 10:46     ` Ian Jackson
@ 2012-09-14  9:06       ` Ian Campbell
  0 siblings, 0 replies; 6+ messages in thread
From: Ian Campbell @ 2012-09-14  9:06 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel, slam, Stefano Stabellini

On Wed, 2012-07-18 at 11:46 +0100, Ian Jackson wrote:
> slam writes ("Re: [PATCH] xentop.c: Change curses painting behavior to avoid flicker"):
> > I apologize in advance for the newb questions.  Is there anything I need
> > to do to help this patch make it into 4.3?  Will I need to re-post it
> > to the list again at a later date, or is my first post of this
> > sufficient assuming the patch remains unchanged?
> 
> No need to apologise.  In theory I'd hope we remember this but in
> practice we don't have any formal tracking.
> 
> So if you can, please do repost this after 4.2 is released.

I've applied this to unstable (aka 4.3-pre) now.

Ian.

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

end of thread, other threads:[~2012-09-14  9:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-04 18:55 [PATCH] xentop.c: Change curses painting behavior to avoid flicker Jason McCarver
2012-07-17 13:24 ` Ian Jackson
2012-07-17 23:39   ` slam
2012-07-18  7:50     ` Ian Campbell
2012-07-18 10:46     ` Ian Jackson
2012-09-14  9:06       ` Ian Campbell

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