From patchwork Mon Jan 30 14:12:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foss X-Patchwork-Id: 9545427 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 9CD0E60417 for ; Mon, 30 Jan 2017 14:13:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BFB227F07 for ; Mon, 30 Jan 2017 14:13:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F4992811E; Mon, 30 Jan 2017 14:13:30 +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, UNPARSEABLE_RELAY 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 2841027F07 for ; Mon, 30 Jan 2017 14:13:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 203036E4B9; Mon, 30 Jan 2017 14:13:19 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by gabe.freedesktop.org (Postfix) with ESMTPS id 407FE6E504 for ; Mon, 30 Jan 2017 14:13:15 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: robertfoss) with ESMTPSA id 440C32660BD From: Robert Foss To: intel-gfx@lists.freedesktop.org, Tomeu Vizoso , Maarten Lankhorst , Gustavo Padovan , Daniel Stone , Mika Kahola , Petri Latvala Date: Mon, 30 Jan 2017 09:12:23 -0500 Message-Id: <20170130141224.25063-33-robert.foss@collabora.com> X-Mailer: git-send-email 2.11.0.453.g787f75f05 In-Reply-To: <20170130141224.25063-1-robert.foss@collabora.com> References: <20170130141224.25063-1-robert.foss@collabora.com> Subject: [Intel-gfx] [PATCH i-g-t v3 32/33] tests/kms_plane_lowres: Add support for dynamic number of 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 Add changes reflecting the new support for dynamic number of planes per pipe. Signed-off-by: Robert Foss Reviewed-by: Mika Kahola --- tests/kms_plane_lowres.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c index 424ecb97..689c248e 100644 --- a/tests/kms_plane_lowres.c +++ b/tests/kms_plane_lowres.c @@ -40,8 +40,8 @@ typedef struct { int drm_fd; igt_display_t display; igt_pipe_crc_t *pipe_crc; - igt_plane_t *plane[IGT_MAX_PLANES]; - struct igt_fb fb[IGT_MAX_PLANES]; + igt_plane_t **plane; + struct igt_fb *fb; } data_t; static drmModeModeInfo @@ -113,6 +113,12 @@ static void test_init(data_t *data, enum pipe pipe) { data->pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO); + data->plane = calloc(data->display.pipes[pipe].n_planes, sizeof(data->plane));\ + igt_assert_f(data->plane, "Failed to allocate memory for %d planes\n", + data->display.pipes[pipe].n_planes); + data->fb = calloc(data->display.pipes[pipe].n_planes, sizeof(struct igt_fb)); + igt_assert_f(data->fb, "Failed to allocate memory for %d FBs\n", + data->display.pipes[pipe].n_planes); } static void @@ -128,6 +134,11 @@ test_fini(data_t *data, igt_output_t *output) igt_output_set_pipe(output, PIPE_ANY); igt_pipe_crc_free(data->pipe_crc); + + free(data->plane); + data->plane = NULL; + free(data->fb); + data->fb = NULL; } static int @@ -178,6 +189,8 @@ test_setup(data_t *data, enum pipe pipe, uint64_t modifier, int flags, int size; int i, x, y; + crtc.planes = calloc(sizeof(struct kmstest_plane), data->display.pipes[pipe].n_planes); + igt_assert_f(crtc.planes, "Failed to allocate memory for %d planes\n", data->display.pipes[pipe].n_planes); igt_output_set_pipe(output, pipe); kmstest_get_crtc(pipe, &crtc); @@ -198,8 +211,10 @@ test_setup(data_t *data, enum pipe pipe, uint64_t modifier, int flags, igt_plane_set_fb(data->plane[0], &data->fb[0]); /* yellow sprite plane in lower left corner */ - for (i = IGT_PLANE_2; i < crtc.n_planes; i++) { - if (data->plane[i]->is_cursor) + for (i = 0; i < crtc.n_planes; i++) { + if (data->plane[i]->type == DRM_PLANE_TYPE_PRIMARY) + continue; + if (data->plane[i]->type == DRM_PLANE_TYPE_CURSOR) size = 64; else size = SIZE; @@ -209,8 +224,8 @@ test_setup(data_t *data, enum pipe pipe, uint64_t modifier, int flags, igt_create_color_fb(data->drm_fd, size, size, - data->plane[i]->is_cursor ? DRM_FORMAT_ARGB8888 : DRM_FORMAT_XRGB8888, - data->plane[i]->is_cursor ? LOCAL_DRM_FORMAT_MOD_NONE : modifier, + data->plane[i]->type == DRM_PLANE_TYPE_CURSOR ? DRM_FORMAT_ARGB8888 : DRM_FORMAT_XRGB8888, + data->plane[i]->type == DRM_PLANE_TYPE_CURSOR ? LOCAL_DRM_FORMAT_MOD_NONE : modifier, 1.0, 1.0, 0.0, &data->fb[i]);