tests/kms_getfb: Add test for getfb
PATCH 1/1 tests/kms_getfb: Add test for getfb
Add a new test exercising the GetFB API, specifically including its behaviour of always returning new handles even if the client already has a handle to the GEM buffer.
--- tests/Makefile.sources | 1 + tests/kms_getfb.c | 158 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 3 files changed, 160 insertions(+) create mode 100644 tests/kms_getfb.c
tests/Makefile.sources +1 -0
@@ -189,6 +189,7 @@ TESTS_progs = \ kms_flip_tiling \ kms_force_connector_basic \ kms_frontbuffer_tracking \ + kms_getfb \ kms_hdmi_inject \ kms_invalid_dotclock \ kms_legacy_colorkey \
tests/kms_getfb.c new file +158 -0
158 lines not on this page · raw message
tests/meson.build +1 -0
@@ -166,6 +166,7 @@ test_progs = [ 'kms_flip_tiling', 'kms_force_connector_basic', 'kms_frontbuffer_tracking', + 'kms_getfb', 'kms_hdmi_inject', 'kms_invalid_dotclock', 'kms_legacy_colorkey',
Signature · 6 lines
2.16.2 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 80 lines · Daniel Stone
Add a new test exercising the GetFB API, specifically including its behaviour of always returning new handles even if the client already has a handle to the GEM buffer.
Signed-off-by Daniel Stone <[email protected]>--- tests/Makefile.sources | 1 + tests/kms_getfb.c | 158 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 3 files changed, 160 insertions(+) create mode 100644 tests/kms_getfb.ctests/Makefile.sources +1
-0@@ -189,6 +189,7 @@ TESTS_progs = \ kms_flip_tiling \ kms_force_connector_basic \ kms_frontbuffer_tracking \ + kms_getfb \ kms_hdmi_inject \ kms_invalid_dotclock \ kms_legacy_colorkey \tests/kms_getfb.c new file +50
-0@@ -0,0 +1,158 @@ +/* +* Copyright © 2013 Intel Corporation +* Copyright © 2018 Collabora, Ltd. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +* IN THE SOFTWARE. +* +* Authors: +* Daniel Vetter <[email protected]> +* Daniel Stone <[email protected]> +* +*/ + +#include "igt.h" +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <fcntl.h> +#include <inttypes.h> +#include <errno.h> +#include <sys/stat.h> +#include <sys/ioctl.h> +#include "drm.h" +#include "drm_fourcc.h" + +static void test_handle_input (int fd) +{ +struct drm_mode_fb_cmd2 add = {}; + + igt_fixture { + add.width =1024 ; + add.height =1024 ; + add.pixel_format =DRM_FORMAT_XRGB8888 ;
tests/kms_getfb.c line 60
Quoted 10 lines
tests/kms_getfb.c new file +10
-0+ add.pitches[0 ] =1024 *4 ; + add.handles[0 ] =igt_create_bo_with_dimensions (fd,1024 ,1024 , +DRM_FORMAT_XRGB8888 ,0 ,0 ,NULL ,NULL ,NULL ); +igt_assert (add.handles[0 ]); +do_ioctl (fd,DRM_IOCTL_MODE_ADDFB2 , &add); + } + + igt_subtest("getfb-handle-zero") { +struct drm_mode_fb_cmd get = { .fb_id =0 }; +do_ioctl_err (fd,DRM_IOCTL_MODE_GETFB , &get,ENOENT );
I wonder if the kernel should actually return -EINVAL for that one. Oh well, probably not much point in trying to change it now and risk something breaking.
Hmm. Actually the kernel now does radix_tree_lookup(&idr->idr_rt, id - idr->idr_base);
which looks a bit suspicious for the id < idr_base case. I don't think we use idr_base for kms stuff yet though, but we do for gem.
Anyways test looks all right to me
Quoted 117 lines
tests/kms_getfb.c new file +98
-0+ } + + igt_subtest("getfb-handle-valid") { +struct drm_mode_fb_cmd get = { .fb_id = add.fb_id }; +do_ioctl (fd,DRM_IOCTL_MODE_GETFB , &get); +igt_assert_neq_u32 (get.handle,0 ); +igt_assert_eq_u32 (get.width, add.width); +igt_assert_eq_u32 (get.height, add.height); +igt_assert_eq_u32 (get.pitch, add.pitches[0 ]); +igt_assert_eq_u32 (get.depth,24 ); +igt_assert_eq_u32 (get.bpp,32 ); +gem_close (fd, get.handle); + } + + igt_subtest("getfb-handle-closed") { +struct drm_mode_fb_cmd get = { .fb_id = add.fb_id }; +do_ioctl (fd,DRM_IOCTL_MODE_RMFB , &add.fb_id); +do_ioctl_err (fd,DRM_IOCTL_MODE_GETFB , &get,ENOENT ); + } + + igt_subtest("getfb-handle-not-fb") { +struct drm_mode_fb_cmd get = { }; +uint32_t prop_id =0 ; +igt_display_t display; + +/* Find a valid property ID to use. */ +igt_display_init (&display, fd); +for (int i =0 ; i < display.n_outputs; i++) { +igt_output_t *output = &display.outputs[i]; + +if (output->props[IGT_CONNECTOR_DPMS ] !=0 ) { + prop_id = output->props[IGT_CONNECTOR_DPMS ]; +break ; + } + } +igt_require (prop_id >0 ); + + get.fb_id = prop_id; +do_ioctl_err (fd,DRM_IOCTL_MODE_GETFB , &get,ENOENT ); + } +} + +static void test_duplicate_handles (int fd) +{ +struct drm_mode_fb_cmd2 add = {}; + + igt_fixture { + add.width =1024 ; + add.height =1024 ; + add.pixel_format =DRM_FORMAT_XRGB8888 ; + add.pitches[0 ] =1024 *4 ; + add.handles[0 ] =igt_create_bo_with_dimensions (fd,1024 ,1024 , +DRM_FORMAT_XRGB8888 ,0 ,0 ,NULL ,NULL ,NULL ); +igt_assert (add.handles[0 ]); +do_ioctl (fd,DRM_IOCTL_MODE_ADDFB2 , &add); + } + + igt_subtest("getfb-addfb-different-handles") { +struct drm_mode_fb_cmd get = { .fb_id = add.fb_id }; + +do_ioctl (fd,DRM_IOCTL_MODE_GETFB , &get); +igt_assert_neq_u32 (get.handle, add.handles[0 ]); +gem_close (fd, get.handle); + } + + igt_subtest("getfb-repeated-different-handles") { +struct drm_mode_fb_cmd get1 = { .fb_id = add.fb_id }; +struct drm_mode_fb_cmd get2 = { .fb_id = add.fb_id }; + +do_ioctl (fd,DRM_IOCTL_MODE_GETFB , &get1); +do_ioctl (fd,DRM_IOCTL_MODE_GETFB , &get2); +igt_assert_neq_u32 (get1.handle, get2.handle); + +gem_close (fd, get1.handle); +gem_close (fd, get2.handle); + } + + igt_fixture { +do_ioctl (fd,DRM_IOCTL_MODE_RMFB , &add.fb_id); +gem_close (fd, add.handles[0 ]); + } + +} + +igt_main +{ +int fd; + +igt_fixture + fd =drm_open_driver_master (DRIVER_ANY ); + +test_handle_input (fd); + +test_duplicate_handles (fd); + +igt_fixture +close (fd ); +}tests/meson.build +1
-0@@ -166,6 +166,7 @@ test_progs = [ 'kms_flip_tiling', 'kms_force_connector_basic', 'kms_frontbuffer_tracking', + 'kms_getfb', 'kms_hdmi_inject', 'kms_invalid_dotclock', 'kms_legacy_colorkey',Signature · 6 lines
2.16.2 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✓ Fi.CI.BAT: success for tests/kms_getfb: Add test for getfb
In reply to Daniel Stone== Series Details ==
== Series Details ==
Series: tests/kms_getfb: Add test for getfb
URL : https://patchwork.freedesktop.org/series/40370/
State : success
== Summary ==
IGT patchset tested on top of latest successful build ddc4ffb00e389a4dd584e8055eadf283dff69db5 lib: Don't fail if plane IN_FORMATS not present
with latest DRM-Tip kernel build CI_DRM_3959b54f7f729d38 drm-tip: 2018y-03m-21d-12h-01m-49s UTC integration manifest
Testlist changes:
+igt@kms_getfb@getfb-addfb-different-handles
+igt@kms_getfb@getfb-handle-closed
+igt@kms_getfb@getfb-handle-not-fb
+igt@kms_getfb@getfb-handle-valid
+igt@kms_getfb@getfb-handle-zero
+igt@kms_getfb@getfb-repeated-different-handles
---- Known issues:
Test debugfs_test:
Subgroup read_all_entries:
incomplete -> PASS (fi-snb-2520m) fdo#103713
Test gem_mmap_gtt:
Subgroup basic-small-bo-tiledx:
pass -> FAIL (fi-gdg-551) fdo#102575
Test prime_vgem:
Subgroup basic-fence-flip:
pass -> FAIL (fi-ilk-650) fdo#104008fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008
fi-bdw-5557u total:285 pass:264 dwarn:0 dfail:0 fail:0 skip:21 time:435s fi-bdw-gvtdvm total:285 pass:261 dwarn:0 dfail:0 fail:0 skip:24 time:450s fi-blb-e6850 total:285 pass:220 dwarn:1 dfail:0 fail:0 skip:64 time:380s fi-bsw-n3050 total:285 pass:239 dwarn:0 dfail:0 fail:0 skip:46 time:537s fi-bwr-2160 total:285 pass:180 dwarn:0 dfail:0 fail:0 skip:105 time:297s fi-bxt-dsi total:285 pass:255 dwarn:0 dfail:0 fail:0 skip:30 time:514s fi-bxt-j4205 total:285 pass:256 dwarn:0 dfail:0 fail:0 skip:29 time:511s fi-byt-j1900 total:285 pass:250 dwarn:0 dfail:0 fail:0 skip:35 time:518s fi-byt-n2820 total:285 pass:246 dwarn:0 dfail:0 fail:0 skip:39 time:503s fi-cfl-8700k total:285 pass:257 dwarn:0 dfail:0 fail:0 skip:28 time:410s fi-cfl-s2 total:285 pass:259 dwarn:0 dfail:0 fail:0 skip:26 time:568s fi-cfl-u total:285 pass:259 dwarn:0 dfail:0 fail:0 skip:26 time:511s fi-cnl-drrs total:285 pass:254 dwarn:3 dfail:0 fail:0 skip:28 time:521s fi-cnl-y3 total:285 pass:259 dwarn:0 dfail:0 fail:0 skip:26 time:584s fi-elk-e7500 total:285 pass:225 dwarn:1 dfail:0 fail:0 skip:59 time:417s fi-gdg-551 total:285 pass:176 dwarn:0 dfail:0 fail:1 skip:108 time:316s fi-glk-1 total:285 pass:257 dwarn:0 dfail:0 fail:0 skip:28 time:537s fi-hsw-4770 total:285 pass:258 dwarn:0 dfail:0 fail:0 skip:27 time:402s fi-ilk-650 total:285 pass:224 dwarn:0 dfail:0 fail:1 skip:60 time:418s fi-ivb-3520m total:285 pass:256 dwarn:0 dfail:0 fail:0 skip:29 time:466s fi-ivb-3770 total:285 pass:252 dwarn:0 dfail:0 fail:0 skip:33 time:433s fi-kbl-7500u total:285 pass:260 dwarn:1 dfail:0 fail:0 skip:24 time:477s fi-kbl-7567u total:285 pass:265 dwarn:0 dfail:0 fail:0 skip:20 time:467s fi-kbl-r total:285 pass:258 dwarn:0 dfail:0 fail:0 skip:27 time:512s fi-pnv-d510 total:285 pass:219 dwarn:1 dfail:0 fail:0 skip:65 time:654s fi-skl-6260u total:285 pass:265 dwarn:0 dfail:0 fail:0 skip:20 time:442s fi-skl-6600u total:285 pass:258 dwarn:0 dfail:0 fail:0 skip:27 time:533s fi-skl-6700k2 total:285 pass:261 dwarn:0 dfail:0 fail:0 skip:24 time:509s fi-skl-6770hq total:285 pass:265 dwarn:0 dfail:0 fail:0 skip:20 time:496s fi-skl-guc total:285 pass:257 dwarn:0 dfail:0 fail:0 skip:28 time:428s fi-skl-gvtdvm total:285 pass:262 dwarn:0 dfail:0 fail:0 skip:23 time:449s fi-snb-2520m total:285 pass:245 dwarn:0 dfail:0 fail:0 skip:40 time:592s fi-snb-2600 total:285 pass:245 dwarn:0 dfail:0 fail:0 skip:40 time:400s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1176/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 tests/kms_getfb: Add test for getfb
In reply to Daniel Stone== Series Details ==
== Series Details ==
Series: tests/kms_getfb: Add test for getfb
URL : https://patchwork.freedesktop.org/series/40370/
State : warning
== Summary ==
---- Possible new issues:
Test kms_frontbuffer_tracking:
Subgroup fbc-2p-scndscrn-pri-indfb-draw-mmap-gtt:
pass -> SKIP (shard-hsw)---- Known issues:
Test kms_flip:
Subgroup 2x-plain-flip-fb-recreate:
pass -> FAIL (shard-hsw) fdo#100368 +1
Subgroup flip-vs-modeset-vs-hang:
pass -> DMESG-WARN (shard-snb) fdo#103821
Test kms_frontbuffer_tracking:
Subgroup fbc-2p-scndscrn-spr-indfb-draw-mmap-wc:
pass -> SKIP (shard-hsw) fdo#101623 +1
Test kms_rotation_crc:
Subgroup sprite-rotation-180:
pass -> FAIL (shard-snb) fdo#103925
Test kms_setmode:
Subgroup basic:
fail -> WARN (shard-hsw) fdo#99912 +1
Test kms_sysfs_edid_timing:
pass -> WARN (shard-apl) fdo#100047fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#103821 https://bugs.freedesktop.org/show_bug.cgi?id=103821
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623
fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047
shard-apl total:3484 pass:1820 dwarn:1 dfail:0 fail:7 skip:1655 time:13104s shard-hsw total:3484 pass:1770 dwarn:1 dfail:0 fail:2 skip:1709 time:11790s shard-snb total:3484 pass:1362 dwarn:2 dfail:0 fail:3 skip:2117 time:7299s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1176/shards.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev