From patchwork Wed Nov 26 01:29:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 5383291 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CE58C9F2F5 for ; Wed, 26 Nov 2014 01:30:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DCC0420160 for ; Wed, 26 Nov 2014 01:30:04 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E8575201CD for ; Wed, 26 Nov 2014 01:30:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 569246E25C; Tue, 25 Nov 2014 17:30:02 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qa0-f46.google.com (mail-qa0-f46.google.com [209.85.216.46]) by gabe.freedesktop.org (Postfix) with ESMTP id 140506E25C for ; Tue, 25 Nov 2014 17:30:01 -0800 (PST) Received: by mail-qa0-f46.google.com with SMTP id u7so1275469qaz.19 for ; Tue, 25 Nov 2014 17:30:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9f/MS+LO3AT0+ivzP+nBboiESBs2MfWUTiBjCi/6DjY=; b=HSdiZevqftCPgQ82LwTLEtVd+03DQBgyskYZ23HUbmGSpyN+GBcMO2t0Sy0gwDLaCR UO8ZVhk6SFTEILVP3ADECTnhCXWG8FJxanwVCK37E2VU2BJL2bA0VWH0ZBl08mcN+ijK e+f0NbZ/MkgqKeqa5usxE7vf3HvePNII8FQH2PXBo3kgjrhv7WrWlORKXdFWuF/0IoVT 9Wxzw4+/tTD6kT0YufPFZdgGJPIzQlCsp7dmZqIdw2kc8Yuk3J4szjlnLEawpxZyGzll oBHFurS5nDJsYC7ldXtcRhUv3AiIqej2VNFSijpXMBjvibpuxIL2yARLx7w1RdwR3Kpw UJdA== X-Received: by 10.224.122.15 with SMTP id j15mr30714986qar.68.1416965400721; Tue, 25 Nov 2014 17:30:00 -0800 (PST) Received: from localhost ([2601:6:2c00:943:2677:3ff:fed3:ff40]) by mx.google.com with ESMTPSA id u95sm2680612qgu.47.2014.11.25.17.29.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Nov 2014 17:30:00 -0800 (PST) From: Rob Clark To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/3] drm/msm: switch to atomic-helpers iterator macros Date: Tue, 25 Nov 2014 20:29:47 -0500 Message-Id: <1416965387-7042-4-git-send-email-robdclark@gmail.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1416965387-7042-1-git-send-email-robdclark@gmail.com> References: <1416965387-7042-1-git-send-email-robdclark@gmail.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c | 6 +++--- drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c | 9 +++++---- drivers/gpu/drm/msm/msm_kms.h | 23 ----------------------- 3 files changed, 8 insertions(+), 30 deletions(-) diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c index 6781aa9..a7672e1 100644 --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c @@ -84,7 +84,7 @@ static void crtc_flush(struct drm_crtc *crtc) struct drm_plane *plane; uint32_t flush = 0; - for_each_plane_on_crtc(crtc, plane) { + drm_atomic_crtc_for_each_plane(plane, crtc) { enum mdp4_pipe pipe_id = mdp4_plane_pipe(plane); flush |= pipe2flush(pipe_id); } @@ -197,7 +197,7 @@ static void setup_mixer(struct mdp4_kms *mdp4_kms) struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc); struct drm_plane *plane; - for_each_plane_on_crtc(crtc, plane) { + drm_atomic_crtc_for_each_plane(plane, crtc) { enum mdp4_pipe pipe_id = mdp4_plane_pipe(plane); int idx = idxs[pipe_id]; mixer_cfg = mixercfg(mixer_cfg, mdp4_crtc->mixer, @@ -221,7 +221,7 @@ static void blend_setup(struct drm_crtc *crtc) mdp4_write(mdp4_kms, REG_MDP4_OVLP_TRANSP_HIGH0(ovlp), 0); mdp4_write(mdp4_kms, REG_MDP4_OVLP_TRANSP_HIGH1(ovlp), 0); - for_each_plane_on_crtc(crtc, plane) { + drm_atomic_crtc_for_each_plane(plane, crtc) { enum mdp4_pipe pipe_id = mdp4_plane_pipe(plane); int idx = idxs[pipe_id]; if (idx > 0) { diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c index 0598bde..0e9a2e3 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c @@ -91,7 +91,7 @@ static void crtc_flush_all(struct drm_crtc *crtc) if (!mdp5_crtc->ctl) return; - for_each_plane_on_crtc(crtc, plane) { + drm_atomic_crtc_for_each_plane(plane, crtc) { flush_mask |= mdp5_plane_get_flush(plane); } flush_mask |= mdp5_ctl_get_flush(mdp5_crtc->ctl); @@ -124,8 +124,9 @@ static void complete_flip(struct drm_crtc *crtc, struct drm_file *file) } spin_unlock_irqrestore(&dev->event_lock, flags); - for_each_plane_on_crtc(crtc, plane) + drm_atomic_crtc_for_each_plane(plane, crtc) { mdp5_plane_complete_flip(plane); + } } static void mdp5_crtc_destroy(struct drm_crtc *crtc) @@ -195,7 +196,7 @@ static void blend_setup(struct drm_crtc *crtc) if (!mdp5_crtc->ctl) goto out; - for_each_plane_on_crtc(crtc, plane) { + drm_atomic_crtc_for_each_plane(plane, crtc) { enum mdp_mixer_stage_id stage = to_mdp5_plane_state(plane->state)->stage; @@ -317,7 +318,7 @@ static int mdp5_crtc_atomic_check(struct drm_crtc *crtc, /* verify that there are not too many planes attached to crtc * and that we don't have conflicting mixer stages: */ - for_each_pending_plane_on_crtc(state->state, crtc, plane) { + drm_atomic_crtc_state_for_each_plane(plane, state) { struct drm_plane_state *pstate; if (cnt >= ARRAY_SIZE(pstates)) { diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h index 7fb4876..0643774 100644 --- a/drivers/gpu/drm/msm/msm_kms.h +++ b/drivers/gpu/drm/msm/msm_kms.h @@ -65,27 +65,4 @@ static inline void msm_kms_init(struct msm_kms *kms, struct msm_kms *mdp4_kms_init(struct drm_device *dev); struct msm_kms *mdp5_kms_init(struct drm_device *dev); -/* TODO move these helper iterator macro somewhere common: */ -#define for_each_plane_on_crtc(_crtc, _plane) \ - list_for_each_entry((_plane), &(_crtc)->dev->mode_config.plane_list, head) \ - if ((_plane)->state->crtc == (_crtc)) - -static inline bool -__plane_will_be_attached_to_crtc(struct drm_atomic_state *state, - struct drm_plane *plane, struct drm_crtc *crtc) -{ - int idx = drm_plane_index(plane); - - /* if plane is modified in incoming state, use the new state: */ - if (state->plane_states[idx]) - return state->plane_states[idx]->crtc == crtc; - - /* otherwise, current state: */ - return plane->state->crtc == crtc; -} - -#define for_each_pending_plane_on_crtc(_state, _crtc, _plane) \ - list_for_each_entry((_plane), &(_crtc)->dev->mode_config.plane_list, head) \ - if (__plane_will_be_attached_to_crtc((_state), (_plane), (_crtc))) - #endif /* __MSM_KMS_H__ */