xf86-video-ati: Branch 'master'

Alex Deucher agd5f at kemper.freedesktop.org
Wed Jan 2 16:48:38 PST 2008


 src/atombios_crtc.c   |   34 +++++++----
 src/atombios_output.c |    9 ++
 src/radeon_atombios.c |    2 
 src/radeon_crtc.c     |    2 
 src/radeon_modes.c    |   57 ++++++++++++++++++
 src/radeon_output.c   |  151 +++++++++++++++++++++++++++-----------------------
 6 files changed, 172 insertions(+), 83 deletions(-)

New commits:
commit 1accfdd590828e95e0d68a576c8ee05a06a86e43
Author: Alex Deucher <alex at samba.(none)>
Date:   Wed Jan 2 19:48:28 2008 -0500

    RADEON: various avivo tv-out related clean-ups

diff --git a/src/atombios_crtc.c b/src/atombios_crtc.c
index 6769988..4941e60 100644
--- a/src/atombios_crtc.c
+++ b/src/atombios_crtc.c
@@ -288,31 +288,43 @@ atombios_crtc_mode_set(xf86CrtcPtr crtc,
 
     crtc_timing.ucCRTC = radeon_crtc->crtc_id;
     if (need_tv_timings) {
-      ret = RADEONATOMGetTVTimings(pScrn, need_tv_timings - 1, &crtc_timing, &adjusted_mode->Clock);
-      if (ret == FALSE) {
-	  need_tv_timings = 0;
-      } else {
-	  adjusted_mode->CrtcHDisplay = crtc_timing.usH_Disp;
-      }
+	ret = RADEONATOMGetTVTimings(pScrn, need_tv_timings - 1, &crtc_timing, &adjusted_mode->Clock);
+	if (ret == FALSE) {
+	    need_tv_timings = 0;
+	} else {
+	    adjusted_mode->CrtcHDisplay = crtc_timing.usH_Disp;
+	    adjusted_mode->CrtcHTotal = crtc_timing.usH_Total;
+	    adjusted_mode->CrtcVDisplay = crtc_timing.usV_Disp;
+	    adjusted_mode->CrtcVTotal = crtc_timing.usV_Total;
+	}
     }
-	    
+
     if (!need_tv_timings) {
 	crtc_timing.usH_Total = adjusted_mode->CrtcHTotal;
 	crtc_timing.usH_Disp = adjusted_mode->CrtcHDisplay;
 	crtc_timing.usH_SyncStart = adjusted_mode->CrtcHSyncStart;
 	crtc_timing.usH_SyncWidth = adjusted_mode->CrtcHSyncEnd - adjusted_mode->CrtcHSyncStart;
-	
+
 	crtc_timing.usV_Total = adjusted_mode->CrtcVTotal;
 	crtc_timing.usV_Disp = adjusted_mode->CrtcVDisplay;
 	crtc_timing.usV_SyncStart = adjusted_mode->CrtcVSyncStart;
 	crtc_timing.usV_SyncWidth = adjusted_mode->CrtcVSyncEnd - adjusted_mode->CrtcVSyncStart;
-	
+
 	if (adjusted_mode->Flags & V_NVSYNC)
 	    crtc_timing.susModeMiscInfo.usAccess |= ATOM_VSYNC_POLARITY;
-	
+
 	if (adjusted_mode->Flags & V_NHSYNC)
 	    crtc_timing.susModeMiscInfo.usAccess |= ATOM_HSYNC_POLARITY;
-	
+
+	if (adjusted_mode->Flags & V_CSYNC)
+	    crtc_timing.susModeMiscInfo.usAccess |= ATOM_COMPOSITESYNC;
+
+	if (adjusted_mode->Flags & V_INTERLACE)
+	    crtc_timing.susModeMiscInfo.usAccess |= ATOM_INTERLACE;
+
+	if (adjusted_mode->Flags & V_DBLSCAN)
+	    crtc_timing.susModeMiscInfo.usAccess |= ATOM_DOUBLE_CLOCK_MODE;
+
     }
 
     ErrorF("Mode %dx%d - %d %d %d\n", adjusted_mode->CrtcHDisplay, adjusted_mode->CrtcVDisplay,
diff --git a/src/atombios_output.c b/src/atombios_output.c
index c963368..83b5d92 100644
--- a/src/atombios_output.c
+++ b/src/atombios_output.c
@@ -639,6 +639,15 @@ atombios_dac_detect(ScrnInfoPtr pScrn, xf86OutputPtr output)
     AtomBiosResult ret;
     uint32_t bios_0_scratch;
 
+    if (OUTPUT_IS_TV) {
+	if (xf86ReturnOptValBool(info->Options, OPTION_FORCE_TVOUT, FALSE)) {
+	    if (radeon_output->type == OUTPUT_STV)
+		return MT_STV;
+	    else
+		return MT_CTV;
+	}
+    }
+
     ret = atom_bios_dac_load_detect(info->atomBIOS, output);
     if (ret == ATOM_SUCCESS) {
 	bios_0_scratch = INREG(RADEON_BIOS_0_SCRATCH);
diff --git a/src/radeon_atombios.c b/src/radeon_atombios.c
index 18088b5..4b7421f 100644
--- a/src/radeon_atombios.c
+++ b/src/radeon_atombios.c
@@ -1644,7 +1644,7 @@ RADEONATOMGetTVTimings(ScrnInfoPtr pScrn, int index, SET_CRTC_TIMING_PARAMETERS_
     RADEONInfoPtr  info       = RADEONPTR(pScrn);
     ATOM_ANALOG_TV_INFO *tv_info;
 
-    tv_info = info->atomBIOS->atomDataPtr->AnalogTV_Info;    
+    tv_info = info->atomBIOS->atomDataPtr->AnalogTV_Info;
 
     if (index > MAX_SUPPORTED_TV_TIMING)
 	return FALSE;
diff --git a/src/radeon_crtc.c b/src/radeon_crtc.c
index c3a47b9..207a5a6 100644
--- a/src/radeon_crtc.c
+++ b/src/radeon_crtc.c
@@ -174,7 +174,7 @@ RADEONComputePLL(RADEONPLLPtr pll,
 	    }
 	}
 	if (best_freq == freq)
-		break;
+	    break;
     }
 
     ErrorF("best_freq: %u\n", (unsigned int)best_freq);
diff --git a/src/radeon_modes.c b/src/radeon_modes.c
index e775993..099a5e9 100644
--- a/src/radeon_modes.c
+++ b/src/radeon_modes.c
@@ -80,7 +80,8 @@ void RADEONSetPitch (ScrnInfoPtr pScrn)
 
 }
 
-static DisplayModePtr RADEONTVModes(xf86OutputPtr output)
+static DisplayModePtr
+RADEONTVModes(xf86OutputPtr output)
 {
     DisplayModePtr new  = NULL;
 
@@ -91,6 +92,55 @@ static DisplayModePtr RADEONTVModes(xf86OutputPtr output)
     return new;
 }
 
+static DisplayModePtr
+RADEONATOMTVModes(xf86OutputPtr output)
+{
+    RADEONOutputPrivatePtr radeon_output = output->driver_private;
+    DisplayModePtr  last       = NULL;
+    DisplayModePtr  new        = NULL;
+    DisplayModePtr  first      = NULL;
+    int max_v, i;
+    /* Add some common sizes */
+    int widths[5] = {640, 720, 800, 848, 1024};
+
+    if (radeon_output->tvStd == TV_STD_NTSC ||
+	radeon_output->tvStd == TV_STD_NTSC_J ||
+	radeon_output->tvStd == TV_STD_PAL_M)
+	max_v = 480;
+    else
+	max_v = 600;
+
+    for (i = 0; i < 5; i++) {
+	new = xf86CVTMode(widths[i], max_v, 60.0, FALSE, FALSE);
+
+	new->type       = M_T_DRIVER;
+
+	if (radeon_output->tvStd == TV_STD_NTSC ||
+	    radeon_output->tvStd == TV_STD_NTSC_J ||
+	    radeon_output->tvStd == TV_STD_PAL_M) {
+	    if (widths[i] == 640)
+		new->type |= M_T_PREFERRED;
+	} else {
+	    if (widths[i] == 800)
+		new->type |= M_T_PREFERRED;
+	}
+
+	new->next       = NULL;
+	new->prev       = last;
+
+	if (last) last->next = new;
+	last = new;
+	if (!first) first = new;
+    }
+
+    if (last) {
+	last->next   = NULL; //first;
+	first->prev  = NULL; //last;
+    }
+
+    return first;
+}
+
 /* This is used only when no mode is specified for FP and no ddc is
  * available.  We force it to native mode, if possible.
  */
@@ -221,7 +271,10 @@ RADEONProbeOutputModes(xf86OutputPtr output)
 
     if (output->status == XF86OutputStatusConnected) {
 	if (OUTPUT_IS_TV) {
-	    modes = RADEONTVModes(output);
+	    if (IS_AVIVO_VARIANT)
+		modes = RADEONATOMTVModes(output);
+	    else
+		modes = RADEONTVModes(output);
 	} else if (radeon_output->type == OUTPUT_CV) {
 	    atomBiosResult = RHDAtomBiosFunc(pScrn->scrnIndex, info->atomBIOS,
 					     ATOMBIOS_GET_CV_MODES, &atomBiosArg);
diff --git a/src/radeon_output.c b/src/radeon_output.c
index 4c2df88..ec4f3dc 100644
--- a/src/radeon_output.c
+++ b/src/radeon_output.c
@@ -360,15 +360,7 @@ void RADEONConnectorFindMonitor(ScrnInfoPtr pScrn, xf86OutputPtr output)
 	    if (!radeon_output->MonType) {
 		if (radeon_output->type == OUTPUT_LVDS)
 		    radeon_output->MonType = MT_LCD;
-		else if (OUTPUT_IS_TV) {
-		    if (xf86ReturnOptValBool(info->Options, OPTION_FORCE_TVOUT, FALSE)) {
-			if (radeon_output->type == OUTPUT_STV)
-			    radeon_output->MonType = MT_STV;
-			else
-			    radeon_output->MonType = MT_CTV;
-		    } else
-		        radeon_output->MonType = atombios_dac_detect(pScrn, output);
-		} else
+		else
 		    radeon_output->MonType = atombios_dac_detect(pScrn, output);
 	    }
 	} else {
@@ -519,10 +511,30 @@ radeon_mode_valid(xf86OutputPtr output, DisplayModePtr pMode)
 
     if (OUTPUT_IS_TV) {
 	/* FIXME: Update when more modes are added */
-	if (pMode->HDisplay == 800 && pMode->VDisplay == 600)
-	    return MODE_OK;
-	else
-	    return MODE_CLOCK_RANGE;
+	if (IS_AVIVO_VARIANT) {
+	    int max_v;
+
+	    /* tv-scaler can scale horizontal width
+	     * but frame ends must match tv_pll
+	     * for now cap v size
+	     */
+	    if (radeon_output->tvStd == TV_STD_NTSC ||
+		radeon_output->tvStd == TV_STD_NTSC_J ||
+		radeon_output->tvStd == TV_STD_PAL_M)
+		max_v = 480;
+	    else
+		max_v = 600;
+
+	    if (pMode->VDisplay == max_v)
+		return MODE_OK;
+	    else
+		return MODE_CLOCK_RANGE;
+	} else {
+	    if (pMode->HDisplay == 800 && pMode->VDisplay == 600)
+		return MODE_OK;
+	    else
+		return MODE_CLOCK_RANGE;
+	}
     }
 
     if (radeon_output->type == OUTPUT_LVDS) {
@@ -877,61 +889,63 @@ radeon_create_resources(xf86OutputPtr output)
     }
 
     if (OUTPUT_IS_TV) {
-	tv_hsize_atom = MAKE_ATOM("tv_horizontal_size");
-
-	range[0] = -MAX_H_SIZE;
-	range[1] = MAX_H_SIZE;
-	err = RRConfigureOutputProperty(output->randr_output, tv_hsize_atom,
-					FALSE, TRUE, FALSE, 2, range);
-	if (err != 0) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		       "RRConfigureOutputProperty error, %d\n", err);
-	}
-	data = 0;
-	err = RRChangeOutputProperty(output->randr_output, tv_hsize_atom,
-				     XA_INTEGER, 32, PropModeReplace, 1, &data,
-				     FALSE, TRUE);
-	if (err != 0) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		       "RRChangeOutputProperty error, %d\n", err);
-	}
+	if (!IS_AVIVO_VARIANT) {
+	    tv_hsize_atom = MAKE_ATOM("tv_horizontal_size");
+
+	    range[0] = -MAX_H_SIZE;
+	    range[1] = MAX_H_SIZE;
+	    err = RRConfigureOutputProperty(output->randr_output, tv_hsize_atom,
+					    FALSE, TRUE, FALSE, 2, range);
+	    if (err != 0) {
+		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+			   "RRConfigureOutputProperty error, %d\n", err);
+	    }
+	    data = 0;
+	    err = RRChangeOutputProperty(output->randr_output, tv_hsize_atom,
+					 XA_INTEGER, 32, PropModeReplace, 1, &data,
+					 FALSE, TRUE);
+	    if (err != 0) {
+		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+			   "RRChangeOutputProperty error, %d\n", err);
+	    }
 
-	tv_hpos_atom = MAKE_ATOM("tv_horizontal_position");
+	    tv_hpos_atom = MAKE_ATOM("tv_horizontal_position");
 
-	range[0] = -MAX_H_POSITION;
-	range[1] = MAX_H_POSITION;
-	err = RRConfigureOutputProperty(output->randr_output, tv_hpos_atom,
-					FALSE, TRUE, FALSE, 2, range);
-	if (err != 0) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		       "RRConfigureOutputProperty error, %d\n", err);
-	}
-	data = 0;
-	err = RRChangeOutputProperty(output->randr_output, tv_hpos_atom,
-				     XA_INTEGER, 32, PropModeReplace, 1, &data,
-				     FALSE, TRUE);
-	if (err != 0) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		       "RRChangeOutputProperty error, %d\n", err);
-	}
+	    range[0] = -MAX_H_POSITION;
+	    range[1] = MAX_H_POSITION;
+	    err = RRConfigureOutputProperty(output->randr_output, tv_hpos_atom,
+					    FALSE, TRUE, FALSE, 2, range);
+	    if (err != 0) {
+		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+			   "RRConfigureOutputProperty error, %d\n", err);
+	    }
+	    data = 0;
+	    err = RRChangeOutputProperty(output->randr_output, tv_hpos_atom,
+					 XA_INTEGER, 32, PropModeReplace, 1, &data,
+					 FALSE, TRUE);
+	    if (err != 0) {
+		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+			   "RRChangeOutputProperty error, %d\n", err);
+	    }
 
-	tv_vpos_atom = MAKE_ATOM("tv_vertical_position");
+	    tv_vpos_atom = MAKE_ATOM("tv_vertical_position");
 
-	range[0] = -MAX_V_POSITION;
-	range[1] = MAX_V_POSITION;
-	err = RRConfigureOutputProperty(output->randr_output, tv_vpos_atom,
-					FALSE, TRUE, FALSE, 2, range);
-	if (err != 0) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		       "RRConfigureOutputProperty error, %d\n", err);
-	}
-	data = 0;
-	err = RRChangeOutputProperty(output->randr_output, tv_vpos_atom,
-				     XA_INTEGER, 32, PropModeReplace, 1, &data,
-				     FALSE, TRUE);
-	if (err != 0) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		       "RRChangeOutputProperty error, %d\n", err);
+	    range[0] = -MAX_V_POSITION;
+	    range[1] = MAX_V_POSITION;
+	    err = RRConfigureOutputProperty(output->randr_output, tv_vpos_atom,
+					    FALSE, TRUE, FALSE, 2, range);
+	    if (err != 0) {
+		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+			   "RRConfigureOutputProperty error, %d\n", err);
+	    }
+	    data = 0;
+	    err = RRChangeOutputProperty(output->randr_output, tv_vpos_atom,
+					 XA_INTEGER, 32, PropModeReplace, 1, &data,
+					 FALSE, TRUE);
+	    if (err != 0) {
+		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+			   "RRChangeOutputProperty error, %d\n", err);
+	    }
 	}
 
 	tv_std_atom = MAKE_ATOM("tv_standard");
@@ -998,6 +1012,7 @@ static Bool
 radeon_set_property(xf86OutputPtr output, Atom property,
 		       RRPropertyValuePtr value)
 {
+    RADEONInfoPtr info = RADEONPTR(output->scrn);
     RADEONOutputPrivatePtr radeon_output = output->driver_private;
     INT32 val;
 
@@ -1093,7 +1108,7 @@ radeon_set_property(xf86OutputPtr output, Atom property,
 	    return FALSE;
 
 	radeon_output->hSize = val;
-	if (radeon_output->tv_on)
+	if (radeon_output->tv_on && !IS_AVIVO_VARIANT)
 	    RADEONUpdateHVPosition(output, &output->crtc->mode);
 	return TRUE;
     } else if (property == tv_hpos_atom) {
@@ -1108,7 +1123,7 @@ radeon_set_property(xf86OutputPtr output, Atom property,
 	    return FALSE;
 
 	radeon_output->hPos = val;
-	if (radeon_output->tv_on)
+	if (radeon_output->tv_on && !IS_AVIVO_VARIANT)
 	    RADEONUpdateHVPosition(output, &output->crtc->mode);
 	return TRUE;
     } else if (property == tv_vpos_atom) {
@@ -1123,7 +1138,7 @@ radeon_set_property(xf86OutputPtr output, Atom property,
 	    return FALSE;
 
 	radeon_output->vPos = val;
-	if (radeon_output->tv_on)
+	if (radeon_output->tv_on && !IS_AVIVO_VARIANT)
 	    RADEONUpdateHVPosition(output, &output->crtc->mode);
 	return TRUE;
     } else if (property == tv_std_atom) {
@@ -1180,7 +1195,7 @@ static const xf86OutputFuncsRec radeon_output_funcs = {
 
 void RADEONSetOutputType(ScrnInfoPtr pScrn, RADEONOutputPrivatePtr radeon_output)
 {
-    RADEONOutputType output;
+    RADEONOutputType output = OUTPUT_NONE;
 
     switch(radeon_output->ConnectorType) {
     case CONNECTOR_VGA:


More information about the xorg-commit mailing list