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

Commit 31f2b3c0 authored by Ana Krulec's avatar Ana Krulec
Browse files

Plumbing through GPU context priority

TODO: Actually return priority from Render engine, instead of random
number.

Test: Compile and observe logcat.
Bug: 168740533
Change-Id: Id8d93e315162708a2a8afa1e87ebdf97ab53a20f
parent 91a8a22a
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -1230,6 +1230,21 @@ public:

        return remote()->transact(BnSurfaceComposer::ADD_TRANSACTION_TRACE_LISTENER, data, &reply);
    }

    /**
     * Get priority of the RenderEngine in surface flinger.
     */
    virtual int getGPUContextPriority() {
        Parcel data, reply;
        data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
        status_t err =
                remote()->transact(BnSurfaceComposer::GET_GPU_CONTEXT_PRIORITY, data, &reply);
        if (err != NO_ERROR) {
            ALOGE("getGPUContextPriority failed to read data:  %s (%d)", strerror(-err), err);
            return 0;
        }
        return reply.readInt32();
    }
};

// Out-of-line virtual method definition to trigger vtable emission in this
@@ -2094,6 +2109,12 @@ status_t BnSurfaceComposer::onTransact(

            return addTransactionTraceListener(listener);
        }
        case GET_GPU_CONTEXT_PRIORITY: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            int priority = getGPUContextPriority();
            SAFE_PARCEL(reply->writeInt32, priority);
            return NO_ERROR;
        }
        default: {
            return BBinder::onTransact(code, data, reply, flags);
        }
+4 −0
Original line number Diff line number Diff line
@@ -1988,6 +1988,10 @@ status_t SurfaceComposerClient::setGlobalShadowSettings(const half4& ambientColo
                                                                          lightRadius);
}

int SurfaceComposerClient::getGPUContextPriority() {
    return ComposerService::getComposerService()->getGPUContextPriority();
}

// ----------------------------------------------------------------------------

status_t ScreenshotClient::captureDisplay(const DisplayCaptureArgs& captureArgs,
+6 −0
Original line number Diff line number Diff line
@@ -504,6 +504,11 @@ public:
     */
    virtual status_t addTransactionTraceListener(
            const sp<gui::ITransactionTraceListener>& listener) = 0;

    /**
     * Gets priority of the RenderEngine in SurfaceFlinger.
     */
    virtual int getGPUContextPriority() = 0;
};

// ----------------------------------------------------------------------------
@@ -565,6 +570,7 @@ public:
        ACQUIRE_FRAME_RATE_FLEXIBILITY_TOKEN,
        SET_FRAME_TIMELINE_VSYNC,
        ADD_TRANSACTION_TRACE_LISTENER,
        GET_GPU_CONTEXT_PRIORITY,
        // Always append new enum to the end.
    };

+5 −0
Original line number Diff line number Diff line
@@ -184,6 +184,11 @@ public:
     */
    static bool getProtectedContentSupport();

    /**
     * Gets the context priority of surface flinger's render engine.
     */
    static int getGPUContextPriority();

    /**
     * Uncaches a buffer in ISurfaceComposer. It must be uncached via a transaction so that it is
     * in order with other transactions that use buffers.
+2 −0
Original line number Diff line number Diff line
@@ -887,6 +887,8 @@ public:
        return NO_ERROR;
    }

    int getGPUContextPriority() override { return 0; };

protected:
    IBinder* onAsBinder() override { return nullptr; }

Loading