[PATCH i-g-t 2/2] tests/kms_force_connector_basic: Add prune-stale-modes subtest

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

Add a new subtest that makes sure old stale modes get pruned from the
connector's mode list when the EDID changes.

Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
---
 lib/igt_kms.c                     | 40 +++++++++++++++++++++++++++++++++++++++
 lib/igt_kms.h                     |  1 +
 tests/kms_force_connector_basic.c | 40 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 81 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index da49f5676641..5d5a95c20106 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -111,6 +111,46 @@ const unsigned char* igt_kms_get_base_edid(void)
 	return base_edid;
 }
 
+#define VFREQ 60
+#define CLOCK 101000
+#define HACTIVE 1400
+#define HBLANK 160
+#define VACTIVE 1050
+#define VBLANK 30
+#define HOFFSET 48
+#define HPULSE 32
+#define VOFFSET 3
+#define VPULSE 4
+
+#define HSIZE 52
+#define VSIZE 30
+
+#define EDID_NAME alt_edid
+#include "igt_edid_template.h"
+
+/**
+ * igt_kms_get_alt_edid:
+ *
+ * Get an alternate edid block, which includes the following modes:
+ *
+ *  - 1400x1050 60Hz
+ *  - 1920x1080 60Hz
+ *  - 1280x720 60Hz
+ *  - 1024x768 60Hz
+ *  - 800x600 60Hz
+ *  - 640x480 60Hz
+ *
+ * This can be extended with further features using functions such as
+ * #kmstest_edid_add_3d.
+ *
+ * Returns: an alternate edid block
+ */
+const unsigned char* igt_kms_get_alt_edid(void)
+{
+	update_edid_csum(alt_edid);
+
+	return alt_edid;
+}
 
 /**
  * SECTION:igt_kms
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 965c47c1c7f4..94f315fe13e2 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -286,6 +286,7 @@ void igt_reset_connectors(void);
 
 #define EDID_LENGTH 128
 const unsigned char* igt_kms_get_base_edid(void);
+const unsigned char* igt_kms_get_alt_edid(void);
 
 
 #endif /* __IGT_KMS_H__ */
diff --git a/tests/kms_force_connector_basic.c b/tests/kms_force_connector_basic.c
index 637f625a852f..f1b2da32dddc 100644
--- a/tests/kms_force_connector_basic.c
+++ b/tests/kms_force_connector_basic.c
@@ -178,6 +178,46 @@ int main(int argc, char **argv)
 
 	}
 
+	igt_subtest("prune-stale-modes") {
+		int i;
+
+		kmstest_force_connector(drm_fd, vga_connector,
+					FORCE_CONNECTOR_ON);
+
+		/* test pruning of stale modes */
+		kmstest_force_edid(drm_fd, vga_connector,
+				   igt_kms_get_alt_edid(), EDID_LENGTH);
+		temp = drmModeGetConnector(drm_fd,
+					   vga_connector->connector_id);
+
+		for (i = 0; i < temp->count_modes; i++) {
+			if (temp->modes[i].hdisplay == 1400 &&
+			    temp->modes[i].vdisplay == 1050)
+				break;
+		}
+		igt_assert_f(i != temp->count_modes, "1400x1050 not on mode list\n");
+
+		drmModeFreeConnector(temp);
+
+		kmstest_force_edid(drm_fd, vga_connector,
+				   igt_kms_get_base_edid(), EDID_LENGTH);
+		temp = drmModeGetConnector(drm_fd,
+					   vga_connector->connector_id);
+
+		for (i = 0; i < temp->count_modes; i++) {
+			if (temp->modes[i].hdisplay == 1400 &&
+			    temp->modes[i].vdisplay == 1050)
+				break;
+		}
+		igt_assert_f(i == temp->count_modes, "1400x1050 not pruned from mode list\n");
+
+		drmModeFreeConnector(temp);
+
+		kmstest_force_edid(drm_fd, vga_connector, NULL, 0);
+		kmstest_force_connector(drm_fd, vga_connector,
+					FORCE_CONNECTOR_UNSPECIFIED);
+	}
+
 	igt_fixture {
 		drmModeFreeConnector(vga_connector);
 		close(drm_fd);
-- 
2.4.10

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux