[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#651741: gnome-power-manager: display backlight brightness has no effect on Sony Vaio VPCYA1V9E



package xserver-xorg-video-intel
tags 651741 - fixed-upstream
found 651741 xserver-xorg-video-intel/2:2.19.0-6
quit

The upstream developers of xf86-video-intel denied my request to
blacklist the faulty VAIO ACPI implementation.  They said Linux
should be patched instead.  I have not yet reported the problem
to the kernel bugzilla.

However, later upstream versions let the system administrator
override the automatic selection of a backlight control device,
by adding Option "Backlight" to /etc/X11/xorg.conf:

Section "Device"
        Option     "AccelMethod"        "uxa"
        Option     "Backlight"          "intel_backlight"
	Identifier  "Card0"
	Driver      "intel"
	BusID       "PCI:0:2:0"
EndSection

This option was added in xf86-video-intel 2.20.6, and a serious
bug in it was fixed in 2.20.7.  The current version in Debian
experimental is 2:2.20.5-1, which does not support this option.

As a workaround until Linux automatically disables the useless
backlight control device, I propose backporting this option.
For UXA, the backport is pretty easy; please see the attached
patch.  For SNA, it would require more work, and I did not
attempt it.

To test this patch on Sony Vaio VPCYA1V9E, I built and installed
xserver-xorg-video-intel 2:2.19.0-6 + this patch, created an
/etc/X11/xorg.conf containing only the "Device" section shown
above, and restarted the X server.  /var/log/Xorg.0.log then
showed that /sys/class/backlight/intel_backlight was being used,
and I was able to control the backlight with xrandr and with key
combinations.

Backport the following upstream commits, but omit SNA support because
it has conflicts and resolving them would too easily cause new bugs.
Add a note about this Debian-specific backport in man/intel.man.

Debian bug #651741 <http://bugs.debian.org/651741>

  commit 414e87255cdee6eb556703ddefd194af71b985ed
  Author:     Chris Wilson <chris@chris-wilson.co.uk>
  AuthorDate: 2012-08-26 19:47:31 +0100
  Commit:     Chris Wilson <chris@chris-wilson.co.uk>
  CommitDate: 2012-08-26 19:47:31 +0100

    Add Option "Backlight" to override the probed backlight control interface
    
    The automatic selection may not correspond with the correct backlight
    (such as in a multi-gpu, multi-panel device) or the user may simply
    prefer another control interface. This allows them to override the
    chosen interface using
    
      Option "Backlight" "my-backlight"
    
    to specify '/sys/class/backlight/my-backlight' as the interface to use
    instead.
    
    Suggested-by: Alon Levy <alevy@redhat.com>
    References: https://bugs.freedesktop.org/show_bug.cgi?id=29273
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

  commit 164ae7a4f9fd3e538f1b506031d297088fc0c659
  Author:     Chris Wilson <chris@chris-wilson.co.uk>
  AuthorDate: 2012-09-02 17:19:12 +0100
  Commit:     Chris Wilson <chris@chris-wilson.co.uk>
  CommitDate: 2012-09-02 17:20:19 +0100

    man: Malformed "Backlight" section
    
    Reported-by: Matthew Monaco <dgbaley27@0x01b.net>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54397
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

  commit 3dc644b2a959fc559e1138b332ed42d7235de42f
  Author:     Сковорода Никита Андреевич <chalkerx@gmail.com>
  AuthorDate: 2012-09-03 13:44:21 +0400
  Commit:     Chris Wilson <chris@chris-wilson.co.uk>
  CommitDate: 2012-09-03 23:09:08 +0100

    uxa: Fix Backlight option support.
    
    Signed-off-by: Сковорода Никита Андреевич <chalkerx@gmail.com>

  commit 886f3cef4101a674bb62656cf7f3046643cae4b1
  Author:     Chris Wilson <chris@chris-wilson.co.uk>
  AuthorDate: 2012-09-05 15:27:21 +0100
  Commit:     Chris Wilson <chris@chris-wilson.co.uk>
  CommitDate: 2012-09-05 15:27:21 +0100

    uxa: Fix cut'n'paste error in Option "Backlight"
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Index: xserver-xorg-video-intel-2.19.0/man/intel.man
===================================================================
--- xserver-xorg-video-intel-2.19.0.orig/man/intel.man	2012-10-21 15:30:31.268126472 +0300
+++ xserver-xorg-video-intel-2.19.0/man/intel.man	2012-10-21 15:35:27.360135750 +0300
@@ -138,6 +138,18 @@
 .IP
 Default: Textured video adaptor is preferred.
 .TP
+.BI "Option \*qBacklight\*q \*q" string \*q
+Override the probed backlight control interface. Sometimes the automatically
+selected backlight interface may not correspond to the correct, or simply
+most useful, interface available on the system. This allows you to override
+that choice by specifying the entry under /sys/class/backlight to use.
+.IP
+Default: Automatic selection.
+.IP
+Debian-specific: This option was backported from upstream release 2.20.7.
+Because SNA support was omitted in this backport, the option has no effect
+if AccelMethod is sna.
+.TP
 .BI "Option \*qFallbackDebug\*q \*q" boolean \*q
 Enable printing of debugging information on acceleration fallbacks to the
 server log.
Index: xserver-xorg-video-intel-2.19.0/src/intel_display.c
===================================================================
--- xserver-xorg-video-intel-2.19.0.orig/src/intel_display.c	2012-10-21 15:25:48.000000000 +0300
+++ xserver-xorg-video-intel-2.19.0/src/intel_display.c	2012-10-21 15:32:52.912130911 +0300
@@ -40,6 +40,7 @@
 
 #include "intel.h"
 #include "intel_bufmgr.h"
+#include "intel_options.h"
 #include "xf86drm.h"
 #include "xf86drmMode.h"
 #include "X11/Xatom.h"
@@ -247,19 +248,36 @@
 intel_output_backlight_init(xf86OutputPtr output)
 {
 	struct intel_output *intel_output = output->driver_private;
+	intel_screen_private *intel = intel_get_screen_private(output->scrn);
+	char path[BACKLIGHT_PATH_LEN];
+	struct stat buf;
+	char *str;
 	int i;
 
-	for (i = 0; backlight_interfaces[i] != NULL; i++) {
-		char path[BACKLIGHT_PATH_LEN];
-		struct stat buf;
+	str = xf86GetOptValString(intel->Options, OPTION_BACKLIGHT);
+	if (str != NULL) {
+		sprintf(path, "%s/%s", BACKLIGHT_CLASS, str);
+		if (!stat(path, &buf)) {
+			intel_output->backlight_iface = str;
+			intel_output->backlight_max = intel_output_backlight_get_max(output);
+			if (intel_output->backlight_max > 0) {
+				xf86DrvMsg(output->scrn->scrnIndex, X_CONFIG,
+					   "found backlight control interface %s\n", path);
+				return;
+			}
+		}
+		xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
+			   "unrecognised backlight control interface %s\n", str);
+	}
 
+	for (i = 0; backlight_interfaces[i] != NULL; i++) {
 		sprintf(path, "%s/%s", BACKLIGHT_CLASS, backlight_interfaces[i]);
 		if (!stat(path, &buf)) {
 			intel_output->backlight_iface = backlight_interfaces[i];
 			intel_output->backlight_max = intel_output_backlight_get_max(output);
 			if (intel_output->backlight_max > 0) {
 				intel_output->backlight_active_level = intel_output_backlight_get(output);
-				xf86DrvMsg(output->scrn->scrnIndex, X_INFO,
+				xf86DrvMsg(output->scrn->scrnIndex, X_PROBED,
 					   "found backlight control interface %s\n", path);
 				return;
 			}
Index: xserver-xorg-video-intel-2.19.0/src/intel_options.h
===================================================================
--- xserver-xorg-video-intel-2.19.0.orig/src/intel_options.h	2012-10-21 15:25:48.000000000 +0300
+++ xserver-xorg-video-intel-2.19.0/src/intel_options.h	2012-10-21 15:32:52.916130910 +0300
@@ -9,6 +9,7 @@
 
 enum intel_options {
 	OPTION_ACCEL_METHOD,
+	OPTION_BACKLIGHT,
 	OPTION_DRI,
 	OPTION_VIDEO_KEY,
 	OPTION_COLOR_KEY,
@@ -42,6 +43,7 @@
 
 static OptionInfoRec intel_options[] = {
 	{OPTION_ACCEL_METHOD,	"AccelMethod",	OPTV_STRING,	{0},	0},
+	{OPTION_BACKLIGHT,	"Backlight",	OPTV_STRING,	{0},	0},
 	{OPTION_DRI,		"DRI",		OPTV_BOOLEAN,	{0},	TRUE},
 	{OPTION_COLOR_KEY,	"ColorKey",	OPTV_INTEGER,	{0},	FALSE},
 	{OPTION_VIDEO_KEY,	"VideoKey",	OPTV_INTEGER,	{0},	FALSE},

Attachment: pgpQUScUP9Bm9.pgp
Description: PGP signature


Reply to: