summaryrefslogtreecommitdiff
path: root/lib/igt_kms.h
diff options
context:
space:
mode:
authorJessica Zhang <quic_jesszhan@quicinc.com>2022-05-16 18:37:12 -0700
committerAbhinav Kumar <quic_abhinavk@quicinc.com>2022-05-27 09:28:50 -0700
commit58a5a2d5be19b916311541401aaa48b787f9a185 (patch)
treee2ea3defc65359bb1a06b3898669e9ea200acebd /lib/igt_kms.h
parent5b17cb8eae3b1f8232d6aaeaf29aaaf310ff022e (diff)
lib/igt_kms: Set pipe->plane_primary to driver-assigned primary plane when there are multiple possible primary planes
Currently, IGT populates pipe->planes using possible_crtcs and assumes that the first primary plane it encounters is the one being actively used by the pipe. This is not always true in cases where there are multiple possible primary planes. This will cause problems whenever IGT calls drmModePageFlip since drmModePageFlip will use the primary plane assigned to the pipe by the driver to perform the page flip [1]. So a mismatch between the primary plane used by IGT and the driver can cause the page flip to fail. To fix this, let's implement a helper method to get the primary plane that's being assigned to the pipe by the driver. We can then call it during igt_display_require() and, if there's a mismatch between pipe->plane_primary and the assigned primary plane's index, we can swap the unused primary plane with the driver-assigned primary plane [1] https://gitlab.freedesktop.org/drm/msm/-/blob/msm-next/drivers/gpu/drm/drm_plane.c#L1234 Changes since v1: - Instead of swapping the pointers of the planes within the array, we can just change the value of pipe->plane_primary. Changes since v2: - Reverted `if (type == DRM_PLANE_TYPE_PRIMARY)` conditional then added a nested if statement to increment num_primary_planes if plane type is primary. Changes since v3: - Created helper method igt_pipe_has_valid_output and added a check for if pipe has valid output before getting the output of a pipe to get the assigned primary plane - Reverted back to using igt_swap to swap the order of the primary planes within the pipe->planes array. Some kms_* tests use igt_output_get_plane(output, 0) to get the primary plane, so this will avoid regressions in those tests. - Updated the plane->index of the primary planes that are being swapped. Suggested-by: Rob Clark <robdclark@chromium.org> Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com> Acked-by: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Mark Yacoub <markyacoub@chromium.org>
Diffstat (limited to 'lib/igt_kms.h')
-rw-r--r--lib/igt_kms.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 1f33e4f1..ba0bf4d6 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -383,6 +383,7 @@ struct igt_pipe {
bool enabled;
int n_planes;
+ int num_primary_planes;
int plane_cursor;
int plane_primary;
igt_plane_t *planes;