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

Commit 09c2845e authored by Stanimir Varbanov's avatar Stanimir Varbanov Committed by Mauro Carvalho Chehab
Browse files

[media] media: venus: hfi: add Host Firmware Interface (HFI)



This is the implementation of HFI. It is charged with the
responsibility to comunicate with the firmware through an
interface commands and messages.

 - hfi.c has interface functions used by the core, decoder
and encoder parts to comunicate with the firmware. For example
there are functions for session and core initialisation.

 - hfi_cmds has packetization operations which preparing
packets to be send from host to firmware.

 - hfi_msgs takes care of messages sent from firmware to the
host.

Signed-off-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent aaaa93ed
Loading
Loading
Loading
Loading
+522 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
 * Copyright (C) 2017 Linaro Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */
#include <linux/slab.h>
#include <linux/mutex.h>
#include <linux/list.h>
#include <linux/completion.h>
#include <linux/platform_device.h>
#include <linux/videodev2.h>

#include "core.h"
#include "hfi.h"
#include "hfi_cmds.h"
#include "hfi_venus.h"

#define TIMEOUT		msecs_to_jiffies(1000)

static u32 to_codec_type(u32 pixfmt)
{
	switch (pixfmt) {
	case V4L2_PIX_FMT_H264:
	case V4L2_PIX_FMT_H264_NO_SC:
		return HFI_VIDEO_CODEC_H264;
	case V4L2_PIX_FMT_H263:
		return HFI_VIDEO_CODEC_H263;
	case V4L2_PIX_FMT_MPEG1:
		return HFI_VIDEO_CODEC_MPEG1;
	case V4L2_PIX_FMT_MPEG2:
		return HFI_VIDEO_CODEC_MPEG2;
	case V4L2_PIX_FMT_MPEG4:
		return HFI_VIDEO_CODEC_MPEG4;
	case V4L2_PIX_FMT_VC1_ANNEX_G:
	case V4L2_PIX_FMT_VC1_ANNEX_L:
		return HFI_VIDEO_CODEC_VC1;
	case V4L2_PIX_FMT_VP8:
		return HFI_VIDEO_CODEC_VP8;
	case V4L2_PIX_FMT_VP9:
		return HFI_VIDEO_CODEC_VP9;
	case V4L2_PIX_FMT_XVID:
		return HFI_VIDEO_CODEC_DIVX;
	default:
		return 0;
	}
}

int hfi_core_init(struct venus_core *core)
{
	int ret = 0;

	mutex_lock(&core->lock);

	if (core->state >= CORE_INIT)
		goto unlock;

	reinit_completion(&core->done);

	ret = core->ops->core_init(core);
	if (ret)
		goto unlock;

	ret = wait_for_completion_timeout(&core->done, TIMEOUT);
	if (!ret) {
		ret = -ETIMEDOUT;
		goto unlock;
	}

	ret = 0;

	if (core->error != HFI_ERR_NONE) {
		ret = -EIO;
		goto unlock;
	}

	core->state = CORE_INIT;
unlock:
	mutex_unlock(&core->lock);
	return ret;
}

static int core_deinit_wait_atomic_t(atomic_t *p)
{
	schedule();
	return 0;
}

int hfi_core_deinit(struct venus_core *core, bool blocking)
{
	int ret = 0, empty;

	mutex_lock(&core->lock);

	if (core->state == CORE_UNINIT)
		goto unlock;

	empty = list_empty(&core->instances);

	if (!empty && !blocking) {
		ret = -EBUSY;
		goto unlock;
	}

	if (!empty) {
		mutex_unlock(&core->lock);
		wait_on_atomic_t(&core->insts_count, core_deinit_wait_atomic_t,
				 TASK_UNINTERRUPTIBLE);
		mutex_lock(&core->lock);
	}

	ret = core->ops->core_deinit(core);

	if (!ret)
		core->state = CORE_UNINIT;

unlock:
	mutex_unlock(&core->lock);
	return ret;
}

int hfi_core_suspend(struct venus_core *core)
{
	if (core->state != CORE_INIT)
		return 0;

	return core->ops->suspend(core);
}

int hfi_core_resume(struct venus_core *core, bool force)
{
	if (!force && core->state != CORE_INIT)
		return 0;

	return core->ops->resume(core);
}

int hfi_core_trigger_ssr(struct venus_core *core, u32 type)
{
	return core->ops->core_trigger_ssr(core, type);
}

int hfi_core_ping(struct venus_core *core)
{
	int ret;

	mutex_lock(&core->lock);

	ret = core->ops->core_ping(core, 0xbeef);
	if (ret)
		return ret;

	ret = wait_for_completion_timeout(&core->done, TIMEOUT);
	if (!ret) {
		ret = -ETIMEDOUT;
		goto unlock;
	}
	ret = 0;
	if (core->error != HFI_ERR_NONE)
		ret = -ENODEV;
unlock:
	mutex_unlock(&core->lock);
	return ret;
}

static int wait_session_msg(struct venus_inst *inst)
{
	int ret;

	ret = wait_for_completion_timeout(&inst->done, TIMEOUT);
	if (!ret)
		return -ETIMEDOUT;

	if (inst->error != HFI_ERR_NONE)
		return -EIO;

	return 0;
}

int hfi_session_create(struct venus_inst *inst, const struct hfi_inst_ops *ops)
{
	struct venus_core *core = inst->core;

	if (!ops)
		return -EINVAL;

	inst->state = INST_UNINIT;
	init_completion(&inst->done);
	inst->ops = ops;

	mutex_lock(&core->lock);
	list_add_tail(&inst->list, &core->instances);
	atomic_inc(&core->insts_count);
	mutex_unlock(&core->lock);

	return 0;
}
EXPORT_SYMBOL_GPL(hfi_session_create);

int hfi_session_init(struct venus_inst *inst, u32 pixfmt)
{
	struct venus_core *core = inst->core;
	const struct hfi_ops *ops = core->ops;
	u32 codec;
	int ret;

	codec = to_codec_type(pixfmt);
	reinit_completion(&inst->done);

	ret = ops->session_init(inst, inst->session_type, codec);
	if (ret)
		return ret;

	ret = wait_session_msg(inst);
	if (ret)
		return ret;

	inst->state = INST_INIT;

	return 0;
}
EXPORT_SYMBOL_GPL(hfi_session_init);

void hfi_session_destroy(struct venus_inst *inst)
{
	struct venus_core *core = inst->core;

	mutex_lock(&core->lock);
	list_del_init(&inst->list);
	atomic_dec(&core->insts_count);
	wake_up_atomic_t(&core->insts_count);
	mutex_unlock(&core->lock);
}
EXPORT_SYMBOL_GPL(hfi_session_destroy);

int hfi_session_deinit(struct venus_inst *inst)
{
	const struct hfi_ops *ops = inst->core->ops;
	int ret;

	if (inst->state == INST_UNINIT)
		return 0;

	if (inst->state < INST_INIT)
		return -EINVAL;

	reinit_completion(&inst->done);

	ret = ops->session_end(inst);
	if (ret)
		return ret;

	ret = wait_session_msg(inst);
	if (ret)
		return ret;

	inst->state = INST_UNINIT;

	return 0;
}
EXPORT_SYMBOL_GPL(hfi_session_deinit);

int hfi_session_start(struct venus_inst *inst)
{
	const struct hfi_ops *ops = inst->core->ops;
	int ret;

	if (inst->state != INST_LOAD_RESOURCES)
		return -EINVAL;

	reinit_completion(&inst->done);

	ret = ops->session_start(inst);
	if (ret)
		return ret;

	ret = wait_session_msg(inst);
	if (ret)
		return ret;

	inst->state = INST_START;

	return 0;
}

int hfi_session_stop(struct venus_inst *inst)
{
	const struct hfi_ops *ops = inst->core->ops;
	int ret;

	if (inst->state != INST_START)
		return -EINVAL;

	reinit_completion(&inst->done);

	ret = ops->session_stop(inst);
	if (ret)
		return ret;

	ret = wait_session_msg(inst);
	if (ret)
		return ret;

	inst->state = INST_STOP;

	return 0;
}

int hfi_session_continue(struct venus_inst *inst)
{
	struct venus_core *core = inst->core;

	if (core->res->hfi_version != HFI_VERSION_3XX)
		return 0;

	return core->ops->session_continue(inst);
}
EXPORT_SYMBOL_GPL(hfi_session_continue);

int hfi_session_abort(struct venus_inst *inst)
{
	const struct hfi_ops *ops = inst->core->ops;
	int ret;

	reinit_completion(&inst->done);

	ret = ops->session_abort(inst);
	if (ret)
		return ret;

	ret = wait_session_msg(inst);
	if (ret)
		return ret;

	return 0;
}

int hfi_session_load_res(struct venus_inst *inst)
{
	const struct hfi_ops *ops = inst->core->ops;
	int ret;

	if (inst->state != INST_INIT)
		return -EINVAL;

	reinit_completion(&inst->done);

	ret = ops->session_load_res(inst);
	if (ret)
		return ret;

	ret = wait_session_msg(inst);
	if (ret)
		return ret;

	inst->state = INST_LOAD_RESOURCES;

	return 0;
}

int hfi_session_unload_res(struct venus_inst *inst)
{
	const struct hfi_ops *ops = inst->core->ops;
	int ret;

	if (inst->state != INST_STOP)
		return -EINVAL;

	reinit_completion(&inst->done);

	ret = ops->session_release_res(inst);
	if (ret)
		return ret;

	ret = wait_session_msg(inst);
	if (ret)
		return ret;

	inst->state = INST_RELEASE_RESOURCES;

	return 0;
}

int hfi_session_flush(struct venus_inst *inst)
{
	const struct hfi_ops *ops = inst->core->ops;
	int ret;

	reinit_completion(&inst->done);

	ret = ops->session_flush(inst, HFI_FLUSH_ALL);
	if (ret)
		return ret;

	ret = wait_session_msg(inst);
	if (ret)
		return ret;

	return 0;
}
EXPORT_SYMBOL_GPL(hfi_session_flush);

int hfi_session_set_buffers(struct venus_inst *inst, struct hfi_buffer_desc *bd)
{
	const struct hfi_ops *ops = inst->core->ops;

	return ops->session_set_buffers(inst, bd);
}

int hfi_session_unset_buffers(struct venus_inst *inst,
			      struct hfi_buffer_desc *bd)
{
	const struct hfi_ops *ops = inst->core->ops;
	int ret;

	reinit_completion(&inst->done);

	ret = ops->session_unset_buffers(inst, bd);
	if (ret)
		return ret;

	if (!bd->response_required)
		return 0;

	ret = wait_session_msg(inst);
	if (ret)
		return ret;

	return 0;
}

int hfi_session_get_property(struct venus_inst *inst, u32 ptype,
			     union hfi_get_property *hprop)
{
	const struct hfi_ops *ops = inst->core->ops;
	int ret;

	if (inst->state < INST_INIT || inst->state >= INST_STOP)
		return -EINVAL;

	reinit_completion(&inst->done);

	ret = ops->session_get_property(inst, ptype);
	if (ret)
		return ret;

	ret = wait_session_msg(inst);
	if (ret)
		return ret;

	*hprop = inst->hprop;

	return 0;
}
EXPORT_SYMBOL_GPL(hfi_session_get_property);

int hfi_session_set_property(struct venus_inst *inst, u32 ptype, void *pdata)
{
	const struct hfi_ops *ops = inst->core->ops;

	if (inst->state < INST_INIT || inst->state >= INST_STOP)
		return -EINVAL;

	return ops->session_set_property(inst, ptype, pdata);
}
EXPORT_SYMBOL_GPL(hfi_session_set_property);

int hfi_session_process_buf(struct venus_inst *inst, struct hfi_frame_data *fd)
{
	const struct hfi_ops *ops = inst->core->ops;

	if (fd->buffer_type == HFI_BUFFER_INPUT)
		return ops->session_etb(inst, fd);
	else if (fd->buffer_type == HFI_BUFFER_OUTPUT)
		return ops->session_ftb(inst, fd);

	return -EINVAL;
}

irqreturn_t hfi_isr_thread(int irq, void *dev_id)
{
	struct venus_core *core = dev_id;

	return core->ops->isr_thread(core);
}

irqreturn_t hfi_isr(int irq, void *dev)
{
	struct venus_core *core = dev;

	return core->ops->isr(core);
}

int hfi_create(struct venus_core *core, const struct hfi_core_ops *ops)
{
	int ret;

	if (!ops)
		return -EINVAL;

	atomic_set(&core->insts_count, 0);
	core->core_ops = ops;
	core->state = CORE_UNINIT;
	init_completion(&core->done);
	pkt_set_version(core->res->hfi_version);
	ret = venus_hfi_create(core);

	return ret;
}

void hfi_destroy(struct venus_core *core)
{
	venus_hfi_destroy(core);
}
+175 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
 * Copyright (C) 2017 Linaro Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */
#ifndef __HFI_H__
#define __HFI_H__

#include <linux/interrupt.h>

#include "hfi_helper.h"

#define VIDC_SESSION_TYPE_VPE			0
#define VIDC_SESSION_TYPE_ENC			1
#define VIDC_SESSION_TYPE_DEC			2

#define VIDC_RESOURCE_NONE			0
#define VIDC_RESOURCE_OCMEM			1
#define VIDC_RESOURCE_VMEM			2

struct hfi_buffer_desc {
	u32 buffer_type;
	u32 buffer_size;
	u32 num_buffers;
	u32 device_addr;
	u32 extradata_addr;
	u32 extradata_size;
	u32 response_required;
};

struct hfi_frame_data {
	u32 buffer_type;
	u32 device_addr;
	u32 extradata_addr;
	u64 timestamp;
	u32 flags;
	u32 offset;
	u32 alloc_len;
	u32 filled_len;
	u32 mark_target;
	u32 mark_data;
	u32 clnt_data;
	u32 extradata_size;
};

union hfi_get_property {
	struct hfi_profile_level profile_level;
	struct hfi_buffer_requirements bufreq[HFI_BUFFER_TYPE_MAX];
};

/* HFI events */
#define EVT_SYS_EVENT_CHANGE			1
#define EVT_SYS_WATCHDOG_TIMEOUT		2
#define EVT_SYS_ERROR				3
#define EVT_SESSION_ERROR			4

/* HFI event callback structure */
struct hfi_event_data {
	u32 error;
	u32 height;
	u32 width;
	u32 event_type;
	u32 packet_buffer;
	u32 extradata_buffer;
	u32 tag;
	u32 profile;
	u32 level;
};

/* define core states */
#define CORE_UNINIT				0
#define CORE_INIT				1

/* define instance states */
#define INST_UNINIT				2
#define INST_INIT				3
#define INST_LOAD_RESOURCES			4
#define INST_START				5
#define INST_STOP				6
#define INST_RELEASE_RESOURCES			7

struct venus_core;
struct venus_inst;

struct hfi_core_ops {
	void (*event_notify)(struct venus_core *core, u32 event);
};

struct hfi_inst_ops {
	void (*buf_done)(struct venus_inst *inst, unsigned int buf_type,
			 u32 tag, u32 bytesused, u32 data_offset, u32 flags,
			 u32 hfi_flags, u64 timestamp_us);
	void (*event_notify)(struct venus_inst *inst, u32 event,
			     struct hfi_event_data *data);
};

struct hfi_ops {
	int (*core_init)(struct venus_core *core);
	int (*core_deinit)(struct venus_core *core);
	int (*core_ping)(struct venus_core *core, u32 cookie);
	int (*core_trigger_ssr)(struct venus_core *core, u32 trigger_type);

	int (*session_init)(struct venus_inst *inst, u32 session_type,
			    u32 codec);
	int (*session_end)(struct venus_inst *inst);
	int (*session_abort)(struct venus_inst *inst);
	int (*session_flush)(struct venus_inst *inst, u32 flush_mode);
	int (*session_start)(struct venus_inst *inst);
	int (*session_stop)(struct venus_inst *inst);
	int (*session_continue)(struct venus_inst *inst);
	int (*session_etb)(struct venus_inst *inst, struct hfi_frame_data *fd);
	int (*session_ftb)(struct venus_inst *inst, struct hfi_frame_data *fd);
	int (*session_set_buffers)(struct venus_inst *inst,
				   struct hfi_buffer_desc *bd);
	int (*session_unset_buffers)(struct venus_inst *inst,
				     struct hfi_buffer_desc *bd);
	int (*session_load_res)(struct venus_inst *inst);
	int (*session_release_res)(struct venus_inst *inst);
	int (*session_parse_seq_hdr)(struct venus_inst *inst, u32 seq_hdr,
				     u32 seq_hdr_len);
	int (*session_get_seq_hdr)(struct venus_inst *inst, u32 seq_hdr,
				   u32 seq_hdr_len);
	int (*session_set_property)(struct venus_inst *inst, u32 ptype,
				    void *pdata);
	int (*session_get_property)(struct venus_inst *inst, u32 ptype);

	int (*resume)(struct venus_core *core);
	int (*suspend)(struct venus_core *core);

	/* interrupt operations */
	irqreturn_t (*isr)(struct venus_core *core);
	irqreturn_t (*isr_thread)(struct venus_core *core);
};

int hfi_create(struct venus_core *core, const struct hfi_core_ops *ops);
void hfi_destroy(struct venus_core *core);

int hfi_core_init(struct venus_core *core);
int hfi_core_deinit(struct venus_core *core, bool blocking);
int hfi_core_suspend(struct venus_core *core);
int hfi_core_resume(struct venus_core *core, bool force);
int hfi_core_trigger_ssr(struct venus_core *core, u32 type);
int hfi_core_ping(struct venus_core *core);
int hfi_session_create(struct venus_inst *inst, const struct hfi_inst_ops *ops);
void hfi_session_destroy(struct venus_inst *inst);
int hfi_session_init(struct venus_inst *inst, u32 pixfmt);
int hfi_session_deinit(struct venus_inst *inst);
int hfi_session_start(struct venus_inst *inst);
int hfi_session_stop(struct venus_inst *inst);
int hfi_session_continue(struct venus_inst *inst);
int hfi_session_abort(struct venus_inst *inst);
int hfi_session_load_res(struct venus_inst *inst);
int hfi_session_unload_res(struct venus_inst *inst);
int hfi_session_flush(struct venus_inst *inst);
int hfi_session_set_buffers(struct venus_inst *inst,
			    struct hfi_buffer_desc *bd);
int hfi_session_unset_buffers(struct venus_inst *inst,
			      struct hfi_buffer_desc *bd);
int hfi_session_get_property(struct venus_inst *inst, u32 ptype,
			     union hfi_get_property *hprop);
int hfi_session_set_property(struct venus_inst *inst, u32 ptype, void *pdata);
int hfi_session_process_buf(struct venus_inst *inst, struct hfi_frame_data *f);
irqreturn_t hfi_isr_thread(int irq, void *dev_id);
irqreturn_t hfi_isr(int irq, void *dev);

#endif
+1255 −0

File added.

Preview size limit exceeded, changes collapsed.

+304 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
 * Copyright (C) 2017 Linaro Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */
#ifndef __VENUS_HFI_CMDS_H__
#define __VENUS_HFI_CMDS_H__

#include "hfi.h"

/* commands */
#define HFI_CMD_SYS_INIT			0x10001
#define HFI_CMD_SYS_PC_PREP			0x10002
#define HFI_CMD_SYS_SET_RESOURCE		0x10003
#define HFI_CMD_SYS_RELEASE_RESOURCE		0x10004
#define HFI_CMD_SYS_SET_PROPERTY		0x10005
#define HFI_CMD_SYS_GET_PROPERTY		0x10006
#define HFI_CMD_SYS_SESSION_INIT		0x10007
#define HFI_CMD_SYS_SESSION_END			0x10008
#define HFI_CMD_SYS_SET_BUFFERS			0x10009
#define HFI_CMD_SYS_TEST_SSR			0x10101

#define HFI_CMD_SESSION_SET_PROPERTY		0x11001
#define HFI_CMD_SESSION_SET_BUFFERS		0x11002
#define HFI_CMD_SESSION_GET_SEQUENCE_HEADER	0x11003

#define HFI_CMD_SYS_SESSION_ABORT		0x210001
#define HFI_CMD_SYS_PING			0x210002

#define HFI_CMD_SESSION_LOAD_RESOURCES		0x211001
#define HFI_CMD_SESSION_START			0x211002
#define HFI_CMD_SESSION_STOP			0x211003
#define HFI_CMD_SESSION_EMPTY_BUFFER		0x211004
#define HFI_CMD_SESSION_FILL_BUFFER		0x211005
#define HFI_CMD_SESSION_SUSPEND			0x211006
#define HFI_CMD_SESSION_RESUME			0x211007
#define HFI_CMD_SESSION_FLUSH			0x211008
#define HFI_CMD_SESSION_GET_PROPERTY		0x211009
#define HFI_CMD_SESSION_PARSE_SEQUENCE_HEADER	0x21100a
#define HFI_CMD_SESSION_RELEASE_BUFFERS		0x21100b
#define HFI_CMD_SESSION_RELEASE_RESOURCES	0x21100c
#define HFI_CMD_SESSION_CONTINUE		0x21100d
#define HFI_CMD_SESSION_SYNC			0x21100e

/* command packets */
struct hfi_sys_init_pkt {
	struct hfi_pkt_hdr hdr;
	u32 arch_type;
};

struct hfi_sys_pc_prep_pkt {
	struct hfi_pkt_hdr hdr;
};

struct hfi_sys_set_resource_pkt {
	struct hfi_pkt_hdr hdr;
	u32 resource_handle;
	u32 resource_type;
	u32 resource_data[1];
};

struct hfi_sys_release_resource_pkt {
	struct hfi_pkt_hdr hdr;
	u32 resource_type;
	u32 resource_handle;
};

struct hfi_sys_set_property_pkt {
	struct hfi_pkt_hdr hdr;
	u32 num_properties;
	u32 data[1];
};

struct hfi_sys_get_property_pkt {
	struct hfi_pkt_hdr hdr;
	u32 num_properties;
	u32 data[1];
};

struct hfi_sys_set_buffers_pkt {
	struct hfi_pkt_hdr hdr;
	u32 buffer_type;
	u32 buffer_size;
	u32 num_buffers;
	u32 buffer_addr[1];
};

struct hfi_sys_ping_pkt {
	struct hfi_pkt_hdr hdr;
	u32 client_data;
};

struct hfi_session_init_pkt {
	struct hfi_session_hdr_pkt shdr;
	u32 session_domain;
	u32 session_codec;
};

struct hfi_session_end_pkt {
	struct hfi_session_hdr_pkt shdr;
};

struct hfi_session_abort_pkt {
	struct hfi_session_hdr_pkt shdr;
};

struct hfi_session_set_property_pkt {
	struct hfi_session_hdr_pkt shdr;
	u32 num_properties;
	u32 data[0];
};

struct hfi_session_set_buffers_pkt {
	struct hfi_session_hdr_pkt shdr;
	u32 buffer_type;
	u32 buffer_size;
	u32 extradata_size;
	u32 min_buffer_size;
	u32 num_buffers;
	u32 buffer_info[1];
};

struct hfi_session_get_sequence_header_pkt {
	struct hfi_session_hdr_pkt shdr;
	u32 buffer_len;
	u32 packet_buffer;
};

struct hfi_session_load_resources_pkt {
	struct hfi_session_hdr_pkt shdr;
};

struct hfi_session_start_pkt {
	struct hfi_session_hdr_pkt shdr;
};

struct hfi_session_stop_pkt {
	struct hfi_session_hdr_pkt shdr;
};

struct hfi_session_empty_buffer_compressed_pkt {
	struct hfi_session_hdr_pkt shdr;
	u32 time_stamp_hi;
	u32 time_stamp_lo;
	u32 flags;
	u32 mark_target;
	u32 mark_data;
	u32 offset;
	u32 alloc_len;
	u32 filled_len;
	u32 input_tag;
	u32 packet_buffer;
	u32 extradata_buffer;
	u32 data[1];
};

struct hfi_session_empty_buffer_uncompressed_plane0_pkt {
	struct hfi_session_hdr_pkt shdr;
	u32 view_id;
	u32 time_stamp_hi;
	u32 time_stamp_lo;
	u32 flags;
	u32 mark_target;
	u32 mark_data;
	u32 alloc_len;
	u32 filled_len;
	u32 offset;
	u32 input_tag;
	u32 packet_buffer;
	u32 extradata_buffer;
	u32 data[1];
};

struct hfi_session_empty_buffer_uncompressed_plane1_pkt {
	u32 flags;
	u32 alloc_len;
	u32 filled_len;
	u32 offset;
	u32 packet_buffer2;
	u32 data[1];
};

struct hfi_session_empty_buffer_uncompressed_plane2_pkt {
	u32 flags;
	u32 alloc_len;
	u32 filled_len;
	u32 offset;
	u32 packet_buffer3;
	u32 data[1];
};

struct hfi_session_fill_buffer_pkt {
	struct hfi_session_hdr_pkt shdr;
	u32 stream_id;
	u32 offset;
	u32 alloc_len;
	u32 filled_len;
	u32 output_tag;
	u32 packet_buffer;
	u32 extradata_buffer;
	u32 data[1];
};

struct hfi_session_flush_pkt {
	struct hfi_session_hdr_pkt shdr;
	u32 flush_type;
};

struct hfi_session_suspend_pkt {
	struct hfi_session_hdr_pkt shdr;
};

struct hfi_session_resume_pkt {
	struct hfi_session_hdr_pkt shdr;
};

struct hfi_session_get_property_pkt {
	struct hfi_session_hdr_pkt shdr;
	u32 num_properties;
	u32 data[1];
};

struct hfi_session_release_buffer_pkt {
	struct hfi_session_hdr_pkt shdr;
	u32 buffer_type;
	u32 buffer_size;
	u32 extradata_size;
	u32 response_req;
	u32 num_buffers;
	u32 buffer_info[1];
};

struct hfi_session_release_resources_pkt {
	struct hfi_session_hdr_pkt shdr;
};

struct hfi_session_parse_sequence_header_pkt {
	struct hfi_session_hdr_pkt shdr;
	u32 header_len;
	u32 packet_buffer;
};

struct hfi_sfr {
	u32 buf_size;
	u8 data[1];
};

struct hfi_sys_test_ssr_pkt {
	struct hfi_pkt_hdr hdr;
	u32 trigger_type;
};

void pkt_set_version(enum hfi_version version);

void pkt_sys_init(struct hfi_sys_init_pkt *pkt, u32 arch_type);
void pkt_sys_pc_prep(struct hfi_sys_pc_prep_pkt *pkt);
void pkt_sys_idle_indicator(struct hfi_sys_set_property_pkt *pkt, u32 enable);
void pkt_sys_power_control(struct hfi_sys_set_property_pkt *pkt, u32 enable);
int pkt_sys_set_resource(struct hfi_sys_set_resource_pkt *pkt, u32 id, u32 size,
			 u32 addr, void *cookie);
int pkt_sys_unset_resource(struct hfi_sys_release_resource_pkt *pkt, u32 id,
			   u32 size, void *cookie);
void pkt_sys_debug_config(struct hfi_sys_set_property_pkt *pkt, u32 mode,
			  u32 config);
void pkt_sys_coverage_config(struct hfi_sys_set_property_pkt *pkt, u32 mode);
void pkt_sys_ping(struct hfi_sys_ping_pkt *pkt, u32 cookie);
void pkt_sys_image_version(struct hfi_sys_get_property_pkt *pkt);
int pkt_sys_ssr_cmd(struct hfi_sys_test_ssr_pkt *pkt, u32 trigger_type);
int pkt_session_init(struct hfi_session_init_pkt *pkt, void *cookie,
		     u32 session_type, u32 codec);
void pkt_session_cmd(struct hfi_session_pkt *pkt, u32 pkt_type, void *cookie);
int pkt_session_set_buffers(struct hfi_session_set_buffers_pkt *pkt,
			    void *cookie, struct hfi_buffer_desc *bd);
int pkt_session_unset_buffers(struct hfi_session_release_buffer_pkt *pkt,
			      void *cookie, struct hfi_buffer_desc *bd);
int pkt_session_etb_decoder(struct hfi_session_empty_buffer_compressed_pkt *pkt,
			    void *cookie, struct hfi_frame_data *input_frame);
int pkt_session_etb_encoder(
		struct hfi_session_empty_buffer_uncompressed_plane0_pkt *pkt,
		void *cookie, struct hfi_frame_data *input_frame);
int pkt_session_ftb(struct hfi_session_fill_buffer_pkt *pkt,
		    void *cookie, struct hfi_frame_data *output_frame);
int pkt_session_parse_seq_header(
		struct hfi_session_parse_sequence_header_pkt *pkt,
		void *cookie, u32 seq_hdr, u32 seq_hdr_len);
int pkt_session_get_seq_hdr(struct hfi_session_get_sequence_header_pkt *pkt,
			    void *cookie, u32 seq_hdr, u32 seq_hdr_len);
int pkt_session_flush(struct hfi_session_flush_pkt *pkt, void *cookie,
		      u32 flush_mode);
int pkt_session_get_property(struct hfi_session_get_property_pkt *pkt,
			     void *cookie, u32 ptype);
int pkt_session_set_property(struct hfi_session_set_property_pkt *pkt,
			     void *cookie, u32 ptype, void *pdata);

#endif
+1050 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading