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

Commit 88a8024e authored by android-build-team Robot's avatar android-build-team Robot
Browse files

release-request-18270495-77c6-4d95-8968-eb22e3d2fe8b-for-git_oc-release-405765...

release-request-18270495-77c6-4d95-8968-eb22e3d2fe8b-for-git_oc-release-4057656 snap-temp-L93200000069424216

Change-Id: Ic7d3e0ad701bf38c33845d2fb79a57202aabe1f6
parents 6c429b95 932f0084
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -160,6 +160,9 @@ public:

    status_t getUniqueId(uint64_t* outId) const;

    // Returns the CLOCK_MONOTONIC start time of the last dequeueBuffer call
    nsecs_t getLastDequeueStartTime() const;

protected:
    virtual ~Surface();

@@ -421,6 +424,9 @@ protected:
    nsecs_t mLastDequeueDuration = 0;
    nsecs_t mLastQueueDuration = 0;

    // Stores the time right before we call IGBP::dequeueBuffer
    nsecs_t mLastDequeueStartTime = 0;

    Condition mQueueBufferCondition;

    uint64_t mNextFrameNumber = 1;
+10 −2
Original line number Diff line number Diff line
@@ -501,13 +501,13 @@ int Surface::dequeueBuffer(android_native_buffer_t** buffer, int* fenceFd) {

    int buf = -1;
    sp<Fence> fence;
    nsecs_t now = systemTime();
    nsecs_t startTime = systemTime();

    FrameEventHistoryDelta frameTimestamps;
    status_t result = mGraphicBufferProducer->dequeueBuffer(&buf, &fence,
            reqWidth, reqHeight, reqFormat, reqUsage,
            enableFrameTimestamps ? &frameTimestamps : nullptr);
    mLastDequeueDuration = systemTime() - now;
    mLastDequeueDuration = systemTime() - startTime;

    if (result < 0) {
        ALOGV("dequeueBuffer: IGraphicBufferProducer::dequeueBuffer"
@@ -524,6 +524,9 @@ int Surface::dequeueBuffer(android_native_buffer_t** buffer, int* fenceFd) {

    Mutex::Autolock lock(mMutex);

    // Write this while holding the mutex
    mLastDequeueStartTime = startTime;

    sp<GraphicBuffer>& gbuf(mSlots[buf].buffer);

    // this should never happen
@@ -1699,6 +1702,11 @@ status_t Surface::getUniqueId(uint64_t* outId) const {
    return mGraphicBufferProducer->getUniqueId(outId);
}

nsecs_t Surface::getLastDequeueStartTime() const {
    Mutex::Autolock lock(mMutex);
    return mLastDequeueStartTime;
}

status_t Surface::getAndFlushRemovedBuffers(std::vector<sp<GraphicBuffer>>* out) {
    if (out == nullptr) {
        ALOGE("%s: out must not be null!", __FUNCTION__);
+17 −1
Original line number Diff line number Diff line
@@ -393,6 +393,22 @@ TEST_F(SurfaceTest, GetAndFlushRemovedBuffers) {
    ASSERT_LE(removedBuffers.size(), 1u);
}

TEST_F(SurfaceTest, TestGetLastDequeueStartTime) {
    sp<ANativeWindow> anw(mSurface);
    ASSERT_EQ(NO_ERROR, native_window_api_connect(anw.get(), NATIVE_WINDOW_API_CPU));

    ANativeWindowBuffer* buffer = nullptr;
    int32_t fenceFd = -1;

    nsecs_t before = systemTime(CLOCK_MONOTONIC);
    anw->dequeueBuffer(anw.get(), &buffer, &fenceFd);
    nsecs_t after = systemTime(CLOCK_MONOTONIC);

    nsecs_t lastDequeueTime = mSurface->getLastDequeueStartTime();
    ASSERT_LE(before, lastDequeueTime);
    ASSERT_GE(after, lastDequeueTime);
}

class FakeConsumer : public BnConsumerListener {
public:
    void onFrameAvailable(const BufferItem& /*item*/) override {}
@@ -1568,4 +1584,4 @@ TEST_F(GetFrameTimestampsTest, PresentUnsupportedNoSync) {
    EXPECT_EQ(-1, outDisplayPresentTime);
}

}
} // namespace android
+1 −0
Original line number Diff line number Diff line
@@ -111,6 +111,7 @@ cc_library_shared {
        "EGL/Loader.cpp",
        "EGL/BlobCache.cpp",
    ],
    shared_libs: ["libvndksupport"],
    static_libs: ["libEGL_getProcAddress"],
    ldflags: ["-Wl,--exclude-libs=ALL"],
    export_include_dirs: ["EGL/include"],
+9 −19
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include <log/log.h>

#include <ui/GraphicsEnv.h>
#include <vndksupport/linker.h>

#include "egl_trace.h"
#include "egldefs.h"
@@ -115,6 +116,11 @@ static void* do_android_dlopen_ext(const char* path, int mode, const android_dle
    return android_dlopen_ext(path, mode, info);
}

static void* do_android_load_sphal_library(const char* path, int mode) {
    ATRACE_CALL();
    return android_load_sphal_library(path, mode);
}

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

Loader::driver_t::driver_t(void* gles)
@@ -424,27 +430,11 @@ static void* load_system_driver(const char* kind) {
    const char* const driver_absolute_path = absolutePath.c_str();

    // Try to load drivers from the 'sphal' namespace, if it exist. Fall back to
    // the original routine when the namespace does not exist or the load from
    // the namespace fails.
    // the original routine when the namespace does not exist.
    // See /system/core/rootdir/etc/ld.config.txt for the configuration of the
    // sphal namespace.
    android_namespace_t* sphal_namespace = android_get_exported_namespace("sphal");
    if (sphal_namespace != NULL) {
        const android_dlextinfo dlextinfo = {
            .flags = ANDROID_DLEXT_USE_NAMESPACE,
            .library_namespace = sphal_namespace,
        };
        void* dso = do_android_dlopen_ext(driver_absolute_path, RTLD_LOCAL | RTLD_NOW, &dlextinfo);
        if (dso) {
            ALOGD("loaded %s from sphal namespace", driver_absolute_path);
            return dso;
        }
        else {
            ALOGW("failed to load %s from sphal namespace: %s", driver_absolute_path, dlerror());
        }
    }

    void* dso = do_dlopen(driver_absolute_path, RTLD_NOW | RTLD_LOCAL);
    void* dso = do_android_load_sphal_library(driver_absolute_path,
                                              RTLD_NOW | RTLD_LOCAL);
    if (dso == 0) {
        const char* err = dlerror();
        ALOGE("load_driver(%s): %s", driver_absolute_path, err ? err : "unknown");