diff --git a/src/add-ons/accelerants/radeon_hd/encoder.cpp b/src/add-ons/accelerants/radeon_hd/encoder.cpp index 38b15f854f..de27f76cb5 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.cpp +++ b/src/add-ons/accelerants/radeon_hd/encoder.cpp @@ -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) { diff --git a/src/add-ons/accelerants/radeon_hd/encoder.h b/src/add-ons/accelerants/radeon_hd/encoder.h index ccd1736fca..19f769d0c1 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.h +++ b/src/add-ons/accelerants/radeon_hd/encoder.h @@ -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 */ diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index c4a73298da..8635e96087 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -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); }