All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH igt] igt/kms_atomic: Match CRTC harder for special planes
@ 2016-12-13 18:15 Daniel Stone
  2016-12-14  7:15 ` Robert Foss
  2016-12-14  9:25 ` Robert Foss
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Stone @ 2016-12-13 18:15 UTC (permalink / raw)
  To: intel-gfx

Our heuristic for finding planes was previously matching the type, and
ensuring that the plane was valid for that CRTC. However, VC4 now has
primary/cursor planes which can wander multiple CRTCs, so we could pick
a PRIMARY plane which was not the kernel's idea of crtc->primary,
causing plane_primary_legacy to fail; ditto for cursor.

Make find_plane try harder, by preferring to return planes which are
already on the requested CRTC.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Robert Foss <robert.foss@collabora.com>
Cc: Eric Anholt <eric@anholt.net>
---
 tests/kms_atomic.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index 1441fdf..e6d71c3 100644
--- a/tests/kms_atomic.c
+++ b/tests/kms_atomic.c
@@ -451,6 +451,7 @@ static struct kms_atomic_plane_state *
 find_plane(struct kms_atomic_state *state, enum plane_type type,
 	   struct kms_atomic_crtc_state *crtc)
 {
+	struct kms_atomic_plane_state *ret = NULL;
 	int i;
 
 	for (i = 0; i < state->num_planes; i++) {
@@ -464,10 +465,18 @@ find_plane(struct kms_atomic_state *state, enum plane_type type,
 			continue;
 
 		plane_get_current_state(plane);
-		return plane;
+
+		/* Try to find a plane that's already on this CRTC. In
+		 * particular, this ensures that for special (primary/cursor)
+		 * planes that can be on multiple CRTCs, we find the same
+		 * one that the legacy ioctls will. */
+		if (!crtc || plane->crtc_id == crtc->obj)
+			return plane;
+
+		ret = plane;
 	}
 
-	return NULL;
+	return ret;
 }
 
 static void crtc_populate_req(struct kms_atomic_crtc_state *crtc,
-- 
2.10.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH igt] igt/kms_atomic: Match CRTC harder for special planes
  2016-12-13 18:15 [PATCH igt] igt/kms_atomic: Match CRTC harder for special planes Daniel Stone
@ 2016-12-14  7:15 ` Robert Foss
  2016-12-14  9:25 ` Robert Foss
  1 sibling, 0 replies; 3+ messages in thread
From: Robert Foss @ 2016-12-14  7:15 UTC (permalink / raw)
  To: Daniel Stone, intel-gfx

Hey Daniel,

This patch looks good to me.

On 2016-12-13 01:15 PM, Daniel Stone wrote:
> Our heuristic for finding planes was previously matching the type, and
> ensuring that the plane was valid for that CRTC. However, VC4 now has
> primary/cursor planes which can wander multiple CRTCs, so we could pick
> a PRIMARY plane which was not the kernel's idea of crtc->primary,
> causing plane_primary_legacy to fail; ditto for cursor.
>
> Make find_plane try harder, by preferring to return planes which are
> already on the requested CRTC.
>
> Signed-off-by: Daniel Stone <daniels@collabora.com>
> Reported-by: Robert Foss <robert.foss@collabora.com>
> Cc: Eric Anholt <eric@anholt.net>
> ---
>  tests/kms_atomic.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
> index 1441fdf..e6d71c3 100644
> --- a/tests/kms_atomic.c
> +++ b/tests/kms_atomic.c
> @@ -451,6 +451,7 @@ static struct kms_atomic_plane_state *
>  find_plane(struct kms_atomic_state *state, enum plane_type type,
>  	   struct kms_atomic_crtc_state *crtc)
>  {
> +	struct kms_atomic_plane_state *ret = NULL;
>  	int i;
>
>  	for (i = 0; i < state->num_planes; i++) {
> @@ -464,10 +465,18 @@ find_plane(struct kms_atomic_state *state, enum plane_type type,
>  			continue;
>
>  		plane_get_current_state(plane);
> -		return plane;
> +
> +		/* Try to find a plane that's already on this CRTC. In
> +		 * particular, this ensures that for special (primary/cursor)
> +		 * planes that can be on multiple CRTCs, we find the same
> +		 * one that the legacy ioctls will. */
> +		if (!crtc || plane->crtc_id == crtc->obj)
> +			return plane;
> +
> +		ret = plane;
>  	}
>
> -	return NULL;
> +	return ret;
>  }
>
>  static void crtc_populate_req(struct kms_atomic_crtc_state *crtc,
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH igt] igt/kms_atomic: Match CRTC harder for special planes
  2016-12-13 18:15 [PATCH igt] igt/kms_atomic: Match CRTC harder for special planes Daniel Stone
  2016-12-14  7:15 ` Robert Foss
@ 2016-12-14  9:25 ` Robert Foss
  1 sibling, 0 replies; 3+ messages in thread
From: Robert Foss @ 2016-12-14  9:25 UTC (permalink / raw)
  To: Daniel Stone, intel-gfx

Pushed, thanks.


Rob.

On 2016-12-13 01:15 PM, Daniel Stone wrote:
> Our heuristic for finding planes was previously matching the type, and
> ensuring that the plane was valid for that CRTC. However, VC4 now has
> primary/cursor planes which can wander multiple CRTCs, so we could pick
> a PRIMARY plane which was not the kernel's idea of crtc->primary,
> causing plane_primary_legacy to fail; ditto for cursor.
>
> Make find_plane try harder, by preferring to return planes which are
> already on the requested CRTC.
>
> Signed-off-by: Daniel Stone <daniels@collabora.com>
> Reported-by: Robert Foss <robert.foss@collabora.com>
> Cc: Eric Anholt <eric@anholt.net>
> ---
>  tests/kms_atomic.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
> index 1441fdf..e6d71c3 100644
> --- a/tests/kms_atomic.c
> +++ b/tests/kms_atomic.c
> @@ -451,6 +451,7 @@ static struct kms_atomic_plane_state *
>  find_plane(struct kms_atomic_state *state, enum plane_type type,
>  	   struct kms_atomic_crtc_state *crtc)
>  {
> +	struct kms_atomic_plane_state *ret = NULL;
>  	int i;
>
>  	for (i = 0; i < state->num_planes; i++) {
> @@ -464,10 +465,18 @@ find_plane(struct kms_atomic_state *state, enum plane_type type,
>  			continue;
>
>  		plane_get_current_state(plane);
> -		return plane;
> +
> +		/* Try to find a plane that's already on this CRTC. In
> +		 * particular, this ensures that for special (primary/cursor)
> +		 * planes that can be on multiple CRTCs, we find the same
> +		 * one that the legacy ioctls will. */
> +		if (!crtc || plane->crtc_id == crtc->obj)
> +			return plane;
> +
> +		ret = plane;
>  	}
>
> -	return NULL;
> +	return ret;
>  }
>
>  static void crtc_populate_req(struct kms_atomic_crtc_state *crtc,
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-12-14  9:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-13 18:15 [PATCH igt] igt/kms_atomic: Match CRTC harder for special planes Daniel Stone
2016-12-14  7:15 ` Robert Foss
2016-12-14  9:25 ` Robert Foss

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.