From d7dfe68dc7bf61575d99f47e4826e514807e5166 Mon Sep 17 00:00:00 2001 From: Rudolf Cornelissen Date: Thu, 3 Nov 2005 14:11:47 +0000 Subject: [PATCH] modified custom flags behaviour, mostly TV_PRIMARY flag stuff: more in proposemode, less in other places. For singlehead TV modes on dualhead cards TVout chip is always assigned to the primary head now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14660 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/nvidia/ProposeDisplayMode.c | 32 ++++++++++++++++++- .../accelerants/nvidia/SetDisplayMode.c | 12 ------- .../nvidia/engine/nv_brooktreetv.c | 15 ++++----- .../accelerants/nvidia/engine/nv_crtc.c | 4 +++ .../accelerants/nvidia/engine/nv_crtc2.c | 4 +++ 5 files changed, 45 insertions(+), 22 deletions(-) diff --git a/src/add-ons/accelerants/nvidia/ProposeDisplayMode.c b/src/add-ons/accelerants/nvidia/ProposeDisplayMode.c index 7a9889006c..3deb96d39c 100644 --- a/src/add-ons/accelerants/nvidia/ProposeDisplayMode.c +++ b/src/add-ons/accelerants/nvidia/ProposeDisplayMode.c @@ -507,12 +507,42 @@ status_t PROPOSE_DISPLAY_MODE(display_mode *target, const display_mode *low, con } } + /* if not dualhead capable card clear dualhead flags */ + if (!(target->flags & DUALHEAD_CAPABLE)) + { + target->flags &= ~DUALHEAD_BITS; + } + /* set TV_CAPABLE if suitable: pixelclock is not important (defined by TVstandard) */ if (si->ps.tvout && BT_check_tvmode(*target)) { target->flags |= TV_CAPABLE; } + /* if not TVout capable card clear TVout flags */ + if (!(target->flags & TV_CAPABLE)) + { + target->flags &= ~TV_BITS; + } + + /* make sure TV head assignment is sane */ + if (target->flags & TV_BITS) + { + if (!si->ps.secondary_head) + { + target->flags |= TV_PRIMARY; + } + else + { + if ((target->flags & DUALHEAD_BITS) == DUALHEAD_OFF) + target->flags |= TV_PRIMARY; + } + } + else + { + target->flags &= ~TV_PRIMARY; + } + /* set HARDWARE_CURSOR mode if suitable */ if (si->settings.hardcursor) target->flags |= B_HARDWARE_CURSOR; @@ -520,7 +550,7 @@ status_t PROPOSE_DISPLAY_MODE(display_mode *target, const display_mode *low, con /* set SUPPORTS_OVERLAYS */ target->flags |= B_SUPPORTS_OVERLAYS; - LOG(1, ("PROPOSEMODE: validated status modeflags: $%08x\n", target->flags)); + LOG(1, ("PROPOSEMODE: validated modeflags: $%08x\n", target->flags)); /* overrule timing command flags to be (fixed) blank_pedestal = 0.0IRE, * progressive scan (fixed), and sync_on_green not avaible. */ diff --git a/src/add-ons/accelerants/nvidia/SetDisplayMode.c b/src/add-ons/accelerants/nvidia/SetDisplayMode.c index 29aae79bd4..d4ba02b5d7 100644 --- a/src/add-ons/accelerants/nvidia/SetDisplayMode.c +++ b/src/add-ons/accelerants/nvidia/SetDisplayMode.c @@ -68,18 +68,6 @@ status_t SET_DISPLAY_MODE(display_mode *mode_to_set) /* See BOUNDS WARNING above... */ if (PROPOSE_DISPLAY_MODE(&target, &target, &target) == B_ERROR) return B_ERROR; - /* if not dualhead capable card clear dualhead flags */ - if (!(target.flags & DUALHEAD_CAPABLE)) - { - target.flags &= ~DUALHEAD_BITS; - } - /* if not TVout capable card clear TVout flags */ - if (!(target.flags & TV_CAPABLE)) - { - target.flags &= ~TV_BITS; - } - LOG(1, ("SETMODE: (CONT.) validated command modeflags: $%08x\n", target.flags)); - /* make sure a possible 3D add-on will block rendering and re-initialize itself. * note: update in _this_ order only */ /* SET_DISPLAY_MODE will reset this flag when it's done. */ diff --git a/src/add-ons/accelerants/nvidia/engine/nv_brooktreetv.c b/src/add-ons/accelerants/nvidia/engine/nv_brooktreetv.c index 9735edf7dc..348eb0d26b 100644 --- a/src/add-ons/accelerants/nvidia/engine/nv_brooktreetv.c +++ b/src/add-ons/accelerants/nvidia/engine/nv_brooktreetv.c @@ -1580,7 +1580,7 @@ static status_t BT_update_mode_for_gpu(display_mode *target, uint8 tvmode) * and ASUS V7100 GeForce2 MX200 AGP/32Mb (CH7007). */ static status_t BT_start_tvout(display_mode tv_target) { - if (!si->ps.secondary_head || (tv_target.flags & TV_PRIMARY)) + if (tv_target.flags & TV_PRIMARY) { if (si->ps.secondary_head) { @@ -1591,8 +1591,7 @@ static status_t BT_start_tvout(display_mode tv_target) nv_crtc_start_tvout(); } - - if (si->ps.secondary_head && !(tv_target.flags & TV_PRIMARY)) + else { /* switch TV encoder to CRTC2 */ NV_REG32(NV32_FUNCSEL) &= ~0x00000100; @@ -1613,10 +1612,9 @@ status_t BT_stop_tvout(void) /* prevent BT from being overclocked by VGA-only modes & black-out TV-out */ BT_killclk_blackout(); - if (!si->ps.secondary_head || (si->dm.flags & TV_PRIMARY)) + if (si->dm.flags & TV_PRIMARY) nv_crtc_stop_tvout(); - - if (si->ps.secondary_head && !(si->dm.flags & TV_PRIMARY)) + else nv_crtc2_stop_tvout(); /* fixme if needed: @@ -1708,10 +1706,9 @@ status_t BT_setmode(display_mode target) BT_update_mode_for_gpu(&tv_target, tvmode); /* setup GPU CRTC timing */ - if (!si->ps.secondary_head || (si->dm.flags & TV_PRIMARY)) + if (tv_target.flags & TV_PRIMARY) head1_set_timing(tv_target); - - if (si->ps.secondary_head && !(si->dm.flags & TV_PRIMARY)) + else head2_set_timing(tv_target); //fixme: only testing older cards for now... diff --git a/src/add-ons/accelerants/nvidia/engine/nv_crtc.c b/src/add-ons/accelerants/nvidia/engine/nv_crtc.c index d1b15645df..5cc228f3c7 100644 --- a/src/add-ons/accelerants/nvidia/engine/nv_crtc.c +++ b/src/add-ons/accelerants/nvidia/engine/nv_crtc.c @@ -917,6 +917,8 @@ status_t nv_crtc_cursor_position(uint16 x, uint16 y) status_t nv_crtc_stop_tvout(void) { + LOG(4,("CRTC: stopping TV output\n")); + /* enable access to primary head */ set_crtc_owner(0); @@ -974,6 +976,8 @@ status_t nv_crtc_stop_tvout(void) status_t nv_crtc_start_tvout(void) { + LOG(4,("CRTC: starting TV output\n")); + /* enable access to primary head */ set_crtc_owner(0); diff --git a/src/add-ons/accelerants/nvidia/engine/nv_crtc2.c b/src/add-ons/accelerants/nvidia/engine/nv_crtc2.c index da1d1ea133..ed1c596146 100644 --- a/src/add-ons/accelerants/nvidia/engine/nv_crtc2.c +++ b/src/add-ons/accelerants/nvidia/engine/nv_crtc2.c @@ -767,6 +767,8 @@ status_t nv_crtc2_cursor_position(uint16 x, uint16 y) status_t nv_crtc2_stop_tvout(void) { + LOG(4,("CRTC2: stopping TV output\n")); + /* enable access to secondary head */ set_crtc_owner(1); @@ -821,6 +823,8 @@ status_t nv_crtc2_stop_tvout(void) status_t nv_crtc2_start_tvout(void) { + LOG(4,("CRTC2: starting TV output\n")); + /* enable access to secondary head */ set_crtc_owner(1);