diff mbox

[i-g-t,5/5] lib/igt_kms: Remove redundant cursor code

Message ID 1487354070-14487-5-git-send-email-brian.starkey@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Brian Starkey Feb. 17, 2017, 5:54 p.m. UTC
The dynamic plane support means that there should never be gaps in the
pipe->planes array. This means we should never need to move the cursor
plane from the last slot to another.

Remove the unnecessary code, and add an assert that makes sure nothing
strange happened that broke the assignment logic.

Signed-off-by: Brian Starkey <brian.starkey@arm.com>
---
 lib/igt_kms.c |   19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

Comments

Robert Foss Feb. 19, 2017, 8:45 p.m. UTC | #1
On 2017-02-17 12:54 PM, Brian Starkey wrote:
> The dynamic plane support means that there should never be gaps in the
> pipe->planes array. This means we should never need to move the cursor
> plane from the last slot to another.
>
> Remove the unnecessary code, and add an assert that makes sure nothing
> strange happened that broke the assignment logic.

I was tempted to make this change too, but didn't quite dare risking 
introducing unexpected behavior. But I think this is the desired behavior.


Reviewed-by: Robert Foss <robert.foss@collabora.com>

>
> Signed-off-by: Brian Starkey <brian.starkey@arm.com>
> ---
>  lib/igt_kms.c |   19 +++++--------------
>  1 file changed, 5 insertions(+), 14 deletions(-)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index ef7bfd1a8108..6fbe67139d98 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -1824,20 +1824,11 @@ void igt_display_init(igt_display_t *display, int drm_fd)
>  		 */
>  		igt_assert_eq(pipe->plane_primary, 0);
>
> -		if (display->has_cursor_plane) {
> -			/*
> -			 * Cursor was put in the last slot.  If we have 0 or
> -			 * only 1 sprite, that's the wrong slot and we need to
> -			 * move it down.
> -			 */
> -			if (p != last_plane) {
> -				pipe->planes[p] =
> -					pipe->planes[last_plane];
> -				pipe->planes[p].index = p;
> -				memset(&pipe->planes[last_plane], 0,
> -				       sizeof *plane);
> -			}
> -		}
> +		/*
> +		 * There should be no gaps. If there is, something happened
> +		 * which we can't handle (e.g. all planes are cursors).
> +		 */
> +		igt_assert_eq(p, last_plane);
>
>  		pipe->n_planes = n_planes;
>
>
diff mbox

Patch

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index ef7bfd1a8108..6fbe67139d98 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1824,20 +1824,11 @@  void igt_display_init(igt_display_t *display, int drm_fd)
 		 */
 		igt_assert_eq(pipe->plane_primary, 0);
 
-		if (display->has_cursor_plane) {
-			/*
-			 * Cursor was put in the last slot.  If we have 0 or
-			 * only 1 sprite, that's the wrong slot and we need to
-			 * move it down.
-			 */
-			if (p != last_plane) {
-				pipe->planes[p] =
-					pipe->planes[last_plane];
-				pipe->planes[p].index = p;
-				memset(&pipe->planes[last_plane], 0,
-				       sizeof *plane);
-			}
-		}
+		/*
+		 * There should be no gaps. If there is, something happened
+		 * which we can't handle (e.g. all planes are cursors).
+		 */
+		igt_assert_eq(p, last_plane);
 
 		pipe->n_planes = n_planes;