From patchwork Mon Aug 21 13:51:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alper Nebi Yasak X-Patchwork-Id: 1823650 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=i+1wSJUC; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RTv7B5SVxz1yYZ for ; Mon, 21 Aug 2023 23:52:38 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2380887084; Mon, 21 Aug 2023 15:51:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="i+1wSJUC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2081087081; Mon, 21 Aug 2023 15:51:43 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 45F8E8707A for ; Mon, 21 Aug 2023 15:51:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=alpernebiyasak@gmail.com Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-3fee600dce6so18065515e9.1 for ; Mon, 21 Aug 2023 06:51:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692625900; x=1693230700; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=du9K8HAMfjDBv9t9zq9p8Zs+vCZHJ6g2zmB7iSzSF7o=; b=i+1wSJUCYpv3D2Y4WhFT+a+eXACMjCfu9K5FQkWQdC2smyIukzPLOT9TKll1BIlZ+S 0BSrF+Vp8/DGT40HSh+wXWV4jYRbGaai6uC9HETzas7pJ6Qhy+ffz2UKdEYLi1VLHsaq X75Z5dWmXphu9f83rAKezE9CYHm+PJtfCCmN6nzYmKby9xzdvEmPjC4JmCjqvh+sqORE Bzxq55zbOUyTxIzqT01tuFNOw/v8W0H5dQ6fFOCzvxrMmYV1xWY68YL/0QqfqG2DG5q1 XPDS0Sgg6L+yzBD2e/I0iNDZaFfXRDq4jvWBkELBWMrWm1880C9/qHFlPwFRRUlHYf+M 4DSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692625900; x=1693230700; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=du9K8HAMfjDBv9t9zq9p8Zs+vCZHJ6g2zmB7iSzSF7o=; b=ejVU1hfEMyFZ7BfMSqaYec4EUOoA0M467Rm/YLD9WqMi6MKcePqHndqYIVtBdIb8pl jE/EUHhBvvRp1Bn9zpDfUbCUk27iKZaqWwqAa4ZLknDsCStzGovzG2+wKem8yoP2H1jp e5tUVYZa2/MESz/zDnwWZV528p3+eHhCUUWBwTCt3plzb+SWqR1j0T40nBrUB+tDj1b0 VYDTZvDCxDhQRGlLmMYX8QtWf/waAzPl5ePXvPhus06aR5+7O2V28M8yF2xRcceFSIQR 4T2k/MBwCdM1+mpz6TnKB+zjN6Kj0TmPzEo9o6Pcc/lXWY0kRniuHFu0fzE84gOcGlOi Xfyw== X-Gm-Message-State: AOJu0YxMuk5t4Hh2FasrdRfRr0tLxX8vAgGS5cfNm5tZpbvKz9V6ip/a g8C3FsqqNAKybynks3ECaaBXn+kLAr4= X-Google-Smtp-Source: AGHT+IE0aHC9IeAZ9om6v+CX5lhGhaikzyvs7K+JjasiPPxFotFPaEOG+0SHfy/L4wW7iRlvWFh0mw== X-Received: by 2002:a5d:568f:0:b0:317:e5ec:8767 with SMTP id f15-20020a5d568f000000b00317e5ec8767mr4615501wrv.21.1692625899711; Mon, 21 Aug 2023 06:51:39 -0700 (PDT) Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Aug 2023 06:51:39 -0700 (PDT) From: Alper Nebi Yasak To: u-boot@lists.denx.de Cc: Kever Yang , Jagan Teki , Andre Przywara , Svyatoslav Ryhel , Alexander Graf , Philipp Tomsich , Andrew Davis , Da Xue , Heinrich Schuchardt , Patrice Chotard , Patrick Delaunay , Derald Woods , Anatolij Gustschin , uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , Matthias Brugger , u-boot-amlogic@groups.io, Ilias Apalodimas , Neil Armstrong , Alper Nebi Yasak Subject: [PATCH v5 07/13] video: test: Test video damage tracking via vidconsole Date: Mon, 21 Aug 2023 16:51:04 +0300 Message-Id: <20230821135111.3558478-8-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> References: <20230821135111.3558478-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean With VIDEO_DAMAGE, the video uclass tracks updated regions of the frame buffer in order to avoid unnecessary work during a video sync. Enable the config in sandbox and add a test for it, by printing strings at a few locations and checking the tracked region. Signed-off-by: Alper Nebi Yasak Reviewed-by: Simon Glass --- This is hard to test because most things issue video syncs that process and reset the damaged region. Changes in v5: - Add patch "video: test: Test video damage tracking via vidconsole" configs/sandbox_defconfig | 1 + test/dm/video.c | 56 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index 259f31f26cee..51b820f13121 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -307,6 +307,7 @@ CONFIG_USB_ETH_CDC=y CONFIG_VIDEO=y CONFIG_VIDEO_FONT_SUN12X22=y CONFIG_VIDEO_COPY=y +CONFIG_VIDEO_DAMAGE=y CONFIG_CONSOLE_ROTATION=y CONFIG_CONSOLE_TRUETYPE=y CONFIG_CONSOLE_TRUETYPE_CANTORAONE=y diff --git a/test/dm/video.c b/test/dm/video.c index e4bd27a6b76f..8c7d9800a42e 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -711,3 +711,59 @@ static int dm_test_video_copy(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_video_copy, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); + +/* Test video damage tracking */ +static int dm_test_video_damage(struct unit_test_state *uts) +{ + struct sandbox_sdl_plat *plat; + struct udevice *dev, *con; + struct video_priv *priv; + const char *test_string_1 = "Criticism may not be agreeable, "; + const char *test_string_2 = "but it is necessary."; + const char *test_string_3 = "It fulfils the same function as pain in the human body."; + + if (!IS_ENABLED(CONFIG_VIDEO_DAMAGE)) + return -EAGAIN; + + ut_assertok(uclass_find_device(UCLASS_VIDEO, 0, &dev)); + ut_assert(!device_active(dev)); + plat = dev_get_plat(dev); + plat->font_size = 32; + + ut_assertok(video_get_nologo(uts, &dev)); + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + priv = dev_get_uclass_priv(dev); + + vidconsole_position_cursor(con, 14, 10); + vidconsole_put_string(con, test_string_2); + ut_asserteq(449, priv->damage.xstart); + ut_asserteq(325, priv->damage.ystart); + ut_asserteq(661, priv->damage.xend); + ut_asserteq(350, priv->damage.yend); + + vidconsole_position_cursor(con, 7, 5); + vidconsole_put_string(con, test_string_1); + ut_asserteq(225, priv->damage.xstart); + ut_asserteq(164, priv->damage.ystart); + ut_asserteq(661, priv->damage.xend); + ut_asserteq(350, priv->damage.yend); + + vidconsole_position_cursor(con, 21, 15); + vidconsole_put_string(con, test_string_3); + ut_asserteq(225, priv->damage.xstart); + ut_asserteq(164, priv->damage.ystart); + ut_asserteq(1280, priv->damage.xend); + ut_asserteq(510, priv->damage.yend); + + video_sync(dev, false); + ut_asserteq(priv->xsize, priv->damage.xstart); + ut_asserteq(priv->ysize, priv->damage.ystart); + ut_asserteq(0, priv->damage.xend); + ut_asserteq(0, priv->damage.yend); + + ut_asserteq(7339, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; +} +DM_TEST(dm_test_video_damage, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);