Bug 77831

Summary: [bisected regression] no backlight control any more (MacBook4,1)
Product: Drivers Reporter: Matteo Cypriani (mcy)
Component: Video(DRI - Intel)Assignee: Jani Nikula (jani.nikula)
Status: RESOLVED CODE_FIX    
Severity: normal CC: intel-gfx-bugs
Priority: P2    
Hardware: x86-64   
OS: Linux   
Kernel Version: 3.15 Subsystem:
Regression: Yes Bisected commit-id:
Attachments: kern.log drm.debug=0xe with v3.14-890-gc675949
drm/i915: default to having backlight if VBT not available

Description Matteo Cypriani 2014-06-13 14:03:18 UTC
Created attachment 139641 [details]
kern.log drm.debug=0xe with v3.14-890-gc675949

Hi there,

Sorry Jani, I'm afraid this one is for you too. This is the bug I experienced while testing the kernel from the drm-intel repo for bug 75791, and it is confirmed in v3.15 on the same machine.

Symptoms:
- backlight level stays at maximum
- empty /sys/class/backlight
- this might be unrelated, but X (KDM) almost always initially starts to a black screen, and I have to switch to a VT and back to the X VT to restore the display; more rarely it's the other way round: KDM starts normally but when I switch to a VT it is a black screen

Bisect result:

commit c675949ec58ca50d5a3ae3c757892f1560f6e896
Author: Jani Nikula <jani.nikula@intel.com>
Date:   Wed Apr 9 11:31:37 2014 +0300

    drm/i915: do not setup backlight if not available according to VBT

The kern.log attached was obtained with this commit and drm.debug=0xe; you can see the message "native backlight control not available per VBT" introduced by this commit appear.
Comment 1 Jani Nikula 2014-06-13 14:17:46 UTC
Aww crap. Please attach /sys/kernel/debug/dri/0/i915_opregion.
Comment 2 Jani Nikula 2014-06-13 14:20:23 UTC
Same bisect result but likely different fix required:
https://bugs.freedesktop.org/show_bug.cgi?id=79813
Comment 3 Jani Nikula 2014-06-13 14:28:35 UTC
BTW do you have CONFIG_BACKLIGHT_APPLE=y? Have you tried the module?
Comment 4 Matteo Cypriani 2014-06-13 15:14:57 UTC
(In reply to Jani Nikula from comment #1)
> Aww crap. Please attach /sys/kernel/debug/dri/0/i915_opregion.

You already know it's empty, that didn't change, sorry ;-)


(In reply to Jani Nikula from comment #3)
> BTW do you have CONFIG_BACKLIGHT_APPLE=y? Have you tried the module?

I have CONFIG_BACKLIGHT_APPLE=m, the module apple_bl is loaded and I have a directory "/sys/bus/acpi/drivers/Apple backlight", but I don't know what to do with it.
Comment 5 Jani Nikula 2014-06-16 12:36:53 UTC
(In reply to Matteo Cypriani from comment #4)
> (In reply to Jani Nikula from comment #1)
> > Aww crap. Please attach /sys/kernel/debug/dri/0/i915_opregion.
> 
> You already know it's empty, that didn't change, sorry ;-)
> 
> 
> (In reply to Jani Nikula from comment #3)
> > BTW do you have CONFIG_BACKLIGHT_APPLE=y? Have you tried the module?
> 
> I have CONFIG_BACKLIGHT_APPLE=m, the module apple_bl is loaded and I have a
> directory "/sys/bus/acpi/drivers/Apple backlight", but I don't know what to
> do with it.

Do you have it in /sys/class/backlight? Do you have CONFIG_BACKLIGHT_CLASS_DEVICE=y?
Comment 6 Jani Nikula 2014-06-16 12:42:08 UTC
Please attach the dump produced by intel_bios_dumper tool from the intel-gpu-tools package: http://cgit.freedesktop.org/xorg/app/intel-gpu-tools/
Comment 7 Matteo Cypriani 2014-06-16 14:57:26 UTC
(In reply to Jani Nikula from comment #5)
> Do you have it in /sys/class/backlight?

I don't understand, do I have what? Anyway, /sys/class/backlight is empty, so I guess the answer is no.

> Do you have
> CONFIG_BACKLIGHT_CLASS_DEVICE=y?

I do.


(In reply to Jani Nikula from comment #6)
> Please attach the dump produced by intel_bios_dumper tool

When I run it (as root), I get this error message:
  "Couldn't read graphics card ROM: Input/output error"

Strace exerpt:

open("/sys/bus/pci/devices/0000:00:02.0/rom", O_RDWR|O_CLOEXEC) = 4
fstat(4, {st_mode=S_IFREG|0600, st_size=131072, ...}) = 0
write(4, "1", 1)                        = 1
lseek(4, 0, SEEK_SET)                   = 0
read(4, 0x2426f60, 131072)              = -1 EIO (Input/output error)
lseek(4, 0, SEEK_SET)                   = 0
write(4, "0", 1)                        = 1
close(4)                                = 0

And indeed:

# ls -l /sys/bus/pci/devices/0000:00:02.0/rom
-rw------- 1 root root 131072 Jun 16 10:54 /sys/bus/pci/devices/0000:00:02.0/rom
# hexdump /sys/bus/pci/devices/0000:00:02.0/rom 
hexdump: /sys/bus/pci/devices/0000:00:02.0/rom: Input/output error
# cp /sys/bus/pci/devices/0000:00:02.0/rom /tmp
cp: error reading '/sys/bus/pci/devices/0000:00:02.0/rom': Input/output error
cp: failed to extend '/tmp/rom': Input/output error
zsh: exit 1     cp /sys/bus/pci/devices/0000:00:02.0/rom /tmp

Ay idea how to solve this?
Comment 8 Jani Nikula 2014-06-17 11:55:28 UTC
(In reply to Matteo Cypriani from comment #7)
> (In reply to Jani Nikula from comment #5)
> > Do you have it in /sys/class/backlight?
> 
> I don't understand, do I have what? Anyway, /sys/class/backlight is empty,
> so I guess the answer is no.

Weird, apple_bl should add apple_backlight interface there.
Comment 9 Jani Nikula 2014-06-17 12:04:25 UTC
I don't think I've seen this before.

Jun 13 09:17:38 vt kernel: [   34.282877] [drm:intel_opregion_setup] graphic opregion physical addr: 0x0
Jun 13 09:17:38 vt kernel: [   34.282879] [drm:intel_opregion_setup] ACPI OpRegion not supported!

Jun 13 09:17:38 vt kernel: [   34.282945] i915 0000:00:02.0: Invalid ROM contents
Jun 13 09:17:38 vt kernel: [   34.282947] [drm:intel_parse_bios] VBT signature missing
Jun 13 09:17:38 vt kernel: [   34.282948] [drm] failed to find VBIOS tables
Comment 10 Jani Nikula 2014-06-17 12:44:19 UTC
Created attachment 140081 [details]
drm/i915: default to having backlight if VBT not available

Matteo, please try this patch on top of 3.15 or later.
Comment 11 Matteo Cypriani 2014-06-18 14:58:53 UTC
It works. With that patch applied on top of v3.15 I'm back to the behaviour of v3.14, and after applying the patch that solved bug 75791 I'm back to the everything-works-fine state of v3.13.
Thanks for your work and your reactiveness!
Comment 12 Jani Nikula 2014-06-24 13:24:17 UTC
commit 56c4b63aaf4c2cd91966b2a5e69e5367bea60bbe
Author: Jani Nikula <jani.nikula@intel.com>
Date:   Tue Jun 17 15:47:05 2014 +0300

    drm/i915: default to having backlight if VBT not available

Thanks for the report and testing.