From patchwork Mon Oct 5 21:21:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zanoni, Paulo R" X-Patchwork-Id: 7331881 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id ECCE4BEEA4 for ; Mon, 5 Oct 2015 21:21:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 01E5C20601 for ; Mon, 5 Oct 2015 21:21:50 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 4FCD22060D for ; Mon, 5 Oct 2015 21:21:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7A36A6E8D0; Mon, 5 Oct 2015 14:21:44 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTP id 9A7D66E8CF for ; Mon, 5 Oct 2015 14:21:43 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 05 Oct 2015 14:21:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,640,1437462000"; d="scan'208";a="804263047" Received: from khauck-mobl.amr.corp.intel.com (HELO panetone.amr.corp.intel.com) ([10.254.102.83]) by fmsmga001.fm.intel.com with ESMTP; 05 Oct 2015 14:21:26 -0700 From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Mon, 5 Oct 2015 18:21:09 -0300 Message-Id: <1444080071-29070-4-git-send-email-paulo.r.zanoni@intel.com> X-Mailer: git-send-email 2.5.3 In-Reply-To: <1444080071-29070-1-git-send-email-paulo.r.zanoni@intel.com> References: <1444080071-29070-1-git-send-email-paulo.r.zanoni@intel.com> Subject: [Intel-gfx] [PATCH igt 4/6] kms_frontbuffer_tracking: add scaledprimary subtest 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 It's not testing a lot since we lack the Kernel Stolen Memory Checker, but some day this will be useful. Signed-off-by: Paulo Zanoni --- tests/kms_frontbuffer_tracking.c | 131 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c index 6692dd8..47fc0c8 100644 --- a/tests/kms_frontbuffer_tracking.c +++ b/tests/kms_frontbuffer_tracking.c @@ -2496,6 +2496,125 @@ static void fullscreen_plane_subtest(const struct test_mode *t) igt_remove_fb(drm.fd, &fullscreen_fb); } +/* + * scaledprimary - try different primary plane scaling strategies + * + * METHOD + * Enable the primary plane, use drmModeSetPlane to force scaling in + * different ways. + * + * EXPECTED RESULTS + * SKIP on platforms that don't support primary plane scaling. Success on all + * others. + * + * FAILURES + * TODO: although we're exercising the code here, we're not really doing + * assertions in order to check if things are working properly. The biggest + * issue this code would be able to find would be an incorrectly calculated + * CFB size, and today we don't have means to assert this. One day we might + * implement some sort of stolen memory checking mechanism, then we'll be able + * to force it to run after every drmModeSetPlane call here, so we'll be + * checking if the expected CFB size is actually what we think it is. + */ +static void scaledprimary_subtest(const struct test_mode *t) +{ + struct igt_fb new_fb, *old_fb; + struct modeset_params *params = pick_params(t); + int i, rc; + uint32_t plane_id; + + igt_require_f(intel_gen(intel_get_drm_devid(drm.fd)) >= 9, + "Can't test primary plane scaling before gen 9\n"); + + prepare_subtest(t, NULL); + + old_fb = params->fb.fb; + + create_fb(t->format, params->fb.fb->width, params->fb.fb->height, + LOCAL_I915_FORMAT_MOD_X_TILED, + t->plane, &new_fb); + fill_fb(&new_fb, COLOR_BLUE); + + igt_draw_rect_fb(drm.fd, drm.bufmgr, NULL, &new_fb, t->method, + params->fb.x, params->fb.y, + params->fb.w / 2, params->fb.h / 2, + pick_color(&new_fb, COLOR_GREEN)); + igt_draw_rect_fb(drm.fd, drm.bufmgr, NULL, &new_fb, t->method, + params->fb.x + params->fb.w / 2, + params->fb.y + params->fb.h / 2, + params->fb.w / 2, params->fb.h / 2, + pick_color(&new_fb, COLOR_RED)); + igt_draw_rect_fb(drm.fd, drm.bufmgr, NULL, &new_fb, t->method, + params->fb.x + params->fb.w / 2, + params->fb.y + params->fb.h / 2, + params->fb.w / 4, params->fb.h / 4, + pick_color(&new_fb, COLOR_MAGENTA)); + + for (i = 0; i < drm.plane_res->count_planes; i++) + if ((drm.planes[i]->possible_crtcs & 1) && + drm.plane_types[i] == DRM_PLANE_TYPE_PRIMARY) + plane_id = drm.planes[i]->plane_id; + + /* No scaling. */ + rc = drmModeSetPlane(drm.fd, plane_id, params->crtc_id, + new_fb.fb_id, 0, + 0, 0, + params->mode->hdisplay, params->mode->vdisplay, + params->fb.x << 16, params->fb.y << 16, + params->fb.w << 16, params->fb.h << 16); + igt_assert(rc == 0); + do_assertions(DONT_ASSERT_CRC); + + /* Source upscaling. */ + rc = drmModeSetPlane(drm.fd, plane_id, params->crtc_id, + new_fb.fb_id, 0, + 0, 0, + params->mode->hdisplay, params->mode->vdisplay, + params->fb.x << 16, params->fb.y << 16, + (params->fb.w / 2) << 16, + (params->fb.h / 2) << 16); + igt_assert(rc == 0); + do_assertions(DONT_ASSERT_CRC); + + /* Destination doesn't fill the entire CRTC, no scaling. */ + rc = drmModeSetPlane(drm.fd, plane_id, params->crtc_id, + new_fb.fb_id, 0, + params->mode->hdisplay / 4, + params->mode->vdisplay / 4, + params->mode->hdisplay / 2, + params->mode->vdisplay / 2, + params->fb.x << 16, params->fb.y << 16, + (params->fb.w / 2) << 16, + (params->fb.h / 2) << 16); + igt_assert(rc == 0); + do_assertions(DONT_ASSERT_CRC); + + /* Destination doesn't fill the entire CRTC, upscaling. */ + rc = drmModeSetPlane(drm.fd, plane_id, params->crtc_id, + new_fb.fb_id, 0, + params->mode->hdisplay / 4, + params->mode->vdisplay / 4, + params->mode->hdisplay / 2, + params->mode->vdisplay / 2, + (params->fb.x + params->fb.w / 2) << 16, + (params->fb.y + params->fb.h / 2) << 16, + (params->fb.w / 4) << 16, + (params->fb.h / 4) << 16); + igt_assert(rc == 0); + do_assertions(DONT_ASSERT_CRC); + + /* Back to the good and old blue fb. */ + rc = drmModeSetPlane(drm.fd, plane_id, params->crtc_id, + old_fb->fb_id, 0, + 0, 0, + params->mode->hdisplay, params->mode->vdisplay, + params->fb.x << 16, params->fb.y << 16, + params->fb.w << 16, params->fb.h << 16); + igt_assert(rc == 0); + do_assertions(0); + + igt_remove_fb(drm.fd, &new_fb); +} /** * modesetfrombusy - modeset from a busy buffer to a non-busy buffer * @@ -3071,6 +3190,18 @@ int main(int argc, char *argv[]) if (t.pipes != PIPE_SINGLE || t.screen != SCREEN_PRIM || t.plane != PLANE_PRI || + t.method != IGT_DRAW_MMAP_CPU) + continue; + igt_subtest_f("%s-%s-scaledprimary", + feature_str(t.feature), + fbs_str(t.fbs)) + scaledprimary_subtest(&t); + TEST_MODE_ITER_END + + TEST_MODE_ITER_BEGIN(t) + if (t.pipes != PIPE_SINGLE || + t.screen != SCREEN_PRIM || + t.plane != PLANE_PRI || t.fbs != FBS_INDIVIDUAL || t.method != IGT_DRAW_MMAP_CPU) continue;