From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8EB8610E65A for ; Fri, 2 Jun 2023 10:50:13 +0000 (UTC) Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-4f4b0a0b557so2513969e87.1 for ; Fri, 02 Jun 2023 03:50:13 -0700 (PDT) From: Juha-Pekka Heikkila To: igt-dev@lists.freedesktop.org Date: Fri, 2 Jun 2023 13:50:01 +0300 Message-Id: <20230602105001.7610-1-juhapekka.heikkila@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [igt-dev] [PATCH i-g-t] tests/kms_plane: Add debug prints for pixel format tests if couldn't use custom plane size List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: Moved check for setting 64x64 plane size for pixel format tests into its own function and added debug prints if couldn't use smaller than full mode size plane for testing. Signed-off-by: Juha-Pekka Heikkila --- tests/kms_plane.c | 57 +++++++++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/tests/kms_plane.c b/tests/kms_plane.c index 90b68a47..dfc6a8c5 100644 --- a/tests/kms_plane.c +++ b/tests/kms_plane.c @@ -896,6 +896,40 @@ struct format_mod { uint32_t format; }; +/* + * See if test can go use 64x64 plane size for testing. If driver is not + * reporting to be atomic, will not try to use 64x64 plane size. +*/ +static void check_allowed_plane_size_64x64(data_t *data, igt_plane_t *plane, + uint64_t *width, uint64_t *height, + uint32_t format) +{ + struct igt_fb test_fb; + int ret; + + if (!data->display.is_atomic) { + igt_debug("Not using 64x64 plane size on non-atomic platform\n"); + return; + } + + igt_create_fb(data->drm_fd, 64, 64, format, DRM_FORMAT_MOD_LINEAR, &test_fb); + igt_plane_set_fb(plane, &test_fb); + + ret = igt_display_try_commit_atomic(&data->display, + DRM_MODE_ATOMIC_TEST_ONLY | + DRM_MODE_ATOMIC_ALLOW_MODESET, + NULL); + if (!ret) { + *width = test_fb.width; + *height = test_fb.height; + } else { + igt_debug("Not using 64x64 plane size, atomic commit did not " + "accept 64x64 plane size\n"); + } + + igt_remove_fb(data->drm_fd, &test_fb); +} + static bool test_format_plane(data_t *data, enum pipe pipe, igt_output_t *output, igt_plane_t *plane, igt_fb_t *primary_fb) { @@ -944,28 +978,7 @@ static bool test_format_plane(data_t *data, enum pipe pipe, IGT_FORMAT_ARGS(ref.format), IGT_MODIFIER_ARGS(ref.modifier), kmstest_pipe_name(pipe), plane->index); - if (data->display.is_atomic) { - struct igt_fb test_fb; - int ret; - - igt_create_fb(data->drm_fd, 64, 64, ref.format, - DRM_FORMAT_MOD_LINEAR, &test_fb); - - igt_plane_set_fb(plane, &test_fb); - - ret = igt_display_try_commit_atomic(&data->display, - DRM_MODE_ATOMIC_TEST_ONLY | - DRM_MODE_ATOMIC_ALLOW_MODESET, - NULL); - if (!ret) { - width = test_fb.width; - height = test_fb.height; - } - - igt_plane_set_fb(plane, clear_fb); - - igt_remove_fb(data->drm_fd, &test_fb); - } + check_allowed_plane_size_64x64(data, plane, &width, &height, ref.format); capture_format_crcs_single(data, pipe, plane, ref.format, ref.modifier, width, height, IGT_COLOR_YCBCR_BT709, -- 2.25.1