Re: [PATCH i-g-t v5] lib/igt_kms: Add plane type verification in igt_crtc_get_plane_type
Kamil Konieczny <[email protected]> Fri, 24 Jul 2026 12:43:24 +0200
| Newsgroups | org.freedesktop.lists.igt-dev |
|---|---|
| Message-ID | <[email protected]> |
Hi Jing-Ping,
On 2026-07-23 at 17:18:02 +0800, Jing-Ping Jan wrote:
> Verify plane type matches requested type to avoid returning invalid
> planes.
>
> Fixes: 5426dc0a889a ("lib/kms: Skip rather than fail when a suitable plane can't be found")
> Cc: Chris Wilson <[email protected]>
> Cc: Ville Syrjälä <[email protected]>
> Cc: Swati Sharma <[email protected]>
> Cc: Karthik B S <[email protected]>
> Signed-off-by: Jing-Ping Jan <[email protected]>
Applied, thanks!
Regards,
Kamil
> ---
> v5:
> - update Chris's email
> - update commit subject
> - print found type value only
> v4:
> - Remove unintended changes
> v3:
> - Moving condition after old one
> - print type string instead of enum value
> v2:
> - Cc Swati and Karthik.
> - split condition with additional branch
>
> lib/igt_kms.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 2eefb773b..6b4d58237 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -3537,6 +3537,13 @@ igt_plane_t *igt_crtc_get_plane_type(igt_crtc_t *crtc, int plane_type)
> "Valid pipe->planes idx not found. plane_idx=%d plane_type=%d n_planes=%d\n",
> plane_idx, plane_type, crtc->n_planes);
>
> + igt_require_f(crtc->planes[plane_idx].type == plane_type,
> + "Unexpected plane type, found plane_idx=%d, "
> + "type=%d != requested plane_type=%d (%s)\n", plane_idx,
> + crtc->planes[plane_idx].type,
> + plane_type,
> + plane_type == DRM_PLANE_TYPE_PRIMARY ? "PRIMARY" : "CURSOR");
> +
> return &crtc->planes[plane_idx];
> }
>
> --
> 2.55.0.229.g6434b31f56-goog
>