diff options
author | Simon Ser <simon.ser@intel.com> | 2019-07-02 10:57:37 +0300 |
---|---|---|
committer | Simon Ser <simon.ser@intel.com> | 2019-07-05 16:06:40 +0300 |
commit | 219430933ac316313b71832f6a65e2e08c08cbd7 (patch) | |
tree | e047fb451be5f93c8daf072581266f62536ad019 /lib/igt_kms.c | |
parent | f0e39642f6f8da5406627bfa79c6600df949e203 (diff) |
lib/igt_kms: remove length parameter from kmstest_force_edid
Given an EDID, computing the size is trivial. Instead of having one size
constant per EDID and hope the callers use the right one (ie. *not* EDID_LENGTH
when there's an extension), we can make functions that take EDIDs compute the
size if they need it.
We have tests in lib/tests/igt_edid.c which assert the number of extensions
present in the EDID anyway.
Signed-off-by: Simon Ser <simon.ser@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Diffstat (limited to 'lib/igt_kms.c')
-rw-r--r-- | lib/igt_kms.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/igt_kms.c b/lib/igt_kms.c index dc8992cb..a66a6850 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -182,6 +182,8 @@ const unsigned char *igt_kms_get_alt_edid(void) return (unsigned char *) &edid; } +#define AUDIO_EDID_LENGTH (2 * EDID_LENGTH) + static void generate_audio_edid(unsigned char raw_edid[static AUDIO_EDID_LENGTH], bool with_vsd, struct cea_sad *sad, @@ -990,15 +992,13 @@ bool kmstest_force_connector(int drm_fd, drmModeConnector *connector, * @drm_fd: drm file descriptor * @connector: connector to set @edid on * @edid: An EDID data block - * @length: length of the EDID data. #EDID_LENGTH defines the standard EDID - * length * * Set the EDID data on @connector to @edid. See also #igt_kms_get_base_edid. * - * If @length is zero, the forced EDID will be removed. + * If @edid is NULL, the forced EDID will be removed. */ void kmstest_force_edid(int drm_fd, drmModeConnector *connector, - const unsigned char *edid, size_t length) + const unsigned char *edid) { char *path; int debugfs_fd, ret; @@ -1011,10 +1011,11 @@ void kmstest_force_edid(int drm_fd, drmModeConnector *connector, igt_require(debugfs_fd != -1); - if (length == 0) + if (edid == NULL) ret = write(debugfs_fd, "reset", 5); else - ret = write(debugfs_fd, edid, length); + ret = write(debugfs_fd, edid, + edid_get_size((struct edid *) edid)); close(debugfs_fd); /* To allow callers to always use GetConnectorCurrent we need to force a |