public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Mika Kahola <mika.kahola@intel.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: Vidya Srinivas <vidya.srinivas@intel.com>
Subject: Re: [PATCH i-g-t v2 1/9] tests/kms_plane: Run test for all supported pixel formats, v2.
Date: Fri, 12 Jan 2018 15:52:50 +0200	[thread overview]
Message-ID: <1515765170.12453.85.camel@intel.com> (raw)
In-Reply-To: <20180112102116.4670-2-maarten.lankhorst@linux.intel.com>

On Fri, 2018-01-12 at 11:21 +0100, Maarten Lankhorst wrote:
> From: Mahesh Kumar <mahesh1.kumar@intel.com>
> 
> This patch adds a subtest related to pixel format testing. The test
> tries to create framebuffer with all supported pixel formats on every
> plane,
> and tries to draw them using cairo and commits the same on display.
> 
> Changes since v1:
> - Make the test more generic and try on all planes, including legacy
> cursor.
> 

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

> Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
> Signed-off-by: Jyoti Yadav <jyoti.r.yadav@intel.com>
> Signed-off-by: Vidya Srinivas <vidya.srinivas@intel.com>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  tests/kms_plane.c | 103
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 103 insertions(+)
> 
> diff --git a/tests/kms_plane.c b/tests/kms_plane.c
> index 92bf67f1018c..9672763fe619 100644
> --- a/tests/kms_plane.c
> +++ b/tests/kms_plane.c
> @@ -368,6 +368,105 @@ test_plane_panning(data_t *data, enum pipe
> pipe, unsigned int flags)
>  	igt_skip_on(connected_outs == 0);
>  }
>  
> +static bool can_draw(uint32_t drm_format)
> +{
> +	const uint32_t *drm_formats;
> +	int format_count, i;
> +
> +	igt_get_all_cairo_formats(&drm_formats, &format_count);
> +
> +	for (i = 0; i < format_count; i++)
> +		if (drm_formats[i] == drm_format)
> +			return true;
> +
> +	return false;
> +}
> +
> +static void test_format_plane(data_t *data, enum pipe pipe,
> +			      igt_output_t *output, igt_plane_t
> *plane)
> +{
> +	igt_plane_t *primary;
> +	struct igt_fb primary_fb, fb;
> +	drmModeModeInfo *mode;
> +	cairo_t *cr;
> +	int i;
> +	uint32_t format;
> +	uint64_t width, height;
> +
> +	mode = igt_output_get_mode(output);
> +	if (plane->type != DRM_PLANE_TYPE_CURSOR) {
> +		width = mode->hdisplay;
> +		height = mode->vdisplay;
> +	} else {
> +		if (!plane->drm_plane) {
> +			igt_debug("Only legacy cursor ioctl
> supported, skipping cursor plane\n");
> +			return;
> +		}
> +		do_or_die(drmGetCap(data->drm_fd,
> DRM_CAP_CURSOR_WIDTH, &width));
> +		do_or_die(drmGetCap(data->drm_fd,
> DRM_CAP_CURSOR_HEIGHT, &height));
> +	}
> +
> +	igt_debug("Testing connector %s on %s plane %s.%u\n",
> +		  igt_output_name(output),
> kmstest_plane_type_name(plane->type),
> +		  kmstest_pipe_name(pipe), plane->index);
> +
> +	igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
> +		      DRM_FORMAT_XRGB8888,
> LOCAL_DRM_FORMAT_MOD_NONE, &primary_fb);
> +
> +	igt_output_set_pipe(output, pipe);
> +	primary = igt_output_get_plane_type(output,
> DRM_PLANE_TYPE_PRIMARY);
> +	igt_plane_set_fb(primary, &primary_fb);
> +
> +	igt_display_commit2(&data->display, data->display.is_atomic
> ? COMMIT_ATOMIC : COMMIT_LEGACY);
> +
> +	for (i = 0; i < plane->drm_plane->count_formats; i++) {
> +		format = plane->drm_plane->formats[i];
> +
> +		if (!can_draw(format))
> +			continue;
> +
> +		igt_debug("Testing format 0x%x on %s.%u\n",
> +			  format, kmstest_pipe_name(pipe), plane-
> >index);
> +
> +		igt_create_fb(data->drm_fd, width, height,
> +			      format, LOCAL_DRM_FORMAT_MOD_NONE,
> &fb);
> +
> +		cr = igt_get_cairo_ctx(data->drm_fd, &fb);
> +		igt_paint_color(cr, 0, 0, width, height,
> +				0.0, 1.0, 0.0);
> +		if (width >= 164 && height >= 164)
> +			igt_paint_color(cr, 100, 100, 64, 64, 0.0,
> 0.0, 0.0);
> +		igt_assert(cairo_status(cr) == 0);
> +		cairo_destroy(cr);
> +
> +		igt_plane_set_fb(plane, &fb);
> +		igt_display_commit2(&data->display,
> COMMIT_UNIVERSAL);
> +
> +		igt_remove_fb(data->drm_fd, &fb);
> +	}
> +
> +	igt_plane_set_fb(primary, NULL);
> +	igt_plane_set_fb(plane, NULL);
> +	igt_remove_fb(data->drm_fd, &primary_fb);
> +}
> +
> +static void
> +test_pixel_formats(data_t *data, enum pipe pipe)
> +{
> +	igt_output_t *output;
> +
> +	igt_display_require_output_on_pipe(&data->display, pipe);
> +
> +	for_each_valid_output_on_pipe(&data->display, pipe, output)
> {
> +		igt_plane_t *plane;
> +
> +		for_each_plane_on_pipe(&data->display, pipe, plane)
> +			test_format_plane(data, pipe, output,
> plane);
> +
> +		igt_output_set_pipe(output, PIPE_ANY);
> +	}
> +}
> +
>  static void
>  run_tests_for_pipe_plane(data_t *data, enum pipe pipe)
>  {
> @@ -376,6 +475,10 @@ run_tests_for_pipe_plane(data_t *data, enum pipe
> pipe)
>  		igt_require(data->display.pipes[pipe].n_planes > 0);
>  	}
>  
> +	igt_subtest_f("pixel-format-pipe-%s-planes",
> +		      kmstest_pipe_name(pipe))
> +		test_pixel_formats(data, pipe);
> +
>  	igt_subtest_f("plane-position-covered-pipe-%s-planes",
>  		      kmstest_pipe_name(pipe))
>  		test_plane_position(data, pipe,
> TEST_POSITION_FULLY_COVERED);
-- 
Mika Kahola - Intel OTC

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

  reply	other threads:[~2018-01-12 13:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-12 10:21 [PATCH i-g-t v2 0/9] kms plane scaling tests Maarten Lankhorst
2018-01-12 10:21 ` [PATCH i-g-t v2 1/9] tests/kms_plane: Run test for all supported pixel formats, v2 Maarten Lankhorst
2018-01-12 13:52   ` Mika Kahola [this message]
2018-01-12 10:21 ` [PATCH i-g-t v2 2/9] tests/kms_plane_scaling: Move the actual test to its own function Maarten Lankhorst
2018-01-15  8:47   ` Mika Kahola
2018-01-12 10:21 ` [PATCH i-g-t v2 3/9] tests/kms_plane_scaling: Fix basic scaling test, v2 Maarten Lankhorst
2018-01-15  9:01   ` Mika Kahola
2018-01-12 10:21 ` [PATCH i-g-t v2 4/9] tests/kms_plane_scaling: Convert from simple test to full test Maarten Lankhorst
2018-01-15  9:10   ` Mika Kahola
2018-01-12 10:21 ` [PATCH i-g-t v2 5/9] tests/kms_plane_scaling: Clean up tests to work better with igt_kms Maarten Lankhorst
2018-01-12 10:21 ` [PATCH i-g-t v2 6/9] tests/kms_plane_scaling: test scaling with tiling rotation and pixel formats, v2 Maarten Lankhorst
2018-01-12 10:21 ` [PATCH i-g-t v2 7/9] tests/kms_plane_scaling: test scaler with clipping clamping, v2 Maarten Lankhorst
2018-01-12 10:21 ` [PATCH i-g-t v2 8/9] lib/igt_kms: Add more braces around macros Maarten Lankhorst
2018-01-15 12:01   ` Mika Kahola
2018-01-12 10:21 ` [PATCH i-g-t v2 9/9] tests/kms_plane_scaling: test for multi pipe with scaling Maarten Lankhorst
2018-01-12 13:09 ` ✓ Fi.CI.BAT: success for kms plane scaling tests Patchwork
2018-01-12 13:58 ` ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1515765170.12453.85.camel@intel.com \
    --to=mika.kahola@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=vidya.srinivas@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox