mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	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
This commit is contained in:
		
							parent
							
								
									d26f96c74d
								
							
						
					
					
						commit
						29dc0d1de1
					
				
					 1 changed files with 19 additions and 2 deletions
				
			
		| 
						 | 
					@ -803,6 +803,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 | 
				
			||||||
	struct drm_framebuffer *fb = NULL;
 | 
						struct drm_framebuffer *fb = NULL;
 | 
				
			||||||
	struct drm_pending_vblank_event *e = NULL;
 | 
						struct drm_pending_vblank_event *e = NULL;
 | 
				
			||||||
	u32 target_vblank = page_flip->sequence;
 | 
						u32 target_vblank = page_flip->sequence;
 | 
				
			||||||
 | 
						struct drm_modeset_acquire_ctx ctx;
 | 
				
			||||||
	int ret = -EINVAL;
 | 
						int ret = -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!drm_core_check_feature(dev, DRIVER_MODESET))
 | 
						if (!drm_core_check_feature(dev, DRIVER_MODESET))
 | 
				
			||||||
| 
						 | 
					@ -866,7 +867,16 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	drm_modeset_lock_crtc(crtc, crtc->primary);
 | 
						drm_modeset_acquire_init(&ctx, 0);
 | 
				
			||||||
 | 
					retry:
 | 
				
			||||||
 | 
						ret = drm_modeset_lock(&crtc->mutex, &ctx);
 | 
				
			||||||
 | 
						if (ret)
 | 
				
			||||||
 | 
							goto out;
 | 
				
			||||||
 | 
						ret = drm_modeset_lock(&crtc->cursor->mutex, &ctx);
 | 
				
			||||||
 | 
						if (ret)
 | 
				
			||||||
 | 
							goto out;
 | 
				
			||||||
 | 
						crtc->acquire_ctx = &ctx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (crtc->primary->fb == NULL) {
 | 
						if (crtc->primary->fb == NULL) {
 | 
				
			||||||
		/* The framebuffer is currently unbound, presumably
 | 
							/* The framebuffer is currently unbound, presumably
 | 
				
			||||||
		 * due to a hotplug event, that userspace has not
 | 
							 * due to a hotplug event, that userspace has not
 | 
				
			||||||
| 
						 | 
					@ -944,7 +954,14 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 | 
				
			||||||
	if (crtc->primary->old_fb)
 | 
						if (crtc->primary->old_fb)
 | 
				
			||||||
		drm_framebuffer_put(crtc->primary->old_fb);
 | 
							drm_framebuffer_put(crtc->primary->old_fb);
 | 
				
			||||||
	crtc->primary->old_fb = NULL;
 | 
						crtc->primary->old_fb = NULL;
 | 
				
			||||||
	drm_modeset_unlock_crtc(crtc);
 | 
					
 | 
				
			||||||
 | 
						if (ret == -EDEADLK) {
 | 
				
			||||||
 | 
							drm_modeset_backoff(&ctx);
 | 
				
			||||||
 | 
							goto retry;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						drm_modeset_drop_locks(&ctx);
 | 
				
			||||||
 | 
						drm_modeset_acquire_fini(&ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue