xf86-video-intel: Branch 'modesetting' - 3 commits - src/i810_reg.h src/i830_common.h src/i830_display.c src/i830_dri.c src/i830_driver.c src/i830.h
Keith Packard
keithp at kemper.freedesktop.org
Mon Jun 19 23:31:25 EEST 2006
src/i810_reg.h | 7 +++++++
src/i830.h | 4 ++++
src/i830_common.h | 9 +++++++++
src/i830_display.c | 16 ++++++++++++++++
src/i830_dri.c | 25 +++++++++++++++++++++++++
src/i830_driver.c | 15 +++++++++++++++
6 files changed, 76 insertions(+)
New commits:
diff-tree 52243d407cad93283956660de4771097ac0b4b2d (from parents)
Merge: 2fb375b665f4802819b89f2277fd6154006c11ee 34f6a8204f1edec015283fc6b5f196e47897e3de
Author: Keith Packard <keithp at neko.keithp.com>
Date: Mon Jun 19 13:28:09 2006 -0700
Merge branch 'modesetting-origin' into modesetting
diff-tree 2fb375b665f4802819b89f2277fd6154006c11ee (from b5acc6b3a3a3a109014d6b971f4722d0f0a4c29a)
Author: Keith Packard <keithp at neko.keithp.com>
Date: Mon Jun 19 13:24:57 2006 -0700
Set vblank interrupt configuration to match pipe configuration
New i915 drm ioctl (in version 1.5) allows the X server to select
which pipe drives vblank interrupts. Use this to drive from the 'preferred'
pipe. Yes, per-window vblanks would be nice in a shared fb environment.
Maybe someday.
diff --git a/src/i830.h b/src/i830.h
index 0c47f7d..aa9b275 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -546,6 +546,7 @@ extern void I830DRIUnmapScreenRegions(Sc
extern Bool I830DRIMapScreenRegions(ScrnInfoPtr pScrn, drmI830Sarea *sarea);
extern void I830DRIUnlock(ScrnInfoPtr pScrn);
extern Bool I830DRILock(ScrnInfoPtr pScrn);
+extern Bool I830DRISetVBlankInterrupt (ScrnInfoPtr pScrn, Bool on);
#endif
extern Bool I830AccelInit(ScreenPtr pScreen);
diff --git a/src/i830_common.h b/src/i830_common.h
index 41b5cc3..a27bc01 100644
--- a/src/i830_common.h
+++ b/src/i830_common.h
@@ -52,6 +52,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define DRM_I830_INIT_HEAP 0x0a
#define DRM_I830_CMDBUFFER 0x0b
#define DRM_I830_DESTROY_HEAP 0x0c
+#define DRM_I830_SET_VBLANK_PIPE 0x0d
+#define DRM_I830_GET_VBLANK_PIPE 0x0e
+
typedef struct {
enum {
@@ -193,5 +196,11 @@ typedef struct {
int region;
} drmI830MemDestroyHeap;
+#define DRM_I830_VBLANK_PIPE_A 1
+#define DRM_I830_VBLANK_PIPE_B 2
+
+typedef struct {
+ int pipe;
+} drmI830VBlankPipe;
#endif /* _I830_DRM_H_ */
diff --git a/src/i830_display.c b/src/i830_display.c
index 7b9773a..a833675 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -631,6 +631,9 @@ i830SetMode(ScrnInfoPtr pScrn, DisplayMo
pI830->planeEnabled[1] ? "enabled" : "disabled",
planeB & DISPPLANE_SEL_PIPE_MASK ? "Pipe B" : "Pipe A");
+#ifdef XF86DRI
+ I830DRISetVBlankInterrupt (pScrn, TRUE);
+#endif
done:
#ifdef XF86DRI
if (didLock)
diff --git a/src/i830_dri.c b/src/i830_dri.c
index 762d3d9..0cd3ed0 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -1449,6 +1449,31 @@ I830UpdateDRIBuffers(ScrnInfoPtr pScrn,
}
Bool
+I830DRISetVBlankInterrupt (ScrnInfoPtr pScrn, Bool on)
+{
+ I830Ptr pI830 = I830PTR(pScrn);
+ drmI830VBlankPipe pipe;
+
+ if (pI830->directRenderingEnabled && pI830->drmMinor >= 5) {
+ if (on) {
+ if (pI830->planeEnabled[1])
+ pipe.pipe = DRM_I830_VBLANK_PIPE_B;
+ else
+ pipe.pipe = DRM_I830_VBLANK_PIPE_A;
+ } else {
+ pipe.pipe = 0;
+ }
+ if (drmCommandWrite(pI830->drmSubFD, DRM_I830_SET_VBLANK_PIPE,
+ &pipe, sizeof (pipe))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I830 Vblank Pipe Setup Failed\n");
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+Bool
I830DRILock(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 3a7b54a..0a04aad 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -2976,6 +2976,9 @@ RestoreHWState(ScrnInfoPtr pScrn)
DPRINTF(PFX, "RestoreHWState\n");
+#ifdef XF86DRI
+ I830DRISetVBlankInterrupt (pScrn, FALSE);
+#endif
vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL);
vgaHWLock(hwp);
diff-tree b5acc6b3a3a3a109014d6b971f4722d0f0a4c29a (from c1c46f882f9a11c383c8d1d1ce393be8fda55ed0)
Author: Keith Packard <keithp at neko.keithp.com>
Date: Mon Jun 19 13:22:17 2006 -0700
Add backlight control to DPMS logic.
Turn backlight on and off in response to DPMS state changes.
diff --git a/src/i810_reg.h b/src/i810_reg.h
index 53c65bb..f7ba930 100644
--- a/src/i810_reg.h
+++ b/src/i810_reg.h
@@ -728,6 +728,13 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN
# define SDVO_MULTIPLIER_MASK 0x000000ff
# define SDVO_DEFAULT_MULTIPLIER 0x00000003
+#define BLC_PWM_CTL 0x61254
+#define BACKLIGHT_MODULATION_FREQ_SHIFT (17)
+#define BACKLIGHT_MODULATION_FREQ_MASK (0x7fff << 17)
+#define BLM_LEGACY_MODE (1 << 16)
+#define BACKLIGHT_DUTY_CYCLE_SHIFT (0)
+#define BACKLIGHT_DUTY_CYCLE_MASK (0xffff)
+
#define FPA0 0x06040
#define FPA1 0x06044
#define FPB0 0x06048
diff --git a/src/i830.h b/src/i830.h
index c60bfbe..0c47f7d 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -440,6 +440,8 @@ typedef struct _I830Rec {
int panel_fixed_vsyncoff;
int panel_fixed_vsyncwidth;
+ int backlight_duty_cycle; /* restore backlight to this value */
+
Bool panel_wants_dither;
unsigned char *VBIOS;
@@ -493,6 +495,7 @@ typedef struct _I830Rec {
CARD32 savePaletteA[256];
CARD32 savePaletteB[256];
CARD32 saveSWF[17];
+ CARD32 saveBLC_PWM_CTL;
} I830Rec;
#define I830PTR(p) ((I830Ptr)((p)->driverPrivate))
diff --git a/src/i830_display.c b/src/i830_display.c
index 95fa936..7b9773a 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -664,7 +664,14 @@ i830SetLVDSPanelPower(ScrnInfoPtr pScrn,
{
I830Ptr pI830 = I830PTR(pScrn);
CARD32 pp_status, pp_control;
+ CARD32 blc_pwm_ctl;
+ int backlight_duty_cycle;
+ blc_pwm_ctl = INREG (BLC_PWM_CTL);
+ backlight_duty_cycle = blc_pwm_ctl & BACKLIGHT_DUTY_CYCLE_MASK;
+ if (backlight_duty_cycle)
+ pI830->backlight_duty_cycle = backlight_duty_cycle;
+
if (on) {
OUTREG(PP_STATUS, INREG(PP_STATUS) | PP_ON);
OUTREG(PP_CONTROL, INREG(PP_CONTROL) | POWER_TARGET_ON);
@@ -672,7 +679,13 @@ i830SetLVDSPanelPower(ScrnInfoPtr pScrn,
pp_status = INREG(PP_STATUS);
pp_control = INREG(PP_CONTROL);
} while (!(pp_status & PP_ON) && !(pp_control & POWER_TARGET_ON));
+ OUTREG(BLC_PWM_CTL,
+ (blc_pwm_ctl & ~BACKLIGHT_DUTY_CYCLE_MASK) |
+ pI830->backlight_duty_cycle);
} else {
+ OUTREG(BLC_PWM_CTL,
+ (blc_pwm_ctl & ~BACKLIGHT_DUTY_CYCLE_MASK));
+
OUTREG(PP_STATUS, INREG(PP_STATUS) & ~PP_ON);
OUTREG(PP_CONTROL, INREG(PP_CONTROL) & ~POWER_TARGET_ON);
do {
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 425ddd5..3a7b54a 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -2925,6 +2925,17 @@ SaveHWState(ScrnInfoPtr pScrn)
pI830->saveLVDS = INREG(LVDS);
pI830->savePP_CONTROL = INREG(PP_CONTROL);
pI830->savePP_CYCLE = INREG(PP_CYCLE);
+ pI830->saveBLC_PWM_CTL = INREG(BLC_PWM_CTL);
+ pI830->backlight_duty_cycle = (pI830->saveBLC_PWM_CTL &
+ BACKLIGHT_DUTY_CYCLE_MASK);
+ /*
+ * If the light is off at server startup, just make it full brightness
+ */
+ if (!pI830->backlight_duty_cycle)
+ pI830->backlight_duty_cycle = ((pI830->saveBLC_PWM_CTL &
+ BACKLIGHT_MODULATION_FREQ_MASK) >>
+ BACKLIGHT_MODULATION_FREQ_SHIFT);
+
if (!IS_I9XX(pI830)) {
pI830->saveDVOA = INREG(DVOA);
@@ -3031,6 +3042,7 @@ RestoreHWState(ScrnInfoPtr pScrn)
}
}
+ OUTREG(BLC_PWM_CTL, pI830->saveBLC_PWM_CTL);
OUTREG(LVDSPP_ON, pI830->savePP_ON);
OUTREG(LVDSPP_OFF, pI830->savePP_OFF);
OUTREG(PP_CYCLE, pI830->savePP_CYCLE);
More information about the xorg-commit
mailing list