linux/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c

// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2016 MediaTek Inc.
* Author: PC Chen <[email protected]>
*         Tiffany Lin <[email protected]>
*/

#include <media/v4l2-event.h>
#include <media/v4l2-mem2mem.h>
#include <media/videobuf2-dma-contig.h>
#include <linux/pm_runtime.h>

#include "mtk_vcodec_enc.h"
#include "venc_drv_if.h"

#define MTK_VENC_MIN_W
#define MTK_VENC_MIN_H
#define MTK_VENC_HD_MAX_W
#define MTK_VENC_HD_MAX_H
#define MTK_VENC_4K_MAX_W
#define MTK_VENC_4K_MAX_H

#define DFT_CFG_WIDTH
#define DFT_CFG_HEIGHT
#define MTK_MAX_CTRLS_HINT

#define MTK_DEFAULT_FRAMERATE_NUM
#define MTK_DEFAULT_FRAMERATE_DENOM
#define MTK_VENC_4K_CAPABILITY_ENABLE

static void mtk_venc_worker(struct work_struct *work);

static const struct v4l2_frmsize_stepwise mtk_venc_hd_framesizes =;

static const struct v4l2_frmsize_stepwise mtk_venc_4k_framesizes =;

static int vidioc_venc_s_ctrl(struct v4l2_ctrl *ctrl)
{}

static const struct v4l2_ctrl_ops mtk_vcodec_enc_ctrl_ops =;

static int vidioc_enum_fmt(struct v4l2_fmtdesc *f,
			   const struct mtk_video_fmt *formats,
			   size_t num_formats)
{}

static const struct mtk_video_fmt *
mtk_venc_find_format(u32 fourcc, const struct mtk_vcodec_enc_pdata *pdata)
{}

static int vidioc_enum_framesizes(struct file *file, void *fh,
				  struct v4l2_frmsizeenum *fsize)
{}

static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
				   struct v4l2_fmtdesc *f)
{}

static int vidioc_enum_fmt_vid_out(struct file *file, void *priv,
				   struct v4l2_fmtdesc *f)
{}

static int mtk_vcodec_enc_get_chip_name(void *priv)
{}

static int vidioc_venc_querycap(struct file *file, void *priv,
				struct v4l2_capability *cap)
{}

static int vidioc_venc_s_parm(struct file *file, void *priv,
			      struct v4l2_streamparm *a)
{}

static int vidioc_venc_g_parm(struct file *file, void *priv,
			      struct v4l2_streamparm *a)
{}

static struct mtk_q_data *mtk_venc_get_q_data(struct mtk_vcodec_enc_ctx *ctx,
					      enum v4l2_buf_type type)
{}

static void vidioc_try_fmt_cap(struct v4l2_format *f)
{}

/* V4L2 specification suggests the driver corrects the format struct if any of
 * the dimensions is unsupported
 */
static int vidioc_try_fmt_out(struct mtk_vcodec_enc_ctx *ctx, struct v4l2_format *f,
			      const struct mtk_video_fmt *fmt)
{}

static void mtk_venc_set_param(struct mtk_vcodec_enc_ctx *ctx,
			       struct venc_enc_param *param)
{}

static int vidioc_venc_s_fmt_cap(struct file *file, void *priv,
			     struct v4l2_format *f)
{}

static int vidioc_venc_s_fmt_out(struct file *file, void *priv,
			     struct v4l2_format *f)
{}

static int vidioc_venc_g_fmt(struct file *file, void *priv,
			     struct v4l2_format *f)
{}

static int vidioc_try_fmt_vid_cap_mplane(struct file *file, void *priv,
					 struct v4l2_format *f)
{}

static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv,
					 struct v4l2_format *f)
{}

static int vidioc_venc_g_selection(struct file *file, void *priv,
				     struct v4l2_selection *s)
{}

static int vidioc_venc_s_selection(struct file *file, void *priv,
				     struct v4l2_selection *s)
{}

static int vidioc_venc_qbuf(struct file *file, void *priv,
			    struct v4l2_buffer *buf)
{}

static int vidioc_venc_dqbuf(struct file *file, void *priv,
			     struct v4l2_buffer *buf)
{}

static int vidioc_encoder_cmd(struct file *file, void *priv,
			      struct v4l2_encoder_cmd *cmd)
{}

const struct v4l2_ioctl_ops mtk_venc_ioctl_ops =;

static int vb2ops_venc_queue_setup(struct vb2_queue *vq,
				   unsigned int *nbuffers,
				   unsigned int *nplanes,
				   unsigned int sizes[],
				   struct device *alloc_devs[])
{}

static int vb2ops_venc_buf_prepare(struct vb2_buffer *vb)
{}

static void vb2ops_venc_buf_queue(struct vb2_buffer *vb)
{}

static int vb2ops_venc_start_streaming(struct vb2_queue *q, unsigned int count)
{}

static void vb2ops_venc_stop_streaming(struct vb2_queue *q)
{}

static int vb2ops_venc_buf_out_validate(struct vb2_buffer *vb)
{}

static const struct vb2_ops mtk_venc_vb2_ops =;

static int mtk_venc_encode_header(void *priv)
{}

static int mtk_venc_param_change(struct mtk_vcodec_enc_ctx *ctx)
{}

/*
 * v4l2_m2m_streamoff() holds dev_mutex and waits mtk_venc_worker()
 * to call v4l2_m2m_job_finish().
 * If mtk_venc_worker() tries to acquire dev_mutex, it will deadlock.
 * So this function must not try to acquire dev->dev_mutex.
 * This means v4l2 ioctls and mtk_venc_worker() can run at the same time.
 * mtk_venc_worker() should be carefully implemented to avoid bugs.
 */
static void mtk_venc_worker(struct work_struct *work)
{}

static void m2mops_venc_device_run(void *priv)
{}

static int m2mops_venc_job_ready(void *m2m_priv)
{}

static void m2mops_venc_job_abort(void *priv)
{}

const struct v4l2_m2m_ops mtk_venc_m2m_ops =;

void mtk_vcodec_enc_set_default_params(struct mtk_vcodec_enc_ctx *ctx)
{}

int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_enc_ctx *ctx)
{}

int mtk_vcodec_enc_queue_init(void *priv, struct vb2_queue *src_vq,
			      struct vb2_queue *dst_vq)
{}

int mtk_venc_unlock(struct mtk_vcodec_enc_ctx *ctx)
{}

int mtk_venc_lock(struct mtk_vcodec_enc_ctx *ctx)
{}

void mtk_vcodec_enc_release(struct mtk_vcodec_enc_ctx *ctx)
{}