From patchwork Mon Feb 12 13:13:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 199776 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp2425378dyd; Mon, 12 Feb 2024 05:27:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IGe1YARZPENYHa2WbIKmd6RhQ2fW623JTNi/dn5UkIexW7fzSvt80RE9V9Int/KGpa3qIRL X-Received: by 2002:a05:6870:200c:b0:219:3dae:4605 with SMTP id o12-20020a056870200c00b002193dae4605mr6909081oab.32.1707744440474; Mon, 12 Feb 2024 05:27:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707744440; cv=pass; d=google.com; s=arc-20160816; b=TsuYrqaWRhu/WKMa+G5Spcj1SX04wJZfijz5k73QZ0onKnjOKNAHTILgkKVkTUs4w9 xsLoLIvxhx+eSKftDv1bFbtgSL5dco+mymsvsh4JX9qMpbnolouE6NuqOonpCtDKzssl 2pFCuv9khSfnOGccCrdeQd8KcZnNHPDT091bTwT5GzxxYTuI2IGYzIZZyFgy9uzXugK9 LEdMqY2xWiJRY4eau8Fk7SxKkKPD8xoDqQeU4R4SC1O7pduBfba+S6JmhTYT6u7A7fFR 9T0enMSf9Y+nBfU5fnGKjbPc1QwoFAeNSbv6JBs7I8MhbKfgZyNVSrsoDFyStGSUFlmQ zekg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=gaT0aM4/uPSvpfapRGJ+DSSoLq0IKLkNQZbKiiX+lJY=; fh=U4BpmdP+l7YKiro+b4hWfkZoi/MKZNQTaBB1euq6ScY=; b=qCQYGk79wRCMjTiMsU5NZbZy5XnBul8bC4dbsiqd7RMwn2H18LXg26M1bfJ6p3Y1iC B7eNP2ZA8y/pQod3aqw/gNZL7tG8A26DwHf/aTZZ4iD/dzscqbD43Dpcw7ZyFwJn/4Zq bpabG8Gu1noIGDujG1MJ7hxnj/3EJtibPUBGkoZ8YWO5V9J9AxwuKj9qt53VCBlRL472 pgFVykQjIQSOhLNChXwMcK9+5hPHBJ7GmZIAwHblB/zHeN1p2n8DZ/s8z6f1J5c1YPaR 5cO3TdvumqVsHeTy2doTlZ0WDXXzVDOGXjjkQR0OwIOgcAjVpf9amdY7ns0l49DmGIQw phvw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CF+tMWnE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-61655-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61655-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCVdLoeTCn+3PoNzsnHx4NhHEunMlWo78J+DFWCBBoYr6MIlgnjZop/Zucc3TtYVPdxGen3FbHlhkymnzsOhUjU7I1ao8w== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v4-20020a05622a188400b0042c59340e59si381479qtc.598.2024.02.12.05.27.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 05:27:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61655-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CF+tMWnE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-61655-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61655-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4227B1C20C97 for ; Mon, 12 Feb 2024 13:27:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AD2F2524AA; Mon, 12 Feb 2024 13:14:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CF+tMWnE" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2DB051C43; Mon, 12 Feb 2024 13:14:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707743694; cv=none; b=nakUWu0z7b59uxz8HwW6aEI2QMOmEvTd1+uYEx9ivwI/pUje5xiEABgRhVFmfC12yTNtGo2InBCfdqYuL5PTddB7Ag2j0GFzQt5/WDxcKHXCX86dO1S4TKh9XxWqk9XLXHNA96PB1vuWWDF4Skm2a6zEoDo5gcDo1EDUZoCGMrQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707743694; c=relaxed/simple; bh=9I0REbcpKSt1MVBIkF5lrOnJOl7fX+Traw8aZNWXX1Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=M3vLxTlBDncC6QJaCXxd3MWNat2OEOdKW8gWqCllAj9qyPVY/9tvmPpQOYC1XNxWBdz/LG0Sj9WjN+efTFT4sGemqTIYIpZNrSUh+K2wq5KhwHgUsN2MRBl6/t4kNslC2btBonATMwAQs2ixZTt9wrTWbi8SFQAeMXagKuam4D8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CF+tMWnE; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DAE6C43399; Mon, 12 Feb 2024 13:14:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707743694; bh=9I0REbcpKSt1MVBIkF5lrOnJOl7fX+Traw8aZNWXX1Y=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=CF+tMWnEsHyAg1Jd1/77+v4kTOpFkQj+1p8X/b2Ni0TCg7bGlMtiDNQvJ/yw//UJI 8za4jfG4dWuO1GwfwsXvK73pC43gBQu1nOS6yvOJRNHH7BF1TmXHGUrLgflmO7Sv0u 9qRfh7z2ASctZLz3dXldHW/MLNXrkv78oTNvvcEBAks3IciAWAQYJDbxfZp7S+0q0O cxWMwwSRmFgGpHayOIWY6x1H77/j0TAR8IHNlRG400rQkdrqPGwC99PlKVCrBUfadb n5ICKvyOdIx++xYUSU8paNth4faiiSE5TQ9rceFz5STpgu3mv2NUQxdxkZ15i1C4w5 x/S+Gh+YhVdCQ== From: Maxime Ripard Date: Mon, 12 Feb 2024 14:13:13 +0100 Subject: [PATCH v6 30/36] drm/vc4: tests: Convert to plane creation helper Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240212-kms-hdmi-connector-state-v6-30-f4bcdc979e6f@kernel.org> References: <20240212-kms-hdmi-connector-state-v6-0-f4bcdc979e6f@kernel.org> In-Reply-To: <20240212-kms-hdmi-connector-state-v6-0-f4bcdc979e6f@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Emma Anholt , Jonathan Corbet , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: Hans Verkuil , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-sunxi@lists.linux.dev, Maxime Ripard X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2025; i=mripard@kernel.org; h=from:subject:message-id; bh=9I0REbcpKSt1MVBIkF5lrOnJOl7fX+Traw8aZNWXX1Y=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDKmnJAuvREvsUY9ojPzovJHzkWT07O7tlpqJ/5KrVgQ0K G28d1ako5SFQYyLQVZMkSVG2HxJ3KlZrzvZ+ObBzGFlAhnCwMUpABOZ+JGR4SUL45T0TsY9+8TK ElXbBdIrmyfIu7UlGitd9uLz+pEXwciwx0hnX79esb5BUsfc/5p9dhUGAucnctgGVNRnCCU0yzM CAA== X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790699834290958077 X-GMAIL-MSGID: 1790699834290958077 Now that we have a plane create helper for kunit mocked drivers, let's convert to it in vc4. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/tests/vc4_mock_plane.c | 34 +++++++----------------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/vc4/tests/vc4_mock_plane.c b/drivers/gpu/drm/vc4/tests/vc4_mock_plane.c index 973f5f929097..14357db82238 100644 --- a/drivers/gpu/drm/vc4/tests/vc4_mock_plane.c +++ b/drivers/gpu/drm/vc4/tests/vc4_mock_plane.c @@ -1,43 +1,25 @@ // SPDX-License-Identifier: GPL-2.0 -#include -#include -#include +#include #include #include #include "vc4_mock.h" -static const struct drm_plane_helper_funcs vc4_dummy_plane_helper_funcs = { -}; - -static const struct drm_plane_funcs vc4_dummy_plane_funcs = { - .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, - .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, - .reset = drm_atomic_helper_plane_reset, -}; - -static const uint32_t vc4_dummy_plane_formats[] = { - DRM_FORMAT_XRGB8888, -}; - struct drm_plane *vc4_dummy_plane(struct kunit *test, struct drm_device *drm, enum drm_plane_type type) { struct drm_plane *plane; - plane = __drmm_universal_plane_alloc(drm, sizeof(struct drm_plane), 0, - 0, - &vc4_dummy_plane_funcs, - vc4_dummy_plane_formats, - ARRAY_SIZE(vc4_dummy_plane_formats), - NULL, - DRM_PLANE_TYPE_PRIMARY, - NULL); + KUNIT_ASSERT_EQ(test, type, DRM_PLANE_TYPE_PRIMARY); + + plane = drm_kunit_helper_create_primary_plane(test, drm, + NULL, + NULL, + NULL, 0, + NULL); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, plane); - drm_plane_helper_add(plane, &vc4_dummy_plane_helper_funcs); - return plane; }