lib: Add igt_plane_has_format() etc. for pre-blobifier drivers
PATCH 1/3 lib: Add igt_plane_has_format() etc. for pre-blobifier drivers
From: Ville Syrjälä <[email protected]>
For drivers that don't support the IN_FORMATS blob we should just consult the format list returned by getplane. Let's add a few helpers to check a specific format against that list, and also let's make the format+modifier use the same list. Since we can't tell which modifiers are supported without IN_FORMATS we'll just assume that linear should work, and everything else should not.
--- lib/igt_kms.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ lib/igt_kms.h | 2 ++ 2 files changed, 46 insertions(+)
lib/igt_kms.c +44 -0
@@ -3901,11 +3901,31 @@ static void igt_fill_plane_format_mod(igt_display_t *display, igt_plane_t *planeigt_assert_eq (idx, plane->format_mod_count); } +bool igt_plane_has_format (igt_plane_t *plane,uint32_t format) +{ +drmModePlanePtr p = plane->drm_plane; + +for (int i =0 ; i < p->count_formats; i++) { +if (p->formats[i] == format) +return true; + } + +return false; +} +bool igt_plane_has_format_mod (igt_plane_t *plane,uint32_t format,uint64_t modifier) {int i; +if (plane->format_mod_count ==0 ) { +/* we can't tell what's supported so assume only linear */ +if (modifier !=DRM_FORMAT_MOD_LINEAR ) +return false; + +return igt_plane_has_format (plane, format); + } +for (i =0 ; i < plane->format_mod_count; i++) {if (plane->formats[i] == format && plane->modifiers[i] == modifier)
@@ -3977,11 +3997,35 @@ static void igt_fill_display_format_mod(igt_display_t *display) } } +bool igt_display_has_format (igt_display_t *display,uint32_t format) +{ +enum pipe pipe; + +for_each_pipe (display, pipe) { +igt_plane_t *plane; + +for_each_plane_on_pipe (display, pipe, plane) { +if (igt_plane_has_format (plane, format)) +return true; + } + } + +return false; +} +bool igt_display_has_format_mod (igt_display_t *display,uint32_t format,uint64_t modifier) {int i; +if (display->format_mod_count ==0 ) { +/* we can't tell what's supported so assume only linear */ +if (modifier !=DRM_FORMAT_MOD_LINEAR ) +return false; + +return igt_display_has_format (display, format); + } +for (i =0 ; i < display->format_mod_count; i++) {if (display->formats[i] == format && display->modifiers[i] == modifier)
lib/igt_kms.h +2 -0
@@ -680,7 +680,9 @@ bool igt_hotplug_detected(struct udev_monitor *mon,void igt_flush_hotplugs (struct udev_monitor *mon);void igt_cleanup_hotplug (struct udev_monitor *mon); +bool igt_display_has_format (igt_display_t *display,uint32_t format);bool igt_display_has_format_mod (igt_display_t *display,uint32_t format,uint64_t modifier); +bool igt_plane_has_format (igt_plane_t *plane,uint32_t format);bool igt_plane_has_format_mod (igt_plane_t *plane,uint32_t format,uint64_t modifier);#endif /* __IGT_KMS_H__ */
Signature · 6 lines
2.16.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 2/3 tests/kms_plane: Add validate-in-formats subtest
From: Ville Syrjälä <[email protected]>
Cross check the format list in the IN_FORMATS blob vs. the format list returned by getplane.
--- tests/kms_plane.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
tests/kms_plane.c +50 -0
@@ -366,6 +366,53 @@ test_plane_panning(data_t *data, enum pipe pipe, unsigned int flags)igt_skip_on (connected_outs ==0 ); } +static void validate_plane_in_formats (igt_plane_t *plane) +{ +drmModePlanePtr drm_plane = plane->drm_plane; + +igt_require (plane->format_mod_count); + +/* +* Make sure every format in the IN_FORMATS blob +* also appears in the getplane formats. +*/ +for (int i =0 ; i < plane->format_mod_count; i++) { +int j; + +for (j =0 ; i < drm_plane->count_formats; j++) { +if (plane->formats[i] == drm_plane->formats[j]) +break ; + } +igt_assert_lt (j, drm_plane->count_formats); + } + +/* +* Make sure every format in getplane also +* appears in the IN_FORMATS blob. +*/ +for (int i =0 ; i < drm_plane->count_formats; i++) { +int j; + +for (j =0 ; i < plane->format_mod_count; j++) { +if (drm_plane->formats[i] == plane->formats[i]) +break ; + } +igt_assert_lt (j, plane->format_mod_count); + } +} + +static void validate_in_formats (data_t *data) +{ +enum pipe pipe; + +for_each_pipe (&data->display, pipe) { +igt_plane_t *plane; + +for_each_plane_on_pipe (&data->display, pipe, plane) +validate_plane_in_formats (plane); + } +} +static void test_format_plane (data_t *data,enum pipe pipe,igt_output_t *output,igt_plane_t *plane) {
@@ -506,6 +553,9 @@ igt_mainigt_display_init (&data.display, data.drm_fd); } + igt_subtest_f("validate-in-formats") +validate_in_formats (&data); +for_each_pipe_static (pipe)run_tests_for_pipe_plane (&data, pipe);
Signature · 6 lines
2.16.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH v2 3/3 tests/kms_addfb_basic: Check that addfb2 accepts/rejects the expected formats
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
Try to create a bunch of fbs with different formats/modfifiers and make sure sure addfb2 accepts/rejects them in accordance with what the plane IN_FORMATS blobifiers are advertizing.
We only check "easy" formats (ie. RGB/C8, no YUV/planar etc.). We also assume that one can always create a 64x64 fb with stride of 64*8 bytes.
v2: Skip when blobifiers aren't supported
--- tests/kms_addfb_basic.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 97 insertions(+), 3 deletions(-)
tests/kms_addfb_basic.c +97 -3
@@ -41,6 +41,90 @@uint32_t gem_bo;uint32_t gem_bo_small; +static uint64_t modifiers[] = { +DRM_FORMAT_MOD_LINEAR , +I915_FORMAT_MOD_X_TILED , +I915_FORMAT_MOD_Y_TILED , + I915_FORMAT_MOD_Yf_TILED, +I915_FORMAT_MOD_Y_TILED_CCS , + I915_FORMAT_MOD_Yf_TILED_CCS, +}; + +static const uint32_t formats[] = { +DRM_FORMAT_C8 , + +DRM_FORMAT_RGB565 , +DRM_FORMAT_BGR565 , + +DRM_FORMAT_RGB888 , +DRM_FORMAT_BGR888 , + +DRM_FORMAT_XRGB8888 , +DRM_FORMAT_XBGR8888 , +DRM_FORMAT_RGBX8888 , +DRM_FORMAT_BGRX8888 , +DRM_FORMAT_ARGB8888 , +DRM_FORMAT_ABGR8888 , +DRM_FORMAT_RGBA8888 , +DRM_FORMAT_BGRA8888 , + +DRM_FORMAT_XRGB2101010 , +DRM_FORMAT_XBGR2101010 , +DRM_FORMAT_RGBX1010102 , +DRM_FORMAT_BGRX1010102 , +DRM_FORMAT_ARGB2101010 , +DRM_FORMAT_ABGR2101010 , +DRM_FORMAT_RGBA1010102 , +DRM_FORMAT_BGRA1010102 , +}; + +/* +* make sure addfb2 accepts/rejects every format/modifier +* in accordance with the plane IN_FORMATS properties. +*/ +static void expected_formats (igt_display_t *display) +{ +int fd = display->drm_fd; +uint32_t handle; + +igt_require (display->format_mod_count); + + handle =gem_create (fd,64 *8 *64 ); +igt_assert (handle); + +for (int i =0 ; i <ARRAY_SIZE (formats); i++) { +uint32_t format = formats[i]; + +for (int j =0 ; j <ARRAY_SIZE (modifiers); j++) { +uint64_t modifier = modifiers[j]; +struct drm_mode_fb_cmd2 f = { + .width =64 , + .height =64 , + .pixel_format = format, + .handles[0 ] = handle, + .pitches[0 ] =64 *8 , + .modifier[0 ] = modifier, + .flags =DRM_MODE_FB_MODIFIERS , + }; +int ret; + + ret =drmIoctl (fd,DRM_IOCTL_MODE_ADDFB2 , &f); + +if (igt_display_has_format_mod (display, format, modifier)) { +igt_assert_eq (ret,0 ); +igt_assert_neq (f.fb_id,0 ); + }else { +igt_assert_neq (ret,0 ); +igt_assert_eq (f.fb_id,0 ); + } + +drmIoctl (fd,DRM_IOCTL_MODE_RMFB , &f.fb_id); + } + } + +gem_close (fd, handle); +} +static void invalid_tests (int fd) {struct local_drm_mode_fb_cmd2 f = {};
@@ -539,13 +623,17 @@ static void prop_tests(int fd) } -int fd; +static igt_display_t display; +static int fd;igt_main { -igt_fixture + igt_fixture { fd =drm_open_driver_master (DRIVER_ANY ); +igt_display_init (&display, fd); + } +invalid_tests (fd);pitch_tests (fd);
@@ -560,6 +648,12 @@ igt_mainprop_tests (fd); -igt_fixture + igt_subtest("expected-formats") +expected_formats (&display); + + igt_fixture { +igt_display_fini (&display); +close (fd); + } }
Signature · 6 lines
2.16.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] lib: Add igt_plane_has_format() etc. for pre-blobifier drivers
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: series starting with [i-g-t,1/3] lib: Add igt_plane_has_format() etc. for pre-blobifier drivers
URL : https://patchwork.freedesktop.org/series/40113/
State : success
== Summary ==
IGT patchset tested on top of latest successful build 98f7614bd725afaae48f7b70d18329149075661b lib: Parse plane IN_FORMATS blobifiers into a nicer form
with latest DRM-Tip kernel build CI_DRM_394266a3be2efe09 drm-tip: 2018y-03m-16d-16h-32m-51s UTC integration manifest
Testlist changes:
+igt@kms_addfb_basic@expected-formats
+igt@kms_plane@validate-in-formats
---- Known issues:
Test gem_mmap_gtt:
Subgroup basic-small-bo-tiledx:
pass -> FAIL (fi-gdg-551) fdo#102575
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-b:
pass -> INCOMPLETE (fi-snb-2520m) fdo#103713fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fi-bdw-5557u total:285 pass:264 dwarn:0 dfail:0 fail:0 skip:21 time:436s fi-bdw-gvtdvm total:285 pass:261 dwarn:0 dfail:0 fail:0 skip:24 time:443s fi-blb-e6850 total:285 pass:220 dwarn:1 dfail:0 fail:0 skip:64 time:382s fi-bsw-n3050 total:285 pass:239 dwarn:0 dfail:0 fail:0 skip:46 time:544s fi-bwr-2160 total:285 pass:180 dwarn:0 dfail:0 fail:0 skip:105 time:305s fi-bxt-j4205 total:285 pass:256 dwarn:0 dfail:0 fail:0 skip:29 time:519s fi-byt-j1900 total:285 pass:250 dwarn:0 dfail:0 fail:0 skip:35 time:524s fi-byt-n2820 total:285 pass:246 dwarn:0 dfail:0 fail:0 skip:39 time:515s fi-cfl-8700k total:285 pass:257 dwarn:0 dfail:0 fail:0 skip:28 time:409s fi-cfl-s2 total:285 pass:259 dwarn:0 dfail:0 fail:0 skip:26 time:588s fi-cfl-u total:285 pass:259 dwarn:0 dfail:0 fail:0 skip:26 time:512s fi-cnl-drrs total:285 pass:254 dwarn:3 dfail:0 fail:0 skip:28 time:535s fi-cnl-y3 total:285 pass:259 dwarn:0 dfail:0 fail:0 skip:26 time:597s fi-elk-e7500 total:285 pass:225 dwarn:1 dfail:0 fail:0 skip:59 time:433s fi-gdg-551 total:285 pass:176 dwarn:0 dfail:0 fail:1 skip:108 time:326s fi-glk-1 total:285 pass:257 dwarn:0 dfail:0 fail:0 skip:28 time:540s fi-hsw-4770 total:285 pass:258 dwarn:0 dfail:0 fail:0 skip:27 time:405s fi-ilk-650 total:285 pass:225 dwarn:0 dfail:0 fail:0 skip:60 time:421s fi-ivb-3520m total:285 pass:256 dwarn:0 dfail:0 fail:0 skip:29 time:479s fi-ivb-3770 total:285 pass:252 dwarn:0 dfail:0 fail:0 skip:33 time:434s fi-kbl-7500u total:285 pass:260 dwarn:1 dfail:0 fail:0 skip:24 time:478s fi-kbl-7567u total:285 pass:265 dwarn:0 dfail:0 fail:0 skip:20 time:472s fi-kbl-r total:285 pass:258 dwarn:0 dfail:0 fail:0 skip:27 time:525s fi-pnv-d510 total:285 pass:219 dwarn:1 dfail:0 fail:0 skip:65 time:666s fi-skl-6260u total:285 pass:265 dwarn:0 dfail:0 fail:0 skip:20 time:447s fi-skl-6600u total:285 pass:258 dwarn:0 dfail:0 fail:0 skip:27 time:530s fi-skl-6700hq total:285 pass:259 dwarn:0 dfail:0 fail:0 skip:26 time:541s fi-skl-6700k2 total:285 pass:261 dwarn:0 dfail:0 fail:0 skip:24 time:503s fi-skl-6770hq total:285 pass:265 dwarn:0 dfail:0 fail:0 skip:20 time:514s fi-skl-guc total:285 pass:257 dwarn:0 dfail:0 fail:0 skip:28 time:431s fi-skl-gvtdvm total:285 pass:262 dwarn:0 dfail:0 fail:0 skip:23 time:450s fi-snb-2520m total:242 pass:208 dwarn:0 dfail:0 fail:0 skip:33 fi-snb-2600 total:285 pass:245 dwarn:0 dfail:0 fail:0 skip:40 time:407s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1154/issues.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✗ Fi.CI.IGT: warning for series starting with [i-g-t,1/3] lib: Add igt_plane_has_format() etc. for pre-blobifier drivers
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: series starting with [i-g-t,1/3] lib: Add igt_plane_has_format() etc. for pre-blobifier drivers
URL : https://patchwork.freedesktop.org/series/40113/
State : warning
== Summary ==
---- Possible new issues:
Test kms_cursor_crc:
Subgroup cursor-128x128-suspend:
skip -> PASS (shard-snb)
Test pm_rc6_residency:
Subgroup rc6-accuracy:
pass -> SKIP (shard-snb)---- Known issues:
Test kms_flip:
Subgroup flip-vs-absolute-wf_vblank-interruptible:
pass -> FAIL (shard-hsw) fdo#100368
Test kms_rotation_crc:
Subgroup sprite-rotation-90:
pass -> FAIL (shard-apl) fdo#105185 +1
Test kms_sysfs_edid_timing:
pass -> WARN (shard-apl) fdo#100047
Test perf:
Subgroup polling:
pass -> FAIL (shard-hsw) fdo#102252 +1fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#105185 https://bugs.freedesktop.org/show_bug.cgi?id=105185
fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
shard-apl total:3406 pass:1793 dwarn:1 dfail:0 fail:9 skip:1601 time:12680s shard-hsw total:3444 pass:1767 dwarn:1 dfail:0 fail:4 skip:1671 time:11894s shard-snb total:3444 pass:1358 dwarn:1 dfail:0 fail:4 skip:2081 time:7259s
Blacklisted hosts:
shard-kbl total:3376 pass:1872 dwarn:30 dfail:0 fail:9 skip:1463 time:9422s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1154/shards.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev