diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2017-11-22 10:05:53 +0200 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2017-11-22 12:47:15 +0200 |
commit | a4724a1dae7a877ae7bb7082b068bbb12032ff63 (patch) | |
tree | ef3264139d2f48c39787d3f692a834da3f8581ea /kms++util | |
parent | 448dec0fa7e398bff2152f5e01671353af03bc8c (diff) |
kmstest: use resman
Diffstat (limited to 'kms++util')
-rw-r--r-- | kms++util/inc/kms++util/resourcemanager.h | 2 | ||||
-rw-r--r-- | kms++util/src/resourcemanager.cpp | 26 |
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) |