[PATCH i-g-t v1] lib/igt_kms: Backup connector modes before sorting
Santhosh Reddy Guddati
santhosh.reddy.guddati at intel.com
Tue Dec 24 03:44:15 UTC 2024
Backup connector modes before sorting to ensure the original mode
is not changed if the joiner is not found.This will skip updating
connector->mode[0] if joiner is not available.
v2: Dont sort the modes, instead check for the modes (Luca Coelho)
Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13287
Signed-off-by: Santhosh Reddy Guddati <santhosh.reddy.guddati at intel.com>
---
lib/igt_kms.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 3d061abc5..17b36f861 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -6394,15 +6394,15 @@ bool bigjoiner_mode_found(int drm_fd, drmModeConnector *connector,
int max_dotclock, drmModeModeInfo *mode)
{
bool found = false;
+ drmModeModeInfo *modes_backup;
- igt_sort_connector_modes(connector, sort_drm_modes_by_res_dsc);
- found = igt_bigjoiner_possible(drm_fd, &connector->modes[0], max_dotclock);
- if (!found) {
- igt_sort_connector_modes(connector, sort_drm_modes_by_clk_dsc);
- found = igt_bigjoiner_possible(drm_fd, &connector->modes[0], max_dotclock);
+ for (int i=0; i< connector->count_modes; i++) {
+ if (igt_bigjoiner_possible(drm_fd, &connector->modes[i], max_dotclock)) {
+ *mode = connector->modes[i];
+ found = true;
+ break;
+ }
}
- if (found)
- *mode = connector->modes[0];
return found;
}
@@ -6439,14 +6439,14 @@ bool ultrajoiner_mode_found(int drm_fd, drmModeConnector *connector,
{
bool found = false;
- igt_sort_connector_modes(connector, sort_drm_modes_by_res_dsc);
- found = igt_ultrajoiner_possible(&connector->modes[0], max_dotclock);
- if (!found) {
- igt_sort_connector_modes(connector, sort_drm_modes_by_clk_dsc);
- found = igt_ultrajoiner_possible(&connector->modes[0], max_dotclock);
+ for (int i = 0; i < connector->count_modes; i++) {
+ if (igt_ultrajoiner_possible(&connector->modes[i], max_dotclock)) {
+ *mode = connector->modes[i];
+ found = true;
+ break;
+ }
}
- if (found)
- *mode = connector->modes[0];
+
return found;
}
--
2.43.0
More information about the Intel-gfx-trybot
mailing list