From patchwork Tue Aug 8 16:16:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Stone X-Patchwork-Id: 9888721 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 5EE8C603F9 for ; Tue, 8 Aug 2017 16:17:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 50EFB28935 for ; Tue, 8 Aug 2017 16:17:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4FE6C2895D; Tue, 8 Aug 2017 16:17:15 +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 ADD0D289BF for ; Tue, 8 Aug 2017 16:17:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 19BE76E1C7; Tue, 8 Aug 2017 16:16:54 +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 CD2D36E19A for ; Tue, 8 Aug 2017 16:16:52 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: daniels) with ESMTPSA id 2BB3326C777 From: Daniel Stone To: intel-gfx@lists.freedesktop.org Date: Tue, 8 Aug 2017 17:16:45 +0100 Message-Id: <20170808161645.25329-8-daniels@collabora.com> X-Mailer: git-send-email 2.13.4 In-Reply-To: <20170808161645.25329-1-daniels@collabora.com> References: <20170808161645.25329-1-daniels@collabora.com> Cc: daniel.vetter@ffwll.ch Subject: [Intel-gfx] [PATCH i-g-t 8/8] tests/kms_ccs: Test CCS on sprite 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 Also try to test CCS on available non-primary planes. However, as there is not enough bandwidth to scan out both the primary and sprite planes when using CCS (or even Y-tiled), fall back to linear for the primary plane when using CCS for a sprite/cursor plane. Signed-off-by: Daniel Stone Reviewed-by: Jason Ekstrand Acked-by: Jason Ekstrand --- tests/kms_ccs.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 67 insertions(+), 7 deletions(-) diff --git a/tests/kms_ccs.c b/tests/kms_ccs.c index 79856f97..c544b36f 100644 --- a/tests/kms_ccs.c +++ b/tests/kms_ccs.c @@ -37,19 +37,24 @@ enum test_flags { enum test_fb_flags { FB_COMPRESSED = 1 << 0, + FB_HAS_PLANE = 1 << 1, }; typedef struct { int drm_fd; igt_display_t display; struct igt_fb fb; + struct igt_fb fb_sprite; igt_output_t *output; enum pipe pipe; enum test_flags flags; + igt_plane_t *plane; } data_t; #define RED 0x00ff0000 #define COMPRESSED_RED 0x0ff0000f +#define GREEN 0x0000ff00 +#define COMPRESSED_GREEN 0x000ff00f #define CCS_UNCOMPRESSED 0x0 #define CCS_COMPRESSED 0x55 @@ -173,8 +178,10 @@ static void render_fb(data_t *data, uint32_t gem_handle, unsigned int size, { uint32_t *ptr; unsigned int half_height, half_size; - uint32_t uncompressed_color = RED; - uint32_t compressed_color = COMPRESSED_RED; + uint32_t uncompressed_color = data->plane ? GREEN : RED; + uint32_t compressed_color = + data->plane ? COMPRESSED_GREEN : COMPRESSED_RED; + uint32_t bad_color = RED; int i; ptr = gem_mmap__cpu(data->drm_fd, gem_handle, 0, size, @@ -200,8 +207,19 @@ static void render_fb(data_t *data, uint32_t gem_handle, unsigned int size, ptr[i] = compressed_color; } } else { - for (i = 0; i < size / 4; i++) - ptr[i] = uncompressed_color; + /* When we're displaying the primary plane underneath a + * sprite plane, cut out a 128 x 128 area (less than the sprite) + * plane size which we paint red, so we know easily if it's + * bad. + */ + for (i = 0; i < size / 4; i++) { + if ((fb_flags & FB_HAS_PLANE) && + i < (stride * 128) && (i % (stride / 4)) < 1) { + ptr[i] = bad_color; + } else { + ptr[i] = uncompressed_color; + } + } } munmap(ptr, size); @@ -249,10 +267,17 @@ static void generate_fb(data_t *data, struct igt_fb *fb, uint64_t modifier; int ret; + /* Use either compressed or Y-tiled to test. However, given the lack of + * available bandwidth, we use linear for the primary plane when + * testing sprites, since we cannot fit two CCS planes into the + * available FIFO configurations. + */ if (fb_flags & FB_COMPRESSED) modifier = LOCAL_I915_FORMAT_MOD_Y_TILED_CCS; - else + else if (!(fb_flags & FB_HAS_PLANE)) modifier = LOCAL_I915_FORMAT_MOD_Y_TILED; + else + modifier = 0; f.flags = LOCAL_DRM_MODE_FB_MODIFIERS; f.width = width; @@ -338,8 +363,17 @@ static void try_config(data_t *data, enum test_fb_flags fb_flags) DRM_PLANE_TYPE_PRIMARY); plane_require_ccs(data, primary, DRM_FORMAT_XRGB8888); - generate_fb(data, &data->fb, drm_mode->hdisplay, drm_mode->vdisplay, - fb_flags); + if (data->plane && fb_flags & FB_COMPRESSED) { + plane_require_ccs(data, data->plane, DRM_FORMAT_XRGB8888); + generate_fb(data, &data->fb, drm_mode->hdisplay, + drm_mode->vdisplay, + (fb_flags & ~FB_COMPRESSED) | FB_HAS_PLANE); + generate_fb(data, &data->fb_sprite, 256, 256, fb_flags); + } else { + generate_fb(data, &data->fb, drm_mode->hdisplay, + drm_mode->vdisplay, fb_flags); + } + if (data->flags & TEST_BAD_PIXEL_FORMAT) return; @@ -347,6 +381,12 @@ static void try_config(data_t *data, enum test_fb_flags fb_flags) igt_plane_set_size(primary, drm_mode->hdisplay, drm_mode->vdisplay); igt_plane_set_fb(primary, &data->fb); + if (data->plane && fb_flags & FB_COMPRESSED) { + igt_plane_set_position(data->plane, 0, 0); + igt_plane_set_size(data->plane, 256, 256); + igt_plane_set_fb(data->plane, &data->fb_sprite); + } + if (data->flags & TEST_ROTATE_180) igt_plane_set_rotation(primary, IGT_ROTATION_180); if (data->flags & TEST_BAD_ROTATION_90) @@ -359,6 +399,13 @@ static void try_config(data_t *data, enum test_fb_flags fb_flags) igt_assert_eq(ret, 0); igt_debug_wait_for_keypress("ccs"); + + if (data->plane && fb_flags & FB_COMPRESSED) { + igt_plane_set_position(data->plane, 0, 0); + igt_plane_set_size(data->plane, 0, 0); + igt_plane_set_fb(data->plane, NULL); + igt_remove_fb(display->drm_fd, &data->fb_sprite); + } } static void test_output(data_t *data) @@ -427,6 +474,7 @@ igt_main for_each_pipe(&data.display, data.pipe) { const char *pipe_name = kmstest_pipe_name(data.pipe); + int sprite_idx = 0; data.flags = TEST_BAD_PIXEL_FORMAT; igt_subtest_f("pipe-%s-bad-pixel-format", pipe_name) @@ -443,6 +491,18 @@ igt_main data.flags = TEST_CRC | TEST_ROTATE_180; igt_subtest_f("pipe-%s-crc-primary-rotation-180", pipe_name) test_output(&data); + + data.flags = TEST_CRC; + for_each_plane_on_pipe(&data.display, data.pipe, data.plane) { + if (data.plane->type == DRM_PLANE_TYPE_PRIMARY) + continue; + sprite_idx++; + igt_subtest_f("pipe-%s-crc-sprite-%d-basic", pipe_name, + sprite_idx) + test_output(&data); + } + + data.plane = NULL; } igt_fixture