diff options
author | Dave Airlie <airlied@redhat.com> | 2008-08-27 11:12:19 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2008-08-27 11:12:19 +1000 |
commit | a4167e7b572859a998710ee599298e5131f51620 (patch) | |
tree | 766eccb95a91f922581dc4f10f5b3897bb0e3019 | |
parent | 01b2e7368a1f6f14b6d7b6377c804d482bb050cb (diff) |
radeon: avoid oops on encoders with no crtc set
-rw-r--r-- | linux-core/radeon_encoders.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/linux-core/radeon_encoders.c b/linux-core/radeon_encoders.c index ec36e43d..f662872d 100644 --- a/linux-core/radeon_encoders.c +++ b/linux-core/radeon_encoders.c @@ -863,11 +863,18 @@ static void radeon_atom_tmds_dpms(struct drm_encoder *encoder, int mode) struct drm_device *dev = encoder->dev; struct drm_radeon_private *dev_priv = dev->dev_private; struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); - struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc); + struct radeon_crtc *radeon_crtc = NULL; + int crtc_id = 0; int atom_type = -1; int index = -1; uint32_t bios_2_scratch, bios_3_scratch; + if (radeon_crtc) { + radeon_crtc = to_radeon_crtc(encoder->crtc); + crtc_id = radeon_crtc->crtc_id; + } else if (mode == DRM_MODE_DPMS_ON) + return; + if (radeon_encoder->atom_device & ATOM_DEVICE_DFP1_SUPPORT) atom_type = ATOM_DEVICE_DFP1_INDEX; if (radeon_encoder->atom_device & ATOM_DEVICE_DFP2_SUPPORT) @@ -890,7 +897,7 @@ static void radeon_atom_tmds_dpms(struct drm_encoder *encoder, int mode) case ATOM_DEVICE_DFP1_INDEX: index = GetIndexIntoMasterTable(COMMAND, TMDSAOutputControl); bios_2_scratch &= ~ATOM_S3_DFP1_CRTC_ACTIVE; - bios_3_scratch |= (radeon_crtc->crtc_id << 19); + bios_3_scratch |= (crtc_id << 19); switch(mode) { case DRM_MODE_DPMS_ON: bios_2_scratch &= ~ATOM_S2_DFP1_DPMS_STATE; @@ -907,7 +914,7 @@ static void radeon_atom_tmds_dpms(struct drm_encoder *encoder, int mode) case ATOM_DEVICE_DFP2_INDEX: index = GetIndexIntoMasterTable(COMMAND, DVOOutputControl); bios_2_scratch &= ~ATOM_S3_DFP2_CRTC_ACTIVE; - bios_3_scratch |= (radeon_crtc->crtc_id << 23); + bios_3_scratch |= (crtc_id << 23); switch(mode) { case DRM_MODE_DPMS_ON: bios_2_scratch &= ~ATOM_S2_DFP2_DPMS_STATE; @@ -924,7 +931,7 @@ static void radeon_atom_tmds_dpms(struct drm_encoder *encoder, int mode) case ATOM_DEVICE_DFP3_INDEX: index = GetIndexIntoMasterTable(COMMAND, LVTMAOutputControl); bios_2_scratch &= ~ATOM_S3_DFP3_CRTC_ACTIVE; - bios_3_scratch |= (radeon_crtc->crtc_id << 25); + bios_3_scratch |= (crtc_id << 25); switch(mode) { case DRM_MODE_DPMS_ON: bios_2_scratch &= ~ATOM_S2_DFP3_DPMS_STATE; |