updated validation for TVflags in display_mode to reflect nvidia driver capabilities (instead of matrox driver ones). Going for singlehead card tests first.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14289 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rudolf Cornelissen 2005-10-01 10:06:58 +00:00
parent bbf8c95b5a
commit b245971503
5 changed files with 93 additions and 56 deletions

View File

@ -4,7 +4,7 @@
Other authors for NV driver:
Mark Watson,
Rudolf Cornelissen 9/2002-2/2005
Rudolf Cornelissen 9/2002-10/2005
*/
#define MODULE_BIT 0x00400000
@ -503,15 +503,9 @@ status_t PROPOSE_DISPLAY_MODE(display_mode *target, const display_mode *low, con
}
/* set TV_CAPABLE if suitable: pixelclock is not important (defined by TVstandard) */
//fixme: modify for G100 and G200 TVout later on...
if (target->flags & DUALHEAD_CAPABLE)
if (si->ps.tvout && BT_check_tvmode(*target))
{
if (si->ps.tvout &&
(target->timing.h_display <= 1024) &&
(target->timing.v_display <= 768))
{
target->flags |= TV_CAPABLE;
}
target->flags |= TV_CAPABLE;
}
/* set HARDWARE_CURSOR mode if suitable */

View File

@ -6,7 +6,7 @@
Other authors:
Mark Watson,
Apsed,
Rudolf Cornelissen 11/2002-6/2005
Rudolf Cornelissen 11/2002-10/2005
*/
#define MODULE_BIT 0x00200000
@ -112,7 +112,8 @@ status_t SET_DISPLAY_MODE(display_mode *mode_to_set)
LOG(1,("SETMODE: setting DUALHEAD mode\n"));
/* validate flags for secondary TVout */
if ((i2c_sec_tv_adapter() != B_OK) && (target2.flags & TV_BITS))
//fixme: remove or block on autodetect fail. (is now shutoff)
if ((0) && (target2.flags & TV_BITS))
{
target.flags &= ~TV_BITS;//still needed for some routines...
target2.flags &= ~TV_BITS;
@ -209,6 +210,7 @@ status_t SET_DISPLAY_MODE(display_mode *mode_to_set)
}
/* check if we are doing interlaced TVout mode */
//fixme: we don't support interlaced mode?
si->interlaced_tv_mode = false;
/* if ((target2.flags & TV_BITS) && (si->ps.card_type >= G450))
si->interlaced_tv_mode = true;
@ -242,7 +244,7 @@ status_t SET_DISPLAY_MODE(display_mode *mode_to_set)
if (!(target2.flags & TV_BITS)) result = head2_set_timing(target2);
/* TVout support: setup CRTC2 and it's pixelclock */
if (si->ps.tvout && (target2.flags & TV_BITS)) maventv_init(target2);
if (si->ps.tvout && (target2.flags & TV_BITS)) BT_setmode(target2);
}
else /* single head mode */
{
@ -306,7 +308,10 @@ status_t SET_DISPLAY_MODE(display_mode *mode_to_set)
head1_set_display_start(startadd,colour_depth1);
/* set the timing */
head1_set_timing(target);
if (!(target.flags & TV_BITS)) head1_set_timing(target);
/* TVout support: setup CRTC and it's pixelclock */
if (si->ps.tvout && (target.flags & TV_BITS)) BT_setmode(target);
//fixme: shut-off the videoPLL if it exists...
}

View File

@ -1,6 +1,6 @@
/*
Author:
Rudolf Cornelissen 4/2002-9/2005
Rudolf Cornelissen 4/2002-10/2005
*/
#define MODULE_BIT 0x00100000
@ -15,7 +15,7 @@
//fixme: remove rubbish..
enum
{ // TVoutput mode to set
NOT_USED = 0,
NOT_SUPPORTED = 0,
NTSC640_TST,
NTSC640,
NTSC800,
@ -1268,20 +1268,86 @@ static uint8 BT_killclk_blackout(void)
return stat;
}//end BT_killclk_blackout.
//fixme: resetup for brooktreetv, should cover all supported encoders later on..
int maventv_init(display_mode target)
uint8 BT_check_tvmode(display_mode target)
{
uint8 status = NOT_SUPPORTED;
uint32 mode = ((target.timing.h_display) | ((target.timing.v_display) << 16));
switch (mode)
{
case (640 | (480 << 16)):
if ((target.flags & TV_BITS) == TV_PAL)
{
if (!(target.flags & TV_VIDEO)) status = PAL640;
}
if ((target.flags & TV_BITS) == TV_NTSC)
{
if (!(target.flags & TV_VIDEO)) status = NTSC640;
else status = NTSC640_OS;
}
break;
case (800 | (600 << 16)):
if ((target.flags & TV_BITS) == TV_PAL)
{
if (!(target.flags & TV_VIDEO)) status = PAL800;
else status = PAL800_OS;
}
if ((target.flags & TV_BITS) == TV_NTSC)
{
if (!(target.flags & TV_VIDEO)) status = NTSC800;
}
break;
case (720 | (480 << 16)):
if (((target.flags & TV_BITS) == TV_NTSC) && (target.flags & TV_VIDEO))
status = NTSC720;
break;
case (720 | (576 << 16)):
if (((target.flags & TV_BITS) == TV_PAL) && (target.flags & TV_VIDEO))
status = PAL720;
break;
}
return status;
}//end BT_check_tvmode.
status_t BT_setmode(display_mode target)
{
uint8 tvmode;
/* use a display_mode copy because we might tune it for TVout compatibility */
display_mode tv_target = target;
/* preset new TVout mode */
if ((tv_target.flags & TV_BITS) == TV_PAL)
tvmode = BT_check_tvmode(tv_target);
if (!tvmode) return B_ERROR;
//fixme: only testing singlehead cards for now...
if (si->ps.secondary_head)
{
head1_set_timing(tv_target);
return B_ERROR;
}
switch (tvmode)
{
LOG(4, ("MAVENTV: PAL TVout\n"));
}
else
{
LOG(4, ("MAVENTV: NTSC TVout\n"));
case NTSC640:
case NTSC640_TST:
break;
case NTSC800:
break;
case PAL640:
break;
case PAL800:
case PAL800_TST:
break;
case NTSC640_OS:
break;
case PAL800_OS:
break;
case NTSC720:
break;
case PAL720:
break;
}
/* tune new TVout mode */
@ -1295,9 +1361,9 @@ int maventv_init(display_mode target)
/* program new TVout mode */
/* setup CRTC timing */
head2_set_timing(tv_target);
head1_set_timing(tv_target);
/* start whole thing if needed */
return 0;
return B_OK;
}

View File

@ -2,42 +2,13 @@
* i2c interface.
* Bus should be run at max. 100kHz: see original Philips I2C specification
*
* Rudolf Cornelissen 12/2002-9/2005
* Rudolf Cornelissen 12/2002-10/2005
*/
#define MODULE_BIT 0x00004000
#include "nv_std.h"
status_t i2c_sec_tv_adapter()
{
status_t result = B_ERROR;
/* The secondary DDC channel only exist on dualhead cards */
if (!si->ps.secondary_head) return result;
/* make sure the output lines will be active-low when enabled
* (they will be pulled 'passive-high' when disabled) */
// DXIW(GENIODATA,0x00);
/* send out B_STOP condition on secondary head DDC channel and use it to
* check for 'shortcut', indicating the Matrox VGA->TV adapter is connected */
/* make sure SDA is low */
// DXIW(GENIOCTRL, (DXIR(GENIOCTRL) | DDC2_DATA));
snooze(2);
/* make sure SCL should be high */
// DXIW(GENIOCTRL, (DXIR(GENIOCTRL) & ~DDC2_CLK));
snooze(2);
/* if SCL is low then the bus is blocked by a TV adapter */
// if (!(DXIR(GENIODATA) & DDC2_CLK)) result = B_OK;
snooze(5);
/* set SDA while SCL should be set (generates actual bus-stop condition) */
// DXIW(GENIOCTRL, (DXIR(GENIOCTRL) & ~DDC2_DATA));
snooze(5);
return result;
}
char i2c_flag_error (char ErrNo)
//error code list:
//0 - OK status

View File

@ -60,7 +60,8 @@ status_t nv_dac2_set_pix_pll(display_mode target);
/* Brooktree TV functions */
bool BT_probe(void);
int maventv_init(display_mode target);
uint8 BT_check_tvmode(display_mode target);
status_t BT_setmode(display_mode target);
/* CRTC1 functions */
status_t nv_crtc_update_fifo(void);