[Intel-gfx] [PATCH] drm/i915: expose a fixed brightness range to userspace

U. Artie Eoff ullysses.a.eoff at intel.com
Tue Nov 11 21:30:38 CET 2014


A userspace brightness range that is larger than the hardware
brightness range does not have a 1:1 mapping and can result
in brightness != actual_brightness for some values.

Expose a fixed brightness range of [0..1000] to userspace so
that all values can map 1:1 into the hardware brightness
range.  This would assume that the hardware range is always
greater than 1000, otherwise we're right back to the original
issue.

This patch is based on Jani Nikula's proposed change in the
referenced ML thread, except use the range [0..1000] instead;
which was recommended by Jesse Barnes for smoother backlight
transitions.

Reference: http://lists.freedesktop.org/archives/intel-gfx/2014-November/055221.html
Signed-off-by: U. Artie Eoff <ullysses.a.eoff at intel.com>
---
 drivers/gpu/drm/i915/intel_panel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 4d63839..f74f5f2 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -1057,7 +1057,7 @@ static int intel_backlight_device_register(struct intel_connector *connector)
 	 * Note: Everything should work even if the backlight device max
 	 * presented to the userspace is arbitrarily chosen.
 	 */
-	props.max_brightness = panel->backlight.max;
+	props.max_brightness = 1000;
 	props.brightness = scale_hw_to_user(connector,
 					    panel->backlight.level,
 					    props.max_brightness);
-- 
1.9.3




More information about the Intel-gfx mailing list