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: 125478 Delivered-To: patches@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1619846ljf; Tue, 23 Jan 2018 00:31:10 -0800 (PST) X-Received: by 10.99.123.28 with SMTP id w28mr8600331pgc.305.1516696270675; Tue, 23 Jan 2018 00:31:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516696270; cv=none; d=google.com; s=arc-20160816; b=RKIwYG8Vy+oOreJ4fq9FWR4ka7qx0wo2JTSS3fFytgf6+9y2NZGNbggCFKtQp7+A14 Wt9queJt3b7TICyWw5nKUXfDrcgfOCfg2N8OKlEhmyt/v/I0l+atQwf7CH1BUUZq88f3 Vvvq/L3DvAzcX+fYgTbhz8aE4eANUhR41Vh8nRIvZhsHni9WECR1WsiRYIy0vjKt+xIw PcaW0pEuv/R07EvAEeF8gA2Nm+tKjcHOyEC97qcSYm7K/C4HkzFEnfvMAH2T9plgCfLa nfssxoIiBPfqRDrWuDroNwyyZvzKMaxeF3/JgT7OVMNst/L4f6aOVe/d2MO3ROm+ySKe XqEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=Db+wXa7z3DxljhAeBlzIJbkrKmbGWL13r1xGQQO+Klg=; b=YtEdmakMpWP15JKPFd96xOWbG/YW+kY3f4IOUCAZ/pS/Rw20bTwXsylQhYtFi+GtLy 9F/+0dBZfkTUit5rtNbixP1TpyaQ/M4GnoLIi149nm329e9qGx4p+ji0hHZVoGZozKkD 2jJxxIknwe1nC9yTVMKbHWq/1PKV537Mz67D5pRadkPvqVWjbBDhQhyeSXxuXiOb7Yz3 XmnqcSUR3yekIuHr/uo65ItpHqY+sBOIJDqZ8ioa8b3+cAzV3PmcZKGPSoto5BjJdaz6 NDe+aVzvRaNvNPaPTucQRc8LbzvGL9ipfpL6L6iV/zL/f3rUwn4Q35ehFcOGRiMRwrOp dfbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aj9AVhoa; 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 p25sor491482pfj.117.2018.01.23.00.31.10 for (Google Transport Security); Tue, 23 Jan 2018 00:31:10 -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=aj9AVhoa; 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; 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=rbPkTsvToon6cey66Ii2sTI10zuvOlmN53Rg/AwgMDpPPl9FzNG1tOb8ST9etiYmQS h5FNxhparrP+3QS88zmqOjDOcm5MxUE4xuI7EW5MP6iBMzB3tmI4cbK8jYhiTKEgoeYJ TPlGeIVDulhRuL6UFqk8ZdVFKiQQGJ700GBWNuSKq/7o4ohiok/QadtpWpdi9g6LUMW/ 8+B80zMOF5zBjVD1O61vsSZgp89oHFRLSSYQRz2gwuzi8RJPRbcIuBkZ03wqsb3lmXe5 qf2CRFhdaF+Ko9hT+EDlrXwPFdtZGAhXRrRqHV6A5pfMDInp5bNmjHrIx+UJ0Zki9yDz DmiQ== X-Gm-Message-State: AKwxytel6Lnbr37/eIz+vAdbdATt/Xr/0jSzKm2CDo4lG6nsBcp3wW45 WPKsVhzVk/2e9JEdTnEvkxQJbANL 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) Return-Path: 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 Cc: John Stultz , Marissa Wall , Sean Paul , Dmitry Shmidt , Matt Szczesiak , Liviu Dudau , David Hanna , Rob Herring , Sumit Semwal , Robert Foss , Gustavo Padovan , Rob Clark 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 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(+) -- 2.7.4 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) {