* add encoder DPMS code

* flip encoders on during modeset.
* crt0 status keeps getting higher and higher which is a good sign.
  the more bits that are set, the closer to a successful lock.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42802 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alexander von Gluck IV 2011-10-05 04:45:54 +00:00
parent b54c811990
commit ffb494caeb
3 changed files with 84 additions and 2 deletions

View File

@ -241,6 +241,84 @@ encoder_analog_setup(uint8 id, uint32 pixelClock, int command)
}
void
encoder_dpms_set(uint8 encoder_id, int mode)
{
int index = 0;
DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION args;
memset(&args, 0, sizeof(args));
switch (encoder_id) {
case ENCODER_OBJECT_ID_INTERNAL_TMDS1:
case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1:
index = GetIndexIntoMasterTable(COMMAND, TMDSAOutputControl);
break;
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:
ERROR("%s: TODO DIG DPMS set\n", __func__);
return;
case ENCODER_OBJECT_ID_INTERNAL_DVO1:
case ENCODER_OBJECT_ID_INTERNAL_DDI:
index = GetIndexIntoMasterTable(COMMAND, DVOOutputControl);
break;
case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1:
// TODO : encoder dpms set newer cards
// If DCE5, dvo true
// If DCE3, dig true
// else...
index = GetIndexIntoMasterTable(COMMAND, DVOOutputControl);
break;
case ENCODER_OBJECT_ID_INTERNAL_LVDS:
index = GetIndexIntoMasterTable(COMMAND, LCD1OutputControl);
break;
case ENCODER_OBJECT_ID_INTERNAL_LVTM1:
// TODO : Laptop LCD special cases dpms set
// if ATOM_DEVICE_LCD_SUPPORT, LCD1OutputControl
// else...
index = GetIndexIntoMasterTable(COMMAND, LVTMAOutputControl);
break;
case ENCODER_OBJECT_ID_INTERNAL_DAC1:
case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1:
// TODO : encoder dpms dce5 dac
// else...
/*
if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT))
index = GetIndexIntoMasterTable(COMMAND, TV1OutputControl);
else if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT))
index = GetIndexIntoMasterTable(COMMAND, CV1OutputControl);
else
*/
index = GetIndexIntoMasterTable(COMMAND, DAC1OutputControl);
break;
case ENCODER_OBJECT_ID_INTERNAL_DAC2:
case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2:
// TODO : tv or CV encoder on DAC2
index = GetIndexIntoMasterTable(COMMAND, DAC2OutputControl);
break;
}
switch (mode) {
case B_DPMS_ON:
args.ucAction = ATOM_ENABLE;
atom_execute_table(gAtomContext, index, (uint32*)&args);
// TODO : ATOM_DEVICE_LCD_SUPPORT : args.ucAction = ATOM_LCD_BLON;
// execute again
break;
case B_DPMS_STAND_BY:
case B_DPMS_SUSPEND:
case B_DPMS_OFF:
args.ucAction = ATOM_DISABLE;
atom_execute_table(gAtomContext, index, (uint32*)&args);
// TODO : ATOM_DEVICE_LCD_SUPPORT : args.ucAction = ATOM_LCD_BLOFF;
// execute again
break;
}
}
void
encoder_output_lock(bool lock)
{

View File

@ -13,6 +13,7 @@ void encoder_assign_crtc(uint8 crt_id);
void encoder_mode_set(uint8 id, uint32 pixelClock);
void encoder_analog_setup(uint8 id, uint32 pixelClock, int command);
void encoder_output_lock(bool lock);
void encoder_dpms_set(uint8 encoder_id, int mode);
#endif /* RADEON_HD_ENCODER_H */

View File

@ -136,9 +136,11 @@ radeon_set_display_mode(display_mode *mode)
if (gDisplay[id]->active == false)
continue;
uint16 connector_index = gDisplay[id]->connector_index;
// *** encoder prep
encoder_output_lock(true);
// encoder DPMS OFF
encoder_dpms_set(gConnector[connector_index]->encoder_object_id,
B_DPMS_OFF);
// *** CRT controler prep
display_crtc_lock(id, ATOM_ENABLE);
@ -167,7 +169,8 @@ radeon_set_display_mode(display_mode *mode)
// *** encoder commit
// encoder DPMS OFF
encoder_dpms_set(gConnector[connector_index]->encoder_object_id,
B_DPMS_ON);
encoder_output_lock(false);
}