[Intel-gfx] [PATCH i-g-t 3/6] i-g-t: lib/igt_kms: Run kms_plane for all supported pixel formats
Maarten Lankhorst
maarten.lankhorst at linux.intel.com
Tue Jan 9 12:24:51 UTC 2018
Op 13-12-17 om 10:50 schreef Vidya Srinivas:
> From: Mahesh Kumar <mahesh1.kumar at intel.com>
>
> This patch adds a subtest related to pixel format testing. The test
> create framebuffer with all supported pixel formats for primary and
> sprite planes which can be drawn using cairo and commits the same on display.
>
> Signed-off-by: Mahesh Kumar <mahesh1.kumar at intel.com>
> Signed-off-by: Jyoti Yadav <jyoti.r.yadav at intel.com>
> Signed-off-by: Vidya Srinivas <vidya.srinivas at intel.com>
> ---
> tests/kms_plane.c | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 123 insertions(+)
>
> diff --git a/tests/kms_plane.c b/tests/kms_plane.c
> index 92bf67f..5f25177 100644
> --- a/tests/kms_plane.c
> +++ b/tests/kms_plane.c
> @@ -368,6 +368,125 @@ test_plane_panning(data_t *data, enum pipe pipe, unsigned int flags)
> igt_skip_on(connected_outs == 0);
> }
>
> +static void test_format_primary(data_t *data,
> + enum pipe pipe, igt_output_t *output)
> +{
> + igt_plane_t *primary;
> + struct igt_fb primary_fb;
> + drmModeModeInfo *mode;
> + cairo_t *cr;
> + int primary_id;
> + uint32_t format;
> +
> + igt_info("Testing connector %s using pipe %s on primary plane\n",
> + igt_output_name(output), kmstest_pipe_name(pipe));
> +
> + igt_output_set_pipe(output, pipe);
> + mode = igt_output_get_mode(output);
> +
> + primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
> +
> + for_each_format_in_plane(primary, format) {
> + if (igt_is_cairo_supported_format(format)) {
> + igt_info("Testing format %s on primary now\n",
> + igt_get_format_name(format));
> + primary_id = igt_create_fb(data->drm_fd,
> + mode->hdisplay, mode->vdisplay,
> + format,
> + LOCAL_DRM_FORMAT_MOD_NONE,
> + &primary_fb);
> + igt_assert(primary_id);
> + cr = igt_get_cairo_ctx(data->drm_fd, &primary_fb);
> + igt_paint_color(cr, 0, 0, mode->hdisplay, mode->vdisplay,
> + 0.0, 1.0, 0.0);
> + 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(primary, &primary_fb);
> + igt_display_commit(&data->display);
> + }
> + }
> +
> + igt_remove_fb(data->drm_fd, &primary_fb);
> + igt_plane_set_fb(primary, NULL);
> +}
> +
> +static void test_format_overlay(data_t *data,
> + enum pipe pipe, igt_output_t *output,
> + int plane_id)
> +{
> + igt_plane_t *primary, *overlay;
> + struct igt_fb primary_fb, overlay_fb;
> + drmModeModeInfo *mode;
> + cairo_t *cr;
> + int primary_id, overlay_id;
> + uint32_t format;
> +
> + igt_info("Testing connector %s using pipe %s on overlay plane %d\n",
> + igt_output_name(output), kmstest_pipe_name(pipe), plane_id);
> +
> + igt_output_set_pipe(output, pipe);
> + mode = igt_output_get_mode(output);
> +
> + overlay = igt_output_get_plane(output, plane_id);
> + primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
> + primary_id = igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
> + DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
> + &primary_fb);
> + igt_assert(primary_id);
> + igt_plane_set_fb(primary, &primary_fb);
> + cr = igt_get_cairo_ctx(data->drm_fd, &primary_fb);
> + igt_paint_color(cr, 0, 0, mode->hdisplay, mode->vdisplay, 0.0, 0.0, 1.0);
> + igt_assert(cairo_status(cr) == 0);
> + cairo_destroy(cr);
> +
> + for_each_format_in_plane(overlay, format) {
> + if (igt_is_cairo_supported_format(format)) {
> + igt_info("Testing format %s on plane id %d\n",
> + igt_get_format_name(format), plane_id);
> + overlay_id = igt_create_fb(data->drm_fd, 300, 300, format,
> + LOCAL_DRM_FORMAT_MOD_NONE, &overlay_fb);
> + igt_assert(overlay_id);
> +
> + igt_plane_set_fb(overlay, &overlay_fb);
> + cr = igt_get_cairo_ctx(data->drm_fd, &overlay_fb);
> + igt_paint_color(cr, 0, 0, 300, 300, 1.0, 0.0, 0.0);
> + igt_assert(cairo_status(cr) == 0);
> + cairo_destroy(cr);
> + igt_display_commit(&data->display);
Why does this test distinguish between primary and sprite? It should test all planes in the same way, including cursor.
In fact, we should also test formats not supported by cairo, and only skip the painting in that case.
~Maarten
More information about the Intel-gfx
mailing list