Commit cf1e6a90 authored by Maíra Canal's avatar Maíra Canal Committed by Melissa Wen

drm/tests: Split up test cases in igt_check_drm_format_min_pitch

The igt_check_drm_format_min_pitch() function had a lot of
KUNIT_EXPECT_* calls, all of which ended up allocating and initializing
various test assertion structures on the stack.

This behavior was producing -Wframe-larger-than warnings on PowerPC, i386,
and MIPS architectures, such as:

drivers/gpu/drm/tests/drm_format_test.c: In function 'igt_check_drm_format_min_pitch':
drivers/gpu/drm/tests/drm_format_test.c:271:1: error: the frame size of
3712 bytes is larger than 2048 bytes

So, the igt_check_drm_format_min_pitch() test case was split into three
smaller functions: one testing single plane formats, one testing
multi-planar formats, and the other testing tiled formats.

Fixes: 0421bb0b ("drm: selftest: convert drm_format selftest to KUnit")
Reported-by: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarMaíra Canal <mairacanal@riseup.net>
Tested-by: default avatarGuenter Roeck <linux@roeck-us.net>
Reviewed-by: default avatarAndré Almeida <andrealmeid@igalia.com>
Signed-off-by: default avatarMelissa Wen <melissa.srw@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220729124726.748221-1-mairacanal@riseup.net
parent 2ac6cdd5
...@@ -91,7 +91,7 @@ static void igt_check_drm_format_block_height(struct kunit *test) ...@@ -91,7 +91,7 @@ static void igt_check_drm_format_block_height(struct kunit *test)
KUNIT_EXPECT_FALSE(test, drm_format_info_block_height(info, -1)); KUNIT_EXPECT_FALSE(test, drm_format_info_block_height(info, -1));
} }
static void igt_check_drm_format_min_pitch(struct kunit *test) static void igt_check_drm_format_min_pitch_for_single_plane(struct kunit *test)
{ {
const struct drm_format_info *info = NULL; const struct drm_format_info *info = NULL;
...@@ -175,6 +175,11 @@ static void igt_check_drm_format_min_pitch(struct kunit *test) ...@@ -175,6 +175,11 @@ static void igt_check_drm_format_min_pitch(struct kunit *test)
(uint64_t)UINT_MAX * 4); (uint64_t)UINT_MAX * 4);
KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, (UINT_MAX - 1)), KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, (UINT_MAX - 1)),
(uint64_t)(UINT_MAX - 1) * 4); (uint64_t)(UINT_MAX - 1) * 4);
}
static void igt_check_drm_format_min_pitch_for_multi_planar(struct kunit *test)
{
const struct drm_format_info *info = NULL;
/* Test 2 planes format */ /* Test 2 planes format */
info = drm_format_info(DRM_FORMAT_NV12); info = drm_format_info(DRM_FORMAT_NV12);
...@@ -249,6 +254,11 @@ static void igt_check_drm_format_min_pitch(struct kunit *test) ...@@ -249,6 +254,11 @@ static void igt_check_drm_format_min_pitch(struct kunit *test)
(uint64_t)(UINT_MAX - 1) / 2); (uint64_t)(UINT_MAX - 1) / 2);
KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 2, (UINT_MAX - 1) / 2), KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 2, (UINT_MAX - 1) / 2),
(uint64_t)(UINT_MAX - 1) / 2); (uint64_t)(UINT_MAX - 1) / 2);
}
static void igt_check_drm_format_min_pitch_for_tiled_format(struct kunit *test)
{
const struct drm_format_info *info = NULL;
/* Test tiled format */ /* Test tiled format */
info = drm_format_info(DRM_FORMAT_X0L2); info = drm_format_info(DRM_FORMAT_X0L2);
...@@ -273,7 +283,9 @@ static void igt_check_drm_format_min_pitch(struct kunit *test) ...@@ -273,7 +283,9 @@ static void igt_check_drm_format_min_pitch(struct kunit *test)
static struct kunit_case drm_format_tests[] = { static struct kunit_case drm_format_tests[] = {
KUNIT_CASE(igt_check_drm_format_block_width), KUNIT_CASE(igt_check_drm_format_block_width),
KUNIT_CASE(igt_check_drm_format_block_height), KUNIT_CASE(igt_check_drm_format_block_height),
KUNIT_CASE(igt_check_drm_format_min_pitch), KUNIT_CASE(igt_check_drm_format_min_pitch_for_single_plane),
KUNIT_CASE(igt_check_drm_format_min_pitch_for_multi_planar),
KUNIT_CASE(igt_check_drm_format_min_pitch_for_tiled_format),
{ } { }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment