Alexandru Gheorghe | c546358 | 2018-03-27 15:52:02 +0100 | [diff] [blame] | 1 | /* |
| 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 | |
Roman Stratiienko | e78235c | 2021-12-23 17:36:12 +0200 | [diff] [blame] | 20 | #include <cstring> |
Alexandru Gheorghe | c546358 | 2018-03-27 15:52:02 +0100 | [diff] [blame] | 21 | |
Roman Stratiienko | 13cc366 | 2020-08-29 21:35:39 +0300 | [diff] [blame] | 22 | #include "DrmDevice.h" |
Roman Stratiienko | 8666dc9 | 2021-02-09 17:49:55 +0200 | [diff] [blame] | 23 | #include "DrmFbImporter.h" |
Roman Stratiienko | 24a7fc4 | 2021-12-23 16:25:20 +0200 | [diff] [blame] | 24 | #include "UEventListener.h" |
Roman Stratiienko | aa3cd54 | 2020-08-29 11:26:16 +0300 | [diff] [blame] | 25 | |
Alexandru Gheorghe | c546358 | 2018-03-27 15:52:02 +0100 | [diff] [blame] | 26 | namespace android { |
| 27 | |
| 28 | class ResourceManager { |
| 29 | public: |
| 30 | ResourceManager(); |
| 31 | ResourceManager(const ResourceManager &) = delete; |
| 32 | ResourceManager &operator=(const ResourceManager &) = delete; |
Roman Stratiienko | 24a7fc4 | 2021-12-23 16:25:20 +0200 | [diff] [blame] | 33 | ~ResourceManager(); |
Roman Stratiienko | 1e053b4 | 2021-10-25 22:54:20 +0300 | [diff] [blame] | 34 | |
Alexandru Gheorghe | c546358 | 2018-03-27 15:52:02 +0100 | [diff] [blame] | 35 | int Init(); |
| 36 | DrmDevice *GetDrmDevice(int display); |
Roman Stratiienko | fc014f5 | 2021-12-23 19:04:29 +0200 | [diff] [blame^] | 37 | const std::vector<std::unique_ptr<DrmDevice>> &GetDrmDevices() const { |
Andrii Chepurnyi | 495e4cc | 2018-08-01 17:42:56 +0300 | [diff] [blame] | 38 | return drms_; |
| 39 | } |
Roman Stratiienko | fc014f5 | 2021-12-23 19:04:29 +0200 | [diff] [blame^] | 40 | int GetDisplayCount() const { |
Andrii Chepurnyi | 495e4cc | 2018-08-01 17:42:56 +0300 | [diff] [blame] | 41 | return num_displays_; |
| 42 | } |
Roman Stratiienko | e78235c | 2021-12-23 17:36:12 +0200 | [diff] [blame] | 43 | bool ForcedScalingWithGpu() const { |
Roman Stratiienko | 65f2ba8 | 2019-12-20 17:04:01 +0200 | [diff] [blame] | 44 | return scale_with_gpu_; |
| 45 | } |
Alexandru Gheorghe | c546358 | 2018-03-27 15:52:02 +0100 | [diff] [blame] | 46 | |
Roman Stratiienko | 1e053b4 | 2021-10-25 22:54:20 +0300 | [diff] [blame] | 47 | UEventListener *GetUEventListener() { |
| 48 | return &uevent_listener_; |
| 49 | } |
| 50 | |
Alexandru Gheorghe | c546358 | 2018-03-27 15:52:02 +0100 | [diff] [blame] | 51 | private: |
Roman Stratiienko | e2f2c92 | 2021-02-13 10:57:47 +0200 | [diff] [blame] | 52 | int AddDrmDevice(std::string const &path); |
Alexandru Gheorghe | c546358 | 2018-03-27 15:52:02 +0100 | [diff] [blame] | 53 | |
| 54 | int num_displays_; |
| 55 | std::vector<std::unique_ptr<DrmDevice>> drms_; |
Roman Stratiienko | 65f2ba8 | 2019-12-20 17:04:01 +0200 | [diff] [blame] | 56 | |
Roman Stratiienko | b3b5c1e | 2021-02-15 13:44:19 +0200 | [diff] [blame] | 57 | bool scale_with_gpu_{}; |
Roman Stratiienko | 1e053b4 | 2021-10-25 22:54:20 +0300 | [diff] [blame] | 58 | |
| 59 | UEventListener uevent_listener_; |
Alexandru Gheorghe | c546358 | 2018-03-27 15:52:02 +0100 | [diff] [blame] | 60 | }; |
Sean Paul | f72cccd | 2018-08-27 13:59:08 -0400 | [diff] [blame] | 61 | } // namespace android |
Alexandru Gheorghe | c546358 | 2018-03-27 15:52:02 +0100 | [diff] [blame] | 62 | |
| 63 | #endif // RESOURCEMANAGER_H |