From patchwork Tue Jan 17 04:45:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Archit Taneja X-Patchwork-Id: 9519959 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 CF117601C3 for ; Tue, 17 Jan 2017 04:46:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C44132849E for ; Tue, 17 Jan 2017 04:46:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8D8A284DD; Tue, 17 Jan 2017 04:46: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=-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 4FDCB2849E for ; Tue, 17 Jan 2017 04:46:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750916AbdAQEqy (ORCPT ); Mon, 16 Jan 2017 23:46:54 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:43176 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750884AbdAQEqt (ORCPT ); Mon, 16 Jan 2017 23:46:49 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 8B81F607C8; Tue, 17 Jan 2017 04:45:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1484628354; bh=UnE6FChRIOkHdGdF6PzzsEMIrPhFEKrBXuthxti/mCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QUIRaMDRCOlKiQeAoVPqYZPfI+z8fxTEzhMc/wyRteLkb3X9hg34G9H5TNjnvf3BM KdXpxGuWbgGTj6CMAE9SqjRdxN+37hVG5sg76EdJ/+wdywDcl1GJDhT4ItL87JuINh qkrppW/3DceORnoh8VxBXkvxDFHKBRqVuSwmoQts= Received: from localhost (unknown [202.46.23.61]) (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 03F0C600B9; Tue, 17 Jan 2017 04:45:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1484628353; bh=UnE6FChRIOkHdGdF6PzzsEMIrPhFEKrBXuthxti/mCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GzG2UaJiscTT7/tNCelOhmp3yO3UZH4HFDU0bhL9b8wLzPWqdFo7R9cnubwNSJWhv F+ebKfGD1CbiawhKZ8cRBSSvs9b98Md+zfUJb0LFO7/4wqb+zdJ5LHHuaQeFcWjNw5 A1K7DhA3a2BUB+5wzgFPr4YYwvjRJb3Ecgonvm8w= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 03F0C600B9 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: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, daniel@ffwll.ch, maarten.lankhorst@linux.intel.com, Archit Taneja Subject: [PATCH v2 7/8] drm/msm/mdp5: Refactor mdp5_plane_atomic_check Date: Tue, 17 Jan 2017 10:15:11 +0530 Message-Id: <20170117044512.22934-8-architt@codeaurora.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170117044512.22934-1-architt@codeaurora.org> References: <1482149338-586-1-git-send-email-architt@codeaurora.org> <20170117044512.22934-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 In mdp5_plane_atomic_check, we get crtc_state from drm_plane_state. Later, for cursor planes, we'll populate the update_plane() func that takes a fast asynchronous path to implement cursor movements. There, we would need to call a similar atomic_check func to validate the plane state, but crtc_state would need to be derived differently. Refactor mdp5_plane_atomic_check to mdp5_plane_atomic_check_with_state such that the latter takes crtc_state as an argument. This is similar to what the intel driver has done for async cursor updates. Signed-off-by: Archit Taneja --- drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 32 +++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c index 7409e959d810..504201b710d9 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c @@ -270,17 +270,16 @@ static void mdp5_plane_cleanup_fb(struct drm_plane *plane, } #define FRAC_16_16(mult, div) (((mult) << 16) / (div)) -static int mdp5_plane_atomic_check(struct drm_plane *plane, - struct drm_plane_state *state) +static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_state, + struct drm_plane_state *state) { struct mdp5_plane_state *mdp5_state = to_mdp5_plane_state(state); + struct drm_plane *plane = state->plane; struct drm_plane_state *old_state = plane->state; struct mdp5_cfg *config = mdp5_cfg_get_config(get_kms(plane)->cfg); bool new_hwpipe = false; uint32_t max_width, max_height; uint32_t caps = 0; - struct drm_crtc *crtc; - struct drm_crtc_state *crtc_state; struct drm_rect clip; int min_scale, max_scale; int ret; @@ -288,10 +287,6 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane, DBG("%s: check (%d -> %d)", plane->name, plane_enabled(old_state), plane_enabled(state)); - crtc = state->crtc ? state->crtc : plane->state->crtc; - if (!crtc) - return 0; - max_width = config->hw->lm.max_width << 16; max_height = config->hw->lm.max_height << 16; @@ -303,10 +298,6 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane, return -ERANGE; } - crtc_state = drm_atomic_get_existing_crtc_state(state->state, crtc); - if (WARN_ON(!crtc_state)) - return -EINVAL; - clip.x1 = 0; clip.y1 = 0; clip.x2 = crtc_state->adjusted_mode.hdisplay; @@ -382,6 +373,23 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane, return 0; } +static int mdp5_plane_atomic_check(struct drm_plane *plane, + struct drm_plane_state *state) +{ + struct drm_crtc *crtc; + struct drm_crtc_state *crtc_state; + + crtc = state->crtc ? state->crtc : plane->state->crtc; + if (!crtc) + return 0; + + crtc_state = drm_atomic_get_existing_crtc_state(state->state, crtc); + if (WARN_ON(!crtc_state)) + return -EINVAL; + + return mdp5_plane_atomic_check_with_state(crtc_state, state); +} + static void mdp5_plane_atomic_update(struct drm_plane *plane, struct drm_plane_state *old_state) {