From 7323650a4bccdd3ab82d898dd4476da6fbe256dd Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 4 Jul 2019 14:12:43 +0300 Subject: lib/igt_kms: add igt_kms_get_3d_edid This replaces kmstest_edid_add_3d. The previous code for generating CEA extensions can be removed. The old and new generated EDIDs are byte-to-byte equal. Signed-off-by: Simon Ser Reviewed-by: Arkadiusz Hiler --- lib/tests/igt_edid.c | 1 + lib/tests/igt_hdmi_inject.c | 94 --------------------------------------------- lib/tests/meson.build | 1 - 3 files changed, 1 insertion(+), 95 deletions(-) delete mode 100644 lib/tests/igt_hdmi_inject.c (limited to 'lib/tests') diff --git a/lib/tests/igt_edid.c b/lib/tests/igt_edid.c index 1a78b38a..e1574828 100644 --- a/lib/tests/igt_edid.c +++ b/lib/tests/igt_edid.c @@ -77,6 +77,7 @@ igt_simple_main { "alt", igt_kms_get_alt_edid, 0 }, { "hdmi_audio", igt_kms_get_hdmi_audio_edid, 1 }, { "4k", igt_kms_get_4k_edid, 1 }, + { "3d", igt_kms_get_3d_edid, 1 }, {0}, }, *f; const unsigned char *edid; diff --git a/lib/tests/igt_hdmi_inject.c b/lib/tests/igt_hdmi_inject.c deleted file mode 100644 index c70c3195..00000000 --- a/lib/tests/igt_hdmi_inject.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright © 2017 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. - * - */ - -#include "igt.h" - -static const unsigned char edid_header[] = { - 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 -}; - -/** - * Sanity check the header of the base EDID block. - * - * Return: 8 if the header is perfect, down to 0 if it's totally wrong. - */ -static int edid_header_is_valid(const unsigned char *raw_edid) -{ - int i, score = 0; - - for (i = 0; i < sizeof(edid_header); i++) - if (raw_edid[i] == edid_header[i]) - score++; - - return score; -} - -/** - * Sanity check the checksum of the EDID block. - * - * Return: 0 if the block is perfect. - * See byte 127 of spec - * https://en.wikipedia.org/wiki/Extended_Display_Identification_Data#EDID_1.3_data_format - */ -static int edid_block_checksum(const unsigned char *raw_edid) -{ - int i; - unsigned char csum = 0; - for (i = 0; i < EDID_LENGTH; i++) { - csum += raw_edid[i]; - } - - return csum; -} - -typedef void (*hdmi_inject_func)(const unsigned char *edid, size_t length, - unsigned char *new_edid_ptr[], size_t *new_length); - -igt_simple_main -{ - const struct { - const char *desc; - hdmi_inject_func inject; - } funcs[] = { - { "3D", kmstest_edid_add_3d }, - { NULL, NULL }, - }, *f; - - for (f = funcs; f->inject; f++) { - unsigned char *edid; - size_t length; - - f->inject(igt_kms_get_base_edid(), EDID_LENGTH, &edid, - &length); - - igt_assert_f(edid_header_is_valid(edid) == 8, - "invalid header on HDMI %s", f->desc); - /* check base edid block */ - igt_assert_f(edid_block_checksum(edid) == 0, - "checksum failed on HDMI %s", f->desc); - /* check extension block */ - igt_assert_f(edid_block_checksum(edid + EDID_LENGTH) == 0, - "CEA block checksum failed on HDMI %s", f->desc); - } -} diff --git a/lib/tests/meson.build b/lib/tests/meson.build index 4d907e34..0c35da30 100644 --- a/lib/tests/meson.build +++ b/lib/tests/meson.build @@ -8,7 +8,6 @@ lib_tests = [ 'igt_exit_handler', 'igt_fork', 'igt_fork_helper', - 'igt_hdmi_inject', 'igt_list_only', 'igt_invalid_subtest_name', 'igt_no_exit', -- cgit v1.2.3