diff mbox

Use "Backlight" as backlight brightness property.

Message ID 1250615246-26111-4-git-send-email-mhopf@suse.de (mailing list archive)
State Not Applicable
Headers show

Commit Message

Matthias Hopf Aug. 18, 2009, 5:07 p.m. UTC
BACKLIGHT is now deprecated, though still usable.
---
 src/drmmode_display.c |   29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 deletions(-)
diff mbox

Patch

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index ab73b4f..7522f1c 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -957,8 +957,9 @@  drmmode_property_ignore(drmModePropertyPtr prop)
     return FALSE;
 }
 
-#define BACKLIGHT_NAME  "BACKLIGHT"
-static Atom backlight_atom;
+#define BACKLIGHT_NAME             "Backlight"
+#define BACKLIGHT_DEPRECATED_NAME  "BACKLIGHT"
+static Atom backlight_atom, backlight_deprecated_atom;
 
 static void
 drmmode_output_create_resources(xf86OutputPtr output)
@@ -1049,8 +1050,9 @@  drmmode_output_create_resources(xf86OutputPtr output)
 	INT32 data, backlight_range[2];
 	/* Set up the backlight property, which takes effect immediately
 	 * and accepts values only within the backlight_range. */
-	backlight_atom = MakeAtom(BACKLIGHT_NAME, sizeof(BACKLIGHT_NAME) - 1,
-	    TRUE);
+	backlight_atom = MakeAtom(BACKLIGHT_NAME, sizeof(BACKLIGHT_NAME) - 1, TRUE);
+	backlight_deprecated_atom = MakeAtom(BACKLIGHT_DEPRECATED_NAME,
+		sizeof(BACKLIGHT_DEPRECATED_NAME) - 1, TRUE);
 
 	backlight_range[0] = 0;
 	backlight_range[1] = drmmode_output->backlight_max;
@@ -1060,6 +1062,12 @@  drmmode_output_create_resources(xf86OutputPtr output)
 	    xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
 	               "RRConfigureOutputProperty error, %d\n", err);
 	}
+	err = RRConfigureOutputProperty(output->randr_output, backlight_deprecated_atom,
+	                                FALSE, TRUE, FALSE, 2, backlight_range);
+	if (err != 0) {
+	    xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
+	               "RRConfigureOutputProperty error, %d\n", err);
+	}
 	/* Set the current value of the backlight property */
 	data = drmmode_output->backlight_active_level;
 	err = RRChangeOutputProperty(output->randr_output, backlight_atom,
@@ -1069,6 +1077,13 @@  drmmode_output_create_resources(xf86OutputPtr output)
 	    xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
 	               "RRChangeOutputProperty error, %d\n", err);
 	}
+	err = RRChangeOutputProperty(output->randr_output, backlight_deprecated_atom,
+	                             XA_INTEGER, 32, PropModeReplace, 1, &data,
+	                             FALSE, TRUE);
+	if (err != 0) {
+	    xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
+	               "RRChangeOutputProperty error, %d\n", err);
+	}
     }
 }
 
@@ -1080,7 +1095,7 @@  drmmode_output_set_property(xf86OutputPtr output, Atom property,
     drmmode_ptr drmmode = drmmode_output->drmmode;
     int i;
 
-    if (property == backlight_atom) {
+    if (property == backlight_atom || property == backlight_deprecated_atom) {
 	INT32 val;
 
 	if (value->type != XA_INTEGER || value->format != 32 ||
@@ -1146,7 +1161,7 @@  drmmode_output_get_property(xf86OutputPtr output, Atom property)
     drmmode_output_private_ptr drmmode_output = output->driver_private;
     int err;
 
-    if (property == backlight_atom) {
+    if (property == backlight_atom || property == backlight_deprecated_atom) {
 	INT32 val;
 
 	if (! drmmode_output->backlight_iface)
@@ -1155,7 +1170,7 @@  drmmode_output_get_property(xf86OutputPtr output, Atom property)
 	val = drmmode_backlight_get(output);
 	if (val < 0)
 	    return FALSE;
-	err = RRChangeOutputProperty(output->randr_output, backlight_atom,
+	err = RRChangeOutputProperty(output->randr_output, property,
 	                             XA_INTEGER, 32, PropModeReplace, 1, &val,
 	                             FALSE, TRUE);
 	if (err != 0) {