From patchwork Thu Aug 7 13:10:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 4691221 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3E1119F373 for ; Thu, 7 Aug 2014 13:11:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 530FC201DD for ; Thu, 7 Aug 2014 13:11:08 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 3251E201DC for ; Thu, 7 Aug 2014 13:11:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 893AC6E778; Thu, 7 Aug 2014 06:11:06 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-yh0-f48.google.com (mail-yh0-f48.google.com [209.85.213.48]) by gabe.freedesktop.org (Postfix) with ESMTP id EEE666E778 for ; Thu, 7 Aug 2014 06:11:04 -0700 (PDT) Received: by mail-yh0-f48.google.com with SMTP id i57so2854274yha.21 for ; Thu, 07 Aug 2014 06:11:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=SPeQeSh9SI3BURLNgGu8R5meylWi6gbSaQzdlhJ/Tx4=; b=g5ws19bR4YrNX0rce5SwIwfMgyxDQqWx7XoHdvGtkG6sAEsiIxBoozPbNXp6LFHJ9q vMxaeBnZG4Hx22hGnLGJFPhWn4JtDrKmgXFzfykcykeGGTC2yGNDvyNtUemR2T703vXt lhPATDIyyGjNPsK+vTG4yVoPolbSQ+Vw9h+s6+NEaBXMalZewU6QuiJjKH+3H0/hYPBp HmYMVC2gIxoC7ueaywfIXmCUJISr7UmYbE4Nr+u3rEqIDYOI/kAeLWRFmi3p1FfEVRPc GRayhYKMsDHfhg/R6riBh6kCN403kMj4gkr2j7vxAdLrLdjZ3s2/mhSBbJN8xBdlLpYj ip8A== X-Received: by 10.236.110.110 with SMTP id t74mr4171817yhg.162.1407417064547; Thu, 07 Aug 2014 06:11:04 -0700 (PDT) Received: from localhost.localdomain ([177.156.106.184]) by mx.google.com with ESMTPSA id l65sm7509013yhb.45.2014.08.07.06.11.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Aug 2014 06:11:04 -0700 (PDT) From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Thu, 7 Aug 2014 10:10:57 -0300 Message-Id: <1407417057-2358-1-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 2.0.1 Cc: Paulo Zanoni Subject: [Intel-gfx] [PATCH] tests/pm_rpm: add subtests for fences X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 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.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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: Paulo Zanoni Daniel thought fences were not surviving runtime PM on DPMS, so we wrote this test to check. The good news is that the test passed, so there's no need for a Kernel patch, at least on the Kernel I tested. Signed-off-by: Paulo Zanoni --- tests/pm_rpm.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c index 84c71bd..5e520da 100644 --- a/tests/pm_rpm.c +++ b/tests/pm_rpm.c @@ -1704,6 +1704,74 @@ static void planes_subtest(bool universal, bool dpms) } } +static void fences_subtest(bool dpms) +{ + uint32_t connector_id, crtc_id = 0; + drmModeModeInfoPtr mode; + struct igt_fb scanout_fb; + int rc, i; + uint32_t *buf_ptr; + uint32_t tiling = false, swizzle; + + disable_all_screens(&ms_data); + igt_assert(wait_for_suspended()); + + igt_require(find_connector_for_modeset(&ms_data, SCREEN_TYPE_ANY, + &connector_id, &mode)); + + crtc_id = ms_data.res->crtcs[0]; + igt_assert(crtc_id); + + igt_create_fb(drm_fd, mode->hdisplay, mode->vdisplay, + DRM_FORMAT_XRGB8888, true, &scanout_fb); + + /* Even though we passed "true" as the tiling argument, double-check + * that the fb is really tiled. */ + gem_get_tiling(drm_fd, scanout_fb.gem_handle, &tiling, &swizzle); + igt_assert(tiling); + + buf_ptr = gem_mmap__gtt(drm_fd, scanout_fb.gem_handle, + scanout_fb.size, PROT_WRITE | PROT_READ); + for (i = 0; i < scanout_fb.size/sizeof(uint32_t); i++) + buf_ptr[i] = i; + + rc = drmModeSetCrtc(drm_fd, crtc_id, scanout_fb.fb_id, 0, 0, + &connector_id, 1, mode); + igt_assert(rc == 0); + igt_assert(wait_for_active()); + + if (dpms) + disable_all_screens_dpms(&ms_data); + else + disable_all_screens(&ms_data); + igt_assert(wait_for_suspended()); + + for (i = 0; i < scanout_fb.size/sizeof(uint32_t); i++) + igt_assert_eq(buf_ptr[i], i); + igt_assert(wait_for_suspended()); + + if (dpms) { + drmModeConnectorPtr c = NULL; + + for (i = 0; i < ms_data.res->count_connectors; i++) + if (ms_data.connectors[i]->connector_id == connector_id) + c = ms_data.connectors[i]; + igt_assert(c); + + kmstest_set_connector_dpms(drm_fd, c, DRM_MODE_DPMS_ON); + } else { + rc = drmModeSetCrtc(drm_fd, crtc_id, scanout_fb.fb_id, 0, 0, + &connector_id, 1, mode); + igt_assert(rc == 0); + } + igt_assert(wait_for_active()); + + for (i = 0; i < scanout_fb.size/sizeof(uint32_t); i++) + igt_assert_eq(buf_ptr[i], i); + + igt_assert(munmap(buf_ptr, scanout_fb.size) == 0); +} + int rounds = 50; bool stay = false; @@ -1808,6 +1876,10 @@ int main(int argc, char *argv[]) dpms_mode_unset_subtest(SCREEN_TYPE_LPSP); igt_subtest("dpms-mode-unset-non-lpsp") dpms_mode_unset_subtest(SCREEN_TYPE_NON_LPSP); + igt_subtest("fences") + fences_subtest(false); + igt_subtest("fences-dpms") + fences_subtest(true); /* Modeset stress */ igt_subtest("modeset-lpsp-stress")