mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-14 08:36:12 -04:00
Merge "msm: cvp: remove version and deprecated functions"
This commit is contained in:
commit
4dc9af7e29
5 changed files with 98 additions and 429 deletions
|
|
@ -360,69 +360,31 @@ int get_hfi_version(void)
|
|||
|
||||
unsigned int get_msg_size(void)
|
||||
{
|
||||
unsigned int ver;
|
||||
|
||||
ver = get_hfi_version();
|
||||
ver = (ver & HFI_VERSION_MINOR_MASK) >> HFI_VERSION_MINOR_SHIFT;
|
||||
|
||||
if (ver < 1)
|
||||
return sizeof(struct cvp_hfi_msg_session_hdr_d);
|
||||
|
||||
return sizeof(struct cvp_hfi_msg_session_hdr);
|
||||
}
|
||||
|
||||
unsigned int get_msg_session_id(void *msg)
|
||||
{
|
||||
unsigned int ver;
|
||||
struct cvp_hfi_msg_session_hdr *hdr =
|
||||
(struct cvp_hfi_msg_session_hdr *)msg;
|
||||
|
||||
ver = get_hfi_version();
|
||||
ver = (ver & HFI_VERSION_MINOR_MASK) >> HFI_VERSION_MINOR_SHIFT;
|
||||
|
||||
if (ver < 1) {
|
||||
struct cvp_hfi_msg_session_hdr_d *old_hdr =
|
||||
(struct cvp_hfi_msg_session_hdr_d *)msg;
|
||||
return old_hdr->session_id;
|
||||
}
|
||||
return hdr->session_id;
|
||||
}
|
||||
|
||||
unsigned int get_msg_errorcode(void *msg)
|
||||
{
|
||||
unsigned int ver;
|
||||
struct cvp_hfi_msg_session_hdr *hdr =
|
||||
(struct cvp_hfi_msg_session_hdr *)msg;
|
||||
|
||||
ver = get_hfi_version();
|
||||
ver = (ver & HFI_VERSION_MINOR_MASK) >> HFI_VERSION_MINOR_SHIFT;
|
||||
|
||||
if (ver < 1) {
|
||||
struct cvp_hfi_msg_session_hdr_d *old_hdr =
|
||||
(struct cvp_hfi_msg_session_hdr_d *)msg;
|
||||
return old_hdr->error_type;
|
||||
}
|
||||
return hdr->error_type;
|
||||
}
|
||||
|
||||
int get_msg_opconfigs(void *msg, unsigned int *session_id,
|
||||
unsigned int *error_type, unsigned int *config_id)
|
||||
{
|
||||
unsigned int ver;
|
||||
struct cvp_hfi_msg_session_op_cfg_packet *cfg =
|
||||
(struct cvp_hfi_msg_session_op_cfg_packet *)msg;
|
||||
|
||||
ver = get_hfi_version();
|
||||
ver = (ver & HFI_VERSION_MINOR_MASK) >> HFI_VERSION_MINOR_SHIFT;
|
||||
|
||||
if (ver < 1) {
|
||||
struct cvp_hfi_msg_session_op_cfg_packet_d *old_cfg
|
||||
= (struct cvp_hfi_msg_session_op_cfg_packet_d *)msg;
|
||||
*session_id = old_cfg->session_id;
|
||||
*error_type = old_cfg->error_type;
|
||||
*config_id = old_cfg->op_conf_id;
|
||||
return 0;
|
||||
}
|
||||
*session_id = cfg->session_id;
|
||||
*error_type = cfg->error_type;
|
||||
*config_id = cfg->op_conf_id;
|
||||
|
|
@ -3002,13 +2964,7 @@ static void **get_session_id(struct msm_cvp_cb_info *info)
|
|||
|
||||
static void print_msg_hdr(void *hdr)
|
||||
{
|
||||
unsigned int ver;
|
||||
|
||||
ver = get_hfi_version();
|
||||
ver = (ver & HFI_VERSION_MINOR_MASK) >> HFI_VERSION_MINOR_SHIFT;
|
||||
|
||||
if (ver >= 1) {
|
||||
struct cvp_hfi_msg_session_hdr *new_hdr =
|
||||
struct cvp_hfi_msg_session_hdr *new_hdr =
|
||||
(struct cvp_hfi_msg_session_hdr *)hdr;
|
||||
dprintk(CVP_DBG, "HFI MSG received: %x %x %x %x %x %x %x\n",
|
||||
new_hdr->size, new_hdr->packet_type,
|
||||
|
|
@ -3017,17 +2973,6 @@ static void print_msg_hdr(void *hdr)
|
|||
new_hdr->client_data.data1,
|
||||
new_hdr->client_data.data2,
|
||||
new_hdr->error_type);
|
||||
} else {
|
||||
struct cvp_hfi_msg_session_hdr_d *old_hdr =
|
||||
(struct cvp_hfi_msg_session_hdr_d *)hdr;
|
||||
dprintk(CVP_DBG, "HFI MSG received: %x %x %x %x %x %x %x\n",
|
||||
old_hdr->size, old_hdr->packet_type,
|
||||
old_hdr->session_id,
|
||||
old_hdr->client_data.transaction_id,
|
||||
old_hdr->client_data.data1,
|
||||
old_hdr->client_data.data2,
|
||||
old_hdr->error_type);
|
||||
}
|
||||
}
|
||||
|
||||
static int __response_handler(struct iris_hfi_device *device)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __H_CVP_HFI_HELPER_H__
|
||||
|
|
@ -285,28 +285,11 @@ struct cvp_hfi_client {
|
|||
u32 transaction_id;
|
||||
u32 data1;
|
||||
u32 data2;
|
||||
union {
|
||||
u64 kdata;
|
||||
struct {
|
||||
u32 kdata1;
|
||||
u32 kdata2;
|
||||
};
|
||||
};
|
||||
u64 kdata;
|
||||
u32 reserved1;
|
||||
u32 reserved2;
|
||||
} __packed;
|
||||
|
||||
struct cvp_hfi_client_d {
|
||||
u32 transaction_id;
|
||||
u32 data1;
|
||||
u32 data2;
|
||||
};
|
||||
|
||||
struct cvp_buf_desc {
|
||||
u32 fd;
|
||||
u32 size;
|
||||
};
|
||||
|
||||
struct cvp_hfi_buf_type {
|
||||
s32 fd;
|
||||
u32 size;
|
||||
|
|
@ -324,15 +307,6 @@ struct cvp_hfi_cmd_session_set_buffers_packet {
|
|||
struct cvp_hfi_buf_type buf_type;
|
||||
} __packed;
|
||||
|
||||
struct cvp_hfi_cmd_session_set_buffers_packet_d {
|
||||
u32 size;
|
||||
u32 packet_type;
|
||||
u32 session_id;
|
||||
struct cvp_hfi_client_d client_data;
|
||||
u32 buffer_addr;
|
||||
u32 buffer_size;
|
||||
};
|
||||
|
||||
struct cvp_session_release_buffers_packet {
|
||||
u32 size;
|
||||
u32 packet_type;
|
||||
|
|
@ -344,16 +318,6 @@ struct cvp_session_release_buffers_packet {
|
|||
u32 buffer_idx;
|
||||
} __packed;
|
||||
|
||||
struct cvp_session_release_buffers_packet_d {
|
||||
u32 size;
|
||||
u32 packet_type;
|
||||
u32 session_id;
|
||||
struct cvp_hfi_client_d client_data;
|
||||
u32 buffer_type;
|
||||
u32 num_buffers;
|
||||
u32 buffer_idx;
|
||||
};
|
||||
|
||||
struct cvp_hfi_cmd_session_hdr {
|
||||
u32 size;
|
||||
u32 packet_type;
|
||||
|
|
@ -371,14 +335,6 @@ struct cvp_hfi_msg_session_hdr {
|
|||
u32 stream_idx;
|
||||
} __packed;
|
||||
|
||||
struct cvp_hfi_msg_session_hdr_d {
|
||||
u32 size;
|
||||
u32 packet_type;
|
||||
u32 session_id;
|
||||
struct cvp_hfi_client_d client_data;
|
||||
u32 error_type;
|
||||
};
|
||||
|
||||
struct cvp_hfi_buffer_mapping_type {
|
||||
u32 index;
|
||||
u32 device_addr;
|
||||
|
|
@ -403,15 +359,6 @@ struct cvp_hfi_msg_event_notify_packet {
|
|||
u32 rg_ext_event_data[1];
|
||||
};
|
||||
|
||||
struct cvp_hfi_msg_session_op_cfg_packet_d {
|
||||
u32 size;
|
||||
u32 packet_type;
|
||||
u32 session_id;
|
||||
struct cvp_hfi_client_d client_data;
|
||||
u32 op_conf_id;
|
||||
u32 error_type;
|
||||
};
|
||||
|
||||
struct cvp_hfi_msg_session_op_cfg_packet {
|
||||
u32 size;
|
||||
u32 packet_type;
|
||||
|
|
@ -500,4 +447,18 @@ struct cvp_hfi_cmd_sys_test_ssr_packet {
|
|||
u32 trigger_type;
|
||||
};
|
||||
|
||||
struct cvp_buf_type {
|
||||
s32 fd;
|
||||
u32 size;
|
||||
u32 offset;
|
||||
u32 flags;
|
||||
union {
|
||||
struct dma_buf *dbuf;
|
||||
struct {
|
||||
u32 reserved1;
|
||||
u32 reserved2;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "hfi_packetization.h"
|
||||
|
|
@ -303,35 +303,17 @@ int cvp_create_pkt_cmd_session_set_buffers(
|
|||
struct cvp_buffer_addr_info *buffer_info)
|
||||
{
|
||||
int rc = 0;
|
||||
unsigned int ver;
|
||||
|
||||
ver = get_hfi_version();
|
||||
ver = (ver & HFI_VERSION_MINOR_MASK) >> HFI_VERSION_MINOR_SHIFT;
|
||||
struct cvp_hfi_cmd_session_set_buffers_packet *pkt;
|
||||
|
||||
if (!cmd || !session)
|
||||
return -EINVAL;
|
||||
|
||||
if (ver < 1) {
|
||||
struct cvp_hfi_cmd_session_set_buffers_packet_d *pkt;
|
||||
|
||||
pkt = (struct cvp_hfi_cmd_session_set_buffers_packet_d *)cmd;
|
||||
pkt->packet_type = HFI_CMD_SESSION_CVP_SET_BUFFERS;
|
||||
pkt->session_id = hash32_ptr(session);
|
||||
pkt->buffer_addr = buffer_info->align_device_addr;
|
||||
pkt->buffer_size = buffer_info->buffer_size;
|
||||
pkt->size =
|
||||
sizeof(struct cvp_hfi_cmd_session_set_buffers_packet_d);
|
||||
} else {
|
||||
struct cvp_hfi_cmd_session_set_buffers_packet *pkt;
|
||||
|
||||
pkt = (struct cvp_hfi_cmd_session_set_buffers_packet *)cmd;
|
||||
pkt->packet_type = HFI_CMD_SESSION_CVP_SET_BUFFERS;
|
||||
pkt->session_id = hash32_ptr(session);
|
||||
pkt->buf_type.fd = buffer_info->align_device_addr;
|
||||
pkt->buf_type.size = buffer_info->buffer_size;
|
||||
pkt->size =
|
||||
sizeof(struct cvp_hfi_cmd_session_set_buffers_packet);
|
||||
}
|
||||
pkt = (struct cvp_hfi_cmd_session_set_buffers_packet *)cmd;
|
||||
pkt->packet_type = HFI_CMD_SESSION_CVP_SET_BUFFERS;
|
||||
pkt->session_id = hash32_ptr(session);
|
||||
pkt->buf_type.fd = buffer_info->align_device_addr;
|
||||
pkt->buf_type.size = buffer_info->buffer_size;
|
||||
pkt->size = sizeof(struct cvp_hfi_cmd_session_set_buffers_packet);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -341,37 +323,18 @@ int cvp_create_pkt_cmd_session_release_buffers(
|
|||
struct cvp_hal_session *session,
|
||||
struct cvp_buffer_addr_info *buffer_info)
|
||||
{
|
||||
unsigned int ver;
|
||||
|
||||
ver = get_hfi_version();
|
||||
ver = (ver & HFI_VERSION_MINOR_MASK) >> HFI_VERSION_MINOR_SHIFT;
|
||||
struct cvp_session_release_buffers_packet *pkt;
|
||||
|
||||
if (!cmd || !session)
|
||||
return -EINVAL;
|
||||
|
||||
if (ver < 1) {
|
||||
struct cvp_session_release_buffers_packet_d *pkt;
|
||||
|
||||
pkt = (struct cvp_session_release_buffers_packet_d *)cmd;
|
||||
pkt->packet_type = HFI_CMD_SESSION_CVP_RELEASE_BUFFERS;
|
||||
pkt->session_id = hash32_ptr(session);
|
||||
pkt->num_buffers = buffer_info->num_buffers;
|
||||
pkt->buffer_type = buffer_info->buffer_type;
|
||||
pkt->size =
|
||||
sizeof(struct cvp_session_release_buffers_packet_d) +
|
||||
pkt = (struct cvp_session_release_buffers_packet *)cmd;
|
||||
pkt->packet_type = HFI_CMD_SESSION_CVP_RELEASE_BUFFERS;
|
||||
pkt->session_id = hash32_ptr(session);
|
||||
pkt->num_buffers = buffer_info->num_buffers;
|
||||
pkt->buffer_type = buffer_info->buffer_type;
|
||||
pkt->size = sizeof(struct cvp_session_release_buffers_packet) +
|
||||
((buffer_info->num_buffers - 1) * sizeof(u32));
|
||||
} else {
|
||||
struct cvp_session_release_buffers_packet *pkt;
|
||||
|
||||
pkt = (struct cvp_session_release_buffers_packet *)cmd;
|
||||
pkt->packet_type = HFI_CMD_SESSION_CVP_RELEASE_BUFFERS;
|
||||
pkt->session_id = hash32_ptr(session);
|
||||
pkt->num_buffers = buffer_info->num_buffers;
|
||||
pkt->buffer_type = buffer_info->buffer_type;
|
||||
pkt->size =
|
||||
sizeof(struct cvp_session_release_buffers_packet) +
|
||||
((buffer_info->num_buffers - 1) * sizeof(u32));
|
||||
}
|
||||
|
||||
if (buffer_info->buffer_type == HAL_BUFFER_OUTPUT ||
|
||||
buffer_info->buffer_type == HAL_BUFFER_OUTPUT2) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "msm_cvp.h"
|
||||
|
|
@ -34,25 +34,6 @@ void print_internal_buffer(u32 tag, const char *str,
|
|||
}
|
||||
}
|
||||
|
||||
static enum hal_buffer get_hal_buftype(const char *str, unsigned int type)
|
||||
{
|
||||
enum hal_buffer buftype = HAL_BUFFER_NONE;
|
||||
|
||||
if (type == CVP_KMD_BUFTYPE_INPUT)
|
||||
buftype = HAL_BUFFER_INPUT;
|
||||
else if (type == CVP_KMD_BUFTYPE_OUTPUT)
|
||||
buftype = HAL_BUFFER_OUTPUT;
|
||||
else if (type == CVP_KMD_BUFTYPE_INTERNAL_1)
|
||||
buftype = HAL_BUFFER_INTERNAL_SCRATCH_1;
|
||||
else if (type == CVP_KMD_BUFTYPE_INTERNAL_2)
|
||||
buftype = HAL_BUFFER_INTERNAL_SCRATCH_1;
|
||||
else
|
||||
dprintk(CVP_ERR, "%s: unknown buffer type %#x\n",
|
||||
str, type);
|
||||
|
||||
return buftype;
|
||||
}
|
||||
|
||||
static int msm_cvp_get_session_info(struct msm_cvp_inst *inst,
|
||||
struct cvp_kmd_session_info *session)
|
||||
{
|
||||
|
|
@ -77,42 +58,6 @@ static int msm_cvp_get_session_info(struct msm_cvp_inst *inst,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int msm_cvp_session_get_iova_addr_d(
|
||||
struct msm_cvp_inst *inst,
|
||||
struct msm_cvp_internal_buffer **cbuf_ptr,
|
||||
unsigned int search_fd, unsigned int search_size,
|
||||
unsigned int *iova,
|
||||
unsigned int *iova_size)
|
||||
{
|
||||
bool found = false;
|
||||
struct msm_cvp_internal_buffer *cbuf;
|
||||
|
||||
mutex_lock(&inst->cvpcpubufs.lock);
|
||||
list_for_each_entry(cbuf, &inst->cvpcpubufs.list, list) {
|
||||
if (cbuf->buf.fd == search_fd) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
mutex_unlock(&inst->cvpcpubufs.lock);
|
||||
if (!found)
|
||||
return -ENOENT;
|
||||
|
||||
if (search_size != cbuf->buf.size) {
|
||||
dprintk(CVP_ERR,
|
||||
"%s: invalid size received fd = %d, size 0x%x 0x%x\n",
|
||||
__func__, search_fd, search_size, cbuf->buf.size);
|
||||
return -EINVAL;
|
||||
}
|
||||
*iova = cbuf->smem.device_addr;
|
||||
*iova_size = cbuf->buf.size;
|
||||
|
||||
if (cbuf_ptr)
|
||||
*cbuf_ptr = cbuf;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int msm_cvp_session_get_iova_addr(
|
||||
struct msm_cvp_inst *inst,
|
||||
struct cvp_buf_type *in_buf,
|
||||
|
|
@ -188,7 +133,7 @@ static int msm_cvp_map_buf_dsp(struct msm_cvp_inst *inst,
|
|||
return -ENOMEM;
|
||||
|
||||
memcpy(&cbuf->buf, buf, sizeof(struct cvp_kmd_buffer));
|
||||
cbuf->smem.buffer_type = get_hal_buftype(__func__, buf->type);
|
||||
cbuf->smem.buffer_type = 0;
|
||||
cbuf->smem.fd = buf->fd;
|
||||
cbuf->smem.offset = buf->offset;
|
||||
cbuf->smem.size = buf->size;
|
||||
|
|
@ -288,70 +233,6 @@ static int msm_cvp_unmap_buf_dsp(struct msm_cvp_inst *inst,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int msm_cvp_map_buf_cpu_d(struct msm_cvp_inst *inst,
|
||||
unsigned int fd,
|
||||
unsigned int size,
|
||||
struct msm_cvp_internal_buffer **cbuf_ptr)
|
||||
{
|
||||
int rc = 0;
|
||||
bool found;
|
||||
struct msm_cvp_internal_buffer *cbuf;
|
||||
|
||||
if (!inst || !inst->core || !cbuf_ptr) {
|
||||
dprintk(CVP_ERR, "%s: invalid params\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mutex_lock(&inst->cvpcpubufs.lock);
|
||||
found = false;
|
||||
list_for_each_entry(cbuf, &inst->cvpcpubufs.list, list) {
|
||||
if (cbuf->buf.fd == fd) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
mutex_unlock(&inst->cvpcpubufs.lock);
|
||||
if (found) {
|
||||
print_internal_buffer(CVP_ERR, "duplicate", inst, cbuf);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
cbuf = kmem_cache_zalloc(cvp_driver->internal_buf_cache, GFP_KERNEL);
|
||||
if (!cbuf)
|
||||
return -ENOMEM;
|
||||
|
||||
cbuf->buf.fd = fd;
|
||||
cbuf->buf.size = size;
|
||||
/* HFI doesn't have buffer type, set it as HAL_BUFFER_INPUT */
|
||||
cbuf->smem.buffer_type = HAL_BUFFER_INPUT;
|
||||
cbuf->smem.fd = cbuf->buf.fd;
|
||||
cbuf->smem.size = cbuf->buf.size;
|
||||
cbuf->smem.flags = 0;
|
||||
cbuf->smem.offset = 0;
|
||||
|
||||
rc = msm_cvp_smem_map_dma_buf(inst, &cbuf->smem);
|
||||
if (rc) {
|
||||
print_internal_buffer(CVP_ERR, "map failed", inst, cbuf);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
mutex_lock(&inst->cvpcpubufs.lock);
|
||||
list_add_tail(&cbuf->list, &inst->cvpcpubufs.list);
|
||||
mutex_unlock(&inst->cvpcpubufs.lock);
|
||||
|
||||
*cbuf_ptr = cbuf;
|
||||
|
||||
return rc;
|
||||
|
||||
exit:
|
||||
if (cbuf->smem.device_addr)
|
||||
msm_cvp_smem_unmap_dma_buf(inst, &cbuf->smem);
|
||||
kmem_cache_free(cvp_driver->internal_buf_cache, cbuf);
|
||||
cbuf = NULL;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void __msm_cvp_cache_operations(struct msm_cvp_internal_buffer *cbuf)
|
||||
{
|
||||
enum smem_cache_ops cache_op;
|
||||
|
|
@ -716,8 +597,7 @@ static int msm_cvp_map_user_persist(struct msm_cvp_inst *inst,
|
|||
struct cvp_kmd_hfi_packet *in_pkt,
|
||||
unsigned int offset, unsigned int buf_num)
|
||||
{
|
||||
struct cvp_buf_desc *buf_ptr;
|
||||
struct cvp_buf_type *new_buf;
|
||||
struct cvp_buf_type *buf;
|
||||
int i, rc = 0;
|
||||
unsigned int iova;
|
||||
|
||||
|
|
@ -725,20 +605,17 @@ static int msm_cvp_map_user_persist(struct msm_cvp_inst *inst,
|
|||
return 0;
|
||||
|
||||
for (i = 0; i < buf_num; i++) {
|
||||
buf_ptr = (struct cvp_buf_desc *)
|
||||
&in_pkt->pkt_data[offset];
|
||||
|
||||
offset += sizeof(*new_buf) >> 2;
|
||||
new_buf = (struct cvp_buf_type *)buf_ptr;
|
||||
buf = (struct cvp_buf_type *)&in_pkt->pkt_data[offset];
|
||||
offset += sizeof(*buf) >> 2;
|
||||
|
||||
/*
|
||||
* Make sure fd or dma_buf field doesn't have any
|
||||
* garbage value.
|
||||
*/
|
||||
if (inst->session_type == MSM_CVP_USER) {
|
||||
new_buf->dbuf = 0;
|
||||
buf->dbuf = NULL;
|
||||
} else if (inst->session_type == MSM_CVP_KERNEL) {
|
||||
new_buf->fd = 0;
|
||||
buf->fd = 0;
|
||||
} else if (inst->session_type >= MSM_CVP_UNKNOWN) {
|
||||
dprintk(CVP_ERR,
|
||||
"%s: unknown session type %d\n",
|
||||
|
|
@ -746,10 +623,10 @@ static int msm_cvp_map_user_persist(struct msm_cvp_inst *inst,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (new_buf->fd <= 0 && !new_buf->dbuf)
|
||||
if (buf->fd <= 0 && !buf->dbuf)
|
||||
continue;
|
||||
|
||||
rc = msm_cvp_map_buf_user_persist(inst, new_buf, &iova);
|
||||
rc = msm_cvp_map_buf_user_persist(inst, buf, &iova);
|
||||
if (rc) {
|
||||
dprintk(CVP_ERR,
|
||||
"%s: buf %d register failed.\n",
|
||||
|
|
@ -757,7 +634,7 @@ static int msm_cvp_map_user_persist(struct msm_cvp_inst *inst,
|
|||
|
||||
return rc;
|
||||
}
|
||||
new_buf->fd = iova;
|
||||
buf->fd = iova;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -766,136 +643,79 @@ static int msm_cvp_map_buf(struct msm_cvp_inst *inst,
|
|||
struct cvp_kmd_hfi_packet *in_pkt,
|
||||
unsigned int offset, unsigned int buf_num)
|
||||
{
|
||||
struct msm_cvp_internal_buffer *cbuf = NULL;
|
||||
struct cvp_buf_desc *buf_ptr;
|
||||
struct cvp_buf_type *new_buf;
|
||||
struct cvp_buf_type *buf;
|
||||
int i, rc = 0;
|
||||
u32 version;
|
||||
unsigned int iova;
|
||||
u64 ktid;
|
||||
struct msm_cvp_frame *frame;
|
||||
|
||||
version = get_hfi_version();
|
||||
version = (version & HFI_VERSION_MINOR_MASK) >> HFI_VERSION_MINOR_SHIFT;
|
||||
|
||||
if (version >= 1 && buf_num) {
|
||||
struct cvp_hfi_cmd_session_hdr *cmd_hdr;
|
||||
|
||||
cmd_hdr = (struct cvp_hfi_cmd_session_hdr *)in_pkt;
|
||||
ktid = atomic64_inc_return(&inst->core->kernel_trans_id);
|
||||
ktid &= (FENCE_BIT - 1);
|
||||
cmd_hdr->client_data.kdata = ktid;
|
||||
|
||||
frame = kmem_cache_zalloc(cvp_driver->frame_cache, GFP_KERNEL);
|
||||
if (!frame)
|
||||
return -ENOMEM;
|
||||
|
||||
INIT_MSM_CVP_LIST(&frame->bufs);
|
||||
frame->ktid = ktid;
|
||||
} else {
|
||||
frame = NULL;
|
||||
}
|
||||
struct cvp_hfi_cmd_session_hdr *cmd_hdr;
|
||||
|
||||
if (!offset || !buf_num)
|
||||
return 0;
|
||||
|
||||
cmd_hdr = (struct cvp_hfi_cmd_session_hdr *)in_pkt;
|
||||
ktid = atomic64_inc_return(&inst->core->kernel_trans_id);
|
||||
ktid &= (FENCE_BIT - 1);
|
||||
cmd_hdr->client_data.kdata = ktid;
|
||||
|
||||
frame = kmem_cache_zalloc(cvp_driver->frame_cache, GFP_KERNEL);
|
||||
if (!frame)
|
||||
return -ENOMEM;
|
||||
|
||||
INIT_MSM_CVP_LIST(&frame->bufs);
|
||||
frame->ktid = ktid;
|
||||
|
||||
|
||||
for (i = 0; i < buf_num; i++) {
|
||||
buf_ptr = (struct cvp_buf_desc *)
|
||||
&in_pkt->pkt_data[offset];
|
||||
if (version >= 1)
|
||||
offset += sizeof(*new_buf) >> 2;
|
||||
else
|
||||
offset += sizeof(*buf_ptr) >> 2;
|
||||
buf = (struct cvp_buf_type *)&in_pkt->pkt_data[offset];
|
||||
offset += sizeof(*buf) >> 2;
|
||||
|
||||
if (version >= 1) {
|
||||
new_buf = (struct cvp_buf_type *)buf_ptr;
|
||||
|
||||
/*
|
||||
* Make sure fd or dma_buf field doesn't have any
|
||||
* garbage value.
|
||||
*/
|
||||
if (inst->session_type == MSM_CVP_USER) {
|
||||
new_buf->dbuf = 0;
|
||||
} else if (inst->session_type == MSM_CVP_KERNEL) {
|
||||
new_buf->fd = 0;
|
||||
} else if (inst->session_type >= MSM_CVP_UNKNOWN) {
|
||||
dprintk(CVP_ERR,
|
||||
"%s: unknown session type %d\n",
|
||||
__func__, inst->session_type);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (new_buf->fd <= 0 && !new_buf->dbuf)
|
||||
continue;
|
||||
|
||||
rc = msm_cvp_map_buf_cpu(inst, new_buf, &iova, frame);
|
||||
if (rc) {
|
||||
struct msm_cvp_frame_buf *frame_buf, *dummy;
|
||||
|
||||
dprintk(CVP_ERR,
|
||||
"%s: buf %d register failed.\n",
|
||||
__func__, i);
|
||||
|
||||
list_for_each_entry_safe(frame_buf,
|
||||
dummy, &frame->bufs.list, list) {
|
||||
list_del(&frame_buf->list);
|
||||
__unmap_buf(inst, frame_buf);
|
||||
kmem_cache_free(
|
||||
cvp_driver->frame_buf_cache,
|
||||
frame_buf);
|
||||
}
|
||||
DEINIT_MSM_CVP_LIST(&frame->bufs);
|
||||
kmem_cache_free(cvp_driver->frame_cache,
|
||||
frame);
|
||||
return rc;
|
||||
}
|
||||
new_buf->fd = iova;
|
||||
} else {
|
||||
if (!buf_ptr->fd)
|
||||
continue;
|
||||
|
||||
rc = msm_cvp_session_get_iova_addr_d(inst,
|
||||
&cbuf,
|
||||
buf_ptr->fd,
|
||||
buf_ptr->size,
|
||||
&buf_ptr->fd,
|
||||
&buf_ptr->size);
|
||||
|
||||
if (rc == -ENOENT) {
|
||||
dprintk(CVP_DBG,
|
||||
"%s map buf fd %d size %d\n",
|
||||
__func__, buf_ptr->fd,
|
||||
buf_ptr->size);
|
||||
rc = msm_cvp_map_buf_cpu_d(inst,
|
||||
buf_ptr->fd,
|
||||
buf_ptr->size, &cbuf);
|
||||
if (rc || !cbuf) {
|
||||
dprintk(CVP_ERR,
|
||||
"%s: buf %d register failed. rc=%d\n",
|
||||
__func__, i, rc);
|
||||
return rc;
|
||||
}
|
||||
buf_ptr->fd = cbuf->smem.device_addr;
|
||||
buf_ptr->size = cbuf->buf.size;
|
||||
} else if (rc) {
|
||||
dprintk(CVP_ERR,
|
||||
"%s: buf %d register failed. rc=%d\n",
|
||||
__func__, i, rc);
|
||||
return rc;
|
||||
}
|
||||
msm_cvp_smem_cache_operations(
|
||||
cbuf->smem.dma_buf,
|
||||
SMEM_CACHE_CLEAN_INVALIDATE,
|
||||
0, buf_ptr->size);
|
||||
/*
|
||||
* Make sure fd or dma_buf field doesn't have any
|
||||
* garbage value.
|
||||
*/
|
||||
if (inst->session_type == MSM_CVP_USER) {
|
||||
buf->dbuf = NULL;
|
||||
} else if (inst->session_type == MSM_CVP_KERNEL) {
|
||||
buf->fd = 0;
|
||||
} else if (inst->session_type >= MSM_CVP_UNKNOWN) {
|
||||
dprintk(CVP_ERR,
|
||||
"%s: unknown session type %d\n",
|
||||
__func__, inst->session_type);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (buf->fd <= 0 && !buf->dbuf)
|
||||
continue;
|
||||
|
||||
rc = msm_cvp_map_buf_cpu(inst, buf, &iova, frame);
|
||||
if (rc) {
|
||||
struct msm_cvp_frame_buf *frame_buf, *dummy;
|
||||
|
||||
dprintk(CVP_ERR,
|
||||
"%s: buf %d register failed.\n",
|
||||
__func__, i);
|
||||
|
||||
list_for_each_entry_safe(frame_buf,
|
||||
dummy, &frame->bufs.list, list) {
|
||||
list_del(&frame_buf->list);
|
||||
__unmap_buf(inst, frame_buf);
|
||||
kmem_cache_free(
|
||||
cvp_driver->frame_buf_cache,
|
||||
frame_buf);
|
||||
}
|
||||
DEINIT_MSM_CVP_LIST(&frame->bufs);
|
||||
kmem_cache_free(cvp_driver->frame_cache,
|
||||
frame);
|
||||
return rc;
|
||||
}
|
||||
buf->fd = iova;
|
||||
}
|
||||
|
||||
if (frame != NULL) {
|
||||
mutex_lock(&inst->frames.lock);
|
||||
list_add_tail(&frame->list, &inst->frames.list);
|
||||
mutex_unlock(&inst->frames.lock);
|
||||
dprintk(CVP_DBG, "%s: map frame %llu\n", __func__, ktid);
|
||||
}
|
||||
mutex_lock(&inst->frames.lock);
|
||||
list_add_tail(&frame->list, &inst->frames.list);
|
||||
mutex_unlock(&inst->frames.lock);
|
||||
dprintk(CVP_DBG, "%s: map frame %llu\n", __func__, ktid);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -1670,8 +1490,8 @@ static int msm_cvp_request_power(struct msm_cvp_inst *inst,
|
|||
}
|
||||
|
||||
static int msm_cvp_update_power(struct msm_cvp_inst *inst)
|
||||
|
||||
{ int rc = 0;
|
||||
{
|
||||
int rc = 0;
|
||||
struct msm_cvp_core *core;
|
||||
struct msm_cvp_inst *s;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _MSM_CVP_INTERNAL_H_
|
||||
|
|
@ -147,12 +147,6 @@ struct msm_cvp_ubwc_config_data {
|
|||
u32 bank_spreading;
|
||||
};
|
||||
|
||||
#define IS_VPU_4(ver) \
|
||||
(ver == VPU_VERSION_4)
|
||||
|
||||
#define IS_VPU_5(ver) \
|
||||
(ver == VPU_VERSION_5)
|
||||
|
||||
struct msm_cvp_platform_data {
|
||||
struct msm_cvp_common_data *common_data;
|
||||
unsigned int common_data_length;
|
||||
|
|
@ -185,20 +179,6 @@ enum profiling_points {
|
|||
MAX_PROFILING_POINTS,
|
||||
};
|
||||
|
||||
struct cvp_buf_type {
|
||||
s32 fd;
|
||||
u32 size;
|
||||
u32 offset;
|
||||
u32 flags;
|
||||
union {
|
||||
struct dma_buf *dbuf;
|
||||
struct {
|
||||
u32 reserved1;
|
||||
u32 reserved2;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
struct cvp_clock_data {
|
||||
int buffer_counter;
|
||||
int load;
|
||||
|
|
|
|||
Loading…
Reference in a new issue