diff mbox series

drm/atomic: Take the atomic toys away from X

Message ID 20190905181834.6234-1-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show
Series drm/atomic: Take the atomic toys away from X | expand

Commit Message

Daniel Vetter Sept. 5, 2019, 6:18 p.m. UTC
The -modesetting ddx has a totally broken idea of how atomic works:
- doesn't disable old connectors, assuming they get auto-disable like
  with the legacy setcrtc
- assumes ASYNC_FLIP is wired through for the atomic ioctl
- not a single call to TEST_ONLY

Iow the implementation is a 1:1 translation of legacy ioctls to
atomic, which is a) broken b) pointless.

We already have bugs in both i915 and amdgpu-DC where this prevents us
from enabling neat features.

If anyone ever cares about atomic in X we can easily add a new atomic
level (req->value == 2) for X to get back the shiny toys.

Since these broken versions of -modesetting have been shipping,
there's really no other way to get out of this bind.

v2:
- add an informational dmesg output (Rob, Ajax)
- reorder after the DRIVER_ATOMIC check to avoid useless noise (Ilia)
- allow req->value > 2 so that X can do another attempt at atomic in
  the future

Cc: Ilia Mirkin <imirkin@alum.mit.edu>
References: https://gitlab.freedesktop.org/xorg/xserver/issues/629
References: https://gitlab.freedesktop.org/xorg/xserver/merge_requests/180
References: abbc0697d5fb ("drm/fb: revert the i915 Actually configure untiled displays from master")
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> (v1)
Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> (v1)
Cc: Michel Dänzer <michel@daenzer.net>
Cc: Alex Deucher <alexdeucher@gmail.com>
Cc: Adam Jackson <ajax@redhat.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Cc: Sean Paul <sean@poorly.run>
Cc: David Airlie <airlied@linux.ie>
Cc: Rob Clark <robdclark@gmail.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/drm_ioctl.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Sasha Levin Sept. 5, 2019, 8:43 p.m. UTC | #1
Hi,

[This is an automated email]

This commit has been processed because it contains a -stable tag.
The stable tag indicates that it's relevant for the following trees: all

The bot has tested the following trees: v5.2.11, v4.19.69, v4.14.141, v4.9.190, v4.4.190.

v5.2.11: Build OK!
v4.19.69: Failed to apply! Possible dependencies:
    69fdf4206a8b ("drm: Differentiate the lack of an interface from invalid parameter")
    70109354fed2 ("drm: Reject unknown legacy bpp and depth for drm_mode_addfb ioctl")
    72fdb40c1a4b ("drm: extract drm_atomic_uapi.c")
    7f4de521001f ("drm/atomic: Add __drm_atomic_helper_plane_reset")
    a5ec8332d428 ("drm: Add per-plane pixel blend mode property")
    d86552efe10a ("drm/atomic: trim driver interface/docs")
    eae06120f197 ("drm: refuse ADDFB2 ioctl for broken bigendian drivers")

v4.14.141: Failed to apply! Possible dependencies:
    163bcc2c74a2 ("drm/atomic: Move drm_crtc_commit to drm_crtc_state, v4.")
    179c02fe90a4 ("drm/tve200: Add new driver for TVE200")
    21a01abbe32a ("drm/atomic: Fix freeing connector/plane state too early by tracking commits, v3.")
    24557865c8b1 ("drm: Add Content Protection property")
    2ed077e467ee ("drm: Add drm_object lease infrastructure [v5]")
    47dc413b0025 ("drm/armada: convert overlay plane to atomic state")
    65724a19438c ("drm/armada: wait and cancel any pending frame work at disable")
    66660d4cf21b ("drm: add connector info/property for non-desktop displays [v2]")
    69fdf4206a8b ("drm: Differentiate the lack of an interface from invalid parameter")
    6d544fd6f4e1 ("drm/doc: Put all driver docs into a separate chapter")
    72fdb40c1a4b ("drm: extract drm_atomic_uapi.c")
    890ca8df5a75 ("drm/armada: disable planes at next blanking period")
    8d70f395e6cb ("drm: Add support for a panel-orientation connector property, v6")
    901bb8899165 ("drm/armada: add a common frame work allocator")
    935774cd71fe ("drm: Add writeback connector type")
    c76f0f7cb546 ("drm: Begin an API for in-kernel clients")
    eaa66279c3dd ("drm/armada: move regs into armada_plane_work")
    eaab01307554 ("drm/armada: store plane in armada_plane_work")

v4.9.190: Failed to apply! Possible dependencies:
    1a02ea434ec3 ("drm: Extract drm_dumb_buffers.c")
    1ea357687479 ("drm/doc: Consistent kerneldoc include order")
    28575f165d36 ("drm: Extract drm_mode_config.[hc]")
    69fdf4206a8b ("drm: Differentiate the lack of an interface from invalid parameter")
    6c4789edc55d ("drm: Clean up kerneldoc for struct drm_driver")
    72fdb40c1a4b ("drm: extract drm_atomic_uapi.c")
    85e634bce01a ("drm: Extract drm_drv.h")
    9edbf1fa600a ("drm: Add API for capturing frame CRCs")
    d8187177b0b1 ("drm: add helper for printing to log or seq_file")

v4.4.190: Failed to apply! Possible dependencies:
    1ea357687479 ("drm/doc: Consistent kerneldoc include order")
    22cba31bae9d ("Documentation/sphinx: add basic working Sphinx configuration and build")
    27528c667a21 ("drm: Add ratelimited versions of the DRM_DEBUG* macros")
    3cbf6a5deb2f ("drm: Mark up legacy/dri1 drivers with DRM_LEGACY")
    54d2c2da0946 ("drm: Introduce drm_connector_register_all() helper")
    5fff80bbdb6b ("drm/atomic: Allow for holes in connector state, v2.")
    69fdf4206a8b ("drm: Differentiate the lack of an interface from invalid parameter")
    6bd488db80a4 ("drm: Simplify drm_printk to reduce object size quite a bit")
    6c4789edc55d ("drm: Clean up kerneldoc for struct drm_driver")
    6c87e5c3ec6d ("drm: Rename drm_connector_unplug_all() to drm_connector_unregister_all()")
    72fdb40c1a4b ("drm: extract drm_atomic_uapi.c")
    79190ea2658a ("drm: Add callbacks for late registering")
    85e634bce01a ("drm: Extract drm_drv.h")
    bee7fb158f40 ("drm: Protect drm_connector_register_all() under DRIVER_MODESET")
    c4e68a583202 ("drm: Introduce DRM_DEV_* log messages")
    ca00c2b986ea ("Documentation/gpu: split up the gpu documentation")
    cb597fcea5c2 ("Documentation/gpu: add new gpu.rst converted from DocBook gpu.tmpl")
    e28cd4d0a223 ("drm: Automatically register/unregister all connectors")
    fa3ab4c2113c ("drm: Add crtc->name and use it in debug messages")


NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

--
Thanks,
Sasha
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 2c120c58f72d..56aa8bbb3a8c 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -336,7 +336,12 @@  drm_setclientcap(struct drm_device *dev, void *data, struct drm_file *file_priv)
 	case DRM_CLIENT_CAP_ATOMIC:
 		if (!drm_core_check_feature(dev, DRIVER_ATOMIC))
 			return -EOPNOTSUPP;
-		if (req->value > 1)
+		/* The modesetting DDX has a totally broken idea of atomic. */
+		if (strstr(current->comm, "X") && req->value == 1) {
+			pr_info("broken atomic modeset userspace detected, disabling atomic\n");
+			return -EOPNOTSUPP;
+		}
+		if (req->value > 2)
 			return -EINVAL;
 		file_priv->atomic = req->value;
 		file_priv->universal_planes = req->value;