On Wed, May 18, 2016 at 05:19:47PM +0530, Pratik Vishwakarma wrote:
> From: pvishwak <pratik.vishwaka...@intel.com>
> 
> Modified tests to follow COMMIT_ATOMIC path if ATOMIC support is
> available from driver. If ATOMIC support is not present, tests
> will follow COMMIT_UNIVERSAL path.
> 
> Signed-off-by: Pratik Vishwakarma <pratik.vishwaka...@intel.com>

I think we should implement a COMMIT_AUTOMATIC mode in lib/igt_kms.c
instead of duplicating this logic in every single testcase.
-Daniel

> ---
>  tests/kms_plane_scaling.c | 33 +++++++++++++++++++++------------
>  1 file changed, 21 insertions(+), 12 deletions(-)
> 
> diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
> index ad5404d..2d216ca 100644
> --- a/tests/kms_plane_scaling.c
> +++ b/tests/kms_plane_scaling.c
> @@ -157,7 +157,10 @@ static void iterate_plane_scaling(data_t *d, 
> drmModeModeInfo *mode)
>               for (w = d->fb2.width; w <= mode->hdisplay; w+=10) {
>                       h = w * d->fb2.height / d->fb2.width;
>                       igt_plane_set_size(d->plane2, w, h);
> -                     igt_display_commit2(display, COMMIT_UNIVERSAL);
> +                     if (d->display.is_atomic)
> +                             igt_display_commit2(display, COMMIT_ATOMIC);
> +                     else
> +                             igt_display_commit2(display, COMMIT_UNIVERSAL);
>               }
>       } else {
>               int w, h;
> @@ -170,7 +173,10 @@ static void iterate_plane_scaling(data_t *d, 
> drmModeModeInfo *mode)
>               for (w = mode->hdisplay; w <= d->fb2.width; w+=10) {
>                       h = w * mode->hdisplay / mode->vdisplay;
>                       igt_fb_set_size(&d->fb2, d->plane2, w, h);
> -                     igt_display_commit2(display, COMMIT_UNIVERSAL);
> +                     if (d->display.is_atomic)
> +                             igt_display_commit2(display, COMMIT_ATOMIC);
> +                     else
> +                             igt_display_commit2(display, COMMIT_UNIVERSAL);
>               }
>       }
>  }
> @@ -182,7 +188,10 @@ static void test_plane_scaling(data_t *d)
>       enum pipe pipe;
>       int valid_tests = 0;
>       int primary_plane_scaling = 0; /* For now */
> +     enum igt_commit_style commit = COMMIT_UNIVERSAL;
>  
> +     if (d->display.is_atomic)
> +             commit = COMMIT_ATOMIC;
>       igt_require(d->display.has_universal_planes);
>       igt_require(d->num_scalers);
>  
> @@ -218,14 +227,14 @@ static void test_plane_scaling(data_t *d)
>                       igt_fb_set_size(&d->fb1, d->plane1, 500, 500);
>                       igt_plane_set_position(d->plane1, 0, 0);
>                       igt_plane_set_size(d->plane1, mode->hdisplay, 
> mode->vdisplay);
> -                     igt_display_commit2(display, COMMIT_UNIVERSAL);
> +                     igt_display_commit2(display, commit);
>  
>                       /* Primary plane 1:1 no scaling */
>                       igt_fb_set_position(&d->fb1, d->plane1, 0, 0);
>                       igt_fb_set_size(&d->fb1, d->plane1, d->fb1.width, 
> d->fb1.height);
>                       igt_plane_set_position(d->plane1, 0, 0);
>                       igt_plane_set_size(d->plane1, mode->hdisplay, 
> mode->vdisplay);
> -                     igt_display_commit2(display, COMMIT_UNIVERSAL);
> +                     igt_display_commit2(display, commit);
>               }
>  
>               /* Set up fb2->plane2 mapping. */
> @@ -237,7 +246,7 @@ static void test_plane_scaling(data_t *d)
>               igt_fb_set_size(&d->fb2, d->plane2, d->fb2.width-200, 
> d->fb2.height-200);
>               igt_plane_set_position(d->plane2, 100, 100);
>               igt_plane_set_size(d->plane2, mode->hdisplay-200, 
> mode->vdisplay-200);
> -             igt_display_commit2(display, COMMIT_UNIVERSAL);
> +             igt_display_commit2(display, commit);
>  
>               iterate_plane_scaling(d, mode);
>  
> @@ -246,14 +255,14 @@ static void test_plane_scaling(data_t *d)
>               igt_fb_set_size(&d->fb2, d->plane2, 500, 500);
>               igt_plane_set_position(d->plane2, 10, 10);
>               igt_plane_set_size(d->plane2, mode->hdisplay-20, 
> mode->vdisplay-20);
> -             igt_display_commit2(display, COMMIT_UNIVERSAL);
> +             igt_display_commit2(display, commit);
>  
>               /* 2nd plane downscaling */
>               igt_fb_set_position(&d->fb2, d->plane2, 0, 0);
>               igt_fb_set_size(&d->fb2, d->plane2, d->fb2.width, 
> d->fb2.height);
>               igt_plane_set_position(d->plane2, 10, 10);
>               igt_plane_set_size(d->plane2, 500, 500 * 
> d->fb2.height/d->fb2.width);
> -             igt_display_commit2(display, COMMIT_UNIVERSAL);
> +             igt_display_commit2(display, commit);
>  
>               if (primary_plane_scaling) {
>                       /* Primary plane up scaling */
> @@ -261,7 +270,7 @@ static void test_plane_scaling(data_t *d)
>                       igt_fb_set_size(&d->fb1, d->plane1, 500, 500);
>                       igt_plane_set_position(d->plane1, 0, 0);
>                       igt_plane_set_size(d->plane1, mode->hdisplay, 
> mode->vdisplay);
> -                     igt_display_commit2(display, COMMIT_UNIVERSAL);
> +                     igt_display_commit2(display, commit);
>               }
>  
>               /* Set up fb3->plane3 mapping. */
> @@ -273,7 +282,7 @@ static void test_plane_scaling(data_t *d)
>               igt_fb_set_size(&d->fb3, d->plane3, d->fb3.width-300, 
> d->fb3.height-300);
>               igt_plane_set_position(d->plane3, 100, 100);
>               igt_plane_set_size(d->plane3, mode->hdisplay-300, 
> mode->vdisplay-300);
> -             igt_display_commit2(display, COMMIT_UNIVERSAL);
> +             igt_display_commit2(display, commit);
>  
>               /* Switch scaler from plane 2 to plane 3 */
>               igt_fb_set_position(&d->fb2, d->plane2, 100, 100);
> @@ -285,7 +294,7 @@ static void test_plane_scaling(data_t *d)
>               igt_fb_set_size(&d->fb3, d->plane3, d->fb3.width-400, 
> d->fb3.height-400);
>               igt_plane_set_position(d->plane3, 10, 10);
>               igt_plane_set_size(d->plane3, mode->hdisplay-300, 
> mode->vdisplay-300);
> -             igt_display_commit2(display, COMMIT_UNIVERSAL);
> +             igt_display_commit2(display, commit);
>  
>               if (primary_plane_scaling) {
>                       /* Switch scaler from plane 1 to plane 2 */
> @@ -298,13 +307,13 @@ static void test_plane_scaling(data_t *d)
>                       igt_fb_set_size(&d->fb2, d->plane2, 
> d->fb2.width-500,d->fb2.height-500);
>                       igt_plane_set_position(d->plane2, 100, 100);
>                       igt_plane_set_size(d->plane2, mode->hdisplay-200, 
> mode->vdisplay-200);
> -                     igt_display_commit2(display, COMMIT_UNIVERSAL);
> +                     igt_display_commit2(display, commit);
>               }
>  
>               /* back to single plane mode */
>               igt_plane_set_fb(d->plane2, NULL);
>               igt_plane_set_fb(d->plane3, NULL);
> -             igt_display_commit2(display, COMMIT_UNIVERSAL);
> +             igt_display_commit2(display, commit);
>  
>               valid_tests++;
>               cleanup_crtc(d, output, d->plane1);
> -- 
> 1.9.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
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

Reply via email to