From patchwork Tue Mar 10 12:35:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ander Conselvan de Oliveira X-Patchwork-Id: 5977621 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 2340E9F318 for ; Tue, 10 Mar 2015 12:36:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 217D120220 for ; Tue, 10 Mar 2015 12:36:09 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 09B9920219 for ; Tue, 10 Mar 2015 12:36:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8AD4A6E6B7; Tue, 10 Mar 2015 05:36:07 -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 135326E6B7 for ; Tue, 10 Mar 2015 05:36:07 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 10 Mar 2015 05:36:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,374,1422950400"; d="scan'208";a="696492564" Received: from linux.intel.com ([10.23.219.25]) by orsmga002.jf.intel.com with ESMTP; 10 Mar 2015 05:36:06 -0700 Received: from localhost (unknown [10.237.72.167]) by linux.intel.com (Postfix) with ESMTP id 16E6F300001; Tue, 10 Mar 2015 05:35:49 -0700 (PDT) From: Ander Conselvan de Oliveira To: intel-gfx@lists.freedesktop.org Date: Tue, 10 Mar 2015 14:35:56 +0200 Message-Id: <1425990956-9016-1-git-send-email-ander.conselvan.de.oliveira@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1425990754-8723-1-git-send-email-ander.conselvan.de.oliveira@intel.com> References: <1425990754-8723-1-git-send-email-ander.conselvan.de.oliveira@intel.com> MIME-Version: 1.0 Cc: Ander Conselvan de Oliveira Subject: [Intel-gfx] [PATCH] tests: Add test for pipe B and C interactions in IVB 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: , 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 This actually only works if the machine is setup properly. It requires that: - the hardware to have at least two connected outpus; - the defatult mode on those outputs needs to be big enough; - the attached monitors need to support 10 bpc. This might generate spurius results if the connected output doesn't support 10bpc or a large enough mode. --- I used this to test the changes that affect pipe B and C interactions on IVB. I'm not really sure how to turn into a proper igt test though, because of the requirements on the outputs in use. --- tests/Makefile.sources | 1 + tests/kms_pipe_b_c_dpms.c | 173 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 174 insertions(+) create mode 100644 tests/kms_pipe_b_c_dpms.c diff --git a/tests/Makefile.sources b/tests/Makefile.sources index 9ab0ff4..9e43a64 100644 --- a/tests/Makefile.sources +++ b/tests/Makefile.sources @@ -73,6 +73,7 @@ TESTS_progs_M = \ kms_nuclear \ kms_pipe_crc_basic \ kms_plane \ + kms_pipe_b_c_dpms \ kms_psr_sink_crc \ kms_render \ kms_rotation_crc \ diff --git a/tests/kms_pipe_b_c_dpms.c b/tests/kms_pipe_b_c_dpms.c new file mode 100644 index 0000000..a5ed761 --- /dev/null +++ b/tests/kms_pipe_b_c_dpms.c @@ -0,0 +1,173 @@ +/* + * Copyright © 2015 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Ander Conselvan de Oliveira + */ + +#include "drmtest.h" +#include "igt_kms.h" +#include "intel_chipset.h" + +typedef struct { + int drm_fd; + igt_display_t display; +} data_t; + +static int +set_mode_on_pipe(data_t *data, enum pipe pipe, igt_output_t *output, int bpc) +{ + igt_plane_t *primary; + drmModeModeInfo *mode; + struct igt_fb fb; + int fb_id; + uint32_t format; + + if (bpc == 8) + format = DRM_FORMAT_XRGB8888; + else if (bpc == 10) + format = DRM_FORMAT_XRGB2101010; + else + igt_fail(1); + + igt_output_set_pipe(output, pipe); + + /* FIXME: we need a big mode */ + mode = igt_output_get_mode(output); + primary = igt_output_get_plane(output, 0); + + fb_id = igt_create_color_fb(data->drm_fd, + mode->hdisplay, mode->vdisplay, + format, I915_TILING_NONE, + 1.0, 1.0, 1.0, &fb); + igt_assert(fb_id >= 0); + + igt_plane_set_fb(primary, &fb); + return igt_display_try_commit2(&data->display, COMMIT_LEGACY); +} + +static int +set_big_mode_on_pipe(data_t *data, enum pipe pipe, igt_output_t *output) +{ + return set_mode_on_pipe(data, pipe, output, 10); +} + +static int +set_normal_mode_on_pipe(data_t *data, enum pipe pipe, igt_output_t *output) +{ + return set_mode_on_pipe(data, pipe, output, 8); +} + +static void +find_outputs(data_t *data, igt_output_t **output1, igt_output_t **output2) +{ + int count = 0; + igt_output_t *output; + + *output1 = NULL; + *output2 = NULL; + + for_each_connected_output(&data->display, output) { + if (!(*output1)) + *output1 = output; + else if (!(*output2)) + *output2 = output; + + igt_output_set_pipe(output, PIPE_ANY); + count++; + } + + igt_skip_on_f(count < 2, "Not enough connected outputs\n"); +} + +static void +test_dpms(data_t *data) +{ + igt_output_t *output1, *output2; + int ret; + + find_outputs(data, &output1, &output2); + + igt_info("Pipe %s will use connector %s\n", + kmstest_pipe_name(PIPE_B), igt_output_name(output1)); + igt_info("Pipe %s will use connector %s\n", + kmstest_pipe_name(PIPE_C), igt_output_name(output2)); + + ret = set_big_mode_on_pipe(data, PIPE_B, output1); + igt_assert(ret == 0); + + kmstest_set_connector_dpms(data->drm_fd, output1->config.connector, DRM_MODE_DPMS_OFF); + + ret = set_big_mode_on_pipe(data, PIPE_C, output2); + igt_assert(ret != 0); +} + +static void +test_lane_reduction(data_t *data) +{ + igt_output_t *output1, *output2; + int ret; + + find_outputs(data, &output1, &output2); + + igt_info("Pipe %s will use connector %s\n", + kmstest_pipe_name(PIPE_B), igt_output_name(output1)); + igt_info("Pipe %s will use connector %s\n", + kmstest_pipe_name(PIPE_C), igt_output_name(output2)); + + ret = set_big_mode_on_pipe(data, PIPE_B, output1); + igt_assert(ret == 0); + + ret = set_normal_mode_on_pipe(data, PIPE_B, output1); + igt_assert(ret == 0); + + ret = set_normal_mode_on_pipe(data, PIPE_C, output2); + igt_assert(ret == 0); +} + +static data_t data; +igt_main +{ + int devid; + + igt_skip_on_simulation(); + + igt_fixture { + data.drm_fd = drm_open_any_master(); + devid = intel_get_drm_devid(data.drm_fd); + + kmstest_set_vt_graphics_mode(); + igt_display_init(&data.display, data.drm_fd); + } + + igt_skip_on(!IS_IVYBRIDGE(devid)); + + igt_subtest("pipe-B-dpms-off-modeset-pipe-C") + test_dpms(&data); + + igt_subtest("pipe-B-double-modeset-then-modeset-pipe-C") + test_lane_reduction(&data); + + igt_fixture { + igt_display_fini(&data.display); + } +}