disp: msm: sde/dsi: reduce display cyclomatic complexity
msm/sde/sde_encoder.c _sde_encoder_update_rsc_client() sde_encoder_prepare_for_kickoff() msm/dsi/dsi_drm.c dsi_bridge_mode_fixup() Lower the cyclomatic complexity for this function by splitting the work into helper functions. Change-Id: I2285809a33078e29989a6b44800c18342aa24170 Signed-off-by: GG Hou <quic_renjhou@quicinc.com>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

szülő
69d1699364
commit
644927312e
@@ -1,5 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
@@ -395,6 +396,63 @@ static void dsi_bridge_mode_set(struct drm_bridge *bridge,
|
||||
DSI_DEBUG("clk_rate: %llu\n", c_bridge->dsi_mode.timing.clk_rate_hz);
|
||||
}
|
||||
|
||||
static bool _dsi_bridge_mode_validate_and_fixup(struct drm_bridge *bridge,
|
||||
struct drm_crtc_state *crtc_state, struct dsi_display *display,
|
||||
struct dsi_display_mode *adj_mode)
|
||||
{
|
||||
int rc = 0;
|
||||
struct dsi_bridge *c_bridge = to_dsi_bridge(bridge);
|
||||
struct dsi_display_mode cur_dsi_mode;
|
||||
struct sde_connector_state *old_conn_state;
|
||||
struct drm_display_mode *cur_mode;
|
||||
|
||||
if (!bridge->encoder || !bridge->encoder->crtc || !crtc_state->crtc) {
|
||||
DSI_ERR("invalid params\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
cur_mode = &crtc_state->crtc->state->mode;
|
||||
old_conn_state = to_sde_connector_state(display->drm_conn->state);
|
||||
|
||||
convert_to_dsi_mode(cur_mode, &cur_dsi_mode);
|
||||
msm_parse_mode_priv_info(&old_conn_state->msm_mode, &cur_dsi_mode);
|
||||
|
||||
rc = dsi_display_validate_mode_change(c_bridge->display, &cur_dsi_mode, adj_mode);
|
||||
if (rc) {
|
||||
DSI_ERR("[%s] seamless mode mismatch failure rc=%d\n", c_bridge->display->name, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* DMS Flag if set during active changed condition cannot be
|
||||
* treated as seamless. Hence, removing DMS flag in such cases.
|
||||
*/
|
||||
if ((adj_mode->dsi_mode_flags & DSI_MODE_FLAG_DMS) &&
|
||||
crtc_state->active_changed)
|
||||
adj_mode->dsi_mode_flags &= ~DSI_MODE_FLAG_DMS;
|
||||
|
||||
/* No DMS/VRR when drm pipeline is changing */
|
||||
if (!dsi_display_mode_match(&cur_dsi_mode, adj_mode,
|
||||
DSI_MODE_MATCH_FULL_TIMINGS) &&
|
||||
(!(adj_mode->dsi_mode_flags & DSI_MODE_FLAG_VRR)) &&
|
||||
(!(adj_mode->dsi_mode_flags & DSI_MODE_FLAG_DYN_CLK)) &&
|
||||
(!(adj_mode->dsi_mode_flags & DSI_MODE_FLAG_POMS_TO_VID)) &&
|
||||
(!(adj_mode->dsi_mode_flags & DSI_MODE_FLAG_POMS_TO_CMD)) &&
|
||||
(!crtc_state->active_changed ||
|
||||
display->is_cont_splash_enabled)) {
|
||||
adj_mode->dsi_mode_flags |= DSI_MODE_FLAG_DMS;
|
||||
|
||||
SDE_EVT32(SDE_EVTLOG_FUNC_CASE2,
|
||||
adj_mode->timing.h_active,
|
||||
adj_mode->timing.v_active,
|
||||
adj_mode->timing.refresh_rate,
|
||||
adj_mode->pixel_clk_khz,
|
||||
adj_mode->panel_mode_caps);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static bool dsi_bridge_mode_fixup(struct drm_bridge *bridge,
|
||||
const struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode)
|
||||
@@ -402,10 +460,10 @@ static bool dsi_bridge_mode_fixup(struct drm_bridge *bridge,
|
||||
int rc = 0;
|
||||
struct dsi_bridge *c_bridge = to_dsi_bridge(bridge);
|
||||
struct dsi_display *display;
|
||||
struct dsi_display_mode dsi_mode, cur_dsi_mode, *panel_dsi_mode;
|
||||
struct dsi_display_mode dsi_mode, *panel_dsi_mode;
|
||||
struct drm_crtc_state *crtc_state;
|
||||
struct drm_connector_state *drm_conn_state;
|
||||
struct sde_connector_state *conn_state, *old_conn_state;
|
||||
struct sde_connector_state *conn_state;
|
||||
struct msm_sub_mode new_sub_mode;
|
||||
|
||||
crtc_state = container_of(mode, struct drm_crtc_state, mode);
|
||||
@@ -481,49 +539,10 @@ static bool dsi_bridge_mode_fixup(struct drm_bridge *bridge,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bridge->encoder && bridge->encoder->crtc &&
|
||||
crtc_state->crtc) {
|
||||
const struct drm_display_mode *cur_mode =
|
||||
&crtc_state->crtc->state->mode;
|
||||
old_conn_state = to_sde_connector_state(display->drm_conn->state);
|
||||
|
||||
convert_to_dsi_mode(cur_mode, &cur_dsi_mode);
|
||||
msm_parse_mode_priv_info(&old_conn_state->msm_mode, &cur_dsi_mode);
|
||||
|
||||
rc = dsi_display_validate_mode_change(c_bridge->display,
|
||||
&cur_dsi_mode, &dsi_mode);
|
||||
if (rc) {
|
||||
DSI_ERR("[%s] seamless mode mismatch failure rc=%d\n",
|
||||
c_bridge->display->name, rc);
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* DMS Flag if set during active changed condition cannot be
|
||||
* treated as seamless. Hence, removing DMS flag in such cases.
|
||||
*/
|
||||
if ((dsi_mode.dsi_mode_flags & DSI_MODE_FLAG_DMS) &&
|
||||
crtc_state->active_changed)
|
||||
dsi_mode.dsi_mode_flags &= ~DSI_MODE_FLAG_DMS;
|
||||
|
||||
/* No DMS/VRR when drm pipeline is changing */
|
||||
if (!dsi_display_mode_match(&cur_dsi_mode, &dsi_mode,
|
||||
DSI_MODE_MATCH_FULL_TIMINGS) &&
|
||||
(!(dsi_mode.dsi_mode_flags & DSI_MODE_FLAG_VRR)) &&
|
||||
(!(dsi_mode.dsi_mode_flags & DSI_MODE_FLAG_DYN_CLK)) &&
|
||||
(!(dsi_mode.dsi_mode_flags & DSI_MODE_FLAG_POMS_TO_VID)) &&
|
||||
(!(dsi_mode.dsi_mode_flags & DSI_MODE_FLAG_POMS_TO_CMD)) &&
|
||||
(!crtc_state->active_changed ||
|
||||
display->is_cont_splash_enabled)) {
|
||||
dsi_mode.dsi_mode_flags |= DSI_MODE_FLAG_DMS;
|
||||
|
||||
SDE_EVT32(SDE_EVTLOG_FUNC_CASE2,
|
||||
dsi_mode.timing.h_active,
|
||||
dsi_mode.timing.v_active,
|
||||
dsi_mode.timing.refresh_rate,
|
||||
dsi_mode.pixel_clk_khz,
|
||||
dsi_mode.panel_mode_caps);
|
||||
}
|
||||
rc = _dsi_bridge_mode_validate_and_fixup(bridge, crtc_state, display, &dsi_mode);
|
||||
if (rc) {
|
||||
DSI_ERR("[%s] failed to validate dsi bridge mode.\n", display->name);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Reject seamless transition when active changed */
|
||||
|
Reference in New Issue
Block a user