Merge "video: driver: define slice delivery as boolean control."

This commit is contained in:
qctecmdr
2022-08-03 10:39:32 -07:00
کامیت شده توسط Gerrit - the friendly Code Review server
کامیت 1ee1d9c8e5
15فایلهای تغییر یافته به همراه1025 افزوده شده و 779 حذف شده

مشاهده پرونده

@@ -113,8 +113,8 @@ static inline bool is_meta_rx_inp_enabled(struct msm_vidc_inst *inst, u32 cap)
{
bool enabled = false;
if (inst->capabilities->cap[cap].value & V4L2_MPEG_VIDC_META_ENABLE &&
inst->capabilities->cap[cap].value & V4L2_MPEG_VIDC_META_RX_INPUT)
if (inst->capabilities->cap[cap].value & MSM_VIDC_META_ENABLE &&
inst->capabilities->cap[cap].value & MSM_VIDC_META_RX_INPUT)
enabled = true;
return enabled;
@@ -124,8 +124,8 @@ static inline bool is_meta_rx_out_enabled(struct msm_vidc_inst *inst, u32 cap)
{
bool enabled = false;
if (inst->capabilities->cap[cap].value & V4L2_MPEG_VIDC_META_ENABLE &&
inst->capabilities->cap[cap].value & V4L2_MPEG_VIDC_META_RX_OUTPUT)
if (inst->capabilities->cap[cap].value & MSM_VIDC_META_ENABLE &&
inst->capabilities->cap[cap].value & MSM_VIDC_META_RX_OUTPUT)
enabled = true;
return enabled;
@@ -135,8 +135,8 @@ static inline bool is_meta_tx_inp_enabled(struct msm_vidc_inst *inst, u32 cap)
{
bool enabled = false;
if (inst->capabilities->cap[cap].value & V4L2_MPEG_VIDC_META_ENABLE &&
inst->capabilities->cap[cap].value & V4L2_MPEG_VIDC_META_TX_INPUT)
if (inst->capabilities->cap[cap].value & MSM_VIDC_META_ENABLE &&
inst->capabilities->cap[cap].value & MSM_VIDC_META_TX_INPUT)
enabled = true;
return enabled;
@@ -146,8 +146,8 @@ static inline bool is_meta_tx_out_enabled(struct msm_vidc_inst *inst, u32 cap)
{
bool enabled = false;
if (inst->capabilities->cap[cap].value & V4L2_MPEG_VIDC_META_ENABLE &&
inst->capabilities->cap[cap].value & V4L2_MPEG_VIDC_META_TX_OUTPUT)
if (inst->capabilities->cap[cap].value & MSM_VIDC_META_ENABLE &&
inst->capabilities->cap[cap].value & MSM_VIDC_META_TX_OUTPUT)
enabled = true;
return enabled;
@@ -344,12 +344,7 @@ static inline bool is_enc_slice_delivery_mode(struct msm_vidc_inst *inst)
return (inst->capabilities->cap[SLICE_MODE].value ==
V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_MAX_MB &&
((inst->codec == MSM_VIDC_H264 &&
inst->capabilities->cap[DELIVERY_MODE].value ==
V4L2_MPEG_VIDC_H264_ENCODE_DELIVERY_MODE_SLICE_BASED) ||
(inst->codec == MSM_VIDC_HEVC &&
inst->capabilities->cap[DELIVERY_MODE].value ==
V4L2_MPEG_VIDC_HEVC_ENCODE_DELIVERY_MODE_SLICE_BASED)));
inst->capabilities->cap[DELIVERY_MODE].value);
}
static inline bool is_state(struct msm_vidc_inst *inst, enum msm_vidc_state state)
@@ -364,20 +359,20 @@ static inline bool is_sub_state(struct msm_vidc_inst *inst,
}
const char *cap_name(enum msm_vidc_inst_capability_type cap_id);
const char *v4l2_pixelfmt_name(u32 pixelfmt);
const char *v4l2_pixelfmt_name(struct msm_vidc_inst *inst, u32 pixelfmt);
const char *v4l2_type_name(u32 port);
void print_vidc_buffer(u32 tag, const char *tag_str, const char *str, struct msm_vidc_inst *inst,
struct msm_vidc_buffer *vbuf);
void print_vb2_buffer(const char *str, struct msm_vidc_inst *inst,
struct vb2_buffer *vb2);
enum msm_vidc_codec_type v4l2_codec_to_driver(u32 v4l2_codec,
const char *func);
u32 v4l2_codec_from_driver(enum msm_vidc_codec_type codec,
const char *func);
enum msm_vidc_colorformat_type v4l2_colorformat_to_driver(u32 colorformat,
const char *func);
u32 v4l2_colorformat_from_driver(enum msm_vidc_colorformat_type colorformat,
enum msm_vidc_codec_type v4l2_codec_to_driver(struct msm_vidc_inst *inst,
u32 v4l2_codec, const char *func);
u32 v4l2_codec_from_driver(struct msm_vidc_inst *inst, enum msm_vidc_codec_type codec,
const char *func);
enum msm_vidc_colorformat_type v4l2_colorformat_to_driver(struct msm_vidc_inst *inst,
u32 colorformat, const char *func);
u32 v4l2_colorformat_from_driver(struct msm_vidc_inst *inst,
enum msm_vidc_colorformat_type colorformat, const char *func);
u32 v4l2_color_primaries_to_driver(struct msm_vidc_inst *inst,
u32 v4l2_primaries, const char *func);
u32 v4l2_color_primaries_from_driver(struct msm_vidc_inst *inst,

مشاهده پرونده

@@ -21,6 +21,33 @@
#include <media/videobuf2-core.h>
#include <media/videobuf2-v4l2.h>
/* TODO : remove once available in mainline kernel */
#ifndef V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10_STILL_PICTURE
#define V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10_STILL_PICTURE (3)
#endif
enum msm_vidc_blur_types {
MSM_VIDC_BLUR_NONE = 0x0,
MSM_VIDC_BLUR_EXTERNAL = 0x1,
MSM_VIDC_BLUR_ADAPTIVE = 0x2,
};
/* various Metadata - encoder & decoder */
enum msm_vidc_metadata_bits {
MSM_VIDC_META_DISABLE = 0x0,
MSM_VIDC_META_ENABLE = 0x1,
MSM_VIDC_META_TX_INPUT = 0x2,
MSM_VIDC_META_TX_OUTPUT = 0x4,
MSM_VIDC_META_RX_INPUT = 0x8,
MSM_VIDC_META_RX_OUTPUT = 0x10,
MSM_VIDC_META_MAX = 0x20,
};
#define MSM_VIDC_METADATA_SIZE (4 * 4096) /* 16 KB */
#define ENCODE_INPUT_METADATA_SIZE (512 * 4096) /* 2 MB */
#define DECODE_INPUT_METADATA_SIZE MSM_VIDC_METADATA_SIZE
#define MSM_VIDC_METADATA_DOLBY_RPU_SIZE (41 * 1024) /* 41 KB */
#define MAX_NAME_LENGTH 128
#define VENUS_VERSION_LENGTH 128
#define MAX_MATRIX_COEFFS 9
@@ -164,6 +191,7 @@ enum msm_vidc_colorformat_type {
MSM_VIDC_FMT_P010 = BIT(4),
MSM_VIDC_FMT_RGBA8888C = BIT(5),
MSM_VIDC_FMT_RGBA8888 = BIT(6),
MSM_VIDC_FMT_META = BIT(31),
};
enum msm_vidc_buffer_type {

مشاهده پرونده

@@ -104,10 +104,10 @@ static int msm_vdec_codec_change(struct msm_vidc_inst *inst, u32 v4l2_codec)
return 0;
i_vpr_h(inst, "%s: codec changed from %s to %s\n",
__func__, v4l2_pixelfmt_name(inst->fmts[INPUT_PORT].fmt.pix_mp.pixelformat),
v4l2_pixelfmt_name(v4l2_codec));
__func__, v4l2_pixelfmt_name(inst, inst->fmts[INPUT_PORT].fmt.pix_mp.pixelformat),
v4l2_pixelfmt_name(inst, v4l2_codec));
inst->codec = v4l2_codec_to_driver(v4l2_codec, __func__);
inst->codec = v4l2_codec_to_driver(inst, v4l2_codec, __func__);
if (!inst->codec) {
i_vpr_e(inst, "%s: invalid codec %#x\n", __func__, v4l2_codec);
rc = -EINVAL;
@@ -177,7 +177,7 @@ static int msm_vdec_set_linear_stride_scanline(struct msm_vidc_inst *inst)
u32 payload[2];
enum msm_vidc_colorformat_type colorformat;
colorformat = v4l2_colorformat_to_driver(
colorformat = v4l2_colorformat_to_driver(inst,
inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat, __func__);
if (!is_linear_yuv_colorformat(colorformat))
@@ -222,7 +222,7 @@ static int msm_vdec_set_ubwc_stride_scanline(struct msm_vidc_inst *inst)
width = f->fmt.pix_mp.width;
height = f->fmt.pix_mp.height;
colorformat = v4l2_colorformat_to_driver(pix_fmt, __func__);
colorformat = v4l2_colorformat_to_driver(inst, pix_fmt, __func__);
if (inst->codec != MSM_VIDC_AV1 ||
(!is_ubwc_colorformat(colorformat)))
@@ -316,7 +316,7 @@ static int msm_vdec_set_bit_depth(struct msm_vidc_inst *inst,
}
pix_fmt = inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat;
colorformat = v4l2_colorformat_to_driver(pix_fmt, __func__);
colorformat = v4l2_colorformat_to_driver(inst, pix_fmt, __func__);
if (is_10bit_colorformat(colorformat))
bitdepth = 10 << 16 | 10;
@@ -705,7 +705,7 @@ static int msm_vdec_set_colorformat(struct msm_vidc_inst *inst)
u32 hfi_colorformat;
pixelformat = inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat;
colorformat = v4l2_colorformat_to_driver(pixelformat, __func__);
colorformat = v4l2_colorformat_to_driver(inst, pixelformat, __func__);
hfi_colorformat = get_hfi_colorformat(inst, colorformat);
i_vpr_h(inst, "%s: hfi colorformat: %d",
__func__, hfi_colorformat);
@@ -1277,7 +1277,7 @@ static int msm_vdec_read_input_subcr_params(struct msm_vidc_inst *inst)
inst->fmts[INPUT_PORT].fmt.pix_mp.width = width;
inst->fmts[INPUT_PORT].fmt.pix_mp.height = height;
output_fmt = v4l2_colorformat_to_driver(
output_fmt = v4l2_colorformat_to_driver(inst,
inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat, __func__);
inst->fmts[OUTPUT_PORT].fmt.pix_mp.width = video_y_stride_pix(
@@ -1376,8 +1376,8 @@ static int msm_vdec_read_input_subcr_params(struct msm_vidc_inst *inst)
if (inst->capabilities->cap[CODED_FRAMES].value ==
CODED_FRAMES_INTERLACE) {
msm_vidc_update_cap_value(inst, META_OUTBUF_FENCE,
V4L2_MPEG_VIDC_META_RX_INPUT |
V4L2_MPEG_VIDC_META_DISABLE, __func__);
MSM_VIDC_META_RX_INPUT |
MSM_VIDC_META_DISABLE, __func__);
}
return 0;
@@ -2285,22 +2285,23 @@ int msm_vdec_try_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
memset(pixmp->reserved, 0, sizeof(pixmp->reserved));
if (f->type == INPUT_MPLANE) {
pix_fmt = v4l2_codec_to_driver(f->fmt.pix_mp.pixelformat, __func__);
pix_fmt = v4l2_codec_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__);
if (!pix_fmt) {
i_vpr_e(inst, "%s: unsupported codec, set current params\n", __func__);
f->fmt.pix_mp.width = inst->fmts[INPUT_PORT].fmt.pix_mp.width;
f->fmt.pix_mp.height = inst->fmts[INPUT_PORT].fmt.pix_mp.height;
f->fmt.pix_mp.pixelformat = inst->fmts[INPUT_PORT].fmt.pix_mp.pixelformat;
pix_fmt = v4l2_codec_to_driver(f->fmt.pix_mp.pixelformat, __func__);
pix_fmt = v4l2_codec_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__);
}
} else if (f->type == OUTPUT_MPLANE) {
pix_fmt = v4l2_colorformat_to_driver(f->fmt.pix_mp.pixelformat, __func__);
pix_fmt = v4l2_colorformat_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__);
if (!pix_fmt) {
i_vpr_e(inst, "%s: unsupported format, set current params\n", __func__);
f->fmt.pix_mp.pixelformat = inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat;
f->fmt.pix_mp.width = inst->fmts[OUTPUT_PORT].fmt.pix_mp.width;
f->fmt.pix_mp.height = inst->fmts[OUTPUT_PORT].fmt.pix_mp.height;
pix_fmt = v4l2_colorformat_to_driver(f->fmt.pix_mp.pixelformat, __func__);
pix_fmt = v4l2_colorformat_to_driver(inst,
f->fmt.pix_mp.pixelformat, __func__);
}
if (inst->bufq[INPUT_PORT].vb2q->streaming) {
f->fmt.pix_mp.height = inst->fmts[INPUT_PORT].fmt.pix_mp.height;
@@ -2418,7 +2419,7 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
inst->crop.height = f->fmt.pix_mp.height;
i_vpr_h(inst,
"%s: type: INPUT, codec %s width %d height %d size %u min_count %d extra_count %d\n",
__func__, v4l2_pixelfmt_name(f->fmt.pix_mp.pixelformat),
__func__, v4l2_pixelfmt_name(inst, f->fmt.pix_mp.pixelformat),
f->fmt.pix_mp.width, f->fmt.pix_mp.height,
fmt->fmt.pix_mp.plane_fmt[0].sizeimage,
inst->buffers.input.min_count,
@@ -2426,7 +2427,8 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
} else if (f->type == INPUT_META_PLANE) {
fmt = &inst->fmts[INPUT_META_PORT];
fmt->type = INPUT_META_PLANE;
fmt->fmt.meta.dataformat = V4L2_META_FMT_VIDC;
fmt->fmt.meta.dataformat =
v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_META, __func__);
fmt->fmt.meta.buffersize = call_session_op(core,
buffer_size, inst, MSM_VIDC_BUF_INPUT_META);
inst->buffers.input_meta.min_count =
@@ -2449,7 +2451,7 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
f->fmt.pix_mp.width = inst->fmts[INPUT_PORT].fmt.pix_mp.width;
}
fmt->fmt.pix_mp.pixelformat = f->fmt.pix_mp.pixelformat;
colorformat = v4l2_colorformat_to_driver(fmt->fmt.pix_mp.pixelformat,
colorformat = v4l2_colorformat_to_driver(inst, fmt->fmt.pix_mp.pixelformat,
__func__);
fmt->fmt.pix_mp.width = video_y_stride_pix(
colorformat, f->fmt.pix_mp.width);
@@ -2487,7 +2489,7 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
}
i_vpr_h(inst,
"%s: type: OUTPUT, format %s width %d height %d size %u min_count %d extra_count %d\n",
__func__, v4l2_pixelfmt_name(fmt->fmt.pix_mp.pixelformat),
__func__, v4l2_pixelfmt_name(inst, fmt->fmt.pix_mp.pixelformat),
fmt->fmt.pix_mp.width, fmt->fmt.pix_mp.height,
fmt->fmt.pix_mp.plane_fmt[0].sizeimage,
inst->buffers.output.min_count,
@@ -2495,7 +2497,8 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
} else if (f->type == OUTPUT_META_PLANE) {
fmt = &inst->fmts[OUTPUT_META_PORT];
fmt->type = OUTPUT_META_PLANE;
fmt->fmt.meta.dataformat = V4L2_META_FMT_VIDC;
fmt->fmt.meta.dataformat =
v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_META, __func__);
fmt->fmt.meta.buffersize = call_session_op(core,
buffer_size, inst, MSM_VIDC_BUF_OUTPUT_META);
inst->buffers.output_meta.min_count =
@@ -2673,7 +2676,7 @@ int msm_vdec_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f)
}
if (!array[f->index])
return -EINVAL;
f->pixelformat = v4l2_codec_from_driver(array[f->index],
f->pixelformat = v4l2_codec_from_driver(inst, array[f->index],
__func__);
if (!f->pixelformat)
return -EINVAL;
@@ -2696,14 +2699,15 @@ int msm_vdec_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f)
}
if (!array[f->index])
return -EINVAL;
f->pixelformat = v4l2_colorformat_from_driver(array[f->index],
f->pixelformat = v4l2_colorformat_from_driver(inst, array[f->index],
__func__);
if (!f->pixelformat)
return -EINVAL;
strlcpy(f->description, "colorformat", sizeof(f->description));
} else if (f->type == INPUT_META_PLANE || f->type == OUTPUT_META_PLANE) {
if (!f->index) {
f->pixelformat = V4L2_META_FMT_VIDC;
f->pixelformat =
v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_META, __func__);
strlcpy(f->description, "metadata", sizeof(f->description));
} else {
return -EINVAL;
@@ -2712,7 +2716,8 @@ int msm_vdec_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f)
memset(f->reserved, 0, sizeof(f->reserved));
i_vpr_h(inst, "%s: index %d, %s: %s, flags %#x\n",
__func__, f->index, f->description, v4l2_pixelfmt_name(f->pixelformat), f->flags);
__func__, f->index, f->description,
v4l2_pixelfmt_name(inst, f->pixelformat), f->flags);
return rc;
}
@@ -2762,7 +2767,8 @@ int msm_vdec_inst_init(struct msm_vidc_inst *inst)
f = &inst->fmts[INPUT_META_PORT];
f->type = INPUT_META_PLANE;
f->fmt.meta.dataformat = V4L2_META_FMT_VIDC;
f->fmt.meta.dataformat =
v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_META, __func__);;
f->fmt.meta.buffersize = MSM_VIDC_METADATA_SIZE;
inst->buffers.input_meta.min_count = 0;
inst->buffers.input_meta.extra_count = 0;
@@ -2771,8 +2777,9 @@ int msm_vdec_inst_init(struct msm_vidc_inst *inst)
f = &inst->fmts[OUTPUT_PORT];
f->type = OUTPUT_MPLANE;
f->fmt.pix_mp.pixelformat = V4L2_PIX_FMT_VIDC_NV12C;
colorformat = v4l2_colorformat_to_driver(
f->fmt.pix_mp.pixelformat =
v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_NV12C, __func__);
colorformat = v4l2_colorformat_to_driver(inst,
f->fmt.pix_mp.pixelformat, __func__);
f->fmt.pix_mp.width = video_y_stride_pix(colorformat, DEFAULT_WIDTH);
f->fmt.pix_mp.height = video_y_scanlines(colorformat, DEFAULT_HEIGHT);
@@ -2798,7 +2805,8 @@ int msm_vdec_inst_init(struct msm_vidc_inst *inst)
f = &inst->fmts[OUTPUT_META_PORT];
f->type = OUTPUT_META_PLANE;
f->fmt.meta.dataformat = V4L2_META_FMT_VIDC;
f->fmt.meta.dataformat =
v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_META, __func__);
f->fmt.meta.buffersize = MSM_VIDC_METADATA_SIZE;
inst->buffers.output_meta.min_count = 0;
inst->buffers.output_meta.extra_count = 0;

مشاهده پرونده

@@ -66,10 +66,10 @@ static int msm_venc_codec_change(struct msm_vidc_inst *inst, u32 v4l2_codec)
return 0;
i_vpr_h(inst, "%s: codec changed from %s to %s\n",
__func__, v4l2_pixelfmt_name(inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat),
v4l2_pixelfmt_name(v4l2_codec));
__func__, v4l2_pixelfmt_name(inst, inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat),
v4l2_pixelfmt_name(inst, v4l2_codec));
inst->codec = v4l2_codec_to_driver(v4l2_codec, __func__);
inst->codec = v4l2_codec_to_driver(inst, v4l2_codec, __func__);
if (!inst->codec) {
i_vpr_e(inst, "%s: invalid codec %#x\n", __func__, v4l2_codec);
rc = -EINVAL;
@@ -120,10 +120,10 @@ static int msm_venc_set_colorformat(struct msm_vidc_inst *inst,
}
pixelformat = inst->fmts[INPUT_PORT].fmt.pix_mp.pixelformat;
colorformat = v4l2_colorformat_to_driver(pixelformat, __func__);
colorformat = v4l2_colorformat_to_driver(inst, pixelformat, __func__);
if (!(colorformat & inst->capabilities->cap[PIX_FMTS].step_or_mask)) {
i_vpr_e(inst, "%s: invalid pixelformat %s\n",
__func__, v4l2_pixelfmt_name(pixelformat));
__func__, v4l2_pixelfmt_name(inst, pixelformat));
return -EINVAL;
}
@@ -324,7 +324,7 @@ static int msm_venc_set_colorspace(struct msm_vidc_inst* inst,
}
input_fmt = &inst->fmts[INPUT_PORT];
pix_fmt = v4l2_colorformat_to_driver(
pix_fmt = v4l2_colorformat_to_driver(inst,
input_fmt->fmt.pix_mp.pixelformat, __func__);
if (inst->fmts[port].fmt.pix_mp.colorspace != V4L2_COLORSPACE_DEFAULT ||
inst->fmts[port].fmt.pix_mp.ycbcr_enc != V4L2_YCBCR_ENC_DEFAULT ||
@@ -1039,22 +1039,23 @@ int msm_venc_try_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
memset(pixmp->reserved, 0, sizeof(pixmp->reserved));
if (f->type == INPUT_MPLANE) {
pix_fmt = v4l2_colorformat_to_driver(f->fmt.pix_mp.pixelformat, __func__);
pix_fmt = v4l2_colorformat_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__);
if (!pix_fmt) {
i_vpr_e(inst, "%s: unsupported format, set current params\n", __func__);
f->fmt.pix_mp.pixelformat = inst->fmts[INPUT_PORT].fmt.pix_mp.pixelformat;
f->fmt.pix_mp.width = inst->fmts[INPUT_PORT].fmt.pix_mp.width;
f->fmt.pix_mp.height = inst->fmts[INPUT_PORT].fmt.pix_mp.height;
pix_fmt = v4l2_colorformat_to_driver(f->fmt.pix_mp.pixelformat, __func__);
pix_fmt = v4l2_colorformat_to_driver(inst,
f->fmt.pix_mp.pixelformat, __func__);
}
} else if (f->type == OUTPUT_MPLANE) {
pix_fmt = v4l2_codec_to_driver(f->fmt.pix_mp.pixelformat, __func__);
pix_fmt = v4l2_codec_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__);
if (!pix_fmt) {
i_vpr_e(inst, "%s: unsupported codec, set current params\n", __func__);
f->fmt.pix_mp.width = inst->fmts[OUTPUT_PORT].fmt.pix_mp.width;
f->fmt.pix_mp.height = inst->fmts[OUTPUT_PORT].fmt.pix_mp.height;
f->fmt.pix_mp.pixelformat = inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat;
pix_fmt = v4l2_codec_to_driver(f->fmt.pix_mp.pixelformat, __func__);
pix_fmt = v4l2_codec_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__);
}
} else if (f->type == INPUT_META_PLANE) {
f->fmt.meta.dataformat = inst->fmts[INPUT_META_PORT].fmt.meta.dataformat;
@@ -1081,6 +1082,7 @@ int msm_venc_s_fmt_output(struct msm_vidc_inst *inst, struct v4l2_format *f)
struct msm_vidc_core *core;
u32 codec_align;
u32 width, height;
enum msm_vidc_codec_type codec;
if (!inst || !inst->core || !f) {
d_vpr_e("%s: invalid params\n", __func__);
@@ -1097,8 +1099,10 @@ int msm_venc_s_fmt_output(struct msm_vidc_inst *inst, struct v4l2_format *f)
}
fmt->type = OUTPUT_MPLANE;
codec_align = (f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_HEVC ||
f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_HEIC) ? 32 : 16;
codec = v4l2_codec_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__);
codec_align = (codec == MSM_VIDC_HEVC ||
codec == MSM_VIDC_HEIC) ? 32 : 16;
/* use rotated width height if rotation is enabled */
width = inst->compose.width;
height = inst->compose.height;
@@ -1143,7 +1147,7 @@ int msm_venc_s_fmt_output(struct msm_vidc_inst *inst, struct v4l2_format *f)
i_vpr_h(inst,
"%s: type: OUTPUT, codec %s width %d height %d size %u min_count %d extra_count %d\n",
__func__, v4l2_pixelfmt_name(fmt->fmt.pix_mp.pixelformat),
__func__, v4l2_pixelfmt_name(inst, fmt->fmt.pix_mp.pixelformat),
fmt->fmt.pix_mp.width, fmt->fmt.pix_mp.height,
fmt->fmt.pix_mp.plane_fmt[0].sizeimage,
inst->buffers.output.min_count,
@@ -1168,7 +1172,8 @@ static int msm_venc_s_fmt_output_meta(struct msm_vidc_inst *inst, struct v4l2_fo
fmt = &inst->fmts[OUTPUT_META_PORT];
fmt->type = OUTPUT_META_PLANE;
fmt->fmt.meta.dataformat = V4L2_META_FMT_VIDC;
fmt->fmt.meta.dataformat =
v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_META, __func__);
fmt->fmt.meta.buffersize = call_session_op(core,
buffer_size, inst, MSM_VIDC_BUF_OUTPUT_META);
inst->buffers.output_meta.min_count =
@@ -1203,7 +1208,7 @@ static int msm_venc_s_fmt_input(struct msm_vidc_inst *inst, struct v4l2_format *
core = inst->core;
msm_venc_try_fmt(inst, f);
pix_fmt = v4l2_colorformat_to_driver(f->fmt.pix_mp.pixelformat, __func__);
pix_fmt = v4l2_colorformat_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__);
msm_vidc_update_cap_value(inst, PIX_FMTS, pix_fmt, __func__);
width = f->fmt.pix_mp.width;
@@ -1283,7 +1288,7 @@ static int msm_venc_s_fmt_input(struct msm_vidc_inst *inst, struct v4l2_format *
i_vpr_h(inst,
"%s: type: INPUT, format %s width %d height %d size %u min_count %d extra_count %d\n",
__func__, v4l2_pixelfmt_name(fmt->fmt.pix_mp.pixelformat),
__func__, v4l2_pixelfmt_name(inst, fmt->fmt.pix_mp.pixelformat),
fmt->fmt.pix_mp.width, fmt->fmt.pix_mp.height,
fmt->fmt.pix_mp.plane_fmt[0].sizeimage,
inst->buffers.input.min_count,
@@ -1309,7 +1314,8 @@ static int msm_venc_s_fmt_input_meta(struct msm_vidc_inst *inst, struct v4l2_for
fmt = &inst->fmts[INPUT_META_PORT];
fmt->type = INPUT_META_PLANE;
fmt->fmt.meta.dataformat = V4L2_META_FMT_VIDC;
fmt->fmt.meta.dataformat =
v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_META, __func__);
fmt->fmt.meta.buffersize = call_session_op(core,
buffer_size, inst, MSM_VIDC_BUF_INPUT_META);
inst->buffers.input_meta.min_count =
@@ -1742,7 +1748,7 @@ int msm_venc_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f)
}
if (!array[f->index])
return -EINVAL;
f->pixelformat = v4l2_codec_from_driver(array[f->index],
f->pixelformat = v4l2_codec_from_driver(inst, array[f->index],
__func__);
if (!f->pixelformat)
return -EINVAL;
@@ -1762,14 +1768,15 @@ int msm_venc_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f)
}
if (!array[f->index])
return -EINVAL;
f->pixelformat = v4l2_colorformat_from_driver(array[f->index],
f->pixelformat = v4l2_colorformat_from_driver(inst, array[f->index],
__func__);
if (!f->pixelformat)
return -EINVAL;
strlcpy(f->description, "colorformat", sizeof(f->description));
} else if (f->type == INPUT_META_PLANE || f->type == OUTPUT_META_PLANE) {
if (!f->index) {
f->pixelformat = V4L2_META_FMT_VIDC;
f->pixelformat =
v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_META, __func__);
strlcpy(f->description, "metadata", sizeof(f->description));
} else {
return -EINVAL;
@@ -1779,7 +1786,7 @@ int msm_venc_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f)
i_vpr_h(inst, "%s: index %d, %s: %s, flags %#x\n",
__func__, f->index, f->description,
v4l2_pixelfmt_name(f->pixelformat), f->flags);
v4l2_pixelfmt_name(inst, f->pixelformat), f->flags);
return rc;
}
@@ -1834,7 +1841,8 @@ int msm_venc_inst_init(struct msm_vidc_inst *inst)
f = &inst->fmts[OUTPUT_META_PORT];
f->type = OUTPUT_META_PLANE;
f->fmt.meta.dataformat = V4L2_META_FMT_VIDC;
f->fmt.meta.dataformat =
v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_META, __func__);
f->fmt.meta.buffersize = MSM_VIDC_METADATA_SIZE;
inst->buffers.output_meta.min_count = 0;
inst->buffers.output_meta.extra_count = 0;
@@ -1843,11 +1851,12 @@ int msm_venc_inst_init(struct msm_vidc_inst *inst)
f = &inst->fmts[INPUT_PORT];
f->type = INPUT_MPLANE;
f->fmt.pix_mp.pixelformat = V4L2_PIX_FMT_VIDC_NV12C;
f->fmt.pix_mp.pixelformat =
v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_NV12C, __func__);
f->fmt.pix_mp.width = DEFAULT_WIDTH;
f->fmt.pix_mp.height = DEFAULT_HEIGHT;
f->fmt.pix_mp.num_planes = 1;
colorformat = v4l2_colorformat_to_driver(f->fmt.pix_mp.pixelformat,
colorformat = v4l2_colorformat_to_driver(inst, f->fmt.pix_mp.pixelformat,
__func__);
f->fmt.pix_mp.plane_fmt[0].bytesperline =
video_y_stride_bytes(colorformat, DEFAULT_WIDTH);
@@ -1869,7 +1878,8 @@ int msm_venc_inst_init(struct msm_vidc_inst *inst)
f = &inst->fmts[INPUT_META_PORT];
f->type = INPUT_META_PLANE;
f->fmt.meta.dataformat = V4L2_META_FMT_VIDC;
f->fmt.meta.dataformat =
v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_META, __func__);
f->fmt.meta.buffersize = MSM_VIDC_METADATA_SIZE;
inst->buffers.input_meta.min_count = 0;
inst->buffers.input_meta.extra_count = 0;

مشاهده پرونده

@@ -287,7 +287,7 @@ int msm_vidc_g_fmt(void *instance, struct v4l2_format *f)
if (f->type == INPUT_MPLANE || f->type == OUTPUT_MPLANE)
i_vpr_h(inst, "%s: type %s format %s width %d height %d size %d\n",
__func__, v4l2_type_name(f->type),
v4l2_pixelfmt_name(f->fmt.pix_mp.pixelformat),
v4l2_pixelfmt_name(inst, f->fmt.pix_mp.pixelformat),
f->fmt.pix_mp.width, f->fmt.pix_mp.height,
f->fmt.pix_mp.plane_fmt[0].sizeimage);
else if (f->type == INPUT_META_PLANE || f->type == OUTPUT_META_PLANE)
@@ -684,6 +684,7 @@ int msm_vidc_enum_framesizes(void *instance, struct v4l2_frmsizeenum *fsize)
struct msm_vidc_inst_capability *capability;
enum msm_vidc_colorformat_type colorfmt;
enum msm_vidc_codec_type codec;
u32 meta_fmt;
if (!inst || !fsize) {
d_vpr_e("%s: invalid params: %pK %pK\n",
@@ -700,11 +701,13 @@ int msm_vidc_enum_framesizes(void *instance, struct v4l2_frmsizeenum *fsize)
if (fsize->index)
return -EINVAL;
if (fsize->pixel_format != V4L2_META_FMT_VIDC) {
meta_fmt = v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_META, __func__);
if (fsize->pixel_format != meta_fmt) {
/* validate pixel format */
codec = v4l2_codec_to_driver(fsize->pixel_format, __func__);
codec = v4l2_codec_to_driver(inst, fsize->pixel_format, __func__);
if (!codec) {
colorfmt = v4l2_colorformat_to_driver(fsize->pixel_format, __func__);
colorfmt = v4l2_colorformat_to_driver(inst, fsize->pixel_format,
__func__);
if (colorfmt == MSM_VIDC_FMT_NONE) {
i_vpr_e(inst, "%s: unsupported pix fmt %#x\n",
__func__, fsize->pixel_format);
@@ -734,6 +737,7 @@ int msm_vidc_enum_frameintervals(void *instance, struct v4l2_frmivalenum *fival)
struct msm_vidc_inst_capability *capability;
enum msm_vidc_colorformat_type colorfmt;
u32 fps, mbpf;
u32 meta_fmt;
if (!inst || !fival) {
d_vpr_e("%s: invalid params: %pK %pK\n",
@@ -758,9 +762,10 @@ int msm_vidc_enum_frameintervals(void *instance, struct v4l2_frmivalenum *fival)
if (fival->index)
return -EINVAL;
if (fival->pixel_format != V4L2_META_FMT_VIDC) {
meta_fmt = v4l2_colorformat_from_driver(inst, MSM_VIDC_FMT_META, __func__);
if (fival->pixel_format != meta_fmt) {
/* validate pixel format */
colorfmt = v4l2_colorformat_to_driver(fival->pixel_format, __func__);
colorfmt = v4l2_colorformat_to_driver(inst, fival->pixel_format, __func__);
if (colorfmt == MSM_VIDC_FMT_NONE) {
i_vpr_e(inst, "%s: unsupported pix fmt %#x\n",
__func__, fival->pixel_format);

مشاهده پرونده

@@ -207,6 +207,7 @@ u32 msm_vidc_decoder_input_size(struct msm_vidc_inst *inst)
u32 base_res_mbs = NUM_MBS_4k;
struct v4l2_format *f;
u32 bitstream_size_overwrite = 0;
enum msm_vidc_codec_type codec;
if (!inst || !inst->capabilities) {
d_vpr_e("%s: invalid params\n", __func__);
@@ -230,13 +231,14 @@ u32 msm_vidc_decoder_input_size(struct msm_vidc_inst *inst)
* 4k mbs for VP8/VP9 and 4k / 2 for remaining codecs.
*/
f = &inst->fmts[INPUT_PORT];
codec = v4l2_codec_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__);
num_mbs = msm_vidc_get_mbs_per_frame(inst);
if (num_mbs > NUM_MBS_4k) {
div_factor = 4;
base_res_mbs = inst->capabilities->cap[MBPF].value;
} else {
base_res_mbs = NUM_MBS_4k;
if (f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_VP9)
if (codec == MSM_VIDC_VP9)
div_factor = 1;
else
div_factor = 2;
@@ -254,10 +256,8 @@ u32 msm_vidc_decoder_input_size(struct msm_vidc_inst *inst)
frame_size = base_res_mbs * MB_SIZE_IN_PIXEL * 3 / 2 / div_factor;
/* multiply by 10/8 (1.25) to get size for 10 bit case */
if (f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_VP9 ||
f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_AV1 ||
f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_HEVC ||
f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_HEIC)
if (codec == MSM_VIDC_VP9 || codec == MSM_VIDC_AV1 ||
codec == MSM_VIDC_HEVC || codec == MSM_VIDC_HEIC)
frame_size = frame_size + (frame_size >> 2);
i_vpr_h(inst, "set input buffer size to %d\n", frame_size);
@@ -272,7 +272,7 @@ u32 msm_vidc_decoder_output_size(struct msm_vidc_inst *inst)
enum msm_vidc_colorformat_type colorformat;
f = &inst->fmts[OUTPUT_PORT];
colorformat = v4l2_colorformat_to_driver(f->fmt.pix_mp.pixelformat,
colorformat = v4l2_colorformat_to_driver(inst, f->fmt.pix_mp.pixelformat,
__func__);
size = video_buffer_size(colorformat, f->fmt.pix_mp.width,
f->fmt.pix_mp.height, true);
@@ -304,7 +304,7 @@ u32 msm_vidc_encoder_input_size(struct msm_vidc_inst *inst)
f = &inst->fmts[INPUT_PORT];
width = f->fmt.pix_mp.width;
height = f->fmt.pix_mp.height;
colorformat = v4l2_colorformat_to_driver(f->fmt.pix_mp.pixelformat,
colorformat = v4l2_colorformat_to_driver(inst, f->fmt.pix_mp.pixelformat,
__func__);
if (is_image_session(inst)) {
width = ALIGN(width, HEIC_GRID_DIMENSION);
@@ -360,6 +360,7 @@ u32 msm_vidc_encoder_output_size(struct msm_vidc_inst *inst)
u32 mbs_per_frame;
u32 width, height;
struct v4l2_format *f;
enum msm_vidc_codec_type codec;
if (!inst || !inst->capabilities) {
d_vpr_e("%s: invalid params\n", __func__);
@@ -367,6 +368,7 @@ u32 msm_vidc_encoder_output_size(struct msm_vidc_inst *inst)
}
f = &inst->fmts[OUTPUT_PORT];
codec = v4l2_codec_to_driver(inst, f->fmt.pix_mp.pixelformat, __func__);
/*
* Encoder output size calculation: 32 Align width/height
* For heic session : YUVsize * 2
@@ -402,8 +404,7 @@ u32 msm_vidc_encoder_output_size(struct msm_vidc_inst *inst)
skip_calc:
/* multiply by 10/8 (1.25) to get size for 10 bit case */
if (f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_HEVC ||
f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_HEIC)
if (codec == MSM_VIDC_HEVC || codec == MSM_VIDC_HEIC)
frame_size = frame_size + (frame_size >> 2);
frame_size = ALIGN(frame_size, SZ_4K);

مشاهده پرونده

@@ -152,12 +152,6 @@ static const char *const mpeg_video_vidc_ir_type[] = {
NULL,
};
static const char *const mpeg_vidc_delivery_modes[] = {
"Frame Based Delivery Mode",
"Slice Based Delivery Mode",
NULL,
};
u32 msm_vidc_get_port_info(struct msm_vidc_inst *inst,
enum msm_vidc_inst_capability_type cap_id)
{
@@ -201,10 +195,6 @@ static const char * const * msm_vidc_get_qmenu_type(
return av1_tier;
case V4L2_CID_MPEG_VIDEO_VIDC_INTRA_REFRESH_TYPE:
return mpeg_video_vidc_ir_type;
case V4L2_CID_MPEG_VIDC_HEVC_ENCODE_DELIVERY_MODE:
return mpeg_vidc_delivery_modes;
case V4L2_CID_MPEG_VIDC_H264_ENCODE_DELIVERY_MODE:
return mpeg_vidc_delivery_modes;
default:
i_vpr_e(inst, "%s: No available qmenu for ctrl %#x\n",
__func__, control_id);
@@ -468,7 +458,7 @@ int msm_vidc_update_cap_value(struct msm_vidc_inst *inst, u32 cap_id,
* cumulative control value if client set same metadata
* control multiple times.
*/
if (adjusted_val & V4L2_MPEG_VIDC_META_ENABLE) {
if (adjusted_val & MSM_VIDC_META_ENABLE) {
/* enable metadata */
inst->capabilities->cap[cap_id].value |= adjusted_val;
} else {
@@ -1621,7 +1611,7 @@ int msm_vidc_adjust_transform_8x8(void *instance, struct v4l2_ctrl *ctrl)
if (profile != V4L2_MPEG_VIDEO_H264_PROFILE_HIGH &&
profile != V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_HIGH)
adjusted_value = V4L2_MPEG_MSM_VIDC_DISABLE;
adjusted_value = 0;
msm_vidc_update_cap_value(inst, TRANSFORM_8X8,
adjusted_value, __func__);
@@ -2350,7 +2340,7 @@ int msm_vidc_adjust_blur_type(void *instance, struct v4l2_ctrl *ctrl)
adjusted_value = ctrl ? ctrl->val :
capability->cap[BLUR_TYPES].value;
if (adjusted_value == VIDC_BLUR_NONE)
if (adjusted_value == MSM_VIDC_BLUR_NONE)
return 0;
if (msm_vidc_get_parent_value(inst, BLUR_TYPES, BITRATE_MODE,
@@ -2363,17 +2353,17 @@ int msm_vidc_adjust_blur_type(void *instance, struct v4l2_ctrl *ctrl)
&roi_enable, __func__))
return -EINVAL;
if (adjusted_value == VIDC_BLUR_EXTERNAL) {
if (adjusted_value == MSM_VIDC_BLUR_EXTERNAL) {
if (is_scaling_enabled(inst) || min_quality) {
adjusted_value = VIDC_BLUR_NONE;
adjusted_value = MSM_VIDC_BLUR_NONE;
}
} else if (adjusted_value == VIDC_BLUR_ADAPTIVE) {
} else if (adjusted_value == MSM_VIDC_BLUR_ADAPTIVE) {
if (is_scaling_enabled(inst) || min_quality ||
(rc_type != HFI_RC_VBR_CFR &&
rc_type != HFI_RC_CBR_CFR &&
rc_type != HFI_RC_CBR_VFR) ||
is_10bit_colorformat(pix_fmts) || roi_enable) {
adjusted_value = VIDC_BLUR_NONE;
adjusted_value = MSM_VIDC_BLUR_NONE;
}
}
@@ -2450,7 +2440,7 @@ int msm_vidc_adjust_blur_resolution(void *instance, struct v4l2_ctrl *ctrl)
&blur_type, __func__))
return -EINVAL;
if (blur_type != VIDC_BLUR_EXTERNAL)
if (blur_type != MSM_VIDC_BLUR_EXTERNAL)
return 0;
msm_vidc_update_cap_value(inst, BLUR_RESOLUTION,
@@ -2725,7 +2715,7 @@ int msm_vidc_adjust_preprocess(void *instance, struct v4l2_ctrl *ctrl)
* BRS enabled and upto 4k @ 60 fps
*/
if (!is_meta_tx_inp_enabled(inst, META_EVA_STATS) &&
brs == V4L2_MPEG_MSM_VIDC_ENABLE &&
brs == 1 &&
res_is_less_than_or_equal_to(width, height, 3840, 2160) &&
max_fps <= 60)
adjusted_value = 1;
@@ -2774,7 +2764,7 @@ int msm_vidc_adjust_dec_lowlatency_mode(void *instance, struct v4l2_ctrl *ctrl)
struct msm_vidc_inst_capability *capability;
s32 adjusted_value;
struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
s32 outbuf_fence = V4L2_MPEG_VIDC_META_DISABLE;
s32 outbuf_fence = MSM_VIDC_META_DISABLE;
if (!inst || !inst->capabilities) {
d_vpr_e("%s: invalid params\n", __func__);
@@ -2790,8 +2780,8 @@ int msm_vidc_adjust_dec_lowlatency_mode(void *instance, struct v4l2_ctrl *ctrl)
return -EINVAL;
/* enable lowlatency if outbuf fence is enabled */
if (outbuf_fence & V4L2_MPEG_VIDC_META_ENABLE &&
outbuf_fence & V4L2_MPEG_VIDC_META_RX_INPUT)
if (outbuf_fence & MSM_VIDC_META_ENABLE &&
outbuf_fence & MSM_VIDC_META_RX_INPUT)
adjusted_value = 1;
msm_vidc_update_cap_value(inst, LOWLATENCY_MODE,
@@ -2893,10 +2883,10 @@ int msm_vidc_adjust_dec_outbuf_fence(void *instance, struct v4l2_ctrl *ctrl)
&picture_order, __func__))
return -EINVAL;
if (picture_order == V4L2_MPEG_MSM_VIDC_DISABLE) {
if (picture_order == 0) {
/* disable outbuf fence */
adjusted_value = V4L2_MPEG_VIDC_META_DISABLE |
V4L2_MPEG_VIDC_META_RX_INPUT;
adjusted_value = MSM_VIDC_META_DISABLE |
MSM_VIDC_META_RX_INPUT;
}
msm_vidc_update_cap_value(inst, META_OUTBUF_FENCE,
@@ -3982,7 +3972,7 @@ int msm_vidc_set_blur_resolution(void *instance,
BLUR_TYPES, &blur_type, __func__))
return -EINVAL;
if (blur_type != VIDC_BLUR_EXTERNAL)
if (blur_type != MSM_VIDC_BLUR_EXTERNAL)
return 0;
hfi_value = inst->capabilities->cap[cap_id].value;
@@ -4336,33 +4326,6 @@ int msm_vidc_v4l2_menu_to_hfi(struct msm_vidc_inst *inst,
goto set_default;
}
return 0;
case DELIVERY_MODE:
if (inst->codec == MSM_VIDC_H264) {
switch (capability->cap[cap_id].value) {
case V4L2_MPEG_VIDC_H264_ENCODE_DELIVERY_MODE_FRAME_BASED:
*value = 0;
break;
case V4L2_MPEG_VIDC_H264_ENCODE_DELIVERY_MODE_SLICE_BASED:
*value = 1;
break;
default:
*value = 0;
goto set_default;
}
} else if (inst->codec == MSM_VIDC_HEVC) {
switch (capability->cap[cap_id].value) {
case V4L2_MPEG_VIDC_HEVC_ENCODE_DELIVERY_MODE_FRAME_BASED:
*value = 0;
break;
case V4L2_MPEG_VIDC_HEVC_ENCODE_DELIVERY_MODE_SLICE_BASED:
*value = 1;
break;
default:
*value = 0;
goto set_default;
}
}
return 0;
default:
i_vpr_e(inst,
"%s: mapping not specified for ctrl_id: %#x\n",

مشاهده پرونده

@@ -400,27 +400,40 @@ const char *v4l2_type_name(u32 port)
return "UNKNOWN";
}
const char *v4l2_pixelfmt_name(u32 pixfmt)
const char *v4l2_pixelfmt_name(struct msm_vidc_inst *inst, u32 pixfmt)
{
switch (pixfmt) {
/* raw port: color format */
case V4L2_PIX_FMT_NV12: return "NV12";
case V4L2_PIX_FMT_NV21: return "NV21";
case V4L2_PIX_FMT_VIDC_NV12C: return "NV12C";
case V4L2_PIX_FMT_VIDC_P010: return "P010";
case V4L2_PIX_FMT_VIDC_TP10C: return "TP10C";
case V4L2_PIX_FMT_RGBA32: return "RGBA";
case V4L2_PIX_FMT_VIDC_ARGB32C: return "RGBAC";
/* bitstream port: codec type */
case V4L2_PIX_FMT_H264: return "AVC";
case V4L2_PIX_FMT_HEVC: return "HEVC";
case V4L2_PIX_FMT_HEIC: return "HEIC";
case V4L2_PIX_FMT_VP9: return "VP9";
case V4L2_PIX_FMT_AV1: return "AV1";
/* meta port */
case V4L2_META_FMT_VIDC: return "META";
struct msm_vidc_core *core;
const struct codec_info *codec_info;
const struct color_format_info *color_format_info;
u32 i, size;
if (!inst || !inst->core) {
d_vpr_e("%s: invalid params\n", __func__);
goto exit;
}
core = inst->core;
if (!core->platform || !core->platform->data.format_data) {
d_vpr_e("%s: invalid core platform\n", __func__);
goto exit;
}
codec_info = core->platform->data.format_data->codec_info;
size = core->platform->data.format_data->codec_info_size;
for (i = 0; i < size; i++) {
if (codec_info[i].v4l2_codec == pixfmt)
return codec_info[i].pixfmt_name;
}
color_format_info = core->platform->data.format_data->color_format_info;
size = core->platform->data.format_data->color_format_info_size;
for (i = 0; i < size; i++) {
if (color_format_info[i].v4l2_color_format == pixfmt)
return color_format_info[i].pixfmt_name;
}
exit:
return "UNKNOWN";
}
@@ -696,423 +709,317 @@ u32 v4l2_type_from_driver(enum msm_vidc_buffer_type buffer_type,
return type;
}
enum msm_vidc_codec_type v4l2_codec_to_driver(u32 v4l2_codec, const char *func)
enum msm_vidc_codec_type v4l2_codec_to_driver(struct msm_vidc_inst *inst,
u32 v4l2_codec, const char *func)
{
struct msm_vidc_core *core;
const struct codec_info *codec_info;
u32 i, size;
enum msm_vidc_codec_type codec = 0;
switch (v4l2_codec) {
case V4L2_PIX_FMT_H264:
codec = MSM_VIDC_H264;
break;
case V4L2_PIX_FMT_HEVC:
codec = MSM_VIDC_HEVC;
break;
case V4L2_PIX_FMT_VP9:
codec = MSM_VIDC_VP9;
break;
case V4L2_PIX_FMT_AV1:
codec = MSM_VIDC_AV1;
break;
case V4L2_PIX_FMT_HEIC:
codec = MSM_VIDC_HEIC;
break;
default:
d_vpr_h("%s: invalid v4l2 codec %#x\n", func, v4l2_codec);
break;
if (!inst || !inst->core) {
d_vpr_e("%s: invalid params\n", __func__);
return -EINVAL;
}
core = inst->core;
if (!core->platform || !core->platform->data.format_data) {
d_vpr_e("%s: invalid core platform\n", __func__);
return -EINVAL;
}
codec_info = core->platform->data.format_data->codec_info;
size = core->platform->data.format_data->codec_info_size;
for (i = 0; i < size; i++) {
if (codec_info[i].v4l2_codec == v4l2_codec)
return codec_info[i].vidc_codec;
}
d_vpr_h("%s: invalid v4l2 codec %#x\n", func, v4l2_codec);
return codec;
}
u32 v4l2_codec_from_driver(enum msm_vidc_codec_type codec, const char *func)
u32 v4l2_codec_from_driver(struct msm_vidc_inst *inst,
enum msm_vidc_codec_type codec, const char *func)
{
struct msm_vidc_core *core;
const struct codec_info *codec_info;
u32 i, size;
u32 v4l2_codec = 0;
switch (codec) {
case MSM_VIDC_H264:
v4l2_codec = V4L2_PIX_FMT_H264;
break;
case MSM_VIDC_HEVC:
v4l2_codec = V4L2_PIX_FMT_HEVC;
break;
case MSM_VIDC_VP9:
v4l2_codec = V4L2_PIX_FMT_VP9;
break;
case MSM_VIDC_AV1:
v4l2_codec = V4L2_PIX_FMT_AV1;
break;
case MSM_VIDC_HEIC:
v4l2_codec = V4L2_PIX_FMT_HEIC;
break;
default:
d_vpr_e("%s: invalid driver codec %#x\n", func, codec);
break;
if (!inst || !inst->core) {
d_vpr_e("%s: invalid params\n", __func__);
return -EINVAL;
}
core = inst->core;
if (!core->platform || !core->platform->data.format_data) {
d_vpr_e("%s: invalid core platform\n", __func__);
return -EINVAL;
}
codec_info = core->platform->data.format_data->codec_info;
size = core->platform->data.format_data->codec_info_size;
for (i = 0; i < size; i++) {
if (codec_info[i].vidc_codec == codec)
return codec_info[i].v4l2_codec;
}
d_vpr_e("%s: invalid driver codec %#x\n", func, codec);
return v4l2_codec;
}
enum msm_vidc_colorformat_type v4l2_colorformat_to_driver(u32 v4l2_colorformat,
const char *func)
enum msm_vidc_colorformat_type v4l2_colorformat_to_driver(
struct msm_vidc_inst *inst,
u32 v4l2_colorformat, const char *func)
{
struct msm_vidc_core *core;
const struct color_format_info *color_format_info;
u32 i, size;
enum msm_vidc_colorformat_type colorformat = 0;
switch (v4l2_colorformat) {
case V4L2_PIX_FMT_NV12:
colorformat = MSM_VIDC_FMT_NV12;
break;
case V4L2_PIX_FMT_NV21:
colorformat = MSM_VIDC_FMT_NV21;
break;
case V4L2_PIX_FMT_VIDC_NV12C:
colorformat = MSM_VIDC_FMT_NV12C;
break;
case V4L2_PIX_FMT_VIDC_TP10C:
colorformat = MSM_VIDC_FMT_TP10C;
break;
case V4L2_PIX_FMT_RGBA32:
colorformat = MSM_VIDC_FMT_RGBA8888;
break;
case V4L2_PIX_FMT_VIDC_ARGB32C:
colorformat = MSM_VIDC_FMT_RGBA8888C;
break;
case V4L2_PIX_FMT_VIDC_P010:
colorformat = MSM_VIDC_FMT_P010;
break;
default:
d_vpr_e("%s: invalid v4l2 color format %#x\n",
func, v4l2_colorformat);
break;
if (!inst || !inst->core) {
d_vpr_e("%s: invalid params\n", __func__);
return -EINVAL;
}
core = inst->core;
if (!core->platform || !core->platform->data.format_data) {
d_vpr_e("%s: invalid core platform\n", __func__);
return -EINVAL;
}
color_format_info = core->platform->data.format_data->color_format_info;
size = core->platform->data.format_data->color_format_info_size;
for (i = 0; i < size; i++) {
if (color_format_info[i].v4l2_color_format == v4l2_colorformat)
return color_format_info[i].vidc_color_format;
}
d_vpr_e("%s: invalid v4l2 color format %#x\n", func, v4l2_colorformat);
return colorformat;
}
u32 v4l2_colorformat_from_driver(enum msm_vidc_colorformat_type colorformat,
u32 v4l2_colorformat_from_driver(struct msm_vidc_inst *inst,
enum msm_vidc_colorformat_type colorformat,
const char *func)
{
struct msm_vidc_core *core;
const struct color_format_info *color_format_info;
u32 i, size;
u32 v4l2_colorformat = 0;
switch (colorformat) {
case MSM_VIDC_FMT_NV12:
v4l2_colorformat = V4L2_PIX_FMT_NV12;
break;
case MSM_VIDC_FMT_NV21:
v4l2_colorformat = V4L2_PIX_FMT_NV21;
break;
case MSM_VIDC_FMT_NV12C:
v4l2_colorformat = V4L2_PIX_FMT_VIDC_NV12C;
break;
case MSM_VIDC_FMT_TP10C:
v4l2_colorformat = V4L2_PIX_FMT_VIDC_TP10C;
break;
case MSM_VIDC_FMT_RGBA8888:
v4l2_colorformat = V4L2_PIX_FMT_RGBA32;
break;
case MSM_VIDC_FMT_RGBA8888C:
v4l2_colorformat = V4L2_PIX_FMT_VIDC_ARGB32C;
break;
case MSM_VIDC_FMT_P010:
v4l2_colorformat = V4L2_PIX_FMT_VIDC_P010;
break;
default:
d_vpr_e("%s: invalid driver color format %#x\n",
func, colorformat);
break;
if (!inst || !inst->core) {
d_vpr_e("%s: invalid params\n", __func__);
return -EINVAL;
}
core = inst->core;
if (!core->platform || !core->platform->data.format_data) {
d_vpr_e("%s: invalid core platform\n", __func__);
return -EINVAL;
}
color_format_info = core->platform->data.format_data->color_format_info;
size = core->platform->data.format_data->color_format_info_size;
for (i = 0; i < size; i++) {
if (color_format_info[i].vidc_color_format == colorformat)
return color_format_info[i].v4l2_color_format;
}
d_vpr_e("%s: invalid driver color format %#x\n", func, colorformat);
return v4l2_colorformat;
}
u32 v4l2_color_primaries_to_driver(struct msm_vidc_inst *inst,
u32 v4l2_primaries, const char *func)
{
struct msm_vidc_core *core;
const struct color_primaries_info *color_prim_info;
u32 i, size;
u32 vidc_color_primaries = MSM_VIDC_PRIMARIES_RESERVED;
switch(v4l2_primaries) {
case V4L2_COLORSPACE_DEFAULT:
vidc_color_primaries = MSM_VIDC_PRIMARIES_RESERVED;
break;
case V4L2_COLORSPACE_REC709:
vidc_color_primaries = MSM_VIDC_PRIMARIES_BT709;
break;
case V4L2_COLORSPACE_470_SYSTEM_M:
vidc_color_primaries = MSM_VIDC_PRIMARIES_BT470_SYSTEM_M;
break;
case V4L2_COLORSPACE_470_SYSTEM_BG:
vidc_color_primaries = MSM_VIDC_PRIMARIES_BT470_SYSTEM_BG;
break;
case V4L2_COLORSPACE_SMPTE170M:
vidc_color_primaries = MSM_VIDC_PRIMARIES_BT601_525;
break;
case V4L2_COLORSPACE_SMPTE240M:
vidc_color_primaries = MSM_VIDC_PRIMARIES_SMPTE_ST240M;
break;
case V4L2_COLORSPACE_VIDC_GENERIC_FILM:
vidc_color_primaries = MSM_VIDC_PRIMARIES_GENERIC_FILM;
break;
case V4L2_COLORSPACE_BT2020:
vidc_color_primaries = MSM_VIDC_PRIMARIES_BT2020;
break;
case V4L2_COLORSPACE_DCI_P3:
vidc_color_primaries = MSM_VIDC_PRIMARIES_SMPTE_RP431_2;
break;
case V4L2_COLORSPACE_VIDC_EG431:
vidc_color_primaries = MSM_VIDC_PRIMARIES_SMPTE_EG431_1;
break;
case V4L2_COLORSPACE_VIDC_EBU_TECH:
vidc_color_primaries = MSM_VIDC_PRIMARIES_SMPTE_EBU_TECH;
break;
default:
i_vpr_e(inst, "%s: invalid v4l2 color primaries %d\n",
func, v4l2_primaries);
break;
if (!inst || !inst->core) {
d_vpr_e("%s: invalid params\n", __func__);
return -EINVAL;
}
core = inst->core;
if (!core->platform || !core->platform->data.format_data) {
d_vpr_e("%s: invalid core platform\n", __func__);
return -EINVAL;
}
color_prim_info = core->platform->data.format_data->color_prim_info;
size = core->platform->data.format_data->color_prim_info_size;
for (i = 0; i < size; i++) {
if (color_prim_info[i].v4l2_color_primaries == v4l2_primaries)
return color_prim_info[i].vidc_color_primaries;
}
i_vpr_e(inst, "%s: invalid v4l2 color primaries %d\n",
func, v4l2_primaries);
return vidc_color_primaries;
}
u32 v4l2_color_primaries_from_driver(struct msm_vidc_inst *inst,
u32 vidc_color_primaries, const char *func)
{
struct msm_vidc_core *core;
const struct color_primaries_info *color_prim_info;
u32 i, size;
u32 v4l2_primaries = V4L2_COLORSPACE_DEFAULT;
switch(vidc_color_primaries) {
case MSM_VIDC_PRIMARIES_UNSPECIFIED:
v4l2_primaries = V4L2_COLORSPACE_DEFAULT;
break;
case MSM_VIDC_PRIMARIES_BT709:
v4l2_primaries = V4L2_COLORSPACE_REC709;
break;
case MSM_VIDC_PRIMARIES_BT470_SYSTEM_M:
v4l2_primaries = V4L2_COLORSPACE_470_SYSTEM_M;
break;
case MSM_VIDC_PRIMARIES_BT470_SYSTEM_BG:
v4l2_primaries = V4L2_COLORSPACE_470_SYSTEM_BG;
break;
case MSM_VIDC_PRIMARIES_BT601_525:
v4l2_primaries = V4L2_COLORSPACE_SMPTE170M;
break;
case MSM_VIDC_PRIMARIES_SMPTE_ST240M:
v4l2_primaries = V4L2_COLORSPACE_SMPTE240M;
break;
case MSM_VIDC_PRIMARIES_GENERIC_FILM:
v4l2_primaries = V4L2_COLORSPACE_VIDC_GENERIC_FILM;
break;
case MSM_VIDC_PRIMARIES_BT2020:
v4l2_primaries = V4L2_COLORSPACE_BT2020;
break;
case MSM_VIDC_PRIMARIES_SMPTE_RP431_2:
v4l2_primaries = V4L2_COLORSPACE_DCI_P3;
break;
case MSM_VIDC_PRIMARIES_SMPTE_EG431_1:
v4l2_primaries = V4L2_COLORSPACE_VIDC_EG431;
break;
case MSM_VIDC_PRIMARIES_SMPTE_EBU_TECH:
v4l2_primaries = V4L2_COLORSPACE_VIDC_EBU_TECH;
break;
default:
i_vpr_e(inst, "%s: invalid hfi color primaries %d\n",
func, vidc_color_primaries);
break;
if (!inst || !inst->core) {
d_vpr_e("%s: invalid params\n", __func__);
return -EINVAL;
}
core = inst->core;
if (!core->platform || !core->platform->data.format_data) {
d_vpr_e("%s: invalid core platform\n", __func__);
return -EINVAL;
}
color_prim_info = core->platform->data.format_data->color_prim_info;
size = core->platform->data.format_data->color_prim_info_size;
for (i = 0; i < size; i++) {
if (color_prim_info[i].vidc_color_primaries == vidc_color_primaries)
return color_prim_info[i].v4l2_color_primaries;
}
i_vpr_e(inst, "%s: invalid hfi color primaries %d\n",
func, vidc_color_primaries);
return v4l2_primaries;
}
u32 v4l2_transfer_char_to_driver(struct msm_vidc_inst *inst,
u32 v4l2_transfer_char, const char *func)
{
struct msm_vidc_core *core;
const struct transfer_char_info *transfer_char_info;
u32 i, size;
u32 vidc_transfer_char = MSM_VIDC_TRANSFER_RESERVED;
switch(v4l2_transfer_char) {
case V4L2_XFER_FUNC_DEFAULT:
vidc_transfer_char = MSM_VIDC_TRANSFER_RESERVED;
break;
case V4L2_XFER_FUNC_709:
vidc_transfer_char = MSM_VIDC_TRANSFER_BT709;
break;
case V4L2_XFER_FUNC_VIDC_BT470_SYSTEM_M:
vidc_transfer_char = MSM_VIDC_TRANSFER_BT470_SYSTEM_M;
break;
case V4L2_XFER_FUNC_VIDC_BT470_SYSTEM_BG:
vidc_transfer_char = MSM_VIDC_TRANSFER_BT470_SYSTEM_BG;
break;
case V4L2_XFER_FUNC_VIDC_BT601_525_OR_625:
vidc_transfer_char = MSM_VIDC_TRANSFER_BT601_525_OR_625;
break;
case V4L2_XFER_FUNC_SMPTE240M:
vidc_transfer_char = MSM_VIDC_TRANSFER_SMPTE_ST240M;
break;
case V4L2_XFER_FUNC_VIDC_LINEAR:
vidc_transfer_char = MSM_VIDC_TRANSFER_LINEAR;
break;
case V4L2_XFER_FUNC_VIDC_XVYCC:
vidc_transfer_char = MSM_VIDC_TRANSFER_XVYCC;
break;
case V4L2_XFER_FUNC_VIDC_BT1361:
vidc_transfer_char = MSM_VIDC_TRANSFER_BT1361_0;
break;
case V4L2_XFER_FUNC_SRGB:
vidc_transfer_char = MSM_VIDC_TRANSFER_SRGB_SYCC;
break;
case V4L2_XFER_FUNC_VIDC_BT2020:
vidc_transfer_char = MSM_VIDC_TRANSFER_BT2020_14;
break;
case V4L2_XFER_FUNC_SMPTE2084:
vidc_transfer_char = MSM_VIDC_TRANSFER_SMPTE_ST2084_PQ;
break;
case V4L2_XFER_FUNC_VIDC_ST428:
vidc_transfer_char = MSM_VIDC_TRANSFER_SMPTE_ST428_1;
break;
case V4L2_XFER_FUNC_VIDC_HLG:
vidc_transfer_char = MSM_VIDC_TRANSFER_BT2100_2_HLG;
break;
default:
i_vpr_e(inst, "%s: invalid v4l2 transfer char %d\n",
func, v4l2_transfer_char);
break;
if (!inst || !inst->core) {
d_vpr_e("%s: invalid params\n", __func__);
return -EINVAL;
}
core = inst->core;
if (!core->platform || !core->platform->data.format_data) {
d_vpr_e("%s: invalid core platform\n", __func__);
return -EINVAL;
}
transfer_char_info = core->platform->data.format_data->transfer_char_info;
size = core->platform->data.format_data->transfer_char_info_size;
for (i = 0; i < size; i++) {
if (transfer_char_info[i].v4l2_transfer_char == v4l2_transfer_char)
return transfer_char_info[i].vidc_transfer_char;
}
i_vpr_e(inst, "%s: invalid v4l2 transfer char %d\n",
func, v4l2_transfer_char);
return vidc_transfer_char;
}
u32 v4l2_transfer_char_from_driver(struct msm_vidc_inst *inst,
u32 vidc_transfer_char, const char *func)
{
struct msm_vidc_core *core;
const struct transfer_char_info *transfer_char_info;
u32 i, size;
u32 v4l2_transfer_char = V4L2_XFER_FUNC_DEFAULT;
switch(vidc_transfer_char) {
case MSM_VIDC_TRANSFER_UNSPECIFIED:
v4l2_transfer_char = V4L2_XFER_FUNC_DEFAULT;
break;
case MSM_VIDC_TRANSFER_BT709:
v4l2_transfer_char = V4L2_XFER_FUNC_709;
break;
case MSM_VIDC_TRANSFER_BT470_SYSTEM_M:
v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_BT470_SYSTEM_M;
break;
case MSM_VIDC_TRANSFER_BT470_SYSTEM_BG:
v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_BT470_SYSTEM_BG;
break;
case MSM_VIDC_TRANSFER_BT601_525_OR_625:
v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_BT601_525_OR_625;
break;
case MSM_VIDC_TRANSFER_SMPTE_ST240M:
v4l2_transfer_char = V4L2_XFER_FUNC_SMPTE240M;
break;
case MSM_VIDC_TRANSFER_LINEAR:
v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_LINEAR;
break;
case MSM_VIDC_TRANSFER_XVYCC:
v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_XVYCC;
break;
case MSM_VIDC_TRANSFER_BT1361_0:
v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_BT1361;
break;
case MSM_VIDC_TRANSFER_SRGB_SYCC:
v4l2_transfer_char = V4L2_XFER_FUNC_SRGB;
break;
case MSM_VIDC_TRANSFER_BT2020_14:
case MSM_VIDC_TRANSFER_BT2020_15:
v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_BT2020;
break;
case MSM_VIDC_TRANSFER_SMPTE_ST2084_PQ:
v4l2_transfer_char = V4L2_XFER_FUNC_SMPTE2084;
break;
case MSM_VIDC_TRANSFER_SMPTE_ST428_1:
v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_ST428;
break;
case MSM_VIDC_TRANSFER_BT2100_2_HLG:
v4l2_transfer_char = V4L2_XFER_FUNC_VIDC_HLG;
break;
default:
i_vpr_e(inst, "%s: invalid hfi transfer char %d\n",
func, vidc_transfer_char);
break;
if (!inst || !inst->core) {
d_vpr_e("%s: invalid params\n", __func__);
return -EINVAL;
}
core = inst->core;
if (!core->platform || !core->platform->data.format_data) {
d_vpr_e("%s: invalid core platform\n", __func__);
return -EINVAL;
}
transfer_char_info = core->platform->data.format_data->transfer_char_info;
size = core->platform->data.format_data->transfer_char_info_size;
for (i = 0; i < size; i++) {
if (transfer_char_info[i].vidc_transfer_char == vidc_transfer_char)
return transfer_char_info[i].v4l2_transfer_char;
}
i_vpr_e(inst, "%s: invalid hfi transfer char %d\n",
func, vidc_transfer_char);
return v4l2_transfer_char;
}
u32 v4l2_matrix_coeff_to_driver(struct msm_vidc_inst *inst,
u32 v4l2_matrix_coeff, const char *func)
{
struct msm_vidc_core *core;
const struct matrix_coeff_info *matrix_coeff_info;
u32 i, size;
u32 vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_RESERVED;
switch(v4l2_matrix_coeff) {
case V4L2_YCBCR_ENC_DEFAULT:
vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_RESERVED;
break;
case V4L2_YCBCR_VIDC_SRGB_OR_SMPTE_ST428:
vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_SRGB_SMPTE_ST428_1;
break;
case V4L2_YCBCR_ENC_709:
case V4L2_YCBCR_ENC_XV709:
vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_BT709;
break;
case V4L2_YCBCR_VIDC_FCC47_73_682:
vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_FCC_TITLE_47;
break;
case V4L2_YCBCR_ENC_XV601:
vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_BT470_SYS_BG_OR_BT601_625;
break;
case V4L2_YCBCR_ENC_601:
vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_BT601_525_BT1358_525_OR_625;
break;
case V4L2_YCBCR_ENC_SMPTE240M:
vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_SMPTE_ST240;
break;
case V4L2_YCBCR_ENC_BT2020:
vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_BT2020_NON_CONSTANT;
break;
case V4L2_YCBCR_ENC_BT2020_CONST_LUM:
vidc_matrix_coeff = MSM_VIDC_MATRIX_COEFF_BT2020_CONSTANT;
break;
default:
i_vpr_e(inst, "%s: invalid v4l2 matrix coeff %d\n",
func, v4l2_matrix_coeff);
break;
if (!inst || !inst->core) {
d_vpr_e("%s: invalid params\n", __func__);
return -EINVAL;
}
core = inst->core;
if (!core->platform || !core->platform->data.format_data) {
d_vpr_e("%s: invalid core platform\n", __func__);
return -EINVAL;
}
matrix_coeff_info = core->platform->data.format_data->matrix_coeff_info;
size = core->platform->data.format_data->matrix_coeff_info_size;
for (i = 0; i < size; i++) {
if (matrix_coeff_info[i].v4l2_matrix_coeff == v4l2_matrix_coeff)
return matrix_coeff_info[i].vidc_matrix_coeff;
}
i_vpr_e(inst, "%s: invalid v4l2 matrix coeff %d\n",
func, v4l2_matrix_coeff);
return vidc_matrix_coeff;
}
u32 v4l2_matrix_coeff_from_driver(struct msm_vidc_inst *inst,
u32 vidc_matrix_coeff, const char *func)
{
struct msm_vidc_core *core;
const struct matrix_coeff_info *matrix_coeff_info;
u32 i, size;
u32 v4l2_matrix_coeff = V4L2_YCBCR_ENC_DEFAULT;
switch(vidc_matrix_coeff) {
case MSM_VIDC_MATRIX_COEFF_SRGB_SMPTE_ST428_1:
v4l2_matrix_coeff = V4L2_YCBCR_VIDC_SRGB_OR_SMPTE_ST428;
break;
case MSM_VIDC_MATRIX_COEFF_BT709:
v4l2_matrix_coeff = V4L2_YCBCR_ENC_709;
break;
case MSM_VIDC_MATRIX_COEFF_UNSPECIFIED:
v4l2_matrix_coeff = V4L2_YCBCR_ENC_DEFAULT;
break;
case MSM_VIDC_MATRIX_COEFF_FCC_TITLE_47:
v4l2_matrix_coeff = V4L2_YCBCR_VIDC_FCC47_73_682;
break;
case MSM_VIDC_MATRIX_COEFF_BT470_SYS_BG_OR_BT601_625:
v4l2_matrix_coeff = V4L2_YCBCR_ENC_XV601;
break;
case MSM_VIDC_MATRIX_COEFF_BT601_525_BT1358_525_OR_625:
v4l2_matrix_coeff = V4L2_YCBCR_ENC_601;
break;
case MSM_VIDC_MATRIX_COEFF_SMPTE_ST240:
v4l2_matrix_coeff = V4L2_YCBCR_ENC_SMPTE240M;
break;
case MSM_VIDC_MATRIX_COEFF_BT2020_NON_CONSTANT:
v4l2_matrix_coeff = V4L2_YCBCR_ENC_BT2020;
break;
case MSM_VIDC_MATRIX_COEFF_BT2020_CONSTANT:
v4l2_matrix_coeff = V4L2_YCBCR_ENC_BT2020_CONST_LUM;
break;
default:
i_vpr_e(inst, "%s: invalid hfi matrix coeff %d\n",
func, vidc_matrix_coeff);
break;
if (!inst || !inst->core) {
d_vpr_e("%s: invalid params\n", __func__);
return -EINVAL;
}
core = inst->core;
if (!core->platform || !core->platform->data.format_data) {
d_vpr_e("%s: invalid core platform\n", __func__);
return -EINVAL;
}
matrix_coeff_info = core->platform->data.format_data->matrix_coeff_info;
size = core->platform->data.format_data->matrix_coeff_info_size;
for (i = 0; i < size; i++) {
if (matrix_coeff_info[i].v4l2_matrix_coeff == v4l2_matrix_coeff)
return matrix_coeff_info[i].vidc_matrix_coeff;
}
i_vpr_e(inst, "%s: invalid hfi matrix coeff %d\n",
func, vidc_matrix_coeff);
return v4l2_matrix_coeff;
}

مشاهده پرونده

@@ -250,7 +250,7 @@ int msm_vidc_scale_buses(struct msm_vidc_inst *inst)
vote_data->bitrate = (vote_data->bitrate / frame_rate) * operating_rate;
vote_data->num_formats = 1;
vote_data->color_formats[0] = v4l2_colorformat_to_driver(
vote_data->color_formats[0] = v4l2_colorformat_to_driver(inst,
inst->fmts[INPUT_PORT].fmt.pix_mp.pixelformat, __func__);
vote_data->vpss_preprocessing_enabled =
inst->capabilities->cap[REQUEST_PREPROCESS].value;
@@ -259,7 +259,7 @@ int msm_vidc_scale_buses(struct msm_vidc_inst *inst)
vote_data->domain = MSM_VIDC_DECODER;
vote_data->bitrate = inst->max_input_data_size * vote_data->fps * 8;
color_format = v4l2_colorformat_to_driver(
color_format = v4l2_colorformat_to_driver(inst,
inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat, __func__);
if (is_linear_colorformat(color_format)) {
vote_data->num_formats = 2;