After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 597874 - gnome screensaver fading doesn't use xrandr gamma ramps
gnome screensaver fading doesn't use xrandr gamma ramps
Status: RESOLVED FIXED
Product: gnome-screensaver
Classification: Deprecated
Component: daemon
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-screensaver maintainers
gnome-screensaver maintainers
: 566857 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-10-09 03:49 UTC by Dave Airlie
Modified: 2010-01-29 01:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gnome-desktop patch to add xrandr gamma support (5.13 KB, patch)
2009-10-09 03:50 UTC, Dave Airlie
none Details | Review
gnome-screensaver randr fade patch. (26.06 KB, patch)
2009-10-09 03:51 UTC, Dave Airlie
none Details | Review
v2 of gamma support for g-s (26.53 KB, patch)
2009-10-09 06:14 UTC, Dave Airlie
none Details | Review
simpler gnome-desktop patch (3.58 KB, patch)
2009-10-11 23:31 UTC, Dave Airlie
none Details | Review
g-s patch to go with latest gnome-desktop patch. (25.89 KB, patch)
2009-10-11 23:32 UTC, Dave Airlie
none Details | Review
gnome-desktop patch v3. (3.74 KB, patch)
2009-10-14 23:29 UTC, Dave Airlie
none Details | Review
gnome-screensaver randr fade patch v4 (26.08 KB, patch)
2009-10-14 23:41 UTC, Dave Airlie
accepted-commit_after_freeze Details | Review
the gnome-desktop patch we're actually shipping (3.74 KB, patch)
2009-11-02 15:31 UTC, Matthias Clasen
none Details | Review

Description Dave Airlie 2009-10-09 03:49:44 UTC
In order for fading with X.org randr 1.2 drivers to work properly,
the screensaver should use randr to fade the crtcs.

I'll attach two patches, one two gnome-desktop one to gnome-screensaver to address this.
Comment 1 Dave Airlie 2009-10-09 03:50:26 UTC
Created attachment 145097 [details] [review]
gnome-desktop patch to add xrandr gamma support

patch to gnome desktop to add some crtc interfaces along with gamma interface.
Comment 2 Dave Airlie 2009-10-09 03:51:23 UTC
Created attachment 145098 [details] [review]
gnome-screensaver randr fade patch.

This adds fading via the randr 1.2 protocol using gnome-desktop APIs.

It'll fall back to old vidmode in non randr screens.
Comment 3 Dave Airlie 2009-10-09 06:14:08 UTC
Created attachment 145101 [details] [review]
v2 of gamma support for g-s

this fixes a bug where we re-enter the fade and lose the restore gamma.
Comment 4 Nicolas Mailhot 2009-10-11 20:59:28 UTC
It would probably be a good idea to check it with the color conversion people (argyllcms, etc). They've complained in the past screensavers messed up their color adjustments
Comment 5 Dave Airlie 2009-10-11 23:30:24 UTC
well this stuff won't mess it up any different than previous stuff its just an alternate method that works on dual head.
Comment 6 Dave Airlie 2009-10-11 23:31:18 UTC
Created attachment 145263 [details] [review]
simpler gnome-desktop patch

Not sure what I was doing there, this is all that is required in the gnome desktop component, much simpler.

Also reflects ssp comments on irc.
Comment 7 Dave Airlie 2009-10-11 23:32:52 UTC
Created attachment 145264 [details] [review]
g-s patch to go with latest gnome-desktop patch.

This is reworked using the crtcs interface correctly, sleepy Friday coding failure.
Comment 8 Soren Sandmann Pedersen 2009-10-13 19:40:33 UTC
Some comments:

- It looks like the crtc->gamma field is only ever used during setting/getting
of gamma, so it could just be a local variable in those functions.

- The gamma_size field is remembered, but I don't think it changes for any particular CRTC, so it could just be initialized once in crtc_initialize().

- g_new0() can never return NULL. If malloc() fails, then glib will abort the program. Also, convention is that the application can pass NULL for "out" parameters, so in get_gamma() the code could be something like this:

      copy_size = crtc->gamma_size * sizeof(unsigned short);

      if (red)
      {
          unsigned short *r = g_new0 (unsigned short, crtc->gamma_size);
          memcpy (r, crtc->gamma->red, copy_size);
          *red = r;
      }

for each of the components. And then  if (size) *size = crtc->gamma_size;

- The boolean return from get_gamma() may be unnecessary then, if it can only fail due to out-of-memory.

- A couple of style issues:
  - Blank line after a block of variables
  - Space between function names and parentheses (both calls and definitions)
Comment 9 Dave Airlie 2009-10-14 23:29:37 UTC
Created attachment 145460 [details] [review]
gnome-desktop patch v3.

fixes as per ssp comment,

still need the gboolean since the XRRGetCrtcGamma call can fail.

otherwise hopefully this should follow any coding insanity^Wstandard.
Comment 10 Dave Airlie 2009-10-14 23:41:05 UTC
Created attachment 145461 [details] [review]
gnome-screensaver randr fade patch v4

Updates for coding style.
Comment 11 William Jon McCann 2009-10-21 23:47:32 UTC
Comment on attachment 145461 [details] [review]
gnome-screensaver randr fade patch v4

Still a few coding style problems I'd like to fix before we commit.  I've tested this and it seems to work nicely.  We can commit after branching.
Comment 12 Matthias Clasen 2009-10-22 18:07:27 UTC
This

        while (*crtcs)
        {
                crtc = *crtcs;
                
                /* if no mode ignore crtc */
                if (!gnome_rr_crtc_get_current_mode (crtc))
                        continue;


make g-s-s get suck in a busy loop if you ever have a crtc without a current mode (as I do :-( ). Simply skipping the crtc here will be problematic though, since that will leave the info array member uninitialized. Other loops assume that they can just loop over the whole info array, so thats a bad idea. The next alternative is to set info->size to 0, but then it looks like we'll trigger a size==0 special case in xf86_wack_gamma ? Ah, no. There is a separate xrandr_crtc_whack_gamma which looks like it will do the right thing with size==0.

The loop should probably look like this ?

        while (*crtcs)
+        {
+                crtc = *crtcs;
+
+                info = &screen_priv->info[crtc_count];
+
+                /* if no mode ignore crtc */
+                if (!gnome_rr_crtc_get_current_mode (crtc)) {
+                       info->size = 0;
+                       info->r = NULL;
+                       info->g = NULL;
+                       info->b = NULL;
+                }
+               else {
+                       res = gnome_rr_crtc_get_gamma (crtc, &info->size,
+                                                      &info->r, &info->g,
+                                                      &info->b);
+                       if (res == FALSE)
+                               goto fail;
+               }
+
+                crtcs++;
+                crtc_count++;
+        }


I'll try this one
Comment 13 Matthias Clasen 2009-11-02 15:31:39 UTC
Created attachment 146756 [details] [review]
the gnome-desktop patch we're actually shipping
Comment 14 William Jon McCann 2009-11-02 21:25:12 UTC
Committed modified patch from Matthias.  Fixed in master (2.29.x).  Thanks!
Comment 15 William Jon McCann 2010-01-29 01:36:51 UTC
*** Bug 566857 has been marked as a duplicate of this bug. ***