Skip to contentSkip to conversation

drm/amd/display: optimize code runtime a bit

PATCH Applied Bernard Zhao 2 participants 2 messages Sep 10, 2020 – Sep 15, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/display: optimize code runtime a bit

In fnction is_cr_done & is_ch_eq_done, when done = false happened once, no need to circle left ln_count. This change is to make the code run a bit fast.

---
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +5 -9
index b2be6ad5101d..53e30be8b66a 100644
@@ -373,34 +373,30 @@ static void dpcd_set_lt_pattern_and_lane_settings(
 static bool is_cr_done(enum dc_lane_count ln_count,
 	union lane_status *dpcd_lane_status)
 {
-	bool done = true;
 	uint32_t lane;
 	/*LANEx_CR_DONE bits All 1's?*/
 	for (lane = 0; lane < (uint32_t)(ln_count); lane++) {
 		if (!dpcd_lane_status[lane].bits.CR_DONE_0)
-			done = false;
+			return false;
 	}
-	return done;
-
+	return true;
 }
 
 static bool is_ch_eq_done(enum dc_lane_count ln_count,
 	union lane_status *dpcd_lane_status,
 	union lane_align_status_updated *lane_status_updated)
 {
-	bool done = true;
 	uint32_t lane;
 	if (!lane_status_updated->bits.INTERLANE_ALIGN_DONE)
-		done = false;
+		return false;
 	else {
 		for (lane = 0; lane < (uint32_t)(ln_count); lane++) {
 			if (!dpcd_lane_status[lane].bits.SYMBOL_LOCKED_0 ||
 				!dpcd_lane_status[lane].bits.CHANNEL_EQ_DONE_0)
-				done = false;
+				return false;
 		}
 	}
-	return done;
-
+	return true;
 }
 
 static void update_drive_settings(
Signature · 1 line
2.28.0
Applied
#1 lore raw

Applied. Thanks!

Alex

Quoted 57 lines · Bernard Zhao

In fnction is_cr_done & is_ch_eq_done, when done = false happened once, no need to circle left ln_count. This change is to make the code run a bit fast.

---
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +5 -10
index b2be6ad5101d..53e30be8b66a 100644
@@ -373,34 +373,30 @@ static void dpcd_set_lt_pattern_and_lane_settings(
 static bool is_cr_done(enum dc_lane_count ln_count,
        union lane_status *dpcd_lane_status)
 {
-       bool done = true;
        uint32_t lane;
        /*LANEx_CR_DONE bits All 1's?*/
        for (lane = 0; lane < (uint32_t)(ln_count); lane++) {
                if (!dpcd_lane_status[lane].bits.CR_DONE_0)
-                       done = false;
+                       return false;
        }
-       return done;
-
+       return true;
 }
 
 static bool is_ch_eq_done(enum dc_lane_count ln_count,
        union lane_status *dpcd_lane_status,
        union lane_align_status_updated *lane_status_updated)
 {
-       bool done = true;
        uint32_t lane;
        if (!lane_status_updated->bits.INTERLANE_ALIGN_DONE)
-               done = false;
+               return false;
        else {
                for (lane = 0; lane < (uint32_t)(ln_count); lane++) {
                        if (!dpcd_lane_status[lane].bits.SYMBOL_LOCKED_0 ||
                                !dpcd_lane_status[lane].bits.CHANNEL_EQ_DONE_0)
-                               done = false;
+                               return false;
                }
        }
-       return done;
-
+       return true;
 }
 
 static void update_drive_settings(
--

2.28.0

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx