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 v3 6/8] tests/kms_plane_scaling: test scaling with tiling rotation and pixel formats, v2.
Date: Tue, 16 Jan 2018 14:43:07 +0200 [thread overview]
Message-ID: <1516106587.12453.116.camel@intel.com> (raw)
In-Reply-To: <20180115142834.65798-7-maarten.lankhorst@linux.intel.com>
On Mon, 2018-01-15 at 15:28 +0100, Maarten Lankhorst wrote:
> From: Jyoti Yadav <jyoti.r.yadav@intel.com>
>
> This patch adds subtest for testing scaling in combination with
> rotation
> and pixel formats.
>
> Changes since v1:
> - Rework test to work with the other changes to kms_plane_scaling.
> (Maarten)
> - Remove hardcodes for MIN/MAX_SRC_WIDTH, and use the value directly.
> (Maarten)
>
> Signed-off-by: Jyoti Yadav <jyoti.r.yadav@intel.com>
> Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
> Signed-off-by: Vidya Srinivas <vidya.srinivas@intel.com>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
> tests/kms_plane_scaling.c | 161
> +++++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 160 insertions(+), 1 deletion(-)
>
> diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
> index 0ba209a3116b..f514459584d1 100644
> --- a/tests/kms_plane_scaling.c
> +++ b/tests/kms_plane_scaling.c
> @@ -54,10 +54,55 @@ static int get_num_scalers(uint32_t devid, enum
> pipe pipe)
> return 1;
> }
>
> +#define MAX_ROTATION 4
> +static igt_rotation_t get_rotation_angle(int rot)
To follow the same naming convention as with tiling, this function
could be renamed as 'get_rotation()'
> +{
> + switch (rot) {
> + case 0:
> + return IGT_ROTATION_0;
> + break;
> + case 1:
> + return IGT_ROTATION_90;
> + break;
> + case 2:
> + return IGT_ROTATION_180;
> + break;
> + case 3:
> + return IGT_ROTATION_270;
> + break;
> + default:
> + igt_info("Unknown/Unsupported Rotation %d\n", rot);
> + return IGT_ROTATION_0;
Maybe throw an error, igt_assert(0), here instead of return with
IGT_ROTATION_0.
> + }
> +}
> +
> +#define MAX_TILING 4
> +static uint64_t get_tiling(int tiling)
> +{
> + switch (tiling) {
> + case 0:
> + return LOCAL_DRM_FORMAT_MOD_NONE;
> + break;
> + case 1:
> + return LOCAL_I915_FORMAT_MOD_X_TILED;
> + break;
> + case 2:
> + return LOCAL_I915_FORMAT_MOD_Y_TILED;
> + break;
> + case 3:
> + return LOCAL_I915_FORMAT_MOD_Yf_TILED;
> + break;
> + default:
> + igt_info("Unknown/Unsupported Tiling %d\n", tiling);
> + return LOCAL_DRM_FORMAT_MOD_NONE;
Same comment as previous one.
> + }
> +}
> +
> static void cleanup_crtc(data_t *data)
> {
> int i;
>
> + igt_display_reset(&data->display);
> igt_pipe_crc_free(data->pipe_crc);
> data->pipe_crc = NULL;
>
> @@ -77,7 +122,6 @@ static void prepare_crtc(data_t *data,
> igt_output_t *output, enum pipe pipe,
>
> cleanup_crtc(data);
>
> - igt_display_reset(display);
> igt_output_set_pipe(output, pipe);
>
> /* create the pipe_crc object for this pipe */
> @@ -110,6 +154,112 @@ static void prepare_crtc(data_t *data,
> igt_output_t *output, enum pipe pipe,
> igt_display_commit2(display, COMMIT_ATOMIC);
> }
>
> +static void paint_fb(data_t *d, struct igt_fb *fb)
> +{
> + cairo_t *cr;
> +
> + cr = igt_get_cairo_ctx(d->drm_fd, fb);
> + igt_paint_color(cr, 0, 0, fb->width, fb->height, 0.0, 1.0,
> 0.0);
> + igt_assert(cairo_status(cr) == 0);
> + cairo_destroy(cr);
> +}
> +
> +static void check_scaling_pipe_plane_rot(data_t *d, igt_plane_t
> *plane,
> + uint32_t pixel_format,
> + uint64_t tiling, enum pipe
> pipe,
> + igt_output_t *output,
> + igt_rotation_t rot)
> +{
> + igt_display_t *display = &d->display;
> + int width, height;
> + drmModeModeInfo *mode;
> +
> + cleanup_crtc(d);
> +
> + igt_output_set_pipe(output, pipe);
> + mode = igt_output_get_mode(output);
> +
> + /* create buffer in the range of min and max source side
> limit.*/
> + width = height = 9;
> + igt_create_fb(display->drm_fd, width, height,
> + pixel_format, tiling, &d->fb[0]);
> + paint_fb(d, &d->fb[0]);
> + igt_plane_set_fb(plane, &d->fb[0]);
> +
> + /* Check min to full resolution upscaling */
> + igt_fb_set_position(&d->fb[0], plane, 0, 0);
> + igt_fb_set_size(&d->fb[0], plane, width, height);
> + igt_plane_set_position(plane, 0, 0);
> + igt_plane_set_size(plane, mode->hdisplay, mode->vdisplay);
> + igt_plane_set_rotation(plane, rot);
> + igt_display_commit2(display, COMMIT_ATOMIC);
> +
> + igt_plane_set_fb(plane, NULL);
> + igt_plane_set_position(plane, 0, 0);
> +}
> +
> +static void test_scaler_with_rotation_pipe(data_t *d, enum pipe
> pipe,
> + igt_output_t *output)
> +{
> + igt_display_t *display = &d->display;
> + igt_plane_t *plane;
> +
> + igt_output_set_pipe(output, pipe);
> + for_each_plane_on_pipe(display, pipe, plane) {
> +
> + if (plane->type == DRM_PLANE_TYPE_CURSOR)
> + continue;
> +
> + for (int i = 0; i < MAX_ROTATION; i++) {
> + igt_rotation_t rot = get_rotation_angle(i);
> + check_scaling_pipe_plane_rot(d, plane,
> DRM_FORMAT_XRGB8888,
> + LOCAL_I915_FORM
> AT_MOD_Y_TILED,
> + pipe, output,
> rot);
> + }
> + }
> +}
> +
> +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_scaler_with_pixel_format_pipe(data_t *d, enum pipe
> pipe, igt_output_t *output)
> +{
> + igt_display_t *display = &d->display;
> + igt_plane_t *plane;
> +
> + igt_output_set_pipe(output, pipe);
> +
> + for_each_plane_on_pipe(display, pipe, plane) {
> + if (plane->type == DRM_PLANE_TYPE_CURSOR)
> + continue;
> +
> + for (int i = 0; i < MAX_TILING; i++) {
> + uint64_t tiling = get_tiling(i);
> + int j;
> +
> + for (j = 0; j < plane->drm_plane-
> >count_formats; j++) {
We could follow the same style for 'j' as for 'i' in the for loops.
> + uint32_t format = plane->drm_plane-
> >formats[j];
> +
> + if (can_draw(format))
> + check_scaling_pipe_plane_rot
> (d, plane,
> +
> format, tiling,
> +
> pipe, output, IGT_ROTATION_0);
> + }
> + }
> + }
> +}
> +
> /* does iterative scaling on plane2 */
> static void iterate_plane_scaling(data_t *d, drmModeModeInfo *mode)
> {
> @@ -293,6 +443,15 @@ igt_main
> igt_subtest_f("pipe-%s-plane-scaling",
> kmstest_pipe_name(pipe))
> for_each_valid_output_on_pipe(&data.display,
> pipe, output)
> test_plane_scaling_on_pipe(&data,
> pipe, output);
> +
> + igt_subtest_f("pipe-%s-scaler-with-pixel-format",
> kmstest_pipe_name(pipe))
> + for_each_valid_output_on_pipe(&data.display,
> pipe, output)
> + test_scaler_with_pixel_format_pipe(&
> data, pipe, output);
> +
> + igt_subtest_f("pipe-%s-scaler-with-rotation",
> kmstest_pipe_name(pipe))
> + for_each_valid_output_on_pipe(&data.display,
> pipe, output)
> + test_scaler_with_rotation_pipe(&data
> , pipe, output);
> +
> }
>
> igt_fixture
--
Mika Kahola - Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2018-01-16 12:40 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-15 14:28 [PATCH i-g-t v3 0/8] kms_plane_scaling tests Maarten Lankhorst
2018-01-15 14:28 ` [PATCH i-g-t v3 1/8] tests/kms_plane_scaling: Move the actual test to its own function Maarten Lankhorst
2018-01-15 14:28 ` [PATCH i-g-t v3 2/8] tests/kms_plane_scaling: Fix basic scaling test, v3 Maarten Lankhorst
2018-01-15 14:28 ` [PATCH i-g-t v3 3/8] tests/kms_plane_scaling: Convert from simple test to full test Maarten Lankhorst
2018-01-15 14:28 ` [PATCH i-g-t v3 4/8] tests/kms_plane_scaling: Move get_num_scalers to a function Maarten Lankhorst
2018-01-16 8:22 ` Mika Kahola
2018-01-16 10:03 ` [PATCH i-g-t] tests/kms_plane_scaling: Move get_num_scalers to a function, v2 Maarten Lankhorst
2018-01-16 11:55 ` Mika Kahola
2018-01-15 14:28 ` [PATCH i-g-t v3 5/8] tests/kms_plane_scaling: Clean up tests to work better with igt_kms, v2 Maarten Lankhorst
2018-01-16 9:32 ` Mika Kahola
2018-01-15 14:28 ` [PATCH i-g-t v3 6/8] tests/kms_plane_scaling: test scaling with tiling rotation and pixel formats, v2 Maarten Lankhorst
2018-01-16 12:43 ` Mika Kahola [this message]
2018-01-16 14:00 ` [PATCH i-g-t] tests/kms_plane_scaling: test scaling with tiling rotation and pixel formats, v3 Maarten Lankhorst
2018-01-16 14:22 ` Mika Kahola
2018-01-15 14:28 ` [PATCH i-g-t v3 7/8] tests/kms_plane_scaling: test scaler with clipping clamping, v3 Maarten Lankhorst
2018-01-16 11:14 ` Mika Kahola
2018-01-15 14:28 ` [PATCH i-g-t v3 8/8] tests/kms_plane_scaling: test for multi pipe with scaling, v3 Maarten Lankhorst
2018-01-16 13:46 ` Mika Kahola
2018-01-16 13:47 ` Maarten Lankhorst
2018-01-16 13:56 ` Mika Kahola
2018-01-17 9:23 ` Maarten Lankhorst
2018-01-15 16:05 ` ✓ Fi.CI.BAT: success for kms_plane_scaling tests Patchwork
2018-01-15 19:25 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-01-16 9:14 ` ✓ Fi.CI.BAT: success " Patchwork
2018-01-16 10:24 ` ✓ Fi.CI.BAT: success for kms_plane_scaling tests. (rev2) Patchwork
2018-01-16 11:14 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-01-16 14:59 ` ✓ Fi.CI.BAT: success for kms_plane_scaling tests. (rev3) Patchwork
2018-01-16 16:43 ` ✗ Fi.CI.IGT: warning " Patchwork
2018-01-17 10:05 ` [Intel-gfx] [PATCH i-g-t v3 0/8] kms_plane_scaling tests Daniel Vetter
2018-01-17 10:05 ` Daniel Vetter
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=1516106587.12453.116.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 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.