Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ee9b14f4 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "SurfaceFlinger: cleanup conversion issues in Scheduler"

parents 542f101b dec1a41f
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -14,10 +14,6 @@
 * limitations under the License.
 */

// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wconversion"

#undef LOG_TAG
#define LOG_TAG "LayerHistory"
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
@@ -141,7 +137,7 @@ LayerHistory::Summary LayerHistory::summarize(nsecs_t now) {
            }

            if (CC_UNLIKELY(mTraceEnabled)) {
                trace(weakLayer, std::round(*frameRate));
                trace(weakLayer, round<int>(*frameRate));
            }
        }
    }
@@ -179,7 +175,7 @@ void LayerHistory::partitionLayers(nsecs_t now) {
        }
    }

    mLayerInfos.erase(mLayerInfos.begin() + end, mLayerInfos.end());
    mLayerInfos.erase(mLayerInfos.begin() + static_cast<long>(end), mLayerInfos.end());
}

void LayerHistory::clear() {
@@ -194,5 +190,3 @@ void LayerHistory::clear() {

} // namespace android::scheduler::impl
// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic pop // ignored "-Wconversion"
+3 −3
Original line number Diff line number Diff line
@@ -95,10 +95,10 @@ private:

    struct ActiveLayers {
        LayerInfos& infos;
        const long index;
        const size_t index;

        auto begin() { return infos.begin(); }
        auto end() { return begin() + index; }
        auto end() { return begin() + static_cast<long>(index); }
    };

    ActiveLayers activeLayers() REQUIRES(mLock) { return {mLayerInfos, mActiveLayersEnd}; }
@@ -113,7 +113,7 @@ private:
    // Partitioned such that active layers precede inactive layers. For fast lookup, the few active
    // layers are at the front, and weak pointers are stored in contiguous memory to hit the cache.
    LayerInfos mLayerInfos GUARDED_BY(mLock);
    long mActiveLayersEnd GUARDED_BY(mLock) = 0;
    size_t mActiveLayersEnd GUARDED_BY(mLock) = 0;

    // Whether to emit systrace output and debug logs.
    const bool mTraceEnabled;
+0 −7
Original line number Diff line number Diff line
@@ -20,10 +20,6 @@

#include "LayerHistory.h"

// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wconversion"

#include <cutils/properties.h>
#include <utils/Log.h>
#include <utils/Timers.h>
@@ -37,9 +33,6 @@
#include "../Layer.h"
#include "SchedulerUtils.h"

// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic pop // ignored "-Wconversion"

#include "LayerInfoV2.h"

namespace android::scheduler::impl {
+2 −9
Original line number Diff line number Diff line
@@ -14,10 +14,6 @@
 * limitations under the License.
 */

// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wconversion"

#include "PhaseOffsets.h"

#include <cutils/properties.h>
@@ -119,9 +115,9 @@ PhaseOffsets::Offsets PhaseOffsets::getDefaultOffsets(nsecs_t vsyncDuration) con
}

PhaseOffsets::Offsets PhaseOffsets::getHighFpsOffsets(nsecs_t vsyncDuration) const {
    const int highFpsLateAppOffsetNs =
    const auto highFpsLateAppOffsetNs =
            getProperty("debug.sf.high_fps_late_app_phase_offset_ns").value_or(2000000);
    const int highFpsLateSfOffsetNs =
    const auto highFpsLateSfOffsetNs =
            getProperty("debug.sf.high_fps_late_sf_phase_offset_ns").value_or(1000000);

    const auto highFpsEarlySfOffsetNs = getProperty("debug.sf.high_fps_early_phase_offset_ns");
@@ -334,6 +330,3 @@ void PhaseDurations::dump(std::string& result) const {

} // namespace impl
} // namespace android::scheduler

// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic pop // ignored "-Wconversion"
+16 −23
Original line number Diff line number Diff line
@@ -17,10 +17,6 @@
// #define LOG_NDEBUG 0
#define ATRACE_TAG ATRACE_TAG_GRAPHICS

// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wconversion"

#include "RefreshRateConfigs.h"
#include <android-base/stringprintf.h>
#include <utils/Trace.h>
@@ -37,26 +33,26 @@ using RefreshRate = RefreshRateConfigs::RefreshRate;
const RefreshRate& RefreshRateConfigs::getRefreshRateForContent(
        const std::vector<LayerRequirement>& layers) const {
    std::lock_guard lock(mLock);
    float contentFramerate = 0.0f;
    float explicitContentFramerate = 0.0f;
    int contentFramerate = 0;
    int explicitContentFramerate = 0;
    for (const auto& layer : layers) {
        const auto desiredRefreshRateRound = round<int>(layer.desiredRefreshRate);
        if (layer.vote == LayerVoteType::Explicit) {
            if (layer.desiredRefreshRate > explicitContentFramerate) {
                explicitContentFramerate = layer.desiredRefreshRate;
            if (desiredRefreshRateRound > explicitContentFramerate) {
                explicitContentFramerate = desiredRefreshRateRound;
            }
        } else {
            if (layer.desiredRefreshRate > contentFramerate) {
                contentFramerate = layer.desiredRefreshRate;
            if (desiredRefreshRateRound > contentFramerate) {
                contentFramerate = desiredRefreshRateRound;
            }
        }
    }

    if (explicitContentFramerate != 0.0f) {
    if (explicitContentFramerate != 0) {
        contentFramerate = explicitContentFramerate;
    } else if (contentFramerate == 0.0f) {
        contentFramerate = mMaxSupportedRefreshRate->fps;
    } else if (contentFramerate == 0) {
        contentFramerate = round<int>(mMaxSupportedRefreshRate->fps);
    }
    contentFramerate = std::round(contentFramerate);
    ATRACE_INT("ContentFPS", contentFramerate);

    // Find the appropriate refresh rate with minimal error
@@ -141,7 +137,7 @@ const RefreshRate& RefreshRateConfigs::getRefreshRateForContentV2(

        for (auto& [refreshRate, overallScore] : scores) {
            const auto displayPeriod = refreshRate->vsyncPeriod;
            const auto layerPeriod = 1e9f / layer.desiredRefreshRate;
            const auto layerPeriod = round<nsecs_t>(1e9f / layer.desiredRefreshRate);

            // Calculate how many display vsyncs we need to present a single frame for this layer
            auto [displayFramesQuot, displayFramesRem] = std::div(layerPeriod, displayPeriod);
@@ -183,7 +179,7 @@ const RefreshRate& RefreshRateConfigs::getRefreshRateForContentV2(
    for (const auto [refreshRate, score] : scores) {
        ALOGV("%s scores %.2f", refreshRate->name.c_str(), score);

        ATRACE_INT(refreshRate->name.c_str(), std::round(score * 100));
        ATRACE_INT(refreshRate->name.c_str(), round<int>(score * 100));

        if (score > max) {
            max = score;
@@ -239,11 +235,10 @@ RefreshRateConfigs::RefreshRateConfigs(
        HwcConfigIndexType currentConfigId)
      : mRefreshRateSwitching(refreshRateSwitching) {
    std::vector<InputConfig> inputConfigs;
    for (auto configId = HwcConfigIndexType(0); configId < HwcConfigIndexType(configs.size());
         ++configId) {
        auto configGroup = HwcConfigGroupType(configs[configId.value()]->getConfigGroup());
        inputConfigs.push_back(
                {configId, configGroup, configs[configId.value()]->getVsyncPeriod()});
    for (size_t configId = 0; configId < configs.size(); ++configId) {
        auto configGroup = HwcConfigGroupType(configs[configId]->getConfigGroup());
        inputConfigs.push_back({HwcConfigIndexType(static_cast<int>(configId)), configGroup,
                                configs[configId]->getVsyncPeriod()});
    }
    init(inputConfigs, currentConfigId);
}
@@ -362,5 +357,3 @@ void RefreshRateConfigs::init(const std::vector<InputConfig>& configs,
}

} // namespace android::scheduler
// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic pop // ignored "-Wconversion"
Loading