diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2017-03-22 17:50:49 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2017-03-29 03:50:07 -0400 |
commit | 29dc0d1de18239cf3ef8bab578b8321ed340d81c (patch) | |
tree | b286dc188ce2b2ed10529d184641648eb72c4f02 /drivers/gpu/drm/drm_plane.c | |
parent | d26f96c74dd027caf14713ae736b4d174535412d (diff) |
drm: Roll out acquire context for the page_flip ioctl
Again just prep work.
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170322215058.8671-11-daniel.vetter@ffwll.ch
Diffstat (limited to 'drivers/gpu/drm/drm_plane.c')
-rw-r--r-- | drivers/gpu/drm/drm_plane.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 8535dc17db7e..62e833ffeffd 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c | |||
@@ -803,6 +803,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, | |||
803 | struct drm_framebuffer *fb = NULL; | 803 | struct drm_framebuffer *fb = NULL; |
804 | struct drm_pending_vblank_event *e = NULL; | 804 | struct drm_pending_vblank_event *e = NULL; |
805 | u32 target_vblank = page_flip->sequence; | 805 | u32 target_vblank = page_flip->sequence; |
806 | struct drm_modeset_acquire_ctx ctx; | ||
806 | int ret = -EINVAL; | 807 | int ret = -EINVAL; |
807 | 808 | ||
808 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 809 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
@@ -866,7 +867,16 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, | |||
866 | return -EINVAL; | 867 | return -EINVAL; |
867 | } | 868 | } |
868 | 869 | ||
869 | drm_modeset_lock_crtc(crtc, crtc->primary); | 870 | drm_modeset_acquire_init(&ctx, 0); |
871 | retry: | ||
872 | ret = drm_modeset_lock(&crtc->mutex, &ctx); | ||
873 | if (ret) | ||
874 | goto out; | ||
875 | ret = drm_modeset_lock(&crtc->cursor->mutex, &ctx); | ||
876 | if (ret) | ||
877 | goto out; | ||
878 | crtc->acquire_ctx = &ctx; | ||
879 | |||
870 | if (crtc->primary->fb == NULL) { | 880 | if (crtc->primary->fb == NULL) { |
871 | /* The framebuffer is currently unbound, presumably | 881 | /* The framebuffer is currently unbound, presumably |
872 | * due to a hotplug event, that userspace has not | 882 | * due to a hotplug event, that userspace has not |
@@ -944,7 +954,14 @@ out: | |||
944 | if (crtc->primary->old_fb) | 954 | if (crtc->primary->old_fb) |
945 | drm_framebuffer_put(crtc->primary->old_fb); | 955 | drm_framebuffer_put(crtc->primary->old_fb); |
946 | crtc->primary->old_fb = NULL; | 956 | crtc->primary->old_fb = NULL; |
947 | drm_modeset_unlock_crtc(crtc); | 957 | |
958 | if (ret == -EDEADLK) { | ||
959 | drm_modeset_backoff(&ctx); | ||
960 | goto retry; | ||
961 | } | ||
962 | |||
963 | drm_modeset_drop_locks(&ctx); | ||
964 | drm_modeset_acquire_fini(&ctx); | ||
948 | 965 | ||
949 | return ret; | 966 | return ret; |
950 | } | 967 | } |