From patchwork Fri Oct 27 10:57:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Archit Taneja X-Patchwork-Id: 10029623 X-Patchwork-Delegate: agross@codeaurora.org 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 02945602D6 for ; Fri, 27 Oct 2017 10:58:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6BE428F4C for ; Fri, 27 Oct 2017 10:58:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DBA7628F52; Fri, 27 Oct 2017 10:58:01 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, 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 75FD828F4C for ; Fri, 27 Oct 2017 10:58:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752562AbdJ0K6A (ORCPT ); Fri, 27 Oct 2017 06:58:00 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:41080 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752547AbdJ0K6A (ORCPT ); Fri, 27 Oct 2017 06:58:00 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 9ED1E609EF; Fri, 27 Oct 2017 10:57:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1509101879; bh=OILOP0LwwwOiFKThAJo4N26HFq3rqjL0oYu7IjUnTQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=deatrqiO9sDaBZstI1QozoM3ts59B7BG7z9zMLFYw3TJO+A5DYpZ2rw7wSBeoTLru NiSmuTXlUDAPwf8v7B2SWr2V4XYZS1M/mHnSmPVDwi10iH3+GTQgZIjcle0cOgRVqq DIP7ryqOaZ0+xyZEC5ByGDU0mBwq14rC/Im8qa9U= Received: from localhost (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: architt@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 9A46660A08; Fri, 27 Oct 2017 10:57:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1509101877; bh=OILOP0LwwwOiFKThAJo4N26HFq3rqjL0oYu7IjUnTQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kXWqb35QkwEbWsX3mQBoagE2EGIrdi9wlT4DS5/01OD/qougvdz+4jdARd5HmRj+A /mVr4DmT9uqSrd5pxgLZ9x0fKcQFjydnMspS8nIS1133xBIoPVYRF02B5pM7dwdPan F7RbKjn9rK103yUJ0Dgpuj0Vr07jF5rMZodcUAws= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 9A46660A08 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=architt@codeaurora.org From: Archit Taneja To: robdclark@gmail.com Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, Archit Taneja , Gustavo Padovan Subject: [PATCH 6/6] drm/msm/mdp5: Don't use async plane update path if plane visibility changes Date: Fri, 27 Oct 2017 16:27:32 +0530 Message-Id: <20171027105732.19235-7-architt@codeaurora.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20171027105732.19235-1-architt@codeaurora.org> References: <20171027105732.19235-1-architt@codeaurora.org> 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 When a plane moves out of bounds (i.e, outside the crtc clip region), the plane state's "visible" parameter changes to false. When this happens, we (a) release the hwpipe resources away from it, and (b) unstage the corresponding hwpipe(s) from the Layer Mixers in the CRTC. (a) requires use to acquire the global atomic state and assign a new hwpipe. (b) requires us to re-configure the Layer Mixer, which is done in the CRTC. We don't want to do these things in the async plane update path, so return an error if the new state's "visible" isn't the same as the current state's "visible". Cc: Gustavo Padovan Signed-off-by: Archit Taneja Reviewed-by: Gustavo Padovan --- drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c index f1cf367e853d..be50445f9901 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c @@ -470,6 +470,9 @@ static int mdp5_plane_atomic_async_check(struct drm_plane *plane, { struct mdp5_plane_state *mdp5_state = to_mdp5_plane_state(state); struct drm_crtc_state *crtc_state; + struct drm_rect clip; + int min_scale, max_scale; + int ret; crtc_state = drm_atomic_get_existing_crtc_state(state->state, state->crtc); @@ -495,6 +498,28 @@ static int mdp5_plane_atomic_async_check(struct drm_plane *plane, plane->state->fb != state->fb) return -EINVAL; + clip.x1 = 0; + clip.y1 = 0; + clip.x2 = crtc_state->adjusted_mode.hdisplay; + clip.y2 = crtc_state->adjusted_mode.vdisplay; + min_scale = FRAC_16_16(1, 8); + max_scale = FRAC_16_16(8, 1); + + ret = drm_plane_helper_check_state(state, &clip, min_scale, + max_scale, true, true); + if (ret) + return ret; + + /* + * if the visibility of the plane changes (i.e, if the cursor is + * clipped out completely, we can't take the async path because + * we need to stage/unstage the plane from the Layer Mixer(s). We + * also assign/unassign the hwpipe(s) tied to the plane. We avoid + * taking the fast path for both these reasons. + */ + if (state->visible != plane->state->visible) + return -EINVAL; + return 0; }