From c363019152f3f0c6dbbf2f6dcd600b676646c067 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 18 Apr 2012 21:50:39 +0000 Subject: [PATCH] radeon_hd: Make crtc lookup fault less catastrophic --- src/add-ons/accelerants/radeon_hd/display.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 2fa471205b..d1f0ef47ca 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -388,7 +388,7 @@ display_get_encoder_mode(uint32 connectorIndex) return ATOM_ENCODER_MODE_DVO; } - // Find crtc for connector + // Find crtc for connector so we can identify source of edid data int32 crtc = -1; for (int32 id = 0; id < MAX_DISPLAY; id++) { if (gDisplay[id]->connectorIndex == connectorIndex) { @@ -396,20 +396,21 @@ display_get_encoder_mode(uint32 connectorIndex) break; } } + bool edidDigital = false; if (crtc == -1) { - ERROR("%s: BUG: ran on connector without crtc!\n", __func__); - return ATOM_ENCODER_MODE_CRT; + ERROR("%s: BUG: executed on connector without crtc!\n", __func__); + } else { + edid1_info* edid = &gDisplay[crtc]->edid_info; + edidDigital = edid->display.input_type ? true : false; } - edid1_info* edid = &gDisplay[crtc]->edid_info; - // Normal encoder situations switch (gConnector[connectorIndex]->type) { case VIDEO_CONNECTOR_DVII: case VIDEO_CONNECTOR_HDMIB: /* HDMI-B is DL-DVI; analog works fine */ // TODO: if audio detected on edid and DCE4, ATOM_ENCODER_MODE_DVI // if audio detected on edid not DCE4, ATOM_ENCODER_MODE_HDMI - if (edid->display.input_type) // is digital? + if (edidDigital) return ATOM_ENCODER_MODE_DVI; else return ATOM_ENCODER_MODE_CRT;