diff options
author | Jyri Sarha <jsarha@ti.com> | 2017-03-11 13:43:56 +0200 |
---|---|---|
committer | Jyri Sarha <jsarha@ti.com> | 2017-03-20 18:20:40 +0200 |
commit | 0b44bbe9279886d9adcb08df2a93e27dd790c6e7 (patch) | |
tree | 301afc316193200f06e8acfc9fef61979a9119f6 /kms++util | |
parent | 12ad56d1360d6140093f2871c32593751b8ae052 (diff) |
ResourceManager: reserve_generic_plane() for either primary or overlay
Diffstat (limited to 'kms++util')
-rw-r--r-- | kms++util/inc/kms++util/resourcemanager.h | 1 | ||||
-rw-r--r-- | kms++util/src/resourcemanager.cpp | 21 |
2 files changed, 21 insertions, 1 deletions
diff --git a/kms++util/inc/kms++util/resourcemanager.h b/kms++util/inc/kms++util/resourcemanager.h index dac6c9e..b4a210d 100644 --- a/kms++util/inc/kms++util/resourcemanager.h +++ b/kms++util/inc/kms++util/resourcemanager.h @@ -16,6 +16,7 @@ public: Connector* reserve_connector(Connector* conn); Crtc* reserve_crtc(Connector* conn); Plane* reserve_plane(Crtc* crtc, PlaneType type, PixelFormat format = PixelFormat::Undefined); + 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 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)) |