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

Commit f5847b80 authored by Brian Lindahl's avatar Brian Lindahl Committed by Android (Google) Code Review
Browse files

Merge "Push HWC cache slot generation down into CompositionEngine"

parents 42afe5fa 439afadf
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -166,7 +166,6 @@ filegroup {
        "FrameTracer/FrameTracer.cpp",
        "FrameTracker.cpp",
        "HdrLayerInfoReporter.cpp",
        "HwcSlotGenerator.cpp",
        "WindowInfosListenerInvoker.cpp",
        "Layer.cpp",
        "LayerFE.cpp",
+6 −2
Original line number Diff line number Diff line
@@ -118,7 +118,8 @@ ClientCache::add(const client_cache_t& cacheId, const sp<GraphicBuffer>& buffer)
                                                                 Usage::READABLE));
}

void ClientCache::erase(const client_cache_t& cacheId) {
sp<GraphicBuffer> ClientCache::erase(const client_cache_t& cacheId) {
    sp<GraphicBuffer> buffer;
    auto& [processToken, id] = cacheId;
    std::vector<sp<ErasedRecipient>> pendingErase;
    {
@@ -126,9 +127,11 @@ void ClientCache::erase(const client_cache_t& cacheId) {
        ClientCacheBuffer* buf = nullptr;
        if (!getBuffer(cacheId, &buf)) {
            ALOGE("failed to erase buffer, could not retrieve buffer");
            return;
            return nullptr;
        }

        buffer = buf->buffer->getBuffer();

        for (auto& recipient : buf->recipients) {
            sp<ErasedRecipient> erasedRecipient = recipient.promote();
            if (erasedRecipient) {
@@ -142,6 +145,7 @@ void ClientCache::erase(const client_cache_t& cacheId) {
    for (auto& recipient : pendingErase) {
        recipient->bufferErased(cacheId);
    }
    return buffer;
}

std::shared_ptr<renderengine::ExternalTexture> ClientCache::get(const client_cache_t& cacheId) {
+13 −1
Original line number Diff line number Diff line
@@ -33,6 +33,17 @@

namespace android {

// This class manages a cache of buffer handles between SurfaceFlinger clients
// and the SurfaceFlinger process which optimizes away some of the cost of
// sending buffer handles across processes.
//
// Buffers are explicitly cached and uncached by the SurfaceFlinger client. When
// a buffer is uncached, it is not only purged from this cache, but the buffer
// ID is also passed down to CompositionEngine to purge it from a similar cache
// used between SurfaceFlinger and Composer HAL. The buffer ID used to purge
// both the SurfaceFlinger side of this other cache, as well as Composer HAL's
// side of the cache.
//
class ClientCache : public Singleton<ClientCache> {
public:
    ClientCache();
@@ -41,7 +52,8 @@ public:

    base::expected<std::shared_ptr<renderengine::ExternalTexture>, AddError> add(
            const client_cache_t& cacheId, const sp<GraphicBuffer>& buffer);
    void erase(const client_cache_t& cacheId);

    sp<GraphicBuffer> erase(const client_cache_t& cacheId);

    std::shared_ptr<renderengine::ExternalTexture> get(const client_cache_t& cacheId);

+3 −0
Original line number Diff line number Diff line
@@ -52,6 +52,9 @@ struct CompositionRefreshArgs {
    // All the layers that have queued updates.
    Layers layersWithQueuedFrames;

    // All graphic buffers that will no longer be used and should be removed from caches.
    std::vector<uint64_t> bufferIdsToUncache;

    // Controls how the color mode is chosen for an output
    OutputColorSetting outputColorSetting{OutputColorSetting::kEnhanced};

+0 −1
Original line number Diff line number Diff line
@@ -163,7 +163,6 @@ struct LayerFECompositionState {

    // The buffer and related state
    sp<GraphicBuffer> buffer;
    int bufferSlot{BufferQueue::INVALID_BUFFER_SLOT};
    sp<Fence> acquireFence = Fence::NO_FENCE;
    Region surfaceDamage;
    uint64_t frameNumber = 0;
Loading