From patchwork Tue Jan 23 08:30:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10179773 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 2BDAF6037F for ; Tue, 23 Jan 2018 08:31:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 155BB28674 for ; Tue, 23 Jan 2018 08:31:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0723028696; Tue, 23 Jan 2018 08:31:15 +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]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5738428674 for ; Tue, 23 Jan 2018 08:31:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A61F56E359; Tue, 23 Jan 2018 08:31:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 38BEA6E359 for ; Tue, 23 Jan 2018 08:31:11 +0000 (UTC) Received: by mail-pg0-x243.google.com with SMTP id m20so9154240pgc.11 for ; Tue, 23 Jan 2018 00:31:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=Db+wXa7z3DxljhAeBlzIJbkrKmbGWL13r1xGQQO+Klg=; b=aj9AVhoaWKtZN86P6T1+bxgO6LzdKahvCReLNKeqgEEJL3SswGUfdaZi8mxBn6SOPr 6TDX7y9DRZ4Knxoug/7qM7z0JwmuNhsUSJcbyVkvc25dXuCEoFJGdMTyQSfL31C5w4pf 489U3RPkgPIIi7Ks2q3qxjDAc/xYz1tiW/zJc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Db+wXa7z3DxljhAeBlzIJbkrKmbGWL13r1xGQQO+Klg=; b=dS8EycnpS9QttHgWgPFSQIcAjVRZpPCsv4uTJxh6TNUeK2shTb5uga96IIR7sUgjvL PWC3Z3ES5aRN+MlnLupJki6dGMaoKi2IItJDjxC2uHJHHZUHGEj2OdQbPx8m7FfvuiBg ml3EpiC+jboxGaflnZsDD7xXadgivi445jksV7zPzKR5mRLo9fIsDUnP83ev1QNx4ueL /ap0sD5xyzNu/Dk9oaL+jmirZzex1YgaUSlSGqTx5yoqiEcnAjF+JbgX9sUJqEqeFtkR KWCiPQf3PJuwhq+0W/egxe/08QGyTUtqy9XQePMyJImHob035p29Gj2JCFqjTvCTDlyG Zdhg== X-Gm-Message-State: AKwxytd6vLSC3ZAGYQOs4rEzJB8votkUvML+f/gJOHB0/8CqQJeZ8o12 tG7+Px7m5YfJOkPOBmoNXz8lP6oa56U= X-Google-Smtp-Source: AH8x2240z02oTu0a1mvDwkym+ss0f6d6QQyIRCeFCcqibOeAfS1g0s388mp7FirT+3WSdlXWEgB7YA== X-Received: by 10.98.57.27 with SMTP id g27mr9963624pfa.128.1516696270048; Tue, 23 Jan 2018 00:31:10 -0800 (PST) Received: from localhost.localdomain ([2601:1c2:600:5100:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id b9sm17724082pgq.35.2018.01.23.00.31.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Jan 2018 00:31:08 -0800 (PST) From: John Stultz To: dri-devel@lists.freedesktop.org Subject: [RFC][PATCH] HACK: drm_atomic: Don't try to set vblank if crtc isn't active Date: Tue, 23 Jan 2018 00:30:58 -0800 Message-Id: <1516696258-32183-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 Cc: Rob Herring , Matt Szczesiak , Dmitry Shmidt , Sean Paul , Robert Foss , Liviu Dudau , Gustavo Padovan , Marissa Wall , David Hanna X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP In trying to use the drm_hwcomposer on HiKey, I found things wouldn't initialize due to the following check in drm_atomic_crtc_check() failing: if (state->event && !state->active && !crtc->state->active) { DRM_DEBUG_ATOMIC("[CRTC:%d:%s] requesting event but off\n", crtc->base.id, crtc->name); return -EINVAL; } This case fails because the crtc_state hasn't been set to active yet. However, this trips on the first call to drm_atomic_commit(), where the drm_hwcomposer is trying to setup the initial mode. Digging further its seems the state->event value is set because before we get into handling the atomic mode, we call prepare_crtc_signaling(), which sees a fence ptr, and calls create_vblank_event(). So to hack around this, I've added a check in prepare_crtc_signaling() to see if the crtc_state is active and if not, skip trying to create the vblank event. I suspect this isn't correct, but I'm a bit confused on what the right solution is. I was thinking the drm_hwcomposer was missing something to enable the display before calling drmModeAtomicCommit(), but as I look at the logic it seems that should be ok. I'm starting to suspect I only see this issue because I don't have the framebuffer console enabled, so the kernel has yet to initialize the crtc, and that's probably not commonly used. Any thoughts or feedback on a better approach to solving this issue would be greatly appreciated! Cc: Marissa Wall Cc: Sean Paul Cc: Dmitry Shmidt Cc: Matt Szczesiak Cc: Liviu Dudau Cc: David Hanna Cc: Rob Herring Cc: Sumit Semwal Cc: Robert Foss Cc: Gustavo Padovan Cc: Rob Clark Cc: dri-devel@lists.freedesktop.org Signed-off-by: John Stultz --- drivers/gpu/drm/drm_atomic.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index c2da558..e6404b2 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -2072,6 +2072,9 @@ static int prepare_crtc_signaling(struct drm_device *dev, for_each_new_crtc_in_state(state, crtc, crtc_state, i) { s32 __user *fence_ptr; + if (!crtc_state->active) + continue; + fence_ptr = get_out_fence_for_crtc(crtc_state->state, crtc); if (arg->flags & DRM_MODE_PAGE_FLIP_EVENT || fence_ptr) {