added DPMS support (in the normal sense) for TVout: TVpicture is turned off completely when screensaver turns off screen.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14392 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rudolf Cornelissen 2005-10-15 10:38:11 +00:00
parent d6d450e124
commit 3aa2145919
3 changed files with 55 additions and 45 deletions

View File

@ -97,6 +97,7 @@ status_t SET_DISPLAY_MODE(display_mode *mode_to_set)
head1_dpms_fetch(&display, &h, &v);
head1_dpms(false, false, false);
if (si->ps.secondary_head) head2_dpms(false, false, false);
if (si->ps.tvout) BT_dpms(false);
/*where in framebuffer the screen is (should this be dependant on previous MOVEDISPLAY?)*/
startadd = (uint8*)si->fbc.frame_buffer - (uint8*)si->framebuffer;
@ -329,6 +330,8 @@ status_t SET_DISPLAY_MODE(display_mode *mode_to_set)
head1_dpms(display, h, v);
/* turn screen two on if a dualhead mode is active */
if (target.flags & DUALHEAD_BITS) head2_dpms(display,h,v);
/* turn TVout on if this is a TVout mode */
if (target.flags & TV_BITS) BT_dpms(true);
/* set up acceleration for this mode */
/* note:
@ -510,18 +513,22 @@ status_t SET_DPMS_MODE(uint32 dpms_flags) {
case B_DPMS_ON: /* H: on, V: on, display on */
head1_dpms(true, true, true);
if (si->ps.secondary_head) head2_dpms(true, true, true);
if (si->dm.flags & TV_BITS) BT_dpms(true);
break;
case B_DPMS_STAND_BY:
head1_dpms(false, false, true);
if (si->ps.secondary_head) head2_dpms(false, false, true);
if (si->dm.flags & TV_BITS) BT_dpms(false);
break;
case B_DPMS_SUSPEND:
head1_dpms(false, true, false);
if (si->ps.secondary_head) head2_dpms(false, true, false);
if (si->dm.flags & TV_BITS) BT_dpms(false);
break;
case B_DPMS_OFF: /* H: off, V: off, display off */
head1_dpms(false, false, false);
if (si->ps.secondary_head) head2_dpms(false, false, false);
if (si->dm.flags & TV_BITS) BT_dpms(false);
break;
default:
LOG(8,("SET: Invalid DPMS settings (DH) 0x%08x\n", dpms_flags));
@ -535,15 +542,19 @@ status_t SET_DPMS_MODE(uint32 dpms_flags) {
{
case B_DPMS_ON: /* H: on, V: on, display on */
head1_dpms(true, true, true);
if (si->dm.flags & TV_BITS) BT_dpms(true);
break;
case B_DPMS_STAND_BY:
head1_dpms(false, false, true);
if (si->dm.flags & TV_BITS) BT_dpms(false);
break;
case B_DPMS_SUSPEND:
head1_dpms(false, true, false);
if (si->dm.flags & TV_BITS) BT_dpms(false);
break;
case B_DPMS_OFF: /* H: off, V: off, display off */
head1_dpms(false, false, false);
if (si->dm.flags & TV_BITS) BT_dpms(false);
break;
default:
LOG(8,("SET: Invalid DPMS settings (DH) 0x%08x\n", dpms_flags));
@ -551,6 +562,7 @@ status_t SET_DPMS_MODE(uint32 dpms_flags) {
return B_ERROR;
}
}
interrupt_enable(true);
return B_OK;
}

View File

@ -1211,48 +1211,6 @@ static uint8 BT_read_monstat(uint8* monstat)
return stat;
}//end BT_read_monstat.
static uint8 BT_dpms(bool display)
{
uint8 stat;
uint8 buffer[3];
LOG(4,("Brooktree: setting DPMS: "));
/* reset status */
i2c_flag_error (-1);
/* shutdown all analog electronics... */
buffer[0] = si->ps.tv_encoder.adress + WR;
/* select first TV config register to write */
buffer[1] = 0xba;
if (display)
{
/* enable all DACs */
buffer[2] = 0x00;
LOG(4,("display on\n"));
}
else
{
/* shutdown all DACs */
buffer[2] = 0x10;
LOG(4,("display off\n"));
}
i2c_bstart(si->ps.tv_encoder.bus);
i2c_writebuffer(si->ps.tv_encoder.bus, buffer, 3);
i2c_bstop(si->ps.tv_encoder.bus);
/* log on errors */
stat = i2c_flag_error(0);
if (stat)
{
LOG(4,("Brooktree: I2C errors occurred while setting DPMS\n"));
return stat;
}
return stat;
}//end BT_dpms.
static uint8 BT_killclk_blackout(void)
{
uint8 stat;
@ -1333,12 +1291,51 @@ static uint8 BT_killclk_blackout(void)
return stat;
}
/* shutdown all analog electronics */
stat = BT_dpms(false);
return stat;
}//end BT_killclk_blackout.
uint8 BT_dpms(bool display)
{
uint8 stat;
uint8 buffer[3];
LOG(4,("Brooktree: setting DPMS: "));
/* reset status */
i2c_flag_error (-1);
/* shutdown all analog electronics... */
buffer[0] = si->ps.tv_encoder.adress + WR;
/* select first TV config register to write */
buffer[1] = 0xba;
if (display)
{
/* enable all DACs */
buffer[2] = 0x00;
LOG(4,("display on\n"));
}
else
{
/* shutdown all DACs */
buffer[2] = 0x10;
LOG(4,("display off\n"));
}
i2c_bstart(si->ps.tv_encoder.bus);
i2c_writebuffer(si->ps.tv_encoder.bus, buffer, 3);
i2c_bstop(si->ps.tv_encoder.bus);
/* log on errors */
stat = i2c_flag_error(0);
if (stat)
{
LOG(4,("Brooktree: I2C errors occurred while setting DPMS\n"));
return stat;
}
return stat;
}//end BT_dpms.
uint8 BT_check_tvmode(display_mode target)
{
uint8 status = NOT_SUPPORTED;

View File

@ -60,6 +60,7 @@ status_t nv_dac2_set_pix_pll(display_mode target);
/* Brooktree TV functions */
bool BT_probe(void);
uint8 BT_dpms(bool display);
uint8 BT_check_tvmode(display_mode target);
status_t BT_stop_tvout(void);
status_t BT_setmode(display_mode target);