From 3c71b494d63de507556898d797ca107f5709a01f Mon Sep 17 00:00:00 2001 From: Rudolf Cornelissen Date: Thu, 3 Nov 2005 18:25:16 +0000 Subject: [PATCH] completed TVout support concerning dualhead (clone) modes and custom modeflag for selecting TVout head on a per mode basis. NV11 is now fully functional (with supported encoders that is). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14667 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/nvidia/InitAccelerant.c | 3 +- .../accelerants/nvidia/SetDisplayMode.c | 94 ++++++++++++------- .../nvidia/engine/nv_brooktreetv.c | 51 ++++++++-- .../accelerants/nvidia/engine/nv_general.c | 2 +- 4 files changed, 106 insertions(+), 44 deletions(-) diff --git a/src/add-ons/accelerants/nvidia/InitAccelerant.c b/src/add-ons/accelerants/nvidia/InitAccelerant.c index d7c968e076..40189c5487 100644 --- a/src/add-ons/accelerants/nvidia/InitAccelerant.c +++ b/src/add-ons/accelerants/nvidia/InitAccelerant.c @@ -192,7 +192,8 @@ status_t INIT_ACCELERANT(int the_fd) { /* ensure DPMS state */ si->dpms_flags = B_DPMS_ON; - /* ensure TVout state */ + /* ensure TVout state: + * TVencoder is on head to be assigned primary, no dualhead switch mode active. */ //fixme: actually check on what CRTC TVout was active during boot (if any)... si->dm.flags = TV_PRIMARY; diff --git a/src/add-ons/accelerants/nvidia/SetDisplayMode.c b/src/add-ons/accelerants/nvidia/SetDisplayMode.c index 4abc542876..96c903055d 100644 --- a/src/add-ons/accelerants/nvidia/SetDisplayMode.c +++ b/src/add-ons/accelerants/nvidia/SetDisplayMode.c @@ -511,60 +511,82 @@ status_t SET_DPMS_MODE(uint32 dpms_flags) /* CRTC used for TVout needs specific DPMS programming */ if (si->dm.flags & TV_BITS) { + /* TV_PRIMARY tells us that the head to be used with TVout is the head that's + * actually assigned as being the primary head at powerup: + * so non dualhead-mode-dependant, and not 'fixed' CRTC1! */ if (si->dm.flags & TV_PRIMARY) { LOG(4,("SET_DPMS_MODE: tuning primary head DPMS settings for TVout compatibility\n")); - if (!(si->settings.vga_on_tv)) + if ((si->dm.flags & DUALHEAD_BITS) != DUALHEAD_SWITCH) { - /* block VGA output on head displaying on TV */ - /* Note: - * this specific sync setting is required: Vsync is used to keep TVout - * synchronized to the CRTC 'vertically' (otherwise 'rolling' occurs). - * This leaves Hsync only for shutting off the VGA screen. */ - h1h = false; - h1v = true; + if (!(si->settings.vga_on_tv)) + { + /* block VGA output on head displaying on TV */ + /* Note: + * this specific sync setting is required: Vsync is used to keep TVout + * synchronized to the CRTC 'vertically' (otherwise 'rolling' occurs). + * This leaves Hsync only for shutting off the VGA screen. */ + h1h = false; + h1v = true; + } + else + { + /* when concurrent VGA is used alongside TVout on a head, DPMS is safest + * applied this way: Vsync is needed for stopping TVout successfully when + * a (new) modeswitch occurs. + * (see routine BT_stop_tvout() in nv_brooktreetv.c) */ + /* Note: + * applying 'normal' DPMS here and forcing Vsync on in the above mentioned + * routine seems to not always be enough: sometimes image generation will + * not resume in that case. */ + h1h = display; + h1v = true; + } } else { - /* when concurrent VGA is used alongside TVout on a head, DPMS is safest - * applied this way: Vsync is needed for stopping TVout successfully when - * a (new) modeswitch occurs. - * (see routine BT_stop_tvout() in nv_brooktreetv.c) */ - /* Note: - * applying 'normal' DPMS here and forcing Vsync on in the above mentioned - * routine seems to not always be enough: sometimes image generation will - * not resume in that case. */ - h1h = display; - h1v = true; + if (!(si->settings.vga_on_tv)) + { + h2h = false; + h2v = true; + } + else + { + h2h = display; + h2v = true; + } } } else { LOG(4,("SET_DPMS_MODE: tuning secondary head DPMS settings for TVout compatibility\n")); - if (!(si->settings.vga_on_tv)) + if ((si->dm.flags & DUALHEAD_BITS) != DUALHEAD_SWITCH) { - /* block VGA output on head displaying on TV */ - /* Note: - * this specific sync setting is required: Vsync is used to keep TVout - * synchronized to the CRTC 'vertically' (otherwise 'rolling' occurs). - * This leaves Hsync only for shutting off the VGA screen. */ - h2h = false; - h2v = true; + if (!(si->settings.vga_on_tv)) + { + h2h = false; + h2v = true; + } + else + { + h2h = display; + h2v = true; + } } else { - /* when concurrent VGA is used alongside TVout on a head, DPMS is safest - * applied this way: Vsync is needed for stopping TVout successfully when - * a (new) modeswitch occurs. - * (see routine BT_stop_tvout() in nv_brooktreetv.c) */ - /* Note: - * applying 'normal' DPMS here and forcing Vsync on in the above mentioned - * routine seems to not always be enough: sometimes image generation will - * not resume in that case. */ - h2h = display; - h2v = true; + if (!(si->settings.vga_on_tv)) + { + h1h = false; + h1v = true; + } + else + { + h1h = display; + h1v = true; + } } } } diff --git a/src/add-ons/accelerants/nvidia/engine/nv_brooktreetv.c b/src/add-ons/accelerants/nvidia/engine/nv_brooktreetv.c index 8953209ab1..3fc6be06b0 100644 --- a/src/add-ons/accelerants/nvidia/engine/nv_brooktreetv.c +++ b/src/add-ons/accelerants/nvidia/engine/nv_brooktreetv.c @@ -1580,10 +1580,23 @@ 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) { + /* TV_PRIMARY tells us that the head to be used with TVout is the head that's + * actually assigned as being the primary head at powerup: + * so non dualhead-mode-dependant, and not 'fixed' CRTC1! */ if (tv_target.flags & TV_PRIMARY) - head1_start_tvout(); + { + if ((tv_target.flags & DUALHEAD_BITS) != DUALHEAD_SWITCH) + head1_start_tvout(); + else + head2_start_tvout(); + } else - head2_start_tvout(); + { + if ((tv_target.flags & DUALHEAD_BITS) != DUALHEAD_SWITCH) + head2_start_tvout(); + else + head1_start_tvout(); + } return B_OK; }//end BT_start_tvout. @@ -1597,10 +1610,23 @@ status_t BT_stop_tvout(void) /* prevent BT from being overclocked by VGA-only modes & black-out TV-out */ BT_killclk_blackout(); + /* TV_PRIMARY tells us that the head to be used with TVout is the head that's + * actually assigned as being the primary head at powerup: + * so non dualhead-mode-dependant, and not 'fixed' CRTC1! */ if (si->dm.flags & TV_PRIMARY) - head1_stop_tvout(); + { + if ((si->dm.flags & DUALHEAD_BITS) != DUALHEAD_SWITCH) + head1_stop_tvout(); + else + head2_stop_tvout(); + } else - head2_stop_tvout(); + { + if ((si->dm.flags & DUALHEAD_BITS) != DUALHEAD_SWITCH) + head2_stop_tvout(); + else + head1_stop_tvout(); + } /* fixme if needed: * a full encoder chip reset could be done here (so after decoupling crtc)... */ @@ -1691,10 +1717,23 @@ status_t BT_setmode(display_mode target) BT_update_mode_for_gpu(&tv_target, tvmode); /* setup GPU CRTC timing */ + /* TV_PRIMARY tells us that the head to be used with TVout is the head that's + * actually assigned as being the primary head at powerup: + * so non dualhead-mode-dependant, and not 'fixed' CRTC1! */ if (tv_target.flags & TV_PRIMARY) - head1_set_timing(tv_target); + { + if ((tv_target.flags & DUALHEAD_BITS) != DUALHEAD_SWITCH) + head1_set_timing(tv_target); + else + head2_set_timing(tv_target); + } else - head2_set_timing(tv_target); + { + if ((tv_target.flags & DUALHEAD_BITS) != DUALHEAD_SWITCH) + head2_set_timing(tv_target); + else + head1_set_timing(tv_target); + } //fixme: only testing older cards for now... if (si->ps.secondary_head && (si->ps.card_type > NV15)) diff --git a/src/add-ons/accelerants/nvidia/engine/nv_general.c b/src/add-ons/accelerants/nvidia/engine/nv_general.c index 7f8c598243..8b5fe17da8 100644 --- a/src/add-ons/accelerants/nvidia/engine/nv_general.c +++ b/src/add-ons/accelerants/nvidia/engine/nv_general.c @@ -91,7 +91,7 @@ status_t nv_general_powerup() { status_t status; - LOG(1,("POWERUP: Haiku nVidia Accelerant 0.60 running.\n")); + LOG(1,("POWERUP: Haiku nVidia Accelerant 0.61 running.\n")); /* log VBLANK INT usability status */ if (si->ps.int_assigned)