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

Commit 17b85dc6 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: cvp: Add support for buffer registration with CDSP"

parents db579d45 16e915e5
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@
#include <linux/soc/qcom/smem.h>
#include <soc/qcom/subsystem_restart.h>
#include <linux/dma-mapping.h>
#include <linux/fastcvpd.h>
#include "hfi_packetization.h"
#include "msm_cvp_debug.h"
#include "cvp_core_hfi.h"
@@ -317,7 +316,7 @@ static int __dsp_suspend(struct venus_hfi_device *device, bool force, u32 flags)
	}

	dprintk(CVP_DBG, "%s: suspend dsp\n", __func__);
	rc = fastcvpd_video_suspend(flags);
	rc = cvp_dsp_suspend(flags);
	if (rc) {
		dprintk(CVP_ERR, "%s: dsp suspend failed with error %d\n",
			__func__, rc);
@@ -342,7 +341,7 @@ static int __dsp_resume(struct venus_hfi_device *device, u32 flags)
	}

	dprintk(CVP_DBG, "%s: resume dsp\n", __func__);
	rc = fastcvpd_video_resume(flags);
	rc = cvp_dsp_resume(flags);
	if (rc) {
		dprintk(CVP_ERR,
			"%s: dsp resume failed with error %d\n",
@@ -368,7 +367,7 @@ static int __dsp_shutdown(struct venus_hfi_device *device, u32 flags)
	}

	dprintk(CVP_DBG, "%s: shutdown dsp\n", __func__);
	rc = fastcvpd_video_shutdown(flags);
	rc = cvp_dsp_shutdown(flags);
	if (rc) {
		dprintk(CVP_ERR,
			"%s: dsp shutdown failed with error %d\n",
+14 −3
Original line number Diff line number Diff line
@@ -666,9 +666,20 @@ int cvp_create_pkt_cmd_session_release_buffers(

	pkt->packet_type = HFI_CMD_SESSION_CVP_RELEASE_BUFFERS;
	pkt->session_id = hash32_ptr(session);
	pkt->buffer_type = 0xdeadbeef;
	pkt->num_buffers = 0;
	pkt->size = sizeof(struct hfi_cmd_session_cvp_release_buffers_packet);
	pkt->num_buffers = buffer_info->num_buffers;

	if (buffer_info->buffer_type == HAL_BUFFER_OUTPUT ||
		buffer_info->buffer_type == HAL_BUFFER_OUTPUT2) {
		dprintk(CVP_ERR, "%s: deprecated buffer_type\n", __func__);
		return -EINVAL;
	}

	pkt->size = sizeof(struct hfi_cmd_session_set_buffers_packet) +
		((buffer_info->num_buffers - 1) * sizeof(u32));

	pkt->buffer_type = get_hfi_buffer(buffer_info->buffer_type);
	if (!pkt->buffer_type)
		return -EINVAL;

	return 0;
}
+42 −5
Original line number Diff line number Diff line
@@ -494,11 +494,18 @@ static int msm_cvp_register_buffer(struct msm_cvp_inst *inst,
	bool found;
	struct hfi_device *hdev;
	struct msm_cvp_internal_buffer *cbuf;
	struct hal_session *session;

	if (!inst || !inst->core || !buf) {
		dprintk(CVP_ERR, "%s: invalid params\n", __func__);
		return -EINVAL;
	}

	session = (struct hal_session *)inst->session;
	if (!session) {
		dprintk(CVP_ERR, "%s: invalid session\n", __func__);
		return -EINVAL;
	}
	hdev = inst->core->device;
	print_client_buffer(CVP_DBG, "register", inst, buf);

@@ -538,6 +545,17 @@ static int msm_cvp_register_buffer(struct msm_cvp_inst *inst,
		goto exit;
	}

	if (buf->index) {
		rc = cvp_dsp_register_buffer((uint32_t)cbuf->smem.device_addr,
			buf->index, buf->size, hash32_ptr(session));
		if (rc) {
			dprintk(CVP_ERR,
				"%s: failed dsp registration for fd=%d rc=%d",
				__func__, buf->fd, rc);
			goto exit;
		}
	}

	return rc;

exit:
@@ -559,11 +577,18 @@ static int msm_cvp_unregister_buffer(struct msm_cvp_inst *inst,
	bool found;
	struct hfi_device *hdev;
	struct msm_cvp_internal_buffer *cbuf;
	struct hal_session *session;

	if (!inst || !inst->core || !buf) {
		dprintk(CVP_ERR, "%s: invalid params\n", __func__);
		return -EINVAL;
	}

	session = (struct hal_session *)inst->session;
	if (!session) {
		dprintk(CVP_ERR, "%s: invalid session\n", __func__);
		return -EINVAL;
	}
	hdev = inst->core->device;
	print_client_buffer(CVP_DBG, "unregister", inst, buf);

@@ -573,10 +598,6 @@ static int msm_cvp_unregister_buffer(struct msm_cvp_inst *inst,
		if (cbuf->buf.fd == buf->fd &&
			cbuf->buf.offset == buf->offset) {
			found = true;
			if (cbuf->smem.device_addr)
				msm_cvp_smem_unmap_dma_buf(inst, &cbuf->smem);
			list_del(&cbuf->list);
			kfree(cbuf);
			break;
		}
	}
@@ -586,6 +607,22 @@ static int msm_cvp_unregister_buffer(struct msm_cvp_inst *inst,
		return -EINVAL;
	}

	if (buf->index) {
		rc = cvp_dsp_deregister_buffer((uint32_t)cbuf->smem.device_addr,
			buf->index, buf->size, hash32_ptr(session));
		if (rc) {
			dprintk(CVP_ERR,
				"%s: failed dsp registration for fd = %d rc=%d",
				__func__, buf->fd, rc);
		}
	}

	if (cbuf->smem.device_addr)
		msm_cvp_smem_unmap_dma_buf(inst, &cbuf->smem);

	list_del(&cbuf->list);
	kfree(cbuf);

	return rc;
}

@@ -597,7 +634,7 @@ int msm_cvp_handle_syscall(struct msm_cvp_inst *inst, struct msm_cvp_arg *arg)
		dprintk(CVP_ERR, "%s: invalid args\n", __func__);
		return -EINVAL;
	}
	dprintk(CVP_DBG, "%s:: arg->type = %d", __func__, arg->type);
	dprintk(CVP_DBG, "%s:: arg->type = %x", __func__, arg->type);

	switch (arg->type) {
	case MSM_CVP_GET_SESSION_INFO:
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@
#include "msm_cvp_common.h"
#include "msm_cvp_clocks.h"
#include "msm_cvp_debug.h"

#include "msm_cvp_dsp.h"
int msm_cvp_handle_syscall(struct msm_cvp_inst *inst, struct msm_cvp_arg *arg);
int msm_cvp_session_init(struct msm_cvp_inst *inst);
int msm_cvp_session_deinit(struct msm_cvp_inst *inst);
+7 −2
Original line number Diff line number Diff line
@@ -614,6 +614,7 @@ static void cvp_handle_session_cmd_done(enum hal_command_response cmd,
	} else
		dprintk(CVP_ERR,
			"%s: Invalid inst cmd response: %d\n", __func__, cmd);
	cvp_put_inst(inst);
}

static void handle_session_set_buf_done(enum hal_command_response cmd,
@@ -644,6 +645,7 @@ static void handle_session_set_buf_done(enum hal_command_response cmd,
		complete(&inst->completions[SESSION_MSG_INDEX(cmd)]);
	else
		dprintk(CVP_ERR, "set_buf_done: invalid cmd: %d\n", cmd);
	cvp_put_inst(inst);

}

@@ -1137,6 +1139,7 @@ static void handle_event_change(enum hal_command_response cmd, void *data)
				HAL_BUFFER_OUTPUT);
		if (!bufreq) {
			mutex_unlock(&inst->lock);
			cvp_put_inst(inst);
			return;
		}

@@ -1148,6 +1151,7 @@ static void handle_event_change(enum hal_command_response cmd, void *data)
				HAL_BUFFER_OUTPUT2);
		if (!bufreq) {
			mutex_unlock(&inst->lock);
			cvp_put_inst(inst);
			return;
		}

@@ -1162,6 +1166,7 @@ static void handle_event_change(enum hal_command_response cmd, void *data)
				HAL_BUFFER_OUTPUT);
		if (!bufreq) {
			mutex_unlock(&inst->lock);
			cvp_put_inst(inst);
			return;
		}

@@ -1485,7 +1490,7 @@ static void handle_sys_error(enum hal_command_response cmd, void *data)
	}

	dprintk(CVP_WARN, "SYS_ERROR received for core %pK\n", core);
	msm_cvp_noc_error_info(core);
	/* msm_cvp_noc_error_info(core) is disabled as of now */
	call_hfi_op(hdev, flush_debug_queue, hdev->hfi_device_data);
	list_for_each_entry(inst, &core->instances, list) {
		dprintk(CVP_WARN,
@@ -1975,7 +1980,7 @@ static int msm_comm_init_core(struct msm_cvp_inst *inst)
	hdev = core->device;
	mutex_lock(&core->lock);
	if (core->state >= CVP_CORE_INIT) {
		dprintk(CVP_INFO, "Video core: %d is already in state: %d\n",
		dprintk(CVP_DBG, "CVP core: %d is already in state: %d\n",
				core->id, core->state);
		goto core_already_inited;
	}
Loading