From e67080742e73c08636b684b3076dfb7f8dfab8e5 Mon Sep 17 00:00:00 2001 From: Rudolf Cornelissen Date: Mon, 29 Mar 2004 16:09:25 +0000 Subject: [PATCH] updated some panel stuff, added some new card ID's git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7103 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/nvidia/engine/nv_crtc.c | 14 ++- .../accelerants/nvidia/engine/nv_crtc2.c | 14 ++- .../accelerants/nvidia/engine/nv_general.c | 16 +-- .../accelerants/nvidia/engine/nv_info.c | 102 +++++++++++------- .../drivers/graphics/nvidia/UPDATE.html | 7 +- .../kernel/drivers/graphics/nvidia/driver.c | 12 ++- 6 files changed, 106 insertions(+), 59 deletions(-) diff --git a/src/add-ons/accelerants/nvidia/engine/nv_crtc.c b/src/add-ons/accelerants/nvidia/engine/nv_crtc.c index 3a6264e96f..13b021f29a 100644 --- a/src/add-ons/accelerants/nvidia/engine/nv_crtc.c +++ b/src/add-ons/accelerants/nvidia/engine/nv_crtc.c @@ -121,6 +121,9 @@ status_t nv_crtc_set_timing(display_mode target) target.timing.v_total = target.timing.v_display + 6; target.timing.v_sync_start = target.timing.v_total - 3; target.timing.v_sync_end = target.timing.v_total - 2; + + /* disable GPU scaling testmode so automatic scaling will be done */ + DACW(FP_DEBUG1, 0); } /* Modify parameters as required by standard VGA */ @@ -263,6 +266,9 @@ status_t nv_crtc_set_timing(display_mode target) { uint32 iscale_x, iscale_y; + /* powerup both LVDS (laptop panellink) and TMDS (DVI panellink) transmitters */ + DACW(FP_DEBUG0, (DACR(FP_DEBUG0) & 0xcfffffff)); + /* calculate inverse scaling factors used by hardware in 20.12 format */ iscale_x = (((1 << 12) * target.timing.h_display) / si->ps.panel1_width); iscale_y = (((1 << 12) * target.timing.v_display) / si->ps.panel1_height); @@ -270,6 +276,8 @@ status_t nv_crtc_set_timing(display_mode target) /* unblock flatpanel timing programming (or something like that..) */ CRTCW(FP_HTIMING, 0); CRTCW(FP_VTIMING, 0); + LOG(2,("CRTC: FP_HTIMING reg readback: $%02x\n", CRTCR(FP_HTIMING))); + LOG(2,("CRTC: FP_VTIMING reg readback: $%02x\n", CRTCR(FP_VTIMING))); /* enable full width visibility on flatpanel */ DACW(FP_HVALID_S, 0); @@ -279,7 +287,8 @@ status_t nv_crtc_set_timing(display_mode target) DACW(FP_VVALID_E, (si->ps.panel1_height - 1)); /* nVidia cards support upscaling except on NV11 */ - if (si->ps.card_type == NV11) + //fixme? logfiles tell me this is nonsense... + if (0)//si->ps.card_type == NV11) { /* disable last fetched line limiting */ DACW(FP_DEBUG2, 0x00000000); @@ -313,9 +322,6 @@ status_t nv_crtc_set_timing(display_mode target) /* inform panel not to scale */ DACW(FP_TG_CTRL, (DACR(FP_TG_CTRL) & 0xfffffeff)); - /* disable GPU scaling testmode so automatic scaling is done */ - DACW(FP_DEBUG1, 0); - /* GPU scaling is automatically setup by hardware, so only modify this * scalingfactor for non 4:3 (1.33) aspect panels; * let's consider 1280x1024 1:33 aspect (it's 1.25 aspect actually!) */ diff --git a/src/add-ons/accelerants/nvidia/engine/nv_crtc2.c b/src/add-ons/accelerants/nvidia/engine/nv_crtc2.c index 7721bdd9a4..f6965934ef 100644 --- a/src/add-ons/accelerants/nvidia/engine/nv_crtc2.c +++ b/src/add-ons/accelerants/nvidia/engine/nv_crtc2.c @@ -107,6 +107,9 @@ status_t nv_crtc2_set_timing(display_mode target) target.timing.v_total = target.timing.v_display + 6; target.timing.v_sync_start = target.timing.v_total - 3; target.timing.v_sync_end = target.timing.v_total - 2; + + /* disable GPU scaling testmode so automatic scaling will be done */ + DAC2W(FP_DEBUG1, 0); } /* Modify parameters as required by standard VGA */ @@ -246,6 +249,9 @@ status_t nv_crtc2_set_timing(display_mode target) { uint32 iscale_x, iscale_y; + /* powerup both LVDS (laptop panellink) and TMDS (DVI panellink) transmitters */ + DAC2W(FP_DEBUG0, (DAC2R(FP_DEBUG0) & 0xcfffffff)); + /* calculate inverse scaling factors used by hardware in 20.12 format */ iscale_x = (((1 << 12) * target.timing.h_display) / si->ps.panel2_width); iscale_y = (((1 << 12) * target.timing.v_display) / si->ps.panel2_height); @@ -253,6 +259,8 @@ status_t nv_crtc2_set_timing(display_mode target) /* unblock flatpanel timing programming (or something like that..) */ CRTC2W(FP_HTIMING, 0); CRTC2W(FP_VTIMING, 0); + LOG(2,("CRTC2: FP_HTIMING reg readback: $%02x\n", CRTC2R(FP_HTIMING))); + LOG(2,("CRTC2: FP_VTIMING reg readback: $%02x\n", CRTC2R(FP_VTIMING))); /* enable full width visibility on flatpanel */ DAC2W(FP_HVALID_S, 0); @@ -262,7 +270,8 @@ status_t nv_crtc2_set_timing(display_mode target) DAC2W(FP_VVALID_E, (si->ps.panel2_height - 1)); /* nVidia cards support upscaling except on NV11 */ - if (si->ps.card_type == NV11) + //fixme? logfiles tell me this is nonsense... + if (0)//si->ps.card_type == NV11) { /* disable last fetched line limiting */ DAC2W(FP_DEBUG2, 0x00000000); @@ -296,9 +305,6 @@ status_t nv_crtc2_set_timing(display_mode target) /* inform panel not to scale */ DAC2W(FP_TG_CTRL, (DAC2R(FP_TG_CTRL) & 0xfffffeff)); - /* disable GPU scaling testmode so automatic scaling is done */ - DAC2W(FP_DEBUG1, 0); - /* GPU scaling is automatically setup by hardware, so only modify this * scalingfactor for non 4:3 (1.33) aspect panels; * let's consider 1280x1024 1:33 aspect (it's 1.25 aspect actually!) */ diff --git a/src/add-ons/accelerants/nvidia/engine/nv_general.c b/src/add-ons/accelerants/nvidia/engine/nv_general.c index 8b016c19fb..0362c387c5 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-8 running.\n")); + LOG(1,("POWERUP: nVidia (open)BeOS Accelerant 0.10-9 running.\n")); /* preset no laptop */ si->ps.laptop = false; @@ -221,6 +221,7 @@ status_t nv_general_powerup() case 0x018110de: /* Nvidia GeForce4 MX 440 AGP8X */ case 0x018210de: /* Nvidia GeForce4 MX 440SE AGP8X */ case 0x018310de: /* Nvidia GeForce4 MX 420 AGP8X */ + case 0x018510de: /* Nvidia GeForce4 MX 4000 AGP8X */ si->ps.card_type = NV18; si->ps.card_arch = NV10A; LOG(4,("POWERUP: Detected Nvidia GeForce4 MX AGP8X (NV18)\n")); @@ -246,7 +247,7 @@ status_t nv_general_powerup() LOG(4,("POWERUP: Detected Nvidia GeForce4 MX AGP8X (NV18)\n")); status = nvxx_general_powerup(); break; - case 0x018a10de: /* Nvidia Quadro4 280 NVS */ + case 0x018a10de: /* Nvidia Quadro4 280 NVS AGP8X */ case 0x018b10de: /* Nvidia Quadro4 380 XGL */ si->ps.card_type = NV18; si->ps.card_arch = NV10A; @@ -363,10 +364,10 @@ status_t nv_general_powerup() LOG(4,("POWERUP: Detected Nvidia unknown FX (NV31)\n")); status = nvxx_general_powerup(); break; - case 0x031410de: /* Nvidia GeForce FX 5600SE */ + case 0x031410de: /* Nvidia GeForce FX 5600XT */ si->ps.card_type = NV31; si->ps.card_arch = NV30A; - LOG(4,("POWERUP: Detected Nvidia GeForce FX 5600SE (NV31)\n")); + LOG(4,("POWERUP: Detected Nvidia GeForce FX 5600XT (NV31)\n")); status = nvxx_general_powerup(); break; case 0x031610de: /* Nvidia unknown FX Go */ @@ -429,11 +430,10 @@ status_t nv_general_powerup() LOG(4,("POWERUP: Detected Nvidia GeForce FX 5250 Go (NV34)\n")); status = nvxx_general_powerup(); break; - case 0x032610de: /* Nvidia unknown FX Go */ + case 0x032610de: /* Nvidia GeForce FX 5500 */ si->ps.card_type = NV34; si->ps.card_arch = NV30A; - si->ps.laptop = true; - LOG(4,("POWERUP: Detected Nvidia unknown FX Go (NV34)\n")); + LOG(4,("POWERUP: Detected Nvidia GeForce FX 5500 (NV34)\n")); status = nvxx_general_powerup(); break; case 0x032810de: /* Nvidia GeForce FX 5200 Go 32M/64M */ @@ -511,6 +511,8 @@ status_t nv_general_powerup() break; case 0x034110de: /* Nvidia GeForce FX 5700 Ultra */ case 0x034210de: /* Nvidia GeForce FX 5700 */ + case 0x034310de: /* Nvidia GeForce FX 5700LE */ + case 0x034410de: /* Nvidia GeForce FX 5700VE */ si->ps.card_type = NV36; si->ps.card_arch = NV30A; LOG(4,("POWERUP: Detected Nvidia GeForce FX 5700 (NV36)\n")); diff --git a/src/add-ons/accelerants/nvidia/engine/nv_info.c b/src/add-ons/accelerants/nvidia/engine/nv_info.c index 4383506ffd..51c7c13362 100644 --- a/src/add-ons/accelerants/nvidia/engine/nv_info.c +++ b/src/add-ons/accelerants/nvidia/engine/nv_info.c @@ -312,58 +312,82 @@ static void detect_panels() * 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. */ + /* Note: - * NV11 and NV17 cards can't distinquish between head 1 and head 2. */ - if (slaved_for_dev1 && !tvout1) + * NV11 and NV17 cards can't distinquish between head 1 and head 2 except for + * connected laptop panels via the FP_TG_CTRL register (the DAC and DAC2 + * flatpanel registers access the same single set on those cards!); + * furthermore assuming that no DVI exist on non-laptop cards upto and + * including NV17 (for now). */ + //fixme: how about NV18? + if (((si->ps.card_type <= NV17) && si->ps.laptop && + (!(DACR(FP_TG_CTRL) & 0x80000000))) || (si->ps.card_type > NV17)) { - uint16 width = ((DACR(FP_HDISPEND) & 0x0000ffff) + 1); - uint16 height = ((DACR(FP_VDISPEND) & 0x0000ffff) + 1); - if ((width >= 640) && (height >= 480)) + if (slaved_for_dev1 && !tvout1) { - si->ps.slaved_tmds1 = true; - si->ps.tmds1_active = true; - si->ps.panel1_width = width; - si->ps.panel1_height = height; + 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; + } } } - //fixme?!?: how about NV18??, CRTC2 has panel instead of CRTC1??? - if ((si->ps.card_type != NV11) && (si->ps.card_type != NV17) && - si->ps.secondary_head && slaved_for_dev2 && !tvout2) + + //fixme: how about NV18? + if (((si->ps.card_type <= NV17) && si->ps.laptop && + (DAC2R(FP_TG_CTRL) & 0x80000000)) || (si->ps.card_type > NV17)) { - uint16 width = ((DAC2R(FP_HDISPEND) & 0x0000ffff) + 1); - uint16 height = ((DAC2R(FP_VDISPEND) & 0x0000ffff) + 1); - if ((width >= 640) && (height >= 480)) + if (si->ps.secondary_head && slaved_for_dev2 && !tvout2) { - si->ps.slaved_tmds2 = true; - si->ps.tmds2_active = true; - si->ps.panel2_width = width; - si->ps.panel2_height = height; + 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; + } } } - if (!si->ps.slaved_tmds1 && !tvout1) + + //fixme: how about NV18? + if (((si->ps.card_type <= NV17) && si->ps.laptop && + (!(DACR(FP_TG_CTRL) & 0x80000000))) || (si->ps.card_type > NV17)) { - uint16 width = ((DACR(FP_HDISPEND) & 0x0000ffff) + 1); - uint16 height = ((DACR(FP_VDISPEND) & 0x0000ffff) + 1); - if ((width >= 640) && (height >= 480)) + if (!si->ps.slaved_tmds1 && !tvout1) { - si->ps.master_tmds1 = true; - si->ps.tmds1_active = true; - si->ps.panel1_width = width; - si->ps.panel1_height = height; + 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; + } } } - //fixme?!?: how about NV18??, CRTC2 has panel instead of CRTC1??? - if ((si->ps.card_type != NV11) && (si->ps.card_type != NV17) && - si->ps.secondary_head && !si->ps.slaved_tmds2 && !tvout2) + + //fixme: how about NV18? + if (((si->ps.card_type <= NV17) && si->ps.laptop && + (DAC2R(FP_TG_CTRL) & 0x80000000)) || (si->ps.card_type > NV17)) { - uint16 width = ((DAC2R(FP_HDISPEND) & 0x0000ffff) + 1); - uint16 height = ((DAC2R(FP_VDISPEND) & 0x0000ffff) + 1); - if ((width >= 640) && (height >= 480)) + if (si->ps.secondary_head && !si->ps.slaved_tmds2 && !tvout2) { - si->ps.master_tmds2 = true; - si->ps.tmds2_active = true; - si->ps.panel2_width = width; - si->ps.panel2_height = height; + 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; + } } } } @@ -400,6 +424,8 @@ static void detect_panels() LOG(2,("DAC1: FP_DEBUG2: $%08x = (dec) %d\n", DACR(FP_DEBUG2),DACR(FP_DEBUG2))); LOG(2,("DAC1: FP_DEBUG3: $%08x = (dec) %d\n", DACR(FP_DEBUG3),DACR(FP_DEBUG3))); + LOG(2,("DAC1: FUNCSEL: $%08x\n", NV_REG32(NV32_FUNCSEL))); + if(si->ps.secondary_head) { LOG(2,("DAC2: FP_HDISPEND: $%08x = (dec) %d\n", DAC2R(FP_HDISPEND),DAC2R(FP_HDISPEND))); @@ -425,6 +451,8 @@ static void detect_panels() LOG(2,("DAC2: FP_DEBUG1: $%08x = (dec) %d\n", DAC2R(FP_DEBUG1),DAC2R(FP_DEBUG1))); LOG(2,("DAC2: FP_DEBUG2: $%08x = (dec) %d\n", DAC2R(FP_DEBUG2),DAC2R(FP_DEBUG2))); LOG(2,("DAC2: FP_DEBUG3: $%08x = (dec) %d\n", DAC2R(FP_DEBUG3),DAC2R(FP_DEBUG3))); + + LOG(2,("DAC2: FUNCSEL: $%08x\n", NV_REG32(NV32_2FUNCSEL))); } LOG(2,("INFO: End flatpanel registers dump.\n")); } diff --git a/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html b/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html index eb6a63f04f..2ca3cce009 100644 --- a/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html +++ b/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html @@ -4,7 +4,7 @@

Changes done for each driverversion:

-

head (0.10-8), (Rudolf)

+

head (0.10-9), (Rudolf)

NOTE:
dualhead switch mode is not yet operational for flatpanels... diff --git a/src/add-ons/kernel/drivers/graphics/nvidia/driver.c b/src/add-ons/kernel/drivers/graphics/nvidia/driver.c index e26a5d9043..ef8c422047 100644 --- a/src/add-ons/kernel/drivers/graphics/nvidia/driver.c +++ b/src/add-ons/kernel/drivers/graphics/nvidia/driver.c @@ -4,7 +4,7 @@ Other authors: Mark Watson; - Rudolf Cornelissen 3/2002-1/2004. + Rudolf Cornelissen 3/2002-3/2004. */ /* standard kernel driver stuff */ @@ -135,11 +135,12 @@ static uint16 nvidia_device_list[] = { 0x0181, /* Nvidia GeForce4 MX 440 AGP8X */ 0x0182, /* Nvidia GeForce4 MX 440SE AGP8X */ 0x0183, /* Nvidia GeForce4 MX 420 AGP8X */ + 0x0185, /* Nvidia GeForce4 MX 4000 AGP8X */ 0x0186, /* Nvidia GeForce4 448 Go */ 0x0187, /* Nvidia GeForce4 488 Go */ 0x0188, /* Nvidia Quadro4 580 XGL */ 0x0189, /* Nvidia GeForce4 MX AGP8X */ - 0x018a, /* Nvidia Quadro4 280 NVS */ + 0x018a, /* Nvidia Quadro4 280 NVS AGP8X */ 0x018b, /* Nvidia Quadro4 380 XGL */ 0x01a0, /* Nvidia GeForce2 Integrated GPU */ 0x01f0, /* Nvidia GeForce4 MX Integrated GPU */ @@ -169,7 +170,7 @@ static uint16 nvidia_device_list[] = { 0x0311, /* Nvidia GeForce FX 5600 Ultra */ 0x0312, /* Nvidia GeForce FX 5600 */ 0x0313, /* Nvidia unknown FX */ - 0x0314, /* Nvidia GeForce FX 5600SE */ + 0x0314, /* Nvidia GeForce FX 5600XT */ 0x0316, /* Nvidia unknown FX Go */ 0x0317, /* Nvidia unknown FX Go */ 0x031a, /* Nvidia GeForce FX 5600 Go */ @@ -183,7 +184,7 @@ static uint16 nvidia_device_list[] = { 0x0323, /* Nvidia GeForce FX 5200SE */ 0x0324, /* Nvidia GeForce FX 5200 Go */ 0x0325, /* Nvidia GeForce FX 5250 Go */ - 0x0326, /* Nvidia unknown FX Go */ + 0x0326, /* Nvidia GeForce FX 5500 */ 0x0328, /* Nvidia GeForce FX 5200 Go 32M/64M */ 0x0329, /* Nvidia GeForce FX 5200 (PPC) */ 0x032a, /* Nvidia Quadro NVS 280 PCI */ @@ -200,13 +201,14 @@ static uint16 nvidia_device_list[] = { 0x0338, /* Nvidia Quadro FX 3000 */ 0x0341, /* Nvidia GeForce FX 5700 Ultra */ 0x0342, /* Nvidia GeForce FX 5700 */ + 0x0343, /* Nvidia GeForce FX 5700LE */ + 0x0344, /* Nvidia GeForce FX 5700VE */ 0x034e, /* Nvidia Quadro FX 1100 */ 0x034f, /* Nvidia unknown FX */ 0 }; /* not yet included nVidia ID's that are unknown, but used apparantly: - 0x0343 0x0347 0x0348 0x0349