Esempio n. 1
0
void DomainDisplayControl_001::setDisplayControlDynamicCaps(UIntN participantIndex, UIntN domainIndex, 
    DisplayControlDynamicCaps newCapabilities)
{
    auto displaySet = getDisplayControlSet(participantIndex, domainIndex);
    auto upperLimitIndex = newCapabilities.getCurrentUpperLimit();
    auto lowerLimitIndex = newCapabilities.getCurrentLowerLimit();

    if (upperLimitIndex != Constants::Invalid && lowerLimitIndex != Constants::Invalid)
    {
        auto size = displaySet.getCount();
        if (upperLimitIndex >= size)
        {
            throw dptf_exception("Upper Limit index is out of control set bounds.");
        }
        else if (upperLimitIndex > lowerLimitIndex || lowerLimitIndex >= size)
        {
            lowerLimitIndex = size - 1;
            getParticipantServices()->writeMessageWarning(
                ParticipantMessage(FLF, "Limit index mismatch, setting lower limit to lowest possible index."));
        }

        m_displayControlDynamicCaps.invalidate();

        Percentage upperLimitBrightness = displaySet[upperLimitIndex].getBrightness();
        UInt32 uint32UpperLimit = upperLimitBrightness.toWholeNumber();
        getParticipantServices()->primitiveExecuteSetAsUInt32(
            esif_primitive_type::SET_DISPLAY_CAPABILITY,
            uint32UpperLimit,
            domainIndex,
            Constants::Esif::NoPersistInstance);

        Percentage lowerLimitBrightness = displaySet[lowerLimitIndex].getBrightness();
        UInt32 uint32LowerLimit = lowerLimitBrightness.toWholeNumber();
        getParticipantServices()->primitiveExecuteSetAsUInt32(
            esif_primitive_type::SET_DISPLAY_DEPTH_LIMIT,
            uint32LowerLimit,
            domainIndex,
            Constants::Esif::NoPersistInstance);
    }
    else
    {
        m_displayControlDynamicCaps.invalidate();

        getParticipantServices()->primitiveExecuteSetAsUInt32(
            esif_primitive_type::SET_DISPLAY_CAPABILITY,
            upperLimitIndex,
            domainIndex,
            Constants::Esif::NoPersistInstance);

        getParticipantServices()->primitiveExecuteSetAsUInt32(
            esif_primitive_type::SET_DISPLAY_DEPTH_LIMIT,
            lowerLimitIndex,
            domainIndex,
            Constants::Esif::NoPersistInstance);
    }
}
void DisplayControlCapabilitiesArbitrator::updatePolicyRequest(
	const DisplayControlDynamicCaps& caps,
	UIntN policyIndex,
	std::map<UIntN, UIntN>& minRequests,
	std::map<UIntN, UIntN>& maxRequests)
{
	auto newMax = caps.getCurrentUpperLimit();
	auto newMin = caps.getCurrentLowerLimit();

	if (newMax == Constants::Invalid && newMin == Constants::Invalid)
	{
		maxRequests.erase(policyIndex);
		minRequests.erase(policyIndex);
	}
	else
	{
		maxRequests[policyIndex] = newMax;
		minRequests[policyIndex] = newMin;
	}
}