From patchwork Wed Dec 13 09:50:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vidya Srinivas X-Patchwork-Id: 10109579 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 16109602C2 for ; Wed, 13 Dec 2017 09:41:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10AB3290E0 for ; Wed, 13 Dec 2017 09:41:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 059B229139; Wed, 13 Dec 2017 09:41:54 +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 A0AFE290E0 for ; Wed, 13 Dec 2017 09:41:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3E7556E3FA; Wed, 13 Dec 2017 09:41:53 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 411DE6E3F9 for ; Wed, 13 Dec 2017 09:41:51 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Dec 2017 01:41:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,397,1508828400"; d="scan'208";a="186554270" Received: from vsrini4-ubuntu.iind.intel.com ([10.223.25.4]) by fmsmga006.fm.intel.com with ESMTP; 13 Dec 2017 01:41:48 -0800 From: Vidya Srinivas To: intel-gfx@lists.freedesktop.org Date: Wed, 13 Dec 2017 15:20:49 +0530 Message-Id: <1513158652-8912-4-git-send-email-vidya.srinivas@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513158652-8912-1-git-send-email-vidya.srinivas@intel.com> References: <1513158652-8912-1-git-send-email-vidya.srinivas@intel.com> Cc: daniel.vetter@intel.com, Vidya Srinivas Subject: [Intel-gfx] [PATCH i-g-t 3/6] i-g-t: lib/igt_kms: Run kms_plane for all supported pixel formats 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 From: Mahesh Kumar This patch adds a subtest related to pixel format testing. The test create framebuffer with all supported pixel formats for primary and sprite planes which can be drawn using cairo and commits the same on display. Signed-off-by: Mahesh Kumar Signed-off-by: Jyoti Yadav Signed-off-by: Vidya Srinivas --- tests/kms_plane.c | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) diff --git a/tests/kms_plane.c b/tests/kms_plane.c index 92bf67f..5f25177 100644 --- a/tests/kms_plane.c +++ b/tests/kms_plane.c @@ -368,6 +368,125 @@ test_plane_panning(data_t *data, enum pipe pipe, unsigned int flags) igt_skip_on(connected_outs == 0); } +static void test_format_primary(data_t *data, + enum pipe pipe, igt_output_t *output) +{ + igt_plane_t *primary; + struct igt_fb primary_fb; + drmModeModeInfo *mode; + cairo_t *cr; + int primary_id; + uint32_t format; + + igt_info("Testing connector %s using pipe %s on primary plane\n", + igt_output_name(output), kmstest_pipe_name(pipe)); + + igt_output_set_pipe(output, pipe); + mode = igt_output_get_mode(output); + + primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY); + + for_each_format_in_plane(primary, format) { + if (igt_is_cairo_supported_format(format)) { + igt_info("Testing format %s on primary now\n", + igt_get_format_name(format)); + primary_id = igt_create_fb(data->drm_fd, + mode->hdisplay, mode->vdisplay, + format, + LOCAL_DRM_FORMAT_MOD_NONE, + &primary_fb); + igt_assert(primary_id); + cr = igt_get_cairo_ctx(data->drm_fd, &primary_fb); + igt_paint_color(cr, 0, 0, mode->hdisplay, mode->vdisplay, + 0.0, 1.0, 0.0); + igt_paint_color(cr, 100, 100, 64, 64, 0.0, 0.0, 0.0); + igt_assert(cairo_status(cr) == 0); + cairo_destroy(cr); + + igt_plane_set_fb(primary, &primary_fb); + igt_display_commit(&data->display); + } + } + + igt_remove_fb(data->drm_fd, &primary_fb); + igt_plane_set_fb(primary, NULL); +} + +static void test_format_overlay(data_t *data, + enum pipe pipe, igt_output_t *output, + int plane_id) +{ + igt_plane_t *primary, *overlay; + struct igt_fb primary_fb, overlay_fb; + drmModeModeInfo *mode; + cairo_t *cr; + int primary_id, overlay_id; + uint32_t format; + + igt_info("Testing connector %s using pipe %s on overlay plane %d\n", + igt_output_name(output), kmstest_pipe_name(pipe), plane_id); + + igt_output_set_pipe(output, pipe); + mode = igt_output_get_mode(output); + + overlay = igt_output_get_plane(output, plane_id); + primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY); + primary_id = igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, + DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE, + &primary_fb); + igt_assert(primary_id); + igt_plane_set_fb(primary, &primary_fb); + cr = igt_get_cairo_ctx(data->drm_fd, &primary_fb); + igt_paint_color(cr, 0, 0, mode->hdisplay, mode->vdisplay, 0.0, 0.0, 1.0); + igt_assert(cairo_status(cr) == 0); + cairo_destroy(cr); + + for_each_format_in_plane(overlay, format) { + if (igt_is_cairo_supported_format(format)) { + igt_info("Testing format %s on plane id %d\n", + igt_get_format_name(format), plane_id); + overlay_id = igt_create_fb(data->drm_fd, 300, 300, format, + LOCAL_DRM_FORMAT_MOD_NONE, &overlay_fb); + igt_assert(overlay_id); + + igt_plane_set_fb(overlay, &overlay_fb); + cr = igt_get_cairo_ctx(data->drm_fd, &overlay_fb); + igt_paint_color(cr, 0, 0, 300, 300, 1.0, 0.0, 0.0); + igt_assert(cairo_status(cr) == 0); + cairo_destroy(cr); + igt_display_commit(&data->display); + + igt_remove_fb(data->drm_fd, &overlay_fb); + igt_plane_set_fb(overlay, NULL); + overlay_id = 0; + } + } + igt_remove_fb(data->drm_fd, &primary_fb); + igt_plane_set_fb(primary, NULL); +} + +static void +test_pixel_formats(data_t *data, enum pipe pipe) +{ + igt_output_t *output; + int connected_outs = 0; + + for_each_valid_output_on_pipe(&data->display, pipe, output) { + int n_planes = data->display.pipes[pipe].n_planes; + + igt_info("Testing PRIMARY on pipe %d\n", pipe); + test_format_primary(data, pipe, output); + + /* Run only for SPRITES */ + for (int plane_id = 1; plane_id < n_planes-1; plane_id++) + test_format_overlay(data, pipe, output, plane_id); + + connected_outs++; + igt_output_set_pipe(output, PIPE_ANY); + } + igt_skip_on(connected_outs == 0); +} + static void run_tests_for_pipe_plane(data_t *data, enum pipe pipe) { @@ -376,6 +495,10 @@ run_tests_for_pipe_plane(data_t *data, enum pipe pipe) igt_require(data->display.pipes[pipe].n_planes > 0); } + igt_subtest_f("pixel-format-pipe-%s-planes", + kmstest_pipe_name(pipe)) + test_pixel_formats(data, pipe); + igt_subtest_f("plane-position-covered-pipe-%s-planes", kmstest_pipe_name(pipe)) test_plane_position(data, pipe, TEST_POSITION_FULLY_COVERED);