* [igt-dev] [PATCH i-g-t] test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP @ 2018-12-13 0:57 Anusha 2018-12-13 1:21 ` [igt-dev] ✓ Fi.CI.BAT: success for test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP (rev6) Patchwork ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: Anusha @ 2018-12-13 0:57 UTC (permalink / raw) To: igt-dev Cc: Anusha Srivatsa, Petri Latvala, Manasi Navare, Dhinakaran Pandiyan From: Manasi Navare <manasi.d.navare@intel.com> This patch adds a basic kms test to validate the display stream compression functionality if supported on DP/eDP connector. Currently this has only two subtests to force the DSC on all the eDP and DP connectors that support it with default parameters. This will be expanded to add more subtests to tweak DSC parameters. v6: (from Anusha) * Fix run_test() (Petri) * Fix update_display() to avoid leaks. (Petri) v5: * Fix test cleanup to avoid crash (Petri) v4: * Future proof for more test types (Petri) * Fix alphabetical order (Petri) * s/igt_display_init/igt_display_require (Petri) * Remove blank lines after return (Petri) v3: * Use array of connectors and loop through (Petri) * Also check for FEC on DP connectors (Manasi) * Add a Pipe_A restriction on DP (Ville) v2: * Use IGT wrappers for all (DK, Antonio) * Split into two subtests for eDP and DP types (Petri) Cc: Petri Latvala <petri.latvala@intel.com> Cc: Antonio Argenziano <antonio.argenziano@intel.com> Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Anusha Srivatsa <anusha.srivatsa@intel.com> Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com> Signed-off-by: Manasi Navare <manasi.d.navare@intel.com> --- tests/Makefile.sources | 1 + tests/kms_dp_dsc.c | 264 +++++++++++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 3 files changed, 266 insertions(+) create mode 100644 tests/kms_dp_dsc.c diff --git a/tests/Makefile.sources b/tests/Makefile.sources index eedde1e8..a3c24c99 100644 --- a/tests/Makefile.sources +++ b/tests/Makefile.sources @@ -54,6 +54,7 @@ TESTS_progs = \ kms_crtc_background_color \ kms_cursor_crc \ kms_cursor_legacy \ + kms_dp_dsc \ kms_draw_crc \ kms_fbcon_fbt \ kms_fence_pin_leak \ diff --git a/tests/kms_dp_dsc.c b/tests/kms_dp_dsc.c new file mode 100644 index 00000000..884a7717 --- /dev/null +++ b/tests/kms_dp_dsc.c @@ -0,0 +1,264 @@ +/* + * Copyright © 2018 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. + * + * Displayport Display Stream Compression test + * Until the CRC support is added this needs to be invoked with --interactive + * to manually verify if the test pattern is seen without corruption for each + * subtest. + * + * Authors: + * Manasi Navare <manasi.d.navare@intel.com> + * + */ +#include "igt.h" +#include "igt_sysfs.h" +#include <errno.h> +#include <getopt.h> +#include <math.h> +#include <stdint.h> +#include <stdbool.h> +#include <strings.h> +#include <unistd.h> +#include <stdlib.h> +#include <signal.h> +#include <time.h> +#include <fcntl.h> +#include <termios.h> + +enum dsc_test_type +{ + test_basic_dsc_enable +}; + +typedef struct { + int drm_fd; + int debugfs_fd; + uint32_t id; + igt_display_t display; + struct igt_fb fb_test_pattern; + igt_output_t *output; + int mode_valid; + drmModeModeInfo *mode; + drmModeConnector *connector; + drmModeEncoder *encoder; + int crtc; + enum pipe pipe; + char conn_name[128]; +} data_t; + +static inline void manual(const char *expected) +{ + igt_debug_manual_check("all", expected); +} + +static bool is_dp_dsc_supported(data_t *data) +{ + char file_name[128] = {0}; + char buf[512]; + + strcpy(file_name, data->conn_name); + strcat(file_name, "/i915_dsc_fec_support"); + igt_require(igt_debugfs_simple_read(data->debugfs_fd, file_name, buf, + sizeof(buf)) > 0); + igt_debugfs_read(data->drm_fd, file_name, buf); + + return strstr(buf, "DSC_Sink_Support: yes"); +} + +static bool is_dp_fec_supported(data_t *data) +{ + char file_name[128] = {0}; + char buf[512]; + + strcpy(file_name, data->conn_name); + strcat(file_name, "/i915_dsc_fec_support"); + igt_debugfs_read(data->drm_fd, file_name, buf); + + return strstr(buf, "FEC_Sink_Support: yes"); +} + +static bool is_dp_dsc_enabled(data_t *data) +{ + char file_name[128] = {0}; + char buf[512]; + + strcpy(file_name, data->conn_name); + strcat(file_name, "/i915_dsc_fec_support"); + igt_debugfs_read(data->drm_fd, file_name, buf); + + return strstr(buf, "DSC_Enabled: yes"); +} + +static void force_dp_dsc_enable(data_t *data) +{ + char file_name[128] = {0}; + int ret; + + strcpy(file_name, data->conn_name); + strcat(file_name, "/i915_dsc_fec_support"); + igt_debug ("Forcing DSC enable on %s\n", data->conn_name); + ret = igt_sysfs_write(data->debugfs_fd, file_name, "1", 1); + igt_assert_f(ret > 0, "debugfs_write failed"); +} + +static void clear_dp_dsc_enable(data_t *data) +{ + char file_name[128] = {0}; + int ret; + + strcpy(file_name, data->conn_name); + strcat(file_name, "/i915_dsc_fec_support"); + igt_debug ("Clearing DSC enable on %s\n", data->conn_name); + ret = igt_sysfs_write(data->debugfs_fd, file_name, "0", 1); + igt_assert_f(ret > 0, "debugfs_write failed"); +} + +static void test_cleanup(data_t *data) { + igt_plane_t *primary; + + if (data->output) { + primary = igt_output_get_plane_type(data->output, + DRM_PLANE_TYPE_PRIMARY); + igt_plane_set_fb(primary, NULL); + igt_display_commit(&data->display); + + igt_remove_fb(data->drm_fd, &data->fb_test_pattern); + } +} + + +/* + * Re-probe connectors and do a modeset with DSC + * + */ +static void update_display(data_t *data, enum dsc_test_type test_type) +{ + igt_plane_t *primary; + data->mode = igt_output_get_mode(data->output); + data->connector = data->output->config.connector; + + if (data->connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort && + data->pipe == PIPE_A) { + igt_debug ("DSC not supported on Pipe A on external DP\n"); + return; + } + + if (test_type == test_basic_dsc_enable) { + igt_debug ("DSC is supported on %s\n", + data->conn_name); + force_dp_dsc_enable(data); + /* Clear the fb in order to avoid leaks */ + igt_remove_fb(data->drm_fd, &data->fb_test_pattern); + igt_create_pattern_fb(data->drm_fd, data->mode->hdisplay, + data->mode->vdisplay, + DRM_FORMAT_XRGB8888, + LOCAL_DRM_FORMAT_MOD_NONE, + &data->fb_test_pattern); + primary = igt_output_get_plane_type(data->output, + DRM_PLANE_TYPE_PRIMARY); + igt_plane_set_fb(primary, &data->fb_test_pattern); + igt_display_commit(&data->display); + /* Until we have CRC check support, manually check if RGB test pattern has no corruption */ + manual ("RGB test pattern without corruption"); + igt_assert_f(is_dp_dsc_enabled(data), + "Default DSC enable failed on Connector: %s Pipe: %s", + data->conn_name, + kmstest_pipe_name(data->pipe)); + clear_dp_dsc_enable(data); + } else { + igt_assert(!"Unknown test type\n"); + } +} + +static void run_test(data_t *data, igt_output_t *output, + enum dsc_test_type test_type) +{ + enum pipe pipe; + + for_each_pipe_static(pipe) { + if (igt_pipe_connector_valid(pipe, output)) { + igt_output_set_pipe(output, pipe); + data->pipe = pipe; + data->output = output; + update_display(data, test_type); + } + } +} + +igt_main +{ + data_t data = {}; + igt_output_t *output; + drmModeRes *res; + drmModeConnector *connector; + int i, test_conn_cnt, test_cnt; + int tests[] = {DRM_MODE_CONNECTOR_eDP, DRM_MODE_CONNECTOR_DisplayPort}; + + igt_fixture { + data.drm_fd = drm_open_driver_master(DRIVER_ANY); + data.debugfs_fd = igt_debugfs_dir(data.drm_fd); + kmstest_set_vt_graphics_mode(); + igt_display_require(&data.display, data.drm_fd); + //igt_display_require_output(&data.display); + igt_require(res = drmModeGetResources(data.drm_fd)); + } + + for (test_cnt = 0; test_cnt < ARRAY_SIZE(tests); test_cnt++) { + + igt_subtest_f("basic-dsc-enable-%s", + kmstest_connector_type_str(tests[test_cnt])) { + test_conn_cnt = 0; + for (i = 0; i < res->count_connectors; i++) { + connector = drmModeGetConnectorCurrent(data.drm_fd, + res->connectors[i]); + if (connector->connection != DRM_MODE_CONNECTED || + connector->connector_type != + tests[test_cnt]) + continue; + test_conn_cnt++; + output = igt_output_from_connector(&data.display, connector); + sprintf(data.conn_name, "%s-%d", + kmstest_connector_type_str(connector->connector_type), + test_conn_cnt); + igt_require_f(is_dp_dsc_supported(&data), + "DSC not supported on connector %s \n", + data.conn_name); + if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) + igt_require_f(is_dp_fec_supported(&data), + "DSC cannot be enabled without FEC on %s\n", + data.conn_name); + run_test(&data, output, test_basic_dsc_enable); + } + test_cleanup(&data); + igt_skip_on(test_conn_cnt == 0); + } + } + + igt_fixture { + drmModeFreeConnector(connector); + drmModeFreeResources(res); + close(data.debugfs_fd); + close(data.drm_fd); + igt_display_fini(&data.display); + } + igt_exit(); +} diff --git a/tests/meson.build b/tests/meson.build index b8a6e61b..e14ab2b4 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -25,6 +25,7 @@ test_progs = [ 'kms_crtc_background_color', 'kms_cursor_crc', 'kms_cursor_legacy', + 'kms_dp_dsc', 'kms_draw_crc', 'kms_fbcon_fbt', 'kms_fence_pin_leak', -- 2.17.0 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [igt-dev] ✓ Fi.CI.BAT: success for test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP (rev6) 2018-12-13 0:57 [igt-dev] [PATCH i-g-t] test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP Anusha @ 2018-12-13 1:21 ` Patchwork 2018-12-13 2:19 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork 2018-12-17 12:00 ` [igt-dev] [PATCH i-g-t] test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP Petri Latvala 2 siblings, 0 replies; 7+ messages in thread From: Patchwork @ 2018-12-13 1:21 UTC (permalink / raw) To: Manasi Navare; +Cc: igt-dev == Series Details == Series: test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP (rev6) URL : https://patchwork.freedesktop.org/series/50652/ State : success == Summary == CI Bug Log - changes from CI_DRM_5309 -> IGTPW_2145 ==================================================== Summary ------- **WARNING** Minor unknown changes coming with IGTPW_2145 need to be verified manually. If you think the reported changes have nothing to do with the changes introduced in IGTPW_2145, 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/50652/revisions/6/mbox/ Possible new issues ------------------- Here are the unknown changes that may have been introduced in IGTPW_2145: ### IGT changes ### #### Warnings #### * igt@kms_busy@basic-flip-a: - fi-kbl-7567u: SKIP -> PASS +2 * igt@kms_pipe_crc_basic@nonblocking-crc-pipe-c: - fi-kbl-7567u: PASS -> SKIP +33 Known issues ------------ Here are the changes found in IGTPW_2145 that come from known issues: ### IGT changes ### #### Issues hit #### * igt@i915_selftest@live_hangcheck: - fi-bwr-2160: PASS -> DMESG-FAIL [fdo#108735] * igt@kms_chamelium@hdmi-hpd-fast: - fi-kbl-7500u: PASS -> FAIL [fdo#108767] * igt@kms_pipe_crc_basic@read-crc-pipe-b-frame-sequence: - fi-byt-clapper: PASS -> FAIL [fdo#103191] / [fdo#107362] +1 #### Possible fixes #### * igt@gem_ctx_create@basic-files: - fi-kbl-7560u: INCOMPLETE [fdo#103665] -> PASS * igt@kms_frontbuffer_tracking@basic: - fi-hsw-peppy: DMESG-WARN [fdo#102614] -> PASS [fdo#102614]: https://bugs.freedesktop.org/show_bug.cgi?id=102614 [fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191 [fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665 [fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362 [fdo#108735]: https://bugs.freedesktop.org/show_bug.cgi?id=108735 [fdo#108767]: https://bugs.freedesktop.org/show_bug.cgi?id=108767 Participating hosts (48 -> 43) ------------------------------ Additional (1): fi-skl-6700hq Missing (6): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-ctg-p8600 fi-pnv-d510 Build changes ------------- * IGT: IGT_4746 -> IGTPW_2145 CI_DRM_5309: c2be30e2c6fa9dec6a623e0ddd1b76f6794db979 @ git://anongit.freedesktop.org/gfx-ci/linux IGTPW_2145: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2145/ IGT_4746: 2c793666d8c8328733f5769b16ae5858fee97f3f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools == Testlist changes == +igt@kms_dp_dsc@basic-dsc-enable-dp +igt@kms_dp_dsc@basic-dsc-enable-edp == Logs == For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2145/ _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 7+ messages in thread
* [igt-dev] ✗ Fi.CI.IGT: failure for test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP (rev6) 2018-12-13 0:57 [igt-dev] [PATCH i-g-t] test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP Anusha 2018-12-13 1:21 ` [igt-dev] ✓ Fi.CI.BAT: success for test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP (rev6) Patchwork @ 2018-12-13 2:19 ` Patchwork 2018-12-17 12:00 ` [igt-dev] [PATCH i-g-t] test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP Petri Latvala 2 siblings, 0 replies; 7+ messages in thread From: Patchwork @ 2018-12-13 2:19 UTC (permalink / raw) To: Manasi Navare; +Cc: igt-dev == Series Details == Series: test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP (rev6) URL : https://patchwork.freedesktop.org/series/50652/ State : failure == Summary == CI Bug Log - changes from CI_DRM_5309_full -> IGTPW_2145_full ==================================================== Summary ------- **FAILURE** Serious unknown changes coming with IGTPW_2145_full absolutely need to be verified manually. If you think the reported changes have nothing to do with the changes introduced in IGTPW_2145_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/50652/revisions/6/mbox/ Possible new issues ------------------- Here are the unknown changes that may have been introduced in IGTPW_2145_full: ### IGT changes ### #### Possible regressions #### * igt@gem_busy@extended-semaphore-blt: - shard-hsw: PASS -> FAIL #### Warnings #### * igt@pm_rc6_residency@rc6-accuracy: - shard-snb: SKIP -> PASS Known issues ------------ Here are the changes found in IGTPW_2145_full that come from known issues: ### IGT changes ### #### Issues hit #### * igt@kms_ccs@pipe-a-crc-sprite-planes-basic: - shard-glk: PASS -> FAIL [fdo#108145] +1 * igt@kms_color@pipe-b-degamma: - shard-apl: PASS -> DMESG-WARN [fdo#103558] / [fdo#105602] +3 * igt@kms_cursor_crc@cursor-128x42-onscreen: - shard-glk: PASS -> FAIL [fdo#103232] +2 * igt@kms_cursor_crc@cursor-256x85-onscreen: - shard-apl: PASS -> FAIL [fdo#103232] +1 - shard-kbl: PASS -> FAIL [fdo#103232] * igt@kms_cursor_legacy@all-pipes-single-move: - shard-apl: PASS -> INCOMPLETE [fdo#103927] * igt@kms_flip@flip-vs-expired-vblank-interruptible: - shard-glk: PASS -> FAIL [fdo#102887] / [fdo#105363] * igt@kms_frontbuffer_tracking@fbc-1p-rte: - shard-glk: PASS -> FAIL [fdo#103167] / [fdo#105682] * igt@kms_frontbuffer_tracking@fbc-2p-primscrn-cur-indfb-draw-blt: - shard-glk: PASS -> FAIL [fdo#103167] +10 * igt@kms_plane@pixel-format-pipe-c-planes-source-clamping: - shard-glk: PASS -> FAIL [fdo#108948] * igt@kms_plane@plane-position-covered-pipe-b-planes: - shard-kbl: PASS -> FAIL [fdo#103166] * igt@kms_plane@plane-position-covered-pipe-c-planes: - shard-apl: PASS -> FAIL [fdo#103166] +1 * igt@kms_plane_multiple@atomic-pipe-a-tiling-y: - shard-glk: PASS -> FAIL [fdo#103166] +4 * igt@kms_plane_multiple@atomic-pipe-c-tiling-x: - shard-glk: NOTRUN -> FAIL [fdo#103166] * igt@kms_setmode@basic: - shard-kbl: PASS -> FAIL [fdo#99912] #### Possible fixes #### * igt@gem_exec_fence@basic-await-default: - shard-hsw: FAIL [fdo#108888] -> PASS * igt@kms_cursor_crc@cursor-128x128-suspend: - shard-apl: FAIL [fdo#103191] / [fdo#103232] -> PASS * igt@kms_cursor_crc@cursor-256x85-sliding: - shard-kbl: FAIL [fdo#103232] -> PASS - shard-apl: FAIL [fdo#103232] -> PASS - shard-glk: FAIL [fdo#103232] -> PASS +1 * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt: - shard-apl: FAIL [fdo#103167] -> PASS * igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-indfb-pgflip-blt: - shard-snb: INCOMPLETE [fdo#105411] / [fdo#107469] -> SKIP * igt@kms_plane@pixel-format-pipe-a-planes-source-clamping: - shard-apl: FAIL [fdo#108948] -> PASS * igt@kms_plane_alpha_blend@pipe-b-alpha-opaque-fb: - shard-glk: FAIL [fdo#108145] -> PASS +2 * igt@kms_vblank@pipe-b-ts-continuation-suspend: - shard-kbl: INCOMPLETE [fdo#103665] -> PASS [fdo#102887]: https://bugs.freedesktop.org/show_bug.cgi?id=102887 [fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166 [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167 [fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191 [fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232 [fdo#103558]: https://bugs.freedesktop.org/show_bug.cgi?id=103558 [fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665 [fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927 [fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363 [fdo#105411]: https://bugs.freedesktop.org/show_bug.cgi?id=105411 [fdo#105602]: https://bugs.freedesktop.org/show_bug.cgi?id=105602 [fdo#105682]: https://bugs.freedesktop.org/show_bug.cgi?id=105682 [fdo#107469]: https://bugs.freedesktop.org/show_bug.cgi?id=107469 [fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145 [fdo#108888]: https://bugs.freedesktop.org/show_bug.cgi?id=108888 [fdo#108948]: https://bugs.freedesktop.org/show_bug.cgi?id=108948 [fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912 Participating hosts (7 -> 5) ------------------------------ Missing (2): shard-skl shard-iclb Build changes ------------- * IGT: IGT_4746 -> IGTPW_2145 * Piglit: piglit_4509 -> None CI_DRM_5309: c2be30e2c6fa9dec6a623e0ddd1b76f6794db979 @ git://anongit.freedesktop.org/gfx-ci/linux IGTPW_2145: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2145/ IGT_4746: 2c793666d8c8328733f5769b16ae5858fee97f3f @ 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_2145/ _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [igt-dev] [PATCH i-g-t] test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP 2018-12-13 0:57 [igt-dev] [PATCH i-g-t] test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP Anusha 2018-12-13 1:21 ` [igt-dev] ✓ Fi.CI.BAT: success for test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP (rev6) Patchwork 2018-12-13 2:19 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork @ 2018-12-17 12:00 ` Petri Latvala 2018-12-17 19:44 ` Srivatsa, Anusha 2 siblings, 1 reply; 7+ messages in thread From: Petri Latvala @ 2018-12-17 12:00 UTC (permalink / raw) To: Anusha; +Cc: igt-dev, Manasi Navare, Dhinakaran Pandiyan On Wed, Dec 12, 2018 at 04:57:39PM -0800, Anusha wrote: > From: Manasi Navare <manasi.d.navare@intel.com> > > This patch adds a basic kms test to validate the display stream > compression functionality if supported on DP/eDP connector. > Currently this has only two subtests to force the DSC on all > the eDP and DP connectors that support it with default parameters. > This will be expanded to add more subtests to tweak DSC parameters. > > v6: (from Anusha) > * Fix run_test() (Petri) > * Fix update_display() to avoid leaks. (Petri) > v5: > * Fix test cleanup to avoid crash (Petri) > v4: > * Future proof for more test types (Petri) > * Fix alphabetical order (Petri) > * s/igt_display_init/igt_display_require (Petri) > * Remove blank lines after return (Petri) > v3: > * Use array of connectors and loop through (Petri) > * Also check for FEC on DP connectors (Manasi) > * Add a Pipe_A restriction on DP (Ville) > v2: > * Use IGT wrappers for all (DK, Antonio) > * Split into two subtests for eDP and DP types (Petri) > > Cc: Petri Latvala <petri.latvala@intel.com> > Cc: Antonio Argenziano <antonio.argenziano@intel.com> > Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> > Cc: Anusha Srivatsa <anusha.srivatsa@intel.com> > Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com> > Signed-off-by: Manasi Navare <manasi.d.navare@intel.com> > --- > tests/Makefile.sources | 1 + > tests/kms_dp_dsc.c | 264 +++++++++++++++++++++++++++++++++++++++++ > tests/meson.build | 1 + > 3 files changed, 266 insertions(+) > create mode 100644 tests/kms_dp_dsc.c > > diff --git a/tests/Makefile.sources b/tests/Makefile.sources > index eedde1e8..a3c24c99 100644 > --- a/tests/Makefile.sources > +++ b/tests/Makefile.sources > @@ -54,6 +54,7 @@ TESTS_progs = \ > kms_crtc_background_color \ > kms_cursor_crc \ > kms_cursor_legacy \ > + kms_dp_dsc \ > kms_draw_crc \ > kms_fbcon_fbt \ > kms_fence_pin_leak \ > diff --git a/tests/kms_dp_dsc.c b/tests/kms_dp_dsc.c > new file mode 100644 > index 00000000..884a7717 > --- /dev/null > +++ b/tests/kms_dp_dsc.c > @@ -0,0 +1,264 @@ > +/* > + * Copyright © 2018 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. > + * > + * Displayport Display Stream Compression test > + * Until the CRC support is added this needs to be invoked with --interactive > + * to manually verify if the test pattern is seen without corruption for each > + * subtest. > + * > + * Authors: > + * Manasi Navare <manasi.d.navare@intel.com> > + * > + */ > +#include "igt.h" > +#include "igt_sysfs.h" > +#include <errno.h> > +#include <getopt.h> > +#include <math.h> > +#include <stdint.h> > +#include <stdbool.h> > +#include <strings.h> > +#include <unistd.h> > +#include <stdlib.h> > +#include <signal.h> > +#include <time.h> > +#include <fcntl.h> > +#include <termios.h> > + > +enum dsc_test_type > +{ > + test_basic_dsc_enable > +}; > + > +typedef struct { > + int drm_fd; > + int debugfs_fd; > + uint32_t id; > + igt_display_t display; > + struct igt_fb fb_test_pattern; > + igt_output_t *output; > + int mode_valid; > + drmModeModeInfo *mode; > + drmModeConnector *connector; > + drmModeEncoder *encoder; > + int crtc; > + enum pipe pipe; > + char conn_name[128]; > +} data_t; > + > +static inline void manual(const char *expected) > +{ > + igt_debug_manual_check("all", expected); > +} > + > +static bool is_dp_dsc_supported(data_t *data) > +{ > + char file_name[128] = {0}; > + char buf[512]; > + > + strcpy(file_name, data->conn_name); > + strcat(file_name, "/i915_dsc_fec_support"); > + igt_require(igt_debugfs_simple_read(data->debugfs_fd, file_name, buf, > + sizeof(buf)) > 0); > + igt_debugfs_read(data->drm_fd, file_name, buf); > + > + return strstr(buf, "DSC_Sink_Support: yes"); > +} > + > +static bool is_dp_fec_supported(data_t *data) > +{ > + char file_name[128] = {0}; > + char buf[512]; > + > + strcpy(file_name, data->conn_name); > + strcat(file_name, "/i915_dsc_fec_support"); > + igt_debugfs_read(data->drm_fd, file_name, buf); > + > + return strstr(buf, "FEC_Sink_Support: yes"); > +} > + > +static bool is_dp_dsc_enabled(data_t *data) > +{ > + char file_name[128] = {0}; > + char buf[512]; > + > + strcpy(file_name, data->conn_name); > + strcat(file_name, "/i915_dsc_fec_support"); > + igt_debugfs_read(data->drm_fd, file_name, buf); > + > + return strstr(buf, "DSC_Enabled: yes"); > +} > + > +static void force_dp_dsc_enable(data_t *data) > +{ > + char file_name[128] = {0}; > + int ret; > + > + strcpy(file_name, data->conn_name); > + strcat(file_name, "/i915_dsc_fec_support"); > + igt_debug ("Forcing DSC enable on %s\n", data->conn_name); > + ret = igt_sysfs_write(data->debugfs_fd, file_name, "1", 1); > + igt_assert_f(ret > 0, "debugfs_write failed"); > +} > + > +static void clear_dp_dsc_enable(data_t *data) > +{ > + char file_name[128] = {0}; > + int ret; > + > + strcpy(file_name, data->conn_name); > + strcat(file_name, "/i915_dsc_fec_support"); > + igt_debug ("Clearing DSC enable on %s\n", data->conn_name); > + ret = igt_sysfs_write(data->debugfs_fd, file_name, "0", 1); > + igt_assert_f(ret > 0, "debugfs_write failed"); > +} > + > +static void test_cleanup(data_t *data) { > + igt_plane_t *primary; > + > + if (data->output) { > + primary = igt_output_get_plane_type(data->output, > + DRM_PLANE_TYPE_PRIMARY); > + igt_plane_set_fb(primary, NULL); > + igt_display_commit(&data->display); > + > + igt_remove_fb(data->drm_fd, &data->fb_test_pattern); > + } > +} Indentation on the if is wrong. > + > + > +/* > + * Re-probe connectors and do a modeset with DSC > + * > + */ > +static void update_display(data_t *data, enum dsc_test_type test_type) > +{ > + igt_plane_t *primary; > + data->mode = igt_output_get_mode(data->output); > + data->connector = data->output->config.connector; > + > + if (data->connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort && > + data->pipe == PIPE_A) { > + igt_debug ("DSC not supported on Pipe A on external DP\n"); > + return; > + } > + > + if (test_type == test_basic_dsc_enable) { > + igt_debug ("DSC is supported on %s\n", > + data->conn_name); > + force_dp_dsc_enable(data); > + /* Clear the fb in order to avoid leaks */ > + igt_remove_fb(data->drm_fd, &data->fb_test_pattern); > + igt_create_pattern_fb(data->drm_fd, data->mode->hdisplay, > + data->mode->vdisplay, > + DRM_FORMAT_XRGB8888, > + LOCAL_DRM_FORMAT_MOD_NONE, > + &data->fb_test_pattern); > + primary = igt_output_get_plane_type(data->output, > + DRM_PLANE_TYPE_PRIMARY); > + igt_plane_set_fb(primary, &data->fb_test_pattern); > + igt_display_commit(&data->display); > + /* Until we have CRC check support, manually check if RGB test pattern has no corruption */ > + manual ("RGB test pattern without corruption"); > + igt_assert_f(is_dp_dsc_enabled(data), > + "Default DSC enable failed on Connector: %s Pipe: %s", > + data->conn_name, > + kmstest_pipe_name(data->pipe)); > + clear_dp_dsc_enable(data); > + } else { > + igt_assert(!"Unknown test type\n"); > + } > +} > + > +static void run_test(data_t *data, igt_output_t *output, > + enum dsc_test_type test_type) > +{ > + enum pipe pipe; > + > + for_each_pipe_static(pipe) { This doesn't need to be the _static loop, for_each_pipe(data->display, pipe) can be used. > + if (igt_pipe_connector_valid(pipe, output)) { > + igt_output_set_pipe(output, pipe); > + data->pipe = pipe; > + data->output = output; > + update_display(data, test_type); > + } > + } > +} > + > +igt_main > +{ > + data_t data = {}; > + igt_output_t *output; > + drmModeRes *res; > + drmModeConnector *connector; > + int i, test_conn_cnt, test_cnt; > + int tests[] = {DRM_MODE_CONNECTOR_eDP, DRM_MODE_CONNECTOR_DisplayPort}; > + > + igt_fixture { > + data.drm_fd = drm_open_driver_master(DRIVER_ANY); > + data.debugfs_fd = igt_debugfs_dir(data.drm_fd); > + kmstest_set_vt_graphics_mode(); > + igt_display_require(&data.display, data.drm_fd); > + //igt_display_require_output(&data.display); > + igt_require(res = drmModeGetResources(data.drm_fd)); > + } > + > + for (test_cnt = 0; test_cnt < ARRAY_SIZE(tests); test_cnt++) { > + > + igt_subtest_f("basic-dsc-enable-%s", > + kmstest_connector_type_str(tests[test_cnt])) { > + test_conn_cnt = 0; > + for (i = 0; i < res->count_connectors; i++) { > + connector = drmModeGetConnectorCurrent(data.drm_fd, > + res->connectors[i]); > + if (connector->connection != DRM_MODE_CONNECTED || > + connector->connector_type != > + tests[test_cnt]) > + continue; > + test_conn_cnt++; > + output = igt_output_from_connector(&data.display, connector); > + sprintf(data.conn_name, "%s-%d", > + kmstest_connector_type_str(connector->connector_type), > + test_conn_cnt); > + igt_require_f(is_dp_dsc_supported(&data), > + "DSC not supported on connector %s \n", > + data.conn_name); This will make the subtest skip when checking DP-1, without trying DP-2 at all. Is that intended? -- Petri Latvala > + if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) > + igt_require_f(is_dp_fec_supported(&data), > + "DSC cannot be enabled without FEC on %s\n", > + data.conn_name); > + run_test(&data, output, test_basic_dsc_enable); > + } > + test_cleanup(&data); > + igt_skip_on(test_conn_cnt == 0); > + } > + } > + > + igt_fixture { > + drmModeFreeConnector(connector); > + drmModeFreeResources(res); > + close(data.debugfs_fd); > + close(data.drm_fd); > + igt_display_fini(&data.display); > + } > + igt_exit(); > +} > diff --git a/tests/meson.build b/tests/meson.build > index b8a6e61b..e14ab2b4 100644 > --- a/tests/meson.build > +++ b/tests/meson.build > @@ -25,6 +25,7 @@ test_progs = [ > 'kms_crtc_background_color', > 'kms_cursor_crc', > 'kms_cursor_legacy', > + 'kms_dp_dsc', > 'kms_draw_crc', > 'kms_fbcon_fbt', > 'kms_fence_pin_leak', > -- > 2.17.0 > _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [igt-dev] [PATCH i-g-t] test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP 2018-12-17 12:00 ` [igt-dev] [PATCH i-g-t] test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP Petri Latvala @ 2018-12-17 19:44 ` Srivatsa, Anusha 2018-12-18 12:12 ` Petri Latvala 0 siblings, 1 reply; 7+ messages in thread From: Srivatsa, Anusha @ 2018-12-17 19:44 UTC (permalink / raw) To: Latvala, Petri; +Cc: igt-dev, Navare, Manasi D, Pandiyan, Dhinakaran >-----Original Message----- >From: Latvala, Petri >Sent: Monday, December 17, 2018 4:00 AM >To: Srivatsa, Anusha <anusha.srivatsa@intel.com> >Cc: igt-dev@lists.freedesktop.org; Navare, Manasi D ><manasi.d.navare@intel.com>; Argenziano, Antonio ><antonio.argenziano@intel.com>; Pandiyan, Dhinakaran ><dhinakaran.pandiyan@intel.com>; Ville Syrjälä <ville.syrjala@linux.intel.com> >Subject: Re: [PATCH i-g-t] test/kms_dp_dsc: Basic KMS test to validate VESA DSC >on DP/eDP > >On Wed, Dec 12, 2018 at 04:57:39PM -0800, Anusha wrote: >> From: Manasi Navare <manasi.d.navare@intel.com> >> >> This patch adds a basic kms test to validate the display stream >> compression functionality if supported on DP/eDP connector. >> Currently this has only two subtests to force the DSC on all the eDP >> and DP connectors that support it with default parameters. >> This will be expanded to add more subtests to tweak DSC parameters. >> >> v6: (from Anusha) >> * Fix run_test() (Petri) >> * Fix update_display() to avoid leaks. (Petri) >> v5: >> * Fix test cleanup to avoid crash (Petri) >> v4: >> * Future proof for more test types (Petri) >> * Fix alphabetical order (Petri) >> * s/igt_display_init/igt_display_require (Petri) >> * Remove blank lines after return (Petri) >> v3: >> * Use array of connectors and loop through (Petri) >> * Also check for FEC on DP connectors (Manasi) >> * Add a Pipe_A restriction on DP (Ville) >> v2: >> * Use IGT wrappers for all (DK, Antonio) >> * Split into two subtests for eDP and DP types (Petri) >> >> Cc: Petri Latvala <petri.latvala@intel.com> >> Cc: Antonio Argenziano <antonio.argenziano@intel.com> >> Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> >> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> >> Cc: Anusha Srivatsa <anusha.srivatsa@intel.com> >> Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com> >> Signed-off-by: Manasi Navare <manasi.d.navare@intel.com> >> --- >> tests/Makefile.sources | 1 + >> tests/kms_dp_dsc.c | 264 +++++++++++++++++++++++++++++++++++++++++ >> tests/meson.build | 1 + >> 3 files changed, 266 insertions(+) >> create mode 100644 tests/kms_dp_dsc.c >> >> diff --git a/tests/Makefile.sources b/tests/Makefile.sources index >> eedde1e8..a3c24c99 100644 >> --- a/tests/Makefile.sources >> +++ b/tests/Makefile.sources >> @@ -54,6 +54,7 @@ TESTS_progs = \ >> kms_crtc_background_color \ >> kms_cursor_crc \ >> kms_cursor_legacy \ >> + kms_dp_dsc \ >> kms_draw_crc \ >> kms_fbcon_fbt \ >> kms_fence_pin_leak \ >> diff --git a/tests/kms_dp_dsc.c b/tests/kms_dp_dsc.c new file mode >> 100644 index 00000000..884a7717 >> --- /dev/null >> +++ b/tests/kms_dp_dsc.c >> @@ -0,0 +1,264 @@ >> +/* >> + * Copyright © 2018 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. >> + * >> + * Displayport Display Stream Compression test >> + * Until the CRC support is added this needs to be invoked with >> +--interactive >> + * to manually verify if the test pattern is seen without corruption >> +for each >> + * subtest. >> + * >> + * Authors: >> + * Manasi Navare <manasi.d.navare@intel.com> >> + * >> + */ >> +#include "igt.h" >> +#include "igt_sysfs.h" >> +#include <errno.h> >> +#include <getopt.h> >> +#include <math.h> >> +#include <stdint.h> >> +#include <stdbool.h> >> +#include <strings.h> >> +#include <unistd.h> >> +#include <stdlib.h> >> +#include <signal.h> >> +#include <time.h> >> +#include <fcntl.h> >> +#include <termios.h> >> + >> +enum dsc_test_type >> +{ >> + test_basic_dsc_enable >> +}; >> + >> +typedef struct { >> + int drm_fd; >> + int debugfs_fd; >> + uint32_t id; >> + igt_display_t display; >> + struct igt_fb fb_test_pattern; >> + igt_output_t *output; >> + int mode_valid; >> + drmModeModeInfo *mode; >> + drmModeConnector *connector; >> + drmModeEncoder *encoder; >> + int crtc; >> + enum pipe pipe; >> + char conn_name[128]; >> +} data_t; >> + >> +static inline void manual(const char *expected) { >> + igt_debug_manual_check("all", expected); } >> + >> +static bool is_dp_dsc_supported(data_t *data) { >> + char file_name[128] = {0}; >> + char buf[512]; >> + >> + strcpy(file_name, data->conn_name); >> + strcat(file_name, "/i915_dsc_fec_support"); >> + igt_require(igt_debugfs_simple_read(data->debugfs_fd, file_name, buf, >> + sizeof(buf)) > 0); >> + igt_debugfs_read(data->drm_fd, file_name, buf); >> + >> + return strstr(buf, "DSC_Sink_Support: yes"); } >> + >> +static bool is_dp_fec_supported(data_t *data) { >> + char file_name[128] = {0}; >> + char buf[512]; >> + >> + strcpy(file_name, data->conn_name); >> + strcat(file_name, "/i915_dsc_fec_support"); >> + igt_debugfs_read(data->drm_fd, file_name, buf); >> + >> + return strstr(buf, "FEC_Sink_Support: yes"); } >> + >> +static bool is_dp_dsc_enabled(data_t *data) { >> + char file_name[128] = {0}; >> + char buf[512]; >> + >> + strcpy(file_name, data->conn_name); >> + strcat(file_name, "/i915_dsc_fec_support"); >> + igt_debugfs_read(data->drm_fd, file_name, buf); >> + >> + return strstr(buf, "DSC_Enabled: yes"); } >> + >> +static void force_dp_dsc_enable(data_t *data) { >> + char file_name[128] = {0}; >> + int ret; >> + >> + strcpy(file_name, data->conn_name); >> + strcat(file_name, "/i915_dsc_fec_support"); >> + igt_debug ("Forcing DSC enable on %s\n", data->conn_name); >> + ret = igt_sysfs_write(data->debugfs_fd, file_name, "1", 1); >> + igt_assert_f(ret > 0, "debugfs_write failed"); } >> + >> +static void clear_dp_dsc_enable(data_t *data) { >> + char file_name[128] = {0}; >> + int ret; >> + >> + strcpy(file_name, data->conn_name); >> + strcat(file_name, "/i915_dsc_fec_support"); >> + igt_debug ("Clearing DSC enable on %s\n", data->conn_name); >> + ret = igt_sysfs_write(data->debugfs_fd, file_name, "0", 1); >> + igt_assert_f(ret > 0, "debugfs_write failed"); } >> + >> +static void test_cleanup(data_t *data) { >> + igt_plane_t *primary; >> + >> + if (data->output) { >> + primary = igt_output_get_plane_type(data->output, >> + DRM_PLANE_TYPE_PRIMARY); >> + igt_plane_set_fb(primary, NULL); >> + igt_display_commit(&data->display); >> + >> + igt_remove_fb(data->drm_fd, &data->fb_test_pattern); >> + } >> +} > > >Indentation on the if is wrong. Oops...will fix it. > >> + >> + >> +/* >> + * Re-probe connectors and do a modeset with DSC >> + * >> + */ >> +static void update_display(data_t *data, enum dsc_test_type >> +test_type) { >> + igt_plane_t *primary; >> + data->mode = igt_output_get_mode(data->output); >> + data->connector = data->output->config.connector; >> + >> + if (data->connector->connector_type == >DRM_MODE_CONNECTOR_DisplayPort && >> + data->pipe == PIPE_A) { >> + igt_debug ("DSC not supported on Pipe A on external DP\n"); >> + return; >> + } >> + >> + if (test_type == test_basic_dsc_enable) { >> + igt_debug ("DSC is supported on %s\n", >> + data->conn_name); >> + force_dp_dsc_enable(data); >> + /* Clear the fb in order to avoid leaks */ >> + igt_remove_fb(data->drm_fd, &data->fb_test_pattern); >> + igt_create_pattern_fb(data->drm_fd, data->mode->hdisplay, >> + data->mode->vdisplay, >> + DRM_FORMAT_XRGB8888, >> + LOCAL_DRM_FORMAT_MOD_NONE, >> + &data->fb_test_pattern); >> + primary = igt_output_get_plane_type(data->output, >> + >DRM_PLANE_TYPE_PRIMARY); >> + igt_plane_set_fb(primary, &data->fb_test_pattern); >> + igt_display_commit(&data->display); >> + /* Until we have CRC check support, manually check if RGB test >pattern has no corruption */ >> + manual ("RGB test pattern without corruption"); >> + igt_assert_f(is_dp_dsc_enabled(data), >> + "Default DSC enable failed on Connector: %s Pipe: >%s", >> + data->conn_name, >> + kmstest_pipe_name(data->pipe)); >> + clear_dp_dsc_enable(data); >> + } else { >> + igt_assert(!"Unknown test type\n"); >> + } >> +} >> + >> +static void run_test(data_t *data, igt_output_t *output, >> + enum dsc_test_type test_type) >> +{ >> + enum pipe pipe; >> + >> + for_each_pipe_static(pipe) { > > >This doesn't need to be the _static loop, for_each_pipe(data->display, pipe) can >be used. Hmmm...looking at both again, it says for_each_pipe_static() is to be used to enumerate per-pipe subtests and for_ each_pipe() cannot be used to enumerate per-pipe subtests. So, if we want to add more subtests wont having _static be useful? > >> + if (igt_pipe_connector_valid(pipe, output)) { >> + igt_output_set_pipe(output, pipe); >> + data->pipe = pipe; >> + data->output = output; >> + update_display(data, test_type); >> + } >> + } >> +} >> + >> +igt_main >> +{ >> + data_t data = {}; >> + igt_output_t *output; >> + drmModeRes *res; >> + drmModeConnector *connector; >> + int i, test_conn_cnt, test_cnt; >> + int tests[] = {DRM_MODE_CONNECTOR_eDP, >> +DRM_MODE_CONNECTOR_DisplayPort}; >> + >> + igt_fixture { >> + data.drm_fd = drm_open_driver_master(DRIVER_ANY); >> + data.debugfs_fd = igt_debugfs_dir(data.drm_fd); >> + kmstest_set_vt_graphics_mode(); >> + igt_display_require(&data.display, data.drm_fd); >> + //igt_display_require_output(&data.display); >> + igt_require(res = drmModeGetResources(data.drm_fd)); >> + } >> + >> + for (test_cnt = 0; test_cnt < ARRAY_SIZE(tests); test_cnt++) { >> + >> + igt_subtest_f("basic-dsc-enable-%s", >> + kmstest_connector_type_str(tests[test_cnt])) { >> + test_conn_cnt = 0; >> + for (i = 0; i < res->count_connectors; i++) { >> + connector = >drmModeGetConnectorCurrent(data.drm_fd, >> + res- >>connectors[i]); >> + if (connector->connection != >DRM_MODE_CONNECTED || >> + connector->connector_type != >> + tests[test_cnt]) >> + continue; >> + test_conn_cnt++; >> + output = >igt_output_from_connector(&data.display, connector); >> + sprintf(data.conn_name, "%s-%d", >> + kmstest_connector_type_str(connector- >>connector_type), >> + test_conn_cnt); >> + igt_require_f(is_dp_dsc_supported(&data), >> + "DSC not supported on connector %s >\n", >> + data.conn_name); > >This will make the subtest skip when checking DP-1, without trying >DP-2 at all. Is that intended? > No. it has to test for DP-2 as well.. But even if the igt_require() here fails, the loop will move on to the next connector right? Anusha Anusha > >-- >Petri Latvala > > > >> + if (connector->connector_type == >DRM_MODE_CONNECTOR_DisplayPort) >> + > igt_require_f(is_dp_fec_supported(&data), >> + "DSC cannot be enabled >without FEC on %s\n", >> + data.conn_name); >> + run_test(&data, output, test_basic_dsc_enable); >> + } >> + test_cleanup(&data); >> + igt_skip_on(test_conn_cnt == 0); >> + } >> + } >> + >> + igt_fixture { >> + drmModeFreeConnector(connector); >> + drmModeFreeResources(res); >> + close(data.debugfs_fd); >> + close(data.drm_fd); >> + igt_display_fini(&data.display); >> + } >> + igt_exit(); >> +} >> diff --git a/tests/meson.build b/tests/meson.build >> index b8a6e61b..e14ab2b4 100644 >> --- a/tests/meson.build >> +++ b/tests/meson.build >> @@ -25,6 +25,7 @@ test_progs = [ >> 'kms_crtc_background_color', >> 'kms_cursor_crc', >> 'kms_cursor_legacy', >> + 'kms_dp_dsc', >> 'kms_draw_crc', >> 'kms_fbcon_fbt', >> 'kms_fence_pin_leak', >> -- >> 2.17.0 >> _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [igt-dev] [PATCH i-g-t] test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP 2018-12-17 19:44 ` Srivatsa, Anusha @ 2018-12-18 12:12 ` Petri Latvala 2018-12-20 19:09 ` Srivatsa, Anusha 0 siblings, 1 reply; 7+ messages in thread From: Petri Latvala @ 2018-12-18 12:12 UTC (permalink / raw) To: Srivatsa, Anusha; +Cc: igt-dev, Navare, Manasi D, Pandiyan, Dhinakaran On Mon, Dec 17, 2018 at 09:44:26PM +0200, Srivatsa, Anusha wrote: > > > >-----Original Message----- > >From: Latvala, Petri > >Sent: Monday, December 17, 2018 4:00 AM > >To: Srivatsa, Anusha <anusha.srivatsa@intel.com> > >Cc: igt-dev@lists.freedesktop.org; Navare, Manasi D > ><manasi.d.navare@intel.com>; Argenziano, Antonio > ><antonio.argenziano@intel.com>; Pandiyan, Dhinakaran > ><dhinakaran.pandiyan@intel.com>; Ville Syrjälä <ville.syrjala@linux.intel.com> > >Subject: Re: [PATCH i-g-t] test/kms_dp_dsc: Basic KMS test to validate VESA DSC > >on DP/eDP > > > >On Wed, Dec 12, 2018 at 04:57:39PM -0800, Anusha wrote: > >> From: Manasi Navare <manasi.d.navare@intel.com> > >> > >> This patch adds a basic kms test to validate the display stream > >> compression functionality if supported on DP/eDP connector. > >> Currently this has only two subtests to force the DSC on all the eDP > >> and DP connectors that support it with default parameters. > >> This will be expanded to add more subtests to tweak DSC parameters. > >> > >> v6: (from Anusha) > >> * Fix run_test() (Petri) > >> * Fix update_display() to avoid leaks. (Petri) > >> v5: > >> * Fix test cleanup to avoid crash (Petri) > >> v4: > >> * Future proof for more test types (Petri) > >> * Fix alphabetical order (Petri) > >> * s/igt_display_init/igt_display_require (Petri) > >> * Remove blank lines after return (Petri) > >> v3: > >> * Use array of connectors and loop through (Petri) > >> * Also check for FEC on DP connectors (Manasi) > >> * Add a Pipe_A restriction on DP (Ville) > >> v2: > >> * Use IGT wrappers for all (DK, Antonio) > >> * Split into two subtests for eDP and DP types (Petri) > >> > >> Cc: Petri Latvala <petri.latvala@intel.com> > >> Cc: Antonio Argenziano <antonio.argenziano@intel.com> > >> Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> > >> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> > >> Cc: Anusha Srivatsa <anusha.srivatsa@intel.com> > >> Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com> > >> Signed-off-by: Manasi Navare <manasi.d.navare@intel.com> > >> --- > >> tests/Makefile.sources | 1 + > >> tests/kms_dp_dsc.c | 264 +++++++++++++++++++++++++++++++++++++++++ > >> tests/meson.build | 1 + > >> 3 files changed, 266 insertions(+) > >> create mode 100644 tests/kms_dp_dsc.c > >> > >> diff --git a/tests/Makefile.sources b/tests/Makefile.sources index > >> eedde1e8..a3c24c99 100644 > >> --- a/tests/Makefile.sources > >> +++ b/tests/Makefile.sources > >> @@ -54,6 +54,7 @@ TESTS_progs = \ > >> kms_crtc_background_color \ > >> kms_cursor_crc \ > >> kms_cursor_legacy \ > >> + kms_dp_dsc \ > >> kms_draw_crc \ > >> kms_fbcon_fbt \ > >> kms_fence_pin_leak \ > >> diff --git a/tests/kms_dp_dsc.c b/tests/kms_dp_dsc.c new file mode > >> 100644 index 00000000..884a7717 > >> --- /dev/null > >> +++ b/tests/kms_dp_dsc.c > >> @@ -0,0 +1,264 @@ > >> +/* > >> + * Copyright © 2018 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. > >> + * > >> + * Displayport Display Stream Compression test > >> + * Until the CRC support is added this needs to be invoked with > >> +--interactive > >> + * to manually verify if the test pattern is seen without corruption > >> +for each > >> + * subtest. > >> + * > >> + * Authors: > >> + * Manasi Navare <manasi.d.navare@intel.com> > >> + * > >> + */ > >> +#include "igt.h" > >> +#include "igt_sysfs.h" > >> +#include <errno.h> > >> +#include <getopt.h> > >> +#include <math.h> > >> +#include <stdint.h> > >> +#include <stdbool.h> > >> +#include <strings.h> > >> +#include <unistd.h> > >> +#include <stdlib.h> > >> +#include <signal.h> > >> +#include <time.h> > >> +#include <fcntl.h> > >> +#include <termios.h> > >> + > >> +enum dsc_test_type > >> +{ > >> + test_basic_dsc_enable > >> +}; > >> + > >> +typedef struct { > >> + int drm_fd; > >> + int debugfs_fd; > >> + uint32_t id; > >> + igt_display_t display; > >> + struct igt_fb fb_test_pattern; > >> + igt_output_t *output; > >> + int mode_valid; > >> + drmModeModeInfo *mode; > >> + drmModeConnector *connector; > >> + drmModeEncoder *encoder; > >> + int crtc; > >> + enum pipe pipe; > >> + char conn_name[128]; > >> +} data_t; > >> + > >> +static inline void manual(const char *expected) { > >> + igt_debug_manual_check("all", expected); } > >> + > >> +static bool is_dp_dsc_supported(data_t *data) { > >> + char file_name[128] = {0}; > >> + char buf[512]; > >> + > >> + strcpy(file_name, data->conn_name); > >> + strcat(file_name, "/i915_dsc_fec_support"); > >> + igt_require(igt_debugfs_simple_read(data->debugfs_fd, file_name, buf, > >> + sizeof(buf)) > 0); > >> + igt_debugfs_read(data->drm_fd, file_name, buf); > >> + > >> + return strstr(buf, "DSC_Sink_Support: yes"); } > >> + > >> +static bool is_dp_fec_supported(data_t *data) { > >> + char file_name[128] = {0}; > >> + char buf[512]; > >> + > >> + strcpy(file_name, data->conn_name); > >> + strcat(file_name, "/i915_dsc_fec_support"); > >> + igt_debugfs_read(data->drm_fd, file_name, buf); > >> + > >> + return strstr(buf, "FEC_Sink_Support: yes"); } > >> + > >> +static bool is_dp_dsc_enabled(data_t *data) { > >> + char file_name[128] = {0}; > >> + char buf[512]; > >> + > >> + strcpy(file_name, data->conn_name); > >> + strcat(file_name, "/i915_dsc_fec_support"); > >> + igt_debugfs_read(data->drm_fd, file_name, buf); > >> + > >> + return strstr(buf, "DSC_Enabled: yes"); } > >> + > >> +static void force_dp_dsc_enable(data_t *data) { > >> + char file_name[128] = {0}; > >> + int ret; > >> + > >> + strcpy(file_name, data->conn_name); > >> + strcat(file_name, "/i915_dsc_fec_support"); > >> + igt_debug ("Forcing DSC enable on %s\n", data->conn_name); > >> + ret = igt_sysfs_write(data->debugfs_fd, file_name, "1", 1); > >> + igt_assert_f(ret > 0, "debugfs_write failed"); } > >> + > >> +static void clear_dp_dsc_enable(data_t *data) { > >> + char file_name[128] = {0}; > >> + int ret; > >> + > >> + strcpy(file_name, data->conn_name); > >> + strcat(file_name, "/i915_dsc_fec_support"); > >> + igt_debug ("Clearing DSC enable on %s\n", data->conn_name); > >> + ret = igt_sysfs_write(data->debugfs_fd, file_name, "0", 1); > >> + igt_assert_f(ret > 0, "debugfs_write failed"); } > >> + > >> +static void test_cleanup(data_t *data) { > >> + igt_plane_t *primary; > >> + > >> + if (data->output) { > >> + primary = igt_output_get_plane_type(data->output, > >> + DRM_PLANE_TYPE_PRIMARY); > >> + igt_plane_set_fb(primary, NULL); > >> + igt_display_commit(&data->display); > >> + > >> + igt_remove_fb(data->drm_fd, &data->fb_test_pattern); > >> + } > >> +} > > > > > >Indentation on the if is wrong. > > Oops...will fix it. > > > > >> + > >> + > >> +/* > >> + * Re-probe connectors and do a modeset with DSC > >> + * > >> + */ > >> +static void update_display(data_t *data, enum dsc_test_type > >> +test_type) { > >> + igt_plane_t *primary; > >> + data->mode = igt_output_get_mode(data->output); > >> + data->connector = data->output->config.connector; > >> + > >> + if (data->connector->connector_type == > >DRM_MODE_CONNECTOR_DisplayPort && > >> + data->pipe == PIPE_A) { > >> + igt_debug ("DSC not supported on Pipe A on external DP\n"); > >> + return; > >> + } > >> + > >> + if (test_type == test_basic_dsc_enable) { > >> + igt_debug ("DSC is supported on %s\n", > >> + data->conn_name); > >> + force_dp_dsc_enable(data); > >> + /* Clear the fb in order to avoid leaks */ > >> + igt_remove_fb(data->drm_fd, &data->fb_test_pattern); > >> + igt_create_pattern_fb(data->drm_fd, data->mode->hdisplay, > >> + data->mode->vdisplay, > >> + DRM_FORMAT_XRGB8888, > >> + LOCAL_DRM_FORMAT_MOD_NONE, > >> + &data->fb_test_pattern); > >> + primary = igt_output_get_plane_type(data->output, > >> + > >DRM_PLANE_TYPE_PRIMARY); > >> + igt_plane_set_fb(primary, &data->fb_test_pattern); > >> + igt_display_commit(&data->display); > >> + /* Until we have CRC check support, manually check if RGB test > >pattern has no corruption */ > >> + manual ("RGB test pattern without corruption"); > >> + igt_assert_f(is_dp_dsc_enabled(data), > >> + "Default DSC enable failed on Connector: %s Pipe: > >%s", > >> + data->conn_name, > >> + kmstest_pipe_name(data->pipe)); > >> + clear_dp_dsc_enable(data); > >> + } else { > >> + igt_assert(!"Unknown test type\n"); > >> + } > >> +} > >> + > >> +static void run_test(data_t *data, igt_output_t *output, > >> + enum dsc_test_type test_type) > >> +{ > >> + enum pipe pipe; > >> + > >> + for_each_pipe_static(pipe) { > > > > > >This doesn't need to be the _static loop, for_each_pipe(data->display, pipe) can > >be used. > > Hmmm...looking at both again, it says for_each_pipe_static() is to be used to enumerate per-pipe subtests and for_ > each_pipe() cannot be used to enumerate per-pipe subtests. So, if we want to add more subtests wont having _static be useful? It means for_each_pipe_static is to be used if you're not inside an igt_subtest or igt_fixture. Inside them you can use real runtime information and for_each_pipe is ok. In pseudocode, these are the use cases for the different forms: for_each_pipe_static(pipe) { igt_subtest_f("do-things-on-pipe-%s", kmstest_pipe_name(pipe)) { ... } } igt_subtest("do-things") { for_each_pipe(...) { ... } } > > > > >> + if (igt_pipe_connector_valid(pipe, output)) { > >> + igt_output_set_pipe(output, pipe); > >> + data->pipe = pipe; > >> + data->output = output; > >> + update_display(data, test_type); > >> + } > >> + } > >> +} > >> + > >> +igt_main > >> +{ > >> + data_t data = {}; > >> + igt_output_t *output; > >> + drmModeRes *res; > >> + drmModeConnector *connector; > >> + int i, test_conn_cnt, test_cnt; > >> + int tests[] = {DRM_MODE_CONNECTOR_eDP, > >> +DRM_MODE_CONNECTOR_DisplayPort}; > >> + > >> + igt_fixture { > >> + data.drm_fd = drm_open_driver_master(DRIVER_ANY); > >> + data.debugfs_fd = igt_debugfs_dir(data.drm_fd); > >> + kmstest_set_vt_graphics_mode(); > >> + igt_display_require(&data.display, data.drm_fd); > >> + //igt_display_require_output(&data.display); > >> + igt_require(res = drmModeGetResources(data.drm_fd)); > >> + } > >> + > >> + for (test_cnt = 0; test_cnt < ARRAY_SIZE(tests); test_cnt++) { > >> + > >> + igt_subtest_f("basic-dsc-enable-%s", > >> + kmstest_connector_type_str(tests[test_cnt])) { > >> + test_conn_cnt = 0; > >> + for (i = 0; i < res->count_connectors; i++) { > >> + connector = > >drmModeGetConnectorCurrent(data.drm_fd, > >> + res- > >>connectors[i]); > >> + if (connector->connection != > >DRM_MODE_CONNECTED || > >> + connector->connector_type != > >> + tests[test_cnt]) > >> + continue; > >> + test_conn_cnt++; > >> + output = > >igt_output_from_connector(&data.display, connector); > >> + sprintf(data.conn_name, "%s-%d", > >> + kmstest_connector_type_str(connector- > >>connector_type), > >> + test_conn_cnt); > >> + igt_require_f(is_dp_dsc_supported(&data), > >> + "DSC not supported on connector %s > >\n", > >> + data.conn_name); > > > >This will make the subtest skip when checking DP-1, without trying > >DP-2 at all. Is that intended? > > > No. it has to test for DP-2 as well.. > But even if the igt_require() here fails, the loop will move on to > the next connector right? No, it jumps out of the igt_subtest block, to the next iteration of the outer loop, which loops over connector types. -- Petri Latvala _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [igt-dev] [PATCH i-g-t] test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP 2018-12-18 12:12 ` Petri Latvala @ 2018-12-20 19:09 ` Srivatsa, Anusha 0 siblings, 0 replies; 7+ messages in thread From: Srivatsa, Anusha @ 2018-12-20 19:09 UTC (permalink / raw) To: Latvala, Petri; +Cc: igt-dev, Navare, Manasi D, Pandiyan, Dhinakaran >-----Original Message----- >From: Latvala, Petri >Sent: Tuesday, December 18, 2018 4:13 AM >To: Srivatsa, Anusha <anusha.srivatsa@intel.com> >Cc: igt-dev@lists.freedesktop.org; Navare, Manasi D ><manasi.d.navare@intel.com>; Argenziano, Antonio ><antonio.argenziano@intel.com>; Pandiyan, Dhinakaran ><dhinakaran.pandiyan@intel.com>; Ville Syrjälä <ville.syrjala@linux.intel.com> >Subject: Re: [PATCH i-g-t] test/kms_dp_dsc: Basic KMS test to validate VESA DSC >on DP/eDP > >On Mon, Dec 17, 2018 at 09:44:26PM +0200, Srivatsa, Anusha wrote: >> >> >> >-----Original Message----- >> >From: Latvala, Petri >> >Sent: Monday, December 17, 2018 4:00 AM >> >To: Srivatsa, Anusha <anusha.srivatsa@intel.com> >> >Cc: igt-dev@lists.freedesktop.org; Navare, Manasi D >> ><manasi.d.navare@intel.com>; Argenziano, Antonio >> ><antonio.argenziano@intel.com>; Pandiyan, Dhinakaran >> ><dhinakaran.pandiyan@intel.com>; Ville Syrjälä >> ><ville.syrjala@linux.intel.com> >> >Subject: Re: [PATCH i-g-t] test/kms_dp_dsc: Basic KMS test to >> >validate VESA DSC on DP/eDP >> > >> >On Wed, Dec 12, 2018 at 04:57:39PM -0800, Anusha wrote: >> >> From: Manasi Navare <manasi.d.navare@intel.com> >> >> >> >> This patch adds a basic kms test to validate the display stream >> >> compression functionality if supported on DP/eDP connector. >> >> Currently this has only two subtests to force the DSC on all the >> >> eDP and DP connectors that support it with default parameters. >> >> This will be expanded to add more subtests to tweak DSC parameters. >> >> >> >> v6: (from Anusha) >> >> * Fix run_test() (Petri) >> >> * Fix update_display() to avoid leaks. (Petri) >> >> v5: >> >> * Fix test cleanup to avoid crash (Petri) >> >> v4: >> >> * Future proof for more test types (Petri) >> >> * Fix alphabetical order (Petri) >> >> * s/igt_display_init/igt_display_require (Petri) >> >> * Remove blank lines after return (Petri) >> >> v3: >> >> * Use array of connectors and loop through (Petri) >> >> * Also check for FEC on DP connectors (Manasi) >> >> * Add a Pipe_A restriction on DP (Ville) >> >> v2: >> >> * Use IGT wrappers for all (DK, Antonio) >> >> * Split into two subtests for eDP and DP types (Petri) >> >> >> >> Cc: Petri Latvala <petri.latvala@intel.com> >> >> Cc: Antonio Argenziano <antonio.argenziano@intel.com> >> >> Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> >> >> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> >> >> Cc: Anusha Srivatsa <anusha.srivatsa@intel.com> >> >> Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com> >> >> Signed-off-by: Manasi Navare <manasi.d.navare@intel.com> >> >> --- >> >> tests/Makefile.sources | 1 + >> >> tests/kms_dp_dsc.c | 264 >+++++++++++++++++++++++++++++++++++++++++ >> >> tests/meson.build | 1 + >> >> 3 files changed, 266 insertions(+) create mode 100644 >> >> tests/kms_dp_dsc.c >> >> >> >> diff --git a/tests/Makefile.sources b/tests/Makefile.sources index >> >> eedde1e8..a3c24c99 100644 >> >> --- a/tests/Makefile.sources >> >> +++ b/tests/Makefile.sources >> >> @@ -54,6 +54,7 @@ TESTS_progs = \ >> >> kms_crtc_background_color \ >> >> kms_cursor_crc \ >> >> kms_cursor_legacy \ >> >> + kms_dp_dsc \ >> >> kms_draw_crc \ >> >> kms_fbcon_fbt \ >> >> kms_fence_pin_leak \ >> >> diff --git a/tests/kms_dp_dsc.c b/tests/kms_dp_dsc.c new file mode >> >> 100644 index 00000000..884a7717 >> >> --- /dev/null >> >> +++ b/tests/kms_dp_dsc.c >> >> @@ -0,0 +1,264 @@ >> >> +/* >> >> + * Copyright © 2018 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. >> >> + * >> >> + * Displayport Display Stream Compression test >> >> + * Until the CRC support is added this needs to be invoked with >> >> +--interactive >> >> + * to manually verify if the test pattern is seen without >> >> +corruption for each >> >> + * subtest. >> >> + * >> >> + * Authors: >> >> + * Manasi Navare <manasi.d.navare@intel.com> >> >> + * >> >> + */ >> >> +#include "igt.h" >> >> +#include "igt_sysfs.h" >> >> +#include <errno.h> >> >> +#include <getopt.h> >> >> +#include <math.h> >> >> +#include <stdint.h> >> >> +#include <stdbool.h> >> >> +#include <strings.h> >> >> +#include <unistd.h> >> >> +#include <stdlib.h> >> >> +#include <signal.h> >> >> +#include <time.h> >> >> +#include <fcntl.h> >> >> +#include <termios.h> >> >> + >> >> +enum dsc_test_type >> >> +{ >> >> + test_basic_dsc_enable >> >> +}; >> >> + >> >> +typedef struct { >> >> + int drm_fd; >> >> + int debugfs_fd; >> >> + uint32_t id; >> >> + igt_display_t display; >> >> + struct igt_fb fb_test_pattern; >> >> + igt_output_t *output; >> >> + int mode_valid; >> >> + drmModeModeInfo *mode; >> >> + drmModeConnector *connector; >> >> + drmModeEncoder *encoder; >> >> + int crtc; >> >> + enum pipe pipe; >> >> + char conn_name[128]; >> >> +} data_t; >> >> + >> >> +static inline void manual(const char *expected) { >> >> + igt_debug_manual_check("all", expected); } >> >> + >> >> +static bool is_dp_dsc_supported(data_t *data) { >> >> + char file_name[128] = {0}; >> >> + char buf[512]; >> >> + >> >> + strcpy(file_name, data->conn_name); >> >> + strcat(file_name, "/i915_dsc_fec_support"); >> >> + igt_require(igt_debugfs_simple_read(data->debugfs_fd, file_name, buf, >> >> + sizeof(buf)) > 0); >> >> + igt_debugfs_read(data->drm_fd, file_name, buf); >> >> + >> >> + return strstr(buf, "DSC_Sink_Support: yes"); } >> >> + >> >> +static bool is_dp_fec_supported(data_t *data) { >> >> + char file_name[128] = {0}; >> >> + char buf[512]; >> >> + >> >> + strcpy(file_name, data->conn_name); >> >> + strcat(file_name, "/i915_dsc_fec_support"); >> >> + igt_debugfs_read(data->drm_fd, file_name, buf); >> >> + >> >> + return strstr(buf, "FEC_Sink_Support: yes"); } >> >> + >> >> +static bool is_dp_dsc_enabled(data_t *data) { >> >> + char file_name[128] = {0}; >> >> + char buf[512]; >> >> + >> >> + strcpy(file_name, data->conn_name); >> >> + strcat(file_name, "/i915_dsc_fec_support"); >> >> + igt_debugfs_read(data->drm_fd, file_name, buf); >> >> + >> >> + return strstr(buf, "DSC_Enabled: yes"); } >> >> + >> >> +static void force_dp_dsc_enable(data_t *data) { >> >> + char file_name[128] = {0}; >> >> + int ret; >> >> + >> >> + strcpy(file_name, data->conn_name); >> >> + strcat(file_name, "/i915_dsc_fec_support"); >> >> + igt_debug ("Forcing DSC enable on %s\n", data->conn_name); >> >> + ret = igt_sysfs_write(data->debugfs_fd, file_name, "1", 1); >> >> + igt_assert_f(ret > 0, "debugfs_write failed"); } >> >> + >> >> +static void clear_dp_dsc_enable(data_t *data) { >> >> + char file_name[128] = {0}; >> >> + int ret; >> >> + >> >> + strcpy(file_name, data->conn_name); >> >> + strcat(file_name, "/i915_dsc_fec_support"); >> >> + igt_debug ("Clearing DSC enable on %s\n", data->conn_name); >> >> + ret = igt_sysfs_write(data->debugfs_fd, file_name, "0", 1); >> >> + igt_assert_f(ret > 0, "debugfs_write failed"); } >> >> + >> >> +static void test_cleanup(data_t *data) { >> >> + igt_plane_t *primary; >> >> + >> >> + if (data->output) { >> >> + primary = igt_output_get_plane_type(data->output, >> >> + DRM_PLANE_TYPE_PRIMARY); >> >> + igt_plane_set_fb(primary, NULL); >> >> + igt_display_commit(&data->display); >> >> + >> >> + igt_remove_fb(data->drm_fd, &data->fb_test_pattern); >> >> + } >> >> +} >> > >> > >> >Indentation on the if is wrong. >> >> Oops...will fix it. >> >> > >> >> + >> >> + >> >> +/* >> >> + * Re-probe connectors and do a modeset with DSC >> >> + * >> >> + */ >> >> +static void update_display(data_t *data, enum dsc_test_type >> >> +test_type) { >> >> + igt_plane_t *primary; >> >> + data->mode = igt_output_get_mode(data->output); >> >> + data->connector = data->output->config.connector; >> >> + >> >> + if (data->connector->connector_type == >> >DRM_MODE_CONNECTOR_DisplayPort && >> >> + data->pipe == PIPE_A) { >> >> + igt_debug ("DSC not supported on Pipe A on external DP\n"); >> >> + return; >> >> + } >> >> + >> >> + if (test_type == test_basic_dsc_enable) { >> >> + igt_debug ("DSC is supported on %s\n", >> >> + data->conn_name); >> >> + force_dp_dsc_enable(data); >> >> + /* Clear the fb in order to avoid leaks */ >> >> + igt_remove_fb(data->drm_fd, &data->fb_test_pattern); >> >> + igt_create_pattern_fb(data->drm_fd, data->mode->hdisplay, >> >> + data->mode->vdisplay, >> >> + DRM_FORMAT_XRGB8888, >> >> + LOCAL_DRM_FORMAT_MOD_NONE, >> >> + &data->fb_test_pattern); >> >> + primary = igt_output_get_plane_type(data->output, >> >> + >> >DRM_PLANE_TYPE_PRIMARY); >> >> + igt_plane_set_fb(primary, &data->fb_test_pattern); >> >> + igt_display_commit(&data->display); >> >> + /* Until we have CRC check support, manually check if RGB test >> >pattern has no corruption */ >> >> + manual ("RGB test pattern without corruption"); >> >> + igt_assert_f(is_dp_dsc_enabled(data), >> >> + "Default DSC enable failed on Connector: %s Pipe: >> >%s", >> >> + data->conn_name, >> >> + kmstest_pipe_name(data->pipe)); >> >> + clear_dp_dsc_enable(data); >> >> + } else { >> >> + igt_assert(!"Unknown test type\n"); >> >> + } >> >> +} >> >> + >> >> +static void run_test(data_t *data, igt_output_t *output, >> >> + enum dsc_test_type test_type) { >> >> + enum pipe pipe; >> >> + >> >> + for_each_pipe_static(pipe) { >> > >> > >> >This doesn't need to be the _static loop, >> >for_each_pipe(data->display, pipe) can be used. >> >> Hmmm...looking at both again, it says for_each_pipe_static() is to be >> used to enumerate per-pipe subtests and for_ >> each_pipe() cannot be used to enumerate per-pipe subtests. So, if we want to >add more subtests wont having _static be useful? > > >It means for_each_pipe_static is to be used if you're not inside an igt_subtest or >igt_fixture. Inside them you can use real runtime information and for_each_pipe >is ok. > >In pseudocode, these are the use cases for the different forms: > > >for_each_pipe_static(pipe) { > igt_subtest_f("do-things-on-pipe-%s", kmstest_pipe_name(pipe)) { > ... > } >} > >igt_subtest("do-things") { > for_each_pipe(...) { > ... > } >} Thanks for the explanation Petri, I will make this change. > >> >> > >> >> + if (igt_pipe_connector_valid(pipe, output)) { >> >> + igt_output_set_pipe(output, pipe); >> >> + data->pipe = pipe; >> >> + data->output = output; >> >> + update_display(data, test_type); >> >> + } >> >> + } >> >> +} >> >> + >> >> +igt_main >> >> +{ >> >> + data_t data = {}; >> >> + igt_output_t *output; >> >> + drmModeRes *res; >> >> + drmModeConnector *connector; >> >> + int i, test_conn_cnt, test_cnt; >> >> + int tests[] = {DRM_MODE_CONNECTOR_eDP, >> >> +DRM_MODE_CONNECTOR_DisplayPort}; >> >> + >> >> + igt_fixture { >> >> + data.drm_fd = drm_open_driver_master(DRIVER_ANY); >> >> + data.debugfs_fd = igt_debugfs_dir(data.drm_fd); >> >> + kmstest_set_vt_graphics_mode(); >> >> + igt_display_require(&data.display, data.drm_fd); >> >> + //igt_display_require_output(&data.display); >> >> + igt_require(res = drmModeGetResources(data.drm_fd)); >> >> + } >> >> + >> >> + for (test_cnt = 0; test_cnt < ARRAY_SIZE(tests); test_cnt++) { >> >> + >> >> + igt_subtest_f("basic-dsc-enable-%s", >> >> + kmstest_connector_type_str(tests[test_cnt])) { >> >> + test_conn_cnt = 0; >> >> + for (i = 0; i < res->count_connectors; i++) { >> >> + connector = >> >drmModeGetConnectorCurrent(data.drm_fd, >> >> + res- >> >>connectors[i]); >> >> + if (connector->connection != >> >DRM_MODE_CONNECTED || >> >> + connector->connector_type != >> >> + tests[test_cnt]) >> >> + continue; >> >> + test_conn_cnt++; >> >> + output = >> >igt_output_from_connector(&data.display, connector); >> >> + sprintf(data.conn_name, "%s-%d", >> >> + kmstest_connector_type_str(connector- >> >>connector_type), >> >> + test_conn_cnt); >> >> + igt_require_f(is_dp_dsc_supported(&data), >> >> + "DSC not supported on connector %s >> >\n", >> >> + data.conn_name); >> > >> >This will make the subtest skip when checking DP-1, without trying >> >DP-2 at all. Is that intended? >> > >> No. it has to test for DP-2 as well.. >> But even if the igt_require() here fails, the loop will move on to the >> next connector right? > > >No, it jumps out of the igt_subtest block, to the next iteration of the outer loop, >which loops over connector types. > Yes, will avoid using igt_require here. Thanks, Anusha >-- >Petri Latvala _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-12-20 19:09 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-12-13 0:57 [igt-dev] [PATCH i-g-t] test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP Anusha 2018-12-13 1:21 ` [igt-dev] ✓ Fi.CI.BAT: success for test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP (rev6) Patchwork 2018-12-13 2:19 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork 2018-12-17 12:00 ` [igt-dev] [PATCH i-g-t] test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP Petri Latvala 2018-12-17 19:44 ` Srivatsa, Anusha 2018-12-18 12:12 ` Petri Latvala 2018-12-20 19:09 ` Srivatsa, Anusha
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.