From patchwork Tue Feb 7 13:33:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kahola X-Patchwork-Id: 9560123 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 67D796047A for ; Tue, 7 Feb 2017 13:32:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59C7120007 for ; Tue, 7 Feb 2017 13:32:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4EC6728342; Tue, 7 Feb 2017 13:32:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ADE2020007 for ; Tue, 7 Feb 2017 13:32:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CE37C6E057; Tue, 7 Feb 2017 13:32:17 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9CA4A6E057 for ; Tue, 7 Feb 2017 13:32:16 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP; 07 Feb 2017 05:32:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.33,346,1477983600"; d="scan'208"; a="1104159834" Received: from sorvi.fi.intel.com ([10.237.72.169]) by fmsmga001.fm.intel.com with ESMTP; 07 Feb 2017 05:32:15 -0800 From: Mika Kahola To: intel-gfx@lists.freedesktop.org Date: Tue, 7 Feb 2017 15:33:09 +0200 Message-Id: <1486474389-28854-1-git-send-email-mika.kahola@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [Intel-gfx] [PATCH i-g-t] tests/kms_plane_lowres: Add DRM_MODE_ATOMIC_ALLOW_MODESET test 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-Virus-Scanned: ClamAV using ClamSMTP When doing a full atomic modeset, kernel should fail if the flag DRM_MODE_ATOMIC_ALLOW_MODESET is not set. Let's add this test as part of 'kms_plane_lowres' testset. The testcases are 'pipe-x-allow-modeset' where x stands for pipe in question. For: VIZ-6955 Signed-off-by: Mika Kahola --- tests/kms_plane_lowres.c | 51 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c index 689c248..a127124 100644 --- a/tests/kms_plane_lowres.c +++ b/tests/kms_plane_lowres.c @@ -142,12 +142,16 @@ test_fini(data_t *data, igt_output_t *output) } static int -display_commit_mode(data_t *data, enum pipe pipe, int flags, igt_crc_t *crc) +display_commit_mode(data_t *data, enum pipe pipe, bool test_modeset, igt_crc_t *crc) { char buf[256]; struct drm_event *e = (void *)buf; unsigned int vblank_start, vblank_stop; int n, ret; + int flags = DRM_MODE_PAGE_FLIP_EVENT; + + if (!test_modeset) + flags |= DRM_MODE_ATOMIC_ALLOW_MODESET; vblank_start = kmstest_get_vblank(data->display.drm_fd, pipe, DRM_VBLANK_NEXTONMISS); @@ -155,6 +159,9 @@ display_commit_mode(data_t *data, enum pipe pipe, int flags, igt_crc_t *crc) ret = igt_display_try_commit_atomic(&data->display, flags, NULL); + if (test_modeset) + return ret; + igt_skip_on(ret != 0); igt_set_timeout(1, "Stuck on page flip"); @@ -181,8 +188,7 @@ check_mode(drmModeModeInfo *mode1, drmModeModeInfo *mode2) } static drmModeModeInfo * -test_setup(data_t *data, enum pipe pipe, uint64_t modifier, int flags, - igt_output_t *output) +test_setup(data_t *data, enum pipe pipe, uint64_t modifier, igt_output_t *output) { struct kmstest_crtc crtc; drmModeModeInfo *mode; @@ -238,21 +244,21 @@ test_setup(data_t *data, enum pipe pipe, uint64_t modifier, int flags, static void test_plane_position_with_output(data_t *data, enum pipe pipe, - igt_output_t *output, uint64_t modifier) + igt_output_t *output, uint64_t modifier, + bool test_modeset) { igt_crc_t *crc_hires1, *crc_hires2; igt_crc_t *crc_lowres; drmModeModeInfo mode_lowres; drmModeModeInfo *mode1, *mode2, *mode3; int ret, n; - int flags = DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_ALLOW_MODESET; igt_info("Testing connector %s using pipe %s\n", igt_output_name(output), kmstest_pipe_name(pipe)); test_init(data, pipe); - mode1 = test_setup(data, pipe, modifier, flags, output); + mode1 = test_setup(data, pipe, modifier, output); mode_lowres = get_lowres_mode(data->drm_fd, mode1); @@ -273,7 +279,12 @@ test_plane_position_with_output(data_t *data, enum pipe pipe, check_mode(&mode_lowres, mode2); - display_commit_mode(data, pipe, flags, crc_lowres); + ret = display_commit_mode(data, pipe, test_modeset, crc_lowres); + + if (test_modeset) { + igt_assert(ret != 0); + goto out; + } igt_assert_plane_visible(pipe, false); @@ -285,17 +296,24 @@ test_plane_position_with_output(data_t *data, enum pipe pipe, check_mode(mode1, mode3); - display_commit_mode(data, pipe, flags, crc_hires2); + ret = display_commit_mode(data, pipe, test_modeset, crc_hires2); + + if (test_modeset) { + igt_assert(ret != 0); + goto out; + } igt_assert_plane_visible(pipe, true); +out: igt_pipe_crc_stop(data->pipe_crc); test_fini(data, output); } static void -test_plane_position(data_t *data, enum pipe pipe, uint64_t modifier) +test_plane_position(data_t *data, enum pipe pipe, uint64_t modifier, + bool test_modeset) { igt_output_t *output; int connected_outs; @@ -310,7 +328,8 @@ test_plane_position(data_t *data, enum pipe pipe, uint64_t modifier) connected_outs = 0; for_each_valid_output_on_pipe(&data->display, pipe, output) { - test_plane_position_with_output(data, pipe, output, modifier); + test_plane_position_with_output(data, pipe, output, modifier, + test_modeset); connected_outs++; } @@ -322,19 +341,23 @@ run_tests_for_pipe(data_t *data, enum pipe pipe) { igt_subtest_f("pipe-%s-tiling-none", kmstest_pipe_name(pipe)) - test_plane_position(data, pipe, LOCAL_DRM_FORMAT_MOD_NONE); + test_plane_position(data, pipe, LOCAL_DRM_FORMAT_MOD_NONE, false); igt_subtest_f("pipe-%s-tiling-x", kmstest_pipe_name(pipe)) - test_plane_position(data, pipe, LOCAL_I915_FORMAT_MOD_X_TILED); + test_plane_position(data, pipe, LOCAL_I915_FORMAT_MOD_X_TILED, false); igt_subtest_f("pipe-%s-tiling-y", kmstest_pipe_name(pipe)) - test_plane_position(data, pipe, LOCAL_I915_FORMAT_MOD_Y_TILED); + test_plane_position(data, pipe, LOCAL_I915_FORMAT_MOD_Y_TILED, false); igt_subtest_f("pipe-%s-tiling-yf", kmstest_pipe_name(pipe)) - test_plane_position(data, pipe, LOCAL_I915_FORMAT_MOD_Yf_TILED); + test_plane_position(data, pipe, LOCAL_I915_FORMAT_MOD_Yf_TILED, false); + + igt_subtest_f("pipe-%s-allow-modeset", + kmstest_pipe_name(pipe)) + test_plane_position(data, pipe, LOCAL_I915_FORMAT_MOD_X_TILED, true); } static data_t data;