From patchwork Wed Jun 1 22:06:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 9148493 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 1F3C260467 for ; Wed, 1 Jun 2016 22:08:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12791264F4 for ; Wed, 1 Jun 2016 22:08:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0749227151; Wed, 1 Jun 2016 22:08:09 +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=unavailable 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 98CBB265F9 for ; Wed, 1 Jun 2016 22:08:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 302CA6EA9B; Wed, 1 Jun 2016 22:07:38 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id A8BAC6EA9B for ; Wed, 1 Jun 2016 22:07:29 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id a136so10667818wme.0 for ; Wed, 01 Jun 2016 15:07:29 -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=uf7iLFKSzi66WPNh+S6WXfOkkUcOL/Di/ua7JI3n+p0=; b=IA0qhb/t81QOcxllfsVfBdRiOeoZjpFNI7ncD0NiZwNm3wNN3f39oRteF7PFA/hhaF KCJXUfoDaaE2pk/kcHGDwZL32UZzGKWpFGAy1XuiD6Cw0X8AQijaBXFjY2CqnD+BfC8f O3myhC9sjyQBtdEwoPiq0NrFR5SWxAv77Se3M= 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=uf7iLFKSzi66WPNh+S6WXfOkkUcOL/Di/ua7JI3n+p0=; b=XufBnpKFMaCLNmnGayQAQu5SK7pJXFHHYKn3to2T3sLOGVtb+cL4N3vfi5L1TXwBJ3 ku+yKz28nu7TZQveFlYpIjTJuaKeSXGNAAKb4BCUnStLhK1Oq8OuQV18u21g4iQRw9s8 V8ndKq2jTOSaq+EA5dzcnub1PKRRNzSoLo3cQzOAbDcGmCTx7qiAtUt2NpcbbDk/Ie5m AqeFfHlqO9jbQ5KKVR5vXRlMg9hmuU7BVQNnunvO6ijciIF6SlqXzObTUng2O4MYlk+d arAs56dkBExDYiCjBslT1o5wSnHBqKT7WfUURfzGWpEuFlX51Wh/0hR3NaYG0ct3Yz8k Ci3Q== X-Gm-Message-State: ALyK8tKUvdRQ1OUL+sWB6XqDqflbnAf6iFB7LqlLMRUWkZY/qdrSQFcU2XuD1SlHqbgxWQ== X-Received: by 10.28.174.20 with SMTP id x20mr24356393wme.87.1464818847807; Wed, 01 Jun 2016 15:07:27 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:56b5:0:ac27:b86c:7764:9429]) by smtp.gmail.com with ESMTPSA id lf7sm1571508wjb.23.2016.06.01.15.07.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jun 2016 15:07:27 -0700 (PDT) From: Daniel Vetter To: DRI Development Date: Thu, 2 Jun 2016 00:06:38 +0200 Message-Id: <1464818821-5736-16-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1464818821-5736-1-git-send-email-daniel.vetter@ffwll.ch> References: <1464818821-5736-1-git-send-email-daniel.vetter@ffwll.ch> Cc: Daniel Vetter , Intel Graphics Development , Alexey Brodkin , Carlos Palminha , Daniel Vetter , linux-snps-arc@lists.infradead.org Subject: [Intel-gfx] [PATCH 15/38] drm/arc: Actually bother with handling atomic events. 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 The drm core has a nice ready-made helper for exactly the simple case where it should fire on the next vblank. Note that arming the vblank event in _begin is probably too early, and might easily result in the vblank firing too early, before the new set of planes are actually disabled. But that's kinda a minor issue compared to just outright hanging userspace. v2: Be more robust and either arm, when the CRTC is on, or just send the event out right away. Cc: Carlos Palminha Cc: Alexey Brodkin Cc: linux-snps-arc@lists.infradead.org Signed-off-by: Daniel Vetter --- drivers/gpu/drm/arc/arcpgu_crtc.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c b/drivers/gpu/drm/arc/arcpgu_crtc.c index d5ca0c280e68..c9f183b11df9 100644 --- a/drivers/gpu/drm/arc/arcpgu_crtc.c +++ b/drivers/gpu/drm/arc/arcpgu_crtc.c @@ -145,16 +145,17 @@ static int arc_pgu_crtc_atomic_check(struct drm_crtc *crtc, static void arc_pgu_crtc_atomic_begin(struct drm_crtc *crtc, struct drm_crtc_state *state) { - struct arcpgu_drm_private *arcpgu = crtc_to_arcpgu_priv(crtc); - unsigned long flags; - - if (crtc->state->event) { - struct drm_pending_vblank_event *event = crtc->state->event; + struct drm_pending_vblank_event *event = crtc->state->event; + if (event) { crtc->state->event = NULL; - event->pipe = drm_crtc_index(crtc); - WARN_ON(drm_crtc_vblank_get(crtc) != 0); + 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); } }