xf86-video-ati: Branch 'master'

Alex Deucher agd5f at kemper.freedesktop.org
Tue Feb 3 16:46:52 PST 2009


 src/atombios_output.c |    7 ++---
 src/legacy_output.c   |   69 ++++++++++++++++++++++----------------------------
 src/radeon_atombios.c |    2 -
 src/radeon_probe.h    |    2 -
 4 files changed, 36 insertions(+), 44 deletions(-)

New commits:
commit 16e01a5796a8e8b86ad25d3aa45b9e7044dc72d1
Author: Alex Deucher <alexdeucher at gmail.com>
Date:   Tue Feb 3 19:46:10 2009 -0500

    Fix encoder accounting
    
    Should fix bug 19924

diff --git a/src/atombios_output.c b/src/atombios_output.c
index 0827d74..653d207 100644
--- a/src/atombios_output.c
+++ b/src/atombios_output.c
@@ -1194,6 +1194,7 @@ atombios_output_dpms(xf86OutputPtr output, int mode)
 
     switch (mode) {
     case DPMSModeOn:
+	radeon_encoder->devices |= radeon_output->active_device;
 	if (is_dig)
 	    (void)atombios_dig_dpms(output, mode);
 	else {
@@ -1209,12 +1210,12 @@ atombios_output_dpms(xf86OutputPtr output, int mode)
 		ErrorF("Output %s enable failed\n",
 		       device_name[radeon_get_device_index(radeon_output->active_device)]);
 	}
-	radeon_encoder->use_count++;
 	break;
     case DPMSModeStandby:
     case DPMSModeSuspend:
     case DPMSModeOff:
-	if (radeon_encoder->use_count < 2) {
+	radeon_encoder->devices &= ~(radeon_output->active_device);
+	if (!radeon_encoder->devices) {
 	    if (is_dig)
 		(void)atombios_dig_dpms(output, mode);
 	    else {
@@ -1232,8 +1233,6 @@ atombios_output_dpms(xf86OutputPtr output, int mode)
 			   device_name[radeon_get_device_index(radeon_output->active_device)]);
 	    }
 	}
-	if (radeon_encoder->use_count > 0)
-	    radeon_encoder->use_count--;
 	break;
     }
 }
diff --git a/src/legacy_output.c b/src/legacy_output.c
index 82291e5..6223531 100644
--- a/src/legacy_output.c
+++ b/src/legacy_output.c
@@ -903,6 +903,7 @@ legacy_output_dpms(xf86OutputPtr output, int mode)
 
     switch(mode) {
     case DPMSModeOn:
+	radeon_encoder->devices |= radeon_output->active_device;
 	switch (radeon_encoder->encoder_id) {
 	case ENCODER_OBJECT_ID_INTERNAL_LVDS:
 	{
@@ -984,35 +985,35 @@ legacy_output_dpms(xf86OutputPtr output, int mode)
 	    RADEONDacPowerSet(pScrn, TRUE, FALSE);
 	    break;
 	}
-	radeon_encoder->use_count++;
 	break;
     case DPMSModeOff:
     case DPMSModeSuspend:
     case DPMSModeStandby:
-	switch (radeon_encoder->encoder_id) {
-	case ENCODER_OBJECT_ID_INTERNAL_LVDS:
-	    if (radeon_encoder->use_count < 2) {
-		unsigned long tmpPixclksCntl = INPLL(pScrn, RADEON_PIXCLKS_CNTL);
-		ErrorF("disable LVDS\n");
-		if (info->IsMobility || info->IsIGP) {
-		    /* Asic bug, when turning off LVDS_ON, we have to make sure
-		       RADEON_PIXCLK_LVDS_ALWAYS_ON bit is off
-		    */
-		    OUTPLLP(pScrn, RADEON_PIXCLKS_CNTL, 0, ~RADEON_PIXCLK_LVDS_ALWAYS_ONb);
-		}
-		tmp = INREG(RADEON_LVDS_GEN_CNTL);
-		tmp |= RADEON_LVDS_DISPLAY_DIS;
-		tmp &= ~(RADEON_LVDS_ON | RADEON_LVDS_BLON | RADEON_LVDS_EN);
-		OUTREG(RADEON_LVDS_GEN_CNTL, tmp);
-		save->lvds_gen_cntl |= RADEON_LVDS_DISPLAY_DIS;
-		save->lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_BLON | RADEON_LVDS_EN);
-		if (info->IsMobility || info->IsIGP) {
-		    OUTPLL(pScrn, RADEON_PIXCLKS_CNTL, tmpPixclksCntl);
+	radeon_encoder->devices &= ~(radeon_output->active_device);
+	if (!radeon_encoder->devices) {
+	    switch (radeon_encoder->encoder_id) {
+	    case ENCODER_OBJECT_ID_INTERNAL_LVDS:
+		{
+		    unsigned long tmpPixclksCntl = INPLL(pScrn, RADEON_PIXCLKS_CNTL);
+		    ErrorF("disable LVDS\n");
+		    if (info->IsMobility || info->IsIGP) {
+			/* Asic bug, when turning off LVDS_ON, we have to make sure
+			   RADEON_PIXCLK_LVDS_ALWAYS_ON bit is off
+			*/
+			OUTPLLP(pScrn, RADEON_PIXCLKS_CNTL, 0, ~RADEON_PIXCLK_LVDS_ALWAYS_ONb);
+		    }
+		    tmp = INREG(RADEON_LVDS_GEN_CNTL);
+		    tmp |= RADEON_LVDS_DISPLAY_DIS;
+		    tmp &= ~(RADEON_LVDS_ON | RADEON_LVDS_BLON | RADEON_LVDS_EN);
+		    OUTREG(RADEON_LVDS_GEN_CNTL, tmp);
+		    save->lvds_gen_cntl |= RADEON_LVDS_DISPLAY_DIS;
+		    save->lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_BLON | RADEON_LVDS_EN);
+		    if (info->IsMobility || info->IsIGP) {
+			OUTPLL(pScrn, RADEON_PIXCLKS_CNTL, tmpPixclksCntl);
+		    }
 		}
-	    }
-	    break;
-	case ENCODER_OBJECT_ID_INTERNAL_TMDS1:
-	    if (radeon_encoder->use_count < 2) {
+		break;
+	    case ENCODER_OBJECT_ID_INTERNAL_TMDS1:
 		ErrorF("disable FP1\n");
 		tmp = INREG(RADEON_FP_GEN_CNTL);
 		tmp &= ~(RADEON_FP_FPON | RADEON_FP_TMDS_EN);
@@ -1026,10 +1027,8 @@ legacy_output_dpms(xf86OutputPtr output, int mode)
 		    save->fp_2nd_gen_cntl &= ~(RS400_FP_2ND_ON |
 					       RS400_TMDS_2ND_EN);
 		}
-	    }
 	    break;
-	case ENCODER_OBJECT_ID_INTERNAL_DVO1:
-	    if (radeon_encoder->use_count < 2) {
+	    case ENCODER_OBJECT_ID_INTERNAL_DVO1:
 		ErrorF("disable FP2\n");
 		tmp = INREG(RADEON_FP2_GEN_CNTL);
 		tmp |= RADEON_FP2_BLANK_EN;
@@ -1046,20 +1045,16 @@ legacy_output_dpms(xf86OutputPtr output, int mode)
 		    save->fp2_2_gen_cntl &= ~(RS400_FP2_2_ON | RS400_FP2_2_DVO2_EN);
 		    save->fp2_2_gen_cntl |= RS400_FP2_2_BLANK_EN;
 		}
-	    }
-	    break;
-	case ENCODER_OBJECT_ID_INTERNAL_DAC1:
-	    if (radeon_encoder->use_count < 2) {
+		break;
+	    case ENCODER_OBJECT_ID_INTERNAL_DAC1:
 		ErrorF("disable primary dac\n");
 		tmp = INREG(RADEON_CRTC_EXT_CNTL);
 		tmp &= ~RADEON_CRTC_CRT_ON;
 		OUTREG(RADEON_CRTC_EXT_CNTL, tmp);
 		save->crtc_ext_cntl &= ~RADEON_CRTC_CRT_ON;
 		RADEONDacPowerSet(pScrn, FALSE, TRUE);
-	    }
-	    break;
-	case ENCODER_OBJECT_ID_INTERNAL_DAC2:
-	    if (radeon_encoder->use_count < 2) {
+		break;
+	    case ENCODER_OBJECT_ID_INTERNAL_DAC2:
 		if (radeon_output->active_device & (ATOM_DEVICE_TV_SUPPORT)) {
 		    ErrorF("disable TV\n");
 		    tmp = INREG(RADEON_TV_MASTER_CNTL);
@@ -1081,11 +1076,9 @@ legacy_output_dpms(xf86OutputPtr output, int mode)
 		    }
 		}
 		RADEONDacPowerSet(pScrn, FALSE, FALSE);
+		break;
 	    }
-	    break;
 	}
-	if (radeon_encoder->use_count > 0)
-	    radeon_encoder->use_count--;
 	break;
     }
 }
diff --git a/src/radeon_atombios.c b/src/radeon_atombios.c
index 61eb62b..87e89ba 100644
--- a/src/radeon_atombios.c
+++ b/src/radeon_atombios.c
@@ -1644,7 +1644,7 @@ radeon_add_encoder(ScrnInfoPtr pScrn, uint32_t encoder_id, uint32_t device_suppo
 	info->encoders[device_index] = (radeon_encoder_ptr)xcalloc(1,sizeof(radeon_encoder_rec));
 	if (info->encoders[device_index] != NULL) {
 	    info->encoders[device_index]->encoder_id = encoder_id;
-	    info->encoders[device_index]->use_count = 0;
+	    info->encoders[device_index]->devices = 0;
 	    info->encoders[device_index]->dev_priv = NULL;
 	    // add dev_priv stuff
 	    switch (encoder_id) {
diff --git a/src/radeon_probe.h b/src/radeon_probe.h
index a1b261f..1b6ed7b 100644
--- a/src/radeon_probe.h
+++ b/src/radeon_probe.h
@@ -161,7 +161,7 @@ typedef struct _RADEONCrtcPrivateRec {
 
 typedef struct _radeon_encoder {
     uint16_t encoder_id;
-    int use_count;
+    int devices;
     void *dev_priv;
 } radeon_encoder_rec, *radeon_encoder_ptr;
 


More information about the xorg-commit mailing list