← Back to team overview

mactel-support team mailing list archive

[Bug 289520] Re: GPM unresponsive for two minutes after startup on Macbooks

 

I presume you are talking about patch 91.

The current code is executing the body of the for loop for both end
points, cur and shared_value_abs, Besides being unnecessary, it means
the loop exits for a value outside of the valid range. This makes it
impossible to use the guarded_up/down functions, which never leaves the
valid range.

It *is* possible to make the patch smaller, by 18 lines, by leaving the
if statements untouched, like this:

@@ -331,11 +322,12 @@
                return TRUE;
        }
 
-       /* step the correct way */
+       /* step the correct way - by using guarded and scaled stepping */
        if (cur < shared_value_abs) {
                /* going up */
-               for (i=cur; i<=shared_value_abs; i++) {
-                       ret = gpm_brightness_xrandr_output_set_internal (brightness, output, i);
+               while (cur < shared_value_abs) {
+                       cur = gpm_brightness_get_guarded_up (min, cur, shared_value_abs);
+                       ret = gpm_brightness_xrandr_output_set_internal (brightness, output, cur);
                        if (!ret) {
                                break;
                        }
@@ -344,9 +336,10 @@
                        }
                }
        } else {
-               /* going down */
-               for (i=cur; i>=shared_value_abs; i--) {
-                       ret = gpm_brightness_xrandr_output_set_internal (brightness, output, i);
+               while (cur > shared_value_abs) {
+                       /* going down */
+                       cur = gpm_brightness_get_guarded_down (shared_value_abs, cur, max);
+                       ret = gpm_brightness_xrandr_output_set_internal (brightness, output, cur);
                        if (!ret) {
                                break;
                        }

However, the resulting code looks rather artifical. Would you prefer a
patch base on the above?

-- 
GPM unresponsive for two minutes after startup on Macbooks
https://bugs.launchpad.net/bugs/289520
You received this bug notification because you are a member of Mactel
Support, which is a direct subscriber.

Status in Mactel Support: Fix Released
Status in “gnome-power-manager” source package in Ubuntu: In Progress

Bug description:
Binary package hint: gnome-power-manager

Many of the recent Apple MacBooks have a large number of LCD backlight levels. The GPM uses XRandR to modify the backlight. However, the gpm-brightness-xrandr smooth brightness function does not take the number of brightness levels into account. On recent Macbooks, this leads to some 20000 brightness-set calls on startup, an activity that takes about one and a half minute. During this time, GPM is not responsive. Attached is a patch that introduces scaled stepping, which fixes the problem.



Follow ups