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

Commit 65089b04 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: cvp: Invalidate output buffer cache for DME"

parents 5f6b4d71 46fb3d8b
Loading
Loading
Loading
Loading
+37 −1
Original line number Diff line number Diff line
/* 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__
#define __H_CVP_HFI_HELPER_H__

#include <linux/dma-mapping.h>

#define HFI_COMMON_BASE				(0)
#define HFI_DOMAIN_BASE_COMMON		(HFI_COMMON_BASE + 0)
#define HFI_DOMAIN_BASE_CVP			(HFI_COMMON_BASE + 0x04000000)
@@ -495,4 +497,38 @@ 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;
		};
	} __packed;
} __packed;

struct cvp_hfi_msg_dme_pkt {
	u32 size;
	u32 packet_type;
	u32 session_id;
	u32 error_type;
	struct cvp_hfi_client client_data;
	u32 stream_idx;
	u32 skipmv;
	struct cvp_buf_type srcbuffer;
	struct cvp_buf_type srcctxbuffer;
	struct cvp_buf_type refbuffer;
	struct cvp_buf_type refctxbuffer;
	struct cvp_buf_type statsbuffer;
	u32 fullreswidth;
	u32 fullresheight;
	u32 processwidth;
	u32 processheight;
	u32 confidence;
} __packed;

#endif
+36 −1
Original line number Diff line number Diff line
// 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 <linux/bitops.h>
@@ -443,6 +443,36 @@ static struct msm_cvp_inst *cvp_get_inst_from_id(struct msm_cvp_core *core,

}

static int __dme_output_cache_operation(struct cvp_hfi_msg_session_hdr *pkt)
{
	struct cvp_hfi_msg_dme_pkt *dme_pkt;
	int rc;

	if (!pkt) {
		dprintk(CVP_ERR, "%s: invalid param\n", __func__);
		return -EINVAL;
	} else if (pkt->size < get_msg_size()) {
		dprintk(CVP_ERR, "%s: bad_pkt_size %d\n", __func__, pkt->size);
		return -E2BIG;
	}

	dme_pkt = (struct cvp_hfi_msg_dme_pkt *)pkt;
	rc = dma_buf_begin_cpu_access_partial(dme_pkt->statsbuffer.dbuf,
						DMA_TO_DEVICE, 0,
						dme_pkt->statsbuffer.size);
	if (rc) {
		dprintk(CVP_ERR, "%s: begin_cpu_access failed\n", __func__);
		return rc;
	}
	rc = dma_buf_end_cpu_access_partial(dme_pkt->statsbuffer.dbuf,
						DMA_FROM_DEVICE, 0,
						dme_pkt->statsbuffer.size);
	if (rc)
		dprintk(CVP_ERR, "%s: end_cpu_access failed\n", __func__);

	return rc;
}

static int hfi_process_session_cvp_msg(u32 device_id,
	struct cvp_hfi_msg_session_hdr *pkt,
	struct msm_cvp_cb_info *info)
@@ -478,6 +508,11 @@ static int hfi_process_session_cvp_msg(u32 device_id,
			kdata1 = pkt->client_data.kdata1;
			kdata2 = pkt->client_data.kdata2;
			ktid = ((u64)kdata2 << 32) | kdata1;


			if (pkt->packet_type == HFI_MSG_SESSION_CVP_DME)
				__dme_output_cache_operation(pkt);

			msm_cvp_unmap_buf_cpu(inst, ktid);

			return _deprecated_hfi_msg_process(device_id,
+1 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
#include "cvp_hfi.h"
#include <synx_api.h>
#include "cvp_core_hfi.h"
#include "cvp_hfi_helper.h"

struct cvp_power_level {
	unsigned long core_sum;
+1 −15
Original line number Diff line number Diff line
/* 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_
@@ -179,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;