summaryrefslogtreecommitdiff
path: root/lib/igt_kms.c
diff options
context:
space:
mode:
authorSimon Ser <simon.ser@intel.com>2019-04-16 14:27:46 +0300
committerArkadiusz Hiler <arkadiusz.hiler@intel.com>2019-04-17 08:21:33 +0300
commita2fd0489c87a4d647c339f98057e6a1550e0e2f5 (patch)
tree1761b7e9f7e99bf225243755893abe241925d45f /lib/igt_kms.c
parente03d0030391689cfd0fbca293d44d83dd7d9e356 (diff)
lib/igt_edid: new library for generating EDIDs
For the purposes of testing different EDID features, we need to generate more and more complex EDID blobs (e.g. with audio support). However currently IGT uses a macro-based system to generate EDIDs. This doesn't scale well and is pretty inflexible. This commit introduces a new little library to generate EDIDs. For now it can't do more than the old macro. Future commits will extend the API. The structures are mostly based on the Linux kernel code (drm_edid.h). Setters have been added for convenience. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'lib/igt_kms.c')
-rw-r--r--lib/igt_kms.c113
1 files changed, 55 insertions, 58 deletions
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index f8b0dab2..df9aafd2 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -50,6 +50,7 @@
#include "drmtest.h"
#include "igt_kms.h"
#include "igt_aux.h"
+#include "igt_edid.h"
#include "intel_chipset.h"
#include "igt_debugfs.h"
#include "igt_device.h"
@@ -102,23 +103,6 @@ static void update_edid_csum(unsigned char *edid, int cea_pos)
edid[cea_pos + 127] = 256 - sum;
}
-#define VFREQ 60
-#define CLOCK 148500
-#define HACTIVE 1920
-#define HBLANK 280
-#define VACTIVE 1080
-#define VBLANK 45
-#define HOFFSET 88
-#define HPULSE 44
-#define VOFFSET 4
-#define VPULSE 5
-
-#define HSIZE 52
-#define VSIZE 30
-
-#define EDID_NAME base_edid
-#include "igt_edid_template.h"
-
/**
* igt_kms_get_base_edid:
*
@@ -135,29 +119,66 @@ static void update_edid_csum(unsigned char *edid, int cea_pos)
*
* Returns: a basic edid block
*/
-const unsigned char* igt_kms_get_base_edid(void)
+const unsigned char *igt_kms_get_base_edid(void)
{
- update_edid_csum(base_edid, 0);
+ static struct edid edid;
+ drmModeModeInfo mode = {};
- return base_edid;
+ mode.clock = 148500;
+ mode.hdisplay = 1920;
+ mode.hsync_start = 2008;
+ mode.hsync_end = 2052;
+ mode.htotal = 2200;
+ mode.vdisplay = 1080;
+ mode.vsync_start = 1084;
+ mode.vsync_end = 1089;
+ mode.vtotal = 1125;
+ mode.vrefresh = 60;
+
+ edid_init_with_mode(&edid, &mode);
+ edid_update_checksum(&edid);
+
+ return (unsigned char *) &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
+/**
+ * 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)
+{
+ static struct edid edid;
+ drmModeModeInfo mode = {};
+
+ mode.clock = 101000;
+ mode.hdisplay = 1400;
+ mode.hsync_start = 1448;
+ mode.hsync_end = 1480;
+ mode.htotal = 1560;
+ mode.vdisplay = 1050;
+ mode.vsync_start = 1053;
+ mode.vsync_end = 1057;
+ mode.vtotal = 1080;
+ mode.vrefresh = 60;
-#define HSIZE 52
-#define VSIZE 30
+ edid_init_with_mode(&edid, &mode);
+ edid_update_checksum(&edid);
-#define EDID_NAME alt_edid
-#include "igt_edid_template.h"
+ return (unsigned char *) &edid;
+}
const char * const igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
[IGT_PLANE_SRC_X] = "SRC_X",
@@ -302,30 +323,6 @@ igt_fill_pipe_props(igt_display_t *display, igt_pipe_t *pipe,
}
/**
- * 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, 0);
-
- return alt_edid;
-}
-
-/**
* kmstest_pipe_name:
* @pipe: display pipe
*