Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp2721730rwl; Fri, 6 Jan 2023 10:04:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXuGchwFouLkeeK0uu1dOp/m1Pw2ws5+uXD5H9Wrz3K856L0QLM+zUR63hBrQJRRDrsh9Nde X-Received: by 2002:a17:907:6746:b0:840:758a:9155 with SMTP id qm6-20020a170907674600b00840758a9155mr31480874ejc.12.1673028293598; Fri, 06 Jan 2023 10:04:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673028293; cv=none; d=google.com; s=arc-20160816; b=UGs8kpJSMMCGKHVLDPeWmKwV7ASp89zXdRjsvTK/G2dpMBYAGPGBCrPTBDabTskjzW F+fuyRFgbAzmphFoXHrQ6k4gtwR9EHYQXjw4qDlbqYjwhTGLjINdCvglBbmH8JdfcRuQ +5QqJRxYS28mF338+yneKUKBWUOyi8axKXZc82dpqtsQ2RGygwal1TKYAaZMQ1yazaUf UhRQEq3ztXewT4HMkNruc+AILAGPG44XoQZPPBHnI2JvPGGLCrnOQ+Gta6YZfJva0/VT DWuyNrd9kvuEOOV/9ykBUDCD8t3g4kHzL7c7Mqm9+POnB1XcC0oemDbiqo1pEl41S5KB /Ijg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=8GHbXKYEfBQ8k18yvEj5GJ6Gqi0uOqe0xAgSwSiXa+Q=; b=mA7oUfKcj2ND+St0FU1A4pVUwLsNftSHf4q0ywsHz4uDJoRfqiSBkeIfOSpBQBUXRL qlNEBDp5Q+JHobL7BVtHyAH8/bHfPo5tS1J/JmXpEJrhNKb9SwK97wH6BQ7tcHNJPVPh h1Y3INox+DNpXRIOkDYf13lIHAK6RTK2pdu+Fxx5S581SpIkI0Dz+B5mSJkQ0Y6z7hv0 HFwVOpekoHcz7uCfJ9uSlLV631yhK2mFCLlRi3BisIdasgmCUoSepHSutDZMlTmYh8YU 1A4CdGHsYm6BSkLZUu3lyj0fpr3015bBksz8crl/DOs9UEBxXJaPfd0KeTQUiJDF1Cn6 lasQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=V55nkZ92; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eg46-20020a05640228ae00b0045d27c0ba90si1969343edb.577.2023.01.06.10.04.36; Fri, 06 Jan 2023 10:04:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=V55nkZ92; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230294AbjAFRyW (ORCPT + 54 others); Fri, 6 Jan 2023 12:54:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231376AbjAFRxz (ORCPT ); Fri, 6 Jan 2023 12:53:55 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4130F108 for ; Fri, 6 Jan 2023 09:53:54 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id g10so1587385wmo.1 for ; Fri, 06 Jan 2023 09:53:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=8GHbXKYEfBQ8k18yvEj5GJ6Gqi0uOqe0xAgSwSiXa+Q=; b=V55nkZ92AGtNCvV8RPNuqTTAVXI89wklWiLVGrs7BnsXhJNUKRmB/CpzYOBOiw9Sd9 KLhU75XHjuZ7O9TFWix/cgyGxlMVd7KmsTXJAUF+bCJE5BHlsf5Mw/w1fiJ21+GGGzCg w5L86CL42Wh++y9bn1PAXUcuA5V+YXkF54Hsg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8GHbXKYEfBQ8k18yvEj5GJ6Gqi0uOqe0xAgSwSiXa+Q=; b=I2YM0VE5kkkL6yTkMTe8wUdV92GCOvpuLfbl8Xnt7o1EcZx1tZ6RQPEO7rgQCrOLmN kPt2Kq6Zxi1KkF5WDq/mjwxCkZOonVF2937rJfhflhEEJdRhDX9nPZ+7kBwHSFIVeI9g QpcMgBtarNUGrGoLK7RJijGGiH5qE0o1AG3tgu0FvGOqoANjhJh/UXP/OPJJQm8aWYpG 5zGofZVDQmQoVaoc/BCzFV7BASoUrpyKnuyV9P+WRH3oOCeIMpNF7bPpXLJt/rK0clD3 0Biy4amBSe5y37C06kHLzLHSjzIVcn5F7ndKpzGKPO6M3jfhQ5UFbVhS8aZ9/3ZAVq4+ fyLw== X-Gm-Message-State: AFqh2kp21geDzsz6iWAmgqqQXjyhiRS+m7KIlfBR8NHj55XWabee6nq8 OdWkQ53Uj2PdZbvoQBid1IGVOA== X-Received: by 2002:a05:600c:3b02:b0:3c7:18:b339 with SMTP id m2-20020a05600c3b0200b003c70018b339mr48171334wms.37.1673027632819; Fri, 06 Jan 2023 09:53:52 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id h8-20020a05600c350800b003d990372dd5sm7823216wmq.20.2023.01.06.09.53.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Jan 2023 09:53:51 -0800 (PST) Date: Fri, 6 Jan 2023 18:53:49 +0100 From: Daniel Vetter To: Brian Norris Cc: Heiko =?iso-8859-1?Q?St=FCbner?= , Sean Paul , Michel =?iso-8859-1?Q?D=E4nzer?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Sandy Huang , linux-rockchip@lists.infradead.org, stable@vger.kernel.org Subject: Re: [PATCH 1/2] drm/atomic: Allow vblank-enabled + self-refresh "disable" Message-ID: Mail-Followup-To: Brian Norris , Heiko =?iso-8859-1?Q?St=FCbner?= , Sean Paul , Michel =?iso-8859-1?Q?D=E4nzer?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Sandy Huang , linux-rockchip@lists.infradead.org, stable@vger.kernel.org References: <20230105174001.1.I3904f697863649eb1be540ecca147a66e42bfad7@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230105174001.1.I3904f697863649eb1be540ecca147a66e42bfad7@changeid> X-Operating-System: Linux phenom 5.19.0-2-amd64 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 05, 2023 at 05:40:17PM -0800, Brian Norris wrote: > The self-refresh helper framework overloads "disable" to sometimes mean > "go into self-refresh mode," and this mode activates automatically > (e.g., after some period of unchanging display output). In such cases, > the display pipe is still considered "on", and user-space is not aware > that we went into self-refresh mode. Thus, users may expect that > vblank-related features (such as DRM_IOCTL_WAIT_VBLANK) still work > properly. > > However, we trigger the WARN_ONCE() here if a CRTC driver tries to leave > vblank enabled here. > > Add a new exception, such that we allow CRTCs to be "disabled" (with > self-refresh active) with vblank interrupts still enabled. > > Cc: # dependency for subsequent patch > Signed-off-by: Brian Norris > --- > > drivers/gpu/drm/drm_atomic_helper.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c > index d579fd8f7cb8..7b5eddadebd5 100644 > --- a/drivers/gpu/drm/drm_atomic_helper.c > +++ b/drivers/gpu/drm/drm_atomic_helper.c > @@ -1207,6 +1207,12 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) > > if (!drm_dev_has_vblank(dev)) > continue; > + /* > + * Self-refresh is not a true "disable"; let vblank remain > + * enabled. > + */ > + if (new_crtc_state->self_refresh_active) > + continue; This very fishy, because we check in crtc_needs_disable whether this output should stay on due to self-refresh. Which means you should never end up in here. And yes vblank better work in self refresh :-) If it doesn't, then you need to fake it with a timer, that's at least what i915 has done for transparent self-refresh. We might need a few more helpers. Also, probably more igt, or is this something igt testing has uncovered? If so, please cite the igt testcase which hits this. -Daniel > > ret = drm_crtc_vblank_get(crtc); > WARN_ONCE(ret != -EINVAL, "driver forgot to call drm_crtc_vblank_off()\n"); > -- > 2.39.0.314.g84b9a713c41-goog > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch