1From 38c67d13993fd5454226934a22be558d2a6a8233 Mon Sep 17 00:00:00 2001 2From: Jeffy Chen <jeffy.chen@rock-chips.com> 3Date: Mon, 23 May 2022 11:46:38 +0800 4Subject: [PATCH 1/3] kms: Use Nth primary plane for Nth CRTC 5 6Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> 7--- 8 src/ws/atomic_kms_window_system.cpp | 10 ++++++++-- 9 1 file changed, 8 insertions(+), 2 deletions(-) 10 11diff --git a/src/ws/atomic_kms_window_system.cpp b/src/ws/atomic_kms_window_system.cpp 12index 1aa7948..b5c2ab5 100644 13--- a/src/ws/atomic_kms_window_system.cpp 14+++ b/src/ws/atomic_kms_window_system.cpp 15@@ -98,6 +98,7 @@ ManagedResource<drmModePlanePtr> get_plane_for_crtc( 16 if (!plane_resources) 17 throw ErrnoError{"Failed to get plane resources"}; 18 19+ auto num_primaries = 0; 20 for (auto i = 0u; i < plane_resources->count_planes; ++i) 21 { 22 auto plane = ManagedResource<drmModePlanePtr>{ 23@@ -107,12 +108,17 @@ ManagedResource<drmModePlanePtr> get_plane_for_crtc( 24 if (!plane) 25 throw ErrnoError{"Failed to get plane"}; 26 27+ if (!is_plane_primary(drm_fd, plane)) 28+ continue; 29+ 30+ /* Nth primary plane for Nth CRTC */ 31+ if (num_primaries ++ != crtc_index) 32+ continue; 33+ 34 if (does_plane_support_crtc_index(plane, crtc_index)) 35 { 36 ret_plane = std::move(plane); 37 38- if (is_plane_primary(drm_fd, ret_plane)) 39- break; 40 } 41 } 42 43-- 442.20.1 45 46