aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorRoman Stratiienko <r.stratiienko@gmail.com>2020-08-29 11:26:16 +0300
committerRoman Stratiienko <r.stratiienko@gmail.com>2020-09-08 22:34:52 +0300
commitaa3cd5456293a2a30a142824e58fd8dd92e628c6 (patch)
tree0281eeaad8815f0a23d4439db457e63c654592d2 /backend
parentfbf5c0ca45b3c4dd1d9621eb5198c3d43f1afbf6 (diff)
downloaddrm_hwcomposer-aa3cd5456293a2a30a142824e58fd8dd92e628c6.tar.gz
drm_hwcomposer: move header files into source directory
... to improve navigation between source/header file. Unnecessary dependencies also removed. Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com> Change-Id: I2c3bf993b8c5f356490433fd94e90011487a1276
Diffstat (limited to 'backend')
-rw-r--r--backend/backend.cpp1
-rw-r--r--backend/backend.h38
-rw-r--r--backend/backendclient.cpp1
-rw-r--r--backend/backendclient.h33
-rw-r--r--backend/backendmanager.cpp2
-rw-r--r--backend/backendmanager.h58
-rw-r--r--backend/backendrcardu.h32
7 files changed, 161 insertions, 4 deletions
diff --git a/backend/backend.cpp b/backend/backend.cpp
index 08ee5a7..e36c47e 100644
--- a/backend/backend.cpp
+++ b/backend/backend.cpp
@@ -16,7 +16,6 @@
#include "backend.h"
#include "backendmanager.h"
-#include "drmhwctwo.h"
namespace android {
diff --git a/backend/backend.h b/backend/backend.h
new file mode 100644
index 0000000..cd9d8cd
--- /dev/null
+++ b/backend/backend.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#ifndef ANDROID_BACKEND_H
+#define ANDROID_BACKEND_H
+
+#include "drmhwctwo.h"
+
+namespace android {
+
+class Backend {
+ public:
+ virtual ~Backend() = default;
+ virtual HWC2::Error ValidateDisplay(DrmHwcTwo::HwcDisplay *display,
+ uint32_t *num_types,
+ uint32_t *num_requests);
+ virtual std::tuple<int, int> GetClientLayers(
+ DrmHwcTwo::HwcDisplay *display,
+ const std::map<uint32_t, DrmHwcTwo::HwcLayer *> &z_map);
+ virtual bool IsClientLayer(DrmHwcTwo::HwcDisplay *display,
+ DrmHwcTwo::HwcLayer *layer);
+};
+} // namespace android
+
+#endif
diff --git a/backend/backendclient.cpp b/backend/backendclient.cpp
index 3f3cd44..a9418da 100644
--- a/backend/backendclient.cpp
+++ b/backend/backendclient.cpp
@@ -16,7 +16,6 @@
#include "backendclient.h"
#include "backendmanager.h"
-#include "drmhwctwo.h"
namespace android {
diff --git a/backend/backendclient.h b/backend/backendclient.h
new file mode 100644
index 0000000..361160f
--- /dev/null
+++ b/backend/backendclient.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#ifndef ANDROID_BACKEND_CLIENT_H
+#define ANDROID_BACKEND_CLIENT_H
+
+#include "backend.h"
+#include "drmhwctwo.h"
+
+namespace android {
+
+class BackendClient : public Backend {
+ public:
+ HWC2::Error ValidateDisplay(DrmHwcTwo::HwcDisplay *display,
+ uint32_t *num_types,
+ uint32_t *num_requests) override;
+};
+} // namespace android
+
+#endif
diff --git a/backend/backendmanager.cpp b/backend/backendmanager.cpp
index 80ec827..03ad704 100644
--- a/backend/backendmanager.cpp
+++ b/backend/backendmanager.cpp
@@ -17,8 +17,6 @@
#define LOG_TAG "hwc-backend"
#include "backendmanager.h"
-#include "backend.h"
-#include "drmhwctwo.h"
#include <cutils/properties.h>
#include <log/log.h>
diff --git a/backend/backendmanager.h b/backend/backendmanager.h
new file mode 100644
index 0000000..f18637d
--- /dev/null
+++ b/backend/backendmanager.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#ifndef ANDROID_BACKEND_MANAGER_H
+#define ANDROID_BACKEND_MANAGER_H
+
+#include <functional>
+#include <map>
+#include <string>
+#include <vector>
+
+#include "backend.h"
+#include "drmhwctwo.h"
+
+#define REGISTER_BACKEND(name_str_, backend_) \
+ static int \
+ backend = BackendManager::GetInstance() \
+ .RegisterBackend(name_str_, \
+ []() -> std::unique_ptr<Backend> { \
+ return std::make_unique<backend_>(); \
+ });
+
+namespace android {
+
+class BackendManager {
+ public:
+ using backend_constructor_t = std::function<std::unique_ptr<Backend>()>;
+ static BackendManager &GetInstance();
+ int RegisterBackend(const std::string &name,
+ backend_constructor_t backend_constructor);
+ int SetBackendForDisplay(DrmHwcTwo::HwcDisplay *display);
+ std::unique_ptr<Backend> GetBackendByName(std::string &name);
+ HWC2::Error ValidateDisplay(DrmHwcTwo::HwcDisplay *display,
+ uint32_t *num_types, uint32_t *num_requests);
+
+ private:
+ BackendManager() = default;
+
+ static const std::vector<std::string> client_devices_;
+
+ std::map<std::string, backend_constructor_t> available_backends_;
+};
+} // namespace android
+
+#endif
diff --git a/backend/backendrcardu.h b/backend/backendrcardu.h
new file mode 100644
index 0000000..29ccea9
--- /dev/null
+++ b/backend/backendrcardu.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#ifndef HWC_DISPLAY_BACKEND_RCAR_DU_H
+#define HWC_DISPLAY_BACKEND_RCAR_DU_H
+
+#include "backend.h"
+#include "drmhwctwo.h"
+
+namespace android {
+
+class BackendRCarDu : public Backend {
+ public:
+ bool IsClientLayer(DrmHwcTwo::HwcDisplay *display,
+ DrmHwcTwo::HwcLayer *layer) override;
+};
+} // namespace android
+
+#endif