Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] drm/tests: WARN_ON() in VRR limit tests via drm_object_property_get_value() --
commit 1a4f6d1ae4304b42e44e6989719d4059e858153e Author: Nicolas Frattaroli <[email protected]> drm/tests: hdmi: Add tests for vrr_display_{min,max} properties This commit attaches the vrr_display_min and vrr_display_max properties to the KUnit HDMI state helper test connector and adds two tests verifying drm_connector_hdmi_update_vrr_limits(). > diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c > b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c > index 95a922e7f2515..3f94133b20b10 100644 > --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c > +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c [ ... ] > @@ -3675,6 +3678,88 @@ static void drm_test_check_hdmi_vrr_flush_vsync(struct > kunit *test) > crtc_state->vrr_state.max_vtotal); > } > > +/* > + * Check that on a VRR-capable sink, the HDMI VRR limits helper sets the > + * display_min/display_max connector properties to the right values. > + */ > +static void drm_test_check_hdmi_vrr_display_limits(struct kunit *test) > +{ > + struct drm_atomic_helper_connector_hdmi_priv *priv; > + struct drm_display_mode *preferred; > + struct drm_connector *conn; > + u64 disp_min, disp_max; > + int ret; > + > + priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, > + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), > + 8, > + &dummy_connector_hdmi_funcs, > + test_edid_hdmi_vrr); > + KUNIT_ASSERT_NOT_NULL(test, priv); > + > + conn = &priv->connector; > + KUNIT_ASSERT_TRUE(test, conn->display_info.is_hdmi); > + KUNIT_ASSERT_TRUE(test, conn->display_info.hdmi.vrr_cap.supported); > + > + preferred = find_preferred_mode(conn); > + KUNIT_ASSERT_NOT_NULL(test, preferred); > + > + ret = drm_connector_hdmi_update_vrr_limits(conn, preferred); > + KUNIT_ASSERT_EQ(test, ret, 0); > + > + ret = drm_object_property_get_value(&conn->base, > conn->vrr_display_min_property, > + &disp_min); > + KUNIT_EXPECT_EQ(test, ret, 0); > + > + ret = drm_object_property_get_value(&conn->base, > conn->vrr_display_max_property, > + &disp_max); > + KUNIT_EXPECT_EQ(test, ret, 0); > + > + KUNIT_EXPECT_EQ(test, disp_min, 30); > + KUNIT_EXPECT_EQ(test, disp_max, 120); > +} > + > +/* > + * Check that on a non-VRR-capable sink, the HDMI VRR limits helper sets the > + * display_min/display_max connector properties to 0. > + */ > +static void drm_test_check_hdmi_vrr_display_limits_zero(struct kunit *test) > +{ > + struct drm_atomic_helper_connector_hdmi_priv *priv; > + struct drm_display_mode *preferred; > + struct drm_connector *conn; > + u64 disp_min, disp_max; > + int ret; > + > + priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, > + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), > + 8, > + &dummy_connector_hdmi_funcs, > + test_edid_hdmi_4k_rgb_yuv420_dc_max_340mhz); > + KUNIT_ASSERT_NOT_NULL(test, priv); > + > + conn = &priv->connector; > + KUNIT_ASSERT_TRUE(test, conn->display_info.is_hdmi); > + KUNIT_ASSERT_FALSE(test, conn->display_info.hdmi.vrr_cap.supported); > + > + preferred = find_preferred_mode(conn); > + KUNIT_ASSERT_NOT_NULL(test, preferred); > + > + ret = drm_connector_hdmi_update_vrr_limits(conn, preferred); > + KUNIT_ASSERT_EQ(test, ret, 0); > + > + ret = drm_object_property_get_value(&conn->base, > conn->vrr_display_min_property, > + &disp_min); > + KUNIT_EXPECT_EQ(test, ret, 0); > + > + ret = drm_object_property_get_value(&conn->base, > conn->vrr_display_max_property, > + &disp_max); [Severity: Medium] Will calling drm_object_property_get_value() in drm_test_check_hdmi_vrr_display_limits() and drm_test_check_hdmi_vrr_display_limits_zero() trigger a WARN_ON() when running these tests? Both tests initialize the test DRM device through drm_kunit_helper_connector_hdmi_init_with_edid_funcs() -> __connector_hdmi_init(), which allocates the device with DRIVER_ATOMIC: drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c:__connector_hdmi_init() { ... priv = drm_kunit_helper_alloc_drm_device(test, dev, struct drm_atomic_helper_connector_hdmi_priv, drm, DRIVER_MODESET | DRIVER_ATOMIC); ... } Unlike drm_object_property_set_value(), drm_object_property_get_value() does not exempt DRM_MODE_PROP_IMMUTABLE properties and unconditionally warns on atomic devices: drivers/gpu/drm/drm_mode_object.c: int drm_object_property_get_value(struct drm_mode_object *obj, struct drm_property *property, uint64_t *val) { WARN_ON(drm_drv_uses_atomic_modeset(property->dev)); return __drm_object_property_get_value(obj, property, val); } Since vrr_display_min_property and vrr_display_max_property are created with DRM_MODE_PROP_IMMUTABLE, should both tests use drm_object_immutable_property_get_value() instead? -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=27
