From patchwork Tue Jan 23 23:16:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10181137 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 97C116037F for ; Tue, 23 Jan 2018 23:16:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 899512880B for ; Tue, 23 Jan 2018 23:16:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E25328814; Tue, 23 Jan 2018 23:16:54 +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 277442880B for ; Tue, 23 Jan 2018 23:16:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2E9706E4B5; Tue, 23 Jan 2018 23:16:53 +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 F09896E4B8 for ; Tue, 23 Jan 2018 23:16:49 +0000 (UTC) Received: by mail-pg0-x243.google.com with SMTP id u1so1361955pgr.0 for ; Tue, 23 Jan 2018 15:16:49 -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:in-reply-to:references; bh=4ErbTPYQq7WHeTHfr525uHkbAOSEuBZtru0+vBVgfLY=; b=UCjZpP4h08HclTvii5isrlGel+2jL/5COn9Vk/bm5tk+dNHbyeQN8xZzQ4oIWxf1SF Ob6oT7WyN1QsCIAMq8EHuiO7ph02WbNc3gOBPPwmk5ytJcLfqPqkcryXY+B8Sn2Wg4to Pj4jMh+yhH4TnKpq2Sv3ktxPD8YG8fCv+AZis= 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:in-reply-to :references; bh=4ErbTPYQq7WHeTHfr525uHkbAOSEuBZtru0+vBVgfLY=; b=TxB9JSKhlBiNenEOadowQlClaX/PSYbSWhdrI36hRfu4vXIrF/9p8sJ1dRIuQrSF0B 9FjRjtr3U53iz+txGYrJFJ+19mlq5VUeOp4XTTmszCJ1YDPietirwRHRx+VH6i8COaIc WCXh2x/dEjUgWGgQWPPlxM1ABqEXlrfUSxCGzPFWX+7HG92024SxMWoNgTG81x0ARKg8 GGaKsKt7B48RYHjRVs5rhdZHr+UJHzZ7uTj9Fou8BTjDJxUN6GkRJJcEzybKBRYyDHC7 zy/jeFL8QpWBE39H1vTn99RQ2sX+qrUKU/Kh2plqbnRy/f5DDHLRn2MCTnIsViRZ4hrJ UrLA== X-Gm-Message-State: AKwxytdT4iaODAsOYBi7/DCqhckq4+ofE/Tfs3sb01spQCGaagQHVoZa bZo9u47c5vGnG8f2qfjRQNG4spy17Fs= X-Google-Smtp-Source: AH8x2251wSbXMQejlxw1oX+Hc9REcH+lY43y9n4R+O65Lmv9/+bq+iZA0ztOexrtuZqO2kGnoUPYvg== X-Received: by 2002:a17:902:581a:: with SMTP id m26-v6mr6317513pli.158.1516749409050; Tue, 23 Jan 2018 15:16:49 -0800 (PST) Received: from localhost.localdomain ([2601:1c2:600:5100:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c83sm6924811pfk.8.2018.01.23.15.16.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Jan 2018 15:16:48 -0800 (PST) From: John Stultz To: dri-devel@lists.freedesktop.org Subject: [RFC][PATCH 1/4 v2] drm_hwcomposer: Make sure we set the active state when doing modesets Date: Tue, 23 Jan 2018 15:16:36 -0800 Message-Id: <1516749399-29504-2-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516749399-29504-1-git-send-email-john.stultz@linaro.org> References: <1516749399-29504-1-git-send-email-john.stultz@linaro.org> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Herring , Matt Szczesiak , Dmitry Shmidt , Sean Paul , Robert Foss , Liviu Dudau , Marissa Wall , David Hanna 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 drm_hwcomposer with HiKey/HiKey960 boards, I found that the crtc wouldn't intitalize and the atomic commit calls were failing. I initially chased this down to following check in the kernel drm_atomic_crtc_check() function 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; } Where because a fence was submitted state->event was set, but the crtc state was not active. This results in the atomic commit to fail and no mode to be set. After hacking around this in the kernel, Sean Paul helped me understand that it was the kernel complaining about the crtc state being provided in the atomic commit which did not have the active flag set. Thus, the proper fix is to make sure when we do the modesetting that we also set the crtc state active flag in property set. With this change, the kernel no longer rejects the atomic commit and the crtc initializes properly. Cc: Marissa Wall Cc: Sean Paul Cc: Dmitry Shmidt Cc: Robert Foss Cc: Matt Szczesiak Cc: Liviu Dudau Cc: David Hanna Cc: Rob Herring Signed-off-by: John Stultz --- drmdisplaycompositor.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drmdisplaycompositor.cpp b/drmdisplaycompositor.cpp index acd13b8..3a20b31 100644 --- a/drmdisplaycompositor.cpp +++ b/drmdisplaycompositor.cpp @@ -520,6 +520,13 @@ int DrmDisplayCompositor::CommitFrame(DrmDisplayComposition *display_comp, } if (mode_.needs_modeset) { + ret = drmModeAtomicAddProperty(pset, crtc->id(), crtc->active_property().id(), 1); + if (ret < 0) { + ALOGE("Failed to add crtc active to pset\n"); + drmModeAtomicFree(pset); + return ret; + } + ret = drmModeAtomicAddProperty(pset, crtc->id(), crtc->mode_property().id(), mode_.blob_id) < 0 || drmModeAtomicAddProperty(pset, connector->id(),