From: Swati Sharma <swati2.sharma@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: petri.latvala@intel.com
Subject: [igt-dev] [PATCH i-g-t 1/8] lib/dsc: Move VDSC functions to separate lib file
Date: Mon, 9 Jan 2023 20:58:24 +0530 [thread overview]
Message-ID: <20230109152832.3310-2-swati2.sharma@intel.com> (raw)
In-Reply-To: <20230109152832.3310-1-swati2.sharma@intel.com>
Move dsc func() from lib/igt_kms to lib/igt_dsc. With
DSC1.2a new functions will be introduced. It's better
to create separate file having dsc specific functions
instead of overcrowding igt_kms.
Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
---
lib/igt.h | 1 +
lib/igt_dsc.c | 151 ++++++++++++++++++++++++++++++++++++++++++++++++
lib/igt_dsc.h | 37 ++++++++++++
lib/igt_kms.c | 127 ----------------------------------------
lib/igt_kms.h | 10 ----
lib/meson.build | 1 +
6 files changed, 190 insertions(+), 137 deletions(-)
create mode 100644 lib/igt_dsc.c
create mode 100644 lib/igt_dsc.h
diff --git a/lib/igt.h b/lib/igt.h
index 88938109e..73b6f7727 100644
--- a/lib/igt.h
+++ b/lib/igt.h
@@ -40,6 +40,7 @@
#include "igt_pipe_crc.h"
#include "igt_pm.h"
#include "igt_stats.h"
+#include "igt_dsc.h"
#ifdef HAVE_CHAMELIUM
#include "igt_alsa.h"
#include "igt_audio.h"
diff --git a/lib/igt_dsc.c b/lib/igt_dsc.c
new file mode 100644
index 000000000..2d54c1ce5
--- /dev/null
+++ b/lib/igt_dsc.c
@@ -0,0 +1,151 @@
+/*
+ * Copyright © 2022 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 <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include "igt_dsc.h"
+#include "igt_sysfs.h"
+
+static bool check_dsc_debugfs(int drmfd, char *connector_name, const char *check_str)
+{
+ char file_name[128] = {0};
+ char buf[512];
+
+ sprintf(file_name, "%s/i915_dsc_fec_support", connector_name);
+
+ igt_debugfs_read(drmfd, file_name, buf);
+
+ return strstr(buf, check_str);
+}
+
+static int write_dsc_debugfs(int drmfd, char *connector_name, const char *file_name,
+ const char *write_buf)
+{
+ int debugfs_fd = igt_debugfs_dir(drmfd);
+ int len = strlen(write_buf);
+ int ret;
+ char file_path[128] = {0};
+
+ sprintf(file_path, "%s/%s", connector_name, file_name);
+
+ ret = igt_sysfs_write(debugfs_fd, file_path, write_buf, len);
+
+ close(debugfs_fd);
+
+ return ret;
+}
+
+/*
+ * igt_is_dsc_supported:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ *
+ * Returns: True if DSC is supported for the given connector, false otherwise.
+ */
+bool igt_is_dsc_supported(int drmfd, char *connector_name)
+{
+ return check_dsc_debugfs(drmfd, connector_name, "DSC_Sink_Support: yes");
+}
+
+/*
+ * igt_is_fec_supported:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ *
+ * Returns: True if FEC is supported for the given connector, false otherwise.
+ */
+bool igt_is_fec_supported(int drmfd, char *connector_name)
+{
+ return check_dsc_debugfs(drmfd, connector_name, "FEC_Sink_Support: yes");
+}
+
+/*
+ * igt_is_dsc_enabled:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ *
+ * Returns: True if DSC is enabled for the given connector, false otherwise.
+ */
+bool igt_is_dsc_enabled(int drmfd, char *connector_name)
+{
+ return check_dsc_debugfs(drmfd, connector_name, "DSC_Enabled: yes");
+}
+
+/*
+ * igt_is_force_dsc_enabled:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ *
+ * Returns: True if DSC is force enabled (via debugfs) for the given connector,
+ * false otherwise.
+ */
+bool igt_is_force_dsc_enabled(int drmfd, char *connector_name)
+{
+ return check_dsc_debugfs(drmfd, connector_name, "Force_DSC_Enable: yes");
+}
+
+/*
+ * igt_force_dsc_enable:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ *
+ * Returns: 1 on success or negative error code, in case of failure.
+ */
+int igt_force_dsc_enable(int drmfd, char *connector_name)
+{
+ return write_dsc_debugfs(drmfd, connector_name, "i915_dsc_fec_support", "1");
+}
+
+/*
+ * igt_force_dsc_enable_bpc:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ * @bpc: Input BPC
+ *
+ * Returns: No. of bytes written or negative error code, in case of failure.
+ */
+int igt_force_dsc_enable_bpc(int drmfd, char *connector_name, int bpc)
+{
+ char buf[20] = {0};
+
+ sprintf(buf, "%d", bpc);
+
+ return write_dsc_debugfs(drmfd, connector_name, "i915_dsc_bpc", buf);
+}
+
+/*
+ * igt_get_dsc_debugfs_fd:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ *
+ * Returns: fd of the DSC debugfs for the given connector, else returns -1.
+ */
+int igt_get_dsc_debugfs_fd(int drmfd, char *connector_name)
+{
+ char file_name[128] = {0};
+
+ sprintf(file_name, "%s/i915_dsc_fec_support", connector_name);
+
+ return openat(igt_debugfs_dir(drmfd), file_name, O_WRONLY);
+}
diff --git a/lib/igt_dsc.h b/lib/igt_dsc.h
new file mode 100644
index 000000000..047db42eb
--- /dev/null
+++ b/lib/igt_dsc.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright © 2023 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.
+ */
+
+#ifndef IGT_DSC_H
+#define IGT_DSC_H
+
+#include "igt_fb.h"
+
+bool igt_is_dsc_supported(int drmfd, char *connector_name);
+bool igt_is_fec_supported(int drmfd, char *connector_name);
+bool igt_is_dsc_enabled(int drmfd, char *connector_name);
+bool igt_is_force_dsc_enabled(int drmfd, char *connector_name);
+int igt_force_dsc_enable(int drmfd, char *connector_name);
+int igt_force_dsc_enable_bpc(int drmfd, char *connector_name, int bpc);
+int igt_get_dsc_debugfs_fd(int drmfd, char *connector_name);
+
+#endif
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index b4a98ae17..31e6dfda0 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -5564,133 +5564,6 @@ void igt_dump_crtcs_fd(int drmfd)
drmModeFreeResources(mode_resources);
}
-static
-bool check_dsc_debugfs(int drmfd, char *connector_name,
- const char *check_str)
-{
- char file_name[128] = {0};
- char buf[512];
-
- sprintf(file_name, "%s/i915_dsc_fec_support", connector_name);
-
- igt_debugfs_read(drmfd, file_name, buf);
-
- return strstr(buf, check_str);
-}
-
-static
-int write_dsc_debugfs(int drmfd, char *connector_name,
- const char *file_name,
- const char *write_buf)
-{
- int debugfs_fd = igt_debugfs_dir(drmfd);
- int len = strlen(write_buf);
- int ret;
- char file_path[128] = {0};
-
- sprintf(file_path, "%s/%s", connector_name, file_name);
-
- ret = igt_sysfs_write(debugfs_fd, file_path, write_buf, len);
-
- close(debugfs_fd);
-
- return ret;
-}
-
-/*
- * igt_is_dsc_supported:
- * @drmfd: A drm file descriptor
- * @connector_name: Name of the libdrm connector we're going to use
- *
- * Returns: True if DSC is supported for the given connector, false otherwise.
- */
-bool igt_is_dsc_supported(int drmfd, char *connector_name)
-{
- return check_dsc_debugfs(drmfd, connector_name, "DSC_Sink_Support: yes");
-}
-
-/*
- * igt_is_fec_supported:
- * @drmfd: A drm file descriptor
- * @connector_name: Name of the libdrm connector we're going to use
- *
- * Returns: True if FEC is supported for the given connector, false otherwise.
- */
-bool igt_is_fec_supported(int drmfd, char *connector_name)
-{
- return check_dsc_debugfs(drmfd, connector_name, "FEC_Sink_Support: yes");
-}
-
-/*
- * igt_is_dsc_enabled:
- * @drmfd: A drm file descriptor
- * @connector_name: Name of the libdrm connector we're going to use
- *
- * Returns: True if DSC is enabled for the given connector, false otherwise.
- */
-bool igt_is_dsc_enabled(int drmfd, char *connector_name)
-{
- return check_dsc_debugfs(drmfd, connector_name, "DSC_Enabled: yes");
-}
-
-/*
- * igt_is_force_dsc_enabled:
- * @drmfd: A drm file descriptor
- * @connector_name: Name of the libdrm connector we're going to use
- *
- * Returns: True if DSC is force enabled (via debugfs) for the given connector,
- * false otherwise.
- */
-bool igt_is_force_dsc_enabled(int drmfd, char *connector_name)
-{
- return check_dsc_debugfs(drmfd, connector_name, "Force_DSC_Enable: yes");
-}
-
-/*
- * igt_force_dsc_enable:
- * @drmfd: A drm file descriptor
- * @connector_name: Name of the libdrm connector we're going to use
- *
- * Returns: 1 on success or negative error code, in case of failure.
- */
-int igt_force_dsc_enable(int drmfd, char *connector_name)
-{
- return write_dsc_debugfs(drmfd, connector_name, "i915_dsc_fec_support", "1");
-}
-
-/*
- * igt_force_dsc_enable_bpc:
- * @drmfd: A drm file descriptor
- * @connector_name: Name of the libdrm connector we're going to use
- * @bpc: Input BPC
- *
- * Returns: No. of bytes written or negative error code, in case of failure.
- */
-int igt_force_dsc_enable_bpc(int drmfd, char *connector_name, int bpc)
-{
- char buf[20] = {0};
-
- sprintf(buf, "%d", bpc);
-
- return write_dsc_debugfs(drmfd, connector_name, "i915_dsc_bpc", buf);
-}
-
-/*
- * igt_get_dsc_debugfs_fd:
- * @drmfd: A drm file descriptor
- * @connector_name: Name of the libdrm connector we're going to use
- *
- * Returns: fd of the DSC debugfs for the given connector, else returns -1.
- */
-int igt_get_dsc_debugfs_fd(int drmfd, char *connector_name)
-{
- char file_name[128] = {0};
-
- sprintf(file_name, "%s/i915_dsc_fec_support", connector_name);
-
- return openat(igt_debugfs_dir(drmfd), file_name, O_WRONLY);
-}
-
/*
* igt_get_output_max_bpc:
* @drmfd: A drm file descriptor
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 7a00d2045..be5482e08 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -974,16 +974,6 @@ void igt_require_pipe(igt_display_t *display,
void igt_dump_connectors_fd(int drmfd);
void igt_dump_crtcs_fd(int drmfd);
bool igt_override_all_active_output_modes_to_fit_bw(igt_display_t *display);
-
-bool igt_is_dsc_supported(int drmfd, char *connector_name);
-bool igt_is_fec_supported(int drmfd, char *connector_name);
-bool igt_is_dsc_enabled(int drmfd, char *connector_name);
-bool igt_is_force_dsc_enabled(int drmfd, char *connector_name);
-int igt_force_dsc_enable(int drmfd, char *connector_name);
-int igt_force_dsc_enable_bpc(int drmfd, char *connector_name,
- int bpc);
-int igt_get_dsc_debugfs_fd(int drmfd, char *connector_name);
-
unsigned int igt_get_output_max_bpc(int drmfd, char *connector_name);
unsigned int igt_get_pipe_current_bpc(int drmfd, enum pipe pipe);
void igt_assert_output_bpc_equal(int drmfd, enum pipe pipe,
diff --git a/lib/meson.build b/lib/meson.build
index c79e3e952..1ba64bfd4 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -96,6 +96,7 @@ lib_sources = [
'igt_infoframe.c',
'veboxcopy_gen12.c',
'igt_msm.c',
+ 'igt_dsc.c',
]
lib_deps = [
--
2.25.1
next prev parent reply other threads:[~2023-01-09 15:26 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-09 15:28 [igt-dev] [PATCH i-g-t 0/8] VDSC YCbCr420 + Fractional BPP Swati Sharma
2023-01-09 15:28 ` Swati Sharma [this message]
2023-01-09 15:28 ` [igt-dev] [PATCH i-g-t 2/8] Move wrapper functions from kms_dsc to kms_dsc_helper Swati Sharma
2023-01-10 10:54 ` Hogander, Jouni
2023-01-09 15:28 ` [igt-dev] [PATCH i-g-t 3/8] lib/dsc: Add helpers for VDSC YCbCr420 debugfs entry Swati Sharma
2023-01-09 15:28 ` [igt-dev] [PATCH i-g-t 4/8] tests/i915/kms_dsc: Prep work for extending val support for VDSC YCbCr420 Swati Sharma
2023-01-09 15:28 ` [igt-dev] [PATCH i-g-t 5/8] tests/i915/kms_dsc: Enable validation " Swati Sharma
2023-01-10 11:56 ` Hogander, Jouni
2023-01-11 6:38 ` Swati Sharma
2023-01-09 15:28 ` [igt-dev] [PATCH i-g-t 6/8] lib/dsc: Add helpers for VDSC Fractional BPP debugfs entry Swati Sharma
2023-01-09 15:28 ` [igt-dev] [PATCH i-g-t 7/8] tests/i915/kms_dsc: Enable validation for VDSC Fractional BPP Swati Sharma
2023-01-09 15:28 ` [igt-dev] [PATCH i-g-t 8/8] tests/i915/kms_dsc: Add test summary Swati Sharma
2023-01-09 18:04 ` [igt-dev] ✗ GitLab.Pipeline: warning for VDSC YCbCr420 + Fractional BPP (rev2) Patchwork
2023-01-09 18:34 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2023-01-10 1:34 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230109152832.3310-2-swati2.sharma@intel.com \
--to=swati2.sharma@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=petri.latvala@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox