From 203b86df50d392e31e7b5d314db1d6a642f9dc81 Mon Sep 17 00:00:00 2001 From: Rudolf Cornelissen Date: Thu, 29 Jan 2004 10:37:50 +0000 Subject: [PATCH] added dualhead switch mode git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6403 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/graphics/nvidia/nv_macros.h | 2 + .../accelerants/nvidia/SetDisplayMode.c | 38 +++++------------ .../accelerants/nvidia/engine/nv_general.c | 42 ++++++++++++------- .../accelerants/nvidia/engine/nv_proto.h | 2 +- .../drivers/graphics/nvidia/UPDATE.html | 7 ++-- 5 files changed, 46 insertions(+), 45 deletions(-) diff --git a/headers/private/graphics/nvidia/nv_macros.h b/headers/private/graphics/nvidia/nv_macros.h index 7fd219bd55..f1128c2296 100644 --- a/headers/private/graphics/nvidia/nv_macros.h +++ b/headers/private/graphics/nvidia/nv_macros.h @@ -478,11 +478,13 @@ #define NVDAC_CURPOS 0x00680300 #define NVDAC_PIXPLLC 0x00680508 #define NVDAC_PLLSEL 0x0068050c +#define NVDAC_OUTPUT 0x0068052c #define NVDAC_PIXPLLC2 0x00680578 /* NV31, NV36 only */ #define NVDAC_GENCTRL 0x00680600 /* secondary head */ #define NVDAC2_CURPOS 0x00682300 #define NVDAC2_PIXPLLC 0x00680520 +#define NVDAC2_OUTPUT 0x0068252c #define NVDAC2_PIXPLLC2 0x0068057c /* NV31, NV36 only */ #define NVDAC2_GENCTRL 0x00682600 diff --git a/src/add-ons/accelerants/nvidia/SetDisplayMode.c b/src/add-ons/accelerants/nvidia/SetDisplayMode.c index 7a5df2318d..556f7f5f38 100644 --- a/src/add-ons/accelerants/nvidia/SetDisplayMode.c +++ b/src/add-ons/accelerants/nvidia/SetDisplayMode.c @@ -182,31 +182,26 @@ status_t SET_DISPLAY_MODE(display_mode *mode_to_set) nv_crtc2_set_display_pitch (); /*work out where the "right" screen starts*/ - startadd_right=startadd+(target.timing.h_display * (colour_depth1 >> 3)); + startadd_right = startadd + (target.timing.h_display * (colour_depth1 >> 3)); - /* set the outputs */ - switch (si->ps.card_type) + /* set the outputs if possible */ + if (si->ps.secondary_head) { - //fixme.. - case G550: switch (target.flags & DUALHEAD_BITS) { case DUALHEAD_ON: case DUALHEAD_CLONE: - //fixme: set output connectors only - nv_general_dac_select(DS_CRTC1DAC_CRTC2MAVEN); + /* connect outputs straight-through */ + nv_general_output_select(false); break; case DUALHEAD_SWITCH: - //fixme: set output connectors only - nv_general_dac_select(DS_CRTC1MAVEN_CRTC2DAC); + /* cross-connect outputs */ + nv_general_output_select(true); break; } - break; - default: - break; } - /*Tell card what memory to display*/ + /* Tell card what memory to display */ switch (target.flags & DUALHEAD_BITS) { case DUALHEAD_ON: @@ -262,23 +257,12 @@ status_t SET_DISPLAY_MODE(display_mode *mode_to_set) /* tell the card what memory to display */ nv_crtc_set_display_start(startadd,colour_depth1); - /* enable primary analog output */ - switch (si->ps.card_type) - { - case NV11: -// nv_general_dac_select(DS_CRTC1DAC_CRTC2MAVEN); - break; - case NV17: -// nv_general_dac_select(DS_CRTC1CON1_CRTC2CON2); -// gx50_general_output_select(); - break; - default: - break; - } - /* set the timing */ nv_crtc_set_timing(target); + /* connect outputs straight-through */ + if (si->ps.secondary_head) nv_general_output_select(false); + //fixme: shut-off the videoPLL if it exists... } diff --git a/src/add-ons/accelerants/nvidia/engine/nv_general.c b/src/add-ons/accelerants/nvidia/engine/nv_general.c index fa31d63f78..87cce1ee48 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.08-9 running.\n")); + LOG(1,("POWERUP: nVidia (open)BeOS Accelerant 0.08-10 running.\n")); /* preset no laptop */ si->ps.laptop = false; @@ -789,31 +789,45 @@ return nv_general_bios_to_powergraphics(); return B_OK; } -status_t gx50_general_output_select() +status_t nv_general_output_select(bool cross) { /* make sure this call is warranted */ - if ((si->ps.card_type != NV11) && (si->ps.card_type != NV17)) return B_ERROR; - - /* choose primary analog outputconnector */ - if ((si->ps.primary_dvi) && (si->ps.secondary_head) && (si->ps.tvout)) + if (si->ps.secondary_head) { - if (i2c_sec_tv_adapter() == B_OK) + /* NV11 cards can't switch heads */ + if (si->ps.card_type != NV11) { - LOG(4,("INIT: secondary TV-adapter detected, using primary connector\n")); -// DXIW(OUTPUTCONN,0x01); + if (cross) + { + LOG(4,("INIT: switching outputs to be cross-connected\n")); + + /* enable head 2 on connector 1 */ + /* (b8 = select head for output, + * b0 = enable sync signals on output (if generated)) */ + DACW(OUTPUT, 0x00000101); + /* enable head 1 on connector 2 */ + DAC2W(OUTPUT, 0x00000001); + } + else + { + LOG(4,("INIT: switching outputs to be straight-through\n")); + + /* enable head 1 on connector 1 */ + DACW(OUTPUT, 0x00000001); + /* enable head 2 on connector 2 */ + DAC2W(OUTPUT, 0x00000101); + } } else { - LOG(4,("INIT: no secondary TV-adapter detected, using secondary connector\n")); -// DXIW(OUTPUTCONN,0x04); + LOG(4,("INIT: NV11 outputs are hardwired to be straight-through\n")); } + return B_OK; } else { - LOG(4,("INIT: using primary connector\n")); -// DXIW(OUTPUTCONN,0x01); + return B_ERROR; } - return B_OK; } /*connect CRTC1 to the specified DAC*/ diff --git a/src/add-ons/accelerants/nvidia/engine/nv_proto.h b/src/add-ons/accelerants/nvidia/engine/nv_proto.h index ec03a0d0c9..dd3fb8e5d2 100644 --- a/src/add-ons/accelerants/nvidia/engine/nv_proto.h +++ b/src/add-ons/accelerants/nvidia/engine/nv_proto.h @@ -1,7 +1,7 @@ /*general card functions*/ status_t nv_general_powerup(void); status_t nv_set_cas_latency(void); -status_t gx50_general_output_select(void); +status_t nv_general_output_select(bool cross); status_t nv_general_dac_select(int); status_t nv_general_wait_retrace(void); status_t nv_general_validate_pic_size (display_mode *target, uint32 *bytes_per_row, bool *acc_mode); diff --git a/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html b/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html index 07fd3208ce..f316bc02d4 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.08-9, Rudolf)

+

head (0.08-10, Rudolf)

nv_driver 0.07 (Rudolf)