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
This commit is contained in:
Alexander von Gluck IV 2011-12-13 17:22:48 -06:00
parent b57be6adc9
commit 927cbddcfd

View File

@ -1054,8 +1054,9 @@ void
encoder_dpms_set(uint8 crtcID, uint8 encoderID, int mode) encoder_dpms_set(uint8 crtcID, uint8 encoderID, int mode)
{ {
int index = 0; 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)); memset(&args, 0, sizeof(args));
uint32 connectorIndex = gDisplay[crtcID]->connectorIndex; uint32 connectorIndex = gDisplay[crtcID]->connectorIndex;
@ -1094,21 +1095,21 @@ encoder_dpms_set(uint8 crtcID, uint8 encoderID, int mode)
break; break;
case ENCODER_OBJECT_ID_INTERNAL_DAC1: case ENCODER_OBJECT_ID_INTERNAL_DAC1:
case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1:
// TODO: encoder dpms dce5 dac if ((encoderFlags & ATOM_DEVICE_TV_SUPPORT) != 0)
// else...
/*
if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT))
index = GetIndexIntoMasterTable(COMMAND, TV1OutputControl); 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); index = GetIndexIntoMasterTable(COMMAND, CV1OutputControl);
else else
*/ index = GetIndexIntoMasterTable(COMMAND, DAC1OutputControl);
index = GetIndexIntoMasterTable(COMMAND, DAC1OutputControl);
break; break;
case ENCODER_OBJECT_ID_INTERNAL_DAC2: case ENCODER_OBJECT_ID_INTERNAL_DAC2:
case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2:
// TODO: tv or CV encoder on DAC2 if ((encoderFlags & ATOM_DEVICE_TV_SUPPORT) != 0)
index = GetIndexIntoMasterTable(COMMAND, DAC2OutputControl); index = GetIndexIntoMasterTable(COMMAND, TV1OutputControl);
else if ((encoderFlags & ATOM_DEVICE_CV_SUPPORT) != 0)
index = GetIndexIntoMasterTable(COMMAND, CV1OutputControl);
else
index = GetIndexIntoMasterTable(COMMAND, DAC2OutputControl);
break; break;
} }
@ -1116,22 +1117,26 @@ encoder_dpms_set(uint8 crtcID, uint8 encoderID, int mode)
case B_DPMS_ON: case B_DPMS_ON:
args.ucAction = ATOM_ENABLE; args.ucAction = ATOM_ENABLE;
atom_execute_table(gAtomContext, index, (uint32*)&args); atom_execute_table(gAtomContext, index, (uint32*)&args);
if ((encoderFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) { if (info.dceMajor < 5) {
args.ucAction = ATOM_LCD_BLON; if ((encoderFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) {
atom_execute_table(gAtomContext, index, (uint32*)&args); args.ucAction = ATOM_LCD_BLON;
atom_execute_table(gAtomContext, index, (uint32*)&args);
}
encoder_dpms_scratch(crtcID, true);
} }
encoder_dpms_scratch(crtcID, true);
break; break;
case B_DPMS_STAND_BY: case B_DPMS_STAND_BY:
case B_DPMS_SUSPEND: case B_DPMS_SUSPEND:
case B_DPMS_OFF: case B_DPMS_OFF:
args.ucAction = ATOM_DISABLE; args.ucAction = ATOM_DISABLE;
atom_execute_table(gAtomContext, index, (uint32*)&args); atom_execute_table(gAtomContext, index, (uint32*)&args);
if ((encoderFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) { if (info.dceMajor < 5) {
args.ucAction = ATOM_LCD_BLOFF; if ((encoderFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) {
atom_execute_table(gAtomContext, index, (uint32*)&args); args.ucAction = ATOM_LCD_BLOFF;
atom_execute_table(gAtomContext, index, (uint32*)&args);
}
encoder_dpms_scratch(crtcID, false);
} }
encoder_dpms_scratch(crtcID, false);
break; break;
} }
} }