From patchwork Mon Jan 30 14:12:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foss X-Patchwork-Id: 9545437 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 6C27360417 for ; Mon, 30 Jan 2017 14:13:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C9AA27F07 for ; Mon, 30 Jan 2017 14:13:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4031C2811E; Mon, 30 Jan 2017 14:13:43 +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 CE9D427F07 for ; Mon, 30 Jan 2017 14:13:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D9E306E504; Mon, 30 Jan 2017 14:13:22 +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 [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by gabe.freedesktop.org (Postfix) with ESMTPS id 71D306E50F for ; Mon, 30 Jan 2017 14:13:04 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: robertfoss) with ESMTPSA id 43A402660BD 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:14 -0500 Message-Id: <20170130141224.25063-24-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 23/33] tests/kms_psr_sink_crc: 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_psr_sink_crc.c | 52 +++++++++++++++++++++--------------------------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c index 926b8578..8f6bdc0d 100644 --- a/tests/kms_psr_sink_crc.c +++ b/tests/kms_psr_sink_crc.c @@ -34,12 +34,6 @@ bool running_with_psr_disabled; #define CRC_BLACK "000000000000" -enum planes { - PRIMARY, - SPRITE, - CURSOR, -}; - enum operations { PAGE_FLIP, MMAP_GTT, @@ -69,7 +63,7 @@ static const char *op_str(enum operations op) typedef struct { int drm_fd; - enum planes test_plane; + int test_plane; enum operations op; uint32_t devid; uint32_t crtc_id; @@ -313,9 +307,9 @@ static void run_test(data_t *data) /* Setting a secondary fb/plane */ switch (data->test_plane) { - case PRIMARY: default: test_plane = data->primary; break; - case SPRITE: test_plane = data->sprite; break; - case CURSOR: test_plane = data->cursor; break; + case DRM_PLANE_TYPE_PRIMARY: default: test_plane = data->primary; break; + case DRM_PLANE_TYPE_OVERLAY: test_plane = data->sprite; break; + case DRM_PLANE_TYPE_CURSOR: test_plane = data->cursor; break; } igt_plane_set_fb(test_plane, &data->fb_white); igt_display_commit(&data->display); @@ -323,7 +317,7 @@ static void run_test(data_t *data) /* Confirm it is not Green anymore */ igt_assert(wait_psr_entry(data)); get_sink_crc(data, ref_crc); - if (data->test_plane == PRIMARY) + if (data->test_plane == DRM_PLANE_TYPE_PRIMARY) assert_or_manual(!is_green(ref_crc), "screen WHITE"); else assert_or_manual(!is_green(ref_crc), "GREEN background with WHITE box"); @@ -355,7 +349,7 @@ static void run_test(data_t *data) /* Printing white on white so the screen shouldn't change */ memset(ptr, 0xff, data->mod_size); get_sink_crc(data, crc); - if (data->test_plane == PRIMARY) + if (data->test_plane == DRM_PLANE_TYPE_PRIMARY) assert_or_manual(strcmp(ref_crc, crc) == 0, "screen WHITE"); else assert_or_manual(strcmp(ref_crc, crc) == 0, @@ -406,9 +400,9 @@ static void run_test(data_t *data) static void test_cleanup(data_t *data) { igt_plane_set_fb(data->primary, NULL); - if (data->test_plane == SPRITE) + if (data->test_plane == DRM_PLANE_TYPE_OVERLAY) igt_plane_set_fb(data->sprite, NULL); - if (data->test_plane == CURSOR) + if (data->test_plane == DRM_PLANE_TYPE_CURSOR) igt_plane_set_fb(data->cursor, NULL); igt_display_commit(&data->display); @@ -428,7 +422,7 @@ static void setup_test_plane(data_t *data) 0.0, 1.0, 0.0, &data->fb_green); - data->primary = igt_output_get_plane(data->output, IGT_PLANE_PRIMARY); + data->primary = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY); igt_plane_set_fb(data->primary, NULL); white_h = data->mode->hdisplay; @@ -439,16 +433,16 @@ static void setup_test_plane(data_t *data) data->mod_stride = white_h * 4; switch (data->test_plane) { - case SPRITE: - data->sprite = igt_output_get_plane(data->output, - IGT_PLANE_2); + case DRM_PLANE_TYPE_OVERLAY: + data->sprite = igt_output_get_plane_type(data->output, + DRM_PLANE_TYPE_OVERLAY); igt_plane_set_fb(data->sprite, NULL); /* To make it different for human eyes let's make * sprite visible in only one quarter of the primary */ white_h = white_h/2; white_v = white_v/2; - case PRIMARY: + case DRM_PLANE_TYPE_PRIMARY: igt_create_color_fb(data->drm_fd, white_h, white_v, DRM_FORMAT_XRGB8888, @@ -456,9 +450,9 @@ static void setup_test_plane(data_t *data) 1.0, 1.0, 1.0, &data->fb_white); break; - case CURSOR: - data->cursor = igt_output_get_plane(data->output, - IGT_PLANE_CURSOR); + case DRM_PLANE_TYPE_CURSOR: + data->cursor = igt_output_get_plane_type(data->output, + DRM_PLANE_TYPE_CURSOR); igt_plane_set_fb(data->cursor, NULL); create_cursor_fb(data); igt_plane_set_position(data->cursor, 0, 0); @@ -535,7 +529,7 @@ int main(int argc, char *argv[]) for (op = PAGE_FLIP; op <= RENDER; op++) { igt_subtest_f("primary_%s", op_str(op)) { - data.test_plane = PRIMARY; + data.test_plane = DRM_PLANE_TYPE_PRIMARY; data.op = op; setup_test_plane(&data); igt_assert(wait_psr_entry(&data)); @@ -546,7 +540,7 @@ int main(int argc, char *argv[]) for (op = MMAP_GTT; op <= PLANE_ONOFF; op++) { igt_subtest_f("sprite_%s", op_str(op)) { - data.test_plane = SPRITE; + data.test_plane = DRM_PLANE_TYPE_OVERLAY; data.op = op; setup_test_plane(&data); igt_assert(wait_psr_entry(&data)); @@ -557,7 +551,7 @@ int main(int argc, char *argv[]) for (op = MMAP_GTT; op <= PLANE_ONOFF; op++) { igt_subtest_f("cursor_%s", op_str(op)) { - data.test_plane = CURSOR; + data.test_plane = DRM_PLANE_TYPE_CURSOR; data.op = op; setup_test_plane(&data); igt_assert(wait_psr_entry(&data)); @@ -567,7 +561,7 @@ int main(int argc, char *argv[]) } igt_subtest_f("dpms_off_psr_active") { - data.test_plane = PRIMARY; + data.test_plane = DRM_PLANE_TYPE_PRIMARY; data.op = RENDER; setup_test_plane(&data); igt_assert(wait_psr_entry(&data)); @@ -579,7 +573,7 @@ int main(int argc, char *argv[]) } igt_subtest_f("dpms_off_psr_exit") { - data.test_plane = SPRITE; + data.test_plane = DRM_PLANE_TYPE_OVERLAY; data.op = PLANE_ONOFF; setup_test_plane(&data); @@ -591,7 +585,7 @@ int main(int argc, char *argv[]) } igt_subtest_f("suspend_psr_active") { - data.test_plane = PRIMARY; + data.test_plane = DRM_PLANE_TYPE_PRIMARY; data.op = PAGE_FLIP; setup_test_plane(&data); igt_assert(wait_psr_entry(&data)); @@ -604,7 +598,7 @@ int main(int argc, char *argv[]) } igt_subtest_f("suspend_psr_exit") { - data.test_plane = CURSOR; + data.test_plane = DRM_PLANE_TYPE_CURSOR; data.op = PLANE_ONOFF; setup_test_plane(&data);