drm/tests: Fix endian warning
Subsystems (2)
PATCH 1/2 drm/tests: Fix endian warning
When compiling with sparse enabled, this warning is thrown:
warning: incorrect type in argument 2 (different base types)
expected restricted __le32 const [usertype] *buf got unsigned int [usertype] *[assigned] buf
Add a cast to fix it.
--- drivers/gpu/drm/tests/drm_format_helper_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tests/drm_format_helper_test.c +1 -1
@@ -1033,7 +1033,7 @@ static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test) NULL : &result->dst_pitch;drm_fb_xrgb8888_to_xrgb2101010 (&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state); - buf =le32buf_to_cpu (test, buf, dst_size /sizeof (u32)); + buf =le32buf_to_cpu (test, (__force const __le32 *)buf, dst_size /sizeof (u32));KUNIT_EXPECT_MEMEQ (test, buf, result->expected, dst_size); buf = dst.vaddr;/* restore original value of buf */
Signature · 1 line
2.50.0
PATCH 2/2 drm/tests: Fix drm_test_fb_xrgb8888_to_xrgb2101010() on big-endian
Fix failures on big-endian architectures on tests cases single_pixel_source_buffer, single_pixel_clip_rectangle, well_known_colors and destination_pitch.
--- drivers/gpu/drm/tests/drm_format_helper_test.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/tests/drm_format_helper_test.c +1 -0
@@ -1040,6 +1040,7 @@ static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test)memset (buf,0 , dst_size);drm_fb_xrgb8888_to_xrgb2101010 (&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state); + buf =le32buf_to_cpu (test, (__force const __le32 *)buf, dst_size /sizeof (u32));KUNIT_EXPECT_MEMEQ (test, buf, result->expected, dst_size); }
Signature · 1 line
2.50.0
Re: [PATCH 2/2] drm/tests: Fix drm_test_fb_xrgb8888_to_xrgb2101010() on big-endian
Am 30.06.25 um 11:00 schrieb José Expósito:
Quoted 6 lines
Fix failures on big-endian architectures on tests cases
single_pixel_source_buffer,single_pixel_clip_rectangle,well_known_colorsanddestination_pitch.Fixes 15bda1f8de5d ("drm/tests: Add calls to drm_fb_blit() on supported format conversion tests")Signed-off-by José Expósito <[email protected]>
Quoted 16 lines
--- drivers/gpu/drm/tests/drm_format_helper_test.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/tests/drm_format_helper_test.c +1
-0@@ -1040,6 +1040,7 @@ static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test)memset (buf,0 , dst_size);drm_fb_xrgb8888_to_xrgb2101010 (&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state); + buf =le32buf_to_cpu (test, (__force const __le32 *)buf, dst_size /sizeof (u32));KUNIT_EXPECT_MEMEQ (test, buf, result->expected, dst_size); }
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Re: [PATCH 2/2] drm/tests: Fix drm_test_fb_xrgb8888_to_xrgb2101010() on big-endian
Hi Thomas,
Quoted 11 lines · Thomas Zimmermann
Am 30.06.25 um 11:00 schrieb José Expósito:
Quoted 6 lines
Fix failures on big-endian architectures on tests cases
single_pixel_source_buffer,single_pixel_clip_rectangle,well_known_colorsanddestination_pitch.Fixes 15bda1f8de5d ("drm/tests: Add calls to drm_fb_blit() on supported format conversion tests")Signed-off-by José Expósito <[email protected]>Reviewed-by Thomas Zimmermann <[email protected]>
Just a friendly reminder about this patches. Can I merge them? They have been in the ML for a while and it doesn't look like there are concerns.
Best wishes,
Jose
Quoted 24 lines
Quoted 14 lines
--- drivers/gpu/drm/tests/drm_format_helper_test.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/tests/drm_format_helper_test.c +1
-0@@ -1040,6 +1040,7 @@ static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test)memset (buf,0 , dst_size);drm_fb_xrgb8888_to_xrgb2101010 (&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state); + buf =le32buf_to_cpu (test, (__force const __le32 *)buf, dst_size /sizeof (u32));KUNIT_EXPECT_MEMEQ (test, buf, result->expected, dst_size); }Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Re: [PATCH 2/2] drm/tests: Fix drm_test_fb_xrgb8888_to_xrgb2101010() on big-endian
Hi
Am 11.08.25 um 12:24 schrieb José Expósito:
Quoted 9 lines
Hi Thomas,
Quoted 6 lines · Thomas Zimmermann
Am 30.06.25 um 11:00 schrieb José Expósito:
Quoted 4 lines
Fix failures on big-endian architectures on tests cases
single_pixel_source_buffer,single_pixel_clip_rectangle,well_known_colorsanddestination_pitch.
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
Fixes 15bda1f8de5d ("drm/tests: Add calls to drm_fb_blit() on supported format conversion tests")Signed-off-by José Expósito <[email protected]>Reviewed-by Thomas Zimmermann <[email protected]>Just a friendly reminder about this patches. Can I merge them? They have been in the ML for a while and it doesn't look like there are concerns.
Merged into drm-misc-fixes now. Sorry for the delay.
Best regards
Thomas
Quoted 27 lines
Best wishes,
JoseQuoted 23 lines
Quoted 14 lines
--- drivers/gpu/drm/tests/drm_format_helper_test.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/tests/drm_format_helper_test.c +1
-0@@ -1040,6 +1040,7 @@ static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test)memset (buf,0 , dst_size);drm_fb_xrgb8888_to_xrgb2101010 (&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state); + buf =le32buf_to_cpu (test, (__force const __le32 *)buf, dst_size /sizeof (u32));KUNIT_EXPECT_MEMEQ (test, buf, result->expected, dst_size); }Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Am 30.06.25 um 11:00 schrieb José Expósito:
Quoted 10 lines
When compiling with sparse enabled, this warning is thrown:
warning: incorrect type in argument 2 (different base types)
expected restricted__le32const [usertype] *buf got unsigned int [usertype] *[assigned] bufAdd a cast to fix it.
Fixes 453114319699 ("drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_xrgb2101010()")Signed-off-by José Expósito <[email protected]>
Quoted 17 lines
--- drivers/gpu/drm/tests/drm_format_helper_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/tests/drm_format_helper_test.c +1
-1@@ -1033,7 +1033,7 @@ static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test) NULL : &result->dst_pitch;drm_fb_xrgb8888_to_xrgb2101010 (&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state); - buf =le32buf_to_cpu (test, buf, dst_size /sizeof (u32)); + buf =le32buf_to_cpu (test, (__force const __le32 *)buf, dst_size /sizeof (u32));KUNIT_EXPECT_MEMEQ (test, buf, result->expected, dst_size); buf = dst.vaddr;/* restore original value of buf */
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Quoted 19 lines · José Expósito
When compiling with sparse enabled, this warning is thrown:
warning: incorrect type in argument 2 (different base types)
expected restricted__le32const [usertype] *buf got unsigned int [usertype] *[assigned] bufAdd a cast to fix it.
Fixes 453114319699 ("drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_xrgb2101010()")Signed-off-by José Expósito <[email protected]>--- drivers/gpu/drm/tests/drm_format_helper_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/tests/drm_format_helper_test.c +0
-0
drivers/gpu/drm/tests/drm_format_helper_test.c static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test) · line 1039
Quoted 8 lines
drivers/gpu/drm/tests/drm_format_helper_test.c +1
-1@@ -1033,7 +1033,7 @@ static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test) NULL : &result->dst_pitch;drm_fb_xrgb8888_to_xrgb2101010 (&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state); - buf =le32buf_to_cpu (test, buf, dst_size /sizeof (u32)); + buf =le32buf_to_cpu (test, (__force const __le32 *)buf, dst_size /sizeof (u32));KUNIT_EXPECT_MEMEQ (test, buf, result->expected, dst_size); buf = dst.vaddr;/* restore original value of buf */
It might be cleaner to use two separate variables instead of using "buf" as both little endian and host byte order. (Same for patch 2)
Signature · 2 lines
Earthling Michel Dänzer \ GNOME / Xwayland / Mesa developer https://redhat.com \ Libre software enthusiast
Hey Michel,
Thanks for looking into this.
Quoted 22 lines · Michel Dänzer
Quoted 21 lines · José Expósito
When compiling with sparse enabled, this warning is thrown:
warning: incorrect type in argument 2 (different base types)
expected restricted__le32const [usertype] *buf got unsigned int [usertype] *[assigned] bufAdd a cast to fix it.
Fixes 453114319699 ("drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_xrgb2101010()")Signed-off-by José Expósito <[email protected]>--- drivers/gpu/drm/tests/drm_format_helper_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/tests/drm_format_helper_test.c +0
-0@@ -1033,7 +1033,7 @@ static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test) NULL : &result->dst_pitch;
Quoted 8 lines
drivers/gpu/drm/tests/drm_format_helper_test.c static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test) · line 1039
Quoted 6 lines
drivers/gpu/drm/tests/drm_format_helper_test.c +1
-1drm_fb_xrgb8888_to_xrgb2101010 (&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state); - buf =le32buf_to_cpu (test, buf, dst_size /sizeof (u32)); + buf =le32buf_to_cpu (test, (__force const __le32 *)buf, dst_size /sizeof (u32));KUNIT_EXPECT_MEMEQ (test, buf, result->expected, dst_size); buf = dst.vaddr;/* restore original value of buf */ It might be cleaner to use two separate variables instead of using "buf" as both little endian and host byte order. (Same for patch 2)
Yes, however, the same pattern is repeated 10 times in this file.
What do you think about fixing it in a follow up? I don't think it should block fixing the KUnit tests.
Jose
Quoted 4 lines
Signature · 3 lines
-- Earthling Michel Dänzer \ GNOME / Xwayland / Mesa developer https://redhat.com \ Libre software enthusiast
Quoted 32 lines · José Expósito
Hey Michel,
Thanks for looking into this.
Quoted 27 lines · Michel Dänzer
Quoted 26 lines · José Expósito
When compiling with sparse enabled, this warning is thrown:
warning: incorrect type in argument 2 (different base types)
expected restricted__le32const [usertype] *buf got unsigned int [usertype] *[assigned] bufAdd a cast to fix it.
Fixes 453114319699 ("drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_xrgb2101010()")Signed-off-by José Expósito <[email protected]>--- drivers/gpu/drm/tests/drm_format_helper_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/tests/drm_format_helper_test.c +1
-1@@ -1033,7 +1033,7 @@ static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test) NULL : &result->dst_pitch;drm_fb_xrgb8888_to_xrgb2101010 (&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state); - buf =le32buf_to_cpu (test, buf, dst_size /sizeof (u32)); + buf =le32buf_to_cpu (test, (__force const __le32 *)buf, dst_size /sizeof (u32));KUNIT_EXPECT_MEMEQ (test, buf, result->expected, dst_size);
Quoted 8 lines
Quoted 3 lines
drivers/gpu/drm/tests/drm_format_helper_test.c static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test) · line 1039
Quoted 1 line
drivers/gpu/drm/tests/drm_format_helper_test.c +0
-0buf = dst.vaddr;/* restore original value of buf */ It might be cleaner to use two separate variables instead of using "buf" as both little endian and host byte order. (Same for patch 2)
Yes, however, the same pattern is repeated 10 times in this file.
What do you think about fixing it in a follow up? I don't think it should block fixing the KUnit tests.
Ah, yes, makes sense to do it separately then.
Signature · 2 lines
Earthling Michel Dänzer \ GNOME / Xwayland / Mesa developer https://redhat.com \ Libre software enthusiast
Thomas Zimmermann
maintainerHi
Am 01.07.25 um 18:45 schrieb José Expósito:
Quoted 32 lines
Hey Michel,
Thanks for looking into this.
Quoted 27 lines · Michel Dänzer
Quoted 26 lines · José Expósito
When compiling with sparse enabled, this warning is thrown:
warning: incorrect type in argument 2 (different base types)
expected restricted__le32const [usertype] *buf got unsigned int [usertype] *[assigned] bufAdd a cast to fix it.
Fixes 453114319699 ("drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_xrgb2101010()")Signed-off-by José Expósito <[email protected]>--- drivers/gpu/drm/tests/drm_format_helper_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/tests/drm_format_helper_test.c +1
-1@@ -1033,7 +1033,7 @@ static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test) NULL : &result->dst_pitch;drm_fb_xrgb8888_to_xrgb2101010 (&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state); - buf =le32buf_to_cpu (test, buf, dst_size /sizeof (u32)); + buf =le32buf_to_cpu (test, (__force const __le32 *)buf, dst_size /sizeof (u32));KUNIT_EXPECT_MEMEQ (test, buf, result->expected, dst_size);
Quoted 6 lines
Quoted 2 lines
drivers/gpu/drm/tests/drm_format_helper_test.c static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test) · line 1039
Quoted 1 line
drivers/gpu/drm/tests/drm_format_helper_test.c +0
-0buf = dst.vaddr;/* restore original value of buf */ It might be cleaner to use two separate variables instead of using "buf" as both little endian and host byte order. (Same for patch 2)
Yes, however, the same pattern is repeated 10 times in this file.
What do you think about fixing it in a follow up? I don't think it should block fixing the KUnit tests.
Before doing this, you should consider storing the test data in little-endian. That would save all the endianess conversion in the code.
Best regards
Thomas
Quoted 6 lines
Jose
Quoted 3 lines
Signature · 2 lines
Earthling Michel Dänzer \ GNOME / Xwayland / Mesa developer https://redhat.com \ Libre software enthusiast
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)