From e380b315c692e3cce2640426b04d858a02ba9e2f Mon Sep 17 00:00:00 2001 From: Ray Zhang Date: Fri, 5 Jun 2020 13:43:34 +0800 Subject: [PATCH 1/2] disp: msm: do not print error when crtc state is empty Sometimes committed state doesn't contain any crtcs. For example, fbdev emulation is still pushing null commits to DRM even if the cable has been plugged out. Avoid flooding the logs in this case. Change-Id: I6b7f049b80409c4a2ae057839ede6dd8af10d03b Signed-off-by: Ray Zhang Signed-off-by: Steve Cohen --- msm/msm_atomic.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/msm/msm_atomic.c b/msm/msm_atomic.c index efd5a879bb..2fce69c513 100644 --- a/msm/msm_atomic.c +++ b/msm/msm_atomic.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. * Copyright (C) 2014 Red Hat * Author: Rob Clark * @@ -605,7 +605,7 @@ static void msm_atomic_commit_dispatch(struct drm_device *dev, struct msm_drm_private *priv = dev->dev_private; struct drm_crtc *crtc = NULL; struct drm_crtc_state *crtc_state = NULL; - int ret = -EINVAL, i = 0, j = 0; + int ret = -ECANCELED, i = 0, j = 0; bool nonblock; /* cache since work will kfree commit in non-blocking case */ @@ -626,6 +626,7 @@ static void msm_atomic_commit_dispatch(struct drm_device *dev, } else { DRM_ERROR(" Error for crtc_id: %d\n", priv->disp_thread[j].crtc_id); + ret = -EINVAL; } break; } @@ -641,13 +642,17 @@ static void msm_atomic_commit_dispatch(struct drm_device *dev, } if (ret) { + if (ret == -EINVAL) + DRM_ERROR("failed to dispatch commit to any CRTC\n"); + else + DRM_DEBUG_DRIVER_RATELIMITED("empty crtc state\n"); + /** * this is not expected to happen, but at this point the state * has been swapped, but we couldn't dispatch to a crtc thread. * fallback now to a synchronous complete_commit to try and * ensure that SW and HW state don't get out of sync. */ - DRM_ERROR("failed to dispatch commit to any CRTC\n"); complete_commit(commit); } else if (!nonblock) { kthread_flush_work(&commit->commit_work); From 2211a5dac3e660651e6072f3b0e5f12fac8726e4 Mon Sep 17 00:00:00 2001 From: Raviteja Tamatam Date: Tue, 23 Jun 2020 03:27:46 +0530 Subject: [PATCH 2/2] disp: msm: sde: avoid registering vblank callback during CWB During cases where vblank callback registration happens during CWB is enabled and deregistered at point of no CWB, WB encoder is left with dangling vblank_cb. Added changes to avoid registering vblank callback on the clone mode encoder. Change-Id: I62aa12ef453166d2f5558852d924f87841872f37 Signed-off-by: Raviteja Tamatam --- msm/sde/sde_encoder.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/msm/sde/sde_encoder.c b/msm/sde/sde_encoder.c index f252c53d1e..ff6dfcbc97 100644 --- a/msm/sde/sde_encoder.c +++ b/msm/sde/sde_encoder.c @@ -3042,6 +3042,11 @@ void sde_encoder_register_vblank_callback(struct drm_encoder *drm_enc, SDE_DEBUG_ENC(sde_enc, "\n"); SDE_EVT32(DRMID(drm_enc), enable); + if (sde_encoder_in_clone_mode(drm_enc)) { + SDE_EVT32(DRMID(drm_enc), SDE_EVTLOG_ERROR); + return; + } + spin_lock_irqsave(&sde_enc->enc_spinlock, lock_flags); sde_enc->crtc_vblank_cb = vbl_cb; sde_enc->crtc_vblank_cb_data = vbl_data;