dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: airlied@gmail.com, daniel@ffwll.ch,
	maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	cai.huoqing@linux.dev
Cc: Thomas Zimmermann <tzimmermann@suse.de>, dri-devel@lists.freedesktop.org
Subject: [PATCH 09/14] drm: Remove the legacy DRM_IOCTL_MODESET_CTL ioctl
Date: Wed, 22 Nov 2023 13:09:38 +0100	[thread overview]
Message-ID: <20231122122449.11588-10-tzimmermann@suse.de> (raw)
In-Reply-To: <20231122122449.11588-1-tzimmermann@suse.de>

DRM drivers with user-space mode setting have been removed in Linux
v6.3. [1] Now remove the ioctl entry points for these drivers. Invoking
any of the ioctl ops will unconditionally return -EINVAL to user space.

Invoking DRM_IOCTL_MODESET_CTL is different from the other legacy
ioctl ops as it returns 0 even without CONFIG_DRM_LEGACY set. From the
original commit 29935554b384 ("drm: Disallow DRM_IOCTL_MODESET_CTL for
KMS drivers") it is not apparent how or why the operation differs from
the others. It is likely just an oversight in commit 61ae227032e7
("drm: allow removal of legacy codepaths (v4.1)"), which allowed
disabling leagacy ioctls in the first place. Still keep this removal
separate from the other ioctls to allow an easy revert, if necessary.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/series/111602/ # [1]
---
 drivers/gpu/drm/drm_internal.h |  2 -
 drivers/gpu/drm/drm_ioctl.c    |  2 -
 drivers/gpu/drm/drm_vblank.c   | 82 ----------------------------------
 3 files changed, 86 deletions(-)

diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h
index b12c463bc4605..a538a48c7d952 100644
--- a/drivers/gpu/drm/drm_internal.h
+++ b/drivers/gpu/drm/drm_internal.h
@@ -117,8 +117,6 @@ void drm_handle_vblank_works(struct drm_vblank_crtc *vblank);
 /* IOCTLS */
 int drm_wait_vblank_ioctl(struct drm_device *dev, void *data,
 			  struct drm_file *filp);
-int drm_legacy_modeset_ctl_ioctl(struct drm_device *dev, void *data,
-				 struct drm_file *file_priv);
 
 /* drm_irq.c */
 
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index e6c32f76c7452..9c6326b908e74 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -585,8 +585,6 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
 
 	DRM_IOCTL_DEF(DRM_IOCTL_WAIT_VBLANK, drm_wait_vblank_ioctl, DRM_UNLOCKED),
 
-	DRM_IOCTL_DEF(DRM_IOCTL_MODESET_CTL, drm_legacy_modeset_ctl_ioctl, 0),
-
 	DRM_IOCTL_DEF(DRM_IOCTL_UPDATE_DRAW, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
 
 	DRM_IOCTL_DEF(DRM_IOCTL_GEM_CLOSE, drm_gem_close_ioctl, DRM_RENDER_ALLOW),
diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 877e2067534fa..a11f164b2384f 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -1574,88 +1574,6 @@ void drm_crtc_vblank_restore(struct drm_crtc *crtc)
 }
 EXPORT_SYMBOL(drm_crtc_vblank_restore);
 
-static void drm_legacy_vblank_pre_modeset(struct drm_device *dev,
-					  unsigned int pipe)
-{
-	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
-
-	/* vblank is not initialized (IRQ not installed ?), or has been freed */
-	if (!drm_dev_has_vblank(dev))
-		return;
-
-	if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
-		return;
-
-	/*
-	 * To avoid all the problems that might happen if interrupts
-	 * were enabled/disabled around or between these calls, we just
-	 * have the kernel take a reference on the CRTC (just once though
-	 * to avoid corrupting the count if multiple, mismatch calls occur),
-	 * so that interrupts remain enabled in the interim.
-	 */
-	if (!vblank->inmodeset) {
-		vblank->inmodeset = 0x1;
-		if (drm_vblank_get(dev, pipe) == 0)
-			vblank->inmodeset |= 0x2;
-	}
-}
-
-static void drm_legacy_vblank_post_modeset(struct drm_device *dev,
-					   unsigned int pipe)
-{
-	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
-
-	/* vblank is not initialized (IRQ not installed ?), or has been freed */
-	if (!drm_dev_has_vblank(dev))
-		return;
-
-	if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
-		return;
-
-	if (vblank->inmodeset) {
-		spin_lock_irq(&dev->vbl_lock);
-		drm_reset_vblank_timestamp(dev, pipe);
-		spin_unlock_irq(&dev->vbl_lock);
-
-		if (vblank->inmodeset & 0x2)
-			drm_vblank_put(dev, pipe);
-
-		vblank->inmodeset = 0;
-	}
-}
-
-int drm_legacy_modeset_ctl_ioctl(struct drm_device *dev, void *data,
-				 struct drm_file *file_priv)
-{
-	struct drm_modeset_ctl *modeset = data;
-	unsigned int pipe;
-
-	/* If drm_vblank_init() hasn't been called yet, just no-op */
-	if (!drm_dev_has_vblank(dev))
-		return 0;
-
-	/* KMS drivers handle this internally */
-	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
-		return 0;
-
-	pipe = modeset->crtc;
-	if (pipe >= dev->num_crtcs)
-		return -EINVAL;
-
-	switch (modeset->cmd) {
-	case _DRM_PRE_MODESET:
-		drm_legacy_vblank_pre_modeset(dev, pipe);
-		break;
-	case _DRM_POST_MODESET:
-		drm_legacy_vblank_post_modeset(dev, pipe);
-		break;
-	default:
-		return -EINVAL;
-	}
-
-	return 0;
-}
-
 static int drm_queue_vblank_event(struct drm_device *dev, unsigned int pipe,
 				  u64 req_seq,
 				  union drm_wait_vblank *vblwait,
-- 
2.42.1


  parent reply	other threads:[~2023-11-22 12:25 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-22 12:09 [PATCH 00/14] drm: Remove infrastructure for user-space mode setting Thomas Zimmermann
2023-11-22 12:09 ` [PATCH 01/14] arch/powerpc: Remove legacy DRM drivers from default configs Thomas Zimmermann
2023-11-27 21:03   ` Alex Deucher
2023-11-28  7:19   ` Cai Huoqing
2023-11-22 12:09 ` [PATCH 02/14] drm: Fix TODO list mentioning non-KMS drivers Thomas Zimmermann
2023-11-27 21:02   ` Alex Deucher
2023-11-22 12:09 ` [PATCH 03/14] drm: Include <drm/drm_auth.h> Thomas Zimmermann
2023-11-27 21:03   ` Alex Deucher
2023-11-22 12:09 ` [PATCH 04/14] drm/i915: " Thomas Zimmermann
2023-11-22 18:14   ` Jani Nikula
2023-11-22 12:09 ` [PATCH 05/14] accel: " Thomas Zimmermann
2023-11-27 21:03   ` Alex Deucher
2023-11-22 12:09 ` [PATCH 06/14] drm: Include <drm/drm_device.h> Thomas Zimmermann
2023-11-22 12:09 ` [PATCH 07/14] drm/radeon: Do not include <drm/drm_legacy.h> Thomas Zimmermann
2023-11-27 21:00   ` Alex Deucher
2023-11-22 12:09 ` [PATCH 08/14] drm: Remove entry points for legacy ioctls Thomas Zimmermann
2023-11-27 21:04   ` Alex Deucher
2023-11-22 12:09 ` Thomas Zimmermann [this message]
2023-11-27 21:05   ` [PATCH 09/14] drm: Remove the legacy DRM_IOCTL_MODESET_CTL ioctl Alex Deucher
2023-11-22 12:09 ` [PATCH 10/14] drm: Remove support for legacy drivers Thomas Zimmermann
2023-11-27 21:05   ` Alex Deucher
2023-11-22 12:09 ` [PATCH 11/14] drm: Remove locking for legacy ioctls and DRM_UNLOCKED Thomas Zimmermann
2023-11-27 21:05   ` Alex Deucher
2023-11-22 12:09 ` [PATCH 12/14] drm: Remove source code for non-KMS drivers Thomas Zimmermann
2023-11-27 21:06   ` Alex Deucher
2023-11-22 12:09 ` [PATCH 13/14] char/agp: Remove frontend code Thomas Zimmermann
2023-11-27 21:07   ` Alex Deucher
2023-11-22 12:09 ` [PATCH 14/14] drm: Remove Kconfig option for legacy support (CONFIG_DRM_LEGACY) Thomas Zimmermann
2023-11-27 21:07   ` Alex Deucher
2023-12-01  8:39 ` [PATCH 00/14] drm: Remove infrastructure for user-space mode setting Thomas Zimmermann
2023-12-06  9:20 ` Thomas Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231122122449.11588-10-tzimmermann@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@gmail.com \
    --cc=cai.huoqing@linux.dev \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox