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

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

Merge changes from topics "sf-hwc-abstract", "sf-ce-min"

* changes:
  SF: Move RenderEngine ownership to CompositionEngine
  SF: Set up librenderengine_mocks
  SF: Move HWComposer ownership to CompositionEngine
  SF: Introduce a minimal CompositionEngine
parents abbbbd69 b97e04fe
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -80,3 +80,19 @@ cc_library_static {
        thin: true,
    },
}

cc_library_static {
    name: "librenderengine_mocks",
    defaults: ["librenderengine_defaults"],
    srcs: [
        "mock/Framebuffer.cpp",
        "mock/Image.cpp",
        "mock/RenderEngine.cpp",
    ],
    static_libs: [
        "libgtest",
        "libgmock",
    ],
    local_include_dirs: ["include"],
    export_include_dirs: ["include"],
}
+36 −0
Original line number Diff line number Diff line
/*
 * Copyright 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 <gmock/gmock.h>
#include <renderengine/Framebuffer.h>

namespace android {
namespace renderengine {
namespace mock {

class Framebuffer : public renderengine::Framebuffer {
public:
    Framebuffer();
    ~Framebuffer() override;

    MOCK_METHOD2(setNativeWindowBuffer, bool(ANativeWindowBuffer*, bool));
};

} // namespace mock
} // namespace renderengine
} // namespace android
+36 −0
Original line number Diff line number Diff line
/*
 * Copyright 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 <gmock/gmock.h>
#include <renderengine/Image.h>

namespace android {
namespace renderengine {
namespace mock {

class Image : public renderengine::Image {
public:
    Image();
    ~Image() override;

    MOCK_METHOD2(setNativeWindowBuffer, bool(ANativeWindowBuffer* buffer, bool isProtected));
};

} // namespace mock
} // namespace renderengine
} // namespace android
+6 −23
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 * Copyright 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.
@@ -18,13 +18,12 @@

#include <gmock/gmock.h>
#include <renderengine/DisplaySettings.h>
#include <renderengine/Framebuffer.h>
#include <renderengine/Image.h>
#include <renderengine/LayerSettings.h>
#include <renderengine/Mesh.h>
#include <renderengine/RenderEngine.h>
#include <renderengine/Texture.h>
#include <ui/GraphicBuffer.h>
#include <ui/Region.h>

namespace android {
namespace renderengine {
@@ -35,7 +34,7 @@ public:
    RenderEngine();
    ~RenderEngine() override;

    MOCK_METHOD0(createFramebuffer, std::unique_ptr<Framebuffer>());
    MOCK_METHOD0(createFramebuffer, std::unique_ptr<renderengine::Framebuffer>());
    MOCK_METHOD0(createImage, std::unique_ptr<renderengine::Image>());
    MOCK_CONST_METHOD0(primeCache, void());
    MOCK_METHOD1(dump, void(std::string&));
@@ -69,9 +68,9 @@ public:
    MOCK_METHOD1(setSourceDataSpace, void(ui::Dataspace));
    MOCK_METHOD1(setOutputDataSpace, void(ui::Dataspace));
    MOCK_METHOD1(setDisplayMaxLuminance, void(const float));
    MOCK_METHOD1(bindFrameBuffer, status_t(Framebuffer*));
    MOCK_METHOD1(unbindFrameBuffer, void(Framebuffer*));
    MOCK_METHOD1(drawMesh, void(const Mesh&));
    MOCK_METHOD1(bindFrameBuffer, status_t(renderengine::Framebuffer*));
    MOCK_METHOD1(unbindFrameBuffer, void(renderengine::Framebuffer*));
    MOCK_METHOD1(drawMesh, void(const renderengine::Mesh&));
    MOCK_CONST_METHOD0(getMaxTextureSize, size_t());
    MOCK_CONST_METHOD0(getMaxViewportDims, size_t());
    MOCK_CONST_METHOD0(isProtected, bool());
@@ -82,22 +81,6 @@ public:
                          ANativeWindowBuffer*, base::unique_fd*));
};

class Image : public renderengine::Image {
public:
    Image();
    ~Image() override;

    MOCK_METHOD2(setNativeWindowBuffer, bool(ANativeWindowBuffer*, bool));
};

class Framebuffer : public renderengine::Framebuffer {
public:
    Framebuffer();
    ~Framebuffer() override;

    MOCK_METHOD2(setNativeWindowBuffer, bool(ANativeWindowBuffer*, bool));
};

} // namespace mock
} // namespace renderengine
} // namespace android
+30 −0
Original line number Diff line number Diff line
/*
 * Copyright 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.
 */

#include <renderengine/mock/Framebuffer.h>

namespace android {
namespace renderengine {
namespace mock {

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

} // namespace mock
} // namespace renderengine
} // namespace android
Loading