root/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: GPL-2.0 */
   2 /*
   3  * Copyright (c) 2016 MediaTek Inc.
   4  * Author: PC Chen <pc.chen@mediatek.com>
   5  *         Tiffany Lin <tiffany.lin@mediatek.com>
   6  */
   7 
   8 #ifndef _MTK_VCODEC_DEC_H_
   9 #define _MTK_VCODEC_DEC_H_
  10 
  11 #include <media/videobuf2-core.h>
  12 #include <media/videobuf2-v4l2.h>
  13 
  14 #define VCODEC_CAPABILITY_4K_DISABLED   0x10
  15 #define VCODEC_DEC_4K_CODED_WIDTH       4096U
  16 #define VCODEC_DEC_4K_CODED_HEIGHT      2304U
  17 #define MTK_VDEC_MAX_W  2048U
  18 #define MTK_VDEC_MAX_H  1088U
  19 
  20 #define MTK_VDEC_IRQ_STATUS_DEC_SUCCESS        0x10000
  21 
  22 /**
  23  * struct vdec_fb  - decoder frame buffer
  24  * @base_y      : Y plane memory info
  25  * @base_c      : C plane memory info
  26  * @status      : frame buffer status (vdec_fb_status)
  27  */
  28 struct vdec_fb {
  29         struct mtk_vcodec_mem   base_y;
  30         struct mtk_vcodec_mem   base_c;
  31         unsigned int    status;
  32 };
  33 
  34 /**
  35  * struct mtk_video_dec_buf - Private data related to each VB2 buffer.
  36  * @b:          VB2 buffer
  37  * @list:       link list
  38  * @used:       Capture buffer contain decoded frame data and keep in
  39  *                      codec data structure
  40  * @queued_in_vb2:      Capture buffer is queue in vb2
  41  * @queued_in_v4l2:     Capture buffer is in v4l2 driver, but not in vb2
  42  *                      queue yet
  43  * @lastframe:          Intput buffer is last buffer - EOS
  44  * @error:              An unrecoverable error occurs on this buffer.
  45  * @frame_buffer:       Decode status, and buffer information of Capture buffer
  46  *
  47  * Note : These status information help us track and debug buffer state
  48  */
  49 struct mtk_video_dec_buf {
  50         struct vb2_v4l2_buffer  vb;
  51         struct list_head        list;
  52 
  53         bool    used;
  54         bool    queued_in_vb2;
  55         bool    queued_in_v4l2;
  56         bool    lastframe;
  57         bool    error;
  58         struct vdec_fb  frame_buffer;
  59 };
  60 
  61 extern const struct v4l2_ioctl_ops mtk_vdec_ioctl_ops;
  62 extern const struct v4l2_m2m_ops mtk_vdec_m2m_ops;
  63 
  64 
  65 /*
  66  * mtk_vdec_lock/mtk_vdec_unlock are for ctx instance to
  67  * get/release lock before/after access decoder hw.
  68  * mtk_vdec_lock get decoder hw lock and set curr_ctx
  69  * to ctx instance that get lock
  70  */
  71 void mtk_vdec_unlock(struct mtk_vcodec_ctx *ctx);
  72 void mtk_vdec_lock(struct mtk_vcodec_ctx *ctx);
  73 int mtk_vcodec_dec_queue_init(void *priv, struct vb2_queue *src_vq,
  74                            struct vb2_queue *dst_vq);
  75 void mtk_vcodec_dec_set_default_params(struct mtk_vcodec_ctx *ctx);
  76 void mtk_vcodec_dec_release(struct mtk_vcodec_ctx *ctx);
  77 int mtk_vcodec_dec_ctrls_setup(struct mtk_vcodec_ctx *ctx);
  78 
  79 
  80 #endif /* _MTK_VCODEC_DEC_H_ */

/* [<][>][^][v][top][bottom][index][help] */