From patchwork Tue Sep 29 18:10:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King X-Patchwork-Id: 7289301 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 92479BEEA4 for ; Tue, 29 Sep 2015 18:17:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8DB802063F for ; Tue, 29 Sep 2015 18:17:17 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 96182206D4 for ; Tue, 29 Sep 2015 18:17:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E4DA06E1FB; Tue, 29 Sep 2015 11:17:15 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from pandora.arm.linux.org.uk (pandora.arm.linux.org.uk [78.32.30.218]) by gabe.freedesktop.org (Postfix) with ESMTPS id 40DA26E1E2 for ; Tue, 29 Sep 2015 11:17:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=pandora-2014; h=Date:Sender:Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Subject:To:From:References:In-Reply-To; bh=dzQusVFw4Cz9JXnK0zmkoqXf25nOYAqqNH47T9NdqqE=; b=FENFv5l8jtvSCfg0xV5zVsyy9jHwuTkuH2UWmPTrqQE5FJfcalW3XVZSthFi1ObJ1JIuXmK6e2P9/c5RdsXYR3kNijd8/jHz0leEPsCFLrB4o4JIFhZlCQ3/t6vZmRqdAorAudhg4URkgBhrbGrocJI3lgEsmjDF/J38h4SYbWg=; Received: from e0022681537dd.dyn.arm.linux.org.uk ([2001:4d48:ad52:3201:222:68ff:fe15:37dd]:55807 helo=rmk-PC.arm.linux.org.uk) by pandora.arm.linux.org.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1ZgzMg-0004Kx-02 for dri-devel@lists.freedesktop.org; Tue, 29 Sep 2015 19:10:58 +0100 Received: from rmk by rmk-PC.arm.linux.org.uk with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1ZgzMe-0003mA-Uy for dri-devel@lists.freedesktop.org; Tue, 29 Sep 2015 19:10:57 +0100 In-Reply-To: <20150929180843.GP21513@n2100.arm.linux.org.uk> References: <20150929180843.GP21513@n2100.arm.linux.org.uk> From: Russell King To: dri-devel@lists.freedesktop.org Subject: [PATCH 17/20] drm/armada: move frame wait into armada_frame MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 29 Sep 2015 19:10:56 +0100 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: , 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_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Both the CRTC and overlay frames have their own wait queues. It would make more sense if these were part of the plane - the primary plane for the CRTC and overlay plane for the overlay. Signed-off-by: Russell King --- drivers/gpu/drm/armada/armada_crtc.c | 22 ++++++++++++++++++---- drivers/gpu/drm/armada/armada_crtc.h | 4 +++- drivers/gpu/drm/armada/armada_overlay.c | 12 ++++++++---- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c index e3e6f81593c0..46d932bc7678 100644 --- a/drivers/gpu/drm/armada/armada_crtc.c +++ b/drivers/gpu/drm/armada/armada_crtc.c @@ -455,7 +455,7 @@ static void armada_drm_crtc_irq(struct armada_crtc *dcrtc, u32 stat) if (work) armada_drm_crtc_complete_frame_work(dcrtc, work); - wake_up(&dcrtc->frame_wait); + wake_up(&drm_to_armada_plane(dcrtc->crtc.primary)->frame_wait); } } @@ -571,7 +571,8 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc, adj->crtc_vtotal, tm, bm); /* Wait for pending flips to complete */ - wait_event(dcrtc->frame_wait, !dcrtc->frame_work); + wait_event(drm_to_armada_plane(dcrtc->crtc.primary)->frame_wait, + !dcrtc->frame_work); drm_crtc_vblank_off(crtc); @@ -688,7 +689,8 @@ static int armada_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, armada_reg_queue_end(regs, i); /* Wait for pending flips to complete */ - wait_event(dcrtc->frame_wait, !dcrtc->frame_work); + wait_event(drm_to_armada_plane(dcrtc->crtc.primary)->frame_wait, + !dcrtc->frame_work); /* Take a reference to the new fb as we're using it */ drm_framebuffer_reference(crtc->primary->fb); @@ -1096,6 +1098,13 @@ static const struct drm_plane_funcs armada_primary_plane_funcs = { .destroy = drm_primary_helper_destroy, }; +int armada_drm_plane_init(struct armada_plane *plane) +{ + init_waitqueue_head(&plane->frame_wait); + + return 0; +} + static struct drm_prop_enum_list armada_drm_csc_yuv_enum_list[] = { { CSC_AUTO, "Auto" }, { CSC_YUV_CCIR601, "CCIR601" }, @@ -1166,7 +1175,6 @@ static int armada_drm_crtc_create(struct drm_device *drm, struct device *dev, spin_lock_init(&dcrtc->irq_lock); dcrtc->irq_ena = CLEAN_SPU_IRQ_ISR; INIT_LIST_HEAD(&dcrtc->vbl_list); - init_waitqueue_head(&dcrtc->frame_wait); /* Initialize some registers which we don't otherwise set */ writel_relaxed(0x00000001, dcrtc->base + LCD_CFG_SCLK_DIV); @@ -1208,6 +1216,12 @@ static int armada_drm_crtc_create(struct drm_device *drm, struct device *dev, if (!primary) return -ENOMEM; + ret = armada_drm_plane_init(primary); + if (ret) { + kfree(primary); + return ret; + } + ret = drm_universal_plane_init(drm, &primary->base, 0, &armada_primary_plane_funcs, armada_primary_formats, diff --git a/drivers/gpu/drm/armada/armada_crtc.h b/drivers/gpu/drm/armada/armada_crtc.h index 500ce0f43f64..3ec5101e13f7 100644 --- a/drivers/gpu/drm/armada/armada_crtc.h +++ b/drivers/gpu/drm/armada/armada_crtc.h @@ -36,9 +36,12 @@ struct armada_variant; struct armada_plane { struct drm_plane base; + wait_queue_head_t frame_wait; }; #define drm_to_armada_plane(p) container_of(p, struct armada_plane, base) +int armada_drm_plane_init(struct armada_plane *plane); + struct armada_crtc { struct drm_crtc crtc; const struct armada_variant *variant; @@ -71,7 +74,6 @@ struct armada_crtc { uint32_t dumb_ctrl; uint32_t spu_iopad_ctrl; - wait_queue_head_t frame_wait; struct armada_frame_work *frame_work; spinlock_t irq_lock; diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c index 6ec42eb85981..9a5bab765085 100644 --- a/drivers/gpu/drm/armada/armada_overlay.c +++ b/drivers/gpu/drm/armada/armada_overlay.c @@ -39,7 +39,6 @@ struct armada_ovl_plane { struct { struct armada_vbl_event update; struct armada_regs regs[13]; - wait_queue_head_t wait; } vbl; struct armada_ovl_plane_properties prop; }; @@ -90,7 +89,7 @@ static void armada_ovl_plane_vbl(struct armada_crtc *dcrtc, void *data) armada_drm_crtc_update_regs(dcrtc, dplane->vbl.regs); armada_ovl_retire_fb(dplane, NULL); - wake_up(&dplane->vbl.wait); + wake_up(&dplane->base.frame_wait); } static int @@ -163,7 +162,7 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc, dcrtc->base + LCD_SPU_SRAM_PARA1); } - wait_event_timeout(dplane->vbl.wait, + wait_event_timeout(dplane->base.frame_wait, list_empty(&dplane->vbl.update.node), HZ/25); @@ -451,7 +450,12 @@ int armada_overlay_plane_create(struct drm_device *dev, unsigned long crtcs) if (!dplane) return -ENOMEM; - init_waitqueue_head(&dplane->vbl.wait); + ret = armada_drm_plane_init(&dplane->base); + if (ret) { + kfree(dplane); + return ret; + } + armada_drm_vbl_event_init(&dplane->vbl.update, armada_ovl_plane_vbl, dplane);