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

Commit 58c60fe9 authored by Vinay Kalia's avatar Vinay Kalia
Browse files

msm: vidc: Remove implementation for V4L2_DEC_CMD_STOP



V4L2_DEC_CMD_STOP and V4L2_ENC_CMD_STOP are not needed
anymore. These commands were used to just send an event
back to userspace to unblock the polling thread. The
polling thread can be unblocked by using evenfds instead.

Change-Id: I3c3026a4d3dc46fe3eb97a79392401283a16b8fb
Signed-off-by: default avatarVinay Kalia <vkalia@codeaurora.org>
parent 1d6b7340
Loading
Loading
Loading
Loading
+0 −74
Original line number Diff line number Diff line
@@ -3030,40 +3030,6 @@ exit:
	return rc;
}

void msm_comm_cleanup_internal_buffers(struct msm_vidc_inst *inst)
{
	struct internal_buf *buf, *dummy;

	dprintk(VIDC_DBG,
		"Inst %p is in bad state. Cleaning internal buffers\n", inst);

	mutex_lock(&inst->scratchbufs.lock);
	list_for_each_entry_safe(buf, dummy, &inst->scratchbufs.list, list) {
		if (!buf->handle) {
			dprintk(VIDC_ERR, "%s - buf->handle NULL\n", __func__);
			continue;
		}
		list_del(&buf->list);
		msm_comm_smem_free(inst, buf->handle);
		kfree(buf);
	}
	mutex_unlock(&inst->scratchbufs.lock);

	mutex_lock(&inst->persistbufs.lock);
	list_for_each_entry_safe(buf, dummy, &inst->persistbufs.list, list) {
		if (!buf->handle) {
			dprintk(VIDC_ERR, "%s - buf->handle NULL\n", __func__);
			continue;
		}
		list_del(&buf->list);
		msm_comm_smem_free(inst, buf->handle);
		kfree(buf);
	}
	mutex_unlock(&inst->persistbufs.lock);

	return;
}

int msm_vidc_comm_cmd(void *instance, union msm_v4l2_cmd *cmd)
{
	struct msm_vidc_inst *inst = instance;
@@ -3104,51 +3070,11 @@ int msm_vidc_comm_cmd(void *instance, union msm_v4l2_cmd *cmd)
				"Failed to flush buffers: %d\n", rc);
		}
		break;
	case V4L2_ENC_CMD_STOP:
		/* V4L2_DEC_CMD_STOP has the same value as V4L2_ENC_CMD_STOP */
		rc = msm_vidc_release_buffers(inst,
				V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
		if (rc)
			dprintk(VIDC_ERR,
				"Failed to release Capture buffers\n");

		if (core->state != VIDC_CORE_INVALID &&
				inst->state ==  MSM_VIDC_CORE_INVALID) {
			rc = msm_comm_kill_session(inst);
			if (rc)
				dprintk(VIDC_ERR,
					"Failed to clean session: %d\n",
					rc);
			msm_comm_cleanup_internal_buffers(inst);
			msm_vidc_queue_v4l2_event(inst,
				V4L2_EVENT_MSM_VIDC_CLOSE_DONE);
			goto exit;
		}

		rc = msm_comm_release_scratch_buffers(inst, false);
		if (rc)
			dprintk(VIDC_ERR,
				"Failed to release scratch buffers: %d\n", rc);
		rc = msm_comm_release_persist_buffers(inst);
		if (rc)
			dprintk(VIDC_ERR,
				"Failed to release persist buffers: %d\n", rc);
		rc = msm_comm_try_state(inst, MSM_VIDC_CLOSE_DONE);

		/*
		 * Clients rely on this event for joining poll thread.
		 * This event should be returned even if firmware has
		 * failed to respond.
		 */

		msm_vidc_queue_v4l2_event(inst, V4L2_EVENT_MSM_VIDC_CLOSE_DONE);
		break;
	default:
		dprintk(VIDC_ERR, "Unknown Command %d\n", which_cmd);
		rc = -ENOTSUPP;
		break;
	}
exit:
	return rc;
}

+6 −7
Original line number Diff line number Diff line
@@ -1900,15 +1900,14 @@ struct v4l2_streamparm {
		(V4L2_EVENT_MSM_VIDC_START + 3)
#define V4L2_EVENT_MSM_VIDC_PORT_SETTINGS_BITDEPTH_CHANGED_INSUFFICIENT \
		(V4L2_EVENT_MSM_VIDC_START + 4)
#define V4L2_EVENT_MSM_VIDC_CLOSE_DONE	(V4L2_EVENT_MSM_VIDC_START + 5)
#define V4L2_EVENT_MSM_VIDC_SYS_ERROR	(V4L2_EVENT_MSM_VIDC_START + 6)
#define V4L2_EVENT_MSM_VIDC_SYS_ERROR	(V4L2_EVENT_MSM_VIDC_START + 5)
#define V4L2_EVENT_MSM_VIDC_RELEASE_BUFFER_REFERENCE \
		(V4L2_EVENT_MSM_VIDC_START + 7)
		(V4L2_EVENT_MSM_VIDC_START + 6)
#define V4L2_EVENT_MSM_VIDC_RELEASE_UNQUEUED_BUFFER \
		(V4L2_EVENT_MSM_VIDC_START + 8)
#define V4L2_EVENT_MSM_VIDC_HW_OVERLOAD (V4L2_EVENT_MSM_VIDC_START + 9)
#define V4L2_EVENT_MSM_VIDC_MAX_CLIENTS (V4L2_EVENT_MSM_VIDC_START + 10)
#define V4L2_EVENT_MSM_VIDC_HW_UNSUPPORTED (V4L2_EVENT_MSM_VIDC_START + 11)
		(V4L2_EVENT_MSM_VIDC_START + 7)
#define V4L2_EVENT_MSM_VIDC_HW_OVERLOAD (V4L2_EVENT_MSM_VIDC_START + 8)
#define V4L2_EVENT_MSM_VIDC_MAX_CLIENTS (V4L2_EVENT_MSM_VIDC_START + 9)
#define V4L2_EVENT_MSM_VIDC_HW_UNSUPPORTED (V4L2_EVENT_MSM_VIDC_START + 10)

/* Payload for V4L2_EVENT_VSYNC */
struct v4l2_event_vsync {