All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Maíra Canal" <mairacanal@riseup.net>
To: Maxime Ripard <maxime@cerno.tech>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Chen-Yu Tsai <wens@csie.org>, Maxime Ripard <mripard@kernel.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Karol Herbst <kherbst@redhat.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Daniel Vetter <daniel@ffwll.ch>, Lyude Paul <lyude@redhat.com>,
	Samuel Holland <samuel@sholland.org>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Emma Anholt <emma@anholt.net>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
	David Airlie <airlied@linux.ie>, Ben Skeggs <bskeggs@redhat.com>
Cc: "Dom Cobley" <dom@raspberrypi.com>,
	"Dave Stevenson" <dave.stevenson@raspberrypi.com>,
	nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	"Phil Elwell" <phil@raspberrypi.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Noralf Trønnes" <noralf@tronnes.org>,
	"Geert Uytterhoeven" <geert@linux-m68k.org>,
	"Mateusz Kwiatkowski" <kfyatek+publicgit@gmail.com>,
	linux-sunxi@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v8 06/24] drm/modes: Add a function to generate analog display modes
Date: Thu, 10 Nov 2022 20:01:42 -0300	[thread overview]
Message-ID: <28d35094-ac32-e589-274e-76f4b2408aec@riseup.net> (raw)
In-Reply-To: <20220728-rpi-analog-tv-properties-v8-6-09ce1466967c@cerno.tech>

Hi Maxime,

On 11/10/22 08:07, Maxime Ripard wrote:
> Multiple drivers (meson, vc4, sun4i) define analog TV 525-lines and
> 625-lines modes in their drivers.
> 
> Since those modes are fairly standard, and that we'll need to use them
> in more places in the future, it makes sense to move their definition
> into the core framework.
> 
> However, analog display usually have fairly loose timings requirements,
> the only discrete parameters being the total number of lines and pixel
> clock frequency. Thus, we created a function that will create a display
> mode from the standard, the pixel frequency and the active area.
> 
> Tested-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> 
> ---
> Changes in v6:
> - Fix typo
> 
> Changes in v4:
> - Reworded the line length check comment
> - Switch to HZ_PER_KHZ in tests
> - Use previous timing to fill our mode
> - Move the number of lines check earlier
> ---
>  drivers/gpu/drm/drm_modes.c            | 474 +++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/tests/Makefile         |   1 +
>  drivers/gpu/drm/tests/drm_modes_test.c | 145 ++++++++++
>  include/drm/drm_modes.h                |  17 ++
>  4 files changed, 637 insertions(+)
> 
> diff --git a/drivers/gpu/drm/tests/drm_modes_test.c b/drivers/gpu/drm/tests/drm_modes_test.c
> new file mode 100644
> index 000000000000..afeda9f07859
> --- /dev/null
> +++ b/drivers/gpu/drm/tests/drm_modes_test.c
> @@ -0,0 +1,145 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Kunit test for drm_modes functions
> + */
> +
> +#include <drm/drm_drv.h>
> +#include <drm/drm_modes.h>
> +
> +#include <kunit/test.h>
> +
> +#include <linux/units.h>
> +
> +#include "drm_kunit_helpers.h"
> +
> +struct drm_modes_test_priv {
> +	struct drm_device *drm;
> +};
> +
> +static int drm_modes_test_init(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv;
> +
> +	priv = kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_NULL(test, priv);
> +
> +	priv->drm = drm_kunit_device_init(test, DRIVER_MODESET, "drm-modes-test");
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->drm);
> +
> +	test->priv = priv;
> +
> +	return 0;
> +}
> +

As you did on the other tests, it would be nice to use the same naming
convention as the other DRM tests. So, maybe change the "drm_modes"
prefix to "drm_test_modes".

> +static void drm_modes_analog_tv_ntsc_480i(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv = test->priv;
> +	struct drm_display_mode *mode;
> +
> +	mode = drm_analog_tv_mode(priv->drm,
> +				  DRM_MODE_TV_MODE_NTSC,
> +				  13500 * HZ_PER_KHZ, 720, 480,
> +				  true);
> +	KUNIT_ASSERT_NOT_NULL(test, mode);
> +
> +	KUNIT_EXPECT_EQ(test, drm_mode_vrefresh(mode), 60);
> +	KUNIT_EXPECT_EQ(test, mode->hdisplay, 720);
> +
> +	/* BT.601 defines hsync_start at 736 for 480i */
> +	KUNIT_EXPECT_EQ(test, mode->hsync_start, 736);
> +
> +	/*
> +	 * The NTSC standard expects a line to take 63.556us. With a
> +	 * pixel clock of 13.5 MHz, a pixel takes around 74ns, so we
> +	 * need to have 63556ns / 74ns = 858.
> +	 *
> +	 * This is also mandated by BT.601.
> +	 */
> +	KUNIT_EXPECT_EQ(test, mode->htotal, 858);
> +
> +	KUNIT_EXPECT_EQ(test, mode->vdisplay, 480);
> +	KUNIT_EXPECT_EQ(test, mode->vtotal, 525);
> +}
> +
> +static void drm_modes_analog_tv_ntsc_480i_inlined(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv = test->priv;
> +	struct drm_display_mode *expected, *mode;
> +
> +	expected = drm_analog_tv_mode(priv->drm,
> +				      DRM_MODE_TV_MODE_NTSC,
> +				      13500 * HZ_PER_KHZ, 720, 480,
> +				      true);
> +	KUNIT_ASSERT_NOT_NULL(test, expected);
> +
> +	mode = drm_mode_analog_ntsc_480i(priv->drm);
> +	KUNIT_ASSERT_NOT_NULL(test, mode);
> +
> +	KUNIT_EXPECT_TRUE(test, drm_mode_equal(expected, mode));
> +}
> +
> +static void drm_modes_analog_tv_pal_576i(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv = test->priv;
> +	struct drm_display_mode *mode;
> +
> +	mode = drm_analog_tv_mode(priv->drm,
> +				  DRM_MODE_TV_MODE_PAL,
> +				  13500 * HZ_PER_KHZ, 720, 576,
> +				  true);
> +	KUNIT_ASSERT_NOT_NULL(test, mode);
> +
> +	KUNIT_EXPECT_EQ(test, drm_mode_vrefresh(mode), 50);
> +	KUNIT_EXPECT_EQ(test, mode->hdisplay, 720);
> +
> +	/* BT.601 defines hsync_start at 732 for 576i */
> +	KUNIT_EXPECT_EQ(test, mode->hsync_start, 732);
> +
> +	/*
> +	 * The PAL standard expects a line to take 64us. With a pixel
> +	 * clock of 13.5 MHz, a pixel takes around 74ns, so we need to
> +	 * have 64000ns / 74ns = 864.
> +	 *
> +	 * This is also mandated by BT.601.
> +	 */
> +	KUNIT_EXPECT_EQ(test, mode->htotal, 864);
> +
> +	KUNIT_EXPECT_EQ(test, mode->vdisplay, 576);
> +	KUNIT_EXPECT_EQ(test, mode->vtotal, 625);
> +}
> +
> +static void drm_modes_analog_tv_pal_576i_inlined(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv = test->priv;
> +	struct drm_display_mode *expected, *mode;
> +
> +	expected = drm_analog_tv_mode(priv->drm,
> +				      DRM_MODE_TV_MODE_PAL,
> +				      13500 * HZ_PER_KHZ, 720, 576,
> +				      true);
> +	KUNIT_ASSERT_NOT_NULL(test, expected);
> +
> +	mode = drm_mode_analog_pal_576i(priv->drm);
> +	KUNIT_ASSERT_NOT_NULL(test, mode);
> +
> +	KUNIT_EXPECT_TRUE(test, drm_mode_equal(expected, mode));
> +}
> +
> +static struct kunit_case drm_modes_analog_tv_tests[] = {
> +	KUNIT_CASE(drm_modes_analog_tv_ntsc_480i),
> +	KUNIT_CASE(drm_modes_analog_tv_ntsc_480i_inlined),
> +	KUNIT_CASE(drm_modes_analog_tv_pal_576i),
> +	KUNIT_CASE(drm_modes_analog_tv_pal_576i_inlined),
> +	{ }
> +};
> +
> +static struct kunit_suite drm_modes_analog_tv_test_suite = {
> +	.name = "drm_modes_analog_tv",
> +	.init = drm_modes_test_init,
> +	.test_cases = drm_modes_analog_tv_tests,
> +};
> +
> +kunit_test_suites(
> +	&drm_modes_analog_tv_test_suite
> +);

Considering that there is only one suite, you could use the
kunit_test_suite macro instead.

Best Regards,
- Maíra Canal

> +MODULE_LICENSE("GPL v2");

WARNING: multiple messages have this Message-ID (diff)
From: "Maíra Canal" <mairacanal@riseup.net>
To: Maxime Ripard <maxime@cerno.tech>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Chen-Yu Tsai <wens@csie.org>, Maxime Ripard <mripard@kernel.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Karol Herbst <kherbst@redhat.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Daniel Vetter <daniel@ffwll.ch>, Lyude Paul <lyude@redhat.com>,
	Samuel Holland <samuel@sholland.org>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Emma Anholt <emma@anholt.net>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
	David Airlie <airlied@linux.ie>, Ben Skeggs <bskeggs@redhat.com>
Cc: "Dom Cobley" <dom@raspberrypi.com>,
	nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	"Mateusz Kwiatkowski" <kfyatek+publicgit@gmail.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Noralf Trønnes" <noralf@tronnes.org>,
	"Geert Uytterhoeven" <geert@linux-m68k.org>,
	linux-sunxi@lists.linux.dev, "Phil Elwell" <phil@raspberrypi.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [Nouveau] [PATCH v8 06/24] drm/modes: Add a function to generate analog display modes
Date: Thu, 10 Nov 2022 20:01:42 -0300	[thread overview]
Message-ID: <28d35094-ac32-e589-274e-76f4b2408aec@riseup.net> (raw)
In-Reply-To: <20220728-rpi-analog-tv-properties-v8-6-09ce1466967c@cerno.tech>

Hi Maxime,

On 11/10/22 08:07, Maxime Ripard wrote:
> Multiple drivers (meson, vc4, sun4i) define analog TV 525-lines and
> 625-lines modes in their drivers.
> 
> Since those modes are fairly standard, and that we'll need to use them
> in more places in the future, it makes sense to move their definition
> into the core framework.
> 
> However, analog display usually have fairly loose timings requirements,
> the only discrete parameters being the total number of lines and pixel
> clock frequency. Thus, we created a function that will create a display
> mode from the standard, the pixel frequency and the active area.
> 
> Tested-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> 
> ---
> Changes in v6:
> - Fix typo
> 
> Changes in v4:
> - Reworded the line length check comment
> - Switch to HZ_PER_KHZ in tests
> - Use previous timing to fill our mode
> - Move the number of lines check earlier
> ---
>  drivers/gpu/drm/drm_modes.c            | 474 +++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/tests/Makefile         |   1 +
>  drivers/gpu/drm/tests/drm_modes_test.c | 145 ++++++++++
>  include/drm/drm_modes.h                |  17 ++
>  4 files changed, 637 insertions(+)
> 
> diff --git a/drivers/gpu/drm/tests/drm_modes_test.c b/drivers/gpu/drm/tests/drm_modes_test.c
> new file mode 100644
> index 000000000000..afeda9f07859
> --- /dev/null
> +++ b/drivers/gpu/drm/tests/drm_modes_test.c
> @@ -0,0 +1,145 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Kunit test for drm_modes functions
> + */
> +
> +#include <drm/drm_drv.h>
> +#include <drm/drm_modes.h>
> +
> +#include <kunit/test.h>
> +
> +#include <linux/units.h>
> +
> +#include "drm_kunit_helpers.h"
> +
> +struct drm_modes_test_priv {
> +	struct drm_device *drm;
> +};
> +
> +static int drm_modes_test_init(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv;
> +
> +	priv = kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_NULL(test, priv);
> +
> +	priv->drm = drm_kunit_device_init(test, DRIVER_MODESET, "drm-modes-test");
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->drm);
> +
> +	test->priv = priv;
> +
> +	return 0;
> +}
> +

As you did on the other tests, it would be nice to use the same naming
convention as the other DRM tests. So, maybe change the "drm_modes"
prefix to "drm_test_modes".

> +static void drm_modes_analog_tv_ntsc_480i(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv = test->priv;
> +	struct drm_display_mode *mode;
> +
> +	mode = drm_analog_tv_mode(priv->drm,
> +				  DRM_MODE_TV_MODE_NTSC,
> +				  13500 * HZ_PER_KHZ, 720, 480,
> +				  true);
> +	KUNIT_ASSERT_NOT_NULL(test, mode);
> +
> +	KUNIT_EXPECT_EQ(test, drm_mode_vrefresh(mode), 60);
> +	KUNIT_EXPECT_EQ(test, mode->hdisplay, 720);
> +
> +	/* BT.601 defines hsync_start at 736 for 480i */
> +	KUNIT_EXPECT_EQ(test, mode->hsync_start, 736);
> +
> +	/*
> +	 * The NTSC standard expects a line to take 63.556us. With a
> +	 * pixel clock of 13.5 MHz, a pixel takes around 74ns, so we
> +	 * need to have 63556ns / 74ns = 858.
> +	 *
> +	 * This is also mandated by BT.601.
> +	 */
> +	KUNIT_EXPECT_EQ(test, mode->htotal, 858);
> +
> +	KUNIT_EXPECT_EQ(test, mode->vdisplay, 480);
> +	KUNIT_EXPECT_EQ(test, mode->vtotal, 525);
> +}
> +
> +static void drm_modes_analog_tv_ntsc_480i_inlined(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv = test->priv;
> +	struct drm_display_mode *expected, *mode;
> +
> +	expected = drm_analog_tv_mode(priv->drm,
> +				      DRM_MODE_TV_MODE_NTSC,
> +				      13500 * HZ_PER_KHZ, 720, 480,
> +				      true);
> +	KUNIT_ASSERT_NOT_NULL(test, expected);
> +
> +	mode = drm_mode_analog_ntsc_480i(priv->drm);
> +	KUNIT_ASSERT_NOT_NULL(test, mode);
> +
> +	KUNIT_EXPECT_TRUE(test, drm_mode_equal(expected, mode));
> +}
> +
> +static void drm_modes_analog_tv_pal_576i(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv = test->priv;
> +	struct drm_display_mode *mode;
> +
> +	mode = drm_analog_tv_mode(priv->drm,
> +				  DRM_MODE_TV_MODE_PAL,
> +				  13500 * HZ_PER_KHZ, 720, 576,
> +				  true);
> +	KUNIT_ASSERT_NOT_NULL(test, mode);
> +
> +	KUNIT_EXPECT_EQ(test, drm_mode_vrefresh(mode), 50);
> +	KUNIT_EXPECT_EQ(test, mode->hdisplay, 720);
> +
> +	/* BT.601 defines hsync_start at 732 for 576i */
> +	KUNIT_EXPECT_EQ(test, mode->hsync_start, 732);
> +
> +	/*
> +	 * The PAL standard expects a line to take 64us. With a pixel
> +	 * clock of 13.5 MHz, a pixel takes around 74ns, so we need to
> +	 * have 64000ns / 74ns = 864.
> +	 *
> +	 * This is also mandated by BT.601.
> +	 */
> +	KUNIT_EXPECT_EQ(test, mode->htotal, 864);
> +
> +	KUNIT_EXPECT_EQ(test, mode->vdisplay, 576);
> +	KUNIT_EXPECT_EQ(test, mode->vtotal, 625);
> +}
> +
> +static void drm_modes_analog_tv_pal_576i_inlined(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv = test->priv;
> +	struct drm_display_mode *expected, *mode;
> +
> +	expected = drm_analog_tv_mode(priv->drm,
> +				      DRM_MODE_TV_MODE_PAL,
> +				      13500 * HZ_PER_KHZ, 720, 576,
> +				      true);
> +	KUNIT_ASSERT_NOT_NULL(test, expected);
> +
> +	mode = drm_mode_analog_pal_576i(priv->drm);
> +	KUNIT_ASSERT_NOT_NULL(test, mode);
> +
> +	KUNIT_EXPECT_TRUE(test, drm_mode_equal(expected, mode));
> +}
> +
> +static struct kunit_case drm_modes_analog_tv_tests[] = {
> +	KUNIT_CASE(drm_modes_analog_tv_ntsc_480i),
> +	KUNIT_CASE(drm_modes_analog_tv_ntsc_480i_inlined),
> +	KUNIT_CASE(drm_modes_analog_tv_pal_576i),
> +	KUNIT_CASE(drm_modes_analog_tv_pal_576i_inlined),
> +	{ }
> +};
> +
> +static struct kunit_suite drm_modes_analog_tv_test_suite = {
> +	.name = "drm_modes_analog_tv",
> +	.init = drm_modes_test_init,
> +	.test_cases = drm_modes_analog_tv_tests,
> +};
> +
> +kunit_test_suites(
> +	&drm_modes_analog_tv_test_suite
> +);

Considering that there is only one suite, you could use the
kunit_test_suite macro instead.

Best Regards,
- Maíra Canal

> +MODULE_LICENSE("GPL v2");

WARNING: multiple messages have this Message-ID (diff)
From: "Maíra Canal" <mairacanal@riseup.net>
To: Maxime Ripard <maxime@cerno.tech>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Chen-Yu Tsai <wens@csie.org>, Maxime Ripard <mripard@kernel.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Karol Herbst <kherbst@redhat.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Daniel Vetter <daniel@ffwll.ch>, Lyude Paul <lyude@redhat.com>,
	Samuel Holland <samuel@sholland.org>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Emma Anholt <emma@anholt.net>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
	David Airlie <airlied@linux.ie>, Ben Skeggs <bskeggs@redhat.com>
Cc: "Dom Cobley" <dom@raspberrypi.com>,
	"Dave Stevenson" <dave.stevenson@raspberrypi.com>,
	nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	"Mateusz Kwiatkowski" <kfyatek+publicgit@gmail.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Noralf Trønnes" <noralf@tronnes.org>,
	"Geert Uytterhoeven" <geert@linux-m68k.org>,
	linux-sunxi@lists.linux.dev, "Phil Elwell" <phil@raspberrypi.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v8 06/24] drm/modes: Add a function to generate analog display modes
Date: Thu, 10 Nov 2022 20:01:42 -0300	[thread overview]
Message-ID: <28d35094-ac32-e589-274e-76f4b2408aec@riseup.net> (raw)
In-Reply-To: <20220728-rpi-analog-tv-properties-v8-6-09ce1466967c@cerno.tech>

Hi Maxime,

On 11/10/22 08:07, Maxime Ripard wrote:
> Multiple drivers (meson, vc4, sun4i) define analog TV 525-lines and
> 625-lines modes in their drivers.
> 
> Since those modes are fairly standard, and that we'll need to use them
> in more places in the future, it makes sense to move their definition
> into the core framework.
> 
> However, analog display usually have fairly loose timings requirements,
> the only discrete parameters being the total number of lines and pixel
> clock frequency. Thus, we created a function that will create a display
> mode from the standard, the pixel frequency and the active area.
> 
> Tested-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> 
> ---
> Changes in v6:
> - Fix typo
> 
> Changes in v4:
> - Reworded the line length check comment
> - Switch to HZ_PER_KHZ in tests
> - Use previous timing to fill our mode
> - Move the number of lines check earlier
> ---
>  drivers/gpu/drm/drm_modes.c            | 474 +++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/tests/Makefile         |   1 +
>  drivers/gpu/drm/tests/drm_modes_test.c | 145 ++++++++++
>  include/drm/drm_modes.h                |  17 ++
>  4 files changed, 637 insertions(+)
> 
> diff --git a/drivers/gpu/drm/tests/drm_modes_test.c b/drivers/gpu/drm/tests/drm_modes_test.c
> new file mode 100644
> index 000000000000..afeda9f07859
> --- /dev/null
> +++ b/drivers/gpu/drm/tests/drm_modes_test.c
> @@ -0,0 +1,145 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Kunit test for drm_modes functions
> + */
> +
> +#include <drm/drm_drv.h>
> +#include <drm/drm_modes.h>
> +
> +#include <kunit/test.h>
> +
> +#include <linux/units.h>
> +
> +#include "drm_kunit_helpers.h"
> +
> +struct drm_modes_test_priv {
> +	struct drm_device *drm;
> +};
> +
> +static int drm_modes_test_init(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv;
> +
> +	priv = kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_NULL(test, priv);
> +
> +	priv->drm = drm_kunit_device_init(test, DRIVER_MODESET, "drm-modes-test");
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->drm);
> +
> +	test->priv = priv;
> +
> +	return 0;
> +}
> +

As you did on the other tests, it would be nice to use the same naming
convention as the other DRM tests. So, maybe change the "drm_modes"
prefix to "drm_test_modes".

> +static void drm_modes_analog_tv_ntsc_480i(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv = test->priv;
> +	struct drm_display_mode *mode;
> +
> +	mode = drm_analog_tv_mode(priv->drm,
> +				  DRM_MODE_TV_MODE_NTSC,
> +				  13500 * HZ_PER_KHZ, 720, 480,
> +				  true);
> +	KUNIT_ASSERT_NOT_NULL(test, mode);
> +
> +	KUNIT_EXPECT_EQ(test, drm_mode_vrefresh(mode), 60);
> +	KUNIT_EXPECT_EQ(test, mode->hdisplay, 720);
> +
> +	/* BT.601 defines hsync_start at 736 for 480i */
> +	KUNIT_EXPECT_EQ(test, mode->hsync_start, 736);
> +
> +	/*
> +	 * The NTSC standard expects a line to take 63.556us. With a
> +	 * pixel clock of 13.5 MHz, a pixel takes around 74ns, so we
> +	 * need to have 63556ns / 74ns = 858.
> +	 *
> +	 * This is also mandated by BT.601.
> +	 */
> +	KUNIT_EXPECT_EQ(test, mode->htotal, 858);
> +
> +	KUNIT_EXPECT_EQ(test, mode->vdisplay, 480);
> +	KUNIT_EXPECT_EQ(test, mode->vtotal, 525);
> +}
> +
> +static void drm_modes_analog_tv_ntsc_480i_inlined(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv = test->priv;
> +	struct drm_display_mode *expected, *mode;
> +
> +	expected = drm_analog_tv_mode(priv->drm,
> +				      DRM_MODE_TV_MODE_NTSC,
> +				      13500 * HZ_PER_KHZ, 720, 480,
> +				      true);
> +	KUNIT_ASSERT_NOT_NULL(test, expected);
> +
> +	mode = drm_mode_analog_ntsc_480i(priv->drm);
> +	KUNIT_ASSERT_NOT_NULL(test, mode);
> +
> +	KUNIT_EXPECT_TRUE(test, drm_mode_equal(expected, mode));
> +}
> +
> +static void drm_modes_analog_tv_pal_576i(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv = test->priv;
> +	struct drm_display_mode *mode;
> +
> +	mode = drm_analog_tv_mode(priv->drm,
> +				  DRM_MODE_TV_MODE_PAL,
> +				  13500 * HZ_PER_KHZ, 720, 576,
> +				  true);
> +	KUNIT_ASSERT_NOT_NULL(test, mode);
> +
> +	KUNIT_EXPECT_EQ(test, drm_mode_vrefresh(mode), 50);
> +	KUNIT_EXPECT_EQ(test, mode->hdisplay, 720);
> +
> +	/* BT.601 defines hsync_start at 732 for 576i */
> +	KUNIT_EXPECT_EQ(test, mode->hsync_start, 732);
> +
> +	/*
> +	 * The PAL standard expects a line to take 64us. With a pixel
> +	 * clock of 13.5 MHz, a pixel takes around 74ns, so we need to
> +	 * have 64000ns / 74ns = 864.
> +	 *
> +	 * This is also mandated by BT.601.
> +	 */
> +	KUNIT_EXPECT_EQ(test, mode->htotal, 864);
> +
> +	KUNIT_EXPECT_EQ(test, mode->vdisplay, 576);
> +	KUNIT_EXPECT_EQ(test, mode->vtotal, 625);
> +}
> +
> +static void drm_modes_analog_tv_pal_576i_inlined(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv = test->priv;
> +	struct drm_display_mode *expected, *mode;
> +
> +	expected = drm_analog_tv_mode(priv->drm,
> +				      DRM_MODE_TV_MODE_PAL,
> +				      13500 * HZ_PER_KHZ, 720, 576,
> +				      true);
> +	KUNIT_ASSERT_NOT_NULL(test, expected);
> +
> +	mode = drm_mode_analog_pal_576i(priv->drm);
> +	KUNIT_ASSERT_NOT_NULL(test, mode);
> +
> +	KUNIT_EXPECT_TRUE(test, drm_mode_equal(expected, mode));
> +}
> +
> +static struct kunit_case drm_modes_analog_tv_tests[] = {
> +	KUNIT_CASE(drm_modes_analog_tv_ntsc_480i),
> +	KUNIT_CASE(drm_modes_analog_tv_ntsc_480i_inlined),
> +	KUNIT_CASE(drm_modes_analog_tv_pal_576i),
> +	KUNIT_CASE(drm_modes_analog_tv_pal_576i_inlined),
> +	{ }
> +};
> +
> +static struct kunit_suite drm_modes_analog_tv_test_suite = {
> +	.name = "drm_modes_analog_tv",
> +	.init = drm_modes_test_init,
> +	.test_cases = drm_modes_analog_tv_tests,
> +};
> +
> +kunit_test_suites(
> +	&drm_modes_analog_tv_test_suite
> +);

Considering that there is only one suite, you could use the
kunit_test_suite macro instead.

Best Regards,
- Maíra Canal

> +MODULE_LICENSE("GPL v2");

WARNING: multiple messages have this Message-ID (diff)
From: "Maíra Canal" <mairacanal@riseup.net>
To: Maxime Ripard <maxime@cerno.tech>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Chen-Yu Tsai <wens@csie.org>, Maxime Ripard <mripard@kernel.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Karol Herbst <kherbst@redhat.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Daniel Vetter <daniel@ffwll.ch>, Lyude Paul <lyude@redhat.com>,
	Samuel Holland <samuel@sholland.org>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Emma Anholt <emma@anholt.net>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
	David Airlie <airlied@linux.ie>, Ben Skeggs <bskeggs@redhat.com>
Cc: "Dom Cobley" <dom@raspberrypi.com>,
	"Dave Stevenson" <dave.stevenson@raspberrypi.com>,
	nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	"Mateusz Kwiatkowski" <kfyatek+publicgit@gmail.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Noralf Trønnes" <noralf@tronnes.org>,
	"Geert Uytterhoeven" <geert@linux-m68k.org>,
	linux-sunxi@lists.linux.dev, "Phil Elwell" <phil@raspberrypi.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [Intel-gfx] [PATCH v8 06/24] drm/modes: Add a function to generate analog display modes
Date: Thu, 10 Nov 2022 20:01:42 -0300	[thread overview]
Message-ID: <28d35094-ac32-e589-274e-76f4b2408aec@riseup.net> (raw)
In-Reply-To: <20220728-rpi-analog-tv-properties-v8-6-09ce1466967c@cerno.tech>

Hi Maxime,

On 11/10/22 08:07, Maxime Ripard wrote:
> Multiple drivers (meson, vc4, sun4i) define analog TV 525-lines and
> 625-lines modes in their drivers.
> 
> Since those modes are fairly standard, and that we'll need to use them
> in more places in the future, it makes sense to move their definition
> into the core framework.
> 
> However, analog display usually have fairly loose timings requirements,
> the only discrete parameters being the total number of lines and pixel
> clock frequency. Thus, we created a function that will create a display
> mode from the standard, the pixel frequency and the active area.
> 
> Tested-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> 
> ---
> Changes in v6:
> - Fix typo
> 
> Changes in v4:
> - Reworded the line length check comment
> - Switch to HZ_PER_KHZ in tests
> - Use previous timing to fill our mode
> - Move the number of lines check earlier
> ---
>  drivers/gpu/drm/drm_modes.c            | 474 +++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/tests/Makefile         |   1 +
>  drivers/gpu/drm/tests/drm_modes_test.c | 145 ++++++++++
>  include/drm/drm_modes.h                |  17 ++
>  4 files changed, 637 insertions(+)
> 
> diff --git a/drivers/gpu/drm/tests/drm_modes_test.c b/drivers/gpu/drm/tests/drm_modes_test.c
> new file mode 100644
> index 000000000000..afeda9f07859
> --- /dev/null
> +++ b/drivers/gpu/drm/tests/drm_modes_test.c
> @@ -0,0 +1,145 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Kunit test for drm_modes functions
> + */
> +
> +#include <drm/drm_drv.h>
> +#include <drm/drm_modes.h>
> +
> +#include <kunit/test.h>
> +
> +#include <linux/units.h>
> +
> +#include "drm_kunit_helpers.h"
> +
> +struct drm_modes_test_priv {
> +	struct drm_device *drm;
> +};
> +
> +static int drm_modes_test_init(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv;
> +
> +	priv = kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_NULL(test, priv);
> +
> +	priv->drm = drm_kunit_device_init(test, DRIVER_MODESET, "drm-modes-test");
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->drm);
> +
> +	test->priv = priv;
> +
> +	return 0;
> +}
> +

As you did on the other tests, it would be nice to use the same naming
convention as the other DRM tests. So, maybe change the "drm_modes"
prefix to "drm_test_modes".

> +static void drm_modes_analog_tv_ntsc_480i(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv = test->priv;
> +	struct drm_display_mode *mode;
> +
> +	mode = drm_analog_tv_mode(priv->drm,
> +				  DRM_MODE_TV_MODE_NTSC,
> +				  13500 * HZ_PER_KHZ, 720, 480,
> +				  true);
> +	KUNIT_ASSERT_NOT_NULL(test, mode);
> +
> +	KUNIT_EXPECT_EQ(test, drm_mode_vrefresh(mode), 60);
> +	KUNIT_EXPECT_EQ(test, mode->hdisplay, 720);
> +
> +	/* BT.601 defines hsync_start at 736 for 480i */
> +	KUNIT_EXPECT_EQ(test, mode->hsync_start, 736);
> +
> +	/*
> +	 * The NTSC standard expects a line to take 63.556us. With a
> +	 * pixel clock of 13.5 MHz, a pixel takes around 74ns, so we
> +	 * need to have 63556ns / 74ns = 858.
> +	 *
> +	 * This is also mandated by BT.601.
> +	 */
> +	KUNIT_EXPECT_EQ(test, mode->htotal, 858);
> +
> +	KUNIT_EXPECT_EQ(test, mode->vdisplay, 480);
> +	KUNIT_EXPECT_EQ(test, mode->vtotal, 525);
> +}
> +
> +static void drm_modes_analog_tv_ntsc_480i_inlined(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv = test->priv;
> +	struct drm_display_mode *expected, *mode;
> +
> +	expected = drm_analog_tv_mode(priv->drm,
> +				      DRM_MODE_TV_MODE_NTSC,
> +				      13500 * HZ_PER_KHZ, 720, 480,
> +				      true);
> +	KUNIT_ASSERT_NOT_NULL(test, expected);
> +
> +	mode = drm_mode_analog_ntsc_480i(priv->drm);
> +	KUNIT_ASSERT_NOT_NULL(test, mode);
> +
> +	KUNIT_EXPECT_TRUE(test, drm_mode_equal(expected, mode));
> +}
> +
> +static void drm_modes_analog_tv_pal_576i(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv = test->priv;
> +	struct drm_display_mode *mode;
> +
> +	mode = drm_analog_tv_mode(priv->drm,
> +				  DRM_MODE_TV_MODE_PAL,
> +				  13500 * HZ_PER_KHZ, 720, 576,
> +				  true);
> +	KUNIT_ASSERT_NOT_NULL(test, mode);
> +
> +	KUNIT_EXPECT_EQ(test, drm_mode_vrefresh(mode), 50);
> +	KUNIT_EXPECT_EQ(test, mode->hdisplay, 720);
> +
> +	/* BT.601 defines hsync_start at 732 for 576i */
> +	KUNIT_EXPECT_EQ(test, mode->hsync_start, 732);
> +
> +	/*
> +	 * The PAL standard expects a line to take 64us. With a pixel
> +	 * clock of 13.5 MHz, a pixel takes around 74ns, so we need to
> +	 * have 64000ns / 74ns = 864.
> +	 *
> +	 * This is also mandated by BT.601.
> +	 */
> +	KUNIT_EXPECT_EQ(test, mode->htotal, 864);
> +
> +	KUNIT_EXPECT_EQ(test, mode->vdisplay, 576);
> +	KUNIT_EXPECT_EQ(test, mode->vtotal, 625);
> +}
> +
> +static void drm_modes_analog_tv_pal_576i_inlined(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv = test->priv;
> +	struct drm_display_mode *expected, *mode;
> +
> +	expected = drm_analog_tv_mode(priv->drm,
> +				      DRM_MODE_TV_MODE_PAL,
> +				      13500 * HZ_PER_KHZ, 720, 576,
> +				      true);
> +	KUNIT_ASSERT_NOT_NULL(test, expected);
> +
> +	mode = drm_mode_analog_pal_576i(priv->drm);
> +	KUNIT_ASSERT_NOT_NULL(test, mode);
> +
> +	KUNIT_EXPECT_TRUE(test, drm_mode_equal(expected, mode));
> +}
> +
> +static struct kunit_case drm_modes_analog_tv_tests[] = {
> +	KUNIT_CASE(drm_modes_analog_tv_ntsc_480i),
> +	KUNIT_CASE(drm_modes_analog_tv_ntsc_480i_inlined),
> +	KUNIT_CASE(drm_modes_analog_tv_pal_576i),
> +	KUNIT_CASE(drm_modes_analog_tv_pal_576i_inlined),
> +	{ }
> +};
> +
> +static struct kunit_suite drm_modes_analog_tv_test_suite = {
> +	.name = "drm_modes_analog_tv",
> +	.init = drm_modes_test_init,
> +	.test_cases = drm_modes_analog_tv_tests,
> +};
> +
> +kunit_test_suites(
> +	&drm_modes_analog_tv_test_suite
> +);

Considering that there is only one suite, you could use the
kunit_test_suite macro instead.

Best Regards,
- Maíra Canal

> +MODULE_LICENSE("GPL v2");

WARNING: multiple messages have this Message-ID (diff)
From: "Maíra Canal" <mairacanal@riseup.net>
To: Maxime Ripard <maxime@cerno.tech>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Chen-Yu Tsai <wens@csie.org>, Maxime Ripard <mripard@kernel.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Karol Herbst <kherbst@redhat.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Daniel Vetter <daniel@ffwll.ch>, Lyude Paul <lyude@redhat.com>,
	Samuel Holland <samuel@sholland.org>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Emma Anholt <emma@anholt.net>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
	David Airlie <airlied@linux.ie>, Ben Skeggs <bskeggs@redhat.com>
Cc: "Dom Cobley" <dom@raspberrypi.com>,
	"Dave Stevenson" <dave.stevenson@raspberrypi.com>,
	nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	"Phil Elwell" <phil@raspberrypi.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Noralf Trønnes" <noralf@tronnes.org>,
	"Geert Uytterhoeven" <geert@linux-m68k.org>,
	"Mateusz Kwiatkowski" <kfyatek+publicgit@gmail.com>,
	linux-sunxi@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v8 06/24] drm/modes: Add a function to generate analog display modes
Date: Thu, 10 Nov 2022 20:01:42 -0300	[thread overview]
Message-ID: <28d35094-ac32-e589-274e-76f4b2408aec@riseup.net> (raw)
In-Reply-To: <20220728-rpi-analog-tv-properties-v8-6-09ce1466967c@cerno.tech>

Hi Maxime,

On 11/10/22 08:07, Maxime Ripard wrote:
> Multiple drivers (meson, vc4, sun4i) define analog TV 525-lines and
> 625-lines modes in their drivers.
> 
> Since those modes are fairly standard, and that we'll need to use them
> in more places in the future, it makes sense to move their definition
> into the core framework.
> 
> However, analog display usually have fairly loose timings requirements,
> the only discrete parameters being the total number of lines and pixel
> clock frequency. Thus, we created a function that will create a display
> mode from the standard, the pixel frequency and the active area.
> 
> Tested-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> 
> ---
> Changes in v6:
> - Fix typo
> 
> Changes in v4:
> - Reworded the line length check comment
> - Switch to HZ_PER_KHZ in tests
> - Use previous timing to fill our mode
> - Move the number of lines check earlier
> ---
>  drivers/gpu/drm/drm_modes.c            | 474 +++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/tests/Makefile         |   1 +
>  drivers/gpu/drm/tests/drm_modes_test.c | 145 ++++++++++
>  include/drm/drm_modes.h                |  17 ++
>  4 files changed, 637 insertions(+)
> 
> diff --git a/drivers/gpu/drm/tests/drm_modes_test.c b/drivers/gpu/drm/tests/drm_modes_test.c
> new file mode 100644
> index 000000000000..afeda9f07859
> --- /dev/null
> +++ b/drivers/gpu/drm/tests/drm_modes_test.c
> @@ -0,0 +1,145 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Kunit test for drm_modes functions
> + */
> +
> +#include <drm/drm_drv.h>
> +#include <drm/drm_modes.h>
> +
> +#include <kunit/test.h>
> +
> +#include <linux/units.h>
> +
> +#include "drm_kunit_helpers.h"
> +
> +struct drm_modes_test_priv {
> +	struct drm_device *drm;
> +};
> +
> +static int drm_modes_test_init(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv;
> +
> +	priv = kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_NULL(test, priv);
> +
> +	priv->drm = drm_kunit_device_init(test, DRIVER_MODESET, "drm-modes-test");
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->drm);
> +
> +	test->priv = priv;
> +
> +	return 0;
> +}
> +

As you did on the other tests, it would be nice to use the same naming
convention as the other DRM tests. So, maybe change the "drm_modes"
prefix to "drm_test_modes".

> +static void drm_modes_analog_tv_ntsc_480i(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv = test->priv;
> +	struct drm_display_mode *mode;
> +
> +	mode = drm_analog_tv_mode(priv->drm,
> +				  DRM_MODE_TV_MODE_NTSC,
> +				  13500 * HZ_PER_KHZ, 720, 480,
> +				  true);
> +	KUNIT_ASSERT_NOT_NULL(test, mode);
> +
> +	KUNIT_EXPECT_EQ(test, drm_mode_vrefresh(mode), 60);
> +	KUNIT_EXPECT_EQ(test, mode->hdisplay, 720);
> +
> +	/* BT.601 defines hsync_start at 736 for 480i */
> +	KUNIT_EXPECT_EQ(test, mode->hsync_start, 736);
> +
> +	/*
> +	 * The NTSC standard expects a line to take 63.556us. With a
> +	 * pixel clock of 13.5 MHz, a pixel takes around 74ns, so we
> +	 * need to have 63556ns / 74ns = 858.
> +	 *
> +	 * This is also mandated by BT.601.
> +	 */
> +	KUNIT_EXPECT_EQ(test, mode->htotal, 858);
> +
> +	KUNIT_EXPECT_EQ(test, mode->vdisplay, 480);
> +	KUNIT_EXPECT_EQ(test, mode->vtotal, 525);
> +}
> +
> +static void drm_modes_analog_tv_ntsc_480i_inlined(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv = test->priv;
> +	struct drm_display_mode *expected, *mode;
> +
> +	expected = drm_analog_tv_mode(priv->drm,
> +				      DRM_MODE_TV_MODE_NTSC,
> +				      13500 * HZ_PER_KHZ, 720, 480,
> +				      true);
> +	KUNIT_ASSERT_NOT_NULL(test, expected);
> +
> +	mode = drm_mode_analog_ntsc_480i(priv->drm);
> +	KUNIT_ASSERT_NOT_NULL(test, mode);
> +
> +	KUNIT_EXPECT_TRUE(test, drm_mode_equal(expected, mode));
> +}
> +
> +static void drm_modes_analog_tv_pal_576i(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv = test->priv;
> +	struct drm_display_mode *mode;
> +
> +	mode = drm_analog_tv_mode(priv->drm,
> +				  DRM_MODE_TV_MODE_PAL,
> +				  13500 * HZ_PER_KHZ, 720, 576,
> +				  true);
> +	KUNIT_ASSERT_NOT_NULL(test, mode);
> +
> +	KUNIT_EXPECT_EQ(test, drm_mode_vrefresh(mode), 50);
> +	KUNIT_EXPECT_EQ(test, mode->hdisplay, 720);
> +
> +	/* BT.601 defines hsync_start at 732 for 576i */
> +	KUNIT_EXPECT_EQ(test, mode->hsync_start, 732);
> +
> +	/*
> +	 * The PAL standard expects a line to take 64us. With a pixel
> +	 * clock of 13.5 MHz, a pixel takes around 74ns, so we need to
> +	 * have 64000ns / 74ns = 864.
> +	 *
> +	 * This is also mandated by BT.601.
> +	 */
> +	KUNIT_EXPECT_EQ(test, mode->htotal, 864);
> +
> +	KUNIT_EXPECT_EQ(test, mode->vdisplay, 576);
> +	KUNIT_EXPECT_EQ(test, mode->vtotal, 625);
> +}
> +
> +static void drm_modes_analog_tv_pal_576i_inlined(struct kunit *test)
> +{
> +	struct drm_modes_test_priv *priv = test->priv;
> +	struct drm_display_mode *expected, *mode;
> +
> +	expected = drm_analog_tv_mode(priv->drm,
> +				      DRM_MODE_TV_MODE_PAL,
> +				      13500 * HZ_PER_KHZ, 720, 576,
> +				      true);
> +	KUNIT_ASSERT_NOT_NULL(test, expected);
> +
> +	mode = drm_mode_analog_pal_576i(priv->drm);
> +	KUNIT_ASSERT_NOT_NULL(test, mode);
> +
> +	KUNIT_EXPECT_TRUE(test, drm_mode_equal(expected, mode));
> +}
> +
> +static struct kunit_case drm_modes_analog_tv_tests[] = {
> +	KUNIT_CASE(drm_modes_analog_tv_ntsc_480i),
> +	KUNIT_CASE(drm_modes_analog_tv_ntsc_480i_inlined),
> +	KUNIT_CASE(drm_modes_analog_tv_pal_576i),
> +	KUNIT_CASE(drm_modes_analog_tv_pal_576i_inlined),
> +	{ }
> +};
> +
> +static struct kunit_suite drm_modes_analog_tv_test_suite = {
> +	.name = "drm_modes_analog_tv",
> +	.init = drm_modes_test_init,
> +	.test_cases = drm_modes_analog_tv_tests,
> +};
> +
> +kunit_test_suites(
> +	&drm_modes_analog_tv_test_suite
> +);

Considering that there is only one suite, you could use the
kunit_test_suite macro instead.

Best Regards,
- Maíra Canal

> +MODULE_LICENSE("GPL v2");

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-11-10 23:08 UTC|newest]

Thread overview: 162+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10 11:07 [PATCH v8 00/24] drm: Analog TV Improvements Maxime Ripard
2022-11-10 11:07 ` Maxime Ripard
2022-11-10 11:07 ` [Intel-gfx] " Maxime Ripard
2022-11-10 11:07 ` Maxime Ripard
2022-11-10 11:07 ` [Nouveau] " Maxime Ripard
2022-11-10 11:07 ` [PATCH v8 01/24] drm/tests: Add Kunit Helpers Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Intel-gfx] " Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Nouveau] " Maxime Ripard
2022-11-10 11:07 ` [PATCH v8 02/24] drm/connector: Rename legacy TV property Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Intel-gfx] " Maxime Ripard
2022-11-10 11:07   ` [Nouveau] " Maxime Ripard
2022-11-10 11:07 ` [PATCH v8 03/24] drm/connector: Only register TV mode property if present Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Intel-gfx] " Maxime Ripard
2022-11-10 11:07   ` [Nouveau] " Maxime Ripard
2022-11-10 11:07 ` [PATCH v8 04/24] drm/connector: Rename drm_mode_create_tv_properties Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Intel-gfx] " Maxime Ripard
2022-11-10 11:07   ` [Nouveau] " Maxime Ripard
2022-11-10 11:07 ` [PATCH v8 05/24] drm/connector: Add TV standard property Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Intel-gfx] " Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Nouveau] " Maxime Ripard
2022-11-10 11:07 ` [PATCH v8 06/24] drm/modes: Add a function to generate analog display modes Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Intel-gfx] " Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Nouveau] " Maxime Ripard
2022-11-10 23:01   ` Maíra Canal [this message]
2022-11-10 23:01     ` Maíra Canal
2022-11-10 23:01     ` [Intel-gfx] " Maíra Canal
2022-11-10 23:01     ` Maíra Canal
2022-11-10 23:01     ` [Nouveau] " Maíra Canal
2022-11-10 11:07 ` [PATCH v8 07/24] drm/client: Add some tests for drm_connector_pick_cmdline_mode() Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Intel-gfx] " Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Nouveau] " Maxime Ripard
2022-11-10 11:07 ` [PATCH v8 08/24] drm/modes: Move named modes parsing to a separate function Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Intel-gfx] " Maxime Ripard
2022-11-10 11:07   ` [Nouveau] " Maxime Ripard
2022-11-10 11:07 ` [PATCH v8 09/24] drm/modes: Switch to named mode descriptors Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Intel-gfx] " Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Nouveau] " Maxime Ripard
2022-11-10 11:07 ` [PATCH v8 10/24] drm/modes: Fill drm_cmdline mode from named modes Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Nouveau] " Maxime Ripard
2022-11-10 11:07   ` [Intel-gfx] " Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07 ` [PATCH v8 11/24] drm/connector: Add pixel clock to cmdline mode Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Intel-gfx] " Maxime Ripard
2022-11-10 11:07   ` [Nouveau] " Maxime Ripard
2022-11-10 11:07 ` [PATCH v8 12/24] drm/connector: Add a function to lookup a TV mode by its name Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Intel-gfx] " Maxime Ripard
2022-11-10 11:07   ` [Nouveau] " Maxime Ripard
2022-11-10 23:11   ` Maíra Canal
2022-11-10 23:11     ` [Intel-gfx] " Maíra Canal
2022-11-10 23:11     ` Maíra Canal
2022-11-10 23:11     ` Maíra Canal
2022-11-10 23:11     ` [Nouveau] " Maíra Canal
2022-11-10 11:07 ` [PATCH v8 13/24] drm/modes: Introduce the tv_mode property as a command-line option Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Intel-gfx] " Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Nouveau] " Maxime Ripard
2022-11-10 11:07 ` [PATCH v8 14/24] drm/modes: Properly generate a drm_display_mode from a named mode Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Nouveau] " Maxime Ripard
2022-11-10 11:07   ` [Intel-gfx] " Maxime Ripard
2022-11-12 16:29   ` Noralf Trønnes
2022-11-12 16:29     ` Noralf Trønnes
2022-11-12 16:29     ` [Intel-gfx] " Noralf Trønnes
2022-11-12 16:29     ` Noralf Trønnes
2022-11-12 16:29     ` [Nouveau] " Noralf Trønnes
2022-11-10 11:07 ` [PATCH v8 15/24] drm/client: Remove match on mode name Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Nouveau] " Maxime Ripard
2022-11-10 11:07   ` [Intel-gfx] " Maxime Ripard
2022-11-12 16:30   ` Noralf Trønnes
2022-11-12 16:30     ` [Intel-gfx] " Noralf Trønnes
2022-11-12 16:30     ` Noralf Trønnes
2022-11-12 16:30     ` [Nouveau] " Noralf Trønnes
2022-11-12 16:30     ` Noralf Trønnes
2022-11-10 11:07 ` [PATCH v8 16/24] drm/modes: Introduce more named modes Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Intel-gfx] " Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Nouveau] " Maxime Ripard
2022-11-10 23:22   ` Maíra Canal
2022-11-10 23:22     ` Maíra Canal
2022-11-10 23:22     ` [Intel-gfx] " Maíra Canal
2022-11-10 23:22     ` Maíra Canal
2022-11-12 16:32   ` Noralf Trønnes
2022-11-12 16:32     ` Noralf Trønnes
2022-11-12 16:32     ` [Intel-gfx] " Noralf Trønnes
2022-11-12 16:32     ` Noralf Trønnes
2022-11-12 16:32     ` [Nouveau] " Noralf Trønnes
2022-11-10 11:07 ` [PATCH v8 17/24] drm/probe-helper: Provide a TV get_modes helper Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Intel-gfx] " Maxime Ripard
2022-11-10 11:07   ` [Nouveau] " Maxime Ripard
2022-11-10 23:29   ` Maíra Canal
2022-11-10 23:29     ` Maíra Canal
2022-11-10 23:29     ` [Intel-gfx] " Maíra Canal
2022-11-10 23:29     ` Maíra Canal
2022-11-10 23:29     ` [Nouveau] " Maíra Canal
2022-11-10 11:07 ` [PATCH v8 18/24] drm/atomic-helper: Add a TV properties reset helper Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Intel-gfx] " Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Nouveau] " Maxime Ripard
2022-11-10 11:07 ` [PATCH v8 19/24] drm/atomic-helper: Add an analog TV atomic_check implementation Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Intel-gfx] " Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Nouveau] " Maxime Ripard
2022-11-10 11:07 ` [PATCH v8 20/24] drm/vc4: vec: Use TV Reset implementation Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Intel-gfx] " Maxime Ripard
2022-11-10 11:07   ` [Nouveau] " Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07 ` [PATCH v8 21/24] drm/vc4: vec: Check for VEC output constraints Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Intel-gfx] " Maxime Ripard
2022-11-10 11:07   ` [Nouveau] " Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07 ` [PATCH v8 22/24] drm/vc4: vec: Convert to the new TV mode property Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Intel-gfx] " Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Nouveau] " Maxime Ripard
2022-11-10 11:07 ` [PATCH v8 23/24] drm/vc4: vec: Add support for more analog TV standards Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Intel-gfx] " Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Nouveau] " Maxime Ripard
2022-11-10 11:07 ` [PATCH v8 24/24] drm/sun4i: tv: Convert to the new TV mode property Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Intel-gfx] " Maxime Ripard
2022-11-10 11:07   ` Maxime Ripard
2022-11-10 11:07   ` [Nouveau] " Maxime Ripard
2022-11-11  1:40 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm: Analog TV Improvements (rev9) Patchwork
2022-11-11  1:40 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-11-11  2:10 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=28d35094-ac32-e589-274e-76f4b2408aec@riseup.net \
    --to=mairacanal@riseup.net \
    --cc=airlied@linux.ie \
    --cc=bskeggs@redhat.com \
    --cc=daniel@ffwll.ch \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=dom@raspberrypi.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emma@anholt.net \
    --cc=geert@linux-m68k.org \
    --cc=hdegoede@redhat.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=kfyatek+publicgit@gmail.com \
    --cc=kherbst@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=lyude@redhat.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=maxime@cerno.tech \
    --cc=mripard@kernel.org \
    --cc=noralf@tronnes.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=phil@raspberrypi.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=samuel@sholland.org \
    --cc=tvrtko.ursulin@linux.intel.com \
    --cc=tzimmermann@suse.de \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.