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

Commit 83f36b25 authored by Patrick Williams's avatar Patrick Williams
Browse files

SF: Remove BufferStateLayer class

This CL removes the BufferStateLayer class and some of the references to
"BufferStateLayer" in factory and utility method names. In order to keep
the diff smaller, I'll send out a separate CL to remove the remaining
references.

Bug: 238781169
Test: refactor, existing tests pass

Change-Id: I62fe00caa87e109435da62329e817c19cfb96ead
parent 75fd4b82
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -133,7 +133,7 @@ struct layer_state_t {
        eLayerOpaque = 0x02,         // SURFACE_OPAQUE
        eLayerOpaque = 0x02,         // SURFACE_OPAQUE
        eLayerSkipScreenshot = 0x40, // SKIP_SCREENSHOT
        eLayerSkipScreenshot = 0x40, // SKIP_SCREENSHOT
        eLayerSecure = 0x80,         // SECURE
        eLayerSecure = 0x80,         // SECURE
        // Queue up BufferStateLayer buffers instead of dropping the oldest buffer when this flag is
        // Queue up layer buffers instead of dropping the oldest buffer when this flag is
        // set. This blocks the client until all the buffers have been presented. If the buffers
        // set. This blocks the client until all the buffers have been presented. If the buffers
        // have presentation timestamps, then we may drop buffers.
        // have presentation timestamps, then we may drop buffers.
        eEnableBackpressure = 0x100,       // ENABLE_BACKPRESSURE
        eEnableBackpressure = 0x100,       // ENABLE_BACKPRESSURE
+1 −1
Original line number Original line Diff line number Diff line
@@ -270,7 +270,7 @@ private:


    // Send a callback when a GraphicBuffer dies.
    // Send a callback when a GraphicBuffer dies.
    //
    //
    // This is used for BufferStateLayer caching. GraphicBuffers are refcounted per process. When
    // This is used for layer caching. GraphicBuffers are refcounted per process. When
    // A GraphicBuffer doesn't have any more sp<> in a process, it is destroyed. This causes
    // A GraphicBuffer doesn't have any more sp<> in a process, it is destroyed. This causes
    // problems when trying to implicitcly cache across process boundaries. Ideally, both sides
    // problems when trying to implicitcly cache across process boundaries. Ideally, both sides
    // of the cache would hold onto wp<> references. When an app dropped its sp<>, the GraphicBuffer
    // of the cache would hold onto wp<> references. When an app dropped its sp<>, the GraphicBuffer
+0 −28
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2018 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.
 */

#pragma once

#include "Layer.h"

namespace android {

class BufferStateLayer : public Layer {
public:
    explicit BufferStateLayer(const LayerCreationArgs& args) : Layer(args){};
};

} // namespace android
+2 −3
Original line number Original line Diff line number Diff line
@@ -65,7 +65,6 @@
#include <mutex>
#include <mutex>
#include <sstream>
#include <sstream>


#include "BufferStateLayer.h"
#include "DisplayDevice.h"
#include "DisplayDevice.h"
#include "DisplayHardware/HWComposer.h"
#include "DisplayHardware/HWComposer.h"
#include "FrameTimeline.h"
#include "FrameTimeline.h"
@@ -871,7 +870,7 @@ void Layer::prepareBufferStateClientComposition(
    float bufferWidth = getBufferSize(s).getWidth();
    float bufferWidth = getBufferSize(s).getWidth();
    float bufferHeight = getBufferSize(s).getHeight();
    float bufferHeight = getBufferSize(s).getHeight();


    // BufferStateLayers can have a "buffer size" of [0, 0, -1, -1] when no display frame has
    // Layers can have a "buffer size" of [0, 0, -1, -1] when no display frame has
    // been set and there is no parent layer bounds. In that case, the scale is meaningless so
    // been set and there is no parent layer bounds. In that case, the scale is meaningless so
    // ignore them.
    // ignore them.
    if (!getBufferSize(s).isValid()) {
    if (!getBufferSize(s).isValid()) {
@@ -3538,7 +3537,7 @@ Rect Layer::computeBufferCrop(const State& s) {
sp<Layer> Layer::createClone() {
sp<Layer> Layer::createClone() {
    LayerCreationArgs args(mFlinger.get(), nullptr, mName + " (Mirror)", 0, LayerMetadata());
    LayerCreationArgs args(mFlinger.get(), nullptr, mName + " (Mirror)", 0, LayerMetadata());
    args.textureName = mTextureName;
    args.textureName = mTextureName;
    sp<BufferStateLayer> layer = mFlinger->getFactory().createBufferStateLayer(args);
    sp<Layer> layer = mFlinger->getFactory().createBufferStateLayer(args);
    layer->mHwcSlotGenerator = mHwcSlotGenerator;
    layer->mHwcSlotGenerator = mHwcSlotGenerator;
    layer->setInitialValuesForClone(sp<Layer>::fromExisting(this));
    layer->setInitialValuesForClone(sp<Layer>::fromExisting(this));
    return layer;
    return layer;
+5 −5
Original line number Original line Diff line number Diff line
@@ -95,8 +95,8 @@ protected:
    ~ISchedulerCallback() = default;
    ~ISchedulerCallback() = default;
};
};


class Scheduler : impl::MessageQueue {
class Scheduler : android::impl::MessageQueue {
    using Impl = impl::MessageQueue;
    using Impl = android::impl::MessageQueue;


public:
public:
    Scheduler(ICompositor&, ISchedulerCallback&, FeatureFlags);
    Scheduler(ICompositor&, ISchedulerCallback&, FeatureFlags);
@@ -130,7 +130,7 @@ public:
    ConnectionHandle createConnection(const char* connectionName, frametimeline::TokenManager*,
    ConnectionHandle createConnection(const char* connectionName, frametimeline::TokenManager*,
                                      std::chrono::nanoseconds workDuration,
                                      std::chrono::nanoseconds workDuration,
                                      std::chrono::nanoseconds readyDuration,
                                      std::chrono::nanoseconds readyDuration,
                                      impl::EventThread::InterceptVSyncsCallback);
                                      android::impl::EventThread::InterceptVSyncsCallback);


    sp<IDisplayEventConnection> createDisplayEventConnection(
    sp<IDisplayEventConnection> createDisplayEventConnection(
            ConnectionHandle, EventRegistrationFlags eventRegistration = {});
            ConnectionHandle, EventRegistrationFlags eventRegistration = {});
@@ -276,9 +276,9 @@ private:


    void dispatchCachedReportedMode() REQUIRES(mPolicyLock) EXCLUDES(mRefreshRateConfigsLock);
    void dispatchCachedReportedMode() REQUIRES(mPolicyLock) EXCLUDES(mRefreshRateConfigsLock);


    impl::EventThread::ThrottleVsyncCallback makeThrottleVsyncCallback() const
    android::impl::EventThread::ThrottleVsyncCallback makeThrottleVsyncCallback() const
            EXCLUDES(mRefreshRateConfigsLock);
            EXCLUDES(mRefreshRateConfigsLock);
    impl::EventThread::GetVsyncPeriodFunction makeGetVsyncPeriodFunction() const;
    android::impl::EventThread::GetVsyncPeriodFunction makeGetVsyncPeriodFunction() const;


    std::shared_ptr<RefreshRateConfigs> holdRefreshRateConfigs() const
    std::shared_ptr<RefreshRateConfigs> holdRefreshRateConfigs() const
            EXCLUDES(mRefreshRateConfigsLock) {
            EXCLUDES(mRefreshRateConfigsLock) {
Loading