linux/drivers/media/platform/mtk-vcodec/vdec_vpu_if.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 */
   2/*
   3 * Copyright (c) 2016 MediaTek Inc.
   4 * Author: PC Chen <pc.chen@mediatek.com>
   5 */
   6
   7#ifndef _VDEC_VPU_IF_H_
   8#define _VDEC_VPU_IF_H_
   9
  10#include "mtk_vcodec_fw.h"
  11
  12struct mtk_vcodec_ctx;
  13
  14/**
  15 * struct vdec_vpu_inst - VPU instance for video codec
  16 * @id          : ipi msg id for each decoder
  17 * @vsi         : driver structure allocated by VPU side and shared to AP side
  18 *                for control and info share
  19 * @failure     : VPU execution result status, 0: success, others: fail
  20 * @inst_addr   : VPU decoder instance address
  21 * @signaled    : 1 - Host has received ack message from VPU, 0 - not received
  22 * @ctx         : context for v4l2 layer integration
  23 * @dev         : platform device of VPU
  24 * @wq          : wait queue to wait VPU message ack
  25 * @handler     : ipi handler for each decoder
  26 */
  27struct vdec_vpu_inst {
  28        int id;
  29        void *vsi;
  30        int32_t failure;
  31        uint32_t inst_addr;
  32        unsigned int signaled;
  33        struct mtk_vcodec_ctx *ctx;
  34        wait_queue_head_t wq;
  35        mtk_vcodec_ipi_handler handler;
  36};
  37
  38/**
  39 * vpu_dec_init - init decoder instance and allocate required resource in VPU.
  40 *
  41 * @vpu: instance for vdec_vpu_inst
  42 */
  43int vpu_dec_init(struct vdec_vpu_inst *vpu);
  44
  45/**
  46 * vpu_dec_start - start decoding, basically the function will be invoked once
  47 *                 every frame.
  48 *
  49 * @vpu : instance for vdec_vpu_inst
  50 * @data: meta data to pass bitstream info to VPU decoder
  51 * @len : meta data length
  52 */
  53int vpu_dec_start(struct vdec_vpu_inst *vpu, uint32_t *data, unsigned int len);
  54
  55/**
  56 * vpu_dec_end - end decoding, basically the function will be invoked once
  57 *               when HW decoding done interrupt received successfully. The
  58 *               decoder in VPU will continue to do reference frame management
  59 *               and check if there is a new decoded frame available to display.
  60 *
  61 * @vpu : instance for vdec_vpu_inst
  62 */
  63int vpu_dec_end(struct vdec_vpu_inst *vpu);
  64
  65/**
  66 * vpu_dec_deinit - deinit decoder instance and resource freed in VPU.
  67 *
  68 * @vpu: instance for vdec_vpu_inst
  69 */
  70int vpu_dec_deinit(struct vdec_vpu_inst *vpu);
  71
  72/**
  73 * vpu_dec_reset - reset decoder, use for flush decoder when end of stream or
  74 *                 seek. Remainig non displayed frame will be pushed to display.
  75 *
  76 * @vpu: instance for vdec_vpu_inst
  77 */
  78int vpu_dec_reset(struct vdec_vpu_inst *vpu);
  79
  80#endif
  81