[PATCH i-g-t v2] lib/igt_kms: Update igt_fit_modes_in_bw to add legacy commit check
Karthik B S
karthik.b.s at intel.com
Mon Jul 14 14:55:44 UTC 2025
Currently igt_fit_modes_in_bw is only checking for atomic commit but the
igt_override_all_active_output_modes_to_fit_bw function which it is
wrapping actually has support for legacy commit as well.
To handle this, add support for legacy commit check as well.
v2: Update the function description.
Signed-off-by: Karthik B S <karthik.b.s at intel.com>
Reviewed-by: Peter Senna Tschudin <peter.senna at linux.intel.com>
---
lib/igt_kms.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 84ba1635c..7191bf92e 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -5051,8 +5051,11 @@ bool igt_override_all_active_output_modes_to_fit_bw(igt_display_t *display)
* igt_fit_modes_in_bw :
* @display: a pointer to an #igt_display_t structure
*
- * Tries atomic TEST_ONLY commit; if it fails, overrides
- * output modes to fit bandwidth.
+ * Attempts to commit the current display configuration using
+ * atomic or legacy commit style based on the platform support.
+ *
+ * If the commit fails, attempts to override all active output
+ * modes to try to fit within the available bandwidth.
*
* Returns: true if a valid mode combination is found or the commit succeeds,
* false otherwise.
@@ -5061,9 +5064,13 @@ bool igt_fit_modes_in_bw(igt_display_t *display)
{
int ret;
- ret = igt_display_try_commit_atomic(display,
- DRM_MODE_ATOMIC_TEST_ONLY |
- DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+ if (display->is_atomic)
+ ret = igt_display_try_commit_atomic(display,
+ DRM_MODE_ATOMIC_TEST_ONLY |
+ DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+ else
+ ret = igt_display_try_commit2(display, COMMIT_LEGACY);
+
if (ret != 0) {
bool found;
--
2.43.0
More information about the igt-dev
mailing list