From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E0AC5173 for ; Tue, 22 Jun 2021 15:25:12 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0C59731B; Tue, 22 Jun 2021 08:25:06 -0700 (PDT) Received: from e110455-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C1ECC3F718; Tue, 22 Jun 2021 08:25:05 -0700 (PDT) Received: by e110455-lin.cambridge.arm.com (Postfix, from userid 1000) id 7C5A86837C9; Tue, 22 Jun 2021 16:25:04 +0100 (BST) Date: Tue, 22 Jun 2021 16:25:04 +0100 From: Liviu Dudau To: Thomas Zimmermann Cc: daniel@ffwll.ch, airlied@linux.ie, alexander.deucher@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com, james.qian.wang@arm.com, mihail.atanassov@arm.com, brian.starkey@arm.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, inki.dae@samsung.com, jy0922.shim@samsung.com, sw0312.kim@samsung.com, kyungmin.park@samsung.com, krzysztof.kozlowski@canonical.com, xinliang.liu@linaro.org, tiantao6@hisilicon.com, john.stultz@linaro.org, kong.kongxinwei@hisilicon.com, puck.chen@hisilicon.com, laurentiu.palcu@oss.nxp.com, l.stach@pengutronix.de, p.zabel@pengutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, chunkuang.hu@kernel.org, matthias.bgg@gmail.com, bskeggs@redhat.com, tomba@kernel.org, hjc@rock-chips.com, heiko@sntech.de, benjamin.gaignard@linaro.org, yannick.fertre@foss.st.com, philippe.cornu@foss.st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, wens@csie.org, jernej.skrabec@gmail.com, thierry.reding@gmail.com, jonathanh@nvidia.com, jyri.sarha@iki.fi, emma@anholt.net, linux-graphics-maintainer@vmware.com, zackr@vmware.com, hyun.kwon@xilinx.com, laurent.pinchart@ideasonboard.com, michal.simek@xilinx.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, nouveau@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org Subject: Re: [PATCH v2 04/22] drm: Don't test for IRQ support in VBLANK ioctls Message-ID: <20210622152504.2sw6khajwydsoaqa@e110455-lin.cambridge.arm.com> References: <20210622141002.11590-1-tzimmermann@suse.de> <20210622141002.11590-5-tzimmermann@suse.de> X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210622141002.11590-5-tzimmermann@suse.de> Hello, On Tue, Jun 22, 2021 at 04:09:44PM +0200, Thomas Zimmermann wrote: > For KMS drivers, replace the IRQ check in VBLANK ioctls with a check for > vblank support. IRQs might be enabled wthout vblanking being supported. > > This change also removes the DRM framework's only dependency on IRQ state > for non-legacy drivers. For legacy drivers with userspace modesetting, > the original test remains in drm_wait_vblank_ioctl(). > > v2: > * keep the old test for legacy drivers in > drm_wait_vblank_ioctl() (Daniel) > > Signed-off-by: Thomas Zimmermann > --- > drivers/gpu/drm/drm_irq.c | 10 +++------- > drivers/gpu/drm/drm_vblank.c | 13 +++++++++---- > 2 files changed, 12 insertions(+), 11 deletions(-) > > diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c > index c3bd664ea733..1d7785721323 100644 > --- a/drivers/gpu/drm/drm_irq.c > +++ b/drivers/gpu/drm/drm_irq.c > @@ -74,10 +74,8 @@ > * only supports devices with a single interrupt on the main device stored in > * &drm_device.dev and set as the device paramter in drm_dev_alloc(). > * > - * These IRQ helpers are strictly optional. Drivers which roll their own only > - * need to set &drm_device.irq_enabled to signal the DRM core that vblank > - * interrupts are working. Since these helpers don't automatically clean up the > - * requested interrupt like e.g. devm_request_irq() they're not really > + * These IRQ helpers are strictly optional. Since these helpers don't automatically > + * clean up the requested interrupt like e.g. devm_request_irq() they're not really > * recommended. > */ > > @@ -91,9 +89,7 @@ > * and after the installation. > * > * This is the simplified helper interface provided for drivers with no special > - * needs. Drivers which need to install interrupt handlers for multiple > - * interrupts must instead set &drm_device.irq_enabled to signal the DRM core > - * that vblank interrupts are available. > + * needs. > * > * @irq must match the interrupt number that would be passed to request_irq(), > * if called directly instead of using this helper function. > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c > index 3417e1ac7918..a98a4aad5037 100644 > --- a/drivers/gpu/drm/drm_vblank.c > +++ b/drivers/gpu/drm/drm_vblank.c > @@ -1748,8 +1748,13 @@ int drm_wait_vblank_ioctl(struct drm_device *dev, void *data, > unsigned int pipe_index; > unsigned int flags, pipe, high_pipe; > > - if (!dev->irq_enabled) > - return -EOPNOTSUPP; > + if (drm_core_check_feature(dev, DRIVER_MODESET)) { > + if (!drm_dev_has_vblank(dev)) > + return -EOPNOTSUPP; > + } else { > + if (!dev->irq_enabled) > + return -EOPNOTSUPP; > + } For a system call that is used quite a lot by userspace we have increased the code size in a noticeable way. Can we not cache it privately? Best regards, Liviu > > if (vblwait->request.type & _DRM_VBLANK_SIGNAL) > return -EINVAL; > @@ -2023,7 +2028,7 @@ int drm_crtc_get_sequence_ioctl(struct drm_device *dev, void *data, > if (!drm_core_check_feature(dev, DRIVER_MODESET)) > return -EOPNOTSUPP; > > - if (!dev->irq_enabled) > + if (!drm_dev_has_vblank(dev)) > return -EOPNOTSUPP; > > crtc = drm_crtc_find(dev, file_priv, get_seq->crtc_id); > @@ -2082,7 +2087,7 @@ int drm_crtc_queue_sequence_ioctl(struct drm_device *dev, void *data, > if (!drm_core_check_feature(dev, DRIVER_MODESET)) > return -EOPNOTSUPP; > > - if (!dev->irq_enabled) > + if (!drm_dev_has_vblank(dev)) > return -EOPNOTSUPP; > > crtc = drm_crtc_find(dev, file_priv, queue_seq->crtc_id); > -- > 2.32.0 > -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯