blob: 5ffe92c41b727dfa87ac1f8b913627ca63d7a3da [file] [log] [blame]
Alexandru Gheorghec5463582018-03-27 15:52:02 +01001/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef RESOURCEMANAGER_H
18#define RESOURCEMANAGER_H
19
Alexandru Gheorghec5463582018-03-27 15:52:02 +010020#include <string.h>
21
Roman Stratiienko13cc3662020-08-29 21:35:39 +030022#include "DrmDevice.h"
Roman Stratiienko1e053b42021-10-25 22:54:20 +030023#include "UEventListener.h"
Roman Stratiienko8666dc92021-02-09 17:49:55 +020024#include "DrmFbImporter.h"
Roman Stratiienkoaa3cd542020-08-29 11:26:16 +030025
Alexandru Gheorghec5463582018-03-27 15:52:02 +010026namespace android {
27
28class ResourceManager {
29 public:
30 ResourceManager();
31 ResourceManager(const ResourceManager &) = delete;
32 ResourceManager &operator=(const ResourceManager &) = delete;
Roman Stratiienko1e053b42021-10-25 22:54:20 +030033 ~ResourceManager() {
34 uevent_listener_.Exit();
35 }
36
Alexandru Gheorghec5463582018-03-27 15:52:02 +010037 int Init();
38 DrmDevice *GetDrmDevice(int display);
Andrii Chepurnyi495e4cc2018-08-01 17:42:56 +030039 const std::vector<std::unique_ptr<DrmDevice>> &getDrmDevices() const {
40 return drms_;
41 }
42 int getDisplayCount() const {
43 return num_displays_;
44 }
Roman Stratiienko65f2ba82019-12-20 17:04:01 +020045 bool ForcedScalingWithGpu() {
46 return scale_with_gpu_;
47 }
Alexandru Gheorghec5463582018-03-27 15:52:02 +010048
Roman Stratiienko1e053b42021-10-25 22:54:20 +030049 UEventListener *GetUEventListener() {
50 return &uevent_listener_;
51 }
52
Alexandru Gheorghec5463582018-03-27 15:52:02 +010053 private:
Roman Stratiienkoe2f2c922021-02-13 10:57:47 +020054 int AddDrmDevice(std::string const &path);
Alexandru Gheorghec5463582018-03-27 15:52:02 +010055
56 int num_displays_;
57 std::vector<std::unique_ptr<DrmDevice>> drms_;
Roman Stratiienko65f2ba82019-12-20 17:04:01 +020058
Roman Stratiienkob3b5c1e2021-02-15 13:44:19 +020059 bool scale_with_gpu_{};
Roman Stratiienko1e053b42021-10-25 22:54:20 +030060
61 UEventListener uevent_listener_;
Alexandru Gheorghec5463582018-03-27 15:52:02 +010062};
Sean Paulf72cccd2018-08-27 13:59:08 -040063} // namespace android
Alexandru Gheorghec5463582018-03-27 15:52:02 +010064
65#endif // RESOURCEMANAGER_H