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

Commit 0f93281b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes I73599f62,I8526e671,I8ab696b1,Ib7950386,I0051c41a, ...

* changes:
  SF: Introduce mock::NativeWindow
  SF: Introduce mock::DisplaySurface
  SF: Introduce mock::EventControlThread
  SF: Separate EventControlThread into interface and impl
  SF: Define mock::SurfaceInterceptor
  SF: Separate SurfaceInterceptor into interface and impl
  SF: Define mock::MessageQueue
  SF: Separate MessageQueue into interface and impl
  SF: libsurfaceflinger_unittest should skip SF ctor
  SF: Switch to internal display setup
parents fbd1be3c d16bad95
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -678,7 +678,7 @@ void BufferLayer::onFrameAvailable(const BufferItem& item) {
    // Add this buffer from our internal queue tracker
    { // Autolock scope
        Mutex::Autolock lock(mQueueItemLock);
        mFlinger->mInterceptor.saveBufferUpdate(this, item.mGraphicBuffer->getWidth(),
        mFlinger->mInterceptor->saveBufferUpdate(this, item.mGraphicBuffer->getWidth(),
                                                 item.mGraphicBuffer->getHeight(),
                                                 item.mFrameNumber);
        // Reset the frame number tracker when we receive the first buffer after
+9 −9
Original line number Diff line number Diff line
@@ -129,6 +129,7 @@ Error Device::createVirtualDisplay(uint32_t width, uint32_t height,

    auto display = std::make_unique<Display>(
            *mComposer.get(), mCapabilities, displayId, DisplayType::Virtual);
    display->setConnected(true);
    *outDisplay = display.get();
    *format = static_cast<android_pixel_format_t>(intFormat);
    mDisplays.emplace(displayId, std::move(display));
@@ -167,6 +168,7 @@ void Device::onHotplug(hwc2_display_t displayId, Connection connection) {

            auto newDisplay = std::make_unique<Display>(
                    *mComposer.get(), mCapabilities, displayId, displayType);
            newDisplay->setConnected(true);
            mDisplays.emplace(displayId, std::move(newDisplay));
        }
    } else if (connection == Connection::Disconnected) {
@@ -209,16 +211,14 @@ Error Device::flushCommands()
// Display methods

Display::Display(android::Hwc2::Composer& composer,
                 const std::unordered_set<Capability>& capabilities,
                 hwc2_display_t id, DisplayType type)
                 const std::unordered_set<Capability>& capabilities, hwc2_display_t id,
                 DisplayType type)
      : mComposer(composer),
        mCapabilities(capabilities),
        mId(id),
        mIsConnected(false),
    mType(type)
{
        mType(type) {
    ALOGV("Created display %" PRIu64, id);
    setConnected(true);
}

Display::~Display() {
+5 −2
Original line number Diff line number Diff line
@@ -48,6 +48,8 @@ namespace android {
    namespace Hwc2 {
        class Composer;
    }

    class TestableSurfaceFlinger;
}

namespace HWC2 {
@@ -126,8 +128,7 @@ private:
class Display
{
public:
    Display(android::Hwc2::Composer& composer,
            const std::unordered_set<Capability>& capabilities,
    Display(android::Hwc2::Composer& composer, const std::unordered_set<Capability>& capabilities,
            hwc2_display_t id, DisplayType type);
    ~Display();

@@ -263,6 +264,8 @@ private:
    // on this display
    Layer* getLayerById(hwc2_layer_t id) const;

    friend android::TestableSurfaceFlinger;

    // Member variables

    // These are references to data owned by HWC2::Device, which will outlive
+5 −0
Original line number Diff line number Diff line
@@ -26,6 +26,10 @@

namespace android {

EventControlThread::~EventControlThread() = default;

namespace impl {

EventControlThread::EventControlThread(EventControlThread::SetVSyncEnabledFunction function)
      : mSetVSyncEnabled(function) {
    pthread_setname_np(mThread.native_handle(), "EventControlThread");
@@ -67,4 +71,5 @@ void EventControlThread::threadMain() NO_THREAD_SAFETY_ANALYSIS {
    }
}

} // namespace impl
} // namespace android
+13 −2
Original line number Diff line number Diff line
@@ -16,8 +16,8 @@

#pragma once

#include <cstddef>
#include <condition_variable>
#include <cstddef>
#include <functional>
#include <mutex>
#include <thread>
@@ -29,13 +29,23 @@ namespace android {
class SurfaceFlinger;

class EventControlThread {
public:
    virtual ~EventControlThread();

    virtual void setVsyncEnabled(bool enabled) = 0;
};

namespace impl {

class EventControlThread final : public android::EventControlThread {
public:
    using SetVSyncEnabledFunction = std::function<void(bool)>;

    explicit EventControlThread(SetVSyncEnabledFunction function);
    ~EventControlThread();

    void setVsyncEnabled(bool enabled);
    // EventControlThread implementation
    void setVsyncEnabled(bool enabled) override;

private:
    void threadMain();
@@ -51,4 +61,5 @@ private:
    std::thread mThread{&EventControlThread::threadMain, this};
};

} // namespace impl
} // namespace android
Loading