Re: [Intel-gfx] [PATCH i-g-t] i-g-t: kms_plane_scaling: Enhanced scaling tests

2017-11-29 Thread Daniel Vetter
On Mon, Nov 27, 2017 at 09:20:33AM +, Srinivas, Vidya wrote:
> 
> 
> > -Original Message-
> > From: daniel.vet...@ffwll.ch [mailto:daniel.vet...@ffwll.ch] On Behalf Of
> > Daniel Vetter
> > Sent: Monday, November 27, 2017 2:47 PM
> > To: Srinivas, Vidya 
> > Cc: intel-gfx 
> > Subject: Re: [Intel-gfx] [PATCH i-g-t] i-g-t: kms_plane_scaling: Enhanced
> > scaling tests
> > 
> > Somehow I forgot to send out my irc feedback to the m-l.
> > 
> > On Wed, Nov 22, 2017 at 9:15 AM, Vidya Srinivas
> >  wrote:
> > > +igt_main
> > >  {
> > > data_t data = {};
> > >
> > > @@ -308,11 +765,26 @@ igt_simple_main
> > > data.drm_fd = drm_open_driver(DRIVER_INTEL);
> > > igt_require_pipe_crc(data.drm_fd);
> > > igt_display_init(&data.display, data.drm_fd);
> > > +   igt_require(data.display.is_atomic);
> > > data.devid = intel_get_drm_devid(data.drm_fd);
> > >
> > > data.num_scalers = intel_gen(data.devid) >= 9 ? 2 : 0;
> > >
> > > -   test_plane_scaling(&data);
> > > -
> > > +   //test_plane_scaling(&data);

You're commenting out the existing testcase ...

> > > +   igt_subtest_f("scaler_with_pixel_format") {
> > > +   test_scaler_with_pixel_format(&data);
> > > +   }
> > > +   igt_subtest_f("scaler_with_rotation") {
> > > +   test_scaler_with_rotation(&data);
> > > +   }
> > > +   igt_subtest_f("scaler_with_multiple_planes") {
> > > +   test_scaler_with_multiple_planes(&data);
> > > +   }
> > > +   igt_subtest_f("scaler_with_clipping_clamping") {
> > > +   test_scaler_with_clipping_clamping_scenario(&data);
> > > +   }
> > > +   igt_subtest_f("scaler_with_multi_pipe_plane") {
> > > +   test_scaler_with_multi_pipe_plane(&data);
> > > +   }
> > 
> > Commenting out the existing testcase and replacing it with new ones
> > entirely, without explaining what's wrong with the old one, or removing it
> > (we have git for source control, not comments), and how new tests are
> > better isn't how we do things. Presumably the existing tests once worked, so
> > the first step should be to fix that up first and explain why the changes 
> > are
> > necessary. When this code was typed 2 years ago someone put some
> > thought into it, throwing all that work away isn't good.
> > 
> > And _then_ (in follow-up patches) fix the gaps in test coverage.
> > 
> > Thanks, Daniel
> 
> Thank you. I think the explanation was missing. This test with format
> will enhance the existing cases. I will work on these and re-submit the same.

Which means it's not enhancing it, it's outright remove it and replacing
with something new. Either you need to show that the existing testcase is
totally broken (with a patch that removes it and explain why it's
unfixable).

Or (and that's really the preferred thing), patch 1 in this series fixes
up the existing test as the first step.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH i-g-t] i-g-t: kms_plane_scaling: Enhanced scaling tests

2017-11-27 Thread Srinivas, Vidya


> -Original Message-
> From: daniel.vet...@ffwll.ch [mailto:daniel.vet...@ffwll.ch] On Behalf Of
> Daniel Vetter
> Sent: Monday, November 27, 2017 2:47 PM
> To: Srinivas, Vidya 
> Cc: intel-gfx 
> Subject: Re: [Intel-gfx] [PATCH i-g-t] i-g-t: kms_plane_scaling: Enhanced
> scaling tests
> 
> Somehow I forgot to send out my irc feedback to the m-l.
> 
> On Wed, Nov 22, 2017 at 9:15 AM, Vidya Srinivas
>  wrote:
> > +igt_main
> >  {
> > data_t data = {};
> >
> > @@ -308,11 +765,26 @@ igt_simple_main
> > data.drm_fd = drm_open_driver(DRIVER_INTEL);
> > igt_require_pipe_crc(data.drm_fd);
> > igt_display_init(&data.display, data.drm_fd);
> > +   igt_require(data.display.is_atomic);
> > data.devid = intel_get_drm_devid(data.drm_fd);
> >
> > data.num_scalers = intel_gen(data.devid) >= 9 ? 2 : 0;
> >
> > -   test_plane_scaling(&data);
> > -
> > +   //test_plane_scaling(&data);
> > +   igt_subtest_f("scaler_with_pixel_format") {
> > +   test_scaler_with_pixel_format(&data);
> > +   }
> > +   igt_subtest_f("scaler_with_rotation") {
> > +   test_scaler_with_rotation(&data);
> > +   }
> > +   igt_subtest_f("scaler_with_multiple_planes") {
> > +   test_scaler_with_multiple_planes(&data);
> > +   }
> > +   igt_subtest_f("scaler_with_clipping_clamping") {
> > +   test_scaler_with_clipping_clamping_scenario(&data);
> > +   }
> > +   igt_subtest_f("scaler_with_multi_pipe_plane") {
> > +   test_scaler_with_multi_pipe_plane(&data);
> > +   }
> 
> Commenting out the existing testcase and replacing it with new ones
> entirely, without explaining what's wrong with the old one, or removing it
> (we have git for source control, not comments), and how new tests are
> better isn't how we do things. Presumably the existing tests once worked, so
> the first step should be to fix that up first and explain why the changes are
> necessary. When this code was typed 2 years ago someone put some
> thought into it, throwing all that work away isn't good.
> 
> And _then_ (in follow-up patches) fix the gaps in test coverage.
> 
> Thanks, Daniel

Thank you. I think the explanation was missing. This test with format
will enhance the existing cases. I will work on these and re-submit the same.

Regards
Vidya

> 
> > igt_display_fini(&data.display);  }
> > --
> > 2.7.4
> >
> > ___
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> 
> 
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH i-g-t] i-g-t: kms_plane_scaling: Enhanced scaling tests

2017-11-27 Thread Daniel Vetter
Somehow I forgot to send out my irc feedback to the m-l.

On Wed, Nov 22, 2017 at 9:15 AM, Vidya Srinivas
 wrote:
> +igt_main
>  {
> data_t data = {};
>
> @@ -308,11 +765,26 @@ igt_simple_main
> data.drm_fd = drm_open_driver(DRIVER_INTEL);
> igt_require_pipe_crc(data.drm_fd);
> igt_display_init(&data.display, data.drm_fd);
> +   igt_require(data.display.is_atomic);
> data.devid = intel_get_drm_devid(data.drm_fd);
>
> data.num_scalers = intel_gen(data.devid) >= 9 ? 2 : 0;
>
> -   test_plane_scaling(&data);
> -
> +   //test_plane_scaling(&data);
> +   igt_subtest_f("scaler_with_pixel_format") {
> +   test_scaler_with_pixel_format(&data);
> +   }
> +   igt_subtest_f("scaler_with_rotation") {
> +   test_scaler_with_rotation(&data);
> +   }
> +   igt_subtest_f("scaler_with_multiple_planes") {
> +   test_scaler_with_multiple_planes(&data);
> +   }
> +   igt_subtest_f("scaler_with_clipping_clamping") {
> +   test_scaler_with_clipping_clamping_scenario(&data);
> +   }
> +   igt_subtest_f("scaler_with_multi_pipe_plane") {
> +   test_scaler_with_multi_pipe_plane(&data);
> +   }

Commenting out the existing testcase and replacing it with new ones
entirely, without explaining what's wrong with the old one, or
removing it (we have git for source control, not comments), and how
new tests are better isn't how we do things. Presumably the existing
tests once worked, so the first step should be to fix that up first
and explain why the changes are necessary. When this code was typed 2
years ago someone put some thought into it, throwing all that work
away isn't good.

And _then_ (in follow-up patches) fix the gaps in test coverage.

Thanks, Daniel

> igt_display_fini(&data.display);
>  }
> --
> 2.7.4
>
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH i-g-t] i-g-t: kms_plane_scaling: Enhanced scaling tests

2017-11-26 Thread Srinivas, Vidya


> -Original Message-
> From: Latvala, Petri
> Sent: Friday, November 24, 2017 2:58 PM
> To: Srinivas, Vidya 
> Cc: intel-gfx@lists.freedesktop.org
> Subject: Re: [Intel-gfx] [PATCH i-g-t] i-g-t: kms_plane_scaling: Enhanced
> scaling tests
> 
> On Wed, Nov 22, 2017 at 01:45:04PM +0530, Vidya Srinivas wrote:
> > From: Jyoti Yadav 
> >
> > Added subtests to cover below gaps.
> > 1. scaler with pixelformat and tiling.
> > 2. scaler with rotation
> > 3. scaler with multiple planes
> > 4. scaler with multi pipe
> > 5. scaler with clipping/clamping scenario
> >
> > Signed-off-by: Jyoti Yadav 
> > ---
> >  tests/kms_plane_scaling.c | 480
> > +-
> >  1 file changed, 476 insertions(+), 4 deletions(-)
> >
> > diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
> > index 403df47..2be6acc 100644
> > --- a/tests/kms_plane_scaling.c
> > +++ b/tests/kms_plane_scaling.c
> > @@ -43,10 +43,11 @@ typedef struct {
> > struct igt_fb fb1;
> > struct igt_fb fb2;
> > struct igt_fb fb3;
> > +   struct igt_fb fb4;
> > int fb_id1;
> > int fb_id2;
> > int fb_id3;
> > -
> > +   int fb_id4;
> > igt_plane_t *plane1;
> > igt_plane_t *plane2;
> > igt_plane_t *plane3;
> > @@ -54,6 +55,51 @@ typedef struct {
> >  } data_t;
> >
> >  #define FILE_NAME   "1080p-left.png"
> > +#define MIN_SRC_WIDTH 8
> > +#define MAX_SRC_WIDTH 4096
> > +static uint32_t check_pixel_format(uint32_t pixel_format) {
> > +   const uint32_t *igt_formats;
> > +   int num_igt_formats;
> > +   int i;
> > +
> > +
> > +   igt_get_all_cairo_formats(&igt_formats, &num_igt_formats);
> > +   for (i = 0; i < num_igt_formats; i++) {
> > +   if (pixel_format == igt_formats[i])
> > +   return 0;
> > +   }
> > +
> > +   return -1;
> > +}
> > +bool is_igt_output_connected(igt_output_t *output) {
> > +   /* Something went wrong during probe? */
> > +   if (!output->config.connector)
> > +   return false;
> > +
> > +   if (output->config.connector->connection ==
> DRM_MODE_CONNECTED)
> > +   return true;
> > +
> > +   return false;
> > +}
> > +
> > +static igt_output_t *get_next_valid_output(igt_display_t *data, int
> > +i) {
> > +   int j = 0, valid_output = 0;
> > +   drmModeModeInfo *mode;
> > +   for (j = 0; j < data->n_outputs; j++) {
> > +   if (is_igt_output_connected(&data->outputs[j])) {
> > +   mode = igt_output_get_mode(&data->outputs[j]);
> > +   if (mode->hdisplay != 0 && mode->vdisplay != 0) {
> > +   valid_output++;
> > +   if (valid_output == i)
> > +   return &data->outputs[j];
> > +   }
> > +   }
> > +   }
> > +   return NULL;
> > +}
> >
> >  static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe
> pipe,
> > igt_plane_t *plane, drmModeModeInfo *mode,
> enum igt_commit_style
> > s) @@ -298,7 +344,418 @@ static void test_plane_scaling(data_t *d)
> > igt_require_f(valid_tests, "no valid crtc/connector combinations
> > found\n");  }
> >
> > -igt_simple_main
> > +uint64_t get_tiling(int i)
> > +{
> > +   switch (i) {
> > +   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:
> > +   return -1;
> > +   }
> > +}
> > +
> > +void loop_plane_scaling(data_t *d, igt_plane_t *plane, uint32_t
> pixel_format,
> > +   uint64_t tiling, enum pipe pipe, igt_output_t
> *output) {
> > +   igt_display_t *display = &d->display;
> > +   int width, height;
> > +   /* create buffer in the range of  min and max source side limit.*/
> > +   for (width = MIN_SRC_WIDTH; width <= MAX_SRC_WIDTH; width =
> width + 500) {
> > +   igt_output_set_pipe(output, pipe);
> > +   

Re: [Intel-gfx] [PATCH i-g-t] i-g-t: kms_plane_scaling: Enhanced scaling tests

2017-11-24 Thread Petri Latvala
On Wed, Nov 22, 2017 at 01:45:04PM +0530, Vidya Srinivas wrote:
> From: Jyoti Yadav 
> 
> Added subtests to cover below gaps.
>   1. scaler with pixelformat and tiling.
>   2. scaler with rotation
>   3. scaler with multiple planes
>   4. scaler with multi pipe
>   5. scaler with clipping/clamping scenario
> 
> Signed-off-by: Jyoti Yadav 
> ---
>  tests/kms_plane_scaling.c | 480 
> +-
>  1 file changed, 476 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
> index 403df47..2be6acc 100644
> --- a/tests/kms_plane_scaling.c
> +++ b/tests/kms_plane_scaling.c
> @@ -43,10 +43,11 @@ typedef struct {
>   struct igt_fb fb1;
>   struct igt_fb fb2;
>   struct igt_fb fb3;
> + struct igt_fb fb4;
>   int fb_id1;
>   int fb_id2;
>   int fb_id3;
> -
> + int fb_id4;
>   igt_plane_t *plane1;
>   igt_plane_t *plane2;
>   igt_plane_t *plane3;
> @@ -54,6 +55,51 @@ typedef struct {
>  } data_t;
>  
>  #define FILE_NAME   "1080p-left.png"
> +#define MIN_SRC_WIDTH 8
> +#define MAX_SRC_WIDTH 4096
> +static uint32_t check_pixel_format(uint32_t pixel_format)
> +{
> + const uint32_t *igt_formats;
> + int num_igt_formats;
> + int i;
> +
> +
> + igt_get_all_cairo_formats(&igt_formats, &num_igt_formats);
> + for (i = 0; i < num_igt_formats; i++) {
> + if (pixel_format == igt_formats[i])
> + return 0;
> + }
> +
> + return -1;
> +}
> +bool is_igt_output_connected(igt_output_t *output)
> +{
> + /* Something went wrong during probe? */
> + if (!output->config.connector)
> + return false;
> +
> + if (output->config.connector->connection == DRM_MODE_CONNECTED)
> + return true;
> +
> + return false;
> +}
> +
> +static igt_output_t *get_next_valid_output(igt_display_t *data, int i)
> +{
> + int j = 0, valid_output = 0;
> + drmModeModeInfo *mode;
> + for (j = 0; j < data->n_outputs; j++) {
> + if (is_igt_output_connected(&data->outputs[j])) {
> + mode = igt_output_get_mode(&data->outputs[j]);
> + if (mode->hdisplay != 0 && mode->vdisplay != 0) {
> + valid_output++;
> + if (valid_output == i)
> + return &data->outputs[j];
> + }
> + }
> + }
> + return NULL;
> +}
>  
>  static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
>   igt_plane_t *plane, drmModeModeInfo *mode, enum 
> igt_commit_style s)
> @@ -298,7 +344,418 @@ static void test_plane_scaling(data_t *d)
>   igt_require_f(valid_tests, "no valid crtc/connector combinations 
> found\n");
>  }
>  
> -igt_simple_main
> +uint64_t get_tiling(int i)
> +{
> + switch (i) {
> + 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:
> + return -1;
> + }
> +}
> +
> +void loop_plane_scaling(data_t *d, igt_plane_t *plane, uint32_t pixel_format,
> + uint64_t tiling, enum pipe pipe, igt_output_t *output)
> +{
> + igt_display_t *display = &d->display;
> + int width, height;
> + /* create buffer in the range of  min and max source side limit.*/
> + for (width = MIN_SRC_WIDTH; width <= MAX_SRC_WIDTH; width = width + 
> 500) {
> + igt_output_set_pipe(output, pipe);
> + height = width + 10;
> + d->fb_id1 = igt_create_pattern_fb(display->drm_fd, width, 
> height,
> + pixel_format, tiling, &d->fb1);
> + igt_assert(d->fb_id1);
> + igt_plane_set_fb(plane, &d->fb1);
> + /* check upscaling */
> + igt_fb_set_position(&d->fb1, plane, 0, 0);
> + igt_fb_set_size(&d->fb1, plane, d->fb1.width, d->fb1.height);
> + igt_plane_set_position(plane, 10, 10);
> + igt_plane_set_size(plane, width*2, height*2);
> + igt_display_commit2(display, COMMIT_ATOMIC);
> + igt_plane_set_fb(plane, NULL);
> + igt_plane_set_position(plane, 0, 0);
> + if (d->fb_id1) {
> + igt_remove_fb(d->drm_fd, &d->fb1);
> + d->fb_id1 = 0;
> + }
> + }
> +}
> +void test_scaler_with_pixel_format(data_t *d)
> +{
> + igt_display_t *display = &d->display;
> + igt_output_t *output;
> + enum pipe pipe;
> + igt_plane_t *plane;
> + int valid_tests = 0;
> + igt_require(d->num_scalers);
> + for_each_pipe_with_valid

Re: [Intel-gfx] [PATCH i-g-t] i-g-t: kms_plane_scaling: Enhanced scaling tests

2017-11-23 Thread Juha-Pekka Heikkila

On 22.11.2017 10:15, Vidya Srinivas wrote:

From: Jyoti Yadav 

Added subtests to cover below gaps.
1. scaler with pixelformat and tiling.
2. scaler with rotation
3. scaler with multiple planes
4. scaler with multi pipe
5. scaler with clipping/clamping scenario

Signed-off-by: Jyoti Yadav 
---
  tests/kms_plane_scaling.c | 480 +-
  1 file changed, 476 insertions(+), 4 deletions(-)

diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 403df47..2be6acc 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -43,10 +43,11 @@ typedef struct {
struct igt_fb fb1;
struct igt_fb fb2;
struct igt_fb fb3;
+   struct igt_fb fb4;
int fb_id1;
int fb_id2;
int fb_id3;
-
+   int fb_id4;
igt_plane_t *plane1;
igt_plane_t *plane2;
igt_plane_t *plane3;
@@ -54,6 +55,51 @@ typedef struct {
  } data_t;
  
  #define FILE_NAME   "1080p-left.png"

+#define MIN_SRC_WIDTH 8
+#define MAX_SRC_WIDTH 4096
+static uint32_t check_pixel_format(uint32_t pixel_format)
+{
+   const uint32_t *igt_formats;
+   int num_igt_formats;
+   int i;
+
+
+   igt_get_all_cairo_formats(&igt_formats, &num_igt_formats);
+   for (i = 0; i < num_igt_formats; i++) {
+   if (pixel_format == igt_formats[i])
+   return 0;
+   }
+
+   return -1;
+}
+bool is_igt_output_connected(igt_output_t *output)


^^ static


+{
+   /* Something went wrong during probe? */
+   if (!output->config.connector)
+   return false;
+
+   if (output->config.connector->connection == DRM_MODE_CONNECTED)
+   return true;
+
+   return false;
+}
+
+static igt_output_t *get_next_valid_output(igt_display_t *data, int i)
+{
+   int j = 0, valid_output = 0;
+   drmModeModeInfo *mode;
+   for (j = 0; j < data->n_outputs; j++) {
+   if (is_igt_output_connected(&data->outputs[j])) {
+   mode = igt_output_get_mode(&data->outputs[j]);
+   if (mode->hdisplay != 0 && mode->vdisplay != 0) {
+   valid_output++;
+   if (valid_output == i)
+   return &data->outputs[j];
+   }
+   }
+   }
+   return NULL;
+}
  
  static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,

igt_plane_t *plane, drmModeModeInfo *mode, enum 
igt_commit_style s)
@@ -298,7 +344,418 @@ static void test_plane_scaling(data_t *d)
igt_require_f(valid_tests, "no valid crtc/connector combinations 
found\n");
  }
  
-igt_simple_main

+uint64_t get_tiling(int i)


^^ static


+{
+   switch (i) {
+   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:
+   return -1;
+   }
+}
+
+void loop_plane_scaling(data_t *d, igt_plane_t *plane, uint32_t pixel_format,


^^ static


+   uint64_t tiling, enum pipe pipe, igt_output_t *output)
+{
+   igt_display_t *display = &d->display;
+   int width, height;
+   /* create buffer in the range of  min and max source side limit.*/
+   for (width = MIN_SRC_WIDTH; width <= MAX_SRC_WIDTH; width = width + 
500) {
+   igt_output_set_pipe(output, pipe);
+   height = width + 10;
+   d->fb_id1 = igt_create_pattern_fb(display->drm_fd, width, 
height,
+   pixel_format, tiling, &d->fb1);
+   igt_assert(d->fb_id1);
+   igt_plane_set_fb(plane, &d->fb1);
+   /* check upscaling */
+   igt_fb_set_position(&d->fb1, plane, 0, 0);
+   igt_fb_set_size(&d->fb1, plane, d->fb1.width, d->fb1.height);
+   igt_plane_set_position(plane, 10, 10);
+   igt_plane_set_size(plane, width*2, height*2);
+   igt_display_commit2(display, COMMIT_ATOMIC);


When it says 'check' here, should here be used 'igt_display_try_commit2' 
instead of 'igt_display_commit2'? I was bit confused where the checking 
is really happening. Same goes for all the tests, I see the setup 
asserted but for actual 'check' I didn't find asserts about any results.



+   igt_plane_set_fb(plane, NULL);
+   igt_plane_set_position(plane, 0, 0);
+   if (d->fb_id1) {
+   igt_remove_fb(d->drm_fd, &d->fb1);
+   d->fb_id1 = 0;
+   }
+   }
+}
+void test_scaler_with_pixel_format(data_t *d)


^^ static


+

[Intel-gfx] [PATCH i-g-t] i-g-t: kms_plane_scaling: Enhanced scaling tests

2017-11-22 Thread Vidya Srinivas
From: Jyoti Yadav 

Added subtests to cover below gaps.
1. scaler with pixelformat and tiling.
2. scaler with rotation
3. scaler with multiple planes
4. scaler with multi pipe
5. scaler with clipping/clamping scenario

Signed-off-by: Jyoti Yadav 
---
 tests/kms_plane_scaling.c | 480 +-
 1 file changed, 476 insertions(+), 4 deletions(-)

diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 403df47..2be6acc 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -43,10 +43,11 @@ typedef struct {
struct igt_fb fb1;
struct igt_fb fb2;
struct igt_fb fb3;
+   struct igt_fb fb4;
int fb_id1;
int fb_id2;
int fb_id3;
-
+   int fb_id4;
igt_plane_t *plane1;
igt_plane_t *plane2;
igt_plane_t *plane3;
@@ -54,6 +55,51 @@ typedef struct {
 } data_t;
 
 #define FILE_NAME   "1080p-left.png"
+#define MIN_SRC_WIDTH 8
+#define MAX_SRC_WIDTH 4096
+static uint32_t check_pixel_format(uint32_t pixel_format)
+{
+   const uint32_t *igt_formats;
+   int num_igt_formats;
+   int i;
+
+
+   igt_get_all_cairo_formats(&igt_formats, &num_igt_formats);
+   for (i = 0; i < num_igt_formats; i++) {
+   if (pixel_format == igt_formats[i])
+   return 0;
+   }
+
+   return -1;
+}
+bool is_igt_output_connected(igt_output_t *output)
+{
+   /* Something went wrong during probe? */
+   if (!output->config.connector)
+   return false;
+
+   if (output->config.connector->connection == DRM_MODE_CONNECTED)
+   return true;
+
+   return false;
+}
+
+static igt_output_t *get_next_valid_output(igt_display_t *data, int i)
+{
+   int j = 0, valid_output = 0;
+   drmModeModeInfo *mode;
+   for (j = 0; j < data->n_outputs; j++) {
+   if (is_igt_output_connected(&data->outputs[j])) {
+   mode = igt_output_get_mode(&data->outputs[j]);
+   if (mode->hdisplay != 0 && mode->vdisplay != 0) {
+   valid_output++;
+   if (valid_output == i)
+   return &data->outputs[j];
+   }
+   }
+   }
+   return NULL;
+}
 
 static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
igt_plane_t *plane, drmModeModeInfo *mode, enum 
igt_commit_style s)
@@ -298,7 +344,418 @@ static void test_plane_scaling(data_t *d)
igt_require_f(valid_tests, "no valid crtc/connector combinations 
found\n");
 }
 
-igt_simple_main
+uint64_t get_tiling(int i)
+{
+   switch (i) {
+   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:
+   return -1;
+   }
+}
+
+void loop_plane_scaling(data_t *d, igt_plane_t *plane, uint32_t pixel_format,
+   uint64_t tiling, enum pipe pipe, igt_output_t *output)
+{
+   igt_display_t *display = &d->display;
+   int width, height;
+   /* create buffer in the range of  min and max source side limit.*/
+   for (width = MIN_SRC_WIDTH; width <= MAX_SRC_WIDTH; width = width + 
500) {
+   igt_output_set_pipe(output, pipe);
+   height = width + 10;
+   d->fb_id1 = igt_create_pattern_fb(display->drm_fd, width, 
height,
+   pixel_format, tiling, &d->fb1);
+   igt_assert(d->fb_id1);
+   igt_plane_set_fb(plane, &d->fb1);
+   /* check upscaling */
+   igt_fb_set_position(&d->fb1, plane, 0, 0);
+   igt_fb_set_size(&d->fb1, plane, d->fb1.width, d->fb1.height);
+   igt_plane_set_position(plane, 10, 10);
+   igt_plane_set_size(plane, width*2, height*2);
+   igt_display_commit2(display, COMMIT_ATOMIC);
+   igt_plane_set_fb(plane, NULL);
+   igt_plane_set_position(plane, 0, 0);
+   if (d->fb_id1) {
+   igt_remove_fb(d->drm_fd, &d->fb1);
+   d->fb_id1 = 0;
+   }
+   }
+}
+void test_scaler_with_pixel_format(data_t *d)
+{
+   igt_display_t *display = &d->display;
+   igt_output_t *output;
+   enum pipe pipe;
+   igt_plane_t *plane;
+   int valid_tests = 0;
+   igt_require(d->num_scalers);
+   for_each_pipe_with_valid_output(display, pipe, output) {
+   drmModeModeInfo *mode;
+   igt_output_set_pipe(output, pipe);
+   mode = igt_output_get_mode(output);
+