From patchwork Fri Jul 13 12:57:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajesh Yadav X-Patchwork-Id: 10523217 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 643F0602A0 for ; Fri, 13 Jul 2018 12:57:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 51177293D7 for ; Fri, 13 Jul 2018 12:57:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44E852941B; Fri, 13 Jul 2018 12:57:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C2C55293D7 for ; Fri, 13 Jul 2018 12:57:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729647AbeGMNM1 (ORCPT ); Fri, 13 Jul 2018 09:12:27 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:55614 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729617AbeGMNM0 (ORCPT ); Fri, 13 Jul 2018 09:12:26 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 4C78360B72; Fri, 13 Jul 2018 12:57:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1531486673; bh=ULIc+7C6nzMM9TmLCKaIWG9c2riW0a1SVdnVgvr9VxU=; h=From:To:Cc:Subject:Date:From; b=jhN13tqs5cFmnkkh35SNP1I6IMdkgDNfNxd4IaR51kuCqpIY+/L5ZtdKfTaUuTfBM Co+KcKOVFE6KYAt+T0iJf9UPQL6eKE6wsiful+wJ/2GQPkDY2NxsisJb4vaMcBaiO+ DZ22DlITzwscfye8x5HGV2XbnZJ/Ff22DcGkFhS0= Received: from ryadav-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: ryadav@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 3598A60555; Fri, 13 Jul 2018 12:57:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1531486672; bh=ULIc+7C6nzMM9TmLCKaIWG9c2riW0a1SVdnVgvr9VxU=; h=From:To:Cc:Subject:Date:From; b=YH8gIVpCUOZeJCAjOJ6D6PM9nT1uqJocmq3SNOXa2qJNZjM3lTnW9CFS6ON8nDUGl 4HCNFs6r9hBIURAD824OpCDulO+fKKawT6UWt7V5iMHe5FmJyC44PjkzIPKKnO+3uK 9dRG/9kAdM2zQhXMlX0umEUr3HVnKNW5QfmGJpeM= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 3598A60555 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=ryadav@codeaurora.org From: Rajesh Yadav To: dri-devel@lists.freedesktop.org, robdclark@gmail.com, seanpaul@chromium.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: Rajesh Yadav , jsanka@codeaurora.org, skolluku@codeaurora.org, abhinavk@codeaurora.org, chandanu@codeaurora.org, nganji@codeaurora.org, hoegsberg@chromium.org Subject: [PATCH] drm/msm: rework vblank event handling in dpu_crtc Date: Fri, 13 Jul 2018 18:27:23 +0530 Message-Id: <1531486643-26214-1-git-send-email-ryadav@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The vblank on/off calls were missing in dpu_crtc leading to "driver forgot to call drm_crtc_vblank_off()" warning while entering suspend state. Also handle the state update completion event for a crtc being disabled in current atomic commit. This patch depends on https://www.spinics.net/lists/dri-devel/msg182402.html Signed-off-by: Rajesh Yadav --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index d171282..24715e4 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -1617,6 +1617,7 @@ static void dpu_crtc_disable(struct drm_crtc *crtc) struct drm_encoder *encoder; struct msm_drm_private *priv; int ret; + unsigned long flags; if (!crtc || !crtc->dev || !crtc->dev->dev_private || !crtc->state) { DPU_ERROR("invalid crtc\n"); @@ -1632,6 +1633,9 @@ static void dpu_crtc_disable(struct drm_crtc *crtc) if (dpu_kms_is_suspend_state(crtc->dev)) _dpu_crtc_set_suspend(crtc, true); + /* Disable/save vblank irq handling */ + drm_crtc_vblank_off(crtc); + mutex_lock(&dpu_crtc->crtc_lock); /* wait for frame_event_done completion */ @@ -1669,7 +1673,6 @@ static void dpu_crtc_disable(struct drm_crtc *crtc) dpu_power_handle_unregister_event(dpu_crtc->phandle, dpu_crtc->power_event); - memset(dpu_crtc->mixers, 0, sizeof(dpu_crtc->mixers)); dpu_crtc->num_mixers = 0; dpu_crtc->mixers_swapped = false; @@ -1679,6 +1682,13 @@ static void dpu_crtc_disable(struct drm_crtc *crtc) cstate->bw_split_vote = false; mutex_unlock(&dpu_crtc->crtc_lock); + + if (crtc->state->event && !crtc->state->active) { + spin_lock_irqsave(&crtc->dev->event_lock, flags); + drm_crtc_send_vblank_event(crtc, crtc->state->event); + crtc->state->event = NULL; + spin_unlock_irqrestore(&crtc->dev->event_lock, flags); + } } static void dpu_crtc_enable(struct drm_crtc *crtc, @@ -1718,6 +1728,9 @@ static void dpu_crtc_enable(struct drm_crtc *crtc, mutex_unlock(&dpu_crtc->crtc_lock); + /* Enable/restore vblank irq handling */ + drm_crtc_vblank_on(crtc); + dpu_crtc->power_event = dpu_power_handle_register_event( dpu_crtc->phandle, DPU_POWER_EVENT_POST_ENABLE | DPU_POWER_EVENT_POST_DISABLE |