From patchwork Mon May 11 22:58:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandra Konduru X-Patchwork-Id: 6384751 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 318979F374 for ; Mon, 11 May 2015 22:59:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0139A2041E for ; Mon, 11 May 2015 22:59:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9986820416 for ; Mon, 11 May 2015 22:59:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F2B716E542; Mon, 11 May 2015 15:59:49 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 8BDDF6E542 for ; Mon, 11 May 2015 15:59:49 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 11 May 2015 15:59:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,411,1427785200"; d="scan'208";a="724311510" Received: from cmkondur-desk2.fm.intel.com ([10.19.123.59]) by fmsmga002.fm.intel.com with ESMTP; 11 May 2015 15:59:36 -0700 From: Chandra Konduru To: intel-gfx@lists.freedesktop.org Date: Mon, 11 May 2015 15:58:46 -0700 Message-Id: <1431385126-18444-1-git-send-email-chandra.konduru@intel.com> X-Mailer: git-send-email 1.7.9.5 Cc: thomas.wood@intel.com Subject: [Intel-gfx] [PREFIX i-g-t] Improvements to kms_plane_scaling X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: chandra konduru Resending with correct subject-prefix. This patch has below improvements: - use tile-Y for fb1 which is used for 90/270 rotation - add 90/270 rotation tests along with scaling - remove primary_plane_scaling flag which isn't required anymore - use helper igt_get_image_size() to get image size - use fb's width/height to initialize fb1 in prepare_crtc - position fb3 at (0,0) and set its src size to fb size Depends on "Prep work for adding NV12 testcase" patch which adds helper function igt_get_image_size(). v2: -Remove primary_plane_scaling flag (Thomas) -Fix running the test from any directory (Tvrtko) Signed-off-by: chandra konduru --- tests/kms_plane_scaling.c | 88 ++++++++++++++++++++++++----------------------- 1 file changed, 45 insertions(+), 43 deletions(-) diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c index 00db5cb..aa88040 100644 --- a/tests/kms_plane_scaling.c +++ b/tests/kms_plane_scaling.c @@ -101,11 +101,11 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe, data->fb_id1 = igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, - LOCAL_I915_FORMAT_MOD_X_TILED, /* tiled */ + LOCAL_I915_FORMAT_MOD_Y_TILED, /* tiled */ &data->fb1); igt_assert(data->fb_id1); - paint_color(data, &data->fb1, mode->hdisplay, mode->vdisplay); + paint_color(data, &data->fb1, data->fb1.width, data->fb1.height); /* * We always set the primary plane to actually enable the pipe as @@ -206,10 +206,8 @@ static void test_plane_scaling(data_t *d) { igt_display_t *display = &d->display; igt_output_t *output; - cairo_surface_t *image; enum pipe pipe; int valid_tests = 0; - int primary_plane_scaling = 0; /* For now */ igt_require(d->display.has_universal_planes); igt_require(d->num_scalers); @@ -223,12 +221,7 @@ static void test_plane_scaling(data_t *d) mode = igt_output_get_mode(output); /* allocate fb2 with image size */ - image = cairo_image_surface_create_from_png(FILE_NAME); - igt_assert(cairo_surface_status(image) == CAIRO_STATUS_SUCCESS); - d->image_w = cairo_image_surface_get_width(image); - d->image_h = cairo_image_surface_get_height(image); - cairo_surface_destroy(image); - + igt_get_image_size(FILE_NAME, &d->image_w, &d->image_h); d->fb_id2 = igt_create_fb(d->drm_fd, d->image_w, d->image_h, DRM_FORMAT_XRGB8888, @@ -249,22 +242,35 @@ static void test_plane_scaling(data_t *d) d->plane1 = igt_output_get_plane(output, IGT_PLANE_PRIMARY); prepare_crtc(d, output, pipe, d->plane1, mode, COMMIT_UNIVERSAL); - if (primary_plane_scaling) { - /* Primary plane upscaling */ - igt_fb_set_position(&d->fb1, d->plane1, 100, 100); - 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); + /* Primary plane upscaling with 90 rotation */ + paint_color(d, &d->fb1, 360, 640); + igt_fb_set_position(&d->fb1, d->plane1, 0, 0); + igt_fb_set_size(&d->fb1, d->plane1, 360, 640); + igt_plane_set_position(d->plane1, 0, 0); + igt_plane_set_size(d->plane1, mode->hdisplay, mode->vdisplay); + igt_plane_set_rotation(d->plane1, IGT_ROTATION_90); + igt_display_commit2(display, COMMIT_UNIVERSAL); - /* Primary plane 1:1 no scaling */ + /* Primary plane upscaling with 270 rotation */ + if (d->fb1.width >= 720 && d->fb1.height >= 1280) { + paint_color(d, &d->fb1, 720, 1280); 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_fb_set_size(&d->fb1, d->plane1, 720, 1280); igt_plane_set_position(d->plane1, 0, 0); igt_plane_set_size(d->plane1, mode->hdisplay, mode->vdisplay); + igt_plane_set_rotation(d->plane1, IGT_ROTATION_270); igt_display_commit2(display, COMMIT_UNIVERSAL); } + /* Primary plane 1:1 no scaling & no rotation */ + paint_color(d, &d->fb1, d->fb1.width, d->fb1.height); + 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_plane_set_rotation(d->plane1, IGT_ROTATION_0); + igt_display_commit2(display, COMMIT_UNIVERSAL); + /* Set up fb2->plane2 mapping. */ d->plane2 = igt_output_get_plane(output, IGT_PLANE_2); igt_plane_set_fb(d->plane2, &d->fb2); @@ -292,14 +298,12 @@ static void test_plane_scaling(data_t *d) igt_plane_set_size(d->plane2, 500, 500 * d->fb2.height/d->fb2.width); igt_display_commit2(display, COMMIT_UNIVERSAL); - if (primary_plane_scaling) { - /* Primary plane up scaling */ - igt_fb_set_position(&d->fb1, d->plane1, 100, 100); - 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); - } + /* Primary plane up scaling */ + igt_fb_set_position(&d->fb1, d->plane1, 100, 100); + 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); /* Set up fb3->plane3 mapping. */ d->plane3 = igt_output_get_plane(output, IGT_PLANE_3); @@ -318,25 +322,23 @@ static void test_plane_scaling(data_t *d) igt_plane_set_position(d->plane2, 100, 100); igt_plane_set_size(d->plane2, d->fb2.width-200, d->fb2.height-200); - igt_fb_set_position(&d->fb3, d->plane3, 100, 100); - 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_fb_set_position(&d->fb3, d->plane3, 0, 0); + igt_fb_set_size(&d->fb3, d->plane3, d->fb3.width, d->fb3.height); + igt_plane_set_position(d->plane3, 500, 500); + igt_plane_set_size(d->plane3, d->fb3.width * 2/3, d->fb3.height * 2/3); igt_display_commit2(display, COMMIT_UNIVERSAL); - if (primary_plane_scaling) { - /* Switch scaler from plane 1 to plane 2 */ - 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); + /* Switch scaler from plane 1 to plane 2 */ + 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_fb_set_position(&d->fb2, d->plane2, 100, 100); - 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_fb_set_position(&d->fb2, d->plane2, 100, 100); + 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); /* back to single plane mode */ igt_plane_set_fb(d->plane2, NULL);