From patchwork Sun May 29 18:35:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 9139917 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B26CD60759 for ; Sun, 29 May 2016 18:36:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A825727CF9 for ; Sun, 29 May 2016 18:36:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D225281F9; Sun, 29 May 2016 18:36:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 320EE28187 for ; Sun, 29 May 2016 18:36:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1C6186E5DE; Sun, 29 May 2016 18:35:53 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3EA146E5D5 for ; Sun, 29 May 2016 18:35:50 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id a136so16123578wme.0 for ; Sun, 29 May 2016 11:35:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KhfCyDXi4P9pNgQR42fpZxWS9ew6Knu7NnxYuK+bDJk=; b=HhPrLmZHOFzxRXutbbnTTJ6Y27d5TzEfZUT7p38+z10bWn56BRw5m3YWG0CyDTLq6/ pK90zXaQWjig7HtcZMtORjsatENWNfZAmQ1hCEbvC4/qT7MP/+nP4NESdWj2HfJUrEpa evlR5mUBZ/qC4YlmTWk6thgdd332BMAikb+SQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KhfCyDXi4P9pNgQR42fpZxWS9ew6Knu7NnxYuK+bDJk=; b=O8z8Jf/4aMkth64+8aIUpxiogoQo1EkY9POBzMxWjUUAlM50YqpzJ1ImH19sJWMhsk OxuwGWZ3HaAQq4CnI0uAMAikGrDZ5Az5RoEb3d9syXbtppBKIE9kI335k0rE0yMuKJ0Z B1wQtY/W5tQO/NIL6mq/HwoSJ0wFS6a2JPl4uABezx3CtbZpn/LETdtq/iWAjk3hGlkz cgHwCOLCSIHPtFUzwinO4eFNsH64fORstSBQIzRtlYX6KoVf48PgS6CBcVm30R24PqSE InObImgSqiIhDhrvDwp/IqrUcDtQz+DtM+DiQqxKtsUaUwkyzp5G8aA1+FiLLN9CNB1P iAqQ== X-Gm-Message-State: ALyK8tJ4wwJZ7x7P4T8Ms0TVMa4vedWIZBAfHQ3Pc/i+FKz92B1aa809ItSlwLUqYFK9PQ== X-Received: by 10.28.182.8 with SMTP id g8mr7893591wmf.56.1464546948375; Sun, 29 May 2016 11:35:48 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:56b5:0:ac27:b86c:7764:9429]) by smtp.gmail.com with ESMTPSA id h2sm7761550wjv.15.2016.05.29.11.35.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 May 2016 11:35:47 -0700 (PDT) From: Daniel Vetter To: DRI Development Date: Sun, 29 May 2016 20:35:16 +0200 Message-Id: <1464546923-13439-20-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1464546923-13439-1-git-send-email-daniel.vetter@ffwll.ch> References: <1464546923-13439-1-git-send-email-daniel.vetter@ffwll.ch> Cc: Daniel Vetter , Daniel Vetter , Intel Graphics Development , Maxime Ripard , Boris Brezillon Subject: [Intel-gfx] [PATCH 19/26] drm/sun4i: Implement some semblance of vblank event handling 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-Virus-Scanned: ClamAV using ClamSMTP atomic_flush seems to be the right place, right after we commit the plane updates. Again use the fullproof version, since the pipe might be off. Cc: Boris Brezillon Cc: Maxime Ripard Signed-off-by: Daniel Vetter --- drivers/gpu/drm/sun4i/sun4i_crtc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c b/drivers/gpu/drm/sun4i/sun4i_crtc.c index 4182a21f5923..f628b6d8f23f 100644 --- a/drivers/gpu/drm/sun4i/sun4i_crtc.c +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c @@ -51,10 +51,22 @@ static void sun4i_crtc_atomic_flush(struct drm_crtc *crtc, { struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc); struct sun4i_drv *drv = scrtc->drv; + struct drm_pending_vblank_event *event = crtc->state->event; DRM_DEBUG_DRIVER("Committing plane changes\n"); sun4i_backend_commit(drv->backend); + + if (event) { + crtc->state->event = NULL; + + spin_lock_irq(&crtc->dev->event_lock); + if (drm_crtc_vblank_get(crtc) == 0) + drm_crtc_arm_vblank_event(crtc, event); + else + drm_crtc_send_vblank_event(crtc, event); + spin_unlock_irq(&crtc->dev->event_lock); + } } static void sun4i_crtc_disable(struct drm_crtc *crtc)