Skip to contentSkip to conversation

NV50 backlight brightness

DISCUSSION Aaron Sowry 3 participants 7 messages Oct 19, 2010 – Oct 22, 2010 4 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi,

The NV50 codepath in nouveau_backlight.c invariably sets max_brightness to 1025, regardless of the chipset in question. The maximum brightness is not 1025 for all NV50 chipsets (for example, by setting the brightness via ACPI controls and peeking the brightness register, I find that the maximum brightness level for my a8 card is 0x4001df67 although I am unsure of the significance of the MSB).

This means when anything manipulates the backlight using nouveau controls (in my case, usually g-p-m), I get very low backlight brightnesses. 2 questions:

1) Is this a known problem, and has it been looked at before? My affected laptop is a ThinkPad and I know that some Macbooks are also affected, so I would be surprised if it isn't fairly common.

2) In the absence of a reliable way to determine a card's max_brightness by peeking registers or similar, is some kind of mapping table in the code an acceptable solution for assigning max_brightness values to certain chipsets?

This has been discussed at some length on the RedHat bugzilla here:
https://bugzilla.redhat.com/show_bug.cgi?id=625171

Cheers,
Aaron

_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

#2 lore raw
In reply to a message not in the archive
Quoted 9 lines · Aaron Sowry

Hi,

The NV50 codepath in nouveau_backlight.c invariably sets max_brightness to 1025, regardless of the chipset in question. The maximum brightness is not 1025 for all NV50 chipsets (for example, by setting the brightness via ACPI controls and peeking the brightness register, I find that the maximum brightness level for my a8 card is 0x4001df67 although I am unsure of the significance of the MSB).

This means when anything manipulates the backlight using nouveau controls (in my case, usually g-p-m), I get very low backlight brightnesses. 2 questions:

1) Is this a known problem, and has it been looked at before? My affected laptop is a ThinkPad and I know that some Macbooks are also affected, so I would be surprised if it isn't fairly common.

2) In the absence of a reliable way to determine a card's max_brightness by peeking registers or similar, is some kind of mapping table in the code an acceptable solution for assigning max_brightness values to certain chipsets?

I have a question to you that's important first: if you fix nouveau's max_brightness level, can you actually properly change the brightness?

I have an eDP laptop that shows the same backlight level regardless of what's in that register.

Ben.

Quoted 10 lines

This has been discussed at some length on the RedHat bugzilla here:
https://bugzilla.redhat.com/show_bug.cgi?id=625171

Cheers,
Aaron
_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

#3 lore raw
Quoted 6 lines · Ben Skeggs

I have a question to you that's important first: if you fix nouveau's max_brightness level, can you actually properly change the brightness?

I have an eDP laptop that shows the same backlight level regardless of what's in that register.

By applying the attached patch I can properly change the brightness levels using g-p-m. The only question is what the 0x40000000 bit represents as set by BIOS/ACPI - both 0x40001fff and 0x00001fff seem to work fine as far as brightness levels are concerned.

drivers/gpu/drm/nouveau/nouveau_backlight.c +5 -1
diff -uNrp kernel-2.6.35.fc14.orig/drivers/gpu/drm/nouveau/nouveau_backlight.c kernel-2.6.35.fc14.new/drivers/gpu/drm/nouveau/nouveau_backlight.c
@@ -120,7 +120,11 @@ static int nouveau_nv50_backlight_init(s
 		return 0;
 
 	memset(&props, 0, sizeof(struct backlight_properties));
-	props.max_brightness = 1025;
+	if (dev_priv->chipset >= 0xa8)  
+		props.max_brightness = 0x0001ffff;
+	else
+		props.max_brightness = 1025;
+
 	bd = backlight_device_register("nv_backlight", &dev->pdev->dev, dev,
 				       &nv50_bl_ops, &props);
 	if (IS_ERR(bd))

_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

#5 lore raw
In reply to a message not in the archive
Quoted 9 lines · Aaron Sowry
Quoted 6 lines · Ben Skeggs

I have a question to you that's important first: if you fix nouveau's max_brightness level, can you actually properly change the brightness?

I have an eDP laptop that shows the same backlight level regardless of what's in that register.

By applying the attached patch I can properly change the brightness levels using g-p-m. The only question is what the 0x40000000 bit represents as set by BIOS/ACPI - both 0x40001fff and 0x00001fff seem to work fine as far as brightness levels are concerned.

Ok. I'll look at all the kmmio/vbios data I have tomorrow, and come up with some kind of "solution", it'll likely require tweaking as we see more data.

What value does 0x610084 contain on boot for you?

Ben.

#6 lore raw
Quoted 2 lines · Ben Skeggs

What value does 0x610084 contain on boot for you?

Using the attached patch (hopefully early enough on in the initialisation):

[aaron@jules ~]$ dmesg | grep NV50
[drm] nouveau 0000:01:00.0: Detected an NV50 generation card (0x0a8600a2) NV50 0x00610084: 0xa0000000

What's the relevance of this value?

home/aaron/rpmbuild/BUILD/kernel-2.6.35.fc14/linux-2.6.35.x86_64/drivers/gpu/drm/nouveau/nv50_display.c renamed from home/aaron/rpmbuild/BUILD/kernel-2.6.35.fc14.orig/drivers/gpu/drm/nouveau/nv50_display.c +2 -0
@@ -205,6 +205,8 @@ nv50_display_init(struct drm_device *dev
 
 	NV_DEBUG_KMS(dev, "\n");
 
+	printk("NV50 0x00610084: 0x%08x\n", nv_rd32(dev, 0x00610084));
+
 	nv_wr32(dev, 0x00610184, nv_rd32(dev, 0x00614004));
 	/*
 	 * I think the 0x006101XX range is some kind of main control area

_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

#8 lore raw
In reply to a message not in the archive

Sent from my iPhone

Quoted 10 lines · Aaron Sowry
Quoted 2 lines · Ben Skeggs

What value does 0x610084 contain on boot for you?

Using the attached patch (hopefully early enough on in the initialisation):

[aaron@jules ~]$ dmesg | grep NV50
[drm] nouveau 0000:01:00.0: Detected an NV50 generation card (0x0a8600a2) NV50 0x00610084: 0xa0000000

What's the relevance of this value?

Oops, nothing, that was a typo. 0x61c084 is what I meant :)

Quoted 1 line

<reg_peek.patch>