From patchwork Wed Jul 23 21:31:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 4613301 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1269FC0514 for ; Wed, 23 Jul 2014 21:31:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1F0C6201BF for ; Wed, 23 Jul 2014 21:31:31 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2D6E920120 for ; Wed, 23 Jul 2014 21:31:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BE48A6E455; Wed, 23 Jul 2014 14:31:29 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-yk0-f174.google.com (mail-yk0-f174.google.com [209.85.160.174]) by gabe.freedesktop.org (Postfix) with ESMTP id BDAC56E455 for ; Wed, 23 Jul 2014 14:31:28 -0700 (PDT) Received: by mail-yk0-f174.google.com with SMTP id q9so1197618ykb.33 for ; Wed, 23 Jul 2014 14:31:28 -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:in-reply-to:references; bh=4T6AGfc2Ng21PlTIMduDX/A0HFPJ1Ix0oz9LqEJ8ENI=; b=NvlMcINw+CizisX9YRmTD8LddV+7Z5bM83WvOGTDkVtgJubLLx5ZlOK+L1Ny1m/+MD v1wbuQWmSnIxozYizyBgkjstJkJvEl2691+ZInw+nelBZ4N514N/4l/f/eHcg1461wIb 5ZPzH0GpZP0xoHkcMfLgIc3I/eTlfOTkpdAdEqfkhbfdXXn8x+LKIXSPDGE7p8gIkZ5E /2XUHjVGkc+Y2UTQuouei76bcwZSdfBJFW1EdifMUZSDVG4ssEHmdrOSI0Hh4p42o2T/ rl7RvCjmom8iSriDX635M6dgo1ugvY0TUfZm5GfU9nBmk6XmI6jHnOOEU7TFa3L4T9CA Ikng== X-Received: by 10.236.44.41 with SMTP id m29mr5425224yhb.57.1406151088226; Wed, 23 Jul 2014 14:31:28 -0700 (PDT) Received: from localhost.localdomain ([177.16.191.199]) by mx.google.com with ESMTPSA id e32sm9712252yhq.43.2014.07.23.14.31.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 Jul 2014 14:31:27 -0700 (PDT) From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Wed, 23 Jul 2014 18:31:00 -0300 Message-Id: <1406151060-23853-2-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 2.0.1 In-Reply-To: <1406151060-23853-1-git-send-email-przanoni@gmail.com> References: <1406151060-23853-1-git-send-email-przanoni@gmail.com> Cc: Paulo Zanoni Subject: [Intel-gfx] [PATCH] tests/pm_rpm: add cursor subtests 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.1 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 These tests currently trigger WARNs on our Kernel. Let's make sure we fix the bugs and they never come back. Signed-off-by: Paulo Zanoni --- tests/pm_rpm.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 101 insertions(+), 10 deletions(-) diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c index 869e6f3..10ac6cc 100644 --- a/tests/pm_rpm.c +++ b/tests/pm_rpm.c @@ -277,13 +277,15 @@ static uint32_t get_fb(struct mode_set_data *data, int width, int height) igt_assert(false); } -static bool enable_one_screen_with_type(struct mode_set_data *data, - enum screen_type type) +static bool find_connector_for_modeset(struct mode_set_data *data, + enum screen_type type, + uint32_t *connector_id, + drmModeModeInfoPtr *mode) { - uint32_t crtc_id = 0, buffer_id = 0, connector_id = 0; - drmModeModeInfoPtr mode = NULL; - int i, rc; + int i; + *connector_id = 0; + *mode = NULL; for (i = 0; i < data->res->count_connectors; i++) { drmModeConnectorPtr c = data->connectors[i]; @@ -296,13 +298,23 @@ static bool enable_one_screen_with_type(struct mode_set_data *data, continue; if (c->connection == DRM_MODE_CONNECTED && c->count_modes) { - connector_id = c->connector_id; - mode = &c->modes[0]; + *connector_id = c->connector_id; + *mode = &c->modes[0]; break; } } - if (connector_id == 0) + return (*connector_id != 0); +} + +static bool enable_one_screen_with_type(struct mode_set_data *data, + enum screen_type type) +{ + uint32_t crtc_id = 0, buffer_id = 0, connector_id; + drmModeModeInfoPtr mode; + int rc; + + if (!find_connector_for_modeset(data, type, &connector_id, &mode)) return false; crtc_id = data->res->crtcs[0]; @@ -310,8 +322,6 @@ static bool enable_one_screen_with_type(struct mode_set_data *data, igt_assert(crtc_id); igt_assert(buffer_id); - igt_assert(connector_id); - igt_assert(mode); rc = drmModeSetCrtc(drm_fd, crtc_id, buffer_id, 0, 0, &connector_id, 1, mode); @@ -1407,6 +1417,81 @@ static void dpms_mode_unset_subtest(enum screen_type type) igt_assert(wait_for_suspended()); } +static void fill_igt_fb(struct igt_fb *fb, uint32_t color) +{ + int i; + uint32_t *ptr; + + ptr = gem_mmap__cpu(drm_fd, fb->gem_handle, fb->size, 0); + for (i = 0; i < fb->size/sizeof(uint32_t); i++) + ptr[i] = color; + igt_assert(munmap(ptr, fb->size) == 0); +} + +/* At some point, this test triggered WARNs in the Kernel. */ +static void cursor_subtest(bool dpms) +{ + uint32_t crtc_id = 0, connector_id; + drmModeModeInfoPtr mode; + int rc; + struct igt_fb scanout_fb, cursor_fb1, cursor_fb2; + + 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, false, &scanout_fb); + igt_create_fb(drm_fd, 64, 64, DRM_FORMAT_ARGB8888, false, &cursor_fb1); + igt_create_fb(drm_fd, 64, 64, DRM_FORMAT_ARGB8888, false, &cursor_fb2); + + fill_igt_fb(&scanout_fb, 0xFF); + fill_igt_fb(&cursor_fb1, 0xFF00FFFF); + fill_igt_fb(&cursor_fb2, 0xFF00FF00); + + 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()); + + rc = drmModeSetCursor(drm_fd, crtc_id, cursor_fb1.gem_handle, 64, 64); + igt_assert(rc == 0); + rc = drmModeMoveCursor(drm_fd, crtc_id, 0, 0); + 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()); + + rc = drmModeMoveCursor(drm_fd, crtc_id, 1, 1); + igt_assert(rc == 0); + igt_assert(wait_for_suspended()); + + rc = drmModeSetCursor(drm_fd, crtc_id, 0, 0, 0); + igt_assert(rc == 0); + igt_assert(wait_for_suspended()); + + rc = drmModeSetCursor(drm_fd, crtc_id, cursor_fb2.gem_handle, 64, 64); + igt_assert(rc == 0); + igt_assert(wait_for_suspended()); + + rc = drmModeMoveCursor(drm_fd, crtc_id, 2, 2); + igt_assert(rc == 0); + igt_assert(wait_for_suspended()); + + rc = drmModeSetCursor(drm_fd, crtc_id, 0, 0, 0); + igt_assert(rc == 0); + igt_assert(wait_for_suspended()); +} + int rounds = 50; bool stay = false; @@ -1480,6 +1565,12 @@ int main(int argc, char *argv[]) igt_subtest("gem-idle") gem_idle_subtest(); + /* Planes and cursors */ + igt_subtest("cursor") + cursor_subtest(false); + igt_subtest("cursor-dpms") + cursor_subtest(true); + /* Misc */ igt_subtest("reg-read-ioctl") reg_read_ioctl_subtest();