[PATCH r128] Split up output register functions

Alex Deucher alexdeucher at gmail.com
Wed Jul 9 09:06:47 PDT 2014


On Tue, Jul 8, 2014 at 9:36 PM, Connor Behan <connor.behan at gmail.com> wrote:
> The old code was writing registers more often than it needed to. TMDS
> writes were triggered by changing the mode for an LVDS panel and RMX
> writes were triggered by changing the mode for the second crtc. This
> splits TMDS, LVDS, DAC and RMX calls into their own functions.
>
> Also note that routing bits have been specified. R128_FP_SEL_CRTC2 and
> R128_LVDS_SEL_CRTC2 are always unset to make the panels use the first
> crtc. R128_DAC_CRT_SEL_CRTC2 is unset unless LVDS is already using the
> first crtc.
>
> Signed-off-by: Connor Behan <connor.behan at gmail.com>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  src/r128.h        |   8 +-
>  src/r128_crtc.c   |  20 -----
>  src/r128_driver.c | 217 ++++++++++++++++++++++++++++++------------------------
>  src/r128_output.c |  30 +++++++-
>  src/r128_probe.h  |   2 +
>  5 files changed, 157 insertions(+), 120 deletions(-)
>
> diff --git a/src/r128.h b/src/r128.h
> index fe757f8..d01b5c1 100644
> --- a/src/r128.h
> +++ b/src/r128.h
> @@ -554,7 +554,10 @@ extern int         R128MinBits(int val);
>  extern void        R128InitVideo(ScreenPtr pScreen);
>
>  extern void        R128InitCommonRegisters(R128SavePtr save, R128InfoPtr info);
> -extern void        R128InitFPRegisters(R128SavePtr orig, R128SavePtr save, DisplayModePtr mode, R128InfoPtr info);
> +extern void        R128InitDACRegisters(R128SavePtr orig, R128SavePtr save, xf86OutputPtr output);
> +extern void        R128InitRMXRegisters(R128SavePtr orig, R128SavePtr save, xf86OutputPtr output, DisplayModePtr mode);
> +extern void        R128InitFPRegisters(R128SavePtr orig, R128SavePtr save, xf86OutputPtr output);
> +extern void        R128InitLVDSRegisters(R128SavePtr orig, R128SavePtr save, xf86OutputPtr output);
>  extern Bool        R128InitCrtcBase(xf86CrtcPtr crtc, R128SavePtr save, int x, int y);
>  extern Bool        R128InitCrtcRegisters(ScrnInfoPtr pScrn, R128SavePtr save, DisplayModePtr mode, R128InfoPtr info);
>  extern void        R128InitPLLRegisters(ScrnInfoPtr pScrn, R128SavePtr save, R128PLLPtr pll, double dot_clock);
> @@ -564,7 +567,10 @@ extern Bool        R128InitCrtc2Registers(ScrnInfoPtr pScrn, R128SavePtr save, D
>  extern void        R128InitPLL2Registers(ScrnInfoPtr pScrn, R128SavePtr save, R128PLLPtr pll, double dot_clock);
>  extern Bool        R128InitDDA2Registers(ScrnInfoPtr pScrn, R128SavePtr save, R128PLLPtr pll, R128InfoPtr info, DisplayModePtr mode);
>  extern void        R128RestoreCommonRegisters(ScrnInfoPtr pScrn, R128SavePtr restore);
> +extern void        R128RestoreDACRegisters(ScrnInfoPtr pScrn, R128SavePtr restore);
> +extern void        R128RestoreRMXRegisters(ScrnInfoPtr pScrn, R128SavePtr restore);
>  extern void        R128RestoreFPRegisters(ScrnInfoPtr pScrn, R128SavePtr restore);
> +extern void        R128RestoreLVDSRegisters(ScrnInfoPtr pScrn, R128SavePtr restore);
>  extern void        R128RestoreCrtcRegisters(ScrnInfoPtr pScrn, R128SavePtr restore);
>  extern void        R128RestorePLLRegisters(ScrnInfoPtr pScrn, R128SavePtr restore);
>  extern void        R128RestoreDDARegisters(ScrnInfoPtr pScrn, R128SavePtr restore);
> diff --git a/src/r128_crtc.c b/src/r128_crtc.c
> index 8a6ec44..9c3d0a9 100644
> --- a/src/r128_crtc.c
> +++ b/src/r128_crtc.c
> @@ -133,26 +133,14 @@ static void r128_crtc_mode_prepare(xf86CrtcPtr crtc)
>  static void r128_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePtr adjusted_mode, int x, int y)
>  {
>      ScrnInfoPtr pScrn = crtc->scrn;
> -    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
>      R128CrtcPrivatePtr r128_crtc = crtc->driver_private;
>      R128InfoPtr info = R128PTR(pScrn);
> -    R128OutputType otype = OUTPUT_NONE;
> -
>      double dot_clock = adjusted_mode->Clock / 1000.0;
> -    int i;
>
>      if (r128_crtc->cursor_offset) r128_crtc_hide_cursor(crtc);
>      xf86PrintModeline(pScrn->scrnIndex, adjusted_mode);
>      R128InitCommonRegisters(&info->ModeReg, info);
>
> -    for (i = 0; i < xf86_config->num_output; i++) {
> -        xf86OutputPtr output = xf86_config->output[i];
> -        R128OutputPrivatePtr r128_output = output->driver_private;
> -
> -        if (output->crtc == crtc)
> -            otype = r128_output->type;
> -    }
> -
>      switch (r128_crtc->crtc_id) {
>      case 0:
>          R128InitCrtcRegisters(pScrn, &info->ModeReg, adjusted_mode, info);
> @@ -178,8 +166,6 @@ static void r128_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayMod
>          break;
>      }
>
> -    if (otype == OUTPUT_DVI || otype == OUTPUT_LVDS)
> -        R128InitFPRegisters(&info->SavedReg, &info->ModeReg, adjusted_mode, info);
>      R128RestoreCommonRegisters(pScrn, &info->ModeReg);
>
>      switch (r128_crtc->crtc_id) {
> @@ -195,12 +181,6 @@ static void r128_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayMod
>         break;
>      }
>
> -    if (otype == OUTPUT_DVI || otype == OUTPUT_LVDS)
> -        R128RestoreFPRegisters(pScrn, &info->ModeReg);
> -
> -    /* XXX: InitFPRegisters looks similar to radeon's InitRMXRegisters so
> -     * maybe it should be called from mode_set in the output code.
> -     */
>      if (r128_crtc->cursor_offset) r128_crtc_show_cursor(crtc);
>  }
>
> diff --git a/src/r128_driver.c b/src/r128_driver.c
> index e7833ed..8e15b0c 100644
> --- a/src/r128_driver.c
> +++ b/src/r128_driver.c
> @@ -2376,9 +2376,6 @@ void R128RestoreCrtcRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
>      OUTREGP(R128_CRTC_EXT_CNTL, restore->crtc_ext_cntl,
>             R128_CRTC_VSYNC_DIS | R128_CRTC_HSYNC_DIS | R128_CRTC_DISPLAY_DIS);
>
> -    OUTREGP(R128_DAC_CNTL, restore->dac_cntl,
> -           R128_DAC_RANGE_CNTL | R128_DAC_BLANKING);
> -
>      OUTREG(R128_CRTC_H_TOTAL_DISP,    restore->crtc_h_total_disp);
>      OUTREG(R128_CRTC_H_SYNC_STRT_WID, restore->crtc_h_sync_strt_wid);
>      OUTREG(R128_CRTC_V_TOTAL_DISP,    restore->crtc_v_total_disp);
> @@ -2389,8 +2386,7 @@ void R128RestoreCrtcRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
>  }
>
>  /* Write CRTC2 registers. */
> -void R128RestoreCrtc2Registers(ScrnInfoPtr pScrn,
> -                                      R128SavePtr restore)
> +void R128RestoreCrtc2Registers(ScrnInfoPtr pScrn, R128SavePtr restore)
>  {
>      R128InfoPtr info        = R128PTR(pScrn);
>      unsigned char *R128MMIO = info->MMIO;
> @@ -2407,26 +2403,48 @@ void R128RestoreCrtc2Registers(ScrnInfoPtr pScrn,
>      OUTREG(R128_CRTC2_PITCH,           restore->crtc2_pitch);
>  }
>
> -/* Write flat panel registers */
> -void R128RestoreFPRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
> +/* Write DAC registers */
> +void R128RestoreDACRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
> +{
> +    R128InfoPtr   info      = R128PTR(pScrn);
> +    unsigned char *R128MMIO = info->MMIO;
> +
> +    OUTREGP(R128_DAC_CNTL, restore->dac_cntl,
> +           R128_DAC_RANGE_CNTL | R128_DAC_BLANKING);
> +}
> +
> +/* Write RMX registers */
> +void R128RestoreRMXRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
>  {
>      R128InfoPtr   info      = R128PTR(pScrn);
>      unsigned char *R128MMIO = info->MMIO;
> -    CARD32        tmp;
>
> -    if (info->BIOSDisplay != R128_DUALHEAD)
> -        OUTREG(R128_CRTC2_GEN_CNTL,       restore->crtc2_gen_cntl);
>      OUTREG(R128_FP_HORZ_STRETCH,      restore->fp_horz_stretch);
>      OUTREG(R128_FP_VERT_STRETCH,      restore->fp_vert_stretch);
>      OUTREG(R128_FP_CRTC_H_TOTAL_DISP, restore->fp_crtc_h_total_disp);
>      OUTREG(R128_FP_CRTC_V_TOTAL_DISP, restore->fp_crtc_v_total_disp);
>      OUTREG(R128_FP_H_SYNC_STRT_WID,   restore->fp_h_sync_strt_wid);
>      OUTREG(R128_FP_V_SYNC_STRT_WID,   restore->fp_v_sync_strt_wid);
> -    OUTREG(R128_TMDS_CRC,             restore->tmds_crc);
> -    OUTREG(R128_FP_PANEL_CNTL,        restore->fp_panel_cntl);
> +}
> +
> +/* Write flat panel registers */
> +void R128RestoreFPRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
> +{
> +    R128InfoPtr   info      = R128PTR(pScrn);
> +    unsigned char *R128MMIO = info->MMIO;
> +
> +    OUTREG(R128_TMDS_CRC,              restore->tmds_crc);
> +    OUTREG(R128_TMDS_TRANSMITTER_CNTL, restore->tmds_transmitter_cntl);
> +    OUTREG(R128_FP_PANEL_CNTL,         restore->fp_panel_cntl);
>      OUTREG(R128_FP_GEN_CNTL, restore->fp_gen_cntl & ~(CARD32)R128_FP_BLANK_DIS);
> +}
>
> -    if(info->isDFP) return;
> +/* Write LVDS registers */
> +void R128RestoreLVDSRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
> +{
> +    R128InfoPtr   info      = R128PTR(pScrn);
> +    unsigned char *R128MMIO = info->MMIO;
> +    CARD32        tmp;
>
>      tmp = INREG(R128_LVDS_GEN_CNTL);
>      if ((tmp & (R128_LVDS_ON | R128_LVDS_BLON)) ==
> @@ -2885,7 +2903,10 @@ static void R128Restore(ScrnInfoPtr pScrn)
>          R128RestoreDDARegisters(pScrn, restore);
>          R128RestoreCrtcRegisters(pScrn, restore);
>          R128RestorePLLRegisters(pScrn, restore);
> +        R128RestoreDACRegisters(pScrn, restore);
> +        R128RestoreRMXRegisters(pScrn, restore);
>          R128RestoreFPRegisters(pScrn, restore);
> +        R128RestoreLVDSRegisters(pScrn, restore);
>      }
>
>  #ifdef WITH_VGAHW
> @@ -3058,21 +3079,14 @@ Bool R128InitCrtcRegisters(ScrnInfoPtr pScrn, R128SavePtr save,
>      if((info->DisplayType == MT_DFP) ||
>         (info->DisplayType == MT_LCD))
>      {
> -        save->crtc_ext_cntl = R128_VGA_ATI_LINEAR |
> -                                 R128_XCRT_CNT_EN;
>          save->crtc_gen_cntl &= ~(R128_CRTC_DBL_SCAN_EN |
>                                    R128_CRTC_INTERLACE_EN);
>      }
> -    else
> -        save->crtc_ext_cntl = R128_VGA_ATI_LINEAR |
> +
> +    save->crtc_ext_cntl = R128_VGA_ATI_LINEAR |
>                               R128_XCRT_CNT_EN |
>                               R128_CRTC_CRT_ON;
>
> -    save->dac_cntl      = (R128_DAC_MASK_ALL
> -                          | R128_DAC_VGA_ADR_EN
> -                          | (info->dac6bits ? 0 : R128_DAC_8BIT_EN));
> -
> -
>      if(info->isDFP && !info->isPro2)
>      {
>          if(info->PanelXRes < mode->CrtcHDisplay)
> @@ -3224,36 +3238,50 @@ Bool R128InitCrtc2Registers(ScrnInfoPtr pScrn, R128SavePtr save,
>      return TRUE;
>  }
>
> -/* Define CRTC registers for requested video mode. */
> -void R128InitFPRegisters(R128SavePtr orig, R128SavePtr save,
> -                               DisplayModePtr mode, R128InfoPtr info)
> +/* Define DAC registers for the requested video mode. */
> +void R128InitDACRegisters(R128SavePtr orig, R128SavePtr save, xf86OutputPtr output)
> +{
> +    ScrnInfoPtr pScrn = output->scrn;
> +    R128InfoPtr info = R128PTR(pScrn);
> +    xf86CrtcPtr crtc = output->crtc;
> +    R128CrtcPrivatePtr r128_crtc = crtc->driver_private;
> +
> +    save->dac_cntl = (R128_DAC_MASK_ALL | R128_DAC_VGA_ADR_EN |
> +                      (!r128_crtc->crtc_id ? 0 : R128_DAC_CRT_SEL_CRTC2) |
> +                      (info->dac6bits      ? 0 : R128_DAC_8BIT_EN));
> +}
> +
> +/* Define RMX registers for the requested video mode. */
> +void R128InitRMXRegisters(R128SavePtr orig, R128SavePtr save,
> +                          xf86OutputPtr output, DisplayModePtr mode)
>  {
> +    R128OutputPrivatePtr r128_output = output->driver_private;
> +
>      int   xres = mode->CrtcHDisplay;
>      int   yres = mode->CrtcVDisplay;
>      float Hratio, Vratio;
>
> -    if (info->BIOSDisplay == R128_BIOS_DISPLAY_CRT) {
> -        save->crtc_ext_cntl  |= R128_CRTC_CRT_ON;
> -        save->crtc2_gen_cntl  = 0;
> -        save->fp_gen_cntl     = orig->fp_gen_cntl;
> -        save->fp_gen_cntl    &= ~(R128_FP_FPON |
> -            R128_FP_CRTC_USE_SHADOW_VEND |
> -            R128_FP_CRTC_HORZ_DIV2_EN |
> -            R128_FP_CRTC_HOR_CRT_DIV2_DIS |
> -            R128_FP_USE_SHADOW_EN);
> -        save->fp_gen_cntl    |= (R128_FP_SEL_CRTC2 |
> -                                 R128_FP_CRTC_DONT_SHADOW_VPAR);
> -        save->fp_panel_cntl   = orig->fp_panel_cntl & (CARD32)~R128_FP_DIGON;
> -        save->lvds_gen_cntl   = orig->lvds_gen_cntl &
> -                                   (CARD32)~(R128_LVDS_ON | R128_LVDS_BLON);
> +    save->fp_crtc_h_total_disp = save->crtc_h_total_disp;
> +    save->fp_crtc_v_total_disp = save->crtc_v_total_disp;
> +    save->fp_h_sync_strt_wid   = save->crtc_h_sync_strt_wid;
> +    save->fp_v_sync_strt_wid   = save->crtc_v_sync_strt_wid;
> +
> +    if (r128_output->type != OUTPUT_DVI && r128_output->type != OUTPUT_LVDS)
>          return;
> -    }
>
> -    if (xres > info->PanelXRes) xres = info->PanelXRes;
> -    if (yres > info->PanelYRes) yres = info->PanelYRes;
> +    if (r128_output->PanelXRes == 0 || r128_output->PanelYRes == 0) {
> +        xres = r128_output->PanelXRes;
> +        yres = r128_output->PanelYRes;
> +
> +        Hratio = 1.0;
> +        Vratio = 1.0;
> +    } else {
> +        if (xres > r128_output->PanelXRes) xres = r128_output->PanelXRes;
> +        if (yres > r128_output->PanelYRes) yres = r128_output->PanelYRes;
>
> -    Hratio = (float)xres/(float)info->PanelXRes;
> -    Vratio = (float)yres/(float)info->PanelYRes;
> +        Hratio = (float)xres/(float)r128_output->PanelXRes;
> +        Vratio = (float)yres/(float)r128_output->PanelYRes;
> +    }
>
>      save->fp_horz_stretch =
>         (((((int)(Hratio * R128_HORZ_STRETCH_RATIO_MAX + 0.5))
> @@ -3263,7 +3291,7 @@ void R128InitFPRegisters(R128SavePtr orig, R128SavePtr save,
>                                   R128_HORZ_STRETCH_RESERVED)));
>      save->fp_horz_stretch &= ~R128_HORZ_AUTO_RATIO_FIX_EN;
>      save->fp_horz_stretch &= ~R128_AUTO_HORZ_RATIO;
> -    if (xres == info->PanelXRes)
> +    if (xres == r128_output->PanelXRes)
>           save->fp_horz_stretch &= ~(R128_HORZ_STRETCH_BLEND | R128_HORZ_STRETCH_ENABLE);
>      else
>           save->fp_horz_stretch |=  (R128_HORZ_STRETCH_BLEND | R128_HORZ_STRETCH_ENABLE);
> @@ -3274,67 +3302,60 @@ void R128InitFPRegisters(R128SavePtr orig, R128SavePtr save,
>          (orig->fp_vert_stretch & (R128_VERT_PANEL_SIZE |
>                                    R128_VERT_STRETCH_RESERVED)));
>      save->fp_vert_stretch &= ~R128_VERT_AUTO_RATIO_EN;
> -    if (yres == info->PanelYRes)
> +    if (yres == r128_output->PanelYRes)
>          save->fp_vert_stretch &= ~(R128_VERT_STRETCH_ENABLE | R128_VERT_STRETCH_BLEND);
>      else
>          save->fp_vert_stretch |=  (R128_VERT_STRETCH_ENABLE | R128_VERT_STRETCH_BLEND);
> +}
>
> -    save->fp_gen_cntl = (orig->fp_gen_cntl &
> -                        (CARD32)~(R128_FP_SEL_CRTC2 |
> -                                  R128_FP_CRTC_USE_SHADOW_VEND |
> -                                  R128_FP_CRTC_HORZ_DIV2_EN |
> -                                  R128_FP_CRTC_HOR_CRT_DIV2_DIS |
> -                                  R128_FP_USE_SHADOW_EN));
> -
> -    save->fp_panel_cntl        = orig->fp_panel_cntl;
> -    save->lvds_gen_cntl        = orig->lvds_gen_cntl;
> -    save->tmds_crc             = orig->tmds_crc;
> -
> -    /* Disable CRT output by disabling CRT output and setting the CRT
> -       DAC to use CRTC2, which we set to 0's.  In the future, we will
> -       want to use the dual CRTC capabilities of the R128 to allow both
> -       the flat panel and external CRT to either simultaneously display
> -       the same image or display two different images. */
> -
> -
> -    if(!info->isDFP){
> -        if (info->BIOSDisplay == R128_BIOS_DISPLAY_FP_CRT) {
> -               save->crtc_ext_cntl  |= R128_CRTC_CRT_ON;
> -       } else if (info->BIOSDisplay == R128_DUALHEAD) {
> -               save->crtc_ext_cntl  |= R128_CRTC_CRT_ON;
> -               save->dac_cntl       |= R128_DAC_CRT_SEL_CRTC2;
> -               save->dac_cntl       |= R128_DAC_PALETTE2_SNOOP_EN;
> -        } else {
> -               save->crtc_ext_cntl  &= ~R128_CRTC_CRT_ON;
> -               save->dac_cntl       |= R128_DAC_CRT_SEL_CRTC2;
> -               save->crtc2_gen_cntl  = 0;
> -        }
> -    }
> +/* Define flat panel registers for the requested video mode. */
> +void R128InitFPRegisters(R128SavePtr orig, R128SavePtr save, xf86OutputPtr output)
> +{
> +    xf86CrtcPtr crtc = output->crtc;
> +    R128CrtcPrivatePtr r128_crtc = crtc->driver_private;
>
>      /* WARNING: Be careful about turning on the flat panel */
> -    if(info->isDFP){
> -        save->fp_gen_cntl = orig->fp_gen_cntl;
> -
> -        save->fp_gen_cntl &= ~(R128_FP_CRTC_USE_SHADOW_VEND |
> -                               R128_FP_CRTC_USE_SHADOW_ROWCUR |
> -                               R128_FP_CRTC_HORZ_DIV2_EN |
> -                               R128_FP_CRTC_HOR_CRT_DIV2_DIS |
> -                               R128_FP_CRT_SYNC_SEL |
> -                               R128_FP_USE_SHADOW_EN);
> -
> -        save->fp_panel_cntl  |= (R128_FP_DIGON | R128_FP_BLON);
> -        save->fp_gen_cntl    |= (R128_FP_FPON | R128_FP_TDMS_EN |
> -             R128_FP_CRTC_DONT_SHADOW_VPAR | R128_FP_CRTC_DONT_SHADOW_HEND);
> -        save->tmds_transmitter_cntl = (orig->tmds_transmitter_cntl
> -            & ~(CARD32)R128_TMDS_PLLRST) | R128_TMDS_PLLEN;
> -    }
> +    save->fp_gen_cntl            = orig->fp_gen_cntl;
> +    save->fp_panel_cntl          = orig->fp_panel_cntl;
> +    save->tmds_transmitter_cntl  = orig->tmds_transmitter_cntl;
> +    save->tmds_crc               = orig->tmds_crc;
> +
> +    if (r128_crtc->crtc_id)
> +        save->fp_gen_cntl       |=   R128_FP_SEL_CRTC2;
>      else
> -        save->lvds_gen_cntl  |= (R128_LVDS_ON | R128_LVDS_BLON);
> +        save->fp_gen_cntl       &=  ~R128_FP_SEL_CRTC2;
>
> -    save->fp_crtc_h_total_disp = save->crtc_h_total_disp;
> -    save->fp_crtc_v_total_disp = save->crtc_v_total_disp;
> -    save->fp_h_sync_strt_wid   = save->crtc_h_sync_strt_wid;
> -    save->fp_v_sync_strt_wid   = save->crtc_v_sync_strt_wid;
> +    save->fp_gen_cntl           &= ~(R128_FP_CRTC_USE_SHADOW_VEND |
> +                                     R128_FP_CRTC_USE_SHADOW_ROWCUR |
> +                                     R128_FP_CRTC_HORZ_DIV2_EN |
> +                                     R128_FP_CRTC_HOR_CRT_DIV2_DIS |
> +                                     R128_FP_CRT_SYNC_SEL |
> +                                     R128_FP_USE_SHADOW_EN);
> +
> +    save->fp_gen_cntl           |=  (R128_FP_FPON |
> +                                     R128_FP_TDMS_EN |
> +                                     R128_FP_CRTC_DONT_SHADOW_VPAR |
> +                                     R128_FP_CRTC_DONT_SHADOW_HEND);
> +
> +    save->fp_panel_cntl         |=  (R128_FP_DIGON | R128_FP_BLON);
> +    save->tmds_transmitter_cntl &=  ~R128_TMDS_PLLRST;
> +    save->tmds_transmitter_cntl |=   R128_TMDS_PLLEN;
> +}
> +
> +/* Define LVDS registers for the requested video mode. */
> +void R128InitLVDSRegisters(R128SavePtr orig, R128SavePtr save, xf86OutputPtr output)
> +{
> +    xf86CrtcPtr crtc = output->crtc;
> +    R128CrtcPrivatePtr r128_crtc = crtc->driver_private;
> +
> +    save->lvds_gen_cntl      =  orig->lvds_gen_cntl;
> +
> +    if (r128_crtc->crtc_id)
> +        save->lvds_gen_cntl |=  R128_LVDS_SEL_CRTC2;
> +    else
> +        save->lvds_gen_cntl &= ~R128_LVDS_SEL_CRTC2;
> +
> +    save->lvds_gen_cntl     |= (R128_LVDS_ON | R128_LVDS_BLON);
>  }
>
>  /* Define PLL registers for requested video mode. */
> diff --git a/src/r128_output.c b/src/r128_output.c
> index 89a2958..4638067 100644
> --- a/src/r128_output.c
> +++ b/src/r128_output.c
> @@ -81,6 +81,31 @@ static void r128_mode_prepare(xf86OutputPtr output)
>
>  static void r128_mode_set(xf86OutputPtr output, DisplayModePtr mode, DisplayModePtr adjusted_mode)
>  {
> +    ScrnInfoPtr pScrn = output->scrn;
> +    R128InfoPtr info = R128PTR(pScrn);
> +    R128OutputPrivatePtr r128_output = output->driver_private;
> +    xf86CrtcPtr crtc = output->crtc;
> +    R128CrtcPrivatePtr r128_crtc = crtc->driver_private;
> +
> +    if (r128_crtc->crtc_id == 0)
> +        R128InitRMXRegisters(&info->SavedReg, &info->ModeReg, output, adjusted_mode);
> +
> +    if (r128_output->type == OUTPUT_DVI)
> +        R128InitFPRegisters(&info->SavedReg, &info->ModeReg, output);
> +    else if (r128_output->type == OUTPUT_LVDS)
> +        R128InitLVDSRegisters(&info->SavedReg, &info->ModeReg, output);
> +    else if (r128_output->type == OUTPUT_VGA)
> +        R128InitDACRegisters(&info->SavedReg, &info->ModeReg, output);
> +
> +    if (r128_crtc->crtc_id == 0)
> +        R128RestoreRMXRegisters(pScrn, &info->ModeReg);
> +
> +    if (r128_output->type == OUTPUT_DVI)
> +        R128RestoreFPRegisters(pScrn, &info->ModeReg);
> +    else if (r128_output->type == OUTPUT_LVDS)
> +        R128RestoreLVDSRegisters(pScrn, &info->ModeReg);
> +    else if (r128_output->type == OUTPUT_VGA)
> +        R128RestoreDACRegisters(pScrn, &info->ModeReg);
>  }
>
>  static void r128_mode_commit(xf86OutputPtr output)
> @@ -455,7 +480,10 @@ Bool R128SetupConnectors(ScrnInfoPtr pScrn)
>                 }
>                 r128_output->ddc_i2c = i2c;
>                 R128I2CInit(output, &r128_output->pI2CBus, output->name);
> -           }
> +           } else if (conntype == CONNECTOR_LVDS) {
> +                r128_output->PanelXRes = info->PanelXRes;
> +                r128_output->PanelYRes = info->PanelYRes;
> +            }
>
>              R128SetOutputType(pScrn, r128_output);
>          }
> diff --git a/src/r128_probe.h b/src/r128_probe.h
> index f521a13..95988ec 100644
> --- a/src/r128_probe.h
> +++ b/src/r128_probe.h
> @@ -161,6 +161,8 @@ typedef struct _R128OutputPrivateRec {
>      R128MonitorType MonType;
>      I2CBusPtr pI2CBus;
>      R128I2CBusRec ddc_i2c;
> +    int PanelXRes;
> +    int PanelYRes;
>  } R128OutputPrivateRec, *R128OutputPrivatePtr;
>
>  #define R128_MAX_CRTC 2
> --
> 2.0.0
>
> _______________________________________________
> xorg-driver-ati mailing list
> xorg-driver-ati at lists.x.org
> http://lists.x.org/mailman/listinfo/xorg-driver-ati


More information about the xorg-driver-ati mailing list