From 927cbddcfd3b968a560d35e842864a44e91047b4 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 13 Dec 2011 17:22:48 -0600 Subject: [PATCH] Improve range of dpms commands * Things in drm are a bit tangled, but it looks as though the backlight controls only need to be called on <= DCE 4 * Add analog dac video device support --- src/add-ons/accelerants/radeon_hd/encoder.cpp | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/encoder.cpp b/src/add-ons/accelerants/radeon_hd/encoder.cpp index 6787cf09f0..d77facaaec 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.cpp +++ b/src/add-ons/accelerants/radeon_hd/encoder.cpp @@ -1054,8 +1054,9 @@ void encoder_dpms_set(uint8 crtcID, uint8 encoderID, int mode) { int index = 0; - DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION args; + radeon_shared_info &info = *gInfo->shared_info; + DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION args; memset(&args, 0, sizeof(args)); uint32 connectorIndex = gDisplay[crtcID]->connectorIndex; @@ -1094,21 +1095,21 @@ encoder_dpms_set(uint8 crtcID, uint8 encoderID, int mode) 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)) + if ((encoderFlags & ATOM_DEVICE_TV_SUPPORT) != 0) index = GetIndexIntoMasterTable(COMMAND, TV1OutputControl); - else if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT)) + else if ((encoderFlags & ATOM_DEVICE_CV_SUPPORT) != 0) index = GetIndexIntoMasterTable(COMMAND, CV1OutputControl); else - */ - index = GetIndexIntoMasterTable(COMMAND, DAC1OutputControl); + 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); + if ((encoderFlags & ATOM_DEVICE_TV_SUPPORT) != 0) + index = GetIndexIntoMasterTable(COMMAND, TV1OutputControl); + else if ((encoderFlags & ATOM_DEVICE_CV_SUPPORT) != 0) + index = GetIndexIntoMasterTable(COMMAND, CV1OutputControl); + else + index = GetIndexIntoMasterTable(COMMAND, DAC2OutputControl); break; } @@ -1116,22 +1117,26 @@ encoder_dpms_set(uint8 crtcID, uint8 encoderID, int mode) case B_DPMS_ON: args.ucAction = ATOM_ENABLE; atom_execute_table(gAtomContext, index, (uint32*)&args); - if ((encoderFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) { - args.ucAction = ATOM_LCD_BLON; - atom_execute_table(gAtomContext, index, (uint32*)&args); + if (info.dceMajor < 5) { + if ((encoderFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) { + args.ucAction = ATOM_LCD_BLON; + atom_execute_table(gAtomContext, index, (uint32*)&args); + } + encoder_dpms_scratch(crtcID, true); } - encoder_dpms_scratch(crtcID, true); 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); - if ((encoderFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) { - args.ucAction = ATOM_LCD_BLOFF; - atom_execute_table(gAtomContext, index, (uint32*)&args); + if (info.dceMajor < 5) { + if ((encoderFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) { + args.ucAction = ATOM_LCD_BLOFF; + atom_execute_table(gAtomContext, index, (uint32*)&args); + } + encoder_dpms_scratch(crtcID, false); } - encoder_dpms_scratch(crtcID, false); break; } }