From 54ce952dd4f773ac5450593d00c27672d9efc2b1 Mon Sep 17 00:00:00 2001 From: Rudolf Cornelissen Date: Thu, 17 Jun 2021 21:58:23 +0000 Subject: [PATCH] intel_extreme: fixed DP/DDI clk init switch and link det, accept EDID still down. --- .../accelerants/intel_extreme/Ports.cpp | 48 ++++++++++++++----- .../accelerants/intel_extreme/accelerant.cpp | 18 ++++--- 2 files changed, 46 insertions(+), 20 deletions(-) diff --git a/src/add-ons/accelerants/intel_extreme/Ports.cpp b/src/add-ons/accelerants/intel_extreme/Ports.cpp index beee02bd55..0cc4a93691 100644 --- a/src/add-ons/accelerants/intel_extreme/Ports.cpp +++ b/src/add-ons/accelerants/intel_extreme/Ports.cpp @@ -790,10 +790,18 @@ HDMIPort::IsConnected() if (portRegister == 0) return false; - bool hasPCH = (gInfo->shared_info->pch_info != INTEL_PCH_NONE); - if (!hasPCH && PortIndex() == INTEL_PORT_C) { - // there's no detection bit on this port - } else if ((read32(portRegister) & DISPLAY_MONITOR_PORT_DETECTED) == 0) + //Notes: + //- DISPLAY_MONITOR_PORT_DETECTED does only tell you *some* sort of digital display is + // connected to the port *if* you have the AUX channel stuff under power. It does not + // tell you which -type- of digital display is connected. + //- Since we rely on the BIOS anyway, let's just use the conclusions it made for us :) + // Beware though: set_display_power_mode() uses this DISPLAY_MONITOR_PORT_ENABLED bit + // for DPMS as well. So we should better buffer our findings here for i.e. possible + // accelerant clones starting up. For DPMS there's currently no problem as this bit + // is only programmed for LVDS, DVI and VGA while we detect presence only for DP and HDMI. + // + //if ((read32(portRegister) & DISPLAY_MONITOR_PORT_DETECTED) == 0) + if ((read32(portRegister) & DISPLAY_MONITOR_PORT_ENABLED) == 0) return false; return HasEDID(); @@ -849,12 +857,26 @@ DisplayPort::IsConnected() if (portRegister == 0) return false; - if ((read32(portRegister) & DISPLAY_MONITOR_PORT_DETECTED) == 0) { + //Notes: + //- DISPLAY_MONITOR_PORT_DETECTED does only tell you *some* sort of digital display is + // connected to the port *if* you have the AUX channel stuff under power. It does not + // tell you which -type- of digital display is connected. + //- Since we rely on the BIOS anyway, let's just use the conclusions it made for us :) + // Beware though: set_display_power_mode() uses this DISPLAY_MONITOR_PORT_ENABLED bit + // for DPMS as well. So we should better buffer our findings here for i.e. possible + // accelerant clones starting up. For DPMS there's currently no problem as this bit + // is only programmed for LVDS, DVI and VGA while we detect presence only for DP and HDMI. + // + //if ((read32(portRegister) & DISPLAY_MONITOR_PORT_DETECTED) == 0) { + if ((read32(portRegister) & DISPLAY_MONITOR_PORT_ENABLED) == 0) { TRACE("%s: %s link not detected\n", __func__, PortName()); return false; } - return HasEDID(); + //since EDID is not correctly implemented yet for this connection type we'll do without it for now + //return HasEDID(); + TRACE("%s: %s link detected\n", __func__, PortName()); + return true; } @@ -1086,8 +1108,9 @@ DigitalDisplayInterface::IsConnected() TRACE("%s: %s Maximum Lanes: %" B_PRId8 "\n", __func__, PortName(), fMaxLanes); - HasEDID(); - + //since EDID is not correctly implemented yet for this connection type we'll do without it for now + //return HasEDID(); + TRACE("%s: %s link detected\n", __func__, PortName()); return true; } @@ -1104,14 +1127,13 @@ DigitalDisplayInterface::SetDisplayMode(display_mode* target, uint32 colorMode) return B_ERROR; } -#if 0 - // Disabled for now as our code doesn't work. Let's hope VESA/EFI has - // already set things up for us during boot. - // Train FDI if it exists + // Setup PanelFitter and Train FDI if it exists + PanelFitter* fitter = fPipe->PFT(); + if (fitter != NULL) + fitter->Enable(*target); FDILink* link = fPipe->FDI(); if (link != NULL) link->Train(target); -#endif pll_divisors divisors; compute_pll_divisors(target, &divisors, false); diff --git a/src/add-ons/accelerants/intel_extreme/accelerant.cpp b/src/add-ons/accelerants/intel_extreme/accelerant.cpp index e81a34c5e2..49fd89033a 100644 --- a/src/add-ons/accelerants/intel_extreme/accelerant.cpp +++ b/src/add-ons/accelerants/intel_extreme/accelerant.cpp @@ -243,6 +243,8 @@ probe_ports() TRACE("lvds: %08" B_PRIx32 "\n", read32(INTEL_DIGITAL_LVDS_PORT)); bool foundLVDS = false; + bool foundDP = false; + bool foundDDI = false; gInfo->port_count = 0; for (int i = INTEL_PORT_A; i <= INTEL_PORT_D; i++) { @@ -251,9 +253,10 @@ probe_ports() if (displayPort == NULL) return B_NO_MEMORY; - if (displayPort->IsConnected()) + if (displayPort->IsConnected()) { + foundDP = true; gInfo->ports[gInfo->port_count++] = displayPort; - else + } else delete displayPort; } @@ -268,9 +271,10 @@ probe_ports() if (ddiPort == NULL) return B_NO_MEMORY; - if (ddiPort->IsConnected()) + if (ddiPort->IsConnected()) { + foundDDI = true; gInfo->ports[gInfo->port_count++] = ddiPort; - else + } else delete ddiPort; } } @@ -292,6 +296,7 @@ probe_ports() TRACE("Probing HDMI %d\n", i); if (has_connected_port((port_index)i, INTEL_PORT_TYPE_ANY)) { // Ensure port not already claimed by something like DDI + TRACE("Port already claimed\n"); continue; } @@ -318,8 +323,8 @@ probe_ports() } else delete lvdsPort; - TRACE("Probing DVI\n"); if (!has_connected_port(INTEL_PORT_ANY, INTEL_PORT_TYPE_ANY)) { + TRACE("Probing DVI\n"); // there's neither DisplayPort nor HDMI so far, assume DVI B for (port_index index = INTEL_PORT_B; index <= INTEL_PORT_C; index = (port_index)(index + 1)) { @@ -353,8 +358,7 @@ probe_ports() if (gInfo->shared_info->pch_info == INTEL_PCH_IBX || gInfo->shared_info->pch_info == INTEL_PCH_CPT) { TRACE("Activating clocks\n"); - // XXX: Is LVDS the same as Panel? - refclk_activate_ilk(foundLVDS); + refclk_activate_ilk(foundLVDS || foundDP || foundDDI); } /* } else if (gInfo->shared_info->pch_info == INTEL_PCH_LPT) {