Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit efd65138 authored by Alan Kwong's avatar Alan Kwong
Browse files

drm/msm: dispatch sync commit to display thread



Current implementation dispatches sync commit in the
calling thread context instead of the display thread
context. This will cause serialization issues between
idle pc, atomic commit, and atomic check operations.
Dispatch sync commit to the corresponding display
thread to serialize processing properly.

Change-Id: I710e0daecfa659a00948092ff15dfc699f5f9344
Signed-off-by: default avatarAlan Kwong <akwong@codeaurora.org>
parent 310e9b0f
Loading
Loading
Loading
Loading
+18 −16
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ struct msm_commit {
	struct drm_device *dev;
	struct drm_atomic_state *state;
	uint32_t crtc_mask;
	bool nonblock;
	struct kthread_work commit_work;
};

@@ -62,6 +63,7 @@ static void end_atomic(struct msm_drm_private *priv, uint32_t crtc_mask)
static void commit_destroy(struct msm_commit *c)
{
	end_atomic(c->dev->dev_private, c->crtc_mask);
	if (c->nonblock)
		kfree(c);
}

@@ -442,7 +444,8 @@ static void _msm_drm_commit_work_cb(struct kthread_work *work)
	SDE_ATRACE_END("complete_commit");
}

static struct msm_commit *commit_init(struct drm_atomic_state *state)
static struct msm_commit *commit_init(struct drm_atomic_state *state,
		bool nonblock)
{
	struct msm_commit *c = kzalloc(sizeof(*c), GFP_KERNEL);

@@ -451,6 +454,7 @@ static struct msm_commit *commit_init(struct drm_atomic_state *state)

	c->dev = state->dev;
	c->state = state;
	c->nonblock = nonblock;

	kthread_init_work(&c->commit_work, _msm_drm_commit_work_cb);

@@ -495,6 +499,11 @@ static int msm_atomic_commit_dispatch(struct drm_device *dev,
			break;
	}

	if (!ret && !commit->nonblock) {
		kthread_flush_work(&commit->commit_work);
		kfree(commit);
	}

	return ret;
}

@@ -528,7 +537,7 @@ int msm_atomic_commit(struct drm_device *dev,
		return ret;
	}

	c = commit_init(state);
	c = commit_init(state, nonblock);
	if (!c) {
		ret = -ENOMEM;
		goto error;
@@ -596,7 +605,6 @@ int msm_atomic_commit(struct drm_device *dev,
	 * current layout.
	 */

	if (nonblock) {
	ret = msm_atomic_commit_dispatch(dev, state, c);
	if (ret) {
		DRM_ERROR("%s: atomic commit failed\n", __func__);
@@ -606,12 +614,6 @@ int msm_atomic_commit(struct drm_device *dev,
	}
	SDE_ATRACE_END("atomic_commit");
	return 0;
	}

	complete_commit(c);

	SDE_ATRACE_END("atomic_commit");
	return 0;

error:
	drm_atomic_helper_cleanup_planes(dev, state);