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: 628883 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rKkxr49ywz9t62 for ; Thu, 2 Jun 2016 08:08:00 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ffwll.ch header.i=@ffwll.ch header.b=IA0qhb/t; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b8EIx-0001dJ-2v; Wed, 01 Jun 2016 22:07:59 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b8EIn-0001TY-GT for linux-snps-arc@lists.infradead.org; Wed, 01 Jun 2016 22:07:50 +0000 Received: by mail-wm0-x241.google.com with SMTP id n184so10068165wmn.1 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=nDxNQRd3w6AWvs4PTZWpO8Od+iniIfPM3T5RyxolHy/zI6qYsh2biTLfeB8m8Eo8Lv GleTJR5RupDU1kecFzd6HxuYIUXVdPbYPI0ZcKKHrOytEHHIix8K8MwGp6bpjALYGfUu 8v2gCeIjskZcBL4Wgo2nqfZTCS9NKV1BrkZM0FzKLwsaNSu9S/lAR3rsPrmDzd0hdD3E 6a4HJtlDucLsgTWG/ZaO//4EIz7bFv1fASiZy9m2W1OSVpnnRIZ1fISmjJmgGcZLjBoL OetZTIbxFe7xnx7rz+0SEywdj0ItJbtcD+/0BudPisEfyYARefWOk6yz2Z2FkRIBTD9d fiMg== X-Gm-Message-State: ALyK8tJ6GXUj6RoufQ6wT+NwhWE6dUVOV+mfpLEAkl0ARhndnKDlUDEzbIApVvo8k6Ckiw== 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 Subject: [PATCH 15/38] drm/arc: Actually bother with handling atomic events. 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160601_150749_695211_3770C53D X-CRM114-Status: GOOD ( 12.24 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:241 listed in] [list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Intel Graphics Development , Alexey Brodkin , Carlos Palminha , Daniel Vetter , linux-snps-arc@lists.infradead.org MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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); } }