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

Commit 220e2bf8 authored by Adrian Salido-Moreno's avatar Adrian Salido-Moreno Committed by Gerrit - the friendly Code Review server
Browse files

msm: mdss: allow re-queue of writeback buffers



When a buffer has been properly processed, client may choose to use sync
fence to acknowledge when buffer is complete. In such cases dequeue is
not necessary, allow this use case by allowing client to re-queue
writeback buffers as long as the buffer has been properly processed
already.

Change-Id: Ibac1eb9710477734e1ee2daf8136085d4439b0d4
Signed-off-by: default avatarAdrian Salido-Moreno <adrianm@codeaurora.org>
parent af83c6c7
Loading
Loading
Loading
Loading
+33 −7
Original line number Original line Diff line number Diff line
@@ -51,7 +51,8 @@ enum mdss_mdp_wb_node_state {
	REGISTERED,
	REGISTERED,
	IN_FREE_QUEUE,
	IN_FREE_QUEUE,
	IN_BUSY_QUEUE,
	IN_BUSY_QUEUE,
	WITH_CLIENT
	WITH_CLIENT,
	WB_BUFFER_READY,
};
};


struct mdss_mdp_wb_data {
struct mdss_mdp_wb_data {
@@ -497,13 +498,37 @@ static int mdss_mdp_wb_queue(struct msm_fb_data_type *mfd,
	if (node == NULL)
	if (node == NULL)
		node = get_user_node(mfd, data);
		node = get_user_node(mfd, data);


	if (!node || node->state == IN_BUSY_QUEUE ||
	if (!node) {
	    node->state == IN_FREE_QUEUE) {
		pr_err("memory not registered\n");
		pr_err("memory not registered or Buffer already with us\n");
		ret = -ENOENT;
		ret = -EINVAL;
	} else {
	} else {
		struct mdss_mdp_img_data *buf = &node->buf_data.p[0];

		switch (node->state) {
		case IN_FREE_QUEUE:
			pr_err("node 0x%pa was already queueued before\n",
					&buf->addr);
			ret = -EINVAL;
			break;
		case IN_BUSY_QUEUE:
			pr_err("node 0x%pa still in busy state\n", &buf->addr);
			ret = -EBUSY;
			break;
		case WB_BUFFER_READY:
			pr_debug("node 0x%pa re-queueded without dequeue\n",
				&buf->addr);
			list_del(&node->active_entry);
		case WITH_CLIENT:
		case REGISTERED:
			list_add_tail(&node->active_entry, &wb->free_queue);
			list_add_tail(&node->active_entry, &wb->free_queue);
			node->state = IN_FREE_QUEUE;
			node->state = IN_FREE_QUEUE;
			break;
		default:
			pr_err("Invalid node 0x%pa state %d\n",
				&buf->addr, node->state);
			ret = -EINVAL;
			break;
		}
	}
	}
	mutex_unlock(&wb->lock);
	mutex_unlock(&wb->lock);


@@ -618,6 +643,7 @@ int mdss_mdp_wb_kickoff(struct msm_fb_data_type *mfd)
	if (wb && node) {
	if (wb && node) {
		mutex_lock(&wb->lock);
		mutex_lock(&wb->lock);
		list_add_tail(&node->active_entry, &wb->busy_queue);
		list_add_tail(&node->active_entry, &wb->busy_queue);
		node->state = WB_BUFFER_READY;
		mutex_unlock(&wb->lock);
		mutex_unlock(&wb->lock);
		wake_up(&wb->wait_q);
		wake_up(&wb->wait_q);
	}
	}