From patchwork Mon Oct 8 19:50:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 12051 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id D0EF823FB3 for ; Mon, 8 Oct 2012 19:51:30 +0000 (UTC) Received: from mail-pb0-f52.google.com (mail-pb0-f52.google.com [209.85.160.52]) by fiordland.canonical.com (Postfix) with ESMTP id 6AC8DA18BDA for ; Mon, 8 Oct 2012 19:51:30 +0000 (UTC) Received: by mail-pb0-f52.google.com with SMTP id rr13so4871250pbb.11 for ; Mon, 08 Oct 2012 12:51:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :dkim-signature:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=VLZ1M2mmBkOmF3kOE0AzPuIuov9gi2so+YMvzhR12Bw=; b=GqFe62yotjKTBP7j8OiKAz9FB/m/gDzlciv+hojCcxQ+4kl26Dk5sUFHSRfMfUK2lJ fCNZt9g7DQJGa3oSS3kF7reXTO9YIa8UkK4v8mP10YtAkY/Bquz+yExBOLQutvHY9wvM mkJL1rEE7q8wvwRnwfxXOnYWNtlI94JB8jjpg5kACdZzCH03p5P0XbBdXwIYFup+Tfvm gdNSq8bhBnM38wXY/r1znL1TFHKEDgrMgs+X5kPCKNd3L3twATyvkG5ZzYlHmyli9N8P ylrQr5U+h83F/HxXNZ3dLnvy3TKAThUeOERXhszGmhGxu1vOlAAiOkj2Gz5H0d4LXLLf KGbA== Received: by 10.66.77.40 with SMTP id p8mr45644713paw.78.1349725890099; Mon, 08 Oct 2012 12:51:30 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.68.34.137 with SMTP id z9csp314532pbi; Mon, 8 Oct 2012 12:51:29 -0700 (PDT) Received: by 10.60.171.114 with SMTP id at18mr13765137oec.24.1349725889136; Mon, 08 Oct 2012 12:51:29 -0700 (PDT) Received: from mail-ob0-f178.google.com (mail-ob0-f178.google.com [209.85.214.178]) by mx.google.com with ESMTPS id b5si4948733obl.208.2012.10.08.12.51.28 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 08 Oct 2012 12:51:29 -0700 (PDT) Received-SPF: pass (google.com: domain of robdclark@gmail.com designates 209.85.214.178 as permitted sender) client-ip=209.85.214.178; Authentication-Results: mx.google.com; spf=pass (google.com: domain of robdclark@gmail.com designates 209.85.214.178 as permitted sender) smtp.mail=robdclark@gmail.com; dkim=pass header.i=@gmail.com Received: by mail-ob0-f178.google.com with SMTP id tb18so4877681obb.37 for ; Mon, 08 Oct 2012 12:51:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=VLZ1M2mmBkOmF3kOE0AzPuIuov9gi2so+YMvzhR12Bw=; b=rLknqMvewJaE/Y5h+GeVGLMWGs2KnmRbSIMwzA3C2v3WgCrGqJfTKAXZCdLbURZBG0 VjAU8FrQSluOoJ8PWylHA7fKfMYwiIAS+9AjI0v33eKPk/WgwJHNheHdLTIQlvv66x4A DMzURZM8uwVfKg8sPqQNuRwgIdIuCGlmUsSHO5gfBgZiBi58RBS/qrBujzJAXHXFELel XGTafYvA3ION2JyNRnEQi2Tmw50KH41lzI66IK5VRJCMMLz4Ca+BQkW68iW2oR1DRds/ UM0XTwyPPgQcx5g0vaZnZYD1GxMEvp7cYMo5zbNY/DzxqN3G40jxRo9zkzR1YImWGt2v P9Vg== Received: by 10.182.139.2 with SMTP id qu2mr1034959obb.35.1349725888865; Mon, 08 Oct 2012 12:51:28 -0700 (PDT) Received: from localhost (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id ea6sm18002468obc.9.2012.10.08.12.51.27 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 08 Oct 2012 12:51:27 -0700 (PDT) Sender: Rob Clark From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: patches@linaro.org, airlied@linux.ie, daniel.vetter@ffwll.ch, bskeggs@redhat.com, inki.dae@samsung.com, laurent.pinchart@ideasonboard.com, s.hauer@pengutronix.de, gregkh@linuxfoundation.org, Rob Clark Subject: [PATCH 08/11] drm/imx: use drm_send_vblank_event() helper Date: Mon, 8 Oct 2012 14:50:46 -0500 Message-Id: <1349725849-22433-9-git-send-email-rob.clark@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1349725849-22433-1-git-send-email-rob.clark@linaro.org> References: <1349725849-22433-1-git-send-email-rob.clark@linaro.org> X-Gm-Message-State: ALoCoQmfzh3tCnIzMfpzCt6Xl2HuWDKgUp2TLO2Wo/PAEQ8Z8MOgMQ3HE9sU3zlvH8xzVNVv7Fd/ From: Rob Clark Also, slightly changes the behavior to always put the vblank irq, even if userspace did not request a vblank event. As far as I can tell, the previous code would leak a vblank irq refcnt if userspace requested a pageflip without event. Signed-off-by: Rob Clark --- drivers/staging/imx-drm/ipuv3-crtc.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c b/drivers/staging/imx-drm/ipuv3-crtc.c index 78d3eda..8fa0f4d 100644 --- a/drivers/staging/imx-drm/ipuv3-crtc.c +++ b/drivers/staging/imx-drm/ipuv3-crtc.c @@ -311,31 +311,14 @@ static int ipu_crtc_mode_set(struct drm_crtc *crtc, static void ipu_crtc_handle_pageflip(struct ipu_crtc *ipu_crtc) { - struct drm_pending_vblank_event *e; - struct timeval now; unsigned long flags; struct drm_device *drm = ipu_crtc->base.dev; spin_lock_irqsave(&drm->event_lock, flags); - - e = ipu_crtc->page_flip_event; - if (!e) { - spin_unlock_irqrestore(&drm->event_lock, flags); - return; - } - - do_gettimeofday(&now); - e->event.sequence = 0; - e->event.tv_sec = now.tv_sec; - e->event.tv_usec = now.tv_usec; + if (ipu_crtc->page_flip_event) + drm_send_vblank_event(drm, -1, ipu_crtc->page_flip_event); ipu_crtc->page_flip_event = NULL; - imx_drm_crtc_vblank_put(ipu_crtc->imx_crtc); - - list_add_tail(&e->base.link, &e->base.file_priv->event_list); - - wake_up_interruptible(&e->base.file_priv->event_wait); - spin_unlock_irqrestore(&drm->event_lock, flags); }