mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 11:50:43 +09:00
drm/atomic-helper: fixup atomit commit backport
Change-Id: I7a8dc2552a1738eb3837e7bfffb82872627340c9 Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
This commit is contained in:
@@ -59,6 +59,7 @@ void drm_atomic_state_default_release(struct drm_atomic_state *state)
|
||||
kfree(state->connector_states);
|
||||
kfree(state->crtcs);
|
||||
kfree(state->crtc_states);
|
||||
kfree(state->crtc_commits);
|
||||
kfree(state->planes);
|
||||
kfree(state->plane_states);
|
||||
}
|
||||
@@ -90,6 +91,10 @@ drm_atomic_state_init(struct drm_device *dev, struct drm_atomic_state *state)
|
||||
sizeof(*state->crtc_states), GFP_KERNEL);
|
||||
if (!state->crtc_states)
|
||||
goto fail;
|
||||
state->crtc_commits = kcalloc(dev->mode_config.num_crtc,
|
||||
sizeof(*state->crtc_commits), GFP_KERNEL);
|
||||
if (!state->crtc_commits)
|
||||
goto fail;
|
||||
state->planes = kcalloc(dev->mode_config.num_total_plane,
|
||||
sizeof(*state->planes), GFP_KERNEL);
|
||||
if (!state->planes)
|
||||
@@ -191,13 +196,13 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state)
|
||||
crtc->funcs->atomic_destroy_state(crtc,
|
||||
state->crtc_states[i]);
|
||||
|
||||
if (state->crtcs[i].commit) {
|
||||
kfree(state->crtcs[i].commit->event);
|
||||
state->crtcs[i].commit->event = NULL;
|
||||
drm_crtc_commit_put(state->crtcs[i].commit);
|
||||
if (state->crtc_commits[i]) {
|
||||
kfree(state->crtc_commits[i]->event);
|
||||
state->crtc_commits[i]->event = NULL;
|
||||
drm_crtc_commit_put(state->crtc_commits[i]);
|
||||
}
|
||||
|
||||
state->crtcs[i].commit = NULL;
|
||||
state->crtc_commits[i] = NULL;
|
||||
state->crtcs[i] = NULL;
|
||||
state->crtc_states[i] = NULL;
|
||||
}
|
||||
|
||||
@@ -1062,7 +1062,7 @@ int drm_atomic_helper_commit(struct drm_device *dev,
|
||||
if (async)
|
||||
return -EBUSY;
|
||||
|
||||
ret = drm_atomic_helper_setup_commit(state, nonblock);
|
||||
ret = drm_atomic_helper_setup_commit(state, async);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -1193,8 +1193,8 @@ static int stall_checks(struct drm_crtc *crtc, bool nonblock)
|
||||
ret = wait_for_completion_interruptible_timeout(&commit->cleanup_done,
|
||||
10*HZ);
|
||||
if (ret == 0)
|
||||
DRM_ERROR("[CRTC:%d:%s] cleanup_done timed out\n",
|
||||
crtc->base.id, crtc->name);
|
||||
DRM_ERROR("[CRTC:%d] cleanup_done timed out\n",
|
||||
crtc->base.id);
|
||||
|
||||
drm_crtc_commit_put(stall_commit);
|
||||
|
||||
@@ -1263,7 +1263,7 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
|
||||
kref_init(&commit->ref);
|
||||
commit->crtc = crtc;
|
||||
|
||||
state->crtcs[i].commit = commit;
|
||||
state->crtc_commits[i] = commit;
|
||||
|
||||
ret = stall_checks(crtc, nonblock);
|
||||
if (ret)
|
||||
@@ -1349,16 +1349,16 @@ void drm_atomic_helper_wait_for_dependencies(struct drm_atomic_state *state)
|
||||
ret = wait_for_completion_timeout(&commit->hw_done,
|
||||
10*HZ);
|
||||
if (ret == 0)
|
||||
DRM_ERROR("[CRTC:%d:%s] hw_done timed out\n",
|
||||
crtc->base.id, crtc->name);
|
||||
DRM_ERROR("[CRTC:%d] hw_done timed out\n",
|
||||
crtc->base.id);
|
||||
|
||||
/* Currently no support for overwriting flips, hence
|
||||
* stall for previous one to execute completely. */
|
||||
ret = wait_for_completion_timeout(&commit->flip_done,
|
||||
10*HZ);
|
||||
if (ret == 0)
|
||||
DRM_ERROR("[CRTC:%d:%s] flip_done timed out\n",
|
||||
crtc->base.id, crtc->name);
|
||||
DRM_ERROR("[CRTC:%d] flip_done timed out\n",
|
||||
crtc->base.id);
|
||||
|
||||
drm_crtc_commit_put(commit);
|
||||
}
|
||||
@@ -1388,7 +1388,7 @@ void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *state)
|
||||
int i;
|
||||
|
||||
for_each_crtc_in_state(state, crtc, crtc_state, i) {
|
||||
commit = state->crtcs[i].commit;
|
||||
commit = state->crtc_commits[i];
|
||||
if (!commit)
|
||||
continue;
|
||||
|
||||
@@ -1421,7 +1421,7 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *state)
|
||||
long ret;
|
||||
|
||||
for_each_crtc_in_state(state, crtc, crtc_state, i) {
|
||||
commit = state->crtcs[i].commit;
|
||||
commit = state->crtc_commits[i];
|
||||
if (WARN_ON(!commit))
|
||||
continue;
|
||||
|
||||
@@ -1446,8 +1446,8 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *state)
|
||||
ret = wait_for_completion_timeout(&commit->flip_done,
|
||||
10*HZ);
|
||||
if (ret == 0)
|
||||
DRM_ERROR("[CRTC:%d:%s] flip_done timed out\n",
|
||||
crtc->base.id, crtc->name);
|
||||
DRM_ERROR("[CRTC:%d] flip_done timed out\n",
|
||||
crtc->base.id);
|
||||
|
||||
spin_lock(&crtc->commit_lock);
|
||||
list_del(&commit->commit_entry);
|
||||
@@ -1750,6 +1750,7 @@ void drm_atomic_helper_swap_state(struct drm_device *dev,
|
||||
struct drm_plane *plane;
|
||||
struct drm_plane_state *plane_state;
|
||||
struct drm_crtc_commit *commit;
|
||||
bool stall = true;
|
||||
|
||||
if (stall) {
|
||||
for_each_crtc_in_state(state, crtc, crtc_state, i) {
|
||||
@@ -1766,8 +1767,8 @@ void drm_atomic_helper_swap_state(struct drm_device *dev,
|
||||
ret = wait_for_completion_timeout(&commit->hw_done,
|
||||
10*HZ);
|
||||
if (ret == 0)
|
||||
DRM_ERROR("[CRTC:%d:%s] hw_done timed out\n",
|
||||
crtc->base.id, crtc->name);
|
||||
DRM_ERROR("[CRTC:%d] hw_done timed out\n",
|
||||
crtc->base.id);
|
||||
drm_crtc_commit_put(commit);
|
||||
}
|
||||
}
|
||||
@@ -1783,13 +1784,13 @@ void drm_atomic_helper_swap_state(struct drm_device *dev,
|
||||
swap(state->crtc_states[i], crtc->state);
|
||||
crtc->state->state = NULL;
|
||||
|
||||
if (state->crtcs[i].commit) {
|
||||
if (state->crtc_commits[i]) {
|
||||
spin_lock(&crtc->commit_lock);
|
||||
list_add(&state->crtcs[i].commit->commit_entry,
|
||||
list_add(&state->crtc_commits[i]->commit_entry,
|
||||
&crtc->commit_list);
|
||||
spin_unlock(&crtc->commit_lock);
|
||||
|
||||
state->crtcs[i].commit->event = NULL;
|
||||
state->crtc_commits[i]->event = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -664,6 +664,11 @@ void drm_send_event_locked(struct drm_device *dev, struct drm_pending_event *e)
|
||||
e->completion = NULL;
|
||||
}
|
||||
|
||||
if (!e->file_priv) {
|
||||
kfree(e);
|
||||
return;
|
||||
}
|
||||
|
||||
list_add_tail(&e->link,
|
||||
&e->file_priv->event_list);
|
||||
wake_up_interruptible(&e->file_priv->event_wait);
|
||||
|
||||
@@ -1383,6 +1383,7 @@ struct drm_atomic_state {
|
||||
struct drm_plane **planes;
|
||||
struct drm_plane_state **plane_states;
|
||||
struct drm_crtc **crtcs;
|
||||
struct drm_crtc_commit **crtc_commits;
|
||||
struct drm_crtc_state **crtc_states;
|
||||
int num_connector;
|
||||
struct drm_connector **connectors;
|
||||
|
||||
Reference in New Issue
Block a user