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

Commit 542307f7 authored by Lloyd Pique's avatar Lloyd Pique
Browse files

SF: Move DisplaySurface into CompositionEngine

The CompositionEngine now provides the interface for a DisplaySurface.

For the moment SurfaceFlinger still provides implementations, but those
may be moved into CompositionEngine too.

Test: atest libsurfaceflinger_unittest libcompositionengine_test
Bug: 121291683
Change-Id: I446e57952d59abc137b3b23203b2e093f6262ef3
parent 32cbe28e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ cc_library {
    srcs: [
        "src/CompositionEngine.cpp",
        "src/Display.cpp",
        "src/DisplaySurface.cpp",
        "src/DumpHelpers.cpp",
        "src/Output.cpp",
        "src/OutputCompositionState.cpp",
@@ -50,6 +51,7 @@ cc_library {
    srcs: [
        "mock/CompositionEngine.cpp",
        "mock/Display.cpp",
        "mock/DisplaySurface.cpp",
        "mock/Output.cpp",
    ],
    static_libs: [
+12 −16
Original line number Diff line number Diff line
@@ -14,23 +14,27 @@
 * limitations under the License.
 */

#ifndef ANDROID_SF_DISPLAY_SURFACE_H
#define ANDROID_SF_DISPLAY_SURFACE_H
#pragma once

#include <utils/Errors.h>
#include <utils/RefBase.h>
#include <utils/StrongPointer.h>

// ---------------------------------------------------------------------------
namespace android {
// ---------------------------------------------------------------------------

class Fence;
class IGraphicBufferProducer;
class String8;

namespace compositionengine {

/**
 * An abstraction for working with a display surface (buffer queue)
 */
class DisplaySurface : public virtual RefBase {
public:
    virtual ~DisplaySurface();

    // beginFrame is called at the beginning of the composition loop, before
    // the configuration is known. The DisplaySurface should do anything it
    // needs to do to enable HWComposer to decide how to compose the frame.
@@ -70,15 +74,7 @@ public:
    virtual void resizeBuffers(const uint32_t w, const uint32_t h) = 0;

    virtual const sp<Fence>& getClientTargetAcquireFence() const = 0;

protected:
    DisplaySurface() {}
    virtual ~DisplaySurface() {}
};

// ---------------------------------------------------------------------------
} // namespace compositionengine
} // namespace android
// ---------------------------------------------------------------------------

#endif // ANDROID_SF_DISPLAY_SURFACE_H
+5 −9
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 * Copyright 2019 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.
@@ -16,16 +16,13 @@

#pragma once

#include <compositionengine/DisplaySurface.h>
#include <gmock/gmock.h>

#include <utils/String8.h>

#include "DisplayHardware/DisplaySurface.h"

namespace android {
namespace mock {
namespace android::compositionengine::mock {

class DisplaySurface : public android::DisplaySurface {
class DisplaySurface : public compositionengine::DisplaySurface {
public:
    DisplaySurface();
    ~DisplaySurface() override;
@@ -39,5 +36,4 @@ public:
    MOCK_CONST_METHOD0(getClientTargetAcquireFence, const sp<Fence>&());
};

} // namespace mock
} // namespace android
} // namespace android::compositionengine::mock
+26 −0
Original line number Diff line number Diff line
/*
 * Copyright 2019 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.
 */

#include "compositionengine/mock/DisplaySurface.h"

namespace android::compositionengine::mock {

// The Google Mock documentation recommends explicit non-header instantiations
// for better compile time performance.
DisplaySurface::DisplaySurface() = default;
DisplaySurface::~DisplaySurface() = default;

} // namespace android::compositionengine::mock
+4 −8
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 * Copyright 2019 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.
@@ -14,14 +14,10 @@
 * limitations under the License.
 */

#include "mock/DisplayHardware/MockDisplaySurface.h"
#include <compositionengine/DisplaySurface.h>

namespace android {
namespace mock {
namespace android::compositionengine {

// Explicit default instantiation is recommended.
DisplaySurface::DisplaySurface() = default;
DisplaySurface::~DisplaySurface() = default;

} // namespace mock
} // namespace android
} // namespace android::compositionengine
Loading