summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-08-25 15:44:20 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-08-26 00:59:33 +0100
commitb7a8087fbc5cbd944f8345b8a098270c1f63ebab (patch)
treea2b910ab0618a5c9812e5047014f1865b160c3b1 /src
parent68a5ad497b557ab9e8bff301098ea78c84d385a2 (diff)
Revert "Leave adjustment of backlight to the driver."
This reverts commit 9c3e34703dcdc2155faeb2c1886930def19d9989. This commit is not ready, as first the driver needs to handle all controllers, especially those that ignore the BLC and require their own interface. Fortunately, by moving that discovery into the kernel - where it just means finding which ACPI device is attached to the video and has a backlight interface - the userspace code should become much more sane, and work even with multi-gpu, multi-lid systems. But that is for tomorrow.
Diffstat (limited to 'src')
-rw-r--r--src/intel_display.c55
1 files changed, 45 insertions, 10 deletions
diff --git a/src/intel_display.c b/src/intel_display.c
index c9451042..4da27906 100644
--- a/src/intel_display.c
+++ b/src/intel_display.c
@@ -80,7 +80,6 @@ struct intel_property {
struct intel_output {
struct intel_mode *mode;
int output_id;
- int dpms_id;
drmModeConnectorPtr mode_output;
drmModeEncoderPtr mode_encoder;
int num_props;
@@ -862,16 +861,56 @@ intel_output_destroy(xf86OutputPtr output)
}
static void
+intel_output_dpms_backlight(xf86OutputPtr output, int oldmode, int mode)
+{
+ struct intel_output *intel_output = output->driver_private;
+
+ if (!intel_output->backlight_iface)
+ return;
+
+ if (mode == DPMSModeOn) {
+ /* If we're going from off->on we may need to turn on the backlight. */
+ if (oldmode != DPMSModeOn)
+ intel_output_backlight_set(output,
+ intel_output->backlight_active_level);
+ } else {
+ /* Only save the current backlight value if we're going from on to off. */
+ if (oldmode == DPMSModeOn)
+ intel_output->backlight_active_level = intel_output_backlight_get(output);
+ intel_output_backlight_set(output, 0);
+ }
+}
+
+static void
intel_output_dpms(xf86OutputPtr output, int dpms)
{
struct intel_output *intel_output = output->driver_private;
+ drmModeConnectorPtr koutput = intel_output->mode_output;
struct intel_mode *mode = intel_output->mode;
+ int i;
- drmModeConnectorSetProperty(mode->fd,
- intel_output->output_id,
- intel_output->dpms_id,
- dpms);
- intel_output->dpms_mode = dpms;
+ for (i = 0; i < koutput->count_props; i++) {
+ drmModePropertyPtr props;
+
+ props = drmModeGetProperty(mode->fd, koutput->props[i]);
+ if (!props)
+ continue;
+
+ if (!strcmp(props->name, "DPMS")) {
+ drmModeConnectorSetProperty(mode->fd,
+ intel_output->output_id,
+ props->prop_id,
+ dpms);
+ intel_output_dpms_backlight(output,
+ intel_output->dpms_mode,
+ dpms);
+ intel_output->dpms_mode = dpms;
+ drmModeFreeProperty(props);
+ return;
+ }
+
+ drmModeFreeProperty(props);
+ }
}
int
@@ -922,10 +961,6 @@ intel_output_create_resources(xf86OutputPtr output)
drmmode_prop = drmModeGetProperty(mode->fd,
mode_output->props[i]);
-
- if (!strcmp(drmmode_prop->name, "DPMS"))
- intel_output->dpms_id = drmmode_prop->prop_id;
-
if (intel_property_ignore(drmmode_prop)) {
drmModeFreeProperty(drmmode_prop);
continue;