drm/sti: use atomic_helper for commit
Since nonblocking atomic commits are now supported, the driver can now use drm_atomic_helper_commit(). Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com> Acked-by: Vincent Abriou <vincent.abriou@st.com>
This commit is contained in:
Родитель
13f62f54d1
Коммит
5e60f595d6
|
@ -115,50 +115,13 @@ err:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sti_atomic_schedule(struct sti_private *private,
|
static void sti_drm_dbg_cleanup(struct drm_minor *minor)
|
||||||
struct drm_atomic_state *state)
|
|
||||||
{
|
{
|
||||||
private->commit.state = state;
|
drm_debugfs_remove_files(sti_drm_dbg_list,
|
||||||
schedule_work(&private->commit.work);
|
ARRAY_SIZE(sti_drm_dbg_list), minor);
|
||||||
}
|
|
||||||
|
|
||||||
static void sti_atomic_complete(struct sti_private *private,
|
drm_debugfs_remove_files((struct drm_info_list *)&sti_drm_fps_fops,
|
||||||
struct drm_atomic_state *state)
|
1, minor);
|
||||||
{
|
|
||||||
struct drm_device *drm = private->drm_dev;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Everything below can be run asynchronously without the need to grab
|
|
||||||
* any modeset locks at all under one condition: It must be guaranteed
|
|
||||||
* that the asynchronous work has either been cancelled (if the driver
|
|
||||||
* supports it, which at least requires that the framebuffers get
|
|
||||||
* cleaned up with drm_atomic_helper_cleanup_planes()) or completed
|
|
||||||
* before the new state gets committed on the software side with
|
|
||||||
* drm_atomic_helper_swap_state().
|
|
||||||
*
|
|
||||||
* This scheme allows new atomic state updates to be prepared and
|
|
||||||
* checked in parallel to the asynchronous completion of the previous
|
|
||||||
* update. Which is important since compositors need to figure out the
|
|
||||||
* composition of the next frame right after having submitted the
|
|
||||||
* current layout.
|
|
||||||
*/
|
|
||||||
|
|
||||||
drm_atomic_helper_commit_modeset_disables(drm, state);
|
|
||||||
drm_atomic_helper_commit_planes(drm, state, 0);
|
|
||||||
drm_atomic_helper_commit_modeset_enables(drm, state);
|
|
||||||
|
|
||||||
drm_atomic_helper_wait_for_vblanks(drm, state);
|
|
||||||
|
|
||||||
drm_atomic_helper_cleanup_planes(drm, state);
|
|
||||||
drm_atomic_state_put(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void sti_atomic_work(struct work_struct *work)
|
|
||||||
{
|
|
||||||
struct sti_private *private = container_of(work,
|
|
||||||
struct sti_private, commit.work);
|
|
||||||
|
|
||||||
sti_atomic_complete(private, private->commit.state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sti_atomic_check(struct drm_device *dev,
|
static int sti_atomic_check(struct drm_device *dev,
|
||||||
|
@ -181,38 +144,6 @@ static int sti_atomic_check(struct drm_device *dev,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sti_atomic_commit(struct drm_device *drm,
|
|
||||||
struct drm_atomic_state *state, bool nonblock)
|
|
||||||
{
|
|
||||||
struct sti_private *private = drm->dev_private;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
err = drm_atomic_helper_prepare_planes(drm, state);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
|
|
||||||
/* serialize outstanding nonblocking commits */
|
|
||||||
mutex_lock(&private->commit.lock);
|
|
||||||
flush_work(&private->commit.work);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This is the point of no return - everything below never fails except
|
|
||||||
* when the hw goes bonghits. Which means we can commit the new state on
|
|
||||||
* the software side now.
|
|
||||||
*/
|
|
||||||
|
|
||||||
drm_atomic_helper_swap_state(state, true);
|
|
||||||
|
|
||||||
drm_atomic_state_get(state);
|
|
||||||
if (nonblock)
|
|
||||||
sti_atomic_schedule(private, state);
|
|
||||||
else
|
|
||||||
sti_atomic_complete(private, state);
|
|
||||||
|
|
||||||
mutex_unlock(&private->commit.lock);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void sti_output_poll_changed(struct drm_device *ddev)
|
static void sti_output_poll_changed(struct drm_device *ddev)
|
||||||
{
|
{
|
||||||
struct sti_private *private = ddev->dev_private;
|
struct sti_private *private = ddev->dev_private;
|
||||||
|
@ -224,7 +155,7 @@ static const struct drm_mode_config_funcs sti_mode_config_funcs = {
|
||||||
.fb_create = drm_fb_cma_create,
|
.fb_create = drm_fb_cma_create,
|
||||||
.output_poll_changed = sti_output_poll_changed,
|
.output_poll_changed = sti_output_poll_changed,
|
||||||
.atomic_check = sti_atomic_check,
|
.atomic_check = sti_atomic_check,
|
||||||
.atomic_commit = sti_atomic_commit,
|
.atomic_commit = drm_atomic_helper_commit,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void sti_mode_config_init(struct drm_device *dev)
|
static void sti_mode_config_init(struct drm_device *dev)
|
||||||
|
@ -304,9 +235,6 @@ static int sti_init(struct drm_device *ddev)
|
||||||
dev_set_drvdata(ddev->dev, ddev);
|
dev_set_drvdata(ddev->dev, ddev);
|
||||||
private->drm_dev = ddev;
|
private->drm_dev = ddev;
|
||||||
|
|
||||||
mutex_init(&private->commit.lock);
|
|
||||||
INIT_WORK(&private->commit.work, sti_atomic_work);
|
|
||||||
|
|
||||||
drm_mode_config_init(ddev);
|
drm_mode_config_init(ddev);
|
||||||
|
|
||||||
sti_mode_config_init(ddev);
|
sti_mode_config_init(ddev);
|
||||||
|
|
|
@ -25,12 +25,6 @@ struct sti_private {
|
||||||
struct drm_property *plane_zorder_property;
|
struct drm_property *plane_zorder_property;
|
||||||
struct drm_device *drm_dev;
|
struct drm_device *drm_dev;
|
||||||
struct drm_fbdev_cma *fbdev;
|
struct drm_fbdev_cma *fbdev;
|
||||||
|
|
||||||
struct {
|
|
||||||
struct drm_atomic_state *state;
|
|
||||||
struct work_struct work;
|
|
||||||
struct mutex lock;
|
|
||||||
} commit;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct platform_driver sti_tvout_driver;
|
extern struct platform_driver sti_tvout_driver;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче