From patchwork Sun May 29 18:35:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 9139901 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 1049660759 for ; Sun, 29 May 2016 18:36:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05CFB27CF9 for ; Sun, 29 May 2016 18:36:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EEC88281F9; Sun, 29 May 2016 18:36:20 +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 B982727CF9 for ; Sun, 29 May 2016 18:36:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 302376E5B5; Sun, 29 May 2016 18:35:50 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 53DAE6E5BB for ; Sun, 29 May 2016 18:35:45 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id q62so16089032wmg.3 for ; Sun, 29 May 2016 11:35:45 -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=KtW2n2Medefvuz7LcoYbzK1NHw2wxwJlCbswHXVihkA73CS7vBkCe6NDckpWjQeoRd WxMLrKyIPBrghxoFe5FtNn3gdHcgkmsBBGnFy/KscUcW4tr0EnmegiBdg1rSqKEVyIMH E7EtgABZGnl1tRCF0Qbmhdu0ui8ebnfJk39TY= 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=iDxGbD0vGNw9tjmgnmbFh7cS6dvztVVGelslG4KD6ljC5vzavWTQUE0L3sFzkkgxsp yTLuDGwVUaAs5WqN6il6rL6oo2Q9e0Unu3aDZ8E7WXfmForXlEVtic4m6SgfDBgQ/ZRd mrif+82vPRXdk0diyp2n0INtg4092og5hc2WnVeqBlYkX1nZmT06OgOR0XuK2Q5JUv2m cMDu8KMgO2H9VSc8oekzVXbrJszHHDeXDXNraTz+b06Wn/ZMe2KJx5FFsZbsIkfQOIIS kRokQIBhQKq8j5FMCwHwhvkudQnDx389gtZJ+KpP5gYkNGr4sKrEKhAlt4+o4Kat93I0 X8yg== X-Gm-Message-State: ALyK8tKU0R1FvPH5bXEpI8m54TScqb2YrZBPCH6RJQQ2gIF/GELxe5v2xElufAARZIr5rQ== X-Received: by 10.28.47.212 with SMTP id v203mr7939877wmv.5.1464546943194; Sun, 29 May 2016 11:35:43 -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.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 May 2016 11:35:42 -0700 (PDT) From: Daniel Vetter To: DRI Development Date: Sun, 29 May 2016 20:35:11 +0200 Message-Id: <1464546923-13439-15-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 , Intel Graphics Development , Alexey Brodkin , Carlos Palminha , Daniel Vetter , linux-snps-arc@lists.infradead.org Subject: [Intel-gfx] [PATCH 14/26] 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); } }