summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwain G. Ainsworth <oga@openbsd.org>2010-05-31 23:04:41 +0100
committerOwain G. Ainsworth <oga@openbsd.org>2010-06-07 21:53:07 +0100
commit8fc66537939879d9bdfe0491dc03cdf0beede5af (patch)
tree7f1678077da9bb0b73d7f4539d79ce93139a8f09
parentd61177860ba722269f586053e44be3e9cc7fb4c1 (diff)
Make pipe_enabled and the palette functions bow down before ironlake.
The registers changed and we need to cope. Partially from kms.
-rw-r--r--src/i830_driver.c49
1 files changed, 33 insertions, 16 deletions
diff --git a/src/i830_driver.c b/src/i830_driver.c
index a7933e93..363774b5 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1762,40 +1762,57 @@ enum pipe {
static Bool i830_pipe_enabled(intel_screen_private *intel, enum pipe pipe)
{
- if (pipe == PIPE_A)
- return (INREG(PIPEACONF) & PIPEACONF_ENABLE);
- else
- return (INREG(PIPEBCONF) & PIPEBCONF_ENABLE);
+ uint32_t dpll_reg;
+
+ if (IS_IGDNG(intel)) {
+ dpll_reg = (pipe == PIPE_A) ? PCH_DPLL_A : PCH_DPLL_B;
+ } else {
+ dpll_reg = (pipe == PIPE_A) ? DPLL_A : DPLL_B;
+ }
+
+ return (INREG(dpll_reg) & DPLL_VCO_ENABLE);
}
static void i830_save_palette(intel_screen_private *intel, enum pipe pipe)
{
+ uint32_t reg = (pipe == PIPE_A ? PALETTE_A : PALETTE_B);
+ uint32_t *array;
int i;
if (!i830_pipe_enabled(intel, pipe))
return;
- for(i= 0; i < 256; i++) {
- if (pipe == PIPE_A)
- intel->savePaletteA[i] = INREG(PALETTE_A + (i << 2));
- else
- intel->savePaletteB[i] = INREG(PALETTE_B + (i << 2));
- }
+ if (IS_IGDNG(intel))
+ reg = (pipe == PIPE_A) ? LGC_PALETTE_A : LGC_PALETTE_B;
+
+ if (pipe == PIPE_A)
+ array = intel->savePaletteA;
+ else
+ array = intel->savePaletteB;
+
+ for (i = 0; i < 256; i++)
+ array[i] = INREG(reg + (i << 2));
}
static void i830_restore_palette(intel_screen_private *intel, enum pipe pipe)
{
+ uint32_t reg = (pipe == PIPE_A ? PALETTE_A : PALETTE_B);
+ uint32_t *array;
int i;
if (!i830_pipe_enabled(intel, pipe))
return;
- for(i= 0; i < 256; i++) {
- if (pipe == PIPE_A)
- OUTREG(PALETTE_A + (i << 2), intel->savePaletteA[i]);
- else
- OUTREG(PALETTE_B + (i << 2), intel->savePaletteB[i]);
- }
+ if (IS_IGDNG(intel))
+ reg = (pipe == PIPE_A) ? LGC_PALETTE_A : LGC_PALETTE_B;
+
+ if (pipe == PIPE_A)
+ array = intel->savePaletteA;
+ else
+ array = intel->savePaletteB;
+
+ for (i = 0; i < 256; i++)
+ OUTREG(reg + (i << 2), array[i]);
}
static Bool SaveHWState(ScrnInfoPtr scrn)