msm: cvp: Support handling cp camera buffer

Adding support for cp camera buffer mapping and
new hfi for chroma buffer.

Change-Id: Iadce59b596447c0bbdf4985bdb8c9209df517bae
Signed-off-by: Pulkit Singh Tak <ptak@codeaurora.org>
This commit is contained in:
Pulkit Singh Tak 2021-01-22 16:31:48 +05:30
commit 3dc3967bb4
7 changed files with 57 additions and 11 deletions

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*/
#include <asm/memory.h>
@ -78,6 +78,13 @@ const struct msm_cvp_hfi_defs cvp_hfi_defs[] = {
.buf_num = HFI_PERSIST_BUF_NUM,
.resp = HAL_SESSION_PERSIST_SET_DONE,
},
{
.size = 0xffffffff,
.type = HFI_CMD_SESSION_CVP_SET_FD_CHROMA_BUFFER,
.buf_offset = 0,
.buf_num = 0,
.resp = HAL_SESSION_CHROMA_SET_DONE,
},
{
.size = 0xffffffff,
.type = HFI_CMD_SESSION_CVP_RELEASE_PERSIST_BUFFERS,
@ -85,6 +92,13 @@ const struct msm_cvp_hfi_defs cvp_hfi_defs[] = {
.buf_num = 0,
.resp = HAL_SESSION_PERSIST_REL_DONE,
},
{
.size = 0xffffffff,
.type = HFI_CMD_SESSION_CVP_RELEASE_FD_CHROMA_BUFFER,
.buf_offset = 0,
.buf_num = 0,
.resp = HAL_SESSION_CHROMA_REL_DONE,
},
{
.size = HFI_DS_CMD_SIZE,
.type = HFI_CMD_SESSION_CVP_DS,
@ -2934,6 +2948,8 @@ static void **get_session_id(struct msm_cvp_cb_info *info)
case HAL_SESSION_FD_FRAME_CMD_DONE:
case HAL_SESSION_PERSIST_SET_DONE:
case HAL_SESSION_PERSIST_REL_DONE:
case HAL_SESSION_CHROMA_SET_DONE:
case HAL_SESSION_CHROMA_REL_DONE:
case HAL_SESSION_FD_CONFIG_CMD_DONE:
case HAL_SESSION_MODEL_BUF_CMD_DONE:
case HAL_SESSION_PROPERTY_INFO:

View file

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*/
#ifndef __H_CVP_HFI_H__
@ -106,6 +106,15 @@
#define HFI_CMD_SESSION_CVP_ICA_CONFIG\
(HFI_CMD_SESSION_CVP_START + 0x101)
#define HFI_CMD_SESSION_CVP_SET_FD_CHROMA_BUFFER\
(HFI_CMD_SESSION_CVP_START + 0x058)
#define HFI_CMD_SESSION_CVP_RELEASE_FD_CHROMA_BUFFER\
(HFI_CMD_SESSION_CVP_START + 0x059)
#define HFI_MSG_SESSION_CVP_SET_FD_CHROMA_BUFFER\
(HFI_MSG_SESSION_CVP_START + 0x03B)
#define HFI_MSG_SESSION_CVP_RELEASE_FD_CHROMA_BUFFER\
(HFI_MSG_SESSION_CVP_START + 0x03C)
#define HFI_MSG_SESSION_CVP_START \
(HFI_DOMAIN_BASE_CVP + HFI_ARCH_COMMON_OFFSET + \

View file

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*/
#ifndef __CVP_HFI_API_H__
@ -231,6 +231,8 @@ enum hal_command_response {
HAL_SESSION_ICA_FRAME_CMD_DONE,
HAL_SESSION_FD_FRAME_CMD_DONE,
HAL_SESSION_PROPERTY_INFO,
HAL_SESSION_CHROMA_SET_DONE,
HAL_SESSION_CHROMA_REL_DONE,
HAL_SESSION_ERROR,
HAL_RESPONSE_UNUSED = 0x10000000,
};

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/bitops.h>
@ -429,6 +429,12 @@ static int hfi_process_session_cvp_operation_config(u32 device_id,
else if (pkt->packet_type == HFI_MSG_SESSION_CVP_SET_MODEL_BUFFERS)
signal = get_signal_from_pkt_type(
HFI_CMD_SESSION_CVP_SET_MODEL_BUFFERS);
else if (pkt->packet_type == HFI_MSG_SESSION_CVP_SET_FD_CHROMA_BUFFER)
signal = get_signal_from_pkt_type(
HFI_CMD_SESSION_CVP_SET_FD_CHROMA_BUFFER);
else if (pkt->packet_type == HFI_MSG_SESSION_CVP_RELEASE_FD_CHROMA_BUFFER)
signal = get_signal_from_pkt_type(
HFI_CMD_SESSION_CVP_RELEASE_FD_CHROMA_BUFFER);
else
signal = get_signal_from_pkt_type(conf_id);
@ -656,6 +662,8 @@ int cvp_hfi_process_msg_packet(u32 device_id, void *hdr,
case HFI_MSG_SESSION_CVP_OPERATION_CONFIG:
case HFI_MSG_SESSION_CVP_SET_PERSIST_BUFFERS:
case HFI_MSG_SESSION_CVP_RELEASE_PERSIST_BUFFERS:
case HFI_MSG_SESSION_CVP_SET_FD_CHROMA_BUFFER:
case HFI_MSG_SESSION_CVP_RELEASE_FD_CHROMA_BUFFER:
case HFI_MSG_SESSION_CVP_SET_MODEL_BUFFERS:
pkt_func =
(pkt_func_def)hfi_process_session_cvp_operation_config;

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*/
#include "msm_cvp.h"
@ -211,9 +211,11 @@ static int msm_cvp_session_process_hfi(
}
pkt_type = in_pkt->pkt_data[1];
if (pkt_type == HFI_CMD_SESSION_CVP_SET_PERSIST_BUFFERS ||
pkt_type == HFI_CMD_SESSION_CVP_SET_MODEL_BUFFERS)
pkt_type == HFI_CMD_SESSION_CVP_SET_MODEL_BUFFERS ||
pkt_type == HFI_CMD_SESSION_CVP_SET_FD_CHROMA_BUFFER)
rc = msm_cvp_map_user_persist(inst, in_pkt, offset, buf_num);
else if (pkt_type == HFI_CMD_SESSION_CVP_RELEASE_PERSIST_BUFFERS)
else if (pkt_type == HFI_CMD_SESSION_CVP_RELEASE_PERSIST_BUFFERS ||
pkt_type == HFI_CMD_SESSION_CVP_RELEASE_FD_CHROMA_BUFFER)
rc = msm_cvp_mark_user_persist(inst, in_pkt, offset, buf_num);
else
rc = msm_cvp_map_frame(inst, in_pkt, offset, buf_num);
@ -240,7 +242,8 @@ static int msm_cvp_session_process_hfi(
signal);
goto exit;
}
if (pkt_type == HFI_CMD_SESSION_CVP_RELEASE_PERSIST_BUFFERS)
if (pkt_type == HFI_CMD_SESSION_CVP_RELEASE_PERSIST_BUFFERS ||
pkt_type == HFI_CMD_SESSION_CVP_RELEASE_FD_CHROMA_BUFFER)
rc = msm_cvp_unmap_user_persist(inst, in_pkt,
offset, buf_num);

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/jiffies.h>
@ -804,6 +804,8 @@ void cvp_handle_cmd_response(enum hal_command_response cmd, void *data)
case HAL_SESSION_DME_FRAME_CMD_DONE:
case HAL_SESSION_PERSIST_SET_DONE:
case HAL_SESSION_PERSIST_REL_DONE:
case HAL_SESSION_CHROMA_SET_DONE:
case HAL_SESSION_CHROMA_REL_DONE:
case HAL_SESSION_TME_CONFIG_CMD_DONE:
case HAL_SESSION_ODT_CONFIG_CMD_DONE:
case HAL_SESSION_OD_CONFIG_CMD_DONE:

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/dma-buf.h>
@ -76,7 +76,11 @@ static int msm_dma_get_device_address(struct dma_buf *dbuf, u32 align,
}
if (table->sgl) {
*iova = table->sgl->dma_address;
if (ion_flags & ION_FLAG_CP_CAMERA) {
*iova = sg_phys(table->sgl);
} else {
*iova = table->sgl->dma_address;
}
} else {
dprintk(CVP_ERR, "sgl is NULL\n");
rc = -ENOMEM;
@ -454,6 +458,8 @@ struct context_bank_info *msm_cvp_smem_get_context_bank(bool is_secure,
search_str = secure_pixel_cb;
else if (ion_flags & ION_FLAG_CP_NON_PIXEL)
search_str = secure_nonpixel_cb;
else if (ion_flags & ION_FLAG_CP_CAMERA)
search_str = secure_pixel_cb;
else
search_str = non_secure_cb;