From 53f26450a35b19fa56bb1deadd33bb6beeee4178 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 5 Jul 2013 11:53:46 -0500 Subject: [PATCH] RadeonHD: Bit-bang LVDS for edid * Older cards have to use the LVDS_Info table, newer cards also have an ddc pin for EDID. * Some buggy sbios don't inject the EDID into the vbios as they should * This corrects hrev45812 as we need to still call connector_read_mode_lvds to obtain the spread spectrum data for the lvds. * Call connector_read_mode_lvds, bit-bang the connector, choose the best outcome. --- src/add-ons/accelerants/radeon_hd/display.cpp | 39 ++++++++++++------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 7baeedf17c..3a2238c005 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -291,14 +291,36 @@ detect_displays() } #endif + if (gConnector[id]->type == VIDEO_CONNECTOR_LVDS) { + display_mode preferredMode; + bool lvdsInfoFound = connector_read_mode_lvds(id, + &preferredMode); + TRACE("%s: connector(%" B_PRIu32 "): bit-banging LVDS for EDID.\n", + __func__, id); + + gDisplay[displayIndex]->attached = connector_read_edid(id, + &gDisplay[displayIndex]->edidData); + + if (!gDisplay[displayIndex]->attached && lvdsInfoFound) { + // If we didn't find ddc edid data, fallback to lvdsInfo + // We have to call connector_read_mode_lvds first to + // collect SS data for the lvds connector + TRACE("%s: connector(%" B_PRIu32 "): using AtomBIOS LVDS_Info " + "preferred mode\n", __func__, id); + gDisplay[displayIndex]->attached = true; + memcpy(&gDisplay[displayIndex]->preferredMode, + &preferredMode, sizeof(display_mode)); + } + } + // If no display found yet, try more standard detection methods if (gDisplay[displayIndex]->attached == false) { TRACE("%s: connector(%" B_PRIu32 "): bit-banging ddc for EDID.\n", __func__, id); - // Lets try bit-banging edid from connector - gDisplay[displayIndex]->attached - = connector_read_edid(id, &gDisplay[displayIndex]->edidData); + // Bit-bang edid from connector + gDisplay[displayIndex]->attached = connector_read_edid(id, + &gDisplay[displayIndex]->edidData); // Found EDID data? if (gDisplay[displayIndex]->attached) { @@ -334,17 +356,6 @@ detect_displays() } } - // If we haven't found EDID yet and LVDS, check LVDS_Info table - if (gDisplay[displayIndex]->attached == false - && gConnector[id]->type == VIDEO_CONNECTOR_LVDS) { - gDisplay[displayIndex]->attached = connector_read_mode_lvds(id, - &gDisplay[displayIndex]->preferredMode); - if (gDisplay[displayIndex]->attached) { - TRACE("%s: connector(%" B_PRIu32 "): using AtomBIOS LVDS_Info " - "preferred mode\n", __func__, id); - } - } - if (gDisplay[displayIndex]->attached != true) { // Nothing interesting here, move along continue;