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

Commit 07d03c4d authored by Ady Abraham's avatar Ady Abraham
Browse files

SF: fix binder thread priority

Add setMinSchedulerPolicy to all binder interfaces SF exposes.
It was missing from gui::ISurfaceComposer and
gui::IDisplayEventConnection.

Test: presubmit
Bug: 299378819
Change-Id: Ia0d99efa5a3bc58625c320d4df3c08bb597d2e38
parent aefb330c
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include <gui/IGraphicBufferProducer.h>
#include <gui/ISurfaceComposer.h>
#include <gui/LayerState.h>
#include <gui/SchedulingPolicy.h>
#include <private/gui/ParcelUtils.h>
#include <stdint.h>
#include <sys/types.h>
@@ -201,6 +202,18 @@ status_t BnSurfaceComposer::onTransact(
                                       isAutoTimestamp, uncacheBuffers, hasListenerCallbacks,
                                       listenerCallbacks, transactionId, mergedTransactions);
        }
        case GET_SCHEDULING_POLICY: {
            gui::SchedulingPolicy policy;
            const auto status = gui::getSchedulingPolicy(&policy);
            if (!status.isOk()) {
                return status.exceptionCode();
            }

            SAFE_PARCEL(reply->writeInt32, policy.policy);
            SAFE_PARCEL(reply->writeInt32, policy.priority);
            return NO_ERROR;
        }

        default: {
            return BBinder::onTransact(code, data, reply, flags);
        }
+6 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.gui;

import android.gui.BitTube;
import android.gui.ParcelableVsyncEventData;
import android.gui.SchedulingPolicy;

/** @hide */
interface IDisplayEventConnection {
@@ -44,4 +45,9 @@ interface IDisplayEventConnection {
     * getLatestVsyncEventData() gets the latest vsync event data.
     */
    ParcelableVsyncEventData getLatestVsyncEventData();

    /*
     * getSchedulingPolicy() used in tests to validate the binder thread pririty
     */
    SchedulingPolicy getSchedulingPolicy();
}
+3 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import android.gui.LayerDebugInfo;
import android.gui.OverlayProperties;
import android.gui.PullAtomData;
import android.gui.ARect;
import android.gui.SchedulingPolicy;
import android.gui.StalledTransactionInfo;
import android.gui.StaticDisplayInfo;
import android.gui.WindowInfosListenerInfo;
@@ -545,4 +546,6 @@ interface ISurfaceComposer {
     * applied in SurfaceFlinger due to an unsignaled fence. Otherwise, null is returned.
     */
    @nullable StalledTransactionInfo getStalledTransactionInfo(int pid);

    SchedulingPolicy getSchedulingPolicy();
}
+3 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.gui;
import android.gui.CreateSurfaceResult;
import android.gui.FrameStats;
import android.gui.LayerMetadata;
import android.gui.SchedulingPolicy;

/** @hide */
interface ISurfaceComposerClient {
@@ -60,4 +61,6 @@ interface ISurfaceComposerClient {
    CreateSurfaceResult mirrorSurface(IBinder mirrorFromHandle);

    CreateSurfaceResult mirrorDisplay(long displayId);

    SchedulingPolicy getSchedulingPolicy();
}
+23 −0
Original line number Diff line number Diff line
/*
 * Copyright 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.gui;

/** @hide */
parcelable SchedulingPolicy {
    int policy;
    int priority;
}
Loading