diff mbox

[i-g-t,2/7] lib/igt_kms: Fix plane counting in igt_display_init.

Message ID 1461164389-15726-3-git-send-email-robert.foss@collabora.com (mailing list archive)
State New, archived
Headers show

Commit Message

Robert Foss April 20, 2016, 2:59 p.m. UTC
From: Robert Foss <robert.foss@collabora.com>

Fix issue where the plane counting fails due to the number and
configuration of planes being unlike the intel configuration.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 lib/igt_kms.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Tomeu Vizoso April 21, 2016, 9:46 a.m. UTC | #1
On 20 April 2016 at 16:59,  <robert.foss@collabora.com> wrote:
> From: Robert Foss <robert.foss@collabora.com>
>
> Fix issue where the plane counting fails due to the number and
> configuration of planes being unlike the intel configuration.
>
> Signed-off-by: Robert Foss <robert.foss@collabora.com>
> ---
>  lib/igt_kms.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index ef24a49..07fb73b 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -1283,6 +1283,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)
>                 igt_plane_t *plane;
>                 int p = IGT_PLANE_2;
>                 int j, type;
> +               uint8_t plane_counter = 0;

nitpick: I think it's more customary to call it n_planes or num_planes.

Regards,

Tomeu

>                 pipe->crtc_id = resources->crtcs[i];
>                 pipe->display = display;
> @@ -1330,8 +1331,10 @@ void igt_display_init(igt_display_t *display, int drm_fd)
>                                 break;
>                         }
>
> +                       plane_counter++;
>                         plane->pipe = pipe;
>                         plane->drm_plane = drm_plane;
> +
>                         if (is_atomic == 0) {
>                                 display->is_atomic = 1;
>                                 igt_atomic_fill_plane_props(display, plane, IGT_NUM_PLANE_PROPS, igt_plane_prop_names);
> @@ -1380,8 +1383,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)
>                         plane->is_cursor = true;
>                 }
>
> -               /* planes = 1 primary, (p-1) sprites, 1 cursor */
> -               pipe->n_planes = p + 1;
> +               pipe->n_planes = plane_counter;
>
>                 /* make sure we don't overflow the plane array */
>                 igt_assert(pipe->n_planes <= IGT_MAX_PLANES);
> --
> 2.5.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index ef24a49..07fb73b 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1283,6 +1283,7 @@  void igt_display_init(igt_display_t *display, int drm_fd)
 		igt_plane_t *plane;
 		int p = IGT_PLANE_2;
 		int j, type;
+		uint8_t plane_counter = 0;
 
 		pipe->crtc_id = resources->crtcs[i];
 		pipe->display = display;
@@ -1330,8 +1331,10 @@  void igt_display_init(igt_display_t *display, int drm_fd)
 				break;
 			}
 
+			plane_counter++;
 			plane->pipe = pipe;
 			plane->drm_plane = drm_plane;
+
 			if (is_atomic == 0) {
 				display->is_atomic = 1;
 				igt_atomic_fill_plane_props(display, plane, IGT_NUM_PLANE_PROPS, igt_plane_prop_names);
@@ -1380,8 +1383,7 @@  void igt_display_init(igt_display_t *display, int drm_fd)
 			plane->is_cursor = true;
 		}
 
-		/* planes = 1 primary, (p-1) sprites, 1 cursor */
-		pipe->n_planes = p + 1;
+		pipe->n_planes = plane_counter;
 
 		/* make sure we don't overflow the plane array */
 		igt_assert(pipe->n_planes <= IGT_MAX_PLANES);