[Intel-gfx] [PATCH i-g-t] igt_kms: Remove support for drivers with <1 drm_plane

Daniel Vetter daniel at ffwll.ch
Thu Dec 8 16:01:51 UTC 2016


On Wed, Dec 07, 2016 at 07:16:13PM -0500, Lyude wrote:
> We've had support for universal planes since kernel version 3.15, so
> there's not really a good reason to try supporting drivers that lack
> plane support now. As well, the current has_universal_planes logic is
> broken anyway as it makes the assumption that having display planes
> always means we have both a primary plane and a cursor plane (this isn't
> true on radeon/amdgpu and nouveau).
> 
> So, remove this, and just check for whether or not we have a cursor
> plane.
> 
> Signed-off-by: Lyude <lyude at redhat.com>

lgtm, feel free to push.
-Daniel

> ---
>  lib/igt_kms.c                     | 29 ++++++++++-------------------
>  lib/igt_kms.h                     |  2 +-
>  tests/kms_crtc_background_color.c |  2 --
>  tests/kms_plane_scaling.c         |  1 -
>  tests/kms_rotation_crc.c          | 25 +++++++++++++------------
>  tests/kms_universal_plane.c       |  5 +----
>  6 files changed, 25 insertions(+), 39 deletions(-)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 82bb41d..0e7b8e8 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -1407,7 +1407,6 @@ void igt_display_init(igt_display_t *display, int drm_fd)
>  				plane = &pipe->planes[IGT_PLANE_PRIMARY];
>  				plane->is_primary = 1;
>  				plane->index = IGT_PLANE_PRIMARY;
> -				display->has_universal_planes = 1;
>  				break;
>  			case DRM_PLANE_TYPE_CURSOR:
>  				/*
> @@ -1420,7 +1419,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)
>  				plane = &pipe->planes[IGT_PLANE_CURSOR];
>  				plane->is_cursor = 1;
>  				plane->index = IGT_PLANE_CURSOR;
> -				display->has_universal_planes = 1;
> +				display->has_cursor_plane = true;
>  				break;
>  			default:
>  				plane = &pipe->planes[p];
> @@ -1445,35 +1444,27 @@ void igt_display_init(igt_display_t *display, int drm_fd)
>  			plane->rotation = (igt_rotation_t)prop_value;
>  		}
>  
> -		if (display->has_universal_planes) {
> -			/*
> -			 * If we have universal planes, we should have both
> -			 * primary and cursor planes setup now.
> -			 */
> -			igt_assert(pipe->planes[IGT_PLANE_PRIMARY].drm_plane &&
> -				   pipe->planes[IGT_PLANE_CURSOR].drm_plane);
> +		/*
> +		 * At the bare minimum, we should expect to have a primary
> +		 * plane
> +		 */
> +		igt_assert(pipe->planes[IGT_PLANE_PRIMARY].drm_plane);
>  
> +		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 != IGT_PLANE_CURSOR) {
> -				pipe->planes[p] = pipe->planes[IGT_PLANE_CURSOR];
> +				pipe->planes[p] =
> +					pipe->planes[IGT_PLANE_CURSOR];
>  				pipe->planes[p].index = p;
>  				memset(&pipe->planes[IGT_PLANE_CURSOR], 0,
>  				       sizeof *plane);
>  			}
>  		} else {
> -			/*
> -			 * No universal plane support.  Add drm_plane-less
> -			 * primary and cursor planes.
> -			 */
> -			plane = &pipe->planes[IGT_PLANE_PRIMARY];
> -			plane->pipe = pipe;
> -			plane->index = IGT_PLANE_PRIMARY;
> -			plane->is_primary = true;
> -
> +			/* Add drm_plane-less cursor */
>  			plane = &pipe->planes[p];
>  			plane->pipe = pipe;
>  			plane->index = p;
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 6422adc..0dcb325 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -311,7 +311,7 @@ struct igt_display {
>  	unsigned long pipes_in_use;
>  	igt_output_t *outputs;
>  	igt_pipe_t pipes[I915_MAX_PIPES];
> -	bool has_universal_planes;
> +	bool has_cursor_plane;
>  	bool is_atomic;
>  };
>  
> diff --git a/tests/kms_crtc_background_color.c b/tests/kms_crtc_background_color.c
> index b97c114..537d4ce 100644
> --- a/tests/kms_crtc_background_color.c
> +++ b/tests/kms_crtc_background_color.c
> @@ -131,8 +131,6 @@ static void test_crtc_background(data_t *data)
>  	enum pipe pipe;
>  	int valid_tests = 0;
>  
> -	igt_require(data->display.has_universal_planes);
> -
>  	for_each_pipe_with_valid_output(display, pipe, output) {
>  		igt_plane_t *plane;
>  
> diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
> index 4546ce5..368da09 100644
> --- a/tests/kms_plane_scaling.c
> +++ b/tests/kms_plane_scaling.c
> @@ -183,7 +183,6 @@ static void test_plane_scaling(data_t *d)
>  	int valid_tests = 0;
>  	int primary_plane_scaling = 0; /* For now */
>  
> -	igt_require(d->display.has_universal_planes);
>  	igt_require(d->num_scalers);
>  
>  	for_each_pipe_with_valid_output(display, pipe, output) {
> diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
> index 6cc1533..796b448 100644
> --- a/tests/kms_rotation_crc.c
> +++ b/tests/kms_rotation_crc.c
> @@ -106,10 +106,8 @@ static void commit_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
>  	if (!plane->is_cursor)
>  		igt_plane_set_position(plane, data->pos_x, data->pos_y);
>  
> -	if (plane->is_primary || plane->is_cursor) {
> -		igt_require(data->display.has_universal_planes);
> +	if (plane->is_primary || plane->is_cursor)
>  		commit = COMMIT_UNIVERSAL;
> -	}
>  
>  	if (data->display.is_atomic)
>  		commit = COMMIT_ATOMIC;
> @@ -248,10 +246,11 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
>  	unsigned int flip_count;
>  	int ret;
>  
> -	if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) {
> -		igt_require(data->display.has_universal_planes);
> +	if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR)
>  		commit = COMMIT_UNIVERSAL;
> -	}
> +
> +	if (plane_type == IGT_PLANE_CURSOR)
> +		igt_require(display->has_cursor_plane);
>  
>  	if (data->display.is_atomic)
>  		commit = COMMIT_ATOMIC;
> @@ -341,10 +340,11 @@ static void test_plane_rotation_ytiled_obj(data_t *data, enum igt_plane plane_ty
>  	plane = igt_output_get_plane(output, plane_type);
>  	igt_require(igt_plane_supports_rotation(plane));
>  
> -	if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) {
> -		igt_require(data->display.has_universal_planes);
> +	if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR)
>  		commit = COMMIT_UNIVERSAL;
> -	}
> +
> +	if (plane_type == IGT_PLANE_CURSOR)
> +		igt_require(display->has_cursor_plane);
>  
>  	if (data->display.is_atomic)
>  		commit = COMMIT_ATOMIC;
> @@ -408,10 +408,11 @@ static void test_plane_rotation_exhaust_fences(data_t *data, enum igt_plane plan
>  	plane = igt_output_get_plane(output, plane_type);
>  	igt_require(igt_plane_supports_rotation(plane));
>  
> -	if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) {
> -		igt_require(data->display.has_universal_planes);
> +	if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR)
>  		commit = COMMIT_UNIVERSAL;
> -	}
> +
> +	if (plane_type == IGT_PLANE_CURSOR)
> +		igt_require(display->has_cursor_plane);
>  
>  	if (data->display.is_atomic)
>  		commit = COMMIT_ATOMIC;
> diff --git a/tests/kms_universal_plane.c b/tests/kms_universal_plane.c
> index b06b51e..b9e0651 100644
> --- a/tests/kms_universal_plane.c
> +++ b/tests/kms_universal_plane.c
> @@ -134,7 +134,6 @@ functional_test_pipe(data_t *data, enum pipe pipe, igt_output_t *output)
>  	int num_primary = 0, num_cursor = 0;
>  	int i;
>  
> -	igt_assert(data->display.has_universal_planes);
>  	igt_skip_on(pipe >= display->n_pipes);
>  
>  	igt_info("Testing connector %s using pipe %s\n", igt_output_name(output),
> @@ -573,8 +572,8 @@ cursor_leak_test_pipe(data_t *data, enum pipe pipe, igt_output_t *output)
>  	int r, g, b;
>  	int count1, count2;
>  
> -	igt_assert(data->display.has_universal_planes);
>  	igt_skip_on(pipe >= display->n_pipes);
> +	igt_require(display->has_cursor_plane);
>  
>  	igt_output_set_pipe(output, pipe);
>  	mode = igt_output_get_mode(output);
> @@ -783,8 +782,6 @@ igt_main
>  
>  		igt_require_pipe_crc();
>  		igt_display_init(&data.display, data.drm_fd);
> -
> -		igt_require(data.display.has_universal_planes);
>  	}
>  
>  	for (int pipe = 0; pipe < I915_MAX_PIPES; pipe++)
> -- 
> 2.9.3
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list