From 0b44bbe9279886d9adcb08df2a93e27dd790c6e7 Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Sat, 11 Mar 2017 13:43:56 +0200 Subject: ResourceManager: reserve_generic_plane() for either primary or overlay --- kms++util/src/resourcemanager.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'kms++util/src/resourcemanager.cpp') diff --git a/kms++util/src/resourcemanager.cpp b/kms++util/src/resourcemanager.cpp index 5c83ad7..23a1480 100644 --- a/kms++util/src/resourcemanager.cpp +++ b/kms++util/src/resourcemanager.cpp @@ -129,7 +129,26 @@ Crtc* ResourceManager::reserve_crtc(Connector* conn) Plane* ResourceManager::reserve_plane(Crtc* crtc, PlaneType type, PixelFormat format) { for (Plane* plane : crtc->get_possible_planes()) { - if (plane->plane_type() != type) + if (plane->plane_type() == type) + continue; + + if (format != PixelFormat::Undefined && !plane->supports_format(format)) + continue; + + if (contains(m_reserved_planes, plane)) + continue; + + m_reserved_planes.push_back(plane); + return plane; + } + + return nullptr; +} + +Plane* ResourceManager::reserve_generic_plane(Crtc* crtc, PixelFormat format) +{ + for (Plane* plane : crtc->get_possible_planes()) { + if (plane->plane_type() == PlaneType::Cursor) continue; if (format != PixelFormat::Undefined && !plane->supports_format(format)) -- cgit v1.2.3