[Intel-gfx] Backlight testing
Lukas Hejtmanek
xhejtman at ics.muni.cz
Thu Apr 24 14:47:10 CEST 2008
Hello Jesse,
unfortunately, the latest head of the intel driver has problem with backlight
setting again.
If I change backlight setting while the xserver is running (using /sys
interface), using mplayer resets the setting back to the previous value.
I think it happens if I set backlight level and then call DPMS from On to On.
The current code does not reread the current value. The following patch works
for me:
diff --git a/src/i830_lvds.c b/src/i830_lvds.c
index 1562c21..2452513 100644
--- a/src/i830_lvds.c
+++ b/src/i830_lvds.c
@@ -69,6 +69,7 @@ struct i830_lvds_priv {
void (*set_backlight)(xf86OutputPtr output, int level);
int (*get_backlight)(xf86OutputPtr output);
int backlight_max;
+ char dpms;
enum pfit_mode fitting_mode;
uint32_t pfit_control;
uint32_t pfit_pgm_ratios;
@@ -395,16 +396,20 @@ i830SetLVDSPanelPower(xf86OutputPtr output, Bool on)
* controller for example), so on them, when turning LVDS back on,
* they'll always re-maximize the brightness.
*/
- if (!(INREG(PP_CONTROL) & POWER_TARGET_ON) &&
+ if (!(INREG(PP_CONTROL) & POWER_TARGET_ON) &&
dev_priv->backlight_duty_cycle == 0)
dev_priv->backlight_duty_cycle = dev_priv->backlight_max;
+ if (!dev_priv->dpms)
+ dev_priv->backlight_duty_cycle = dev_priv->get_backlight(output);
+
OUTREG(PP_CONTROL, INREG(PP_CONTROL) | POWER_TARGET_ON);
do {
pp_status = INREG(PP_STATUS);
} while ((pp_status & PP_ON) == 0);
dev_priv->set_backlight(output, dev_priv->backlight_duty_cycle);
+ dev_priv->dpms = 0;
} else {
/*
* Only save the current backlight value if we're going from
@@ -413,6 +418,7 @@ i830SetLVDSPanelPower(xf86OutputPtr output, Bool on)
if (INREG(PP_CONTROL) & POWER_TARGET_ON)
dev_priv->backlight_duty_cycle = dev_priv->get_backlight(output);
dev_priv->set_backlight(output, 0);
+ dev_priv->dpms = 1;
OUTREG(PP_CONTROL, INREG(PP_CONTROL) & ~POWER_TARGET_ON);
do {
@@ -1222,6 +1228,7 @@ i830_lvds_init(ScrnInfoPtr pScrn)
dev_priv = (struct i830_lvds_priv *) (intel_output + 1);
intel_output->dev_priv = dev_priv;
+ dev_priv->dpms = 0;
/* Set up the LVDS DDC channel. Most panels won't support it, but it can
* be useful if available.
--
Lukáš Hejtmánek
More information about the Intel-gfx
mailing list