summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2009-02-03 19:46:10 -0500
committerAlex Deucher <alexdeucher@gmail.com>2009-02-03 19:46:10 -0500
commit16e01a5796a8e8b86ad25d3aa45b9e7044dc72d1 (patch)
treeeff2ee17959a2873d03fe300d586e708ada5b3f4
parent9abb09d5f43320bd27b336612d39d264fe93549f (diff)
Fix encoder accounting
Should fix bug 19924
-rw-r--r--src/atombios_output.c7
-rw-r--r--src/legacy_output.c69
-rw-r--r--src/radeon_atombios.c2
-rw-r--r--src/radeon_probe.h2
4 files changed, 36 insertions, 44 deletions
diff --git a/src/atombios_output.c b/src/atombios_output.c
index 0827d746..653d2074 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 82291e57..62235311 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 61eb62b0..87e89bac 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 a1b261f9..1b6ed7b1 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;