Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp33819lqb; Thu, 23 May 2024 10:01:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUz3cwWBVYY/fY5WshKiC2lrNIu+ZrGiO/prm0023tMWkdU7PveSWRj2Th022hse2BhcyJUVOtI/bNn/xjX56Flq3sCrqa1mYS7mgbULQ== X-Google-Smtp-Source: AGHT+IHUs+0eeFi69eP26VrqvMW1imXL3bDJpgrUW4uNard5KYu35Lf/m9oxWU/nSyE8KLzAQXuU X-Received: by 2002:a05:6358:b5c9:b0:186:41ec:cbc3 with SMTP id e5c5f4694b2df-197e5100245mr2516955d.8.1716483673234; Thu, 23 May 2024 10:01:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716483673; cv=pass; d=google.com; s=arc-20160816; b=hSq+u+Qo10rzLRqQ4IF8JzjfHi3BxIHVHdGj6jyqRXAkx6gPEjGIiAcXaDtqOVixVI meQ0tUvgqfwUw7zlYJr6ClWJ8MGCn+lbyN+/1PBbkqYQTJ2T3eGiVyPNZp6mwxg4dBvw 4sC9hcLYWUBg6/Z+gYl/Bh8SGmglVf8Oxf45Vt7SYqelpme80/aUT/yHkWKleap9bN71 Ipjo8R6dlsXyjRYmJtLHCKKqA42vDtDiCPKPAXcfYeZX5suItNOviEzKKzTdEruy7mUk ib3i8BYezU3v0d5mN6jVuCuM/9yO0BYPwTrk9d/zgbLcJcAG3Xmym9aZpxISfyBqIW2q U4Ng== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=Ykz7CSuGmpReMbjY7aKYP//JpEBEa/0nSh28NBFDVBU=; fh=ngJ9BaS5uMFN1ghq18wimXcu/c0GsmyeTtvjgkmwFSE=; b=gqLu5zuLm4ips2LX1qOqBsWTSxfFTUXV+jMKNp1JajXQ0DBwzyLK2z1MRPzUf0C+si ON4/pwXyh6TUEGVQtwYjr4pLqcjRw+UOirMQYc8L4RTnkcagRIYl9Qnp1bUjwfDAeu8x xhvSAu6JEZGHc3coMij9TFd0AHdNPXIyO/PUIimIYo+o5nOexXy+kUVfSLm4lOdstrWM NWQ2/SA+9172nXaKqFh23Nwisfyf7jgaxFub2nNhMJ8gREiYEXHRZcu56lABnhJb8N1H dQ4Pe1ASuDkJdjwXL5+Da74rmYUe2cKFIgzdJQIHU6hlDxW9mrIb+7WnzEB2PpIRswz/ 5XQw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=TIapE6M4; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-187806-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187806-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43df56f8f7bsi131352461cf.801.2024.05.23.10.01.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 10:01:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187806-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=TIapE6M4; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-187806-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187806-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 9E5C61C216B6 for ; Thu, 23 May 2024 17:01:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3A6D376034; Thu, 23 May 2024 17:01:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="TIapE6M4" Received: from out-173.mta0.migadu.com (out-173.mta0.migadu.com [91.218.175.173]) (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 04F842C6BD; Thu, 23 May 2024 17:00:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716483662; cv=none; b=gejqI+rBpLAz5Hzua8/8QV3or7vKdfYecSOxxROprfI+Of7YehEU8W0DuExJfKzSlH29QQ3STzLylTr9RBnM0MS2HMozTq/aVQyTd9S/l8RmdCjc3a/gzcyjNS1Htsz1EIi8IuguVwaKZHMgMcZMyfKKeQ+NU8LBQENkdB3bZx0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716483662; c=relaxed/simple; bh=Fq3QsjNx5B621ZaYULO/+HwsocSsy12Sn1t+W1nGbfk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=B4A+OP4LVJNWLKGQSp0B6RuqLuxDxXrtyg4djVxjveBP8N9zIQQ8npUKda5Pvbre5ydsEkAZRd5048M1HR47rUu5NnkspT9YeO17aezG9+EABk+mUmCUAqD/cBp+9Zbm3NlBPqtovKr64aN2i2BsdQmVUNHz78zSb2DIW0sJ8DQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=TIapE6M4; arc=none smtp.client-ip=91.218.175.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: mripard@kernel.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1716483657; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ykz7CSuGmpReMbjY7aKYP//JpEBEa/0nSh28NBFDVBU=; b=TIapE6M4VUR7Mt+IBvSqJF4eYiwgBL6E2freRulFfb573/OkGC3cBsleiVjezpU5O/LrP1 lRF020YJrwQKFpNZM4J2r08fzzaqgUokU/PkR35D1Lbg9EMnRwmevbPlHxGv4TRzSSQohy zFuraMMuvLnJMAiiys++zLk/KyyzzFk= X-Envelope-To: maarten.lankhorst@linux.intel.com X-Envelope-To: tzimmermann@suse.de X-Envelope-To: airlied@gmail.com X-Envelope-To: daniel@ffwll.ch X-Envelope-To: corbet@lwn.net X-Envelope-To: hjc@rock-chips.com X-Envelope-To: heiko@sntech.de X-Envelope-To: wens@csie.org X-Envelope-To: jernej.skrabec@gmail.com X-Envelope-To: samuel@sholland.org X-Envelope-To: andy.yan@rock-chips.com X-Envelope-To: hverkuil@xs4all.nl X-Envelope-To: sebastian.wick@redhat.com X-Envelope-To: ville.syrjala@linux.intel.com X-Envelope-To: dri-devel@lists.freedesktop.org X-Envelope-To: linux-arm-kernel@lists.infradead.org X-Envelope-To: linux-doc@vger.kernel.org X-Envelope-To: linux-kernel@vger.kernel.org X-Envelope-To: linux-media@vger.kernel.org X-Envelope-To: linux-rockchip@lists.infradead.org X-Envelope-To: linux-sunxi@lists.linux.dev X-Envelope-To: dave.stevenson@raspberrypi.com Message-ID: <1e47e26f-948b-43d1-8d9f-a15e06e816f6@linux.dev> Date: Fri, 24 May 2024 01:00:47 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [v14,06/28] drm/tests: Add output bpc tests To: Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Jonathan Corbet , Sandy Huang , =?UTF-8?Q?Heiko_St=C3=BCbner?= , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Andy Yan Cc: Hans Verkuil , Sebastian Wick , =?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= , 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, Dave Stevenson References: <20240521-kms-hdmi-connector-state-v14-6-51950db4fedb@kernel.org> Content-Language: en-US, en-AU X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Sui Jingfeng In-Reply-To: <20240521-kms-hdmi-connector-state-v14-6-51950db4fedb@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT Hi, Maxime I love you patch, yet it generates warnning calltrace. Despite it's just a warning but it can overwhelm when we run kunit tests. Hence, I suggest switch to the drm_atomic_connector_get_property() function. Logs are pasted as below for easier to ready. ------------[ cut here ]------------ WARNING: CPU: 3 PID: 1264 at drivers/gpu/drm/drm_mode_object.c:354 drm_object_property_get_value+0x2c/0x34 Modules linked in: drm_connector_test drm_display_helper drm_kunit_helpers kunit rfkill ip_set nf_tables nfnetlink vfat fat uas usb_storage kvm efi_pstore pstore spi_loongson_pci spi_loongson_core fuse efivarfs [last unloaded: drm_connector_test] CPU: 3 PID: 1264 Comm: kunit_try_catch Tainted: G N 6.9.0+ #443 Hardware name: Loongson Loongson-3A6000-HV-7A2000-XA61200/Loongson-3A6000-HV-7A2000-XA61200, BIOS Loongson-UDK2018-V4.0.05636-stable202311 12/ pc 9000000003469fec ra ffff80000225afdc tp 900000011fc54000 sp 900000011fc57d80 a0 900000010aa84658 a1 9000000104432a00 a2 900000011fc57d98 a3 900000011fc57d98 a4 9000000104432a4c a5 9000000003f14e98 a6 0000000000000008 a7 fffffffffffffffe t0 0000000000000010 t1 900000010aa84000 t2 ffffffffffffffff t3 ffffffffc0c0c0c0 t4 ffffffffc0c0c0c0 t5 0000000000000220 t6 0000000000000001 t7 0000000000107203 t8 0000000000107303 u0 0000000000000008 s9 90000001000ebe60 s0 900000010aa84000 s1 90000001470679c8 s2 9000000104432a00 s3 ffff800002284000 s4 900000010aa84658 s5 900000010aa84618 s6 0000000000001000 s7 0000000000000001 s8 0000000000000000 ra: ffff80000225afdc drm_test_connector_hdmi_init_bpc_8+0xcc/0x2d0 [drm_connector_test] ERA: 9000000003469fec drm_object_property_get_value+0x2c/0x34 CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE) PRMD: 00000004 (PPLV0 +PIE -PWE) EUEN: 00000000 (-FPE -SXE -ASXE -BTE) ECFG: 00071c1c (LIE=2-4,10-12 VS=7) ESTAT: 000c0000 [BRK] (IS= ECode=12 EsubCode=0) PRID: 0014d000 (Loongson-64bit, Loongson-3A6000-HV) CPU: 3 PID: 1264 Comm: kunit_try_catch Tainted: G N 6.9.0+ #443 Hardware name: Loongson Loongson-3A6000-HV-7A2000-XA61200/Loongson-3A6000-HV-7A2000-XA61200, BIOS Loongson-UDK2018-V4.0.05636-stable202311 12/ Stack : 9000000004065000 0000000000000000 9000000002ac339c 900000011fc54000 900000011fc579f0 900000011fc579f8 0000000000000000 900000011fc57b38 900000011fc57b30 900000011fc57b30 900000011fc57940 0000000000000001 0000000000000001 900000011fc579f8 18e7bf3ffb6e59df 9000000100328a00 0000000000000001 0000000000000003 0000000000000434 4c206e6f73676e6f 6f4c203a656d616e 00000000000d0ad3 000000000704c000 90000001000ebe60 0000000000000000 0000000000000000 9000000003ee6ab0 9000000004065000 0000000000000000 900000010aa84618 0000000000001000 0000000000000001 0000000000000000 0000000000000000 9000000002ac33b4 000055557dd80078 00000000000000b0 0000000000000004 0000000000000000 0000000000071c1c ... Call Trace: [<9000000002ac33b4>] show_stack+0x5c/0x180 [<9000000003b1ed2c>] dump_stack_lvl+0x70/0xa0 [<9000000003b01fd8>] __warn+0x84/0xc8 [<9000000003ad282c>] report_bug+0x19c/0x204 [<9000000003b1fe00>] do_bp+0x264/0x2b4 [<0000000000000000>] 0x0 [<9000000003469fec>] drm_object_property_get_value+0x2c/0x34 [] drm_test_connector_hdmi_init_bpc_8+0xcc/0x2d0 [drm_connector_test] [] kunit_try_run_case+0x7c/0x18c [kunit] [] kunit_generic_run_threadfn_adapter+0x1c/0x28 [kunit] [<9000000002b06238>] kthread+0x124/0x130 [<9000000002ac1248>] ret_from_kernel_thread+0xc/0xa4 ---[ end trace 0000000000000000 ]--- ------------[ cut here ]------------ On 5/21/24 18:13, Maxime Ripard wrote: > Now that we're tracking the output bpc count in the connector state, > let's add a few tests to make sure it works as expected. > > Reviewed-by: Dave Stevenson > Signed-off-by: Maxime Ripard > Reviewed-by: Dmitry Baryshkov > --- > drivers/gpu/drm/Kconfig | 1 + > drivers/gpu/drm/tests/Makefile | 1 + > drivers/gpu/drm/tests/drm_connector_test.c | 140 +++++++ > drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 438 +++++++++++++++++++++ > drivers/gpu/drm/tests/drm_kunit_edid.h | 106 +++++ > 5 files changed, 686 insertions(+) > [...] > + > +/* > + * Test that the registration of a connector with a maximum bpc count of > + * 8 succeeds, registers the max bpc property, but doesn't register the > + * HDR output metadata one. > + */ > +static void drm_test_connector_hdmi_init_bpc_8(struct kunit *test) > +{ > + struct drm_connector_init_priv *priv = test->priv; > + struct drm_connector *connector = &priv->connector; > + struct drm_property *prop; > + uint64_t val; > + int ret; > + > + ret = drmm_connector_hdmi_init(&priv->drm, connector, > + &dummy_funcs, > + DRM_MODE_CONNECTOR_HDMIA, > + &priv->ddc, > + 8); > + KUNIT_EXPECT_EQ(test, ret, 0); > + > + prop = connector->max_bpc_property; > + KUNIT_ASSERT_NOT_NULL(test, prop); > + KUNIT_EXPECT_NOT_NULL(test, drm_mode_obj_find_prop_id(&connector->base, prop->base.id)); > + > + ret = drm_object_property_get_value(&connector->base, prop, &val); Maybe we should switch to drm_atomic_connector_get_property() instead, as the comments of the drm_object_property_get_value() told us that atomic drivers should never call this function directly, otherwise it will print warnings and call trace. > + KUNIT_EXPECT_EQ(test, ret, 0); > + KUNIT_EXPECT_EQ(test, val, 8); > + > + prop = priv->drm.mode_config.hdr_output_metadata_property; > + KUNIT_ASSERT_NOT_NULL(test, prop); > + KUNIT_EXPECT_NULL(test, drm_mode_obj_find_prop_id(&connector->base, prop->base.id)); > +} > + > +/* > + * Test that the registration of a connector with a maximum bpc count of > + * 10 succeeds and registers the max bpc and HDR output metadata > + * properties. > + */ > +static void drm_test_connector_hdmi_init_bpc_10(struct kunit *test) > +{ > + struct drm_connector_init_priv *priv = test->priv; > + struct drm_connector *connector = &priv->connector; > + struct drm_property *prop; > + uint64_t val; > + int ret; > + > + ret = drmm_connector_hdmi_init(&priv->drm, connector, > + &dummy_funcs, > + DRM_MODE_CONNECTOR_HDMIA, > + &priv->ddc, > + 10); > + KUNIT_EXPECT_EQ(test, ret, 0); > + > + prop = connector->max_bpc_property; > + KUNIT_ASSERT_NOT_NULL(test, prop); > + KUNIT_EXPECT_NOT_NULL(test, drm_mode_obj_find_prop_id(&connector->base, prop->base.id)); > + > + ret = drm_object_property_get_value(&connector->base, prop, &val); Ditto > + KUNIT_EXPECT_EQ(test, ret, 0); > + KUNIT_EXPECT_EQ(test, val, 10); > + > + prop = priv->drm.mode_config.hdr_output_metadata_property; > + KUNIT_ASSERT_NOT_NULL(test, prop); > + KUNIT_EXPECT_NOT_NULL(test, drm_mode_obj_find_prop_id(&connector->base, prop->base.id)); > +} > + > +/* > + * Test that the registration of a connector with a maximum bpc count of > + * 12 succeeds and registers the max bpc and HDR output metadata > + * properties. > + */ > +static void drm_test_connector_hdmi_init_bpc_12(struct kunit *test) > +{ > + struct drm_connector_init_priv *priv = test->priv; > + struct drm_connector *connector = &priv->connector; > + struct drm_property *prop; > + uint64_t val; > + int ret; > + > + ret = drmm_connector_hdmi_init(&priv->drm, connector, > + &dummy_funcs, > + DRM_MODE_CONNECTOR_HDMIA, > + &priv->ddc, > + 12); > + KUNIT_EXPECT_EQ(test, ret, 0); > + > + prop = connector->max_bpc_property; > + KUNIT_ASSERT_NOT_NULL(test, prop); > + KUNIT_EXPECT_NOT_NULL(test, drm_mode_obj_find_prop_id(&connector->base, prop->base.id)); > + > + ret = drm_object_property_get_value(&connector->base, prop, &val); ret = drm_atomic_connector_get_property(connector, connector->state, prop, &val); Note that this function is not exported, but I think you could export it just like what you did in the patch 02. Thank you for the amazing works. > + KUNIT_EXPECT_EQ(test, ret, 0); > + KUNIT_EXPECT_EQ(test, val, 12); > + > + prop = priv->drm.mode_config.hdr_output_metadata_property; > + KUNIT_ASSERT_NOT_NULL(test, prop); > + KUNIT_EXPECT_NOT_NULL(test, drm_mode_obj_find_prop_id(&connector->base, prop->base.id)); > +} > + -- Best regards Sui