From patchwork Wed Apr 15 22:09:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 6222931 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 17B279F6E1 for ; Wed, 15 Apr 2015 22:10:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EF52020379 for ; Wed, 15 Apr 2015 22:10:23 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 17EDF20389 for ; Wed, 15 Apr 2015 22:10:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 07EBE7211E; Wed, 15 Apr 2015 15:10:21 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from galahad.ideasonboard.com (galahad.ideasonboard.com [185.26.127.97]) by gabe.freedesktop.org (Postfix) with ESMTP id 268BC6E925 for ; Wed, 15 Apr 2015 15:10:02 -0700 (PDT) Received: from avalon.ideasonboard.com (dsl-hkibrasgw3-50ddcc-40.dhcp.inet.fi [80.221.204.40]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id 79B85207F9; Thu, 16 Apr 2015 00:08:02 +0200 (CEST) From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Subject: [PATCH 23/31] drm: omapdrm: Drop manual framebuffer pin handling Date: Thu, 16 Apr 2015 01:09:40 +0300 Message-Id: <1429135788-31979-24-git-send-email-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.0.5 In-Reply-To: <1429135788-31979-1-git-send-email-laurent.pinchart@ideasonboard.com> References: <1429135788-31979-1-git-send-email-laurent.pinchart@ideasonboard.com> Cc: Tomi Valkeinen 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.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 Since the removal of omap_plane_mode_set(), framebuffers are now pinned exclusively through the plane .prepare_fb() and .cleanup_fb() operations as the remaining callers of omap_plane_setup() don't modify the framebuffer. Remove the manual pin/unpin infrastructure. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/omapdrm/omap_crtc.c | 35 ------------------------------ drivers/gpu/drm/omapdrm/omap_drv.h | 1 - drivers/gpu/drm/omapdrm/omap_plane.c | 41 ------------------------------------ 3 files changed, 77 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index d82b8ea..516da56 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c @@ -53,9 +53,6 @@ struct omap_crtc { struct omap_drm_irq vblank_irq; struct omap_drm_irq error_irq; - /* list of framebuffers to unpin */ - struct list_head pending_unpins; - /* pending event */ struct drm_pending_vblank_event *event; wait_queue_head_t flip_wait; @@ -65,11 +62,6 @@ struct omap_crtc { bool ignore_digit_sync_lost; }; -struct omap_framebuffer_unpin { - struct list_head list; - struct drm_framebuffer *fb; -}; - /* ----------------------------------------------------------------------------- * Helper Functions */ @@ -366,7 +358,6 @@ static void omap_crtc_vblank_irq(struct omap_drm_irq *irq, uint32_t irqstatus) int omap_crtc_flush(struct drm_crtc *crtc) { struct omap_crtc *omap_crtc = to_omap_crtc(crtc); - struct omap_framebuffer_unpin *fb, *next; DBG("%s: GO", omap_crtc->name); @@ -386,29 +377,6 @@ int omap_crtc_flush(struct drm_crtc *crtc) dispc_runtime_put(); - /* Unpin and unreference pending framebuffers. */ - list_for_each_entry_safe(fb, next, &omap_crtc->pending_unpins, list) { - omap_framebuffer_unpin(fb->fb); - drm_framebuffer_unreference(fb->fb); - list_del(&fb->list); - kfree(fb); - } - - return 0; -} - -int omap_crtc_queue_unpin(struct drm_crtc *crtc, struct drm_framebuffer *fb) -{ - struct omap_crtc *omap_crtc = to_omap_crtc(crtc); - struct omap_framebuffer_unpin *unpin; - - unpin = kzalloc(sizeof(*unpin), GFP_KERNEL); - if (!unpin) - return -ENOMEM; - - unpin->fb = fb; - list_add_tail(&unpin->list, &omap_crtc->pending_unpins); - return 0; } @@ -644,9 +612,6 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev, crtc = &omap_crtc->base; init_waitqueue_head(&omap_crtc->flip_wait); - - INIT_LIST_HEAD(&omap_crtc->pending_unpins); - init_completion(&omap_crtc->completion); omap_crtc->channel = channel; diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h index 54aff0b..db973b0 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.h +++ b/drivers/gpu/drm/omapdrm/omap_drv.h @@ -142,7 +142,6 @@ void omap_fbdev_free(struct drm_device *dev); const struct omap_video_timings *omap_crtc_timings(struct drm_crtc *crtc); enum omap_channel omap_crtc_channel(struct drm_crtc *crtc); int omap_crtc_flush(struct drm_crtc *crtc); -int omap_crtc_queue_unpin(struct drm_crtc *crtc, struct drm_framebuffer *fb); void omap_crtc_cancel_page_flip(struct drm_crtc *crtc, struct drm_file *file); void omap_crtc_pre_init(void); void omap_crtc_pre_uninit(void); diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c index 117fa37..7813e48 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c @@ -45,49 +45,12 @@ struct omap_plane { struct omap_drm_window win; bool enabled; - /* last fb that we pinned: */ - struct drm_framebuffer *pinned_fb; - uint32_t nformats; uint32_t formats[32]; struct omap_drm_irq error_irq; }; -/* update which fb (if any) is pinned for scanout */ -static int omap_plane_update_pin(struct drm_plane *plane) -{ - struct omap_plane *omap_plane = to_omap_plane(plane); - struct drm_framebuffer *pinned_fb = omap_plane->pinned_fb; - struct drm_framebuffer *fb = omap_plane->enabled ? plane->fb : NULL; - int ret = 0; - - if (pinned_fb == fb) - return 0; - - DBG("%p -> %p", pinned_fb, fb); - - if (fb) { - drm_framebuffer_reference(fb); - ret = omap_framebuffer_pin(fb); - } - - if (pinned_fb) - omap_crtc_queue_unpin(plane->crtc, pinned_fb); - - if (ret) { - dev_err(plane->dev->dev, "could not swap %p -> %p\n", - omap_plane->pinned_fb, fb); - drm_framebuffer_unreference(fb); - omap_plane->pinned_fb = NULL; - return ret; - } - - omap_plane->pinned_fb = fb; - - return 0; -} - static int __omap_plane_setup(struct omap_plane *omap_plane, struct drm_crtc *crtc, struct drm_framebuffer *fb) @@ -133,10 +96,6 @@ static int omap_plane_setup(struct omap_plane *omap_plane) struct drm_plane *plane = &omap_plane->base; int ret; - ret = omap_plane_update_pin(plane); - if (ret < 0) - return ret; - dispc_runtime_get(); ret = __omap_plane_setup(omap_plane, plane->crtc, plane->fb); dispc_runtime_put();