lib/fb: introduce __igt_create_fb_with_bo_size() and __igt_create_fb()
Subsystems (2)
PATCH v4 1/2 lib/fb: introduce __igt_create_fb_with_bo_size() and __igt_create_fb()
They are the same as their non-underscored counterparts, except they will return the error rather than dying when an error occurs.
v2: (suggested by Ville Syrjälä)
- drop the fb_id out parameter, it can be accessed from fb->fb_id.
--- lib/igt_fb.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++---------- lib/igt_fb.h | 7 +++++ 2 files changed, 85 insertions(+), 15 deletions(-)
lib/igt_fb.c +78 -15
@@ -759,18 +759,18 @@ void igt_paint_image(cairo_t *cr, const char *filename,* The backing storage of the framebuffer is filled with all zeros, i.e. black * for rgb pixel formats. * -* Returns: -* The kms id of the created framebuffer. +* Returns: 0 in case of success, the error otherwise. The fb_id can be found +* in fb->fb_id. */ -unsigned int -igt_create_fb_with_bo_size (int fd,int width,int height, -uint32_t format,uint64_t tiling, -struct igt_fb *fb,unsigned bo_size, -unsigned bo_stride) +int +__igt_create_fb_with_bo_size (int fd,int width,int height, +uint32_t format,uint64_t tiling, +struct igt_fb *fb,unsigned bo_size, +unsigned bo_stride) {struct format_desc_struct *f =lookup_drm_format (format);uint32_t fb_id; -int i; +int ret, i;igt_assert_f (f,"DRM format %08x not found\n" , format);
@@ -789,9 +789,14 @@ igt_create_fb_with_bo_size(int fd, int width, int height,if (tiling !=LOCAL_DRM_FORMAT_MOD_NONE && tiling !=LOCAL_I915_FORMAT_MOD_X_TILED ) { -do_or_die (__kms_addfb (fd, fb->gem_handle, width, height, - fb->stride, format, tiling, fb->offsets, -LOCAL_DRM_MODE_FB_MODIFIERS , &fb_id)); + ret =__kms_addfb (fd, fb->gem_handle, width, height, + fb->stride, format, tiling, fb->offsets, +LOCAL_DRM_MODE_FB_MODIFIERS , &fb_id); +if (ret) { +igt_debug ("%s: __kms_addfb() failed: %d (%s)\n" , + __func__, errno,strerror (errno)); +return ret; + } }else {uint32_t handles[4 ];uint32_t pitches[4 ];
@@ -806,9 +811,14 @@ igt_create_fb_with_bo_size(int fd, int width, int height, pitches[i] = fb->stride; } -do_or_die (drmModeAddFB2 (fd, width, height, format, - handles, pitches, fb->offsets, - &fb_id,0 )); + ret =drmModeAddFB2 (fd, width, height, format, + handles, pitches, fb->offsets, + &fb_id,0 ); +if (ret) { +igt_debug ("%s: drmModeAddFB2() failed: %d (%s)\n" , + __func__, errno,strerror (errno)); +return ret; + } } fb->width = width;
@@ -829,7 +839,39 @@ igt_create_fb_with_bo_size(int fd, int width, int height, fb->plane_width[i] =planar_width (f, width, i); } -return fb_id; +return 0 ; +} + +/** +* igt_create_fb_with_bo_size: +* @fd: open i915 drm file descriptor +* @width: width of the framebuffer in pixel +* @height: height of the framebuffer in pixel +* @format: drm fourcc pixel format code +* @tiling: tiling layout of the framebuffer (as framebuffer modifier) +* @fb: pointer to an #igt_fb structure +* @bo_size: size of the backing bo (0 for automatic size) +* @bo_stride: stride of the backing bo (0 for automatic stride) +* +* This function allocates a gem buffer object suitable to back a framebuffer +* with the requested properties and then wraps it up in a drm framebuffer +* object of the requested size. All metadata is stored in @fb. +* +* The backing storage of the framebuffer is filled with all zeros, i.e. black +* for rgb pixel formats. +* +* Returns: +* The kms id of the created framebuffer. +*/ +unsigned int +igt_create_fb_with_bo_size (int fd,int width,int height, +uint32_t format,uint64_t tiling, +struct igt_fb *fb,unsigned bo_size, +unsigned bo_stride) +{ +do_or_die (__igt_create_fb_with_bo_size (fd, width, height, format, + tiling, fb, bo_size, bo_stride)); +return fb->fb_id; }/**
@@ -858,6 +900,27 @@ unsigned int igt_create_fb(int fd, int width, int height, uint32_t format, 0, 0); } +/** +* __igt_create_fb: +* @fd: open i915 drm file descriptor +* @width: width of the framebuffer in pixel +* @height: height of the framebuffer in pixel +* @format: drm fourcc pixel format code +* @tiling: tiling layout of the framebuffer +* @fb: pointer to an #igt_fb structure +* +* Same as igt_create_fb, but return an error if it failed rather than failing. +* +* Returns: 0 in case of success, the error otherwise. The fb_id can be found +* in fb->fb_id. +*/ +int __igt_create_fb (int fd,int width,int height,uint32_t format, +uint64_t tiling,struct igt_fb *fb) +{ +return __igt_create_fb_with_bo_size (fd, width, height, format, tiling, + fb,0 ,0 ); +} +/** * igt_create_color_fb: * @fd: open i915 drm file descriptor
lib/igt_fb.h +7 -0
@@ -102,11 +102,18 @@ void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp, unsigned *width_ret, unsigned *height_ret);void igt_calc_fb_size (int fd,int width,int height,uint32_t format,uint64_t tiling,unsigned *size_ret,unsigned *stride_ret); +int +__igt_create_fb_with_bo_size (int fd,int width,int height, +uint32_t format,uint64_t tiling, +struct igt_fb *fb,unsigned bo_size, +unsigned bo_stride);unsigned int igt_create_fb_with_bo_size (int fd,int width,int height,uint32_t format,uint64_t tiling,struct igt_fb *fb,unsigned bo_size,unsigned bo_stride); +int __igt_create_fb (int fd,int width,int height,uint32_t format, +uint64_t tiling,struct igt_fb *fb);unsigned int igt_create_fb (int fd,int width,int height,uint32_t format,uint64_t tiling,struct igt_fb *fb); unsigned int igt_create_color_fb(int fd, int width, int height,
Signature · 6 lines
2.16.2 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH v4 2/2 add a kms_fb_stride test
This test checks what strides are actually supported by each plane of each pipe. The tested strides are 4K, 8K, and 16K. The tested formats are DRM_FORMAT_RGB565 (16 bits) and DRM_FORMAT_XRGB8888 (32 bits).
To verify that the display controler is OK with the stride, the test uses the pipe crc and verifies that a test image blitted to a hdisplay x vdisplay framebuffer appears the same when blitted to a stride x vdisplay framebuffer (with stride varying from 4K to 16K).
v2:
- SKIP when a stride/format is not supported by the kernel
- perform a modeset at a low resolution on all pipes before running a test in order to be fast and provide coverage even without a display attached (requires a VGA or HDMI connector).
- generate a subtest per pipe, plane, format and stride
v3:
- if no VGA or HDMI connectors are found, fallback to any connected connector
v4: comments from Ville Syrjälä
- make get_lowres_mode return a mode from the wanted connector
--- tests/Makefile.sources | 1 + tests/kms_fb_stride.c | 298 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 3 files changed, 300 insertions(+) create mode 100644 tests/kms_fb_stride.c
tests/Makefile.sources +1 -0
@@ -181,6 +181,7 @@ TESTS_progs = \ kms_cursor_legacy \ kms_draw_crc \ kms_fbcon_fbt \ + kms_fb_stride \ kms_fence_pin_leak \ kms_flip \ kms_flip_event_leak \
tests/kms_fb_stride.c new file +298 -0
298 lines not on this page · raw message
tests/meson.build +1 -0
@@ -159,6 +159,7 @@ test_progs = [ 'kms_cursor_legacy', 'kms_draw_crc', 'kms_fbcon_fbt', + 'kms_fb_stride', 'kms_fence_pin_leak', 'kms_flip', 'kms_flip_event_leak',
Signature · 6 lines
2.16.2 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t v4 2/2] add a kms_fb_stride test
Quoted 16 lines · Martin Peres
This test checks what strides are actually supported by each plane of each pipe. The tested strides are 4K, 8K, and 16K. The tested formats are
DRM_FORMAT_RGB565(16 bits) andDRM_FORMAT_XRGB8888(32 bits).To verify that the display controler is OK with the stride, the test uses the pipe crc and verifies that a test image blitted to a hdisplay x vdisplay framebuffer appears the same when blitted to a stride x vdisplay framebuffer (with stride varying from 4K to 16K).
v2:
- SKIP when a stride/format is not supported by the kernel
- perform a modeset at a low resolution on all pipes before running a test in order to be fast and provide coverage even without a display attached (requires a VGA or HDMI connector).
- generate a subtest per pipe, plane, format and stride
Quoted 7 lines
v3:
- if no VGA or HDMI connectors are found, fallback to any connected connectorv4: comments from Ville Syrjälä
- makeget_lowres_modereturn a mode from the wanted connector
Hello Martin,
I know that there will be a new version of this patches, so maybe you could add IGT_TEST_DESCRIPTION to new test and check with checkpatch.pl for some style changes?
Patch with test looks good, but I wait with review for new version.
Kasia
Quoted 7 lines
Signature · 6 lines
2.16.2 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
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,v4,1/2] lib/fb: introduce __igt_create_fb_with_bo_size() and __igt_create_fb()
In reply to Martin Peres== Series Details ==
== Series Details ==
Series: series starting with [i-g-t,v4,1/2] lib/fb: introduce __igt_create_fb_with_bo_size() and __igt_create_fb()
URL : https://patchwork.freedesktop.org/series/38960/
State : success
== Summary ==
IGT patchset tested on top of latest successful build dd82bdfa86f2086858e2a4bb554aad08a212604e igt/kms_force_connector_basic: Clear any previous connector override
with latest DRM-Tip kernel build CI_DRM_38343a86cab57850 drm-tip: 2018y-02m-26d-15h-41m-02s UTC integration manifest
Testlist changes:
+++ 144 lines
--- 0 lines
---- Known issues:
Test debugfs_test:
Subgroup read_all_entries:
incomplete -> PASS (fi-snb-2520m) fdo#103713fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fi-bdw-5557u total:288 pass:267 dwarn:0 dfail:0 fail:0 skip:21 time:418s fi-bdw-gvtdvm total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:426s fi-blb-e6850 total:288 pass:223 dwarn:1 dfail:0 fail:0 skip:64 time:376s fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:482s fi-bwr-2160 total:288 pass:183 dwarn:0 dfail:0 fail:0 skip:105 time:287s fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:487s fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:474s fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:456s fi-cfl-8700k total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:395s fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:561s fi-cnl-y3 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:573s fi-elk-e7500 total:288 pass:229 dwarn:0 dfail:0 fail:0 skip:59 time:415s fi-gdg-551 total:288 pass:179 dwarn:0 dfail:0 fail:1 skip:108 time:287s fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:508s fi-hsw-4770 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:387s fi-ilk-650 total:288 pass:228 dwarn:0 dfail:0 fail:0 skip:60 time:410s fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:455s fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:411s fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:451s fi-kbl-7560u total:288 pass:269 dwarn:0 dfail:0 fail:0 skip:19 time:491s fi-kbl-7567u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:449s fi-kbl-r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:493s fi-pnv-d510 total:288 pass:222 dwarn:1 dfail:0 fail:0 skip:65 time:571s fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:427s fi-skl-6600u total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:504s fi-skl-6700hq total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:521s fi-skl-6700k2 total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:485s fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:476s fi-skl-guc total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:408s fi-skl-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:431s fi-snb-2520m total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:517s fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:405s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1006/issues.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,v4,1/2] lib/fb: introduce __igt_create_fb_with_bo_size() and __igt_create_fb()
In reply to Martin Peres== Series Details ==
== Series Details ==
Series: series starting with [i-g-t,v4,1/2] lib/fb: introduce __igt_create_fb_with_bo_size() and __igt_create_fb()
URL : https://patchwork.freedesktop.org/series/38960/
State : success
== Summary ==
---- Possible new issues:
Test kms_cursor_crc:
Subgroup cursor-256x256-dpms:
pass -> FAIL (shard-apl)
Test kms_vblank:
Subgroup pipe-b-query-idle:
pass -> SKIP (shard-snb)
Subgroup pipe-c-ts-continuation-dpms-suspend:
pass -> INCOMPLETE (shard-hsw)---- Known issues:
Test gem_eio:
Subgroup in-flight:
pass -> INCOMPLETE (shard-apl) fdo#104945
Test kms_flip:
Subgroup dpms-vs-vblank-race-interruptible:
fail -> PASS (shard-hsw) fdo#103060
Subgroup flip-vs-expired-vblank:
pass -> FAIL (shard-hsw) fdo#102887
Test kms_flip_tiling:
Subgroup flip-yf-tiled:
fail -> PASS (shard-apl) fdo#103822
Test kms_rotation_crc:
Subgroup primary-rotation-180:
fail -> PASS (shard-hsw) fdo#103925 +1
Test kms_setmode:
Subgroup basic:
fail -> PASS (shard-hsw) fdo#99912 +1fdo#104945 https://bugs.freedesktop.org/show_bug.cgi?id=104945
fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#103822 https://bugs.freedesktop.org/show_bug.cgi?id=103822
fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
shard-apl total:3594 pass:1844 dwarn:1 dfail:0 fail:7 skip:1740 time:12031s shard-hsw total:3522 pass:1734 dwarn:1 dfail:0 fail:2 skip:1783 time:11270s shard-snb total:3604 pass:1367 dwarn:1 dfail:0 fail:2 skip:2234 time:6673s
Blacklisted hosts:
shard-kbl total:3547 pass:1933 dwarn:1 dfail:0 fail:6 skip:1606 time:9357s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1006/shards.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 8 lines · Martin Peres
They are the same as their non-underscored counterparts, except they will return the error rather than dying when an error occurs.
v2: (suggested by Ville Syrjälä)
- drop thefb_idout parameter, it can be accessed fromfb->fb_id.Signed-off-by Martin Peres <[email protected]>---
<SNIP>
Quoted 6 lines
+/**
+ *__igt_create_fb:
+ * @fd: open i915 drm file descriptor
+ * @width: width of the framebuffer in pixel
+ * @height: height of the framebuffer in pixel
+ * @format: drm fourcc pixel format code
Quoted 8 lines
+ * @tiling: tiling layout of the framebuffer
+ * @fb: pointer to an #igt_fb structure
+ *
+ * Same asigt_create_fb, but return an error if it failed rather than failing.
+ *
+ * Returns: 0 in case of success, the error otherwise. Thefb_idcan be found
+ * infb->fb_id.
+ */
I prefer the previous version because consistency. Now we have non-underscored functions returning fb_id and the underscored ones returning 0.
I think we should either keeping them as they were or change the non-underscore versions to follow the same conversion.
- Arek
lib/igt_fb.c unsigned int igt_create_fb(int fd, int width, int height, uint32_t format, · line 926
Quoted 10 lines
lib/igt_fb.c +7
-0+int __igt_create_fb (int fd,int width,int height,uint32_t format, +uint64_t tiling,struct igt_fb *fb) +{ +return __igt_create_fb_with_bo_size (fd, width, height, format, tiling, + fb,0 ,0 ); +} +/** * igt_create_color_fb: * @fd: open i915 drm file descriptor
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev