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: 1566891 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 5B10140135 for ; Mon, 8 Oct 2012 19:58:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3C4C2A08AD for ; Mon, 8 Oct 2012 12:58:19 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ob0-f177.google.com (mail-ob0-f177.google.com [209.85.214.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 35509A0881 for ; Mon, 8 Oct 2012 12:51:28 -0700 (PDT) Received: by mail-ob0-f177.google.com with SMTP id wd20so4102825obb.36 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) From: Rob Clark To: dri-devel@lists.freedesktop.org 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> Cc: patches@linaro.org, daniel.vetter@ffwll.ch, laurent.pinchart@ideasonboard.com, gregkh@linuxfoundation.org, Rob Clark , bskeggs@redhat.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org 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); }