Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13681948ybl; Sun, 29 Dec 2019 18:02:16 -0800 (PST) X-Google-Smtp-Source: APXvYqzuoBLB4V0nEANecPIfk7PfI/Wn/tys+ziy7LzwOC3xNZ9mvnAlGRVL2ZsPNIXvJ05jmPlp X-Received: by 2002:a05:6830:1e46:: with SMTP id e6mr65204338otj.245.1577671336407; Sun, 29 Dec 2019 18:02:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577671336; cv=none; d=google.com; s=arc-20160816; b=Yn87EToNaTFFHxgNYBqLIfV2fPwXdEng8VtbDC2cZUCvM0r4jWlz9hex5xEdCePbdP 5GqaqjwHyDLuxBj+SL9LCGvdYvttrYkfFMlFrtewsLQ6xA56BUDXjeehRhMvVvIET5od o2tMGDqxvTtNaO//uTStlGCjAPyxligFCs13FrcoKxq9TrOE1zBnJTr6PskrQu0KmnZU DkdjUfCnST6FAp3pTcoNTBUVpfsznlaAWacGioEAWitC3WHgQy6i8i2JVa3wVW+iuXzs N1EWkzoAPlBjnNc7/YobOGTzHbMBGYPrg23DCt7oRdYAicfRg9m95Kvqwny2ytF88Ekx v1iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=fk5HFL6D3mmcMqyjI+5qC+B0ATQSP5EW17QFM8pmGls=; b=WTOgiHJFKnwg8pw52YlbYW3EA8erI022RIvQ4VVRq7YRVXKTYsBJg2TdHnjrcL//D3 NHHasSzamnM/jLbAJDAFRUgCNpMxchHxMOUca2NXs7xzdNm8T3nHfEXt8UlptHSQc2R3 yU55SyThfZF2yO/C4m0i1lCYoaSYZb00xZBZ+BJhk4QzEW9PHgV0tcq/CJE7mprNOC0f I1oz8F+zCbJ/GtGzEOgu/g1nzd4hM6vssmzxR8tKwQ82p0/Qozqy7mL9Zn5J+ZbBJW3S m2efI44x34fUaGj6bbRCH76ZXRpY28x+LDEGznzfMYXeFpe7YtQXD5QlBak2E9hoj8D/ 1P3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@onstation.org header.s=default header.b=hAmoq4Np; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f204si14995531oia.43.2019.12.29.18.02.05; Sun, 29 Dec 2019 18:02:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@onstation.org header.s=default header.b=hAmoq4Np; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726819AbfL3CBL (ORCPT + 99 others); Sun, 29 Dec 2019 21:01:11 -0500 Received: from onstation.org ([52.200.56.107]:37582 "EHLO onstation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726343AbfL3CBI (ORCPT ); Sun, 29 Dec 2019 21:01:08 -0500 Received: from localhost.localdomain (c-98-239-145-235.hsd1.wv.comcast.net [98.239.145.235]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: masneyb) by onstation.org (Postfix) with ESMTPSA id 80B7B3EE7A; Mon, 30 Dec 2019 02:01:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=onstation.org; s=default; t=1577671266; bh=t0PObDLzsPhcqnRoun2t4cn7CK8IaaEUsOLL32hsp+A=; h=From:To:Cc:Subject:Date:From; b=hAmoq4Npmz3/1IQcX+qOctett7tt7TPaPFnCTIYg2L4+yaM0wk7VV2rrH85EtNsy/ AlF/nGb/YkJxqKzRKxv+x14HYwOwENwdBDvGfrnT/xnO1FVuXzO3tNN8BoUvAFh83T 6pTNrklhEV5bUK409DI2L7LOlxWMvPDu18MuWTfU= From: Brian Masney To: jeffrey.l.hugo@gmail.com, robdclark@gmail.com Cc: freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, sean@poorly.run Subject: [PATCH RFC v2] drm/msm/mdp5: enable autorefresh Date: Sun, 29 Dec 2019 21:00:52 -0500 Message-Id: <20191230020053.26016-1-masneyb@onstation.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since the introduction of commit 2d99ced787e3 ("drm/msm: async commit support"), command-mode panels began throwing the following errors: msm fd900000.mdss: pp done time out, lm=0 Let's fix this by enabling the autorefresh feature that's available in the MDP starting at version 1.0. This will cause the MDP to automatically send a frame to the panel every time the panel invokes the TE signal, which will trigger the PP_DONE IRQ. This requires only sending a single START signal for command-mode panels. This gives us a counter for command-mode panels that we can use to implement async commit support for the MDP5 in a follow up patch. Signed-off-by: Brian Masney Suggested-by: Jeffrey Hugo Fixes: 2d99ced787e3 ("drm/msm: async commit support") --- Changes since v1: - Send a single start command to kick off the pipeline. The reason I marked this patch as a RFC is that the display during some small percentage of boots will stop updating after a minute or so, and the ping pong IRQs stop. Most of the time it works with no issues and I haven't been able to find a way to reproduce the issue. I tried suspending the phone by toggling /sys/power/state since I thought that the issue could potentially be related to power management. drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 17 ++++++++++++- drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c | 31 ++++++++++++++++++++--- drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.h | 3 +-- 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c index 05cc04f729d6..39dd144295b3 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c @@ -436,6 +436,8 @@ static void mdp5_crtc_atomic_disable(struct drm_crtc *crtc, spin_unlock_irqrestore(&mdp5_kms->dev->event_lock, flags); } + mdp5_ctl_disable(mdp5_cstate->ctl, &mdp5_cstate->pipeline); + mdp5_crtc->enabled = false; } @@ -456,6 +458,7 @@ static void mdp5_crtc_atomic_enable(struct drm_crtc *crtc, { struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc); struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state); + struct mdp5_pipeline *pipeline = &mdp5_cstate->pipeline; struct mdp5_kms *mdp5_kms = get_kms(crtc); struct device *dev = &mdp5_kms->pdev->dev; @@ -493,9 +496,21 @@ static void mdp5_crtc_atomic_enable(struct drm_crtc *crtc, mdp_irq_register(&mdp5_kms->base, &mdp5_crtc->err); - if (mdp5_cstate->cmd_mode) + if (mdp5_cstate->cmd_mode) { mdp_irq_register(&mdp5_kms->base, &mdp5_crtc->pp_done); + /* + * Enable autorefresh so we get regular ping/pong IRQs. + * - Bit 31 is the enable bit + * - Bits 0-15 represent the frame count, specifically how many + * TE events before the MDP sends a frame. + */ + mdp5_write(mdp5_kms, + REG_MDP5_PP_AUTOREFRESH_CONFIG(pipeline->mixer->pp), + BIT(31) | BIT(0)); + crtc_flush_all(crtc); + } + mdp5_crtc->enabled = true; } diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c index 030279d7b64b..965757d4f356 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c @@ -50,6 +50,13 @@ struct mdp5_ctl { bool flush_pending; struct mdp5_ctl *pair; /* Paired CTL to be flushed together */ + + /* + * The command mode panels are ran with autorefresh enabled. Only a + * single START command can be sent so keep track on a per ping pong + * basis. + */ + bool start_sent_by_pp[4]; }; struct mdp5_ctl_manager { @@ -191,7 +198,8 @@ static bool start_signal_needed(struct mdp5_ctl *ctl, case INTF_WB: return true; case INTF_DSI: - return intf->mode == MDP5_INTF_DSI_MODE_COMMAND; + return intf->mode == MDP5_INTF_DSI_MODE_COMMAND && + !ctl->start_sent_by_pp[pipeline->mixer->pp]; default: return false; } @@ -204,13 +212,17 @@ static bool start_signal_needed(struct mdp5_ctl *ctl, * executed in order to kick off operation and activate all layers. * e.g.: DSI command mode, Writeback */ -static void send_start_signal(struct mdp5_ctl *ctl) +static void send_start_signal(struct mdp5_ctl *ctl, + struct mdp5_pipeline *pipeline) { unsigned long flags; spin_lock_irqsave(&ctl->hw_lock, flags); ctl_write(ctl, REG_MDP5_CTL_START(ctl->id), 1); spin_unlock_irqrestore(&ctl->hw_lock, flags); + + if (pipeline->intf->mode == MDP5_INTF_DSI_MODE_COMMAND) + ctl->start_sent_by_pp[pipeline->mixer->pp] = true; } /** @@ -234,7 +246,7 @@ int mdp5_ctl_set_encoder_state(struct mdp5_ctl *ctl, DBG("intf_%d: %s", intf->num, enabled ? "on" : "off"); if (start_signal_needed(ctl, pipeline)) { - send_start_signal(ctl); + send_start_signal(ctl, pipeline); } return 0; @@ -562,7 +574,7 @@ u32 mdp5_ctl_commit(struct mdp5_ctl *ctl, } if (start_signal_needed(ctl, pipeline)) { - send_start_signal(ctl); + send_start_signal(ctl, pipeline); } return curr_ctl_flush_mask; @@ -753,3 +765,14 @@ struct mdp5_ctl_manager *mdp5_ctlm_init(struct drm_device *dev, return ERR_PTR(ret); } + +void mdp5_ctl_disable(struct mdp5_ctl *ctl, struct mdp5_pipeline *pipeline) +{ + int i; + + if (pipeline->intf->mode != MDP5_INTF_DSI_MODE_COMMAND) + return; + + for (i = 0; i < ARRAY_SIZE(ctl->start_sent_by_pp); i++) + ctl->start_sent_by_pp[i] = false; +} diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.h b/drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.h index c2af68aa77ae..f9bbf1295669 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.h +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.h @@ -72,7 +72,6 @@ u32 mdp_ctl_flush_mask_encoder(struct mdp5_interface *intf); u32 mdp5_ctl_commit(struct mdp5_ctl *ctl, struct mdp5_pipeline *pipeline, u32 flush_mask, bool start); u32 mdp5_ctl_get_commit_status(struct mdp5_ctl *ctl); - - +void mdp5_ctl_disable(struct mdp5_ctl *ctl, struct mdp5_pipeline *pipeline); #endif /* __MDP5_CTL_H__ */ -- 2.21.0