diff options
Diffstat (limited to 'src/i830_driver.c')
-rw-r--r-- | src/i830_driver.c | 49 |
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) |