mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-27 04:22:58 +00:00
Implement the reqbuf IOCTL op and the vb2_queue_setup vb2 op in the driver with necessary hooks. Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl> Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345) Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org> Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
57 lines
1.9 KiB
C
57 lines
1.9 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
|
|
*/
|
|
|
|
#include "iris_buffer.h"
|
|
#include "iris_instance.h"
|
|
#include "iris_vdec.h"
|
|
#include "iris_vpu_buffer.h"
|
|
|
|
#define DEFAULT_WIDTH 320
|
|
#define DEFAULT_HEIGHT 240
|
|
|
|
void iris_vdec_inst_init(struct iris_inst *inst)
|
|
{
|
|
struct v4l2_format *f;
|
|
|
|
inst->fmt_src = kzalloc(sizeof(*inst->fmt_src), GFP_KERNEL);
|
|
inst->fmt_dst = kzalloc(sizeof(*inst->fmt_dst), GFP_KERNEL);
|
|
|
|
inst->fw_min_count = MIN_BUFFERS;
|
|
|
|
f = inst->fmt_src;
|
|
f->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
|
|
f->fmt.pix_mp.width = DEFAULT_WIDTH;
|
|
f->fmt.pix_mp.height = DEFAULT_HEIGHT;
|
|
f->fmt.pix_mp.pixelformat = V4L2_PIX_FMT_H264;
|
|
f->fmt.pix_mp.num_planes = 1;
|
|
f->fmt.pix_mp.plane_fmt[0].bytesperline = 0;
|
|
f->fmt.pix_mp.plane_fmt[0].sizeimage = iris_get_buffer_size(inst, BUF_INPUT);
|
|
f->fmt.pix_mp.field = V4L2_FIELD_NONE;
|
|
inst->buffers[BUF_INPUT].min_count = iris_vpu_buf_count(inst, BUF_INPUT);
|
|
inst->buffers[BUF_INPUT].size = f->fmt.pix_mp.plane_fmt[0].sizeimage;
|
|
|
|
f = inst->fmt_dst;
|
|
f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
|
|
f->fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12;
|
|
f->fmt.pix_mp.width = ALIGN(DEFAULT_WIDTH, 128);
|
|
f->fmt.pix_mp.height = ALIGN(DEFAULT_HEIGHT, 32);
|
|
f->fmt.pix_mp.num_planes = 1;
|
|
f->fmt.pix_mp.plane_fmt[0].bytesperline = ALIGN(DEFAULT_WIDTH, 128);
|
|
f->fmt.pix_mp.plane_fmt[0].sizeimage = iris_get_buffer_size(inst, BUF_OUTPUT);
|
|
f->fmt.pix_mp.field = V4L2_FIELD_NONE;
|
|
f->fmt.pix_mp.colorspace = V4L2_COLORSPACE_DEFAULT;
|
|
f->fmt.pix_mp.xfer_func = V4L2_XFER_FUNC_DEFAULT;
|
|
f->fmt.pix_mp.ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT;
|
|
f->fmt.pix_mp.quantization = V4L2_QUANTIZATION_DEFAULT;
|
|
inst->buffers[BUF_OUTPUT].min_count = iris_vpu_buf_count(inst, BUF_OUTPUT);
|
|
inst->buffers[BUF_OUTPUT].size = f->fmt.pix_mp.plane_fmt[0].sizeimage;
|
|
}
|
|
|
|
void iris_vdec_inst_deinit(struct iris_inst *inst)
|
|
{
|
|
kfree(inst->fmt_dst);
|
|
kfree(inst->fmt_src);
|
|
}
|