From c045684987b30aa25d9bf5db4b6440b005919372 Mon Sep 17 00:00:00 2001
From: Rudolf Cornelissen
Date: Thu, 4 Mar 2004 09:01:45 +0000
Subject: [PATCH] more panel detection stuff: looks like it will work for both
DVI and laptops..
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6895 a95241bf-73f2-0310-859d-f6bbb57e9c96
---
.../private/graphics/nvidia/DriverInterface.h | 15 +-
.../accelerants/nvidia/engine/nv_general.c | 4 +-
.../accelerants/nvidia/engine/nv_info.c | 162 +++++++++++-------
.../drivers/graphics/nvidia/UPDATE.html | 4 +-
4 files changed, 112 insertions(+), 73 deletions(-)
diff --git a/headers/private/graphics/nvidia/DriverInterface.h b/headers/private/graphics/nvidia/DriverInterface.h
index 712aa89eec..0361369a4f 100644
--- a/headers/private/graphics/nvidia/DriverInterface.h
+++ b/headers/private/graphics/nvidia/DriverInterface.h
@@ -5,7 +5,7 @@
Other authors:
Mark Watson;
Apsed;
- Rudolf Cornelissen 10/2002-2/2004.
+ Rudolf Cornelissen 10/2002-3/2004.
*/
#ifndef DRIVERINTERFACE_H
@@ -220,11 +220,18 @@ typedef struct {
uint32 card_type; /* see card_type enum above */
uint32 card_arch; /* see card_arch enum above */
bool laptop; /* mobile chipset or not ('internal' flatpanel!) */
- uint16 panel_width; /* native horizontal resolution for laptop panels */
- uint16 panel_height; /* navive vertical resolution for laptop panels */
+ bool slaved_tmds1; /* external TMDS encoder active on CRTC1 */
+ bool slaved_tmds2; /* external TMDS encoder active on CRTC2 */
+ bool master_tmds1; /* on die TMDS encoder active on CRTC1 */
+ bool master_tmds2; /* on die TMDS encoder active on CRTC2 */
+ bool tmds1_active; /* found panel on CRTC1 that is active */
+ bool tmds2_active; /* found panel on CRTC2 that is active */
+ uint16 panel1_width; /* native horizontal resolution for digital panels */
+ uint16 panel1_height; /* navive vertical resolution for digital panels */
+ uint16 panel2_width; /* native horizontal resolution for digital panels */
+ uint16 panel2_height; /* navive vertical resolution for digital panels */
uint32 tvout_chip_type; /* see tvchip_type enum above */
status_t pins_status; /* B_OK if read correctly, B_ERROR if faked */
- bool sdram; /* TRUE if SDRAM card: needed info for 2D acceleration */
/* PINS */
float f_ref; /* PLL reference-oscillator frequency (Mhz) */
diff --git a/src/add-ons/accelerants/nvidia/engine/nv_general.c b/src/add-ons/accelerants/nvidia/engine/nv_general.c
index 924ecf271b..2404396db3 100644
--- a/src/add-ons/accelerants/nvidia/engine/nv_general.c
+++ b/src/add-ons/accelerants/nvidia/engine/nv_general.c
@@ -80,7 +80,7 @@ status_t nv_general_powerup()
{
status_t status;
- LOG(1,("POWERUP: nVidia (open)BeOS Accelerant 0.10-1 running.\n"));
+ LOG(1,("POWERUP: nVidia (open)BeOS Accelerant 0.10-2 running.\n"));
/* preset no laptop */
si->ps.laptop = false;
@@ -660,7 +660,7 @@ status_t nv_set_cas_latency()
switch(si->ps.card_type)
{
case G550:
- if (!si->ps.sdram)
+ if (0)//!si->ps.sdram)
{
LOG(4,("INIT: G100 SGRAM CAS tuning not permitted, aborting.\n"));
return B_OK;
diff --git a/src/add-ons/accelerants/nvidia/engine/nv_info.c b/src/add-ons/accelerants/nvidia/engine/nv_info.c
index 51ea35a94a..73772a49fa 100644
--- a/src/add-ons/accelerants/nvidia/engine/nv_info.c
+++ b/src/add-ons/accelerants/nvidia/engine/nv_info.c
@@ -8,6 +8,7 @@
#include "nv_std.h"
+static void detect_panels(void);
static void pinsnv4_fake(void);
static void pinsnv5_nv5m64_fake(void);
static void pinsnv6_fake(void);
@@ -165,8 +166,8 @@ static status_t pins5_read(uint8 *pins, uint8 length)
else si->ps.f_ref = 27.00000;
/* make sure SGRAM functions only get enabled if SGRAM mounted */
- if ((pins[114] & 0x18) == 0x08) si->ps.sdram = false;
- else si->ps.sdram = true;
+// if ((pins[114] & 0x18) == 0x08) si->ps.sdram = false;
+// else si->ps.sdram = true;
/* various registers */
si->ps.secondary_head = (pins[117] & 0x70);
@@ -242,11 +243,21 @@ void fake_pins(void)
}
*/
- /* detect if the BIOS enabled a LCD (internal panel or DVI) or TVout */
+ /* find out the BIOS preprogrammed panel use status... */
+ detect_panels();
+}
+
+static void detect_panels()
+{
+ /* detect if the BIOS enabled LCD's (internal panels or DVI) or TVout */
{
- /* both TMDS transmitters (used for LCD/DVI) and TVencoders are slave devices */
- bool slavedev1_active = false, slavedev2_active = false;
- bool tvout1_active = false, tvout2_active = false;
+ /* both external TMDS transmitters (used for LCD/DVI) and external TVencoders
+ * use the CRTC's in slaved mode. */
+ /* Note:
+ * It looks like GeForceFX cards have on die TMDS encoders that nolonger
+ * require the CRTC to be slaved. */
+ bool slaved_for_dev1 = false, slaved_for_dev2 = false;
+ bool tvout1 = false, tvout2 = false;
/* check primary head: */
/* enable access to CRTC1 on dualhead cards */
@@ -256,11 +267,11 @@ void fake_pins(void)
CRTCW(LOCK, 0x57);
CRTCW(VSYNCE ,(CRTCR(VSYNCE) & 0x7f));
/* detect active slave device (if any) */
- slavedev1_active = (CRTCR(PIXEL) & 0x80);
- if (slavedev1_active)
+ slaved_for_dev1 = (CRTCR(PIXEL) & 0x80);
+ if (slaved_for_dev1)
{
/* if the panel isn't selected, tvout is.. */
- tvout1_active = !(CRTCR(LCD) & 0x01);
+ tvout1 = !(CRTCR(LCD) & 0x01);
}
if (si->ps.secondary_head)
@@ -272,40 +283,78 @@ void fake_pins(void)
CRTCW(LOCK, 0x57);
CRTCW(VSYNCE ,(CRTCR(VSYNCE) & 0x7f));
/* detect active slave device (if any) */
- slavedev2_active = (CRTCR(PIXEL) & 0x80);
- if (slavedev2_active)
+ slaved_for_dev2 = (CRTCR(PIXEL) & 0x80);
+ if (slaved_for_dev2)
{
/* if the panel isn't selected, tvout is.. */
- tvout2_active = !(CRTCR(LCD) & 0x01);
+ tvout2 = !(CRTCR(LCD) & 0x01);
}
}
- /* fixme: doing some logging, but (also) use for DVI outputs on non-laptops.. */
- if (slavedev1_active && ! tvout1_active)
+ /* do some presets */
+ si->ps.panel1_width = 0;
+ si->ps.panel1_height = 0;
+ si->ps.panel2_width = 0;
+ si->ps.panel2_height = 0;
+ si->ps.slaved_tmds1 = false;
+ si->ps.slaved_tmds2 = false;
+ si->ps.master_tmds1 = false;
+ si->ps.master_tmds2 = false;
+ si->ps.tmds1_active = false;
+ si->ps.tmds2_active = false;
+ /* determine the situation we are in... (regarding flatpanels) */
+ /* fixme: add VESA DDC EDID stuff one day... */
+ /* fixme: find out how to program those transmitters one day instead of
+ * relying on the cards BIOS to do it. This adds TVout options where panels
+ * are used!
+ * Currently we'd loose the panel setup while not being able to restore it. */
+ if (slaved_for_dev1 && !tvout1)
{
- LOG(2,("CRTC1 is currently programmed for DFP\n"));
- LOG(2,("panel size is %d x %d\n",
- ((DACR(FP_HDISPEND) & 0x0000ffff) + 1),
- ((DACR(FP_VDISPEND) & 0x0000ffff) + 1)));
+ uint16 width = ((DACR(FP_HDISPEND) & 0x0000ffff) + 1);
+ uint16 height = ((DACR(FP_VDISPEND) & 0x0000ffff) + 1);
+ if ((width >= 640) && (height >= 480))
+ {
+ si->ps.slaved_tmds1 = true;
+ si->ps.tmds1_active = true;
+ si->ps.panel1_width = width;
+ si->ps.panel1_height = height;
+ }
}
- if (slavedev2_active && ! tvout2_active)
+ if (si->ps.secondary_head && slaved_for_dev2 && !tvout2)
{
- LOG(2,("CRTC2 is currently programmed for DFP\n"));
- LOG(2,("panel size is %d x %d\n",
- ((DAC2R(FP_HDISPEND) & 0x0000ffff) + 1),
- ((DAC2R(FP_VDISPEND) & 0x0000ffff) + 1)));
+ uint16 width = ((DAC2R(FP_HDISPEND) & 0x0000ffff) + 1);
+ uint16 height = ((DAC2R(FP_VDISPEND) & 0x0000ffff) + 1);
+ if ((width >= 640) && (height >= 480))
+ {
+ si->ps.slaved_tmds2 = true;
+ si->ps.tmds2_active = true;
+ si->ps.panel2_width = width;
+ si->ps.panel2_height = height;
+ }
}
-
- /* fixme?: assuming laptop panel always on CRTC1 for now... */
- if (si->ps.laptop)
+ if (!si->ps.slaved_tmds1 && !tvout1)
{
- si->ps.panel_width = ((DACR(FP_HDISPEND) & 0x0000ffff) + 1);
- si->ps.panel_height = ((DACR(FP_VDISPEND) & 0x0000ffff) + 1);
+ uint16 width = ((DACR(FP_HDISPEND) & 0x0000ffff) + 1);
+ uint16 height = ((DACR(FP_VDISPEND) & 0x0000ffff) + 1);
+ if ((width >= 640) && (height >= 480))
+ {
+ si->ps.master_tmds1 = true;
+ si->ps.tmds1_active = true;
+ si->ps.panel1_width = width;
+ si->ps.panel1_height = height;
+ }
}
- else
+ if (si->ps.secondary_head && !si->ps.slaved_tmds2 && !tvout2)
{
- si->ps.panel_width = 0;
- si->ps.panel_height = 0;
+ uint16 width = ((DAC2R(FP_HDISPEND) & 0x0000ffff) + 1);
+ uint16 height = ((DAC2R(FP_VDISPEND) & 0x0000ffff) + 1);
+ if ((width >= 640) && (height >= 480))
+ {
+ si->ps.master_tmds2 = true;
+ si->ps.tmds2_active = true;
+ si->ps.panel2_width = width;
+ si->ps.panel2_height = height;
+ }
}
}
}
@@ -337,10 +386,6 @@ static void pinsnv4_fake(void)
//fixme: primary & secondary_dvi should be overrule-able via nv.settings
si->ps.primary_dvi = false;
si->ps.secondary_dvi = false;
-//fixme: is this needed for nv acc?
-//fail-safe mode for now:
- si->ps.sdram = true;
-
/* not used (yet) because no coldstart will be attempted (yet) */
si->ps.std_engine_clock = 90;
si->ps.std_memory_clock = 110;
@@ -373,10 +418,6 @@ static void pinsnv5_nv5m64_fake(void)
//fixme: primary & secondary_dvi should be overrule-able via nv.settings
si->ps.primary_dvi = false;
si->ps.secondary_dvi = false;
-//fixme: is this needed for nv acc?
-//fail-safe mode for now:
- si->ps.sdram = true;
-
/* not used (yet) because no coldstart will be attempted (yet) */
si->ps.std_engine_clock = 125;
si->ps.std_memory_clock = 150;
@@ -409,10 +450,6 @@ static void pinsnv6_fake(void)
//fixme: primary & secondary_dvi should be overrule-able via nv.settings
si->ps.primary_dvi = false;
si->ps.secondary_dvi = false;
-//fixme: is this needed for nv acc?
-//fail-safe mode for now:
- si->ps.sdram = true;
-
/* not used (yet) because no coldstart will be attempted (yet) */
si->ps.std_engine_clock = 100;
si->ps.std_memory_clock = 125;
@@ -446,10 +483,6 @@ static void pinsnv10_arch_fake(void)
//fixme: primary & secondary_dvi should be overrule-able via nv.settings
si->ps.primary_dvi = false;
si->ps.secondary_dvi = false;
-//fixme: is this needed for nv acc?
-//fail-safe mode for now:
- si->ps.sdram = true;
-
/* not used (yet) because no coldstart will be attempted (yet) */
si->ps.std_engine_clock = 120;
si->ps.std_memory_clock = 150;
@@ -483,10 +516,6 @@ static void pinsnv20_arch_fake(void)
//fixme: primary & secondary_dvi should be overrule-able via nv.settings
si->ps.primary_dvi = false;
si->ps.secondary_dvi = false;
-//fixme: is this needed for nv acc?
-//fail-safe mode for now:
- si->ps.sdram = true;
-
/* not used (yet) because no coldstart will be attempted (yet) */
si->ps.std_engine_clock = 175;
si->ps.std_memory_clock = 200;
@@ -520,10 +549,6 @@ static void pinsnv30_arch_fake(void)
//fixme: primary & secondary_dvi should be overrule-able via nv.settings
si->ps.primary_dvi = false;
si->ps.secondary_dvi = false;
-//fixme: is this needed for nv acc?
-//fail-safe mode for now:
- si->ps.sdram = true;
-
/* not used (yet) because no coldstart will be attempted (yet) */
si->ps.std_engine_clock = 190;
si->ps.std_memory_clock = 190;
@@ -768,20 +793,27 @@ void dump_pins(void)
break;
}
LOG(2, ("%s TVout chip detected\n", msg));
- LOG(2,("primary_dvi: "));
- if (si->ps.primary_dvi) LOG(2,("present\n")); else LOG(2,("absent\n"));
- LOG(2,("secondary_dvi: "));
- if (si->ps.secondary_dvi) LOG(2,("present\n")); else LOG(2,("absent\n"));
+// LOG(2,("primary_dvi: "));
+// if (si->ps.primary_dvi) LOG(2,("present\n")); else LOG(2,("absent\n"));
+// LOG(2,("secondary_dvi: "));
+// if (si->ps.secondary_dvi) LOG(2,("present\n")); else LOG(2,("absent\n"));
LOG(2,("card memory_size: %dMb\n", si->ps.memory_size));
- LOG(2,("sdram: "));
- if (si->ps.sdram) LOG(2,("SDRAM card\n")); else LOG(2,("SGRAM card\n"));
LOG(2,("laptop: "));
if (si->ps.laptop) LOG(2,("yes\n")); else LOG(2,("no\n"));
-//fixme: testing...
-// if (si->ps.laptop)
+ if (si->ps.tmds1_active)
{
- LOG(2,("panel width: %d\n", si->ps.panel_width));
- LOG(2,("panel height: %d\n", si->ps.panel_height));
+ LOG(2,("found DFP (digital flatpanel) on CRTC1; CRTC1 is "));
+ if (si->ps.slaved_tmds1) LOG(2,("slaved\n")); else LOG(2,("master\n"));
+ LOG(2,("panel width: %d\n", si->ps.panel1_width));
+ LOG(2,("panel height: %d\n", si->ps.panel1_height));
+
+ }
+ if (si->ps.tmds2_active)
+ {
+ LOG(2,("found DFP (digital flatpanel) on CRTC2; CRTC2 is "));
+ if (si->ps.slaved_tmds2) LOG(2,("slaved\n")); else LOG(2,("master\n"));
+ LOG(2,("panel width: %d\n", si->ps.panel2_width));
+ LOG(2,("panel height: %d\n", si->ps.panel2_height));
}
LOG(2,("INFO: end pinsdump.\n"));
}
diff --git a/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html b/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html
index 4d96a9768e..ef21b650cd 100644
--- a/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html
+++ b/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html
@@ -4,9 +4,9 @@
Changes done for each driverversion:
-head (0.10-1), (Rudolf)
+head (0.10-2), (Rudolf)
- - Trying to detect digital flatpanels... (preliminary stuff)
+
- Trying to detect internal (laptops) and external (DVI) digital flatpanels connected... (preliminary stuff)
nv_driver 0.09, (Rudolf)