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: 125603 Delivered-To: patches@linaro.org Received: by 10.46.66.141 with SMTP id h13csp50435ljf; Tue, 23 Jan 2018 15:16:49 -0800 (PST) X-Received: by 10.99.184.25 with SMTP id p25mr294081pge.96.1516749409535; Tue, 23 Jan 2018 15:16:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516749409; cv=none; d=google.com; s=arc-20160816; b=Skj7L2SQ+ltHTZiETfSPkXIsUiTKwaU2qvUeI1yKn6F92DfGGFpDS5an8PY0jvt+IE kIs0u9YwbceYp7Z3A780hTxlwBlUfC6+KLpUoNlio6vn53Eg0UZ4IsFC3PKkCP0nGF9x iqdI888+MBQGS/RKkLrcEHXBwR2hqPD+BkCOhTbRRyJMVNavKZ0FU1rWZrFAbRYP7h5l DNeuhwpIW4SxzpU8lLa301eanVhHAyMyh5JD9xwUC0DsGY33cosbybkXinp5/ehpBccT InMQkuydaB4SPUtZU4ZpLjnRgF05iE4oN77g9fPN0wMrZR6fo42DIPTjGCZ/4T7Bkfht inbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=4ErbTPYQq7WHeTHfr525uHkbAOSEuBZtru0+vBVgfLY=; b=XH+bpXY0QcoZKOdcVAxOHo5dHV/1gptOj4ojBzBWGsJxCQYZfjCfRDN3xIQn6rbBjF EkuZwFH4I02Sb7WZ/Iwm7NII6Vx9lXYRzjKYM5AIVPmO5Znm0hHR7AgmFodMvZFYOaW3 FxZN5WJX8iJlUy2iZmbIRwtm0OGsYk6ZRXOTZGd/rrL82tEqel3rGpucoXVkzLeztgyp 2rh+Yg60opJFyISK2GNenDuHCVfLbBxMgw7i8oAMYbQhqBUSIX/QT0h8pVYT223mpNQO s54YD4qn7Y4S9W2IlWuAf56Ze03D0XUOaSzSmPGm0/AeQ70u6pD7AXJGWpq8REpKDUQH glOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UCjZpP4h; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id t3-v6sor1998122ply.39.2018.01.23.15.16.49 for (Google Transport Security); Tue, 23 Jan 2018 15:16:49 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UCjZpP4h; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=fK64HDogj6LIG0WLE2Wzsta1S5MSP/h6hTQB1TniIJuhk4Yb8mPohRu9+NLD3n09Ud zfNDAxYIaEvPJSlnbzDxzE8cJgOO+CE37BH9o6dFEIbjG2gYl6sJdn5vVbNay5c6DqSF a76RZnHPiMEzM5kZMR+Dx/2EUblhGiJApPmWKf9q9bqbdpnZ14h33zzPJXk7qiftCGRz VdpA+Ue1lMSFIayqhOGMiLuM404dtOILzcaeVz7nnwb2ywD0OEs+D3EhRAMYrM4FXs8F kByGWP/QpC+YeDt9O5aJ7HZCbtp+c6FiQePSacn7wRD0pN7p98RoXG52A+o3gyOvci+A 3/kA== X-Gm-Message-State: AKwxytevH+Vc6S1FfJ3wE9ZsIFiqLIt6l5Od8KMTq9DbO06rLRCutXqu ePOdSBB1CEEitalgwuzxXeM0JGKW 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) Return-Path: 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 Cc: John Stultz , Marissa Wall , Sean Paul , Dmitry Shmidt , Robert Foss , Matt Szczesiak , Liviu Dudau , David Hanna , Rob Herring 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> 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(+) -- 2.7.4 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(),