summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAurabindo Pillai <aurabindo.pillai@amd.com>2023-11-03 13:58:00 -0400
committerAurabindo Pillai <aurabindo.pillai@amd.com>2023-11-08 14:35:52 -0500
commit2c13e6422ff847eb7523ca5291c21294f8b34ef6 (patch)
tree81690f10cf27325dcb08ad82b0261762fd5e2d8b
parent0380778314e81d5ca9ef250b16930abd12a5a117 (diff)
lib/amd: Add check for SubVP feature status
Add an API to check whether Subviewport feature is supported and enabled Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com> Reviewed-by: Alex Hung <alex.hung@amd.com>
-rw-r--r--lib/igt_amd.c29
-rw-r--r--lib/igt_amd.h1
2 files changed, 30 insertions, 0 deletions
diff --git a/lib/igt_amd.c b/lib/igt_amd.c
index 177a1094d..247a42f37 100644
--- a/lib/igt_amd.c
+++ b/lib/igt_amd.c
@@ -45,6 +45,8 @@
#define Y6 64
#define Y7 128
+#define subvp_supported "sub-viewport supported: yes"
+#define subvp_enabled "sub-viewport supported: yes, enabled: yes"
#define mall_supported "mall supported: yes"
#define mall_enabled "mall supported: yes, enabled: yes"
@@ -1204,6 +1206,33 @@ void igt_amd_get_mall_status(int drm_fd, bool *supported, bool *enabled)
}
/**
+ * @brief check if AMDGPU sub-viewport support exists
+ *
+ * @param drm_fd DRM file descriptor
+ * @param supported set to true if harwdare supports subviewport
+ * @param enabled set tot true if subviewport is currently in use
+ */
+void igt_amd_get_subvp_status(int drm_fd, bool *supported, bool *enabled)
+{
+ char buf[1024];
+ char *subvp_loc;
+
+ *supported = false;
+ *enabled = false;
+
+ if (!get_dm_capabilities(drm_fd, buf, 1024))
+ return;
+
+ subvp_loc = strstr(buf, subvp_supported);
+ if (subvp_loc)
+ *supported = true;
+
+ subvp_loc = strstr(buf, subvp_enabled);
+ if (subvp_loc && *supported)
+ *enabled = true;
+}
+
+/**
* @brief check if AMDGPU DM visual confirm debugfs interface entry exist and defined
*
* @param drm_fd DRM file descriptor
diff --git a/lib/igt_amd.h b/lib/igt_amd.h
index de992ac4f..1e66348ad 100644
--- a/lib/igt_amd.h
+++ b/lib/igt_amd.h
@@ -200,5 +200,6 @@ int igt_amd_get_visual_confirm(int drm_fd);
bool igt_amd_set_visual_confirm(int drm_fd, enum amdgpu_debug_visual_confirm option);
void igt_amd_get_mall_status(int drm_fd, bool *supported, bool *enabled);
+void igt_amd_get_subvp_status(int drm_fd, bool *supported, bool *enabled);
bool igt_amd_output_has_odm_combine_segments(int drm_fd, char *connector_name);
#endif /* IGT_AMD_H */