[igt-dev] [i-g-t RFC v1 1/1] test/kmd_hdmi: Test case for new HDMI property
Nischal Varide
nischal.varide at intel.com
Thu May 6 22:30:25 UTC 2021
A new HDMI vendor product info property is added by driver to make
vendor and product info programmable by user. This IGT test is added
to validate the same.
Signed-off-by: Nischal Varide <nischal.varide at intel.com>
---
Makefile | 32 ++++++++++
lib/igt_kms.c | 5 ++
lib/igt_kms.h | 1 +
tests/kms_hdmi.c | 150 ++++++++++++++++++++++++++++++++++++++++++++++
tests/meson.build | 1 +
5 files changed, 189 insertions(+)
create mode 100644 Makefile
create mode 100644 tests/kms_hdmi.c
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000..35bd086c
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,32 @@
+
+.PHONY: default docs
+default: all
+
+build/build.ninja:
+ mkdir -p build
+ meson build
+
+all: build/build.ninja
+ ninja -C build
+
+clean: build/build.ninja
+ ninja -C build clean
+
+test: build/build.ninja
+ ninja -C build test
+
+reconfigure: build/build.ninja
+ ninja -C build reconfigure
+
+check distcheck dist distclean:
+ echo "This is the meson wrapper, not automake" && false
+
+install: build/build.ninja
+ ninja -C build install
+
+uninstall: build/build.ninja
+ ninja -C build uninstall
+
+docs:
+ ninja -C build igt-gpu-tools-doc
+
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 47b829b0..d7a6af70 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -606,6 +606,7 @@ const char * const igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = {
[IGT_CONNECTOR_LINK_STATUS] = "link-status",
[IGT_CONNECTOR_MAX_BPC] = "max bpc",
[IGT_CONNECTOR_HDR_OUTPUT_METADATA] = "HDR_OUTPUT_METADATA",
+ [IGT_CONNECTOR_HDMI_VENDOR_PRODUCT] = "hdmi_vendor_product",
[IGT_CONNECTOR_WRITEBACK_PIXEL_FORMATS] = "WRITEBACK_PIXEL_FORMATS",
[IGT_CONNECTOR_WRITEBACK_FB_ID] = "WRITEBACK_FB_ID",
[IGT_CONNECTOR_WRITEBACK_OUT_FENCE_PTR] = "WRITEBACK_OUT_FENCE_PTR",
@@ -2006,6 +2007,10 @@ static void igt_output_reset(igt_output_t *output)
igt_output_set_prop_value(output,
IGT_CONNECTOR_HDR_OUTPUT_METADATA, 0);
+ if (igt_output_has_prop(output, IGT_CONNECTOR_HDMI_VENDOR_PRODUCT))
+ igt_output_set_prop_value(output,
+ IGT_CONNECTOR_HDMI_VENDOR_PRODUCT, 0);
+
if (igt_output_has_prop(output, IGT_CONNECTOR_WRITEBACK_FB_ID))
igt_output_set_prop_value(output, IGT_CONNECTOR_WRITEBACK_FB_ID, 0);
if (igt_output_has_prop(output, IGT_CONNECTOR_WRITEBACK_OUT_FENCE_PTR)) {
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 85f0769c..eb83b347 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -147,6 +147,7 @@ enum igt_atomic_connector_properties {
IGT_CONNECTOR_LINK_STATUS,
IGT_CONNECTOR_MAX_BPC,
IGT_CONNECTOR_HDR_OUTPUT_METADATA,
+ IGT_CONNECTOR_HDMI_VENDOR_PRODUCT,
IGT_CONNECTOR_WRITEBACK_PIXEL_FORMATS,
IGT_CONNECTOR_WRITEBACK_FB_ID,
IGT_CONNECTOR_WRITEBACK_OUT_FENCE_PTR,
diff --git a/tests/kms_hdmi.c b/tests/kms_hdmi.c
new file mode 100644
index 00000000..53c46a33
--- /dev/null
+++ b/tests/kms_hdmi.c
@@ -0,0 +1,150 @@
+/*
+ * Copyright © 2020 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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"
+#include <fcntl.h>
+#include <termios.h>
+#include <unistd.h>
+#include <string.h>
+#include "igt_edid.h"
+
+IGT_TEST_DESCRIPTION("Test HDMI SPD Infoframe Property for Vendor and Product");
+
+struct hdmi_vendor_product_info {
+ char vendor[30];
+ char product[30];
+};
+
+typedef struct data {
+ igt_display_t display;
+ igt_plane_t *primary;
+ igt_output_t *output;
+ igt_pipe_t *pipe;
+ drmModeModeInfo *mode;
+ int fd;
+} data_t;
+
+
+static int setup_output(data_t *data)
+{
+ igt_display_t *display = &data->display;
+ igt_output_t *output;
+ enum pipe pipe;
+ int ret = 0;
+
+ for_each_pipe_with_valid_output(display, pipe, output) {
+ drmModeConnectorPtr c = output->config.connector;
+
+ if (igt_output_has_prop(output, IGT_CONNECTOR_HDMI_VENDOR_PRODUCT))
+ ret += 1;
+
+ if ((c->connector_type != DRM_MODE_CONNECTOR_HDMIA) &&
+ (c->connector_type != DRM_MODE_CONNECTOR_HDMIB))
+ continue;
+
+ igt_output_set_pipe(output, pipe);
+ data->output = output;
+ data->mode = igt_output_get_mode(output);
+
+ return ret;
+ }
+ return ret;
+}
+
+
+static void fill_hdmi_vendor_product(struct hdmi_vendor_product_info *meta,
+ const char *vendor_name, const char *product_name)
+{
+ if (meta == NULL)
+ return;
+
+ if (vendor_name == NULL)
+ vendor_name = "intel";
+
+ if (product_name == NULL)
+ product_name = "Integrated gfx";
+
+ strncpy(meta->vendor, vendor_name, sizeof(meta->vendor));
+ strncpy(meta->product, product_name, sizeof(meta->product));
+}
+
+
+/* Sets the Inforframe vendor and produc property */
+static void set_hdmi_output_infoframe(data_t *data,
+ struct hdmi_vendor_product_info const *inf)
+{
+ igt_output_replace_prop_blob(data->output,
+ IGT_CONNECTOR_HDMI_VENDOR_PRODUCT, inf,
+ inf ? sizeof(*inf) : 0);
+}
+
+
+
+static void test_hdmi(data_t *data, igt_output_t *output)
+{
+ struct hdmi_vendor_product_info vp_info;
+ igt_display_t *display = &data->display;
+
+ fill_hdmi_vendor_product(&vp_info, "amd", "amd gfx");
+ set_hdmi_output_infoframe(data, &vp_info);
+ igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+}
+
+
+igt_main
+{
+
+ data_t data = {};
+ igt_output_t *output;
+ int ret_val = 0;
+
+ igt_fixture {
+ data.fd = drm_open_driver_master(DRIVER_AMDGPU | DRIVER_INTEL);
+
+ kmstest_set_vt_graphics_mode();
+
+ igt_display_require(&data.display, data.fd);
+ igt_require(data.display.is_atomic);
+
+ igt_display_require_output(&data.display);
+ }
+
+ /*Calling the Test*/
+ igt_subtest("Hdmi_Vendor_Product") {
+ ret_val = setup_output(&data);
+ test_hdmi(&data, output);
+ if (ret_val)
+ igt_info("Test Case Pass\n");
+ else
+ igt_info("Test Case Failed\n");
+ }
+
+
+ igt_fixture {
+ igt_display_fini(&data.display);
+ }
+
+ igt_exit();
+}
+
diff --git a/tests/meson.build b/tests/meson.build
index 19cc4ebe..42d2e4b3 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -43,6 +43,7 @@ test_progs = [
'kms_getfb',
'kms_hdmi_inject',
'kms_hdr',
+ 'kms_hdmi',
'kms_invalid_dotclock',
'kms_lease',
'kms_legacy_colorkey',
--
2.29.2
More information about the igt-dev
mailing list