diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-06-07 23:27:49 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-06-07 23:31:25 +0100 |
commit | fc64ba821749ed0a0197a69d9bae81957aceb55f (patch) | |
tree | f7d7832ae00d3b503fa3801a3e27d35098df297e /src/sna | |
parent | ecd80a3a997b11307445c50621d4e86e241a5b22 (diff) |
sna: Restore backlight when switching to VT
fbcon doesn't adjust the backlight when it takes over. Therefore if X
performs a VT switch whilst its outputs are off, fbcon wakes up with no
backlight and users are unhappy. Make the assumption that whoever takes
over the VT will set the outputs as it desires, and that the failsafe
value is to then turn the backlight to full.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67025
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna')
-rw-r--r-- | src/sna/sna_display.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 896c50c3..231fc68c 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -134,6 +134,7 @@ struct sna_property { }; struct sna_output { + xf86OutputPtr base; int id; int serial; @@ -523,9 +524,9 @@ static void sna_backlight_close(struct sna *sna) { } #endif static void -sna_output_backlight_set(xf86OutputPtr output, int level) +sna_output_backlight_set(struct sna_output *sna_output, int level) { - struct sna_output *sna_output = output->driver_private; + xf86OutputPtr output = sna_output->base; DBG(("%s(%s) level=%d, max=%d\n", __FUNCTION__, output->name, level, sna_output->backlight.max)); @@ -2530,7 +2531,7 @@ sna_output_dpms(xf86OutputPtr output, int dpms) __FUNCTION__, sna_output->backlight_active_level)); } sna_output->dpms_mode = dpms; - sna_output_backlight_set(output, 0); + sna_output_backlight_set(sna_output, 0); } if (output->crtc && @@ -2543,7 +2544,7 @@ sna_output_dpms(xf86OutputPtr output, int dpms) if (sna_output->backlight.iface && dpms == DPMSModeOn) { DBG(("%s: restoring previous backlight %d\n", __FUNCTION__, sna_output->backlight_active_level)); - sna_output_backlight_set(output, + sna_output_backlight_set(sna_output, sna_output->backlight_active_level); } @@ -2710,7 +2711,7 @@ sna_output_set_property(xf86OutputPtr output, Atom property, sna_output->backlight_active_level = val; if (sna_output->dpms_mode == DPMSModeOn) - sna_output_backlight_set(output, val); + sna_output_backlight_set(sna_output, val); return TRUE; } @@ -3196,6 +3197,7 @@ sna_output_add(struct sna *sna, int id, int serial) compat_conn.conn.subpixel = 0; output->subpixel_order = subpixel_conv_table[compat_conn.conn.subpixel]; output->driver_private = sna_output; + sna_output->base = output; if (sna_output->is_panel) sna_output_backlight_init(output); @@ -5408,6 +5410,20 @@ void sna_mode_reset(struct sna *sna) rotation_reset(&sna_crtc->primary_rotation); rotation_reset(&sna_crtc->sprite_rotation); } + + /* VT switching, likely to fbcon so make the backlight usable */ + for (i = 0; i < sna->mode.num_real_output; i++) { + struct sna_output *sna_output = to_sna_output(config->output[i]); + + assert(sna_output != NULL); + assert(sna_output->dpms_mode == DPMSModeOff); + + if (!sna_output->backlight.iface) + continue; + + sna_output_backlight_set(sna_output, + sna_output->backlight.max); + } } static void transformed_box(BoxRec *box, xf86CrtcPtr crtc) |