Merge lp:~jassmith/unity/unity.redraw-on-resume into lp:unity

Proposed by Jason Smith
Status: Merged
Approved by: Tim Penhey
Approved revision: no longer in the source branch.
Merged at revision: 2205
Proposed branch: lp:~jassmith/unity/unity.redraw-on-resume
Merge into: lp:unity
Diff against target: 83 lines (+25/-0)
4 files modified
manual-tests/NvResumeFromSuspend.txt (+11/-0)
plugins/unityshell/src/LauncherController.cpp (+6/-0)
plugins/unityshell/src/UScreen.cpp (+3/-0)
plugins/unityshell/src/UScreen.h (+5/-0)
To merge this branch: bzr merge lp:~jassmith/unity/unity.redraw-on-resume
Reviewer Review Type Date Requested Status
Tim Penhey (community) Approve
Marco Trevisan (Treviño) Needs Information
Gord Allott Pending
Review via email: mp+95945@code.launchpad.net

This proposal supersedes a proposal from 2012-03-04.

Commit message

Repaint the launcher on resume from suspend.

Description of the change

== The Problem ==
Unity paints a corrupted texture on screen after resume from suspend until it is redraw on Nvidia based system

== The Solutins ==
Repaint the launcher on resume from suspend (this seems to be the problem child)

== Testing ==
Manual test included. Automatic testing not really reasonable due to the nature of the issue (driver hack-a-round)

To post a comment you must log in.
Revision history for this message
Gord Allott (gordallott) wrote : Posted in a previous version of this proposal

+1

review: Approve
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Why not using glib::DBusProxy ?
It would allow a cleaner implementation...

review: Needs Information
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Also, maybe we could just make this go in: https://code.launchpad.net/~smspillaz/unity/unity.half_fix_883836/+merge/85800

And integrate this change into that utility function (that I also had used for some panel stuff).

Revision history for this message
Omer Akram (om26er) wrote :

bump?

Revision history for this message
Tim Penhey (thumper) wrote :

Why add <gio/gio.h> ?

Instead of assigning, use reset:

proxy_.reset(new unity::glib::DBusProxy("org.freedesktop.UPower",
                                        "/org/freedesktop/UPower",
                                        "org.freedesktop.UPower",
                                        G_BUS_TYPE_SYSTEM);

Since you use a lambda function, and not sigc::mem_fun, this won't be automatically disconnected when the launcher controller dies. Could there be a situation where this occurs? Or not?

review: Needs Fixing
Revision history for this message
Tim Penhey (thumper) wrote :

Since this is a high priority bug, and a very slim defined race condition, I've just filed bug 971155 and we'll land this.

review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

No commit message specified.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'manual-tests/NvResumeFromSuspend.txt'
2--- manual-tests/NvResumeFromSuspend.txt 1970-01-01 00:00:00 +0000
3+++ manual-tests/NvResumeFromSuspend.txt 2012-03-29 20:11:20 +0000
4@@ -0,0 +1,11 @@
5+Nvidia resume from suspend corruption
6+----------
7+This test ensures the screen is not corrupted after resume from suspend on nvidia cards.
8+
9+#. Ensure unity is running on a machine with a nvidia GPU using the proprietary nvidia driver
10+#. Put the machine to sleep
11+#. Resume the machine from sleep
12+#. Observe the area where the launcher would normally show
13+
14+Outcome:
15+ The screen should not display any visual corruption once X is finished updating after a resume.
16
17=== modified file 'plugins/unityshell/src/LauncherController.cpp'
18--- plugins/unityshell/src/LauncherController.cpp 2012-03-28 02:42:13 +0000
19+++ plugins/unityshell/src/LauncherController.cpp 2012-03-29 20:11:20 +0000
20@@ -18,6 +18,7 @@
21 * Tim Penhey <tim.penhey@canonical.com>
22 */
23
24+#include <gio/gio.h>
25 #include <glib/gi18n-lib.h>
26 #include <libbamf/libbamf.h>
27
28@@ -261,6 +262,11 @@
29 });
30
31 parent_->AddChild(model_.get());
32+
33+ uscreen->resuming.connect([&]() -> void {
34+ for (auto launcher : launchers)
35+ launcher->QueueDraw();
36+ });
37 }
38
39 Controller::Impl::~Impl()
40
41=== modified file 'plugins/unityshell/src/UScreen.cpp'
42--- plugins/unityshell/src/UScreen.cpp 2012-03-14 06:24:18 +0000
43+++ plugins/unityshell/src/UScreen.cpp 2012-03-29 20:11:20 +0000
44@@ -32,6 +32,9 @@
45 (GCallback)UScreen::Changed, this);
46
47 Refresh();
48+
49+ proxy_ = unity::glib::DBusProxy::Ptr(new unity::glib::DBusProxy("org.freedesktop.UPower", "/org/freedesktop/UPower", "org.freedesktop.UPower", G_BUS_TYPE_SYSTEM));
50+ proxy_->Connect("Resuming", [&](GVariant* data) -> void { resuming.emit(); });
51 }
52
53 UScreen::~UScreen()
54
55=== modified file 'plugins/unityshell/src/UScreen.h'
56--- plugins/unityshell/src/UScreen.h 2012-03-14 06:24:18 +0000
57+++ plugins/unityshell/src/UScreen.h 2012-03-29 20:11:20 +0000
58@@ -24,6 +24,8 @@
59 #include <sigc++/sigc++.h>
60 #include <vector>
61
62+#include "UnityCore/GLibDBusProxy.h"
63+
64 class UScreen : public sigc::trackable
65 {
66 public:
67@@ -41,6 +43,8 @@
68 // <void, primary_monitor, monitors>
69 sigc::signal<void, int, std::vector<nux::Geometry>&> changed;
70
71+ sigc::signal<void> resuming;
72+
73 private:
74 static void Changed(GdkScreen* screen, UScreen* self);
75 static gboolean OnIdleChanged(UScreen* self);
76@@ -50,6 +54,7 @@
77 std::vector<nux::Geometry> _monitors;
78 guint32 _refresh_id;
79 int primary_;
80+ unity::glib::DBusProxy::Ptr proxy_;
81 };
82
83 #endif // _UNITY_SCREEN_H_