From patchwork Fri Jan 30 03:58:26 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1777 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org Authentication-Results: mail.u-boot.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=k1/LXDmP; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BE657697CB for ; Thu, 29 Jan 2026 20:59:15 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id ut5RtjAEC2zi for ; Thu, 29 Jan 2026 20:59:15 -0700 (MST) Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id AC02A697C8 for ; Thu, 29 Jan 2026 20:59:15 -0700 (MST) Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E12BE697DD for ; Thu, 29 Jan 2026 20:59:12 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id G3gXZUhnRwrX for ; Thu, 29 Jan 2026 20:59:12 -0700 (MST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.161.50; helo=mail-oo1-f50.google.com; envelope-from=sjg@chromium.org; receiver=u-boot.org Received: from mail-oo1-f50.google.com (mail-oo1-f50.google.com [209.85.161.50]) by mail.u-boot.org (Postfix) with ESMTPS id 73E45697CB for ; Thu, 29 Jan 2026 20:59:08 -0700 (MST) Received: by mail-oo1-f50.google.com with SMTP id 006d021491bc7-662feac825eso847707eaf.3 for ; Thu, 29 Jan 2026 19:59:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1769745547; x=1770350347; darn=u-boot.org; 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=wFTwxUxc0oFAqcVp00llX3LaAY8XsK4pAa8zl+Q5Nmg=; b=k1/LXDmP3EyEDzWBIHPqnhlzMGV8q+8la+NS87LtQItLQkAT83l57qH06vsoyaLeYM E9CBwHsEMKPQ1uCMMXn+IdTR81Y2kvbKWsRRkNL9T6PFmE0pBVoQ1/gbrx4+ngOnEXR0 cbfNPhnGIWlJEIgnkRzjG6GL87QHcqS450SPk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769745547; x=1770350347; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=wFTwxUxc0oFAqcVp00llX3LaAY8XsK4pAa8zl+Q5Nmg=; b=PtgxblGRYX/976LM4vKLNmiIIuOILmsHRgAPLmkgnqP6bNG7XtfLmV4B0oGlD6hLFE 1Z9hmRj26wln/KBQ6cNFluwTEZgXxQZXK8QfROBaXXkiZMLzpUCNVpFgyi34iDbik1j/ 2VTpOedX1F4EIVViGGDfivTuysROoyhYl97pHffoyDknSQPQEej93KPA6nOzntNU+VRf s7G8nHEqUk3mw1dnifBMI9amIm78fpyiYos0pbfOPNDQtPd83z8zVVba78gNYXq+0j0X qq4OVkHvsHeJzlcM9h8E+J4iHc6Jen4iLJbt7aQw/mk/AjsfmOE2LBh4E4/ydsuw0RVq 18dQ== X-Gm-Message-State: AOJu0Yz2xcc2v1DKskhq5oMTuxnMvOQTzxPZBhZPDdoIFpCvtkMPSyMa /Gf0x+au6R6rPv70+S65R0EyPIIeQ6PJrzv011mClJbFjPN8cFEmooMlRKcxkNhrMihtcAMasSk EO5gFdA== X-Gm-Gg: AZuq6aKym1olCyqf643YyWDfHWMgHRAs8NjRmbuM9782Sp2mrjZMyBXb4+hgHFED/uV umiTNi0UMi3Rcftss/9iXQMypVTkcwPfqCVtw+sd+XE/br2V6dhw5y1r795mRRHudzeI2MrQHL/ ZqZx9k0cf84xzEhunHC0Y7VnIkrOt1Pke4nj3XtE57sHGOoM7oGp6MXi2jqoVDAvjHJ6pKAp4dL /P7Lu5w7/cOVww9o1nGIEZbC4gElME2GWLoA5DRKg7b9Qh8YcYt8o30c0zSJmLp2td84gNesQGW mKI3l4UnEVWpYztTtd3CBsVu0z2hnBKtr73ac7lu3Yq54RvYQHrYu9AIwAWi2aejew2map6yIku hI3NbQbJAHNBsMJgOOCRkcos0lEau8kUdX7IUizeZ3V0JXFEtThXUGtzyrQXD+6F4sF/VtjbnDF Wb5sxsAv+aFpHYL1zky+j8W2FDOLM= X-Received: by 2002:a05:6820:229d:b0:662:fd74:61d0 with SMTP id 006d021491bc7-6630f004344mr964310eaf.7.1769745547177; Thu, 29 Jan 2026 19:59:07 -0800 (PST) Received: from chromium.org ([73.34.74.121]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-662f9a4e491sm4128687eaf.16.2026.01.29.19.59.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jan 2026 19:59:06 -0800 (PST) From: Simon Glass X-Google-Original-From: Simon Glass To: U-Boot Concept Date: Thu, 29 Jan 2026 20:58:26 -0700 Message-ID: <20260130035849.3580212-4-simon.glass@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260130035849.3580212-1-simon.glass@canonical.com> References: <20260130035849.3580212-1-simon.glass@canonical.com> MIME-Version: 1.0 Message-ID-Hash: OCDHQY3X5REO7ZC543R3X7ZIXJAMOVJ7 X-Message-ID-Hash: OCDHQY3X5REO7ZC543R3X7ZIXJAMOVJ7 X-MailFrom: sjg@chromium.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 03/19] test: Add ut_check_video() helper function List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Many video tests need to get the first video device and then call video_compress_fb() on it. Add a convenience function that combines these two operations to reduce duplication. The msg parameter allows tests to describe which frame is being checked, which helps with debugging when a check fails. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- include/test/video.h | 12 ++++++++++++ test/dm/video.c | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/include/test/video.h b/include/test/video.h index 000fd708c86..8676613e6a4 100644 --- a/include/test/video.h +++ b/include/test/video.h @@ -42,4 +42,16 @@ int video_compress_fb(struct unit_test_state *uts, struct udevice *dev, */ int video_check_copy_fb(struct unit_test_state *uts, struct udevice *dev); +/** + * ut_check_video() - Compress the frame buffer and return its size + * + * This is a convenience function that gets the first video device and calls + * video_compress_fb() on it. + * + * @uts: Test state + * @msg: Message describing the frame being checked (or NULL) + * Return: compressed size of the frame buffer, or -ve on error + */ +int ut_check_video(struct unit_test_state *uts, const char *msg); + #endif diff --git a/test/dm/video.c b/test/dm/video.c index 92b2ee9a6e3..b7aa835c86a 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -198,6 +198,18 @@ int video_check_copy_fb(struct unit_test_state *uts, struct udevice *dev) return 0; } +int ut_check_video(struct unit_test_state *uts, const char *msg) +{ + struct udevice *dev; + int ret; + + ret = uclass_first_device_err(UCLASS_VIDEO, &dev); + if (ret) + return ret; + + return video_compress_fb(uts, dev, false); +} + /* * Call this function at any point to halt and show the current display. Be * sure to run the test with the -l flag.