test/psr: Do not fail tests when kernel set a valid disabled reason
Subsystems (2)
PATCH v5 1/4 test/psr: Do not fail tests when kernel set a valid disabled reason
If kernel set a reason why PSR was not enabled the test should not be reported as a error.
The reasons that kernel set are based in the modeset, sink and source parameters and are not considered a error.
--- lib/igt_psr.c | 30 ++++++++++++++++++++++++++++++ lib/igt_psr.h | 1 + tests/kms_psr.c | 21 ++++++++++++++++++++- 3 files changed, 51 insertions(+), 1 deletion(-)
lib/igt_psr.c +30 -0
@@ -178,3 +178,33 @@ bool psr_sink_support(int debugfs_fd, enum psr_mode mode)*/ return strstr (buf,"Sink support: yes [0x03]" ); } + +#define DISABLED_REASON_LOOKUP "Disabled reason: " + +bool psr_disabled_reason_get (int debugfs_fd,char *reason,int len) +{ +char buf[PSR_STATUS_MAX_LEN ]; +char *str; +int ret; + + ret =igt_debugfs_simple_read (debugfs_fd,"i915_edp_psr_status" , buf, +sizeof (buf)); +if (ret <0 ) +return false; + + str =strstr (buf,DISABLED_REASON_LOOKUP ); +if (!str) +return false; + + str = &str[strlen (DISABLED_REASON_LOOKUP )]; + +for (ret =0 ; str[ret] !='\n' ; ret++); + +if (ret +1 > len) +return false; + +memcpy (reason, str, ret); + reason[ret] ='\0' ; + +return true; +}
lib/igt_psr.h +1 -0
@@ -40,5 +40,6 @@ bool psr_wait_update(int debugfs_fd, enum psr_mode mode);bool psr_enable (int debugfs_fd,enum psr_mode );bool psr_disable (int debugfs_fd);bool psr_sink_support (int debugfs_fd,enum psr_mode ); +bool psr_disabled_reason_get (int debugfs_fd,char *reason,int len);#endif
tests/kms_psr.c +20 -1
@@ -387,11 +387,30 @@ static void setup_test_plane(data_t *data, int test_plane)static void test_setup (data_t *data) { +bool ret; +if (data->op_psr_mode ==PSR_MODE_2 )igt_require (data->supports_psr2);psr_enable_if_enabled (data);setup_test_plane (data, data->test_plane_id); -igt_assert (psr_wait_entry_if_enabled (data)); + + ret =psr_wait_entry_if_enabled (data); +if (!ret) { +char reason[128 ]; + + ret =psr_disabled_reason_get (data->debugfs_fd, reason, +sizeof (reason)); + +/* Check if it is a PSR2 reason while trying to enable PSR1 */ +if (ret && data->op_psr_mode ==PSR_MODE_1 && +strstr (reason,"PSR2" )) + ret = false; + +if (ret) +igt_skip ("Skipping test because %s\n" , reason); +else +igt_assert_f (ret,"PSR not enabled\n" ); + } }static void dpms_off_on (data_t *data)
Signature · 6 lines
2.20.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH v5 2/4 tests/intel-ci: Add basic PSR2 tests to fast feedback test list
Lets run the same PSR1 basic tests for PSR2 to caught PSR2 regressions faster.
--- tests/intel-ci/fast-feedback.testlist | 4 ++++ 1 file changed, 4 insertions(+)
tests/intel-ci/fast-feedback.testlist +4 -0
@@ -227,6 +227,10 @@ igt@kms_psr@primary_page_flip igt@kms_psr@cursor_plane_move igt@kms_psr@sprite_plane_onoff igt@kms_psr@primary_mmap_gtt +igt@kms_psr@psr2_primary_page_flip +igt@kms_psr@psr2_cursor_plane_move +igt@kms_psr@psr2_sprite_plane_onoff +igt@kms_psr@psr2_primary_mmap_gtt igt@kms_setmode@basic-clone-single-crtc igt@pm_backlight@basic-brightness igt@pm_rpm@basic-pci-d3-state
Signature · 6 lines
2.20.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH v5 3/4 test: Add PSR2 selective update tests
In reply to José Roberto de SouzaThis tests checks if hardware is able to do selective update when screen changes.
PSR2 don't trigger interruptions and the 'PSR2 SU status' register is not kept loaded all the times, so it is necessary keep polling PSR status debugfs until those values are loaded.
Also from DEEP_SLEEP state HW will not do a seletive update, as most of the memory/context is lost in deep sleep state hardware will need to exit PSR mode then wait a configured number of frames to activate PSR again to then start doing seletive updates, that is why just one screen change is not enough to pass this tests.
When a selective update happens and the values are loaded and read from debugfs it is compared with the expected value of seletive update blocks, if matches the polling is stopped and the test passed otherwise it will wait until it reachs a maximum number o screen changes to fail the test.
v2: Using new SU blocks debugfs output
v3:
- removed the timerfd to fail the test, now failing based in a maximum number of screen changes
- removing thread to read debugfs, read from main thread is enough
- improved commit message
v4:
- getting cairo context for frontbuffer test in prepare()
- droppoing poll(), using blocking timerfd instead
v5:
- Doing a modeset before trying to enable PSR2
--- lib/igt_psr.c | 29 ++++ lib/igt_psr.h | 1 + tests/Makefile.sources | 1 + tests/kms_psr2_su.c | 298 +++++++++++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 5 files changed, 330 insertions(+) create mode 100644 tests/kms_psr2_su.c
lib/igt_psr.c +29 -0
@@ -208,3 +208,32 @@ bool psr_disabled_reason_get(int debugfs_fd, char *reason, int len)return true; } + +#define PSR2_SU_BLOCK_STR_LOOKUP "PSR2 SU blocks:\n0\t" + +static bool +psr2_read_last_num_su_blocks_val (int debugfs_fd,uint16_t *num_su_blocks) +{ +char buf[PSR_STATUS_MAX_LEN ]; +char *str; +int ret; + + ret =igt_debugfs_simple_read (debugfs_fd,"i915_edp_psr_status" , buf, +sizeof (buf)); +if (ret <0 ) +return false; + + str =strstr (buf,PSR2_SU_BLOCK_STR_LOOKUP ); +if (!str) +return false; + + str = &str[strlen (PSR2_SU_BLOCK_STR_LOOKUP )]; + *num_su_blocks = (uint16_t )strtol (str,NULL ,10 ); + +return true; +} + +bool psr2_wait_su (int debugfs_fd,uint16_t *num_su_blocks) +{ +return igt_wait (psr2_read_last_num_su_blocks_val (debugfs_fd, num_su_blocks),40 ,1 ); +}
lib/igt_psr.h +1 -0
@@ -41,5 +41,6 @@ bool psr_enable(int debugfs_fd, enum psr_mode);bool psr_disable (int debugfs_fd);bool psr_sink_support (int debugfs_fd,enum psr_mode );bool psr_disabled_reason_get (int debugfs_fd,char *reason,int len); +bool psr2_wait_su (int debugfs_fd,uint16_t *num_su_blocks);#endif
tests/Makefile.sources +1 -0
@@ -80,6 +80,7 @@ TESTS_progs = \ kms_plane_scaling \ kms_properties \ kms_psr \ + kms_psr2_su \ kms_pwrite_crc \ kms_rmfb \ kms_rotation_crc \
tests/kms_psr2_su.c new file +298 -0
298 lines not on this page · raw message
tests/meson.build +1 -0
@@ -50,6 +50,7 @@ test_progs = [ 'kms_plane_scaling', 'kms_properties', 'kms_psr', + 'kms_psr2_su', 'kms_pwrite_crc', 'kms_rmfb', 'kms_rotation_crc',
Signature · 6 lines
2.20.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t v5 3/4] test: Add PSR2 selective update tests
Quoted 405 lines · José Roberto de Souza
This tests checks if hardware is able to do selective update when screen changes.
PSR2 don't trigger interruptions and the 'PSR2 SU status' register is not kept loaded all the times, so it is necessary keep polling PSR status debugfs until those values are loaded.Also from
DEEP_SLEEPstate HW will not do a seletive update, as most of the memory/context is lost in deep sleep state hardware will need to exit PSR mode then wait a configured number of frames to activate PSR again to then start doing seletive updates, that is why just one screen change is not enough to pass this tests.When a selective update happens and the values are loaded and read from debugfs it is compared with the expected value of seletive update blocks, if matches the polling is stopped and the test passed otherwise it will wait until it reachs a maximum number o screen changes to fail the test.
v2: Using new SU blocks debugfs output
v3:
- removed the timerfd to fail the test, now failing based in a maximum number of screen changes
- removing thread to read debugfs, read from main thread is enough
- improved commit messagev4:
- getting cairo context for frontbuffer test inprepare()
- droppoingpoll(), using blocking timerfd insteadv5:
- Doing a modeset before trying to enable PSR2Cc Rodrigo Vivi <[email protected]>Cc Dhinakaran Pandiyan <[email protected]>Signed-off-by José Roberto de Souza <[email protected]>--- lib/igt_psr.c | 29 ++++ lib/igt_psr.h | 1 + tests/Makefile.sources | 1 + tests/kms_psr2_su.c | 298 +++++++++++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 5 files changed, 330 insertions(+) create mode 100644 tests/kms_psr2_su.clib/igt_psr.c +5
-0@@ -208,3 +208,32 @@ bool psr_disabled_reason_get(int debugfs_fd, char *reason, int len) return true; } + +#define PSR2_SU_BLOCK_STR_LOOKUP "PSR2 SU blocks:\n0\t" + +static bool +psr2_read_last_num_su_blocks_val(int debugfs_fd, uint16_t
*num_su_blocks)lib/igt_psr.c +6
-0+{ +char buf[PSR_STATUS_MAX_LEN ]; +char *str; +int ret; + + ret = igt_debugfs_simple_read(debugfs_fd,"
i915_edp_psr_status", buf,lib/igt_psr.c +17
-0+ sizeof(buf)); +if (ret <0 ) +return false; + + str =strstr (buf,PSR2_SU_BLOCK_STR_LOOKUP ); +if (!str) +return false; + + str = &str[strlen (PSR2_SU_BLOCK_STR_LOOKUP )]; + *num_su_blocks = (uint16_t )strtol (str,NULL ,10 ); + +return true; +} + +bool psr2_wait_su (int debugfs_fd,uint16_t *num_su_blocks) +{ + return igt_wait(psr2_read_last_num_su_blocks_val(debugfs_fd,
num_su_blocks), 40, 1);lib/igt_psr.c +1
-0+}lib/igt_psr.h +1
-0@@ -41,5 +41,6 @@ bool psr_enable(int debugfs_fd, enum psr_mode);bool psr_disable (int debugfs_fd);bool psr_sink_support (int debugfs_fd,enum psr_mode );bool psr_disabled_reason_get (int debugfs_fd,char *reason,int len); +bool psr2_wait_su (int debugfs_fd,uint16_t *num_su_blocks);#endif tests/Makefile.sources +1
-0@@ -80,6 +80,7 @@ TESTS_progs = \ kms_plane_scaling \ kms_properties \ kms_psr \ + kms_psr2_su \ kms_pwrite_crc \ kms_rmfb \ kms_rotation_crc \tests/kms_psr2_su.c new file +4
-0@@ -0,0 +1,298 @@ +/* +* Copyright © 2019 Intel Corporation +* +* 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.
+ *
+ */tests/kms_psr2_su.c new file +16
-0+ +#include "igt.h" +#include "igt_sysfs.h" +#include "igt_psr.h" +#include <errno.h> +#include <stdbool.h> +#include <stdio.h> +#include <string.h> +#include <sys/timerfd.h> +#include "intel_bufmgr.h" + +IGT_TEST_DESCRIPTION ("Test PSR2 selective update" ); + +#define SQUARE_SIZE 100 +/* each selective update block is 4 lines tall */ +#define EXPECTED_NUM_SU_BLOCKS ((SQUARE_SIZE / 4) + (SQUARE_SIZE % 4? 1 : 0))
tests/kms_psr2_su.c new file +3
-0+ +/* +* Minimum is 15 as the number of frames to active PSR2 could be configured
+ * to 15 frames plus a few more in case we miss a selective update between
+ * debugfs reads.
+ */tests/kms_psr2_su.c new file +80
-0+#define MAX_SCREEN_CHANGES 20 + +enum operations { +PAGE_FLIP , +FRONTBUFFER , +LAST +}; + +static const char *op_str (enum operations op) +{ +static const char *const name[] = { + [PAGE_FLIP ] ="page_flip" , + [FRONTBUFFER ] ="frontbuffer" + }; + +return name[op]; +} + +typedef struct { +int drm_fd; +int debugfs_fd; +igt_display_t display; +drm_intel_bufmgr *bufmgr; +drmModeModeInfo *mode; +igt_output_t *output; +struct igt_fb fb[2 ]; +enum operations op; +cairo_t *cr; +int change_screen_timerfd; +uint32_t screen_changes; +}data_t ; + +static void setup_output (data_t *data) +{ +igt_display_t *display = &data->display; +igt_output_t *output; +enum pipe pipe; + +for_each_pipe_with_valid_output (display, pipe, output) { +drmModeConnectorPtr c = output->config.connector; + +if (c->connector_type != DRM_MODE_CONNECTOR_eDP) +continue ; + +igt_output_set_pipe (output, pipe); + data->output = output; + data->mode =igt_output_get_mode (output); + +return ; + } +} + +static void display_init (data_t *data) +{ +igt_display_require (&data->display, data->drm_fd); +setup_output (data); +} + +static void display_fini (data_t *data) +{ +igt_display_fini (&data->display); +} + +static void prepare (data_t *data) +{ +igt_plane_t *primary; + +/* all green frame */ +igt_create_color_fb (data->drm_fd, + data->mode->hdisplay, data->mode->vdisplay, +DRM_FORMAT_XRGB8888 , +LOCAL_DRM_FORMAT_MOD_NONE , +0.0 ,1.0 ,0.0 , + &data->fb[0 ]); + +if (data->op ==PAGE_FLIP ) { +cairo_t *cr; + + igt_create_color_fb(data->drm_fd, + data->mode->hdisplay, data->mode-Quoted 1 line
vdisplay,
tests/kms_psr2_su.c new file +8
-0+DRM_FORMAT_XRGB8888 , +LOCAL_DRM_FORMAT_MOD_NONE , +0.0 ,1.0 ,0.0 , + &data->fb[1]); + + cr =igt_get_cairo_ctx (data->drm_fd, &data->fb[1 ]); +/* paint a white square */ + igt_paint_color_alpha(cr, 0, 0, SQUARE_SIZE,
SQUARE_SIZE,tests/kms_psr2_su.c new file +4
-0+ 1.0, 1.0, 1.0, 1.0); +igt_put_cairo_ctx (data->drm_fd, &data->fb[1 ], cr); + }else if (data->op ==FRONTBUFFER ) { + data->cr = igt_get_cairo_ctx(data->drm_fd, &data-Quoted 1 line
fb[0]);
tests/kms_psr2_su.c new file +28
-0+ } + + primary =igt_output_get_plane_type (data->output, +DRM_PLANE_TYPE_PRIMARY ); +igt_plane_set_fb (primary,NULL ); + +igt_display_commit (&data->display); +igt_plane_set_fb (primary, &data->fb[0 ]); +igt_display_commit (&data->display); + +igt_assert (psr_wait_entry (data->debugfs_fd,PSR_MODE_2 )); + + data->screen_changes =0 ; +} + +static bool update_screen_and_test (data_t *data) +{ +uint16_t su_blocks; +bool ret = false; + + data->screen_changes++; + +switch (data->op) { +case PAGE_FLIP : { +igt_plane_t *primary; + + primary =igt_output_get_plane_type (data->output, + DRM_PLANE_TYPE_PRIMARY);
tests/kms_psr2_su.c new file +2
-0+ + igt_plane_set_fb(primary, &data->fb[data-Quoted 1 line
screen_changes& 1]);tests/kms_psr2_su.c new file +12
-0+igt_display_commit (&data->display); +break ; + } +case FRONTBUFFER : { +drmModeClip clip; +int r; + + clip.x1 = clip.y1 =0 ; + clip.x2 = clip.y2 =SQUARE_SIZE ; + +if (data->screen_changes &1 ) { +/* go back to all green frame with with square */
tests/kms_psr2_su.c new file +1
-0+ igt_paint_color_alpha(data->cr, 0, 0,
SQUARE_SIZE,tests/kms_psr2_su.c new file +1
-0+ SQUARE_SIZE, 1.0, 1.0,1.0, 1.0);
tests/kms_psr2_su.c new file +3
-0+ }else { +/* go back to all green frame */ + igt_paint_color_alpha(data->cr, 0, 0,
SQUARE_SIZE,tests/kms_psr2_su.c new file +1
-0+ SQUARE_SIZE, 0, 1.0, 0,1.0);
tests/kms_psr2_su.c new file +3
-0+ } + + r = drmModeDirtyFB(data->drm_fd, data->fb[0].fb_id,&clip, 1);
tests/kms_psr2_su.c new file +22
-0+igt_assert (r ==0 || r == -ENOSYS ); +break ; + } +default : +igt_assert_f (data->op,"Operation not handled\n" ); + } + +if (psr2_wait_su (data->debugfs_fd, &su_blocks)) + ret = su_blocks ==EXPECTED_NUM_SU_BLOCKS ; + +return ret; +} + +static void run (data_t *data) +{ +bool result = false; + +while (data->screen_changes <MAX_SCREEN_CHANGES && !result) { +uint64_t exp; +int r; + + r = read(data->change_screen_timerfd, &exp,sizeof(exp));
tests/kms_psr2_su.c new file +7
-0+if (r ==sizeof (uint64_t ) && exp) + result =update_screen_and_test (data); + } + +igt_debug ("Screen changes: %u\n" , data->screen_changes); + igt_assert_f(result, + "No matching selective update blocks read fromdebugfs\n");
tests/kms_psr2_su.c new file +15
-0+} + +static void cleanup (data_t *data) +{ +igt_plane_t *primary; + + primary =igt_output_get_plane_type (data->output, +DRM_PLANE_TYPE_PRIMARY ); +igt_plane_set_fb (primary,NULL ); +igt_display_commit (&data->display); + +if (data->op ==PAGE_FLIP ) +igt_remove_fb (data->drm_fd, &data->fb[1 ]); +else if (data->op ==FRONTBUFFER ) + igt_put_cairo_ctx(data->drm_fd, &data->fb[0], data-Quoted 1 line
cr);
tests/kms_psr2_su.c new file +21
-0+ +igt_remove_fb (data->drm_fd, &data->fb[0 ]); +} + +int main (int argc,char *argv[]) +{ +data_t data = {}; + +igt_subtest_init_parse_opts (&argc, argv,"" ,NULL , +NULL ,NULL ,NULL ); +igt_skip_on_simulation (); + + igt_fixture { +struct itimerspec interval; +int r; + + data.drm_fd =drm_open_driver_master (DRIVER_INTEL ); + data.debugfs_fd =igt_debugfs_dir (data.drm_fd); +kmstest_set_vt_graphics_mode (); + + igt_require_f(psr_sink_support(data.debugfs_fd,
PSR_MODE_2),tests/kms_psr2_su.c new file +3
-0+ "Sink does not support PSR2\n"); + + data.bufmgr = drm_intel_bufmgr_gem_init(data.drm_fd,4096);
tests/kms_psr2_su.c line 264
Quoted 8 lines
tests/kms_psr2_su.c new file +8
-0+igt_assert (data.bufmgr); +drm_intel_bufmgr_gem_enable_reuse (data.bufmgr); + +display_init (&data); + +/* Test if PSR2 can be enabled */ +igt_require_f (psr_enable (data.debugfs_fd,PSR_MODE_2 ), +"Sink do not support PSR2\n" );
The comment and error message look wrong, a false from psr_enable() indicates debugfs does not support PSR 2 mode change.
tests/kms_psr2_su.c line 269
Quoted 5 lines
tests/kms_psr2_su.c new file +5
-0+ data.op =FRONTBUFFER ; +prepare (&data); + r =psr_wait_entry (data.debugfs_fd,PSR_MODE_2 ); +cleanup (&data); +igt_require_f (r,"PSR2 can not be enabled\n" );
CI results shows the assertion in prepare() failed. The assertion should have caused a skip on whl, no?
Quoted 37 lines
tests/kms_psr2_su.c new file +3
-0+ +/* blocking timerfd */ + data.change_screen_timerfd =
timerfd_create(CLOCK_MONOTONIC, 0);tests/kms_psr2_su.c new file +5
-0+igt_require (data.change_screen_timerfd !=-1 ); +/* Changing screen at 30hz to support 30hz panels */ + interval.it_value.tv_nsec =NSEC_PER_SEC /30 ; + interval.it_value.tv_sec =0 ; + interval.it_interval.tv_nsec =interval.it_value.tv_nsec;
tests/kms_psr2_su.c new file +2
-0+ interval.it_interval.tv_sec = interval.it_value.tv_sec; + r = timerfd_settime(data.change_screen_timerfd, 0,&interval, NULL);
tests/kms_psr2_su.c new file +19
-0+igt_require_f (r !=-1 ,"Error setting timerfd\n" ); + } + +for (data.op =PAGE_FLIP ; data.op <LAST ; data.op++) { + igt_subtest_f("%s", op_str(data.op)) { +prepare (&data); +run (&data); +cleanup (&data); + } + } + + igt_fixture { +close (data.debugfs_fd); +drm_intel_bufmgr_destroy (data.bufmgr); +display_fini (&data); + } + +igt_exit (); +}tests/meson.build +0
-0
tests/meson.build test_progs = [ · line 56
Quoted 7 lines
tests/meson.build +1
-0@@ -50,6 +50,7 @@ test_progs = [ 'kms_plane_scaling', 'kms_properties', 'kms_psr', + 'kms_psr2_su', 'kms_pwrite_crc', 'kms_rmfb', 'kms_rotation_crc',
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t v5 3/4] test: Add PSR2 selective update tests
Quoted 416 lines · Dhinakaran
Quoted 415 lines · José Roberto de Souza
This tests checks if hardware is able to do selective update when screen changes.
PSR2 don't trigger interruptions and the 'PSR2 SU status' register is not kept loaded all the times, so it is necessary keep polling PSR status debugfs until those values are loaded.Also from
DEEP_SLEEPstate HW will not do a seletive update, as most of the memory/context is lost in deep sleep state hardware will
need to exit PSR mode then wait a configured number of frames to activate PSR again to then start doing seletive updates, that is why
just one screen change is not enough to pass this tests.When a selective update happens and the values are loaded and read from debugfs it is compared with the expected value of seletive update blocks, if matches the polling is stopped and the test passed
otherwise it will wait until it reachs a maximum number o screen changes to fail the test.v2: Using new SU blocks debugfs output
v3:
- removed the timerfd to fail the test, now failing based in a maximum number of screen changes
- removing thread to read debugfs, read from main thread is enough
- improved commit messagev4:
- getting cairo context for frontbuffer test inprepare()
- droppoingpoll(), using blocking timerfd insteadv5:
- Doing a modeset before trying to enable PSR2Cc Rodrigo Vivi <[email protected]>Cc Dhinakaran Pandiyan <[email protected]>Signed-off-by José Roberto de Souza <[email protected]>--- lib/igt_psr.c | 29 ++++ lib/igt_psr.h | 1 + tests/Makefile.sources | 1 + tests/kms_psr2_su.c | 298 +++++++++++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 5 files changed, 330 insertions(+) create mode 100644 tests/kms_psr2_su.clib/igt_psr.c +5
-0@@ -208,3 +208,32 @@ bool psr_disabled_reason_get(int debugfs_fd, char *reason, int len) return true; } + +#define PSR2_SU_BLOCK_STR_LOOKUP "PSR2 SU blocks:\n0\t" + +static bool +psr2_read_last_num_su_blocks_val(int debugfs_fd, uint16_t
*num_su_blocks)lib/igt_psr.c +6
-0+{ +char buf[PSR_STATUS_MAX_LEN ]; +char *str; +int ret; + + ret = igt_debugfs_simple_read(debugfs_fd,"
i915_edp_psr_status", buf,lib/igt_psr.c +17
-0+ sizeof(buf)); +if (ret <0 ) +return false; + + str =strstr (buf,PSR2_SU_BLOCK_STR_LOOKUP ); +if (!str) +return false; + + str = &str[strlen (PSR2_SU_BLOCK_STR_LOOKUP )]; + *num_su_blocks = (uint16_t )strtol (str,NULL ,10 ); + +return true; +} + +bool psr2_wait_su (int debugfs_fd,uint16_t *num_su_blocks) +{ + return igt_wait(psr2_read_last_num_su_blocks_val(debugfs_fd,
num_su_blocks), 40, 1);lib/igt_psr.c +1
-0+}lib/igt_psr.h +1
-0@@ -41,5 +41,6 @@ bool psr_enable(int debugfs_fd, enum psr_mode);bool psr_disable (int debugfs_fd);bool psr_sink_support (int debugfs_fd,enum psr_mode );bool psr_disabled_reason_get (int debugfs_fd,char *reason,int len); +bool psr2_wait_su (int debugfs_fd,uint16_t *num_su_blocks);#endif
tests/Makefile.sources +1
-0@@ -80,6 +80,7 @@ TESTS_progs = \ kms_plane_scaling \ kms_properties \ kms_psr \ + kms_psr2_su \ kms_pwrite_crc \ kms_rmfb \ kms_rotation_crc \tests/kms_psr2_su.c new file +4
-0@@ -0,0 +1,298 @@ +/* +* Copyright © 2019 Intel Corporation +* +* 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.
+ *
+ */tests/kms_psr2_su.c new file +16
-0+ +#include "igt.h" +#include "igt_sysfs.h" +#include "igt_psr.h" +#include <errno.h> +#include <stdbool.h> +#include <stdio.h> +#include <string.h> +#include <sys/timerfd.h> +#include "intel_bufmgr.h" + +IGT_TEST_DESCRIPTION ("Test PSR2 selective update" ); + +#define SQUARE_SIZE 100 +/* each selective update block is 4 lines tall */ +#define EXPECTED_NUM_SU_BLOCKS ((SQUARE_SIZE / 4) + (SQUARE_SIZE %4
? 1 : 0))tests/kms_psr2_su.c new file +3
-0+ +/* +* Minimum is 15 as the number of frames to active PSR2 could be configured
+ * to 15 frames plus a few more in case we miss a selective update between
+ * debugfs reads.
+ */tests/kms_psr2_su.c new file +80
-0+#define MAX_SCREEN_CHANGES 20 + +enum operations { +PAGE_FLIP , +FRONTBUFFER , +LAST +}; + +static const char *op_str (enum operations op) +{ +static const char *const name[] = { + [PAGE_FLIP ] ="page_flip" , + [FRONTBUFFER ] ="frontbuffer" + }; + +return name[op]; +} + +typedef struct { +int drm_fd; +int debugfs_fd; +igt_display_t display; +drm_intel_bufmgr *bufmgr; +drmModeModeInfo *mode; +igt_output_t *output; +struct igt_fb fb[2 ]; +enum operations op; +cairo_t *cr; +int change_screen_timerfd; +uint32_t screen_changes; +}data_t ; + +static void setup_output (data_t *data) +{ +igt_display_t *display = &data->display; +igt_output_t *output; +enum pipe pipe; + +for_each_pipe_with_valid_output (display, pipe, output) { +drmModeConnectorPtr c = output->config.connector; + +if (c->connector_type != DRM_MODE_CONNECTOR_eDP) +continue ; + +igt_output_set_pipe (output, pipe); + data->output = output; + data->mode =igt_output_get_mode (output); + +return ; + } +} + +static void display_init (data_t *data) +{ +igt_display_require (&data->display, data->drm_fd); +setup_output (data); +} + +static void display_fini (data_t *data) +{ +igt_display_fini (&data->display); +} + +static void prepare (data_t *data) +{ +igt_plane_t *primary; + +/* all green frame */ +igt_create_color_fb (data->drm_fd, + data->mode->hdisplay, data->mode->vdisplay, +DRM_FORMAT_XRGB8888 , +LOCAL_DRM_FORMAT_MOD_NONE , +0.0 ,1.0 ,0.0 , + &data->fb[0 ]); + +if (data->op ==PAGE_FLIP ) { +cairo_t *cr; + + igt_create_color_fb(data->drm_fd, + data->mode->hdisplay, data->mode-Quoted 1 line
vdisplay,
tests/kms_psr2_su.c new file +8
-0+DRM_FORMAT_XRGB8888 , +LOCAL_DRM_FORMAT_MOD_NONE , +0.0 ,1.0 ,0.0 , + &data->fb[1]); + + cr =igt_get_cairo_ctx (data->drm_fd, &data->fb[1 ]); +/* paint a white square */ + igt_paint_color_alpha(cr, 0, 0, SQUARE_SIZE,
SQUARE_SIZE,tests/kms_psr2_su.c new file +4
-0+ 1.0, 1.0, 1.0, 1.0); +igt_put_cairo_ctx (data->drm_fd, &data->fb[1 ], cr); + }else if (data->op ==FRONTBUFFER ) { + data->cr = igt_get_cairo_ctx(data->drm_fd, &data-Quoted 1 line
fb[0]);
tests/kms_psr2_su.c new file +28
-0+ } + + primary =igt_output_get_plane_type (data->output, +DRM_PLANE_TYPE_PRIMARY ); +igt_plane_set_fb (primary,NULL ); + +igt_display_commit (&data->display); +igt_plane_set_fb (primary, &data->fb[0 ]); +igt_display_commit (&data->display); + +igt_assert (psr_wait_entry (data->debugfs_fd,PSR_MODE_2 )); + + data->screen_changes =0 ; +} + +static bool update_screen_and_test (data_t *data) +{ +uint16_t su_blocks; +bool ret = false; + + data->screen_changes++; + +switch (data->op) { +case PAGE_FLIP : { +igt_plane_t *primary; + + primary =igt_output_get_plane_type (data->output, + DRM_PLANE_TYPE_PRIMARY);
tests/kms_psr2_su.c new file +2
-0+ + igt_plane_set_fb(primary, &data->fb[data-Quoted 1 line
screen_changes& 1]);tests/kms_psr2_su.c new file +12
-0+igt_display_commit (&data->display); +break ; + } +case FRONTBUFFER : { +drmModeClip clip; +int r; + + clip.x1 = clip.y1 =0 ; + clip.x2 = clip.y2 =SQUARE_SIZE ; + +if (data->screen_changes &1 ) { +/* go back to all green frame with with square */
tests/kms_psr2_su.c new file +1
-0+ igt_paint_color_alpha(data->cr, 0, 0,
SQUARE_SIZE,tests/kms_psr2_su.c new file +1
-0+ SQUARE_SIZE, 1.0, 1.0,1.0, 1.0);
tests/kms_psr2_su.c new file +3
-0+ }else { +/* go back to all green frame */ + igt_paint_color_alpha(data->cr, 0, 0,
SQUARE_SIZE,tests/kms_psr2_su.c new file +1
-0+ SQUARE_SIZE, 0, 1.0, 0,1.0);
tests/kms_psr2_su.c new file +3
-0+ } + + r = drmModeDirtyFB(data->drm_fd, data->fb[0].fb_id,&clip, 1);
tests/kms_psr2_su.c new file +22
-0+igt_assert (r ==0 || r == -ENOSYS ); +break ; + } +default : +igt_assert_f (data->op,"Operation not handled\n" ); + } + +if (psr2_wait_su (data->debugfs_fd, &su_blocks)) + ret = su_blocks ==EXPECTED_NUM_SU_BLOCKS ; + +return ret; +} + +static void run (data_t *data) +{ +bool result = false; + +while (data->screen_changes <MAX_SCREEN_CHANGES && !result) { +uint64_t exp; +int r; + + r = read(data->change_screen_timerfd, &exp,sizeof(exp));
tests/kms_psr2_su.c new file +7
-0+if (r ==sizeof (uint64_t ) && exp) + result =update_screen_and_test (data); + } + +igt_debug ("Screen changes: %u\n" , data->screen_changes); + igt_assert_f(result, + "No matching selective update blocks read fromdebugfs\n");
tests/kms_psr2_su.c new file +15
-0+} + +static void cleanup (data_t *data) +{ +igt_plane_t *primary; + + primary =igt_output_get_plane_type (data->output, +DRM_PLANE_TYPE_PRIMARY ); +igt_plane_set_fb (primary,NULL ); +igt_display_commit (&data->display); + +if (data->op ==PAGE_FLIP ) +igt_remove_fb (data->drm_fd, &data->fb[1 ]); +else if (data->op ==FRONTBUFFER ) + igt_put_cairo_ctx(data->drm_fd, &data->fb[0], data-Quoted 1 line
cr);
tests/kms_psr2_su.c new file +21
-0+ +igt_remove_fb (data->drm_fd, &data->fb[0 ]); +} + +int main (int argc,char *argv[]) +{ +data_t data = {}; + +igt_subtest_init_parse_opts (&argc, argv,"" ,NULL , +NULL ,NULL ,NULL ); +igt_skip_on_simulation (); + + igt_fixture { +struct itimerspec interval; +int r; + + data.drm_fd =drm_open_driver_master (DRIVER_INTEL ); + data.debugfs_fd =igt_debugfs_dir (data.drm_fd); +kmstest_set_vt_graphics_mode (); + + igt_require_f(psr_sink_support(data.debugfs_fd,
PSR_MODE_2),tests/kms_psr2_su.c new file +3
-0+ "Sink does not support PSR2\n"); + + data.bufmgr = drm_intel_bufmgr_gem_init(data.drm_fd,4096);
tests/kms_psr2_su.c new file +2
-0+igt_assert (data.bufmgr); +drm_intel_bufmgr_gem_enable_reuse (data.bufmgr);
Quoted 8 lines
tests/kms_psr2_su.c line 264
Quoted 6 lines
tests/kms_psr2_su.c new file +6
-0+ +display_init (&data); + +/* Test if PSR2 can be enabled */ +igt_require_f (psr_enable (data.debugfs_fd,PSR_MODE_2 ), +"Sink do not support PSR2\n" );The comment and error message look wrong, a false from
psr_enable()indicates debugfs does not support PSR 2 mode change.
You are right, changing to: Error enabling PSR2
What do you think?
Quoted 8 lines
tests/kms_psr2_su.c line 269
Quoted 6 lines
tests/kms_psr2_su.c new file +5
-0+ data.op =FRONTBUFFER ; +prepare (&data); + r =psr_wait_entry (data.debugfs_fd,PSR_MODE_2 ); +cleanup (&data); +igt_require_f (r,"PSR2 can not be enabled\n" );CI results shows the assertion in
prepare()failed. The assertion should have caused a skip on whl, no?
Huum it failed in the prepare() inside of igt_fixture(), one the last things that prepare() does is igt_assert(psr_wait_entry(data-
Quoted 1 line
debugfs_fd,PSR_MODE_2)).
So I'm moving it to the begining of run(), it should fix the issue.
Quoted 37 lines
Quoted 37 lines
tests/kms_psr2_su.c new file +3
-0+ +/* blocking timerfd */ + data.change_screen_timerfd =
timerfd_create(CLOCK_MONOTONIC, 0);tests/kms_psr2_su.c new file +5
-0+igt_require (data.change_screen_timerfd !=-1 ); +/* Changing screen at 30hz to support 30hz panels */ + interval.it_value.tv_nsec =NSEC_PER_SEC /30 ; + interval.it_value.tv_sec =0 ; + interval.it_interval.tv_nsec =interval.it_value.tv_nsec;
tests/kms_psr2_su.c new file +2
-0+ interval.it_interval.tv_sec = interval.it_value.tv_sec; + r = timerfd_settime(data.change_screen_timerfd, 0,&interval, NULL);
tests/kms_psr2_su.c new file +19
-0+igt_require_f (r !=-1 ,"Error setting timerfd\n" ); + } + +for (data.op =PAGE_FLIP ; data.op <LAST ; data.op++) { + igt_subtest_f("%s", op_str(data.op)) { +prepare (&data); +run (&data); +cleanup (&data); + } + } + + igt_fixture { +close (data.debugfs_fd); +drm_intel_bufmgr_destroy (data.bufmgr); +display_fini (&data); + } + +igt_exit (); +}tests/meson.build +0
-0
Quoted 8 lines
tests/meson.build test_progs = [ · line 56
Quoted 8 lines
tests/meson.build +1
-0@@ -50,6 +50,7 @@ test_progs = [ 'kms_plane_scaling', 'kms_properties', 'kms_psr', + 'kms_psr2_su', 'kms_pwrite_crc', 'kms_rmfb', 'kms_rotation_crc',
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t v5 3/4] test: Add PSR2 selective update tests
Quoted 244 lines · Jose
Quoted 243 lines · Dhinakaran
Quoted 242 lines · José Roberto de Souza
This tests checks if hardware is able to do selective update when screen changes.
PSR2 don't trigger interruptions and the 'PSR2 SU status' register
is not kept loaded all the times, so it is necessary keep polling PSR status debugfs until those values are loaded.Also from
DEEP_SLEEPstate HW will not do a seletive update, as most of the memory/context is lost in deep sleep state hardware will
need to exit PSR mode then wait a configured number of frames to activate PSR again to then start doing seletive updates, that is why
just one screen change is not enough to pass this tests.When a selective update happens and the values are loaded and read
from debugfs it is compared with the expected value of seletive update blocks, if matches the polling is stopped and the test passed
otherwise it will wait until it reachs a maximum number o screen changes to fail the test.v2: Using new SU blocks debugfs output
v3:
- removed the timerfd to fail the test, now failing based in a maximum number of screen changes
- removing thread to read debugfs, read from main thread is enough
- improved commit messagev4:
- getting cairo context for frontbuffer test inprepare()
- droppoingpoll(), using blocking timerfd insteadv5:
- Doing a modeset before trying to enable PSR2Cc Rodrigo Vivi <[email protected]>Cc Dhinakaran Pandiyan <[email protected]>Signed-off-by José Roberto de Souza <[email protected]>--- lib/igt_psr.c | 29 ++++ lib/igt_psr.h | 1 + tests/Makefile.sources | 1 + tests/kms_psr2_su.c | 298 +++++++++++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 5 files changed, 330 insertions(+) create mode 100644 tests/kms_psr2_su.clib/igt_psr.c +5
-0@@ -208,3 +208,32 @@ bool psr_disabled_reason_get(int debugfs_fd, char *reason, int len) return true; } + +#define PSR2_SU_BLOCK_STR_LOOKUP "PSR2 SU blocks:\n0\t" + +static bool +psr2_read_last_num_su_blocks_val(int debugfs_fd, uint16_t
*num_su_blocks)lib/igt_psr.c +6
-0+{ +char buf[PSR_STATUS_MAX_LEN ]; +char *str; +int ret; + + ret = igt_debugfs_simple_read(debugfs_fd,"
i915_edp_psr_status", buf,lib/igt_psr.c +17
-0+ sizeof(buf)); +if (ret <0 ) +return false; + + str =strstr (buf,PSR2_SU_BLOCK_STR_LOOKUP ); +if (!str) +return false; + + str = &str[strlen (PSR2_SU_BLOCK_STR_LOOKUP )]; + *num_su_blocks = (uint16_t )strtol (str,NULL ,10 ); + +return true; +} + +bool psr2_wait_su (int debugfs_fd,uint16_t *num_su_blocks) +{ + return igt_wait(psr2_read_last_num_su_blocks_val(debugfs_fd,
num_su_blocks), 40, 1);lib/igt_psr.c +1
-0+}lib/igt_psr.h +1
-0@@ -41,5 +41,6 @@ bool psr_enable(int debugfs_fd, enum psr_mode);bool psr_disable (int debugfs_fd);bool psr_sink_support (int debugfs_fd,enum psr_mode );bool psr_disabled_reason_get (int debugfs_fd,char *reason,int len); +bool psr2_wait_su (int debugfs_fd,uint16_t *num_su_blocks);#endif
tests/Makefile.sources +1
-0@@ -80,6 +80,7 @@ TESTS_progs = \ kms_plane_scaling \ kms_properties \ kms_psr \ + kms_psr2_su \ kms_pwrite_crc \ kms_rmfb \ kms_rotation_crc \tests/kms_psr2_su.c new file +4
-0@@ -0,0 +1,298 @@ +/* +* Copyright © 2019 Intel Corporation +* +* 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.
+ *
+ */tests/kms_psr2_su.c new file +16
-0+ +#include "igt.h" +#include "igt_sysfs.h" +#include "igt_psr.h" +#include <errno.h> +#include <stdbool.h> +#include <stdio.h> +#include <string.h> +#include <sys/timerfd.h> +#include "intel_bufmgr.h" + +IGT_TEST_DESCRIPTION ("Test PSR2 selective update" ); + +#define SQUARE_SIZE 100 +/* each selective update block is 4 lines tall */ +#define EXPECTED_NUM_SU_BLOCKS ((SQUARE_SIZE / 4) + (SQUARE_SIZE%
4
? 1 : 0))tests/kms_psr2_su.c new file +3
-0+ +/* +* Minimum is 15 as the number of frames to active PSR2 could be configured
+ * to 15 frames plus a few more in case we miss a selective update
between
+ * debugfs reads.
+ */tests/kms_psr2_su.c new file +48
-0+#define MAX_SCREEN_CHANGES 20 + +enum operations { +PAGE_FLIP , +FRONTBUFFER , +LAST +}; + +static const char *op_str (enum operations op) +{ +static const char *const name[] = { + [PAGE_FLIP ] ="page_flip" , + [FRONTBUFFER ] ="frontbuffer" + }; + +return name[op]; +} + +typedef struct { +int drm_fd; +int debugfs_fd; +igt_display_t display; +drm_intel_bufmgr *bufmgr; +drmModeModeInfo *mode; +igt_output_t *output; +struct igt_fb fb[2 ]; +enum operations op; +cairo_t *cr; +int change_screen_timerfd; +uint32_t screen_changes; +}data_t ; + +static void setup_output (data_t *data) +{ +igt_display_t *display = &data->display; +igt_output_t *output; +enum pipe pipe; + +for_each_pipe_with_valid_output (display, pipe, output) { +drmModeConnectorPtr c = output->config.connector; + +if (c->connector_type != DRM_MODE_CONNECTOR_eDP) +continue ; + +igt_output_set_pipe (output, pipe); + data->output = output; + data->mode =igt_output_get_mode (output); +
Quoted 8 lines
Quoted 8 lines
tests/kms_psr2_su.c line 101
Quoted 8 lines
tests/kms_psr2_su.c new file +8
-0+return ; + } +} + +static void display_init (data_t *data) +{ +igt_display_require (&data->display, data->drm_fd); +setup_output (data);
This function does not do anything on it's own, please consider inlining setup_output() instead.
Quoted 72 lines
Quoted 72 lines
Quoted 72 lines
tests/kms_psr2_su.c new file +24
-0+} + +static void display_fini (data_t *data) +{ +igt_display_fini (&data->display); +} + +static void prepare (data_t *data) +{ +igt_plane_t *primary; + +/* all green frame */ +igt_create_color_fb (data->drm_fd, + data->mode->hdisplay, data->mode->vdisplay, +DRM_FORMAT_XRGB8888 , +LOCAL_DRM_FORMAT_MOD_NONE , +0.0 ,1.0 ,0.0 , + &data->fb[0 ]); + +if (data->op ==PAGE_FLIP ) { +cairo_t *cr; + + igt_create_color_fb(data->drm_fd, + data->mode->hdisplay, data->mode-Quoted 1 line
vdisplay,
tests/kms_psr2_su.c new file +8
-0+DRM_FORMAT_XRGB8888 , +LOCAL_DRM_FORMAT_MOD_NONE , +0.0 ,1.0 ,0.0 , + &data->fb[1]); + + cr =igt_get_cairo_ctx (data->drm_fd, &data->fb[1 ]); +/* paint a white square */ + igt_paint_color_alpha(cr, 0, 0, SQUARE_SIZE,
SQUARE_SIZE,tests/kms_psr2_su.c new file +4
-0+ 1.0, 1.0, 1.0, 1.0); +igt_put_cairo_ctx (data->drm_fd, &data->fb[1 ], cr); + }else if (data->op ==FRONTBUFFER ) { + data->cr = igt_get_cairo_ctx(data->drm_fd, &data-Quoted 1 line
fb[0]);
tests/kms_psr2_su.c new file +28
-0+ } + + primary =igt_output_get_plane_type (data->output, +DRM_PLANE_TYPE_PRIMARY ); +igt_plane_set_fb (primary,NULL ); + +igt_display_commit (&data->display); +igt_plane_set_fb (primary, &data->fb[0 ]); +igt_display_commit (&data->display); + +igt_assert (psr_wait_entry (data->debugfs_fd,PSR_MODE_2 )); + + data->screen_changes =0 ; +} + +static bool update_screen_and_test (data_t *data) +{ +uint16_t su_blocks; +bool ret = false; + + data->screen_changes++; + +switch (data->op) { +case PAGE_FLIP : { +igt_plane_t *primary; + + primary =igt_output_get_plane_type (data->output, + DRM_PLANE_TYPE_PRIMARY);
tests/kms_psr2_su.c new file +2
-0+ + igt_plane_set_fb(primary, &data->fb[data-
Quoted 3 lines
Quoted 3 lines
tests/kms_psr2_su.c
Quoted 3 lines
Quoted 1 line
screen_changes& 1]);tests/kms_psr2_su.c new file +1
-0+igt_display_commit (&data->display);
COMMIT_ATOMIC, like we discussed earlier.
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
tests/kms_psr2_su.c new file +11
-0+break ; + } +case FRONTBUFFER : { +drmModeClip clip; +int r; + + clip.x1 = clip.y1 =0 ; + clip.x2 = clip.y2 =SQUARE_SIZE ; + +if (data->screen_changes &1 ) { +/* go back to all green frame with with square */
tests/kms_psr2_su.c new file +1
-0+ igt_paint_color_alpha(data->cr, 0, 0,
SQUARE_SIZE,tests/kms_psr2_su.c new file +1
-0+ SQUARE_SIZE, 1.0, 1.0,1.0, 1.0);
tests/kms_psr2_su.c new file +3
-0+ }else { +/* go back to all green frame */ + igt_paint_color_alpha(data->cr, 0, 0,
SQUARE_SIZE,tests/kms_psr2_su.c new file +1
-0+ SQUARE_SIZE, 0, 1.0, 0,1.0);
tests/kms_psr2_su.c new file +3
-0+ } + + r = drmModeDirtyFB(data->drm_fd, data->fb[0].fb_id,&clip, 1);
tests/kms_psr2_su.c new file +1
-0+igt_assert (r ==0 || r == -ENOSYS );
Quoted 8 lines
Quoted 8 lines
tests/kms_psr2_su.c line 197
Quoted 8 lines
tests/kms_psr2_su.c new file +8
-0+break ; + } +default : +igt_assert_f (data->op,"Operation not handled\n" ); + } + +if (psr2_wait_su (data->debugfs_fd, &su_blocks)) + ret = su_blocks ==EXPECTED_NUM_SU_BLOCKS ;
We could perhaps have a stricter restriction, immediately fail for non- zero values that do not match "EXPECTED_NUM_SU_BLOCKS"
Quoted 39 lines
Quoted 39 lines
Quoted 39 lines
tests/kms_psr2_su.c new file +13
-0+ +return ret; +} + +static void run (data_t *data) +{ +bool result = false; + +while (data->screen_changes <MAX_SCREEN_CHANGES && !result) { +uint64_t exp; +int r; + + r = read(data->change_screen_timerfd, &exp,sizeof(exp));
tests/kms_psr2_su.c new file +7
-0+if (r ==sizeof (uint64_t ) && exp) + result =update_screen_and_test (data); + } + +igt_debug ("Screen changes: %u\n" , data->screen_changes); + igt_assert_f(result, + "No matching selective update blocks read fromdebugfs\n");
tests/kms_psr2_su.c new file +15
-0+} + +static void cleanup (data_t *data) +{ +igt_plane_t *primary; + + primary =igt_output_get_plane_type (data->output, +DRM_PLANE_TYPE_PRIMARY ); +igt_plane_set_fb (primary,NULL ); +igt_display_commit (&data->display); + +if (data->op ==PAGE_FLIP ) +igt_remove_fb (data->drm_fd, &data->fb[1 ]); +else if (data->op ==FRONTBUFFER ) + igt_put_cairo_ctx(data->drm_fd, &data->fb[0], data-Quoted 1 line
cr);
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
tests/kms_psr2_su.c new file +7
-0+ +igt_remove_fb (data->drm_fd, &data->fb[0 ]); +} + +int main (int argc,char *argv[]) +{ +data_t data = {};Quoted 8 lines
tests/kms_psr2_su.c line 247
Quoted 8 lines
tests/kms_psr2_su.c new file +8
-0+ +igt_subtest_init_parse_opts (&argc, argv,"" ,NULL , +NULL ,NULL ,NULL ); +igt_skip_on_simulation (); + + igt_fixture { +struct itimerspec interval; +int r;
bool r?
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
tests/kms_psr2_su.c new file +6
-0+ + data.drm_fd =drm_open_driver_master (DRIVER_INTEL ); + data.debugfs_fd =igt_debugfs_dir (data.drm_fd); +kmstest_set_vt_graphics_mode (); + + igt_require_f(psr_sink_support(data.debugfs_fd,
PSR_MODE_2),tests/kms_psr2_su.c new file +3
-0+ "Sink does not support PSR2\n"); + + data.bufmgr = drm_intel_bufmgr_gem_init(data.drm_fd,
Quoted 8 lines
Quoted 8 lines
tests/kms_psr2_su.c line 263
Quoted 8 lines
4096);
tests/kms_psr2_su.c new file +7
-0+igt_assert (data.bufmgr); +drm_intel_bufmgr_gem_enable_reuse (data.bufmgr); + +display_init (&data); + +/* Test if PSR2 can be enabled */ + igt_require_f(psr_enable(data.debugfs_fd, PSR_MODE_2),
I noticed that this is broken in the kernel, PSR mode does not get restored correctly after the test ends. switching_psr() in intel_psr.c needs to be fixed to switch to PSR1 for cases when test sets the default debugfs mode.
Quoted 7 lines
Quoted 4 lines
tests/kms_psr2_su.c line 264
Quoted 1 line
tests/kms_psr2_su.c new file +1
-0+ "Sink do not support PSR2\n");The comment and error message look wrong, a false from
psr_enable()indicates debugfs does not support PSR 2 mode change.You are right, changing to: Error enabling PSR2
What do you think?
"Kernel does not support enabling PSR2 via debugfs"
Quoted 20 lines
Quoted 11 lines
tests/kms_psr2_su.c line 269
Quoted 8 lines
tests/kms_psr2_su.c new file +5
-0+ data.op =FRONTBUFFER ; +prepare (&data); + r =psr_wait_entry (data.debugfs_fd,PSR_MODE_2 ); +cleanup (&data); +igt_require_f (r,"PSR2 can not be enabled\n" );CI results shows the assertion in
prepare()failed. The assertion should have caused a skip on whl, no?Huum it failed in the
prepare()inside ofigt_fixture(), one the last things thatprepare()does is igt_assert(psr_wait_entry(data-Quoted 1 line
debugfs_fd,PSR_MODE_2)).So I'm moving it to the begining of
run(), it should fix the issue.Quoted 1 line
Quoted 11 lines
Quoted 11 lines
tests/kms_psr2_su.c line 278
Quoted 11 lines
tests/kms_psr2_su.c new file +3
-0+ +/* blocking timerfd */ + data.change_screen_timerfd =
timerfd_create(CLOCK_MONOTONIC, 0);tests/kms_psr2_su.c new file +5
-0+igt_require (data.change_screen_timerfd !=-1 ); +/* Changing screen at 30hz to support 30hz panels */ + interval.it_value.tv_nsec =NSEC_PER_SEC /30 ; + interval.it_value.tv_sec =0 ; + interval.it_interval.tv_nsec =interval.it_value.tv_nsec;
tests/kms_psr2_su.c new file +1
-0+ interval.it_interval.tv_sec = interval.it_value.tv_sec;
Can we do something like this to reduce these lines? struct itimerspec interval = {{NSEC_PER_SEC / 30, 0},
{NSEC_PER_SEC / 30, 0}};Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
tests/kms_psr2_su.c new file +1
-0+ r = timerfd_settime(data.change_screen_timerfd, 0,&interval, NULL);
Okay, now I see you chose int.
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
tests/kms_psr2_su.c new file +19
-0+igt_require_f (r !=-1 ,"Error setting timerfd\n" ); + } + +for (data.op =PAGE_FLIP ; data.op <LAST ; data.op++) { + igt_subtest_f("%s", op_str(data.op)) { +prepare (&data); +run (&data); +cleanup (&data); + } + } + + igt_fixture { +close (data.debugfs_fd); +drm_intel_bufmgr_destroy (data.bufmgr); +display_fini (&data); + } + +igt_exit (); +}tests/meson.build +0
-0
Quoted 8 lines
Quoted 8 lines
tests/meson.build test_progs = [ · line 56
Quoted 8 lines
tests/meson.build +1
-0@@ -50,6 +50,7 @@ test_progs = [ 'kms_plane_scaling', 'kms_properties', 'kms_psr', + 'kms_psr2_su', 'kms_pwrite_crc', 'kms_rmfb', 'kms_rotation_crc',
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH v5 4/4 DO NOT MERGE: Check result of kms_psr2_su tests
In reply to José Roberto de Souza--- tests/intel-ci/fast-feedback.testlist | 2 ++ 1 file changed, 2 insertions(+)
tests/intel-ci/fast-feedback.testlist +2 -0
@@ -231,6 +231,8 @@ igt@kms_psr@psr2_primary_page_flip igt@kms_psr@psr2_cursor_plane_move igt@kms_psr@psr2_sprite_plane_onoff igt@kms_psr@psr2_primary_mmap_gtt +igt@kms_psr2_su@page_flip +igt@kms_psr2_su@frontbuffer igt@kms_setmode@basic-clone-single-crtc igt@pm_backlight@basic-brightness igt@pm_rpm@basic-pci-d3-state
Signature · 6 lines
2.20.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,v5,1/4] test/psr: Do not fail tests when kernel set a valid disabled reason
In reply to José Roberto de Souza== Series Details ==
== Series Details ==
Series: series starting with [i-g-t,v5,1/4] test/psr: Do not fail tests when kernel set a valid disabled reason
URL : https://patchwork.freedesktop.org/series/55766/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_5488 -> IGTPW_2296
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/55766/revisions/1/mbox/
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_2296:
### IGT changes ###
#### Suppressed ####
The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.
* {igt@kms_psr@psr2_primary_page_flip}:
- fi-whl-u: NOTRUN -> FAIL +5
Known issues
------------
Here are the changes found in IGTPW_2296 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@i915_module_load@reload:
- fi-blb-e6850: PASS -> INCOMPLETE [fdo#107718]
* igt@kms_flip@basic-flip-vs-dpms:
- fi-skl-6700hq: PASS -> DMESG-WARN [fdo#105998]
#### Possible fixes ####
* igt@kms_busy@basic-flip-a:
- fi-gdg-551: FAIL [fdo#103182] -> PASS
* igt@kms_chamelium@dp-edid-read:
- fi-kbl-7500u: WARN -> PASS
* igt@kms_pipe_crc_basic@read-crc-pipe-a:
- fi-byt-clapper: FAIL [fdo#107362] -> PASS
* igt@kms_pipe_crc_basic@read-crc-pipe-b-frame-sequence:
- fi-byt-clapper: FAIL [fdo#103191] / [fdo#107362] -> PASS +1
* igt@pm_rpm@module-reload:
- fi-skl-6770hq: FAIL [fdo#108511] -> PASS
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#103182]: https://bugs.freedesktop.org/show_bug.cgi?id=103182
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#105998]: https://bugs.freedesktop.org/show_bug.cgi?id=105998
[fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#108511]: https://bugs.freedesktop.org/show_bug.cgi?id=108511
[fdo#108654]: https://bugs.freedesktop.org/show_bug.cgi?id=108654
[fdo#108915]: https://bugs.freedesktop.org/show_bug.cgi?id=108915
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
Participating hosts (44 -> 41)
------------------------------
Additional (1): fi-icl-y
Missing (4): fi-kbl-soraka fi-ilk-m540 fi-byt-squawks fi-bsw-cyan
Build changes
-------------
* IGT: IGT_4790 -> IGTPW_2296
CI_DRM_5488: f13eede6ea3e780d900c5220bf09d764a80a3a8f @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2296: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2296/
IGT_4790: dcdf4b04e16312f8f52ad389388d834f9d74b8f0 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Testlist changes ==
+igt@kms_psr2_su@frontbuffer
+igt@kms_psr2_su@page_flip
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2296/
_______________________________________________
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,v5,1/4] test/psr: Do not fail tests when kernel set a valid disabled reason
In reply to José Roberto de Souza== Series Details ==
== Series Details ==
Series: series starting with [i-g-t,v5,1/4] test/psr: Do not fail tests when kernel set a valid disabled reason
URL : https://patchwork.freedesktop.org/series/55766/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_5488_full -> IGTPW_2296_full
====================================================
Summary
-------
**WARNING**
Minor unknown changes coming with IGTPW_2296_full need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in IGTPW_2296_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://patchwork.freedesktop.org/api/1.0/series/55766/revisions/1/mbox/
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_2296_full:
### IGT changes ###
#### Warnings ####
* igt@gem_eio@in-flight-immediate:
- shard-kbl: DMESG-FAIL -> DMESG-WARN
Known issues
------------
Here are the changes found in IGTPW_2296_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_exec_schedule@pi-ringfull-blt:
- shard-glk: NOTRUN -> FAIL [fdo#103158]
- shard-apl: NOTRUN -> FAIL [fdo#103158]
* igt@gem_exec_schedule@pi-ringfull-bsd2:
- shard-kbl: NOTRUN -> FAIL [fdo#103158]
* igt@kms_busy@extended-modeset-hang-newfb-render-a:
- shard-snb: NOTRUN -> DMESG-WARN [fdo#107956]
* igt@kms_ccs@pipe-a-crc-sprite-planes-basic:
- shard-apl: PASS -> FAIL [fdo#106510] / [fdo#108145]
* igt@kms_cursor_crc@cursor-128x42-onscreen:
- shard-kbl: PASS -> FAIL [fdo#103232]
* igt@kms_cursor_crc@cursor-256x85-onscreen:
- shard-apl: PASS -> FAIL [fdo#103232] +4
* igt@kms_cursor_crc@cursor-64x64-suspend:
- shard-glk: PASS -> FAIL [fdo#103232] +1
- shard-apl: PASS -> FAIL [fdo#103191] / [fdo#103232]
* igt@kms_cursor_legacy@2x-long-nonblocking-modeset-vs-cursor-atomic:
- shard-glk: NOTRUN -> FAIL [fdo#105454] / [fdo#106509]
* igt@kms_flip@flip-vs-expired-vblank:
- shard-glk: PASS -> FAIL [fdo#102887]
* igt@kms_plane@pixel-format-pipe-a-planes-source-clamping:
- shard-glk: PASS -> FAIL [fdo#108948]
* igt@kms_plane@pixel-format-pipe-c-planes-source-clamping:
- shard-apl: PASS -> FAIL [fdo#108948]
* igt@kms_plane@plane-position-covered-pipe-c-planes:
- shard-apl: PASS -> FAIL [fdo#103166] +2
* igt@kms_plane_alpha_blend@pipe-b-alpha-7efc:
- shard-kbl: NOTRUN -> FAIL [fdo#108145] / [fdo#108590]
* igt@kms_plane_alpha_blend@pipe-b-alpha-opaque-fb:
- shard-glk: PASS -> FAIL [fdo#108145]
* igt@kms_plane_alpha_blend@pipe-b-alpha-transparant-fb:
- shard-kbl: NOTRUN -> FAIL [fdo#108145] +1
* igt@kms_plane_alpha_blend@pipe-b-constant-alpha-max:
- shard-glk: NOTRUN -> FAIL [fdo#108145] +1
- shard-apl: NOTRUN -> FAIL [fdo#108145]
* igt@kms_plane_multiple@atomic-pipe-c-tiling-x:
- shard-glk: PASS -> FAIL [fdo#103166] +1
* igt@kms_rotation_crc@multiplane-rotation-cropping-top:
- shard-apl: PASS -> DMESG-FAIL [fdo#108950]
#### Possible fixes ####
* igt@kms_available_modes_crc@available_mode_test_crc:
- shard-glk: FAIL [fdo#106641] -> PASS
* igt@kms_color@pipe-b-degamma:
- shard-apl: FAIL [fdo#104782] -> PASS +1
* igt@kms_cursor_crc@cursor-64x21-onscreen:
- shard-glk: FAIL [fdo#103232] -> PASS +2
* igt@kms_cursor_crc@cursor-64x21-random:
- shard-kbl: FAIL [fdo#103232] -> PASS
* igt@kms_plane@pixel-format-pipe-a-planes:
- shard-kbl: FAIL [fdo#103166] -> PASS
* igt@kms_plane_alpha_blend@pipe-b-alpha-opaque-fb:
- shard-apl: FAIL [fdo#108145] -> PASS
* igt@kms_plane_multiple@atomic-pipe-a-tiling-y:
- shard-glk: FAIL [fdo#103166] -> PASS +3
* igt@kms_plane_multiple@atomic-pipe-b-tiling-none:
- shard-apl: FAIL [fdo#103166] -> PASS +1
* igt@kms_setmode@basic:
- shard-apl: FAIL [fdo#99912] -> PASS
* igt@perf_pmu@rc6-runtime-pm-long:
- shard-kbl: FAIL [fdo#105010] -> PASS
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#102887]: https://bugs.freedesktop.org/show_bug.cgi?id=102887
[fdo#103158]: https://bugs.freedesktop.org/show_bug.cgi?id=103158
[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#104782]: https://bugs.freedesktop.org/show_bug.cgi?id=104782
[fdo#105010]: https://bugs.freedesktop.org/show_bug.cgi?id=105010
[fdo#105454]: https://bugs.freedesktop.org/show_bug.cgi?id=105454
[fdo#106509]: https://bugs.freedesktop.org/show_bug.cgi?id=106509
[fdo#106510]: https://bugs.freedesktop.org/show_bug.cgi?id=106510
[fdo#106641]: https://bugs.freedesktop.org/show_bug.cgi?id=106641
[fdo#107956]: https://bugs.freedesktop.org/show_bug.cgi?id=107956
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108590]: https://bugs.freedesktop.org/show_bug.cgi?id=108590
[fdo#108948]: https://bugs.freedesktop.org/show_bug.cgi?id=108948
[fdo#108950]: https://bugs.freedesktop.org/show_bug.cgi?id=108950
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109373]: https://bugs.freedesktop.org/show_bug.cgi?id=109373
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912
[k.org#202321]: https://bugzilla.kernel.org/show_bug.cgi?id=202321
Participating hosts (7 -> 5)
------------------------------
Missing (2): shard-skl shard-iclb
Build changes
-------------
* IGT: IGT_4790 -> IGTPW_2296
* Piglit: piglit_4509 -> None
CI_DRM_5488: f13eede6ea3e780d900c5220bf09d764a80a3a8f @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2296: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2296/
IGT_4790: dcdf4b04e16312f8f52ad389388d834f9d74b8f0 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2296/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev