Author: kallisti5 Date: 2011-10-05 06:45:54 +0200 (Wed, 05 Oct 2011) New Revision: 42802 Changeset: https://dev.haiku-os.org/changeset/42802 Modified: haiku/trunk/src/add-ons/accelerants/radeon_hd/encoder.cpp haiku/trunk/src/add-ons/accelerants/radeon_hd/encoder.h haiku/trunk/src/add-ons/accelerants/radeon_hd/mode.cpp Log: * 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. Modified: haiku/trunk/src/add-ons/accelerants/radeon_hd/encoder.cpp =================================================================== --- haiku/trunk/src/add-ons/accelerants/radeon_hd/encoder.cpp 2011-10-05 04:25:50 UTC (rev 42801) +++ haiku/trunk/src/add-ons/accelerants/radeon_hd/encoder.cpp 2011-10-05 04:45:54 UTC (rev 42802) @@ -242,6 +242,84 @@ 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) { TRACE("%s: %s\n", __func__, lock ? "true" : "false"); Modified: haiku/trunk/src/add-ons/accelerants/radeon_hd/encoder.h =================================================================== --- haiku/trunk/src/add-ons/accelerants/radeon_hd/encoder.h 2011-10-05 04:25:50 UTC (rev 42801) +++ haiku/trunk/src/add-ons/accelerants/radeon_hd/encoder.h 2011-10-05 04:45:54 UTC (rev 42802) @@ -13,6 +13,7 @@ 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 */ Modified: haiku/trunk/src/add-ons/accelerants/radeon_hd/mode.cpp =================================================================== --- haiku/trunk/src/add-ons/accelerants/radeon_hd/mode.cpp 2011-10-05 04:25:50 UTC (rev 42801) +++ haiku/trunk/src/add-ons/accelerants/radeon_hd/mode.cpp 2011-10-05 04:45:54 UTC (rev 42802) @@ -136,9 +136,11 @@ 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 @@ // *** encoder commit - // encoder DPMS OFF + encoder_dpms_set(gConnector[connector_index]->encoder_object_id, + B_DPMS_ON); encoder_output_lock(false); }