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

Commit 4944c111 authored by Vishnu Nair's avatar Vishnu Nair
Browse files

Add debug sysprops to disable sched fifo in surfaceflinger

debug.sf.disable_sched_fifo_sf: false
debug.sf.disable_sched_fifo_sf_binder: false
debug.sf.disable_sched_fifo_sf_sched: false
debug.sf.disable_sched_fifo_re: false
debug.sf.disable_sched_fifo_composer: false
debug.sf.disable_sched_fifo_composer_callback: false

Fixes: 390673988
Test: setprop disable_sched_fifo_sf and check sched policy in perfetto
Flag: EXEMPT adding sysprop flags
Change-Id: I1973a96591bacd8d7fc6e103f24f4b8e9c7ab926
parent e7158108
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include <future>

#include <android-base/stringprintf.h>
#include <common/FlagManager.h>
#include <common/trace.h>
#include <private/gui/SyncFeatures.h>
#include <processgroup/processgroup.h>
@@ -60,7 +61,7 @@ status_t RenderEngineThreaded::setSchedFifo(bool enabled) {

    struct sched_param param = {0};
    int sched_policy;
    if (enabled) {
    if (enabled && !FlagManager::getInstance().disable_sched_fifo_re()) {
        sched_policy = SCHED_FIFO;
        param.sched_priority = kFifoPriority;
    } else {
+3 −1
Original line number Diff line number Diff line
@@ -347,7 +347,9 @@ void AidlComposer::registerCallback(HWC2::ComposerCallback& callback) {
    mAidlComposerCallback = ndk::SharedRefBase::make<AidlIComposerCallbackWrapper>(callback);

    ndk::SpAIBinder binder = mAidlComposerCallback->asBinder();
    if (!FlagManager::getInstance().disable_sched_fifo_composer_callback()) {
        AIBinder_setMinSchedulerPolicy(binder.get(), SCHED_FIFO, 2);
    }

    const auto status = mAidlComposerClient->registerCallback(mAidlComposerCallback);
    if (!status.isOk()) {
+4 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include <aidl/android/hardware/graphics/common/DisplayHotplugEvent.h>
#include <android/binder_manager.h>
#include <android/hardware/graphics/composer/2.1/types.h>
#include <common/FlagManager.h>
#include <common/trace.h>
#include <composer-command-buffer/2.2/ComposerCommandBuffer.h>
#include <hidl/HidlTransportSupport.h>
@@ -301,7 +302,9 @@ std::string HidlComposer::dumpDebugInfo() {
}

void HidlComposer::registerCallback(const sp<IComposerCallback>& callback) {
    if (!FlagManager::getInstance().disable_sched_fifo_composer_callback()) {
        android::hardware::setMinSchedulerPolicy(callback, SCHED_FIFO, 2);
    }

    auto ret = [&]() {
        if (mClient_2_4) {
+2 −1
Original line number Diff line number Diff line
@@ -344,7 +344,8 @@ sp<EventThreadConnection> EventThread::createEventConnection(
    auto connection = sp<EventThreadConnection>::make(const_cast<EventThread*>(this),
                                                      IPCThreadState::self()->getCallingUid(),
                                                      eventRegistration);
    if (FlagManager::getInstance().misc1()) {
    if (FlagManager::getInstance().misc1() &&
        !FlagManager::getInstance().disable_sched_fifo_sf_sched()) {
        const int policy = SCHED_FIFO;
        connection->setMinSchedulerPolicy(policy, sched_get_priority_min(policy));
    }
+5 −2
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
#include <sys/timerfd.h>
#include <sys/unistd.h>

#include <common/FlagManager.h>
#include <common/trace.h>
#include <ftl/concat.h>
#include <ftl/enum.h>
@@ -155,9 +156,11 @@ bool Timer::dispatch() {
    setDebugState(DebugState::Running);
    struct sched_param param = {0};
    param.sched_priority = 2;
    if (!FlagManager::getInstance().disable_sched_fifo_sf_sched()) {
        if (pthread_setschedparam(pthread_self(), SCHED_FIFO, &param) != 0) {
            ALOGW("Failed to set SCHED_FIFO on dispatch thread");
        }
    }

    if (pthread_setname_np(pthread_self(), "TimerDispatch") != 0) {
        ALOGW("Failed to set thread name on dispatch thread");
Loading