From 54321088460d200116e29047323503067886d698 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 21 Aug 2024 22:18:23 +0200 Subject: [PATCH] backend/drm: drop SKIP in match_connectors_with_crtcs() It's unused. --- backend/drm/util.c | 17 ++++++----------- include/backend/drm/util.h | 5 +---- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/backend/drm/util.c b/backend/drm/util.c index 45ec207f0..6ba090c18 100644 --- a/backend/drm/util.c +++ b/backend/drm/util.c @@ -133,7 +133,7 @@ struct match_state { * * Returns whether we've set a new best element with this solution. */ -static bool match_connectors_with_crtcs_(struct match_state *st, size_t skips, +static bool match_connectors_with_crtcs_(struct match_state *st, size_t score, size_t replaced, size_t crtc_index) { // Finished if (crtc_index >= st->num_crtcs) { @@ -143,7 +143,7 @@ static bool match_connectors_with_crtcs_(struct match_state *st, size_t skips, st->replaced = replaced; memcpy(st->best, st->res, sizeof(st->best[0]) * st->num_crtcs); - st->exit_early = (st->score == st->num_crtcs - skips + st->exit_early = (st->score == st->num_crtcs || st->score == st->num_conns) && st->replaced == 0; @@ -153,11 +153,6 @@ static bool match_connectors_with_crtcs_(struct match_state *st, size_t skips, } } - if (st->orig[crtc_index] == SKIP) { - st->res[crtc_index] = SKIP; - return match_connectors_with_crtcs_(st, skips + 1, score, replaced, crtc_index + 1); - } - bool has_best = false; /* @@ -167,7 +162,7 @@ static bool match_connectors_with_crtcs_(struct match_state *st, size_t skips, if (st->orig[crtc_index] != UNMATCHED && !is_taken(crtc_index, st->res, st->orig[crtc_index])) { st->res[crtc_index] = st->orig[crtc_index]; size_t crtc_score = st->conns[st->res[crtc_index]] != 0 ? 1 : 0; - if (match_connectors_with_crtcs_(st, skips, score + crtc_score, replaced, crtc_index + 1)) { + if (match_connectors_with_crtcs_(st, score + crtc_score, replaced, crtc_index + 1)) { has_best = true; } } @@ -197,7 +192,7 @@ static bool match_connectors_with_crtcs_(struct match_state *st, size_t skips, st->res[crtc_index] = candidate; size_t crtc_score = st->conns[candidate] != 0 ? 1 : 0; - if (match_connectors_with_crtcs_(st, skips, score + crtc_score, replaced, crtc_index + 1)) { + if (match_connectors_with_crtcs_(st, score + crtc_score, replaced, crtc_index + 1)) { has_best = true; } @@ -208,7 +203,7 @@ static bool match_connectors_with_crtcs_(struct match_state *st, size_t skips, // Maybe this CRTC can't be matched st->res[crtc_index] = UNMATCHED; - if (match_connectors_with_crtcs_(st, skips, score, replaced, crtc_index + 1)) { + if (match_connectors_with_crtcs_(st, score, replaced, crtc_index + 1)) { has_best = true; } @@ -236,7 +231,7 @@ void match_connectors_with_crtcs(size_t num_conns, .exit_early = false, }; - match_connectors_with_crtcs_(&st, 0, 0, 0, 0); + match_connectors_with_crtcs_(&st, 0, 0, 0); } void generate_cvt_mode(drmModeModeInfo *mode, int hdisplay, int vdisplay, diff --git a/include/backend/drm/util.h b/include/backend/drm/util.h index 85a8f4722..9ba5f435e 100644 --- a/include/backend/drm/util.h +++ b/include/backend/drm/util.h @@ -19,10 +19,7 @@ void generate_cvt_mode(drmModeModeInfo *mode, int hdisplay, int vdisplay, float vrefresh); // Part of match_connectors_with_crtcs -enum { - UNMATCHED = (uint32_t)-1, - SKIP = (uint32_t)-2, -}; +#define UNMATCHED ((uint32_t)-1) /** * Tries to match DRM connectors with DRM CRTCs.