xf86-video-intel: 4 commits - src/drmmode_display.c

Matthias Hopf mhopf at kemper.freedesktop.org
Thu Sep 3 08:57:54 PDT 2009


 src/drmmode_display.c |   69 ++++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 56 insertions(+), 13 deletions(-)

New commits:
commit e903b3ebad29d943c05ff550940034c3a43e0235
Author: Matthias Hopf <mhopf at suse.de>
Date:   Thu Sep 3 16:34:08 2009 +0200

    Don't set backlight level if going on->on.
    
    Otherwise changed backlight will be reset upon DPMS switch off, because first
    this function is called with DPMSModeOn.

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index b682757..04ba350 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -882,7 +882,8 @@ drmmode_output_dpms_backlight(xf86OutputPtr output, int oldmode, int mode)
 
 	if (mode == DPMSModeOn) {
 		/* If we're going from off->on we may need to turn on the backlight. */
-		drmmode_backlight_set(output, drmmode_output->backlight_active_level);
+		if (oldmode != DPMSModeOn)
+			drmmode_backlight_set(output, drmmode_output->backlight_active_level);
 	} else {
 		/* Only save the current backlight value if we're going from on to off. */
 		if (oldmode == DPMSModeOn)
commit 91f26937c1a3a4f33da86aa6b62ab9b288a54e15
Author: Matthias Hopf <mhopf at suse.de>
Date:   Tue Aug 18 18:44:38 2009 +0200

    Use "Backlight" as backlight brightness property.
    
    BACKLIGHT is now deprecated, though still usable.

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 2873101..b682757 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -945,8 +945,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)
@@ -1037,8 +1038,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;
@@ -1048,6 +1050,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,
@@ -1057,6 +1065,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);
+	}
     }
 }
 
@@ -1068,7 +1083,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 ||
@@ -1134,7 +1149,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)
@@ -1143,7 +1158,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) {
commit dbc8944ee9e6755ab11dfc7375c3394f531a49ce
Author: Matthias Hopf <mhopf at suse.de>
Date:   Tue Aug 18 18:34:45 2009 +0200

    Add get_property support.
    
    So far only BACKLIGHT is changed.

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 47dfc6a..2873101 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1036,10 +1036,7 @@ drmmode_output_create_resources(xf86OutputPtr output)
     if (drmmode_output->backlight_iface) {
 	INT32 data, backlight_range[2];
 	/* Set up the backlight property, which takes effect immediately
-	 * and accepts values only within the backlight_range.
-	 *
-	 * FIXME: there is no get_property yet.
-	 */
+	 * and accepts values only within the backlight_range. */
 	backlight_atom = MakeAtom(BACKLIGHT_NAME, sizeof(BACKLIGHT_NAME) - 1,
 	    TRUE);
 
@@ -1131,10 +1128,41 @@ drmmode_output_set_property(xf86OutputPtr output, Atom property,
     return TRUE;
 }
 
+static Bool
+drmmode_output_get_property(xf86OutputPtr output, Atom property)
+{
+    drmmode_output_private_ptr drmmode_output = output->driver_private;
+    int err;
+
+    if (property == backlight_atom) {
+	INT32 val;
+
+	if (! drmmode_output->backlight_iface)
+	    return FALSE;
+
+	val = drmmode_backlight_get(output);
+	if (val < 0)
+	    return FALSE;
+	err = RRChangeOutputProperty(output->randr_output, backlight_atom,
+	                             XA_INTEGER, 32, PropModeReplace, 1, &val,
+	                             FALSE, TRUE);
+	if (err != 0) {
+	    xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
+	               "RRChangeOutputProperty error, %d\n", err);
+	    return FALSE;
+	}
+
+	return TRUE;
+    }
+
+    return TRUE;
+}
+
 static const xf86OutputFuncsRec drmmode_output_funcs = {
 	.create_resources = drmmode_output_create_resources,
 #ifdef RANDR_12_INTERFACE
 	.set_property = drmmode_output_set_property,
+	.get_property = drmmode_output_get_property,
 #endif
 	.dpms = drmmode_output_dpms,
 #if 0
commit c18fc7955dc2aec878dd3bea1d51aaecf3f08858
Author: Matthias Hopf <mhopf at suse.de>
Date:   Tue Aug 18 18:05:45 2009 +0200

    Don't ignore backlight level change to the same level.
    
    If set externally to a different level, this would result in a no-op.
    OTOH if the display is switched off (DPMS) you do not want the change to take
    place immediately, but rather to be saved and set later when the display is
    active again.

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 24c7659..47dfc6a 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1084,10 +1084,9 @@ drmmode_output_set_property(xf86OutputPtr output, Atom property,
 	if (val < 0 || val > drmmode_output->backlight_max)
 	    return FALSE;
 
-	if (val != drmmode_output->backlight_active_level) {
+	if (drmmode_output->dpms_mode == DPMSModeOn)
 	    drmmode_backlight_set(output, val);
-	    drmmode_output->backlight_active_level = val;
-	}
+	drmmode_output->backlight_active_level = val;
 	return TRUE;
     }
 


More information about the xorg-commit mailing list