summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_chamelium.c3
-rw-r--r--lib/igt_chamelium.h3
-rw-r--r--lib/igt_kms.c38
-rw-r--r--lib/igt_kms.h18
-rw-r--r--lib/tests/igt_edid.c14
5 files changed, 38 insertions, 38 deletions
diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index a09473d0..49ddadfb 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -562,10 +562,9 @@ static void chamelium_destroy_edid(struct chamelium *chamelium, int edid_id)
* Returns: An opaque pointer to the Chamelium EDID
*/
struct chamelium_edid *chamelium_new_edid(struct chamelium *chamelium,
- const unsigned char *raw_edid)
+ const struct edid *edid)
{
struct chamelium_edid *chamelium_edid;
- const struct edid *edid = (struct edid *) raw_edid;
size_t edid_size = edid_get_size(edid);
chamelium_edid = calloc(1, sizeof(struct chamelium_edid));
diff --git a/lib/igt_chamelium.h b/lib/igt_chamelium.h
index 8e3e3320..af53557f 100644
--- a/lib/igt_chamelium.h
+++ b/lib/igt_chamelium.h
@@ -34,6 +34,7 @@
#include "igt_debugfs.h"
struct igt_fb;
+struct edid;
struct chamelium;
struct chamelium_port;
@@ -127,7 +128,7 @@ void chamelium_schedule_hpd_toggle(struct chamelium *chamelium,
struct chamelium_port *port, int delay_ms,
bool rising_edge);
struct chamelium_edid *chamelium_new_edid(struct chamelium *chamelium,
- const unsigned char *edid);
+ const struct edid *edid);
const struct edid *chamelium_edid_get_raw(struct chamelium_edid *edid,
struct chamelium_port *port);
void chamelium_port_set_edid(struct chamelium *chamelium,
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 964a5747..e6e8b93b 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -100,7 +100,7 @@ static int forced_connectors_device[MAX_CONNECTORS + 1];
*
* Returns: a basic edid block
*/
-const unsigned char *igt_kms_get_base_edid(void)
+const struct edid *igt_kms_get_base_edid(void)
{
static struct edid edid;
drmModeModeInfo mode = {};
@@ -119,7 +119,7 @@ const unsigned char *igt_kms_get_base_edid(void)
edid_init_with_mode(&edid, &mode);
edid_update_checksum(&edid);
- return (unsigned char *) &edid;
+ return &edid;
}
/**
@@ -136,7 +136,7 @@ const unsigned char *igt_kms_get_base_edid(void)
*
* Returns: an alternate edid block
*/
-const unsigned char *igt_kms_get_alt_edid(void)
+const struct edid *igt_kms_get_alt_edid(void)
{
static struct edid edid;
drmModeModeInfo mode = {};
@@ -155,12 +155,12 @@ const unsigned char *igt_kms_get_alt_edid(void)
edid_init_with_mode(&edid, &mode);
edid_update_checksum(&edid);
- return (unsigned char *) &edid;
+ return &edid;
}
#define AUDIO_EDID_LENGTH (2 * EDID_LENGTH)
-static void
+static const struct edid *
generate_audio_edid(unsigned char raw_edid[static AUDIO_EDID_LENGTH],
bool with_vsdb, struct cea_sad *sad,
struct cea_speaker_alloc *speaker_alloc)
@@ -206,9 +206,11 @@ generate_audio_edid(unsigned char raw_edid[static AUDIO_EDID_LENGTH],
edid_update_checksum(edid);
edid_ext_update_cea_checksum(edid_ext);
+
+ return edid;
}
-const unsigned char *igt_kms_get_hdmi_audio_edid(void)
+const struct edid *igt_kms_get_hdmi_audio_edid(void)
{
int channels;
uint8_t sampling_rates, sample_sizes;
@@ -229,12 +231,10 @@ const unsigned char *igt_kms_get_hdmi_audio_edid(void)
/* Initialize the Speaker Allocation Data */
speaker_alloc.speakers = CEA_SPEAKER_FRONT_LEFT_RIGHT_CENTER;
- generate_audio_edid(raw_edid, true, &sad, &speaker_alloc);
-
- return raw_edid;
+ return generate_audio_edid(raw_edid, true, &sad, &speaker_alloc);
}
-const unsigned char *igt_kms_get_dp_audio_edid(void)
+const struct edid *igt_kms_get_dp_audio_edid(void)
{
int channels;
uint8_t sampling_rates, sample_sizes;
@@ -255,9 +255,7 @@ const unsigned char *igt_kms_get_dp_audio_edid(void)
/* Initialize the Speaker Allocation Data */
speaker_alloc.speakers = CEA_SPEAKER_FRONT_LEFT_RIGHT_CENTER;
- generate_audio_edid(raw_edid, false, &sad, &speaker_alloc);
-
- return raw_edid;
+ return generate_audio_edid(raw_edid, false, &sad, &speaker_alloc);
}
static const uint8_t edid_4k_svds[] = {
@@ -268,7 +266,7 @@ static const uint8_t edid_4k_svds[] = {
19, /* 720p @ 50Hz */
};
-const unsigned char *igt_kms_get_4k_edid(void)
+const struct edid *igt_kms_get_4k_edid(void)
{
static unsigned char raw_edid[256] = {0};
struct edid *edid;
@@ -317,10 +315,11 @@ const unsigned char *igt_kms_get_4k_edid(void)
edid_update_checksum(edid);
edid_ext_update_cea_checksum(edid_ext);
- return raw_edid;
+
+ return edid;
}
-const unsigned char *igt_kms_get_3d_edid(void)
+const struct edid *igt_kms_get_3d_edid(void)
{
static unsigned char raw_edid[256] = {0};
struct edid *edid;
@@ -368,7 +367,8 @@ const unsigned char *igt_kms_get_3d_edid(void)
edid_update_checksum(edid);
edid_ext_update_cea_checksum(edid_ext);
- return raw_edid;
+
+ return edid;
}
const char * const igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
@@ -1085,7 +1085,7 @@ bool kmstest_force_connector(int drm_fd, drmModeConnector *connector,
* If @edid is NULL, the forced EDID will be removed.
*/
void kmstest_force_edid(int drm_fd, drmModeConnector *connector,
- const unsigned char *edid)
+ const struct edid *edid)
{
char *path;
int debugfs_fd, ret;
@@ -1102,7 +1102,7 @@ void kmstest_force_edid(int drm_fd, drmModeConnector *connector,
ret = write(debugfs_fd, "reset", 5);
else
ret = write(debugfs_fd, edid,
- edid_get_size((struct edid *) edid));
+ edid_get_size(edid));
close(debugfs_fd);
/* To allow callers to always use GetConnectorCurrent we need to force a
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index c0dcb6f2..2b1c072e 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -192,11 +192,12 @@ enum intel_broadcast_rgb_mode {
BROADCAST_RGB_16_235
};
+struct edid;
bool kmstest_force_connector(int fd, drmModeConnector *connector,
enum kmstest_force_connector_state state);
void kmstest_force_edid(int drm_fd, drmModeConnector *connector,
- const unsigned char *edid);
+ const struct edid *edid);
bool kmstest_get_connector_default_mode(int drm_fd, drmModeConnector *connector,
drmModeModeInfo *mode);
@@ -754,16 +755,13 @@ void igt_reset_connectors(void);
uint32_t kmstest_get_vbl_flag(uint32_t pipe_id);
-struct cea_sad;
-struct cea_speaker_alloc;
-
#define EDID_LENGTH 128
-const unsigned char *igt_kms_get_base_edid(void);
-const unsigned char *igt_kms_get_alt_edid(void);
-const unsigned char *igt_kms_get_hdmi_audio_edid(void);
-const unsigned char *igt_kms_get_dp_audio_edid(void);
-const unsigned char *igt_kms_get_4k_edid(void);
-const unsigned char *igt_kms_get_3d_edid(void);
+const struct edid *igt_kms_get_base_edid(void);
+const struct edid *igt_kms_get_alt_edid(void);
+const struct edid *igt_kms_get_hdmi_audio_edid(void);
+const struct edid *igt_kms_get_dp_audio_edid(void);
+const struct edid *igt_kms_get_4k_edid(void);
+const struct edid *igt_kms_get_3d_edid(void);
struct udev_monitor *igt_watch_hotplug(void);
bool igt_hotplug_detected(struct udev_monitor *mon,
diff --git a/lib/tests/igt_edid.c b/lib/tests/igt_edid.c
index fc98f1bb..bbbf1505 100644
--- a/lib/tests/igt_edid.c
+++ b/lib/tests/igt_edid.c
@@ -64,7 +64,7 @@ static bool edid_block_checksum(const unsigned char *raw_edid)
return csum == 0;
}
-typedef const unsigned char *(*get_edid_func)(void);
+typedef const struct edid *(*get_edid_func)(void);
igt_simple_main
{
@@ -80,23 +80,25 @@ igt_simple_main
{ "3d", igt_kms_get_3d_edid, 1 },
{0},
}, *f;
- const unsigned char *edid;
+ const struct edid *edid;
+ const uint8_t *raw_edid;
size_t i;
for (f = funcs; f->f; f++) {
edid = f->f();
+ raw_edid = (uint8_t *) edid;
- igt_assert_f(edid_header_is_valid(edid),
+ igt_assert_f(edid_header_is_valid(raw_edid),
"invalid header on %s EDID", f->desc);
/* check base edid block */
- igt_assert_f(edid_block_checksum(edid),
+ igt_assert_f(edid_block_checksum(raw_edid),
"checksum failed on %s EDID", f->desc);
/* check extension blocks, if any */
- igt_assert_f(edid[126] == f->exts,
+ igt_assert_f(raw_edid[126] == f->exts,
"unexpected number of extensions on %s EDID",
f->desc);
for (i = 0; i < f->exts; i++)
- igt_assert_f(edid_block_checksum(edid + (i + 1) * EDID_LENGTH),
+ igt_assert_f(edid_block_checksum(raw_edid + (i + 1) * EDID_LENGTH),
"CEA block checksum failed on %s EDID", f->desc);
}
}