NetBSD Problem Report #47379

From www@NetBSD.org  Sun Dec 30 04:10:18 2012
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 8AFB063E529
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 30 Dec 2012 04:10:18 +0000 (UTC)
Message-Id: <20121230041017.01C9563E529@www.NetBSD.org>
Date: Sun, 30 Dec 2012 04:10:16 +0000 (UTC)
From: davshao@gmail.com
Reply-To: davshao@gmail.com
To: gnats-bugs@NetBSD.org
Subject: x11/xfce4-terminal high cpu usage solved by Dave Tyson's patch on at least DragonFly and NetBSD
X-Send-Pr-Version: www-1.0

>Number:         47379
>Category:       pkg
>Synopsis:       x11/xfce4-terminal high cpu usage solved by Dave Tyson's patch on at least DragonFly and NetBSD
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 30 04:15:00 +0000 2012
>Closed-Date:    Sun Jan 13 05:08:09 +0000 2013
>Last-Modified:  Sun Jan 13 05:08:09 +0000 2013
>Originator:     David Shao
>Release:        DragonFly  3.3-DEVELOPMENT x86_64 i386
>Organization:
>Environment:
DragonFly 3.3-DEVELOPMENT x86_64 i386
>Description:
As detailed in PR pkg/46926, updating cairo led to x11/xfce4-terminal high cpu usage with X11_TYPE=modular in DragonFly 3.3-DEVELOPMENT, both x86_64 and i386, and in NetBSD 6.99.x amd64.  Dave Tyson has a patch described in

http://mail-index.netbsd.org/pkgsrc-users/2012/12/20/msg017513.html

that appears to correct the high cpu usage problem in DragonFly 3.3-DEVELOPMENT x86_64 and i386 and in NetBSD 6.

This patch restores effective usability of xfce4 in DragonFly and effects a port that does not effect ports outside of xfce4; therefore, it is important that it be included for pkgsrc-2012Q4, and if possible even be backported to pkgsrc-2012Q3.
>How-To-Repeat:
Use current pkgsrc with X11_TYPE=modular in DragonFly 3.3-DEVELOPMENT x86_64 or i386 or NetBSD 6.
>Fix:
Dave Tyson has a patch described in

http://mail-index.netbsd.org/pkgsrc-users/2012/12/20/msg017513.html

that appears to correct the high cpu usage problem in DragonFly 3.3-DEVELOPMENT x86_64 and i386 and in NetBSD 6.

This patch on DragonFly has been tested to correct the high cpu usage problem in machines that have an Radeon 9250 card, Radeon 4xxx cards, and a Lenovo Ideapad netbook with Intel integrated graphics 945GM.

Relative to pkgsrc current master on DragonFly:

commit d2cf449a4442521a9a9c71d95f7b9e3cc08f4d62
Author: pkgsrc fixup <pkgsrc@dragonflybsd.org>
Date:   Fri Dec 28 19:12:16 2012 -0800

a version of Dave Tyson's patch is as follows:

diff --git a/x11/xfce4-terminal/distinfo b/x11/xfce4-terminal/distinfo
index 7ab39b3..c4eaadf 100644
--- a/x11/xfce4-terminal/distinfo
+++ b/x11/xfce4-terminal/distinfo
@@ -3,3 +3,4 @@ $NetBSD: distinfo,v 1.5 2009/09/16 01:15:36 reed Exp $
 SHA1 (Terminal-0.4.2.tar.bz2) = bf4510e331284d7f68ba193fe1d6f2e57b7815bb
 RMD160 (Terminal-0.4.2.tar.bz2) = 8e6364673d6b0d8eddfd59f3f82d3944fca45684
 Size (Terminal-0.4.2.tar.bz2) = 1981158 bytes
+SHA1 (patch-terminal_terminal-screen.c) = 89f86bb08528925fde2086d8d15904fd37349397
diff --git a/x11/xfce4-terminal/patches/patch-terminal_terminal-screen.c b/x11/xfce4-terminal/patches/patch-terminal_terminal-screen.c
new file mode 100644
index 0000000..7eca3bf
--- /dev/null
+++ b/x11/xfce4-terminal/patches/patch-terminal_terminal-screen.c
@@ -0,0 +1,74 @@
+$NetBSD$
+
+--- terminal/terminal-screen.c.orig	2012-12-27 18:49:08.000000000 +0000
++++ terminal/terminal-screen.c
+@@ -87,6 +87,7 @@ static gboolean   terminal_screen_get_ch
+                                                                  GError               **error);
+ static gchar    **terminal_screen_get_child_environment         (TerminalScreen        *screen);
+ static void       terminal_screen_update_background             (TerminalScreen        *screen);
++static void       terminal_screen_update_background_fast        (TerminalScreen        *screen);
+ static void       terminal_screen_update_binding_backspace      (TerminalScreen        *screen);
+ static void       terminal_screen_update_binding_delete         (TerminalScreen        *screen);
+ static void       terminal_screen_update_colors                 (TerminalScreen        *screen);
+@@ -132,6 +133,8 @@ struct _TerminalScreen
+   GtkWidget           *scrollbar;
+   GtkWidget           *tab_label;
+ 
++  gulong              background_signal_id;
++
+   GPid                 pid;
+   gchar               *working_directory;
+ 
+@@ -231,7 +234,6 @@ terminal_screen_init (TerminalScreen *sc
+                     "signal::context-menu", G_CALLBACK (terminal_screen_vte_get_context_menu), screen,
+                     "signal::selection-changed", G_CALLBACK (terminal_screen_vte_selection_changed), screen,
+                     "signal::window-title-changed", G_CALLBACK (terminal_screen_vte_window_title_changed), screen,
+-                    "swapped-signal::size-allocate", G_CALLBACK (terminal_screen_timer_background), screen,
+                     "swapped-signal::style-set", G_CALLBACK (terminal_screen_update_colors), screen,
+                     NULL);
+   gtk_box_pack_start (GTK_BOX (screen), screen->terminal, TRUE, TRUE, 0);
+@@ -573,6 +575,18 @@ terminal_screen_get_child_environment (T
+ 
+ 
+ static void
++terminal_screen_update_background_fast (TerminalScreen *screen)
++{
++  if (G_UNLIKELY (screen->background_timer_id == 0))
++    {
++      screen->background_timer_id = g_idle_add_full (G_PRIORITY_LOW, terminal_screen_timer_background,
++                                                     screen, terminal_screen_timer_background_destroy);
++    }
++}
++
++
++
++static void
+ terminal_screen_update_background (TerminalScreen *screen)
+ {
+   if (G_UNLIKELY (screen->background_timer_id != 0))
+@@ -1015,9 +1029,25 @@ terminal_screen_timer_background (gpoint
+       if (G_LIKELY (image != NULL))
+         g_object_unref (G_OBJECT (image));
+       g_object_unref (G_OBJECT (loader));
++      
++            /* refresh background on size changes */
++            if (screen->background_signal_id == 0)
++              {
++                screen->background_signal_id =
++                   g_signal_connect_swapped (G_OBJECT (screen->terminal), "size-allocate",
++                                             G_CALLBACK (terminal_screen_update_background_fast), screen);
++              }
+     }
+   else
+     {
++          /* stop updating on size changes */
++          if (screen->background_signal_id != 0)
++            {
++              g_signal_handler_disconnect (G_OBJECT (screen->terminal), screen->background_signal_id);
++              screen->background_signal_id = 0;
++            }
++    
++          /* WARNING: the causes a resize too! */
+       vte_terminal_set_background_image (VTE_TERMINAL (screen->terminal), NULL);
+     }
+ 

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 13 Jan 2013 05:08:09 +0000
State-Changed-Why:
this patch was committed (it was filed in at least two other PRs)


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.