Skip to contentSkip to conversation

test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP

PATCH Superseded Manasi Navare 4 participants 6 messages Dec 5, 2018 – Dec 12, 2018 Arm/Amlogic Meson SoC support

v5 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP

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.

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 <[email protected]>
Cc Antonio Argenziano <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Anusha Srivatsa <[email protected]>
---
 tests/Makefile.sources |   1 +
 tests/kms_dp_dsc.c     | 258 +++++++++++++++++++++++++++++++++++++++++
 tests/meson.build      |   1 +
 3 files changed, 260 insertions(+)
 create mode 100644 tests/kms_dp_dsc.c
tests/Makefile.sources +1 -0
index eedde1e8..a3c24c99 100644
@@ -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 \
tests/kms_dp_dsc.c new file +258 -0

258 lines not on this page · raw message

tests/meson.build +1 -0
index b8a6e61b..e14ab2b4 100644
@@ -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',
Signature · 6 lines
2.19.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#1 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP (rev5)

== Series Details ==

== Series Details ==

Series: test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP (rev5)
URL : https://patchwork.freedesktop.org/series/50652/
State : success

== Summary ==

CI Bug Log - changes from IGT_4742 -> IGTPW_2125
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/50652/revisions/5/mbox/

Known issues
------------

Here are the changes found in IGTPW_2125 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_ctx_create@basic-files:
- fi-bsw-n3050: PASS -> FAIL [fdo#108656]

* igt@i915_selftest@live_contexts:
- fi-bsw-n3050: PASS -> DMESG-FAIL [fdo#108626] / [fdo#108656]

#### Possible fixes ####

* igt@gem_close_race@basic-threads:
- fi-bsw-kefka: FAIL [fdo#108656] -> PASS

* igt@gem_exec_suspend@basic-s3:
- fi-skl-6700hq: FAIL [fdo#103375] -> PASS

* igt@prime_vgem@basic-fence-flip:
- fi-ilk-650: FAIL [fdo#104008] -> PASS

[fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
[fdo#104008]: https://bugs.freedesktop.org/show_bug.cgi?id=104008
[fdo#108626]: https://bugs.freedesktop.org/show_bug.cgi?id=108626
[fdo#108656]: https://bugs.freedesktop.org/show_bug.cgi?id=108656

Participating hosts (50 -> 43)
------------------------------

Missing (7): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-whl-u fi-icl-y

Build changes
-------------

* IGT: IGT_4742 -> IGTPW_2125

CI_DRM_5266: 529899779ce289fe64cd2249da1eb9bcea6a423f @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2125: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2125/
IGT_4742: b55279bdb765933eb29e52b4805c817ceed5776a @ 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_2125/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#2 lore raw

[igt-dev] ✓ Fi.CI.IGT: success for test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP (rev5)

In reply to Manasi Navare
== Series Details ==

== Series Details ==

Series: test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP (rev5)
URL : https://patchwork.freedesktop.org/series/50652/
State : success

== Summary ==

CI Bug Log - changes from IGT_4742_full -> IGTPW_2125_full
====================================================

Summary
-------

**WARNING**

Minor unknown changes coming with IGTPW_2125_full need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in IGTPW_2125_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/5/mbox/

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_2125_full:

### IGT changes ###

#### Warnings ####

* igt@kms_plane@plane-position-hole-pipe-c-planes:
- shard-apl: SKIP -> PASS

* igt@pm_rc6_residency@rc6-accuracy:
- shard-snb: PASS -> SKIP

Known issues
------------

Here are the changes found in IGTPW_2125_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@i915_suspend@fence-restore-tiled2untiled:
- shard-apl: PASS -> DMESG-WARN [fdo#108566]

* igt@kms_available_modes_crc@available_mode_test_crc:
- shard-apl: PASS -> FAIL [fdo#106641]

* igt@kms_color@pipe-c-ctm-max:
- shard-apl: PASS -> FAIL [fdo#108147]

* igt@kms_cursor_crc@cursor-256x85-random:
- shard-apl: PASS -> FAIL [fdo#103232] +5

* igt@kms_cursor_crc@cursor-64x21-onscreen:
- shard-kbl: PASS -> FAIL [fdo#103232] +1

* igt@kms_cursor_crc@cursor-64x64-sliding:
- shard-glk: PASS -> FAIL [fdo#103232] +3

* igt@kms_draw_crc@draw-method-rgb565-render-xtiled:
- shard-glk: PASS -> FAIL [fdo#103184]

* igt@kms_flip@flip-vs-modeset-interruptible:
- shard-hsw: PASS -> DMESG-WARN [fdo#102614]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-blt:
- shard-kbl: PASS -> FAIL [fdo#103167]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-onoff:
- shard-apl: PASS -> FAIL [fdo#103167] +2

* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-mmap-cpu:
- shard-glk: PASS -> FAIL [fdo#103167] +5

* igt@kms_plane@pixel-format-pipe-c-planes:
- shard-apl: PASS -> INCOMPLETE [fdo#103927]

* igt@kms_plane@plane-position-covered-pipe-a-planes:
- shard-glk: PASS -> FAIL [fdo#103166]

* igt@kms_rotation_crc@primary-rotation-180:
- shard-snb: NOTRUN -> FAIL [fdo#103925]

* igt@kms_setmode@basic:
- shard-kbl: PASS -> FAIL [fdo#99912]

* igt@kms_vblank@pipe-a-ts-continuation-dpms-suspend:
- shard-kbl: PASS -> INCOMPLETE [fdo#103665]

#### Possible fixes ####

* igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-a:
- shard-hsw: DMESG-WARN [fdo#107956] -> PASS

* igt@kms_ccs@pipe-a-crc-sprite-planes-basic:
- shard-glk: FAIL [fdo#108145] -> PASS +1

* igt@kms_color@pipe-c-degamma:
- shard-apl: FAIL [fdo#104782] -> PASS

* igt@kms_cursor_crc@cursor-128x42-onscreen:

    - shard-glk:          FAIL [fdo#103232] -> PASS
    - shard-apl:          FAIL [fdo#103232] -> PASS
    - shard-kbl:          FAIL [fdo#103232] -> PASS +1

* igt@kms_flip@flip-vs-expired-vblank:
- shard-apl: FAIL [fdo#102887] / [fdo#105363] -> PASS

* igt@kms_flip_tiling@flip-to-y-tiled:
- shard-snb: INCOMPLETE [fdo#105411] -> SKIP

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt:
- shard-apl: FAIL [fdo#103167] -> PASS +1

* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-cur-indfb-move:
- shard-glk: FAIL [fdo#103167] -> PASS

* {igt@kms_plane@pixel-format-pipe-c-planes-source-clamping}:
- shard-apl: FAIL [fdo#108948] -> PASS

* igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
- shard-apl: FAIL [fdo#103166] -> PASS +4

* igt@kms_plane_multiple@atomic-pipe-b-tiling-y:
- shard-kbl: FAIL [fdo#103166] -> PASS

* igt@kms_plane_multiple@atomic-pipe-c-tiling-yf:
- shard-apl: DMESG-WARN [fdo#103558] / [fdo#105602] -> PASS +17

* {igt@kms_rotation_crc@multiplane-rotation-cropping-top}:
- shard-glk: DMESG-FAIL [fdo#105763] / [fdo#106538] -> PASS

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#102614]: https://bugs.freedesktop.org/show_bug.cgi?id=102614
[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#103184]: https://bugs.freedesktop.org/show_bug.cgi?id=103184
[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#103925]: https://bugs.freedesktop.org/show_bug.cgi?id=103925
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#104782]: https://bugs.freedesktop.org/show_bug.cgi?id=104782
[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#105763]: https://bugs.freedesktop.org/show_bug.cgi?id=105763
[fdo#106538]: https://bugs.freedesktop.org/show_bug.cgi?id=106538
[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#108147]: https://bugs.freedesktop.org/show_bug.cgi?id=108147
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[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_4742 -> IGTPW_2125

CI_DRM_5266: 529899779ce289fe64cd2249da1eb9bcea6a423f @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2125: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2125/
IGT_4742: b55279bdb765933eb29e52b4805c817ceed5776a @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2125/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#3 lore raw
In reply to Manasi Navare

Hi Petri,

This version of the patch had clean CI results.
Is this good to get merged?
Thanks for all the review feedback.

Regards
Manasi

Quoted 325 lines · Manasi Navare

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.

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 <[email protected]>
Cc Antonio Argenziano <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Anusha Srivatsa <[email protected]>
---
 tests/Makefile.sources |   1 +
 tests/kms_dp_dsc.c     | 258 +++++++++++++++++++++++++++++++++++++++++
 tests/meson.build      |   1 +
 3 files changed, 260 insertions(+)
 create mode 100644 tests/kms_dp_dsc.c
tests/Makefile.sources +1 -0
index eedde1e8..a3c24c99 100644
@@ -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 \
tests/kms_dp_dsc.c new file +258 -0
new file mode 100644
index 00000000..e0faec1f
@@ -0,0 +1,258 @@
+/*
+ * 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 <[email protected]>
+ *
+ */
+#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;
+
+	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);
+		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_with_valid_output(&data->display, 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_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);
+			}
+			if (data.output)
+				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();
+}
tests/meson.build +1 -0
index b8a6e61b..e14ab2b4 100644
@@ -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',
Signature · 1 line
2.19.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#4 lore raw
In reply to Manasi Navare
Quoted 213 lines · Manasi Navare

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.

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 <[email protected]>
Cc Antonio Argenziano <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Anusha Srivatsa <[email protected]>
---
 tests/Makefile.sources |   1 +
 tests/kms_dp_dsc.c     | 258 +++++++++++++++++++++++++++++++++++++++++
 tests/meson.build      |   1 +
 3 files changed, 260 insertions(+)
 create mode 100644 tests/kms_dp_dsc.c
tests/Makefile.sources +1 -0
index eedde1e8..a3c24c99 100644
@@ -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 \
tests/kms_dp_dsc.c new file +161 -0
new file mode 100644
index 00000000..e0faec1f
@@ -0,0 +1,258 @@
+/*
+ * 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 <[email protected]>
+ *
+ */
+#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;
+
+	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;
+	}

tests/kms_dp_dsc.c line 171

Quoted 10 lines
tests/kms_dp_dsc.c new file +10 -0
+
+	if (test_type == test_basic_dsc_enable) {
+		igt_debug ("DSC is supported on %s\n",
+			   data->conn_name);
+		force_dp_dsc_enable(data);
+		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);

This function is called from a loop and data->fb_test_pattern can contain an fb already, no? Does this leak?

Signature · 1 line
Petri Latvala
Quoted 102 lines
tests/kms_dp_dsc.c new file +87 -0
+		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_with_valid_output(&data->display, 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_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);
+			}
+			if (data.output)
+				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();
+}
tests/meson.build +1 -0
index b8a6e61b..e14ab2b4 100644
@@ -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',
Signature · 1 line
2.19.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#5 lore raw
Quoted 227 lines

-----Original Message-----
From: Latvala, Petri
Sent: Friday, December 7, 2018 2:33 AM
To: Navare, Manasi D <[email protected]>
Cc: [email protected]; Argenziano, Antonio <[email protected]>; Pandiyan, Dhinakaran <[email protected]>; Ville Syrjälä <[email protected]>; Srivatsa, Anusha <[email protected]>
Subject: Re: [PATCH i-g-t v5] test/kms_dp_dsc: Basic KMS test to validate VESA DSC on DP/eDP

Quoted 67 lines · Manasi Navare

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.

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 <[email protected]>
Cc Antonio Argenziano <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Anusha Srivatsa <[email protected]>
---
 tests/Makefile.sources |   1 +
 tests/kms_dp_dsc.c     | 258 +++++++++++++++++++++++++++++++++++++++++
 tests/meson.build      |   1 +
 3 files changed, 260 insertions(+)
 create mode 100644 tests/kms_dp_dsc.c
tests/Makefile.sources index renamed from tests/Makefile.sources +0 -0

eedde1e8..a3c24c99 100644

tests/Makefile.sources +1 -0
@@ -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 \
tests/kms_dp_dsc.c new file mode renamed from tests/kms_dp_dsc.c +0 -0

100644 index 00000000..e0faec1f

tests/kms_dp_dsc.c new file +16 -0
@@ -0,0 +1,258 @@
+/*
+ * 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

tests/kms_dp_dsc.c line 26

Quoted 10 lines
tests/kms_dp_dsc.c new file +10 -0
+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

tests/kms_dp_dsc.c line 28

Quoted 2 lines
tests/kms_dp_dsc.c new file +2 -0
+SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,

DAMAGES

Quoted 121 lines
tests/kms_dp_dsc.c new file +121 -0
+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 <[email protected]>
+ *
+ */
+#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;
+
+	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); }
+
+
+/*

tests/kms_dp_dsc.c

Quoted 10 lines
tests/kms_dp_dsc.c new file +10 -0
+ * 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 &&

Quoted 9 lines

tests/kms_dp_dsc.c line 166

Quoted 9 lines
tests/kms_dp_dsc.c new file +9 -0
+	    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);

Petri,
I will do a igt_remove_fb() to avoid leaks.

Quoted 25 lines

tests/kms_dp_dsc.c line 171

Quoted 5 lines
tests/kms_dp_dsc.c new file +5 -0
+		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);

This function is called from a loop and data->fb_test_pattern can contain an fb already, no? Does this leak?

--
Petri Latvala

tests/kms_dp_dsc.c line 175

Quoted 2 lines
tests/kms_dp_dsc.c new file +2 -0
+		primary = igt_output_get_plane_type(data->output,
+

DRM_PLANE_TYPE_PRIMARY);

tests/kms_dp_dsc.c

Quoted 3 lines
tests/kms_dp_dsc.c new file +3 -0
+		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 */

tests/kms_dp_dsc.c

Quoted 3 lines
tests/kms_dp_dsc.c new file +3 -0
+		manual ("RGB test pattern without corruption");
+		igt_assert_f(is_dp_dsc_enabled(data),
+			     "Default DSC enable failed on Connector: %s Pipe:

%s",

Quoted 13 lines

tests/kms_dp_dsc.c line 192

Quoted 13 lines
tests/kms_dp_dsc.c new file +13 -0
+			     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;
+

And here, like you suggested on our conversation, change for_each_pipe_with_valid_output() to for_each_pipe() {
And igt_pipe_connector_valid(pipe, output) - get valid connector for the pipe and set the rest.

Anusha

Quoted 84 lines
Quoted 7 lines
tests/kms_dp_dsc.c new file +6 -0
+	for_each_pipe_with_valid_output(&data->display, pipe, output) {
 
+		igt_output_set_pipe(output, pipe);
+		data->pipe = pipe;
+		data->output = output;
+		update_display(data, test_type);
+	}

tests/kms_dp_dsc.c

Quoted 10 lines
tests/kms_dp_dsc.c new file +10 -0
+}
+
+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};

Quoted 6 lines
tests/kms_dp_dsc.c new file +6 -0
+
+	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);

tests/kms_dp_dsc.c

Quoted 10 lines
tests/kms_dp_dsc.c new file +10 -0
+		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,

tests/kms_dp_dsc.c

Quoted 3 lines
tests/kms_dp_dsc.c new file +1 -0
+								       res-

connectors[i]);

tests/kms_dp_dsc.c new file +1 -0
+				if (connector->connection !=

DRM_MODE_CONNECTED ||

tests/kms_dp_dsc.c

Quoted 5 lines
tests/kms_dp_dsc.c new file +5 -0
+				    connector->connector_type !=
+				    tests[test_cnt])
+					continue;
+				test_conn_cnt++;
+				output =

igt_output_from_connector(&data.display, connector);

tests/kms_dp_dsc.c

Quoted 6 lines
tests/kms_dp_dsc.c new file +2 -0
+				sprintf(data.conn_name, "%s-%d",
+					kmstest_connector_type_str(connector-

connector_type),

tests/kms_dp_dsc.c new file +3 -0
+					test_conn_cnt);
+				igt_require_f(is_dp_dsc_supported(&data),
+					      "DSC not supported on connector %s

\n",

tests/kms_dp_dsc.c

Quoted 2 lines
tests/kms_dp_dsc.c new file +2 -0
+					      data.conn_name);
+				if (connector->connector_type ==

DRM_MODE_CONNECTOR_DisplayPort)

Quoted 1 line

+

igt_require_f(is_dp_fec_supported(&data),

tests/kms_dp_dsc.c

Quoted 1 line
tests/kms_dp_dsc.c new file +1 -0
+						      "DSC cannot be enabled

without FEC on %s\n",

Quoted 25 lines
tests/kms_dp_dsc.c new file +18 -0
+						      data.conn_name);
+				run_test(&data, output, test_basic_dsc_enable);
+			}
+			if (data.output)
+				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();
+}
tests/meson.build +0 -0
index b8a6e61b..e14ab2b4 100644
@@ -25,6 +25,7 @@ test_progs = [
 	'kms_crtc_background_color',
 	'kms_cursor_crc',
Quoted 8 lines
Quoted 8 lines
tests/meson.build +1 -1
 	'kms_cursor_legacy',
+	'kms_dp_dsc',
 	'kms_draw_crc',
 	'kms_fbcon_fbt',
 	'kms_fence_pin_leak',
--

2.19.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev