From patchwork Wed Nov 19 19:47:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 5340741 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 19B389F1E1 for ; Wed, 19 Nov 2014 19:48:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 408D42020E for ; Wed, 19 Nov 2014 19:48:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id CDCF0201FB for ; Wed, 19 Nov 2014 19:48:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0BCDA6F168; Wed, 19 Nov 2014 11:48:31 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qg0-f43.google.com (mail-qg0-f43.google.com [209.85.192.43]) by gabe.freedesktop.org (Postfix) with ESMTP id 074B96F169; Wed, 19 Nov 2014 11:48:30 -0800 (PST) Received: by mail-qg0-f43.google.com with SMTP id q108so1009711qgd.30 for ; Wed, 19 Nov 2014 11:48:29 -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=jewCD73pbiUxTuW5P0AS6PwkjnbK12jUwuDUM6z31Q8=; b=Es9jWlYufREE76KYNOcbdTVQQ+z0zGJX5IfskoAp0MhZg2v0oc/vTJ7oD+H2kJyHSV OADPudB8HkL0O7H+VpcSYStnO5QfDk+5VVYMLQpbQjUSqWlks1tC0WyRz8O0+z/lpxHC 0KsQsz0/zRgim2EO+XcP6/tu0Fm4ksKoqWw7lgZAgo6nEeBAQIWg84ZdRASheGRCC6HK ax028Yntp0uc7gGfCM5K8WMcfy1dSSNSXRSRg5EFv5wEPEuEQaQdIZzzxArAyzydr75E zx9XGR6wgHV3ASkEROQiGZMh4AmF1q6Mho731o9NVGZSmm0lH0DXCoet6CA7eo7/phaF EaVQ== X-Received: by 10.140.37.71 with SMTP id q65mr52520619qgq.42.1416426509662; Wed, 19 Nov 2014 11:48:29 -0800 (PST) Received: from localhost.localdomain ([177.96.119.122]) by mx.google.com with ESMTPSA id b60sm168806qge.22.2014.11.19.11.48.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Nov 2014 11:48:29 -0800 (PST) From: Paulo Zanoni To: dri-devel@lists.freedesktop.org Subject: [RFC 4/7] drm: add wanted_seq to drm_vblank_wait_item Date: Wed, 19 Nov 2014 17:47:12 -0200 Message-Id: <1416426435-2237-6-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 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 From: Paulo Zanoni Store the wanted sequence in the wait_item instead of storing it in the event structure that is eventually going to be sent to user space. The plan is to make Kernel vblank wait items not have the user space event, so we need to store the wanted sequence number somewhere. It is not a problem that we're not filling e->event.sequence inside drm_queue_vblank_event: we set the value again inside send_vblank_event(). Signed-off-by: Paulo Zanoni --- drivers/gpu/drm/drm_irq.c | 8 ++++---- include/drm/drmP.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 7dcbbdb..a82e5ca 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c @@ -1173,7 +1173,7 @@ void drm_vblank_off(struct drm_device *dev, int crtc) continue; DRM_DEBUG("Sending premature vblank event on disable: \ wanted %d, current %d\n", - e->event.sequence, seq); + e->item.wanted_seq, seq); list_del(&e->base.link); drm_vblank_put(dev, e->item.pipe); drm_wait_vblank_callback(dev, e, seq, &now, true); @@ -1469,7 +1469,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe, trace_drm_vblank_event_queued(current->pid, pipe, vblwait->request.sequence); - e->event.sequence = vblwait->request.sequence; + e->item.wanted_seq = vblwait->request.sequence; if ((seq - vblwait->request.sequence) <= (1 << 23)) { drm_vblank_put(dev, pipe); drm_wait_vblank_callback(dev, e, seq, &now, false); @@ -1646,11 +1646,11 @@ static void drm_handle_vblank_events(struct drm_device *dev, int crtc) list_for_each_entry_safe(e, t, &dev->vblank_event_list, base.link) { if (e->item.pipe != crtc) continue; - if ((seq - e->event.sequence) > (1<<23)) + if ((seq - e->item.wanted_seq) > (1<<23)) continue; DRM_DEBUG("vblank event on %d, current %d\n", - e->event.sequence, seq); + e->item.wanted_seq, seq); list_del(&e->base.link); drm_vblank_put(dev, e->item.pipe); diff --git a/include/drm/drmP.h b/include/drm/drmP.h index b8bc55a..dcec05b 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -667,6 +667,7 @@ typedef void (*drm_vblank_callback_t)(struct drm_device *dev, struct drm_vblank_wait_item { int pipe; + unsigned int wanted_seq; drm_vblank_callback_t callback; bool callback_from_work;