diff options
author | Maarten Lankhorst <maarten.lankhorst@linux.intel.com> | 2017-11-01 16:04:33 +0100 |
---|---|---|
committer | Maarten Lankhorst <maarten.lankhorst@ubuntu.com> | 2017-11-08 08:49:27 +0100 |
commit | 846c7dfc1193eb2f9866fe2fa0ae7d45c72f95b9 (patch) | |
tree | 316498e60c1e6292b75b1b1dc37413ebad2e4059 /drivers/gpu/drm/drm_framebuffer.c | |
parent | 79436a1c9bccf5e38cb6ea26e4e4b9283baf2e20 (diff) | |
download | linux-846c7dfc1193eb2f9866fe2fa0ae7d45c72f95b9.tar.gz linux-846c7dfc1193eb2f9866fe2fa0ae7d45c72f95b9.tar.bz2 linux-846c7dfc1193eb2f9866fe2fa0ae7d45c72f95b9.zip |
drm/atomic: Try to preserve the crtc enabled state in drm_atomic_remove_fb, v2.
This introduces a slight behavioral change to rmfb. Instead of
disabling a crtc when the primary plane is disabled, we try to
preserve it.
Apart from old versions of the vmwgfx xorg driver, there is
nothing depending on rmfb disabling a crtc.
Vmwgfx' and simple kms helper atomic implementation rejects CRTC
enabled without plane, so we can do this safely.
If the atomic commit is rejected by the driver then we will still
fall back to the old behavior and turn off the crtc.
Changes since v1:
- Restart completely when rmfb with crtc on fails (Sean Paul).
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171101150433.10777-1-maarten.lankhorst@linux.intel.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/drm_framebuffer.c')
-rw-r--r-- | drivers/gpu/drm/drm_framebuffer.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index 40e6565105ac..2305e7800b45 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -765,14 +765,18 @@ static int atomic_remove_fb(struct drm_framebuffer *fb) struct drm_plane *plane; struct drm_connector *conn; struct drm_connector_state *conn_state; - int i, ret = 0; + int i, ret; unsigned plane_mask; + bool disable_crtcs = false; - state = drm_atomic_state_alloc(dev); - if (!state) - return -ENOMEM; - +retry_disable: drm_modeset_acquire_init(&ctx, 0); + + state = drm_atomic_state_alloc(dev); + if (!state) { + ret = -ENOMEM; + goto out; + } state->acquire_ctx = &ctx; retry: @@ -793,7 +797,7 @@ retry: goto unlock; } - if (plane_state->crtc->primary == plane) { + if (disable_crtcs && plane_state->crtc->primary == plane) { struct drm_crtc_state *crtc_state; crtc_state = drm_atomic_get_existing_crtc_state(state, plane_state->crtc); @@ -818,6 +822,7 @@ retry: plane->old_fb = plane->fb; } + /* This list is only filled when disable_crtcs is set. */ for_each_new_connector_in_state(state, conn, conn_state, i) { ret = drm_atomic_set_crtc_for_connector(conn_state, NULL); @@ -840,9 +845,15 @@ unlock: drm_atomic_state_put(state); +out: drm_modeset_drop_locks(&ctx); drm_modeset_acquire_fini(&ctx); + if (ret == -EINVAL && !disable_crtcs) { + disable_crtcs = true; + goto retry_disable; + } + return ret; } |