kms_writeback: Add initial writeback tests
PATCH v7 2/4 kms_writeback: Add initial writeback tests
Add tests for the WRITEBACK_PIXEL_FORMATS, WRITEBACK_OUT_FENCE_PTR and WRITEBACK_FB_ID properties on writeback connectors, ensuring their behaviour is correct.
V6: Simon Ser
- Add igt documentation with igt_describe and IGT_TEST_DESCRIPTION
- Drop kmstest_force_connector with FORCE_CONNECTOR_ON inkms_writeback_get_output since userspace won't do this operation
- Add an igt_debug statement in case we don't use writeback output
- Drop flags parameter from do_writeback_test
- Remove do_writeback_test "igt_assert(*out_fence_ptr == -1)" afterigt_display_try_commit_atomic
- Rename writeback_fb_id to writeback_test_fb
- Rework writeback_test_fb for checking buffer
- Move some tests from invalid_out_fence to writeback_test_fb
- Replace ret != 0 checking by ret == -EINVAL after invokedo_writeback_test
- Assert on igt_output_get_plane_type()
- Replace igt_fb_mod_to_tiling to DRM_FORMAT_MOD_LINEAR
- Rename tests
- Replace int ret by unsigned int fd_id when calling igt_create_fb
--- tests/Makefile.sources | 1 + tests/kms_writeback.c | 290 +++++++++++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 3 files changed, 292 insertions(+) create mode 100644 tests/kms_writeback.c
tests/Makefile.sources +1 -0
@@ -81,6 +81,7 @@ TESTS_progs = \ kms_universal_plane \ kms_vblank \ kms_vrr \ + kms_writeback \ meta_test \ perf \ perf_pmu \
tests/kms_writeback.c new file +290 -0
290 lines not on this page · raw message
tests/meson.build +1 -0
@@ -66,6 +66,7 @@ test_progs = [ 'kms_universal_plane', 'kms_vblank', 'kms_vrr', + 'kms_writeback', 'meta_test', 'panfrost_get_param', 'panfrost_gem_new',
Signature · 1 line
2.23.0
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 193 lines · Brian Starkey
Add tests for the
WRITEBACK_PIXEL_FORMATS,WRITEBACK_OUT_FENCE_PTRandWRITEBACK_FB_IDproperties on writeback connectors, ensuring their behaviour is correct.V6: Simon Ser
- Add igt documentation withigt_describeandIGT_TEST_DESCRIPTION
- Dropkmstest_force_connectorwithFORCE_CONNECTOR_ONinkms_writeback_get_outputsince userspace won't do this operation
- Add anigt_debugstatement in case we don't use writeback output
- Drop flags parameter fromdo_writeback_test
- Removedo_writeback_test"igt_assert(*out_fence_ptr == -1)" afterigt_display_try_commit_atomic
- Renamewriteback_fb_idtowriteback_test_fb
- Reworkwriteback_test_fbfor checking buffer
- Move some tests frominvalid_out_fencetowriteback_test_fb
- Replace ret != 0 checking by ret ==-EINVALafter invokedo_writeback_test
- Assert onigt_output_get_plane_type()
- Replaceigt_fb_mod_to_tilingtoDRM_FORMAT_MOD_LINEAR
- Rename tests
- Replace int ret by unsigned intfd_idwhen callingigt_create_fbSigned-off-by Brian Starkey <[email protected]>[rebased and updated do_writeback_test() function to address feedback]Signed-off-by Liviu Dudau <[email protected]>[rebased and updated the patch to address feedback]Signed-off-by Rodrigo Siqueira <[email protected]>--- tests/Makefile.sources | 1 + tests/kms_writeback.c | 290 +++++++++++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 3 files changed, 292 insertions(+) create mode 100644 tests/kms_writeback.ctests/Makefile.sources +1
-0@@ -81,6 +81,7 @@ TESTS_progs = \ kms_universal_plane \ kms_vblank \ kms_vrr \ + kms_writeback \ meta_test \ perf \ perf_pmu \tests/kms_writeback.c new file +141
-0@@ -0,0 +1,290 @@ +/* +* (C) COPYRIGHT 2017 ARM Limited. All rights reserved. +* +* 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. +* +*/ + +#include <errno.h> +#include <stdbool.h> +#include <stdio.h> +#include <string.h> + +#include "igt.h" +#include "igt_core.h" +#include "igt_fb.h" + +IGT_TEST_DESCRIPTION ("Exercise writeback feature." ); + +static drmModePropertyBlobRes *get_writeback_formats_blob (igt_output_t *output) +{ +drmModePropertyBlobRes *blob =NULL ; +uint64_t blob_id; +int ret; + + ret =kmstest_get_property (output->display->drm_fd, + output->config.connector->connector_id, +DRM_MODE_OBJECT_CONNECTOR , + igt_connector_prop_names[IGT_CONNECTOR_WRITEBACK_PIXEL_FORMATS ], +NULL , &blob_id,NULL ); +if (ret) + blob =drmModeGetPropertyBlob (output->display->drm_fd, blob_id); + +igt_assert (blob); + +return blob; +} + +static bool check_writeback_config (igt_display_t *display,igt_output_t *output) +{ +igt_fb_t input_fb, output_fb; +igt_plane_t *plane; +uint32_t writeback_format =DRM_FORMAT_XRGB8888 ; +int width, height, ret; +unsigned int fb_id; +drmModeModeInfo override_mode = { + .clock =25175 , + .hdisplay =640 , + .hsync_start =656 , + .hsync_end =752 , + .htotal =800 , + .hskew =0 , + .vdisplay =480 , + .vsync_start =490 , + .vsync_end =492 , + .vtotal =525 , + .vscan =0 , + .vrefresh =60 , + .flags =DRM_MODE_FLAG_NHSYNC |DRM_MODE_FLAG_NVSYNC , + .name = {"640x480-60" }, + }; +igt_output_override_mode (output, &override_mode); + + width = override_mode.hdisplay; + height = override_mode.vdisplay; + + fb_id =igt_create_fb (display->drm_fd, width, height,DRM_FORMAT_XRGB8888 ,DRM_FORMAT_MOD_LINEAR , &input_fb); +igt_assert (fb_id >=0 ); + + fb_id =igt_create_fb (display->drm_fd, width, height, writeback_format,DRM_FORMAT_MOD_LINEAR , &output_fb); +igt_assert (fb_id >=0 ); + + plane =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY ); +igt_plane_set_fb (plane, &input_fb); +igt_output_set_writeback_fb (output, &output_fb); + + ret =igt_display_try_commit_atomic (display,DRM_MODE_ATOMIC_TEST_ONLY | +DRM_MODE_ATOMIC_ALLOW_MODESET ,NULL ); +igt_plane_set_fb (plane,NULL ); +igt_remove_fb (display->drm_fd, &input_fb); +igt_remove_fb (display->drm_fd, &output_fb); + +return !ret; +} + +static igt_output_t *kms_writeback_get_output (igt_display_t *display) +{ +int i; + +for (i =0 ; i < display->n_outputs; i++) { +igt_output_t *output = &display->outputs[i]; +int j; + +if (output->config.connector->connector_type !=DRM_MODE_CONNECTOR_WRITEBACK ) +continue ; + +for (j =0 ; j <igt_display_get_n_pipes (display); j++) { +igt_output_set_pipe (output, j); + +if (check_writeback_config (display, output)) { +igt_debug ("Using connector %u:%s on pipe %d\n" , + output->config.connector->connector_id, + output->name, j); +return output; + } + } + +/* Restore any connectors we don't use, so we don't trip on them later */ +kmstest_force_connector (display->drm_fd, output->config.connector,FORCE_CONNECTOR_UNSPECIFIED ); + } + +igt_debug ("The device does not enable writeback\n" ); + +return NULL ; +} + +static void check_writeback_fb_id (igt_output_t *output) +{ +uint64_t check_fb_id; + + check_fb_id =igt_output_get_prop (output,IGT_CONNECTOR_WRITEBACK_FB_ID ); +igt_assert (check_fb_id ==0 ); +} + +static int do_writeback_test(igt_output_t *output, uint32_t fb_id,
tests/kms_writeback.c line 151
Quoted 10 lines
tests/kms_writeback.c new file +10
-0+ int32_t *out_fence_ptr, bool ptr_valid) +{ + int ret; +int flags =DRM_MODE_ATOMIC_ALLOW_MODESET ; +igt_display_t *display = output->display; +struct kmstest_connector_config *config = &output->config; + +igt_output_set_prop_value (output,IGT_CONNECTOR_CRTC_ID , config->crtc->crtc_id); +igt_output_set_prop_value (output,IGT_CONNECTOR_WRITEBACK_FB_ID , fb_id); +igt_output_set_prop_value (output,IGT_CONNECTOR_WRITEBACK_OUT_FENCE_PTR , (uint64_t )out_fence_ptr);
On ARM (32bits), this cast creates a compilation error since the pointer size isn't an uint64_t.
Maxime
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 4 lines
Quoted 1 line
+
igt_output_set_prop_value(output, IGT_CONNECTOR_WRITEBACK_OUT_FENCE_PTR, (uint64_t)out_fence_ptr);On ARM (32bits), this cast creates a compilation error since the pointer size isn't an
uint64_t.
Does casting to uintptr_t before uint64_t fix it?
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 6 lines · Simon Ser
Quoted 4 lines
Quoted 1 line
+
igt_output_set_prop_value(output, IGT_CONNECTOR_WRITEBACK_OUT_FENCE_PTR, (uint64_t)out_fence_ptr);On ARM (32bits), this cast creates a compilation error since the pointer size isn't an
uint64_t.Does casting to
uintptr_tbeforeuint64_tfix it?
It does yep. Casting to uintptr_t alone also works
Maxime
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 9 lines · Maxime Ripard
Quoted 6 lines · Simon Ser
Quoted 4 lines
Quoted 1 line
+
igt_output_set_prop_value(output, IGT_CONNECTOR_WRITEBACK_OUT_FENCE_PTR, (uint64_t)out_fence_ptr);On ARM (32bits), this cast creates a compilation error since the pointer size isn't an
uint64_t.Does casting to
uintptr_tbeforeuint64_tfix it?It does yep. Casting to
uintptr_talone also works
to_user_pointer(out_fence_ptr)
Signature · 5 lines
Petri Latvala _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev