aboutsummaryrefslogtreecommitdiff
path: root/drm/ResourceManager.h
diff options
context:
space:
mode:
Diffstat (limited to 'drm/ResourceManager.h')
-rw-r--r--drm/ResourceManager.h66
1 files changed, 45 insertions, 21 deletions
diff --git a/drm/ResourceManager.h b/drm/ResourceManager.h
index 7102cea..88ba878 100644
--- a/drm/ResourceManager.h
+++ b/drm/ResourceManager.h
@@ -17,43 +17,67 @@
#ifndef RESOURCEMANAGER_H
#define RESOURCEMANAGER_H
-#include <string.h>
+#include <cstring>
#include "DrmDevice.h"
-#include "DrmGenericImporter.h"
+#include "DrmDisplayPipeline.h"
+#include "DrmFbImporter.h"
+#include "UEventListener.h"
namespace android {
+class PipelineToFrontendBindingInterface {
+ public:
+ virtual ~PipelineToFrontendBindingInterface() = default;
+ virtual bool BindDisplay(DrmDisplayPipeline *);
+ virtual bool UnbindDisplay(DrmDisplayPipeline *);
+ virtual void FinalizeDisplayBinding();
+};
+
class ResourceManager {
public:
- ResourceManager();
+ explicit ResourceManager(
+ PipelineToFrontendBindingInterface *p2f_bind_interface);
ResourceManager(const ResourceManager &) = delete;
ResourceManager &operator=(const ResourceManager &) = delete;
- int Init();
- DrmDevice *GetDrmDevice(int display);
- std::shared_ptr<Importer> GetImporter(int display);
- const gralloc_module_t *gralloc();
- DrmConnector *AvailableWritebackConnector(int display);
- const std::vector<std::unique_ptr<DrmDevice>> &getDrmDevices() const {
- return drms_;
- }
- int getDisplayCount() const {
- return num_displays_;
- }
- bool ForcedScalingWithGpu() {
+ ResourceManager(const ResourceManager &&) = delete;
+ ResourceManager &&operator=(const ResourceManager &&) = delete;
+ ~ResourceManager();
+
+ void Init();
+
+ void DeInit();
+
+ bool ForcedScalingWithGpu() const {
return scale_with_gpu_;
}
+ auto &GetMainLock() {
+ return main_lock_;
+ }
+
+ static auto GetTimeMonotonicNs() -> int64_t;
+
private:
- int AddDrmDevice(std::string path);
- static bool IsKMSDev(const char *path);
+ auto AddDrmDevice(std::string const &path) -> int;
+ auto GetOrderedConnectors() -> std::vector<DrmConnector *>;
+ void UpdateFrontendDisplays();
+ void DetachAllFrontendDisplays();
- int num_displays_;
std::vector<std::unique_ptr<DrmDevice>> drms_;
- std::vector<std::shared_ptr<Importer>> importers_;
- const gralloc_module_t *gralloc_;
- bool scale_with_gpu_;
+ bool scale_with_gpu_{};
+
+ UEventListener uevent_listener_;
+
+ std::mutex main_lock_;
+
+ std::map<DrmConnector *, std::unique_ptr<DrmDisplayPipeline>>
+ attached_pipelines_;
+
+ PipelineToFrontendBindingInterface *const frontend_interface_;
+
+ bool initialized_{};
};
} // namespace android