blob: 773b35038c7b419d2a9b8d9b79f3599d7ca31880 [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
Roman Stratiienkoe78235c2021-12-23 17:36:12 +020020#include <cstring>
Alexandru Gheorghec5463582018-03-27 15:52:02 +010021
Roman Stratiienko13cc3662020-08-29 21:35:39 +030022#include "DrmDevice.h"
Roman Stratiienko8666dc92021-02-09 17:49:55 +020023#include "DrmFbImporter.h"
Roman Stratiienko24a7fc42021-12-23 16:25:20 +020024#include "UEventListener.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 Stratiienko24a7fc42021-12-23 16:25:20 +020033 ~ResourceManager();
Roman Stratiienko1e053b42021-10-25 22:54:20 +030034
Alexandru Gheorghec5463582018-03-27 15:52:02 +010035 int Init();
36 DrmDevice *GetDrmDevice(int display);
Roman Stratiienkofc014f52021-12-23 19:04:29 +020037 const std::vector<std::unique_ptr<DrmDevice>> &GetDrmDevices() const {
Andrii Chepurnyi495e4cc2018-08-01 17:42:56 +030038 return drms_;
39 }
Roman Stratiienkofc014f52021-12-23 19:04:29 +020040 int GetDisplayCount() const {
Andrii Chepurnyi495e4cc2018-08-01 17:42:56 +030041 return num_displays_;
42 }
Roman Stratiienkoe78235c2021-12-23 17:36:12 +020043 bool ForcedScalingWithGpu() const {
Roman Stratiienko65f2ba82019-12-20 17:04:01 +020044 return scale_with_gpu_;
45 }
Alexandru Gheorghec5463582018-03-27 15:52:02 +010046
Roman Stratiienko1e053b42021-10-25 22:54:20 +030047 UEventListener *GetUEventListener() {
48 return &uevent_listener_;
49 }
50
Alexandru Gheorghec5463582018-03-27 15:52:02 +010051 private:
Roman Stratiienkoe2f2c922021-02-13 10:57:47 +020052 int AddDrmDevice(std::string const &path);
Alexandru Gheorghec5463582018-03-27 15:52:02 +010053
54 int num_displays_;
55 std::vector<std::unique_ptr<DrmDevice>> drms_;
Roman Stratiienko65f2ba82019-12-20 17:04:01 +020056
Roman Stratiienkob3b5c1e2021-02-15 13:44:19 +020057 bool scale_with_gpu_{};
Roman Stratiienko1e053b42021-10-25 22:54:20 +030058
59 UEventListener uevent_listener_;
Alexandru Gheorghec5463582018-03-27 15:52:02 +010060};
Sean Paulf72cccd2018-08-27 13:59:08 -040061} // namespace android
Alexandru Gheorghec5463582018-03-27 15:52:02 +010062
63#endif // RESOURCEMANAGER_H