From 3186091bddad9211023c5b502e3fb39774e48b8c Mon Sep 17 00:00:00 2001
From: Rudolf Cornelissen
Date: Mon, 1 Mar 2004 20:00:16 +0000
Subject: [PATCH] added preliminary flatpanel detection stuff
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6844 a95241bf-73f2-0310-859d-f6bbb57e9c96
---
.../private/graphics/nvidia/DriverInterface.h | 9 +-
headers/private/graphics/nvidia/nv_macros.h | 7 ++
.../accelerants/nvidia/engine/nv_general.c | 4 +-
.../accelerants/nvidia/engine/nv_info.c | 88 +++++++++++++++++--
.../drivers/graphics/nvidia/UPDATE.html | 4 +
5 files changed, 101 insertions(+), 11 deletions(-)
diff --git a/headers/private/graphics/nvidia/DriverInterface.h b/headers/private/graphics/nvidia/DriverInterface.h
index 5749c7ae5d..712aa89eec 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-1/2004.
+ Rudolf Cornelissen 10/2002-2/2004.
*/
#ifndef DRIVERINTERFACE_H
@@ -200,10 +200,11 @@ typedef struct {
CH7005,
CH7006,
CH7007,
+ CH7008,
SAA7102,
+ SAA7103,
SAA7104,
- SAA7108,
- SAA7114,
+ SAA7105,
BT868,
BT869,
CX25870,
@@ -219,6 +220,8 @@ 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 */
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 */
diff --git a/headers/private/graphics/nvidia/nv_macros.h b/headers/private/graphics/nvidia/nv_macros.h
index 45232d45ca..fca6133545 100644
--- a/headers/private/graphics/nvidia/nv_macros.h
+++ b/headers/private/graphics/nvidia/nv_macros.h
@@ -482,6 +482,9 @@
#define NVDAC_GENCTRL 0x00680600
#define NVDAC_TSTCTRL 0x00680608
#define NVDAC_TSTDATA 0x00680610
+/* (flatpanel registers) */
+#define NVDAC_FP_VDISPEND 0x00680800
+#define NVDAC_FP_HDISPEND 0x00680820
/* secondary head */
#define NVDAC2_CURPOS 0x00682300
#define NVDAC2_PIXPLLC 0x00680520
@@ -489,6 +492,9 @@
#define NVDAC2_PIXPLLC2 0x0068057c /* NV31, NV36 only */
#define NVDAC2_GENCTRL 0x00682600
#define NVDAC2_TSTCTRL 0x00682608
+/* (flatpanel registers) */
+#define NVDAC2_FP_VDISPEND 0x00682800
+#define NVDAC2_FP_HDISPEND 0x00682820
/* Nvidia CRTC indexed registers */
/* VGA standard registers: */
@@ -524,6 +530,7 @@
#define NVCRTCX_CURCTL2 0x2f
#define NVCRTCX_CURCTL1 0x30
#define NVCRTCX_CURCTL0 0x31
+#define NVCRTCX_LCD 0x33
#define NVCRTCX_INTERLACE 0x39
#define NVCRTCX_EXTRA 0x41
#define NVCRTCX_OWNER 0x44
diff --git a/src/add-ons/accelerants/nvidia/engine/nv_general.c b/src/add-ons/accelerants/nvidia/engine/nv_general.c
index 688521cde3..924ecf271b 100644
--- a/src/add-ons/accelerants/nvidia/engine/nv_general.c
+++ b/src/add-ons/accelerants/nvidia/engine/nv_general.c
@@ -1,7 +1,7 @@
/* Authors:
Mark Watson 12/1999,
Apsed,
- Rudolf Cornelissen 10/2002-2/2004
+ Rudolf Cornelissen 10/2002-3/2004
*/
#define MODULE_BIT 0x00008000
@@ -80,7 +80,7 @@ status_t nv_general_powerup()
{
status_t status;
- LOG(1,("POWERUP: nVidia (open)BeOS Accelerant 0.09-final running.\n"));
+ LOG(1,("POWERUP: nVidia (open)BeOS Accelerant 0.10-1 running.\n"));
/* preset no laptop */
si->ps.laptop = false;
diff --git a/src/add-ons/accelerants/nvidia/engine/nv_info.c b/src/add-ons/accelerants/nvidia/engine/nv_info.c
index 9e8c15c2c2..51ea35a94a 100644
--- a/src/add-ons/accelerants/nvidia/engine/nv_info.c
+++ b/src/add-ons/accelerants/nvidia/engine/nv_info.c
@@ -1,7 +1,7 @@
/* Read initialisation information from card */
/* some bits are hacks, where PINS is not known */
/* Author:
- Rudolf Cornelissen 7/2003-1/2004
+ Rudolf Cornelissen 7/2003-3/2004
*/
#define MODULE_BIT 0x00002000
@@ -241,6 +241,73 @@ void fake_pins(void)
si->ps.tvout_chip_type = ???;
}
*/
+
+ /* detect if the BIOS enabled a LCD (internal panel 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;
+
+ /* check primary head: */
+ /* enable access to CRTC1 on dualhead cards */
+ if (si->ps.secondary_head) CRTCW(OWNER, 0x00);
+
+ /* unlock CRTC1 */
+ CRTCW(LOCK, 0x57);
+ CRTCW(VSYNCE ,(CRTCR(VSYNCE) & 0x7f));
+ /* detect active slave device (if any) */
+ slavedev1_active = (CRTCR(PIXEL) & 0x80);
+ if (slavedev1_active)
+ {
+ /* if the panel isn't selected, tvout is.. */
+ tvout1_active = !(CRTCR(LCD) & 0x01);
+ }
+
+ if (si->ps.secondary_head)
+ {
+ /* check secondary head: */
+ /* enable access to CRTC2 */
+ CRTCW(OWNER, 0x03);
+ /* unlock CRTC2 */
+ CRTCW(LOCK, 0x57);
+ CRTCW(VSYNCE ,(CRTCR(VSYNCE) & 0x7f));
+ /* detect active slave device (if any) */
+ slavedev2_active = (CRTCR(PIXEL) & 0x80);
+ if (slavedev2_active)
+ {
+ /* if the panel isn't selected, tvout is.. */
+ tvout2_active = !(CRTCR(LCD) & 0x01);
+ }
+ }
+
+ /* fixme: doing some logging, but (also) use for DVI outputs on non-laptops.. */
+ if (slavedev1_active && ! tvout1_active)
+ {
+ 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)));
+ }
+ if (slavedev2_active && ! tvout2_active)
+ {
+ 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)));
+ }
+
+ /* fixme?: assuming laptop panel always on CRTC1 for now... */
+ if (si->ps.laptop)
+ {
+ si->ps.panel_width = ((DACR(FP_HDISPEND) & 0x0000ffff) + 1);
+ si->ps.panel_height = ((DACR(FP_VDISPEND) & 0x0000ffff) + 1);
+ }
+ else
+ {
+ si->ps.panel_width = 0;
+ si->ps.panel_height = 0;
+ }
+ }
}
static void pinsnv4_fake(void)
@@ -666,17 +733,20 @@ void dump_pins(void)
case CH7007:
msg = "Chrontel CH7007";
break;
+ case CH7008:
+ msg = "Chrontel CH7008";
+ break;
case SAA7102:
msg = "Philips SAA7102";
break;
+ case SAA7103:
+ msg = "Philips SAA7103";
+ break;
case SAA7104:
msg = "Philips SAA7104";
break;
- case SAA7108:
- msg = "Philips SAA7108";
- break;
- case SAA7114:
- msg = "Philips SAA7114";
+ case SAA7105:
+ msg = "Philips SAA7105";
break;
case BT868:
msg = "Brooktree/Conexant BT868";
@@ -707,5 +777,11 @@ void dump_pins(void)
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)
+ {
+ LOG(2,("panel width: %d\n", si->ps.panel_width));
+ LOG(2,("panel height: %d\n", si->ps.panel_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 98680da59c..4d96a9768e 100644
--- a/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html
+++ b/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html
@@ -4,6 +4,10 @@
Changes done for each driverversion:
+head (0.10-1), (Rudolf)
+
+ - Trying to detect digital flatpanels... (preliminary stuff)
+
nv_driver 0.09, (Rudolf)
- Fixed NV11 trouble with repeating screen(s) on the right side of the monitor;