From patchwork Thu Apr 6 07:40:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ander Conselvan de Oliveira X-Patchwork-Id: 9666273 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 643256021C for ; Thu, 6 Apr 2017 07:41:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54A4427FBE for ; Thu, 6 Apr 2017 07:41:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4955028305; Thu, 6 Apr 2017 07:41:18 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 D997A27FBE for ; Thu, 6 Apr 2017 07:41:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 65C5C6E912; Thu, 6 Apr 2017 07:41:16 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id AE7A46E912 for ; Thu, 6 Apr 2017 07:41:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1491464474; x=1523000474; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=7oMuoly3UrLR/UJbZFzZyVh2eDcgdPX9kfxbNGa7fuU=; b=eOGJmyvprHV569AGla3ZC5K6SOxhlDczX5DhF4D4ClSt8kdmYQitFxFp y5ddN7evU9/v3We9Lj6f7O+XdnJGWg==; Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Apr 2017 00:41:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,283,1488873600"; d="scan'208";a="952498033" Received: from linux.intel.com ([10.54.29.200]) by orsmga003.jf.intel.com with ESMTP; 06 Apr 2017 00:41:12 -0700 Received: from localhost (aconselv-mobl3.fi.intel.com [10.237.66.54]) by linux.intel.com (Postfix) with ESMTP id 24D596A4006; Thu, 6 Apr 2017 00:41:02 -0700 (PDT) From: Ander Conselvan de Oliveira To: intel-gfx@lists.freedesktop.org Date: Thu, 6 Apr 2017 10:40:59 +0300 Message-Id: <20170406074059.4896-2-ander.conselvan.de.oliveira@intel.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170406074059.4896-1-ander.conselvan.de.oliveira@intel.com> References: <20170406074059.4896-1-ander.conselvan.de.oliveira@intel.com> Cc: Ander Conselvan de Oliveira Subject: [Intel-gfx] [PATCH i-g-t 2/2] kms_cursor_limited: Test crc matches between cursor and overlay planes 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 This test actually *fails* in GLK and possibly SKL and others too. When using limited range, the pipe crc when using the cursor plane is different than the one when using an overlay plane, although the fb and plane position is the same. Since this test fails it should probably not be merged, but it is here to prove the point of the previous patch. Signed-off-by: Ander Conselvan de Oliveira --- tests/Makefile.sources | 1 + tests/kms_cursor_limited.c | 175 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 176 insertions(+) create mode 100644 tests/kms_cursor_limited.c diff --git a/tests/Makefile.sources b/tests/Makefile.sources index 45c21a0..c7d36f6 100644 --- a/tests/Makefile.sources +++ b/tests/Makefile.sources @@ -99,6 +99,7 @@ TESTS_progs_M = \ kms_chv_cursor_fail \ kms_cursor_crc \ kms_cursor_legacy \ + kms_cursor_limited \ kms_draw_crc \ kms_fbc_crc \ kms_fbcon_fbt \ diff --git a/tests/kms_cursor_limited.c b/tests/kms_cursor_limited.c new file mode 100644 index 0000000..88c130c --- /dev/null +++ b/tests/kms_cursor_limited.c @@ -0,0 +1,175 @@ +#include "igt.h" + +typedef struct { + int drm_fd; + igt_display_t display; + struct igt_fb primary_fb; + struct igt_fb fb; + int fb_w, fb_h; + igt_output_t *output; + enum pipe pipe; + igt_pipe_crc_t *pipe_crc; +} data_t; + +static void cursor_enable(data_t *data) +{ + igt_output_t *output = data->output; + igt_plane_t *cursor; + + cursor = igt_output_get_plane_type(output, DRM_PLANE_TYPE_CURSOR); + igt_plane_set_fb(cursor, &data->fb); + igt_plane_set_size(cursor, data->fb_w, data->fb_h); +} + +static void cursor_disable(data_t *data) +{ + igt_output_t *output = data->output; + igt_plane_t *cursor; + + cursor = igt_output_get_plane_type(output, DRM_PLANE_TYPE_CURSOR); + igt_plane_set_fb(cursor, NULL); +} + +static void overlay_enable(data_t *data) +{ + igt_output_t *output = data->output; + igt_plane_t *overlay; + + overlay = igt_output_get_plane_type(output, DRM_PLANE_TYPE_OVERLAY); + igt_plane_set_fb(overlay, &data->fb); + igt_plane_set_size(overlay, data->fb_w, data->fb_h); +} + +static void overlay_disable(data_t *data) +{ + igt_output_t *output = data->output; + igt_plane_t *overlay; + + overlay = igt_output_get_plane_type(output, DRM_PLANE_TYPE_OVERLAY); + igt_plane_set_fb(overlay, NULL); +} + +static void create_fb(data_t *data) +{ + uint32_t fb_id; + + fb_id = igt_create_color_fb(data->drm_fd, data->fb_w, data->fb_h, + DRM_FORMAT_ARGB8888, + LOCAL_DRM_FORMAT_MOD_NONE, + 0.5, 0.5, 0.5, + &data->fb); + igt_assert(fb_id); +} + +static void prepare_crtc(data_t *data, igt_output_t *output, int w, int h) +{ + drmModeModeInfo *mode; + igt_display_t *display = &data->display; + igt_plane_t *primary; + + /* select the pipe we want to use */ + igt_output_set_pipe(output, data->pipe); + cursor_disable(data); + + /* create and set the primary plane fb */ + mode = igt_output_get_mode(output); + igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, + DRM_FORMAT_XRGB8888, + LOCAL_DRM_FORMAT_MOD_NONE, + 0.0, 0.0, 0.0, + &data->primary_fb); + + primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY); + igt_plane_set_fb(primary, &data->primary_fb); + + igt_display_commit(display); + + /* create the pipe_crc object for this pipe */ + if (data->pipe_crc) + igt_pipe_crc_free(data->pipe_crc); + + data->pipe_crc = igt_pipe_crc_new(data->drm_fd, data->pipe, + INTEL_PIPE_CRC_SOURCE_AUTO); + + data->fb_w = w; + data->fb_h = h; + create_fb(data); + + /* make sure cursor is disabled */ + cursor_disable(data); + igt_wait_for_vblank(data->drm_fd, data->pipe); +} + +static void do_single_test(data_t *data) +{ + igt_display_t *display = &data->display; + igt_pipe_crc_t *pipe_crc = data->pipe_crc; + igt_crc_t cursor_crc, overlay_crc; + igt_plane_t *cursor, *overlay; + + cursor_enable(data); + cursor = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_CURSOR); + igt_plane_set_position(cursor, 0, 0); + igt_display_commit(display); + igt_wait_for_vblank(data->drm_fd, data->pipe); + igt_pipe_crc_collect_crc(pipe_crc, &cursor_crc); + + cursor_disable(data); + overlay_enable(data); + overlay = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_OVERLAY); + igt_plane_set_position(overlay, 0, 0); + igt_display_commit(display); + igt_wait_for_vblank(data->drm_fd, data->pipe); + igt_pipe_crc_collect_crc(pipe_crc, &overlay_crc); + + igt_assert_crc_equal(&cursor_crc, &overlay_crc); + + overlay_disable(data); + igt_display_commit(display); +} + +static void run_tests(data_t *data) +{ + enum pipe p; + igt_output_t *output; + + struct { + const char *name; + enum kmstest_broadcast_rgb_mode mode; + } tests[] = { + { .name = "full", .mode = BROADCAST_RGB_FULL }, + { .name = "limited", .mode = BROADCAST_RGB_16_235 }, + }; + + + for (int i = 0; i < ARRAY_SIZE(tests); i++) { + igt_subtest(tests[i].name) { + for_each_pipe_with_valid_output(&data->display, p, output) { + data->output = output; + data->pipe = p; + + prepare_crtc(data, output, 64, 64); + + kmstest_set_connector_broadcast_rgb(data->drm_fd, + output->config.connector, + tests[i].mode); + + do_single_test(data); + } + } + } +} + +static data_t data; + +igt_main +{ + igt_fixture { + data.drm_fd = drm_open_driver_master(DRIVER_INTEL); + kmstest_set_vt_graphics_mode(); + + igt_display_init(&data.display, data.drm_fd); + } + + run_tests(&data); +}