From patchwork Wed Nov 19 19:47:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 5340731 Return-Path: X-Original-To: patchwork-intel-gfx@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 6966E9F1E1 for ; Wed, 19 Nov 2014 19:48:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5E7072021A for ; Wed, 19 Nov 2014 19:48:31 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2EBCC201EF for ; Wed, 19 Nov 2014 19:48:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7E6D16F165; Wed, 19 Nov 2014 11:48:29 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qg0-f41.google.com (mail-qg0-f41.google.com [209.85.192.41]) by gabe.freedesktop.org (Postfix) with ESMTP id 46D1F6F15C; Wed, 19 Nov 2014 11:48:28 -0800 (PST) Received: by mail-qg0-f41.google.com with SMTP id j5so1016573qga.14 for ; Wed, 19 Nov 2014 11:48:27 -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=QCvb2zrqFedN3RDb5NcOU7aOjmU01r0q8U3iyQxluq4=; b=DbavK4mhb8adawyW6nzFKvHO5Na0wKHVd0ujyjB9s7L1Szo7g/f7gElclNgS3nwjbR vZu6zMBMjF9OcupO8s+m1xkuS/rdPC7i11HHhzj3arfq4rz14qBxHpPagFQ2HcAWo/8Y n5rCbjO0fGXBbllmp3hJ9W1BDnIe3zqyAD1UeSLgCp8+OKuPtmkK+i3Cf+pyrnQEtrbQ wU3nA/zb7o3IX+h+hMonAw2d1OsQR4FiXIA77nZCzwv4eRSDqQbP1Mv6kS+M+kcbgpB8 1VtnmJy8/eChMk05JoGew3eGnGJpfrHuVtIvJdHeAaSGoCmWaduCeSEwlZZr5fD439zj AXkQ== X-Received: by 10.224.75.73 with SMTP id x9mr40787362qaj.31.1416426507865; Wed, 19 Nov 2014 11:48:27 -0800 (PST) Received: from localhost.localdomain ([177.96.119.122]) by mx.google.com with ESMTPSA id b60sm168806qge.22.2014.11.19.11.48.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Nov 2014 11:48:27 -0800 (PST) From: Paulo Zanoni To: dri-devel@lists.freedesktop.org Date: Wed, 19 Nov 2014 17:47:11 -0200 Message-Id: <1416426435-2237-5-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1416426435-2237-1-git-send-email-przanoni@gmail.com> References: <1416426435-2237-1-git-send-email-przanoni@gmail.com> Cc: intel-gfx@lists.freedesktop.org, Paulo Zanoni Subject: [Intel-gfx] [RFC 3/7] drm: introduce struct drm_vblank_wait_item X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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 From: Paulo Zanoni It's supposed to contain all the information that is required for both kernel and user space vblank wait items, but not hold any information required by just one of them. For now, we just moved the struct members from one place to another, but the long term goal is that most of the drm.ko code will only handle "struct drm_vblank_wait_item", not knowing anything else. This will allow the callers to wrap this struct in their own private structures. This will happen in the next patches. Signed-off-by: Paulo Zanoni --- drivers/gpu/drm/drm_fops.c | 2 +- drivers/gpu/drm/drm_irq.c | 42 ++++++++++++++++++++++-------------------- include/drm/drmP.h | 10 +++++++--- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 91e1105..47c5e58 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c @@ -289,7 +289,7 @@ static void drm_events_release(struct drm_file *file_priv) list_for_each_entry_safe(v, vt, &dev->vblank_event_list, base.link) if (v->base.file_priv == file_priv) { list_del(&v->base.link); - drm_vblank_put(dev, v->pipe); + drm_vblank_put(dev, v->item.pipe); v->base.destroy(&v->base); } diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 099aef1..7dcbbdb 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c @@ -893,7 +893,7 @@ static void send_vblank_event(struct drm_device *dev, list_add_tail(&e->base.link, &e->base.file_priv->event_list); wake_up_interruptible(&e->base.file_priv->event_wait); - trace_drm_vblank_event_delivered(e->base.pid, e->pipe, + trace_drm_vblank_event_delivered(e->base.pid, e->item.pipe, e->event.sequence); } @@ -918,7 +918,7 @@ void drm_send_vblank_event(struct drm_device *dev, int crtc, now = get_drm_timestamp(); } - e->pipe = crtc; + e->item.pipe = crtc; send_vblank_event(dev, e, seq, &now, false); } EXPORT_SYMBOL(drm_send_vblank_event); @@ -1113,14 +1113,14 @@ static void drm_wait_vblank_callback(struct drm_device *dev, unsigned long seq, struct timeval *now, bool premature) { - if (e->callback_from_work) { - e->callback_args.dev = dev; - e->callback_args.seq = seq; - e->callback_args.now = now; - e->callback_args.premature = premature; - schedule_work(&e->callback_work); + if (e->item.callback_from_work) { + e->item.callback_args.dev = dev; + e->item.callback_args.seq = seq; + e->item.callback_args.now = now; + e->item.callback_args.premature = premature; + schedule_work(&e->item.callback_work); } else { - e->callback(dev, e, seq, now, premature); + e->item.callback(dev, e, seq, now, premature); } } @@ -1169,13 +1169,13 @@ void drm_vblank_off(struct drm_device *dev, int crtc) seq = drm_vblank_count_and_time(dev, crtc, &now); list_for_each_entry_safe(e, t, &dev->vblank_event_list, base.link) { - if (e->pipe != crtc) + if (e->item.pipe != crtc) continue; DRM_DEBUG("Sending premature vblank event on disable: \ wanted %d, current %d\n", e->event.sequence, seq); list_del(&e->base.link); - drm_vblank_put(dev, e->pipe); + drm_vblank_put(dev, e->item.pipe); drm_wait_vblank_callback(dev, e, seq, &now, true); } spin_unlock_irqrestore(&dev->event_lock, irqflags); @@ -1392,10 +1392,12 @@ static void drm_vblank_event_work_func(struct work_struct *work) { struct drm_pending_vblank_event *e = container_of(work, struct drm_pending_vblank_event, - callback_work); + item.callback_work); - e->callback(e->callback_args.dev, e, e->callback_args.seq, - e->callback_args.now, e->callback_args.premature); + e->item.callback(e->item.callback_args.dev, e, + e->item.callback_args.seq, + e->item.callback_args.now, + e->item.callback_args.premature); } static int drm_queue_vblank_event(struct drm_device *dev, int pipe, @@ -1417,7 +1419,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe, goto err_put; } - e->pipe = pipe; + e->item.pipe = pipe; e->base.pid = current->pid; e->event.base.type = DRM_EVENT_VBLANK; e->event.base.length = sizeof e->event; @@ -1425,10 +1427,10 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe, e->base.event = &e->event.base; e->base.file_priv = file_priv; e->base.destroy = (void (*) (struct drm_pending_event *)) kfree; - e->callback = callback; - e->callback_from_work = callback_from_work; + e->item.callback = callback; + e->item.callback_from_work = callback_from_work; if (callback_from_work) - INIT_WORK(&e->callback_work, drm_vblank_event_work_func); + INIT_WORK(&e->item.callback_work, drm_vblank_event_work_func); spin_lock_irqsave(&dev->event_lock, flags); @@ -1642,7 +1644,7 @@ static void drm_handle_vblank_events(struct drm_device *dev, int crtc) seq = drm_vblank_count_and_time(dev, crtc, &now); list_for_each_entry_safe(e, t, &dev->vblank_event_list, base.link) { - if (e->pipe != crtc) + if (e->item.pipe != crtc) continue; if ((seq - e->event.sequence) > (1<<23)) continue; @@ -1651,7 +1653,7 @@ static void drm_handle_vblank_events(struct drm_device *dev, int crtc) e->event.sequence, seq); list_del(&e->base.link); - drm_vblank_put(dev, e->pipe); + drm_vblank_put(dev, e->item.pipe); drm_wait_vblank_callback(dev, e, seq, &now, false); } diff --git a/include/drm/drmP.h b/include/drm/drmP.h index bc114f0..b8bc55a 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -665,10 +665,8 @@ typedef void (*drm_vblank_callback_t)(struct drm_device *dev, unsigned long seq, struct timeval *now, bool premature); -struct drm_pending_vblank_event { - struct drm_pending_event base; +struct drm_vblank_wait_item { int pipe; - struct drm_event_vblank event; drm_vblank_callback_t callback; bool callback_from_work; @@ -681,6 +679,12 @@ struct drm_pending_vblank_event { } callback_args; }; +struct drm_pending_vblank_event { + struct drm_pending_event base; + struct drm_event_vblank event; + struct drm_vblank_wait_item item; +}; + struct drm_vblank_crtc { struct drm_device *dev; /* pointer to the drm_device */ wait_queue_head_t queue; /**< VBLANK wait queue */