drm/fb-helper: Extract _legacy kms functions
The goal is to push all the kms locking down into these separate _atomic and _legacy functions, so that we can correctly pass the acquire ctx into all atomic drivers. Instead of playing games with hidden ctx in mode_config.acquire_ctx. All the fbdev state will be protected by a new fbdev private lock that Thierry is working on. This here is just prep by creating a clean split between atomic and legacy paths, which also simplifies the control flow a bit. Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20170403083304.9083-16-daniel.vetter@ffwll.ch
This commit is contained in:
parent
941b8caaa8
commit
7128645d5c
|
@ -418,17 +418,12 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper)
|
|||
goto retry;
|
||||
}
|
||||
|
||||
static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)
|
||||
static int restore_fbdev_mode_legacy(struct drm_fb_helper *fb_helper)
|
||||
{
|
||||
struct drm_device *dev = fb_helper->dev;
|
||||
struct drm_plane *plane;
|
||||
int i;
|
||||
|
||||
drm_warn_on_modeset_not_all_locked(dev);
|
||||
|
||||
if (drm_drv_uses_atomic_modeset(dev))
|
||||
return restore_fbdev_mode_atomic(fb_helper);
|
||||
|
||||
drm_for_each_plane(plane, dev) {
|
||||
if (plane->type != DRM_PLANE_TYPE_PRIMARY)
|
||||
drm_plane_force_disable(plane);
|
||||
|
@ -462,6 +457,18 @@ static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)
|
||||
{
|
||||
struct drm_device *dev = fb_helper->dev;
|
||||
|
||||
drm_warn_on_modeset_not_all_locked(dev);
|
||||
|
||||
if (drm_drv_uses_atomic_modeset(dev))
|
||||
return restore_fbdev_mode_atomic(fb_helper);
|
||||
else
|
||||
return restore_fbdev_mode_legacy(fb_helper);
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_fb_helper_restore_fbdev_mode_unlocked - restore fbdev configuration
|
||||
* @fb_helper: fbcon to restore
|
||||
|
@ -1513,34 +1520,14 @@ static int pan_display_atomic(struct fb_var_screeninfo *var,
|
|||
goto retry;
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_fb_helper_pan_display - implementation for &fb_ops.fb_pan_display
|
||||
* @var: updated screen information
|
||||
* @info: fbdev registered by the helper
|
||||
*/
|
||||
int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,
|
||||
static int pan_display_legacy(struct fb_var_screeninfo *var,
|
||||
struct fb_info *info)
|
||||
{
|
||||
struct drm_fb_helper *fb_helper = info->par;
|
||||
struct drm_device *dev = fb_helper->dev;
|
||||
struct drm_mode_set *modeset;
|
||||
int ret = 0;
|
||||
int i;
|
||||
|
||||
if (oops_in_progress)
|
||||
return -EBUSY;
|
||||
|
||||
drm_modeset_lock_all(dev);
|
||||
if (!drm_fb_helper_is_bound(fb_helper)) {
|
||||
drm_modeset_unlock_all(dev);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
if (drm_drv_uses_atomic_modeset(dev)) {
|
||||
ret = pan_display_atomic(var, info);
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
for (i = 0; i < fb_helper->crtc_count; i++) {
|
||||
modeset = &fb_helper->crtc_info[i].mode_set;
|
||||
|
||||
|
@ -1555,8 +1542,37 @@ int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,
|
|||
}
|
||||
}
|
||||
}
|
||||
unlock:
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_fb_helper_pan_display - implementation for &fb_ops.fb_pan_display
|
||||
* @var: updated screen information
|
||||
* @info: fbdev registered by the helper
|
||||
*/
|
||||
int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,
|
||||
struct fb_info *info)
|
||||
{
|
||||
struct drm_fb_helper *fb_helper = info->par;
|
||||
struct drm_device *dev = fb_helper->dev;
|
||||
int ret;
|
||||
|
||||
if (oops_in_progress)
|
||||
return -EBUSY;
|
||||
|
||||
drm_modeset_lock_all(dev);
|
||||
if (!drm_fb_helper_is_bound(fb_helper)) {
|
||||
drm_modeset_unlock_all(dev);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
if (drm_drv_uses_atomic_modeset(dev))
|
||||
ret = pan_display_atomic(var, info);
|
||||
else
|
||||
ret = pan_display_legacy(var, info);
|
||||
drm_modeset_unlock_all(dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_fb_helper_pan_display);
|
||||
|
|
Loading…
Reference in New Issue