From ecaef637fac6e0c058a095e4592ce440b4063554 Mon Sep 17 00:00:00 2001 From: Rudolf Cornelissen Date: Thu, 17 Feb 2005 13:34:13 +0000 Subject: [PATCH] added preliminary DPMS support for all panels (still in test) git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11401 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/nvidia/engine/nv_crtc.c | 32 +++++++++++++------ .../accelerants/nvidia/engine/nv_crtc2.c | 32 +++++++++++++------ .../accelerants/nvidia/engine/nv_info.c | 4 +++ 3 files changed, 48 insertions(+), 20 deletions(-) diff --git a/src/add-ons/accelerants/nvidia/engine/nv_crtc.c b/src/add-ons/accelerants/nvidia/engine/nv_crtc.c index 2b820e03ac..fefd94e48e 100644 --- a/src/add-ons/accelerants/nvidia/engine/nv_crtc.c +++ b/src/add-ons/accelerants/nvidia/engine/nv_crtc.c @@ -484,49 +484,61 @@ status_t nv_crtc_dpms(bool display, bool h, bool v) /* start synchronous reset: required before turning screen off! */ SEQW(RESET, 0x01); - /* turn screen off */ temp = SEQR(CLKMODE); if (display) { + /* turn screen on */ SEQW(CLKMODE, (temp & ~0x20)); - /* end synchronous reset if display should be enabled */ + /* end synchronous reset because display should be enabled */ SEQW(RESET, 0x03); - //'safe mode' test! feedback needed with this 'setting'! - if (0)//si->ps.tmds1_active) + if (si->ps.tmds1_active) { + /* restore original panelsync and panel-enable */ + uint32 panelsync = 0x00000000; + if(si->ps.p1_timing.flags & B_POSITIVE_VSYNC) panelsync |= 0x00000001; + if(si->ps.p1_timing.flags & B_POSITIVE_HSYNC) panelsync |= 0x00000010; + /* display enable polarity (not an official flag) */ + if(si->ps.p1_timing.flags & B_BLANK_PEDESTAL) panelsync |= 0x10000000; + DACW(FP_TG_CTRL, ((DACR(FP_TG_CTRL) & 0xcfffffcc) | panelsync)); + + //fixme?: looks like we don't need this after all: /* powerup both LVDS (laptop panellink) and TMDS (DVI panellink) * internal transmitters... */ /* note: * the powerbits in this register are hardwired to the DVI connectors, * instead of to the DACs! (confirmed NV34) */ //fixme... - DACW(FP_DEBUG0, (DACR(FP_DEBUG0) & 0xcfffffff)); + //DACW(FP_DEBUG0, (DACR(FP_DEBUG0) & 0xcfffffff)); /* ... and powerup external TMDS transmitter if it exists */ /* (confirmed OK on NV28 and NV34) */ - CRTCW(0x59, (CRTCR(0x59) | 0x01)); + //CRTCW(0x59, (CRTCR(0x59) | 0x01)); } LOG(4,("display on, ")); } else { + /* turn screen off */ SEQW(CLKMODE, (temp | 0x20)); - //'safe mode' test! feedback needed with this 'setting'! - if (0)//si->ps.tmds1_active) + if (si->ps.tmds1_active) { + /* shutoff panelsync and disable panel */ + DACW(FP_TG_CTRL, ((DACR(FP_TG_CTRL) & 0xcfffffcc) | 0x20000022)); + + //fixme?: looks like we don't need this after all: /* powerdown both LVDS (laptop panellink) and TMDS (DVI panellink) * internal transmitters... */ /* note: * the powerbits in this register are hardwired to the DVI connectors, * instead of to the DACs! (confirmed NV34) */ //fixme... - DACW(FP_DEBUG0, (DACR(FP_DEBUG0) | 0x30000000)); + //DACW(FP_DEBUG0, (DACR(FP_DEBUG0) | 0x30000000)); /* ... and powerdown external TMDS transmitter if it exists */ /* (confirmed OK on NV28 and NV34) */ - CRTCW(0x59, (CRTCR(0x59) & 0xfe)); + //CRTCW(0x59, (CRTCR(0x59) & 0xfe)); } LOG(4,("display off, ")); diff --git a/src/add-ons/accelerants/nvidia/engine/nv_crtc2.c b/src/add-ons/accelerants/nvidia/engine/nv_crtc2.c index eb681fc64e..75637aa220 100644 --- a/src/add-ons/accelerants/nvidia/engine/nv_crtc2.c +++ b/src/add-ons/accelerants/nvidia/engine/nv_crtc2.c @@ -467,49 +467,61 @@ status_t nv_crtc2_dpms(bool display, bool h, bool v) /* start synchronous reset: required before turning screen off! */ SEQW(RESET, 0x01); - /* turn screen off */ temp = SEQR(CLKMODE); if (display) { + /* turn screen on */ SEQW(CLKMODE, (temp & ~0x20)); - /* end synchronous reset if display should be enabled */ + /* end synchronous reset because display should be enabled */ SEQW(RESET, 0x03); - //'safe mode' test! feedback needed with this 'setting'! - if (0)//si->ps.tmds2_active) + if (si->ps.tmds2_active) { + /* restore original panelsync and panel-enable */ + uint32 panelsync = 0x00000000; + if(si->ps.p2_timing.flags & B_POSITIVE_VSYNC) panelsync |= 0x00000001; + if(si->ps.p2_timing.flags & B_POSITIVE_HSYNC) panelsync |= 0x00000010; + /* display enable polarity (not an official flag) */ + if(si->ps.p2_timing.flags & B_BLANK_PEDESTAL) panelsync |= 0x10000000; + DAC2W(FP_TG_CTRL, ((DAC2R(FP_TG_CTRL) & 0xcfffffcc) | panelsync)); + + //fixme?: looks like we don't need this after all: /* powerup both LVDS (laptop panellink) and TMDS (DVI panellink) * internal transmitters... */ /* note: * the powerbits in this register are hardwired to the DVI connectors, * instead of to the DACs! (confirmed NV34) */ //fixme... - DAC2W(FP_DEBUG0, (DAC2R(FP_DEBUG0) & 0xcfffffff)); + //DAC2W(FP_DEBUG0, (DAC2R(FP_DEBUG0) & 0xcfffffff)); /* ... and powerup external TMDS transmitter if it exists */ /* (confirmed OK on NV28 and NV34) */ - CRTC2W(0x59, (CRTC2R(0x59) | 0x01)); + //CRTC2W(0x59, (CRTC2R(0x59) | 0x01)); } LOG(4,("display on, ")); } else { + /* turn screen off */ SEQW(CLKMODE, (temp | 0x20)); - //'safe mode' test! feedback needed with this 'setting'! - if (0)//si->ps.tmds2_active) + if (si->ps.tmds2_active) { + /* shutoff panelsync and disable panel */ + DAC2W(FP_TG_CTRL, ((DAC2R(FP_TG_CTRL) & 0xcfffffcc) | 0x20000022)); + + //fixme?: looks like we don't need this after all: /* powerdown both LVDS (laptop panellink) and TMDS (DVI panellink) * internal transmitters... */ /* note: * the powerbits in this register are hardwired to the DVI connectors, * instead of to the DACs! (confirmed NV34) */ //fixme... - DAC2W(FP_DEBUG0, (DAC2R(FP_DEBUG0) | 0x30000000)); + //DAC2W(FP_DEBUG0, (DAC2R(FP_DEBUG0) | 0x30000000)); /* ... and powerdown external TMDS transmitter if it exists */ /* (confirmed OK on NV28 and NV34) */ - CRTC2W(0x59, (CRTC2R(0x59) & 0xfe)); + //CRTC2W(0x59, (CRTC2R(0x59) & 0xfe)); } LOG(4,("display off, ")); diff --git a/src/add-ons/accelerants/nvidia/engine/nv_info.c b/src/add-ons/accelerants/nvidia/engine/nv_info.c index 51c8ca26b6..12e08abd47 100644 --- a/src/add-ons/accelerants/nvidia/engine/nv_info.c +++ b/src/add-ons/accelerants/nvidia/engine/nv_info.c @@ -2304,6 +2304,8 @@ static void detect_panels() si->ps.p1_timing.flags = 0; if (DACR(FP_TG_CTRL) & 0x00000001) si->ps.p1_timing.flags |= B_POSITIVE_VSYNC; if (DACR(FP_TG_CTRL) & 0x00000010) si->ps.p1_timing.flags |= B_POSITIVE_HSYNC; + /* display enable polarity (not an official flag) */ + if (DACR(FP_TG_CTRL) & 0x10000000) si->ps.p1_timing.flags |= B_BLANK_PEDESTAL; /* refreshrate: * fix a DVI or laptop flatpanel to 60Hz refresh! */ si->ps.p1_timing.pixel_clock = @@ -2326,6 +2328,8 @@ static void detect_panels() si->ps.p2_timing.flags = 0; if (DAC2R(FP_TG_CTRL) & 0x00000001) si->ps.p2_timing.flags |= B_POSITIVE_VSYNC; if (DAC2R(FP_TG_CTRL) & 0x00000010) si->ps.p2_timing.flags |= B_POSITIVE_HSYNC; + /* display enable polarity (not an official flag) */ + if (DAC2R(FP_TG_CTRL) & 0x10000000) si->ps.p2_timing.flags |= B_BLANK_PEDESTAL; /* refreshrate: * fix a DVI or laptop flatpanel to 60Hz refresh! */ si->ps.p2_timing.pixel_clock =