From patchwork Thu Jun 4 09:02:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 6545611 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 A3D3AC0020 for ; Thu, 4 Jun 2015 11:06:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AA9D7207AE for ; Thu, 4 Jun 2015 11:06:50 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B9D502068E for ; Thu, 4 Jun 2015 11:06:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C85976EB06; Thu, 4 Jun 2015 04:06:36 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by gabe.freedesktop.org (Postfix) with ESMTP id B103C6EAD7 for ; Thu, 4 Jun 2015 02:03:45 -0700 (PDT) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id t5493f6J032005; Thu, 4 Jun 2015 04:03:42 -0500 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id t5493f1m011508; Thu, 4 Jun 2015 04:03:41 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.224.2; Thu, 4 Jun 2015 04:03:41 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id t5493Yw6014785; Thu, 4 Jun 2015 04:03:40 -0500 From: Tomi Valkeinen To: , Laurent Pinchart Subject: [PATCHv2 04/45] drm: omapdrm: Rename omap_crtc page flip-related fields Date: Thu, 4 Jun 2015 12:02:21 +0300 Message-ID: <1433408582-9828-5-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1433408582-9828-1-git-send-email-tomi.valkeinen@ti.com> References: <1433408582-9828-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 04 Jun 2015 04:06:34 -0700 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: , 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 From: Laurent Pinchart The old_fb field is only used to indicate whether a page flip is pending. Turn it into a bool named flip_pending. Rename event and page_flip_work to flip_event and flip_work for consistency. Signed-off-by: Laurent Pinchart Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_crtc.c | 47 ++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index 7ef9147bde73..85129d56cf4c 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c @@ -54,19 +54,22 @@ struct omap_crtc { /* list of framebuffers to unpin */ struct list_head pending_unpins; - /* if there is a pending flip, these will be non-null: */ - struct drm_pending_vblank_event *event; - struct drm_framebuffer *old_fb; + /* + * The flip_pending flag indicates if a page flip has been queued and + * hasn't completed yet. The flip event, if any, is stored in + * flip_event. + * + * The flip_work work queue handles page flip requests without caring + * about what context the GEM async callback is called from. Possibly we + * should just make omap_gem always call the cb from the worker so we + * don't have to care about this. + */ + bool flip_pending; + struct drm_pending_vblank_event *flip_event; + struct work_struct flip_work; struct completion completion; - /* for handling page flips without caring about what - * the callback is called from. Possibly we should just - * make omap_gem always call the cb from the worker so - * we don't have to care about this.. - */ - struct work_struct page_flip_work; - bool ignore_digit_sync_lost; }; @@ -293,11 +296,12 @@ static void omap_crtc_vblank_irq(struct omap_drm_irq *irq, uint32_t irqstatus) spin_lock_irqsave(&dev->event_lock, flags); /* wakeup userspace */ - if (omap_crtc->event) - drm_send_vblank_event(dev, omap_crtc->pipe, omap_crtc->event); + if (omap_crtc->flip_event) + drm_send_vblank_event(dev, omap_crtc->pipe, + omap_crtc->flip_event); - omap_crtc->event = NULL; - omap_crtc->old_fb = NULL; + omap_crtc->flip_event = NULL; + omap_crtc->flip_pending = false; spin_unlock_irqrestore(&dev->event_lock, flags); @@ -507,7 +511,7 @@ static int omap_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, static void page_flip_worker(struct work_struct *work) { struct omap_crtc *omap_crtc = - container_of(work, struct omap_crtc, page_flip_work); + container_of(work, struct omap_crtc, flip_work); struct drm_crtc *crtc = &omap_crtc->base; struct drm_display_mode *mode = &crtc->mode; struct drm_gem_object *bo; @@ -531,7 +535,7 @@ static void page_flip_cb(void *arg) struct omap_drm_private *priv = crtc->dev->dev_private; /* avoid assumptions about what ctxt we are called from: */ - queue_work(priv->wq, &omap_crtc->page_flip_work); + queue_work(priv->wq, &omap_crtc->flip_work); } static int omap_crtc_page_flip(struct drm_crtc *crtc, @@ -550,15 +554,16 @@ static int omap_crtc_page_flip(struct drm_crtc *crtc, spin_lock_irqsave(&dev->event_lock, flags); - if (omap_crtc->old_fb) { + if (omap_crtc->flip_pending) { spin_unlock_irqrestore(&dev->event_lock, flags); dev_err(dev->dev, "already a pending flip\n"); return -EBUSY; } - omap_crtc->event = event; - omap_crtc->old_fb = primary->fb = fb; - drm_framebuffer_reference(omap_crtc->old_fb); + omap_crtc->flip_event = event; + omap_crtc->flip_pending = true; + primary->fb = fb; + drm_framebuffer_reference(fb); spin_unlock_irqrestore(&dev->event_lock, flags); @@ -640,7 +645,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev, crtc = &omap_crtc->base; - INIT_WORK(&omap_crtc->page_flip_work, page_flip_worker); + INIT_WORK(&omap_crtc->flip_work, page_flip_worker); INIT_LIST_HEAD(&omap_crtc->pending_unpins);