Merge f119b3e97f on remote branch

Change-Id: Ie65868a44d45c94bed8292802f4db2d9cf49b853
Signed-off-by: Mohit Sharma <quic_smohit@quicinc.com>
This commit is contained in:
Linux Build Service Account
2023-08-11 05:52:44 -07:00
committed by Mohit Sharma
7 changed files with 114 additions and 17 deletions

View File

@@ -1099,6 +1099,7 @@ static int dp_display_host_init(struct dp_display_private *dp)
enable_irq(dp->irq);
dp_display_abort_hdcp(dp, false);
dp_display_qos_request(dp, true);
dp_display_state_add(DP_STATE_INITIALIZED);
/* log this as it results from user action of cable connection */
@@ -1187,6 +1188,7 @@ static void dp_display_host_deinit(struct dp_display_private *dp)
return;
}
dp_display_qos_request(dp, false);
dp_display_abort_hdcp(dp, true);
dp->ctrl->deinit(dp->ctrl);
dp->hpd->host_deinit(dp->hpd, &dp->catalog->hpd);
@@ -2158,8 +2160,10 @@ static int dp_init_sub_modules(struct dp_display_private *dp)
dp->aux_switch_node = of_parse_phandle(dp->pdev->dev.of_node, phandle, 0);
if (!dp->aux_switch_node) {
DP_DEBUG("cannot parse %s handle\n", phandle);
dp->no_aux_switch = true;
DP_WARN("Aux switch node not found, assigning bypass mode as switch type\n");
dp->switch_type = DP_AUX_SWITCH_BYPASS;
goto skip_node_name;
}
if (!strcmp(dp->aux_switch_node->name, "fsa4480"))
@@ -2169,6 +2173,7 @@ static int dp_init_sub_modules(struct dp_display_private *dp)
else
dp->switch_type = DP_AUX_SWITCH_BYPASS;
skip_node_name:
dp->aux = dp_aux_get(dev, &dp->catalog->aux, dp->parser,
dp->aux_switch_node, dp->aux_bridge, dp->switch_type);
if (IS_ERR(dp->aux)) {

View File

@@ -1103,8 +1103,8 @@ int dp_mst_sim_update(void *mst_sim_context, u32 port_num,
rc = -ENOMEM;
goto fail;
}
ctx->port_num = port_num;
for (i = 0; i < port_num; i++) {
ctx->ports[i] = ports[i];
if (ports[i].edid_size) {

View File

@@ -1728,6 +1728,20 @@ static int _sde_connector_set_prop_dyn_transfer_time(struct sde_connector *c_con
return rc;
}
static void _sde_connector_handle_dpms_off(struct sde_connector *c_conn, uint64_t val)
{
/* suspend case: clear stale MISR */
if (val == SDE_MODE_DPMS_OFF) {
memset(&c_conn->previous_misr_sign, 0, sizeof(struct sde_misr_sign));
/* reset backlight scale of LTM */
if (c_conn->bl_scale_sv != MAX_SV_BL_SCALE_LEVEL) {
c_conn->bl_scale_sv = MAX_SV_BL_SCALE_LEVEL;
c_conn->bl_scale_dirty = true;
}
}
}
static int sde_connector_atomic_set_property(struct drm_connector *connector,
struct drm_connector_state *state,
struct drm_property *property,
@@ -1823,9 +1837,7 @@ static int sde_connector_atomic_set_property(struct drm_connector *connector,
_sde_connector_set_prop_dyn_transfer_time(c_conn, val);
break;
case CONNECTOR_PROP_LP:
/* suspend case: clear stale MISR */
if (val == SDE_MODE_DPMS_OFF)
memset(&c_conn->previous_misr_sign, 0, sizeof(struct sde_misr_sign));
_sde_connector_handle_dpms_off(c_conn, val);
break;
default:
break;

View File

@@ -5190,6 +5190,7 @@ static void sde_crtc_disable(struct drm_crtc *crtc)
crtc->state->enable, sde_crtc->cached_encoder_mask);
sde_crtc->enabled = false;
sde_crtc->cached_encoder_mask = 0;
cstate->cached_cwb_enc_mask = 0;
/* Try to disable uidle */
sde_core_perf_crtc_update_uidle(crtc, false);

View File

@@ -635,8 +635,8 @@ int sde_encoder_helper_unregister_irq(struct sde_encoder_phys *phys_enc,
struct sde_encoder_irq *irq;
int ret;
if (!phys_enc) {
SDE_ERROR("invalid encoder\n");
if (!phys_enc || intr_idx >= INTR_IDX_MAX) {
SDE_ERROR("invalid params\n");
return -EINVAL;
}
irq = &phys_enc->irq[intr_idx];
@@ -2777,6 +2777,7 @@ static void sde_encoder_virt_mode_set(struct drm_encoder *drm_enc,
sde_crtc_state->cached_cwb_enc_mask);
sde_crtc_state->cwb_enc_mask = sde_crtc_state->cached_cwb_enc_mask;
sde_encoder_set_clone_mode(drm_enc, crtc_state);
sde_crtc->cached_encoder_mask |= drm_encoder_mask(drm_enc);
}
/* reserve dynamic resources now, indicating non test-only */
@@ -3271,6 +3272,10 @@ static void sde_encoder_virt_enable(struct drm_encoder *drm_enc)
return;
}
if (sde_encoder_is_built_in_display(drm_enc) &&
msm_is_mode_seamless_poms(&c_state->msm_mode))
drm_crtc_vblank_put(sde_enc->crtc);
memset(&sde_enc->cur_master->intf_cfg_v1, 0,
sizeof(sde_enc->cur_master->intf_cfg_v1));
@@ -3359,6 +3364,7 @@ static void sde_encoder_virt_disable(struct drm_encoder *drm_enc)
struct sde_encoder_virt *sde_enc = NULL;
struct sde_connector *sde_conn;
struct sde_kms *sde_kms;
struct sde_connector_state *c_state = NULL;
enum sde_intf_mode intf_mode;
int ret, i = 0;
@@ -3390,6 +3396,12 @@ static void sde_encoder_virt_disable(struct drm_encoder *drm_enc)
if (!sde_kms)
return;
c_state = to_sde_connector_state(sde_enc->cur_master->connector->state);
if (!c_state) {
SDE_ERROR("invalid connector state\n");
return;
}
intf_mode = sde_encoder_get_intf_mode(drm_enc);
SDE_EVT32(DRMID(drm_enc));
@@ -3412,6 +3424,10 @@ static void sde_encoder_virt_disable(struct drm_encoder *drm_enc)
_sde_encoder_input_handler_unregister(drm_enc);
flush_delayed_work(&sde_conn->status_work);
if (sde_encoder_is_built_in_display(drm_enc) &&
msm_is_mode_seamless_poms(&c_state->msm_mode))
drm_crtc_vblank_get(sde_enc->crtc);
/*
* For primary command mode and video mode encoders, execute the
* resource control pre-stop operations before the physical encoders
@@ -3447,7 +3463,8 @@ static void sde_encoder_virt_disable(struct drm_encoder *drm_enc)
* wait for any pending vsync timestamp event to sf
* to ensure vbalnk irq is disabled.
*/
if (sde_enc->vblank_enabled)
if (sde_enc->vblank_enabled &&
!msm_is_mode_seamless_poms(&c_state->msm_mode))
sde_encoder_wait_for_vsync_event_complete(sde_enc);
/*

View File

@@ -541,6 +541,35 @@ static void sde_encoder_phys_wb_setup_fb(struct sde_encoder_phys *phys_enc,
}
static inline bool _sde_encoder_is_single_lm_partial_update(struct sde_encoder_phys_wb *wb_enc)
{
struct sde_crtc *sde_crtc;
struct sde_crtc_state *cstate;
bool lr_only_pu = false;
if (!wb_enc || !wb_enc->crtc || !wb_enc->crtc->state) {
SDE_ERROR("invalid parameter(s)\n");
return true;
}
sde_crtc = to_sde_crtc(wb_enc->crtc);
cstate = to_sde_crtc_state(wb_enc->crtc->state);
/**
* partial update logic and CWB is currently supported only
* upto dual pipe configurations.
*/
if (sde_crtc->num_mixers != CRTC_DUAL_MIXERS_ONLY)
return true;
lr_only_pu = (!sde_kms_rect_is_null(&cstate->lm_roi[0]) &&
sde_kms_rect_is_null(&cstate->lm_roi[1])) ||
(sde_kms_rect_is_null(&cstate->lm_roi[0]) &&
!sde_kms_rect_is_null(&cstate->lm_roi[1]));
return lr_only_pu;
}
static void _sde_encoder_phys_wb_setup_cwb(struct sde_encoder_phys *phys_enc, bool enable)
{
struct sde_encoder_phys_wb *wb_enc = to_sde_encoder_phys_wb(phys_enc);
@@ -550,9 +579,9 @@ static void _sde_encoder_phys_wb_setup_cwb(struct sde_encoder_phys *phys_enc, bo
struct sde_crtc *crtc = to_sde_crtc(wb_enc->crtc);
struct sde_hw_pingpong *hw_pp = phys_enc->hw_pp;
struct sde_hw_dnsc_blur *hw_dnsc_blur = phys_enc->hw_dnsc_blur;
bool need_merge = (crtc->num_mixers > 1);
bool need_merge = false;
enum sde_dcwb;
int i = 0;
int i = 0, num_mixers = 0;
const int num_wb = 1;
if (!phys_enc->in_clone_mode) {
@@ -574,6 +603,19 @@ static void _sde_encoder_phys_wb_setup_cwb(struct sde_encoder_phys *phys_enc, bo
return;
}
/**
* 3d_merge active or cwb active for cwb path has to be set based upon
* LMs in a CTL path. On cwb disable commit both 3d_merge active and cwb
* active for a particular CTL path has to be disabled.
*/
if (enable) {
need_merge = !(_sde_encoder_is_single_lm_partial_update(wb_enc));
num_mixers = need_merge ? crtc->num_mixers : CRTC_SINGLE_MIXER_ONLY;
} else {
need_merge = (crtc->num_mixers > CRTC_SINGLE_MIXER_ONLY) ? true : false;
num_mixers = crtc->num_mixers;
}
hw_ctl = crtc->mixers[0].hw_ctl;
if (hw_ctl && hw_ctl->ops.setup_intf_cfg_v1 &&
(test_bit(SDE_WB_CWB_CTRL, &hw_wb->caps->features) ||
@@ -583,7 +625,7 @@ static void _sde_encoder_phys_wb_setup_cwb(struct sde_encoder_phys *phys_enc, bo
intf_cfg.wb_count = num_wb;
intf_cfg.wb[0] = hw_wb->idx;
for (i = 0; i < crtc->num_mixers; i++) {
for (i = 0; i < num_mixers; i++) {
if (test_bit(SDE_WB_DCWB_CTRL, &hw_wb->caps->features))
intf_cfg.cwb[intf_cfg.cwb_count++] =
(enum sde_cwb)(hw_pp->dcwb_idx + i);
@@ -644,6 +686,7 @@ static void _sde_encoder_phys_wb_setup_ctl(struct sde_encoder_phys *phys_enc,
struct sde_hw_dnsc_blur *hw_dnsc_blur;
struct sde_hw_ctl *ctl;
const int num_wb = 1;
bool need_merge = false;
if (!phys_enc) {
SDE_ERROR("invalid encoder\n");
@@ -661,6 +704,7 @@ static void _sde_encoder_phys_wb_setup_ctl(struct sde_encoder_phys *phys_enc,
hw_cdm = phys_enc->hw_cdm;
hw_dnsc_blur = phys_enc->hw_dnsc_blur;
ctl = phys_enc->hw_ctl;
need_merge = !(_sde_encoder_is_single_lm_partial_update(wb_enc));
if (test_bit(SDE_CTL_ACTIVE_CFG, &ctl->caps->features) &&
(phys_enc->hw_ctl && phys_enc->hw_ctl->ops.setup_intf_cfg_v1)) {
@@ -684,12 +728,12 @@ static void _sde_encoder_phys_wb_setup_ctl(struct sde_encoder_phys *phys_enc,
intf_cfg_v1->dnsc_blur[0] = hw_dnsc_blur->idx;
}
if (mode_3d && hw_pp && hw_pp->merge_3d &&
if (mode_3d && need_merge && hw_pp && hw_pp->merge_3d &&
intf_cfg_v1->merge_3d_count < MAX_MERGE_3D_PER_CTL_V1)
intf_cfg_v1->merge_3d[intf_cfg_v1->merge_3d_count++] = hw_pp->merge_3d->idx;
if (hw_pp && hw_pp->ops.setup_3d_mode)
hw_pp->ops.setup_3d_mode(hw_pp, mode_3d);
hw_pp->ops.setup_3d_mode(hw_pp, need_merge ? mode_3d : 0);
/* setup which pp blk will connect to this wb */
if (hw_pp && hw_wb->ops.bind_pingpong_blk)
@@ -1216,7 +1260,7 @@ static void _sde_encoder_phys_wb_update_cwb_flush_helper(
struct sde_encoder_phys_wb *wb_enc = to_sde_encoder_phys_wb(phys_enc);
struct sde_crtc_state *crtc_state;
struct sde_crtc *crtc;
int i = 0;
int i = 0, num_mixers;
int cwb_capture_mode = 0;
bool need_merge = false;
bool dspp_out = false;
@@ -1237,9 +1281,16 @@ static void _sde_encoder_phys_wb_update_cwb_flush_helper(
return;
}
if (enable) {
need_merge = !(_sde_encoder_is_single_lm_partial_update(wb_enc));
num_mixers = need_merge ? crtc->num_mixers : CRTC_SINGLE_MIXER_ONLY;
} else {
need_merge = (crtc->num_mixers > CRTC_SINGLE_MIXER_ONLY) ? true : false;
num_mixers = crtc->num_mixers;
}
crtc_state = to_sde_crtc_state(wb_enc->crtc->state);
cwb_capture_mode = sde_crtc_get_property(crtc_state, CRTC_PROP_CAPTURE_OUTPUT);
need_merge = (crtc->num_mixers > 1) ? true : false;
dspp_out = (cwb_capture_mode == CAPTURE_DSPP_OUT);
cwb_idx = (enum sde_cwb)hw_pp->idx;
src_pp_idx = (enum sde_cwb)crtc->mixers[0].hw_lm->idx;
@@ -1258,7 +1309,7 @@ static void _sde_encoder_phys_wb_update_cwb_flush_helper(
}
}
for (i = 0; i < crtc->num_mixers; i++) {
for (i = 0; i < num_mixers; i++) {
src_pp_idx = (enum sde_cwb) (src_pp_idx + i);
if (test_bit(SDE_WB_DCWB_CTRL, &hw_wb->caps->features)) {
@@ -1335,7 +1386,7 @@ static void _sde_encoder_phys_wb_update_cwb_flush(struct sde_encoder_phys *phys_
src_pp_idx = (enum sde_cwb)crtc->mixers[0].hw_lm->idx;
cwb_idx = (enum sde_cwb)hw_pp->idx;
dspp_out = (cwb_capture_mode == CAPTURE_DSPP_OUT);
need_merge = (crtc->num_mixers > 1) ? true : false;
need_merge = !(_sde_encoder_is_single_lm_partial_update(wb_enc));
if (test_bit(SDE_WB_DCWB_CTRL, &hw_wb->caps->features)) {
dcwb_idx = hw_pp->dcwb_idx;
@@ -1876,6 +1927,9 @@ static bool _sde_encoder_phys_wb_is_idle(struct sde_encoder_phys *phys_enc)
static void _sde_encoder_phys_wb_reset_state(struct sde_encoder_phys *phys_enc)
{
struct sde_encoder_phys_wb *wb_enc = to_sde_encoder_phys_wb(phys_enc);
struct sde_encoder_virt *sde_enc = to_sde_encoder_virt(phys_enc->parent);
struct sde_wb_device *wb_dev = wb_enc->wb_dev;
struct sde_crtc *sde_crtc;
phys_enc->enable_state = SDE_ENC_DISABLED;
@@ -1887,10 +1941,17 @@ static void _sde_encoder_phys_wb_reset_state(struct sde_encoder_phys *phys_enc)
wb_enc->wb_aspace = NULL;
}
sde_crtc = to_sde_crtc(sde_enc->crtc);
if (sde_crtc)
sde_crtc->cached_encoder_mask &= ~drm_encoder_mask(phys_enc->parent);
wb_enc->crtc = NULL;
phys_enc->hw_cdm = NULL;
phys_enc->hw_ctl = NULL;
phys_enc->in_clone_mode = false;
kfree(wb_dev->modes);
wb_dev->modes = NULL;
wb_dev->count_modes = 0;
atomic_set(&phys_enc->pending_kickoff_cnt, 0);
atomic_set(&phys_enc->pending_retire_fence_cnt, 0);
atomic_set(&phys_enc->pending_ctl_start_cnt, 0);

View File

@@ -93,6 +93,7 @@
#define MAX_IMG_WIDTH 0x3fff
#define MAX_IMG_HEIGHT 0x3fff
#define CRTC_SINGLE_MIXER_ONLY 1
#define CRTC_DUAL_MIXERS_ONLY 2
#define MAX_MIXERS_PER_CRTC 4
#define MAX_MIXERS_PER_LAYOUT 2