summaryrefslogtreecommitdiff
path: root/kms++util
diff options
context:
space:
mode:
Diffstat (limited to 'kms++util')
-rw-r--r--kms++util/inc/kms++util/resourcemanager.h2
-rw-r--r--kms++util/src/resourcemanager.cpp26
2 files changed, 28 insertions, 0 deletions
diff --git a/kms++util/inc/kms++util/resourcemanager.h b/kms++util/inc/kms++util/resourcemanager.h
index b4a210d..002b4c9 100644
--- a/kms++util/inc/kms++util/resourcemanager.h
+++ b/kms++util/inc/kms++util/resourcemanager.h
@@ -15,7 +15,9 @@ public:
Connector* reserve_connector(const std::string& name = "");
Connector* reserve_connector(Connector* conn);
Crtc* reserve_crtc(Connector* conn);
+ Crtc* reserve_crtc(Crtc* crtc);
Plane* reserve_plane(Crtc* crtc, PlaneType type, PixelFormat format = PixelFormat::Undefined);
+ Plane* reserve_plane(Plane* plane);
Plane* reserve_generic_plane(Crtc* crtc, PixelFormat format = PixelFormat::Undefined);
Plane* reserve_primary_plane(Crtc* crtc, PixelFormat format = PixelFormat::Undefined);
Plane* reserve_overlay_plane(Crtc* crtc, PixelFormat format = PixelFormat::Undefined);
diff --git a/kms++util/src/resourcemanager.cpp b/kms++util/src/resourcemanager.cpp
index c4bf7f8..465d817 100644
--- a/kms++util/src/resourcemanager.cpp
+++ b/kms++util/src/resourcemanager.cpp
@@ -132,6 +132,19 @@ Crtc* ResourceManager::reserve_crtc(Connector* conn)
return nullptr;
}
+Crtc* ResourceManager::reserve_crtc(Crtc* crtc)
+{
+ if (!crtc)
+ return nullptr;
+
+ if (contains(m_reserved_crtcs, crtc))
+ return nullptr;
+
+ m_reserved_crtcs.push_back(crtc);
+
+ return crtc;
+}
+
Plane* ResourceManager::reserve_plane(Crtc* crtc, PlaneType type, PixelFormat format)
{
if (!crtc)
@@ -154,6 +167,19 @@ Plane* ResourceManager::reserve_plane(Crtc* crtc, PlaneType type, PixelFormat fo
return nullptr;
}
+Plane* ResourceManager::reserve_plane(Plane* plane)
+{
+ if (!plane)
+ return nullptr;
+
+ if (contains(m_reserved_planes, plane))
+ return nullptr;
+
+ m_reserved_planes.push_back(plane);
+
+ return plane;
+}
+
Plane* ResourceManager::reserve_generic_plane(Crtc* crtc, PixelFormat format)
{
if (!crtc)