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

Commit bbd95457 authored by Chia-I Wu's avatar Chia-I Wu
Browse files

graphics: move ComposerBase to HAL support library

Create android.hardware.graphics.composer@2.1-hal and add
ComposerHal, which is heavily based on ComposerBase, to it.

There are two bigger TODOs.  One is to remove the concept of
"clients" from the class and the other is to remove hwcomposer2.h
dependency.

Test: boots and VTS
Change-Id: I37b4fb3ae2239bf11aa87a56d1e2ebfe0b8c6b54
parent 501cc232
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ cc_library_static {
    ],
    header_libs: [
        "android.hardware.graphics.composer@2.1-command-buffer",
        "android.hardware.graphics.composer@2.1-hal",
    ],
}

@@ -46,6 +47,7 @@ cc_library_shared {
    ],
    header_libs: [
        "android.hardware.graphics.composer@2.1-command-buffer",
        "android.hardware.graphics.composer@2.1-hal",
    ],
}

+1 −2
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@
#include <android/hardware/graphics/mapper/2.0/IMapper.h>
#include <log/log.h>

#include "ComposerBase.h"
#include "ComposerClient.h"

namespace android {
@@ -134,7 +133,7 @@ void BufferCacheEntry::clear()
    }
}

ComposerClient::ComposerClient(ComposerBase& hal)
ComposerClient::ComposerClient(ComposerHal& hal)
    : mHal(hal), mWriter(kWriterInitialSize)
{
}
+6 −4
Original line number Diff line number Diff line
@@ -22,8 +22,8 @@
#include <vector>

#include <composer-command-buffer/2.1/ComposerCommandBuffer.h>
#include <composer-hal/2.1/ComposerHal.h>
#include <hardware/hwcomposer2.h>
#include "ComposerBase.h"

namespace android {
namespace hardware {
@@ -32,6 +32,8 @@ namespace composer {
namespace V2_1 {
namespace implementation {

using namespace hal;

class BufferCacheEntry {
public:
    BufferCacheEntry();
@@ -53,7 +55,7 @@ private:

class ComposerClient : public IComposerClient {
public:
    ComposerClient(ComposerBase& hal);
    ComposerClient(ComposerHal& hal);
    virtual ~ComposerClient();

    void initialize();
@@ -191,7 +193,7 @@ protected:
        }

        ComposerClient& mClient;
        ComposerBase& mHal;
        ComposerHal& mHal;
        CommandWriterBase& mWriter;

        Display mDisplay;
@@ -200,7 +202,7 @@ protected:

    virtual std::unique_ptr<CommandReader> createCommandReader();

    ComposerBase& mHal;
    ComposerHal& mHal;

    // 64KiB minus a small space for metadata such as read/write pointers
    static constexpr size_t kWriterInitialSize =
+5 −3
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@
#include <hardware/hwcomposer2.h>
#undef HWC2_INCLUDE_STRINGIFICATION
#undef HWC2_USE_CPP11
#include "ComposerBase.h"
#include <composer-hal/2.1/ComposerHal.h>

namespace android {
    class HWC2On1Adapter;
@@ -44,6 +44,8 @@ namespace composer {
namespace V2_1 {
namespace implementation {

using namespace hal;

using android::hardware::graphics::common::V1_0::PixelFormat;
using android::hardware::graphics::common::V1_0::Transform;
using android::hardware::graphics::common::V1_0::Dataspace;
@@ -53,7 +55,7 @@ using android::hardware::graphics::common::V1_0::Hdr;

class ComposerClient;

class HwcHal : public IComposer, public ComposerBase {
class HwcHal : public IComposer, public ComposerHal {
public:
    HwcHal(const hw_module_t* module);
    virtual ~HwcHal();
@@ -63,7 +65,7 @@ public:
    Return<void> dumpDebugInfo(dumpDebugInfo_cb hidl_cb) override;
    Return<void> createClient(createClient_cb hidl_cb) override;

    // ComposerBase interface
    // ComposerHal interface
    bool hasCapability(hwc2_capability_t capability) override;
    void removeClient() override;
    void enableCallback(bool enable) override;
+29 −0
Original line number 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.

cc_library_headers {
    name: "android.hardware.graphics.composer@2.1-hal",
    defaults: ["hidl_defaults"],
    vendor_available: true,
    shared_libs: [
        "android.hardware.graphics.composer@2.1",
        "libhardware", // TODO remove hwcomposer2.h dependency
    ],
    export_shared_lib_headers: [
        "android.hardware.graphics.composer@2.1",
        "libhardware",
    ],
    export_include_dirs: ["include"],
}
Loading