video: driver: modify msm_media_info.h to fix 10bit
- introduce STRIDE_BYTES and STRIDE_PIX to calculate size is bytes and pxls respectively. - DEPRECATE VENUS_BUFFER_SIZE and introduce VIDEO_RAW_BUFFER_SIZE. All buffer sizes are calculated by using STRIDE_BYTES. - For s_fmt, use STRIDE_PIX to calculate size. - For v4l2 bytesperline, use STRIDE_IN_BYTES to calculates size in bytes Change-Id: I3db4d843d1834b25c6160ebc318572ac67e22806 Signed-off-by: Darshana Patil <darshana@codeaurora.org>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
74ca2ac96b
commit
d4b5661567
@@ -70,7 +70,7 @@ static struct msm_platform_core_capability core_data_waipio[] = {
|
||||
{DEBUG_TIMEOUT, 0},
|
||||
// TODO: review below entries, and if required rename as PREFETCH
|
||||
{PREFIX_BUF_COUNT_PIX, 18},
|
||||
{PREFIX_BUF_SIZE_PIX, 13434880}, /* Calculated by VENUS_BUFFER_SIZE for 4096x2160 UBWC */
|
||||
{PREFIX_BUF_SIZE_PIX, 13434880}, /* Calculated by VIDEO_RAW_BUFFER_SIZE for 4096x2160 UBWC */
|
||||
{PREFIX_BUF_COUNT_NON_PIX, 1},
|
||||
{PREFIX_BUF_SIZE_NON_PIX, 209715200}, /*
|
||||
* Internal buffer size is calculated for secure decode session
|
||||
|
@@ -198,7 +198,7 @@ static u32 msm_vidc_decoder_dpb_size_iris2(struct msm_vidc_inst *inst)
|
||||
{
|
||||
|
||||
u32 size = 0;
|
||||
u32 color_fmt, media_fmt;
|
||||
u32 color_fmt, v4l2_fmt;
|
||||
u32 width, height;
|
||||
struct v4l2_format *f;
|
||||
|
||||
@@ -216,22 +216,22 @@ static u32 msm_vidc_decoder_dpb_size_iris2(struct msm_vidc_inst *inst)
|
||||
height = f->fmt.pix_mp.height;
|
||||
|
||||
if (color_fmt == MSM_VIDC_FMT_NV12) {
|
||||
media_fmt = COLOR_FMT_NV12_UBWC;
|
||||
v4l2_fmt = V4L2_PIX_FMT_VIDC_NV12C;
|
||||
HFI_NV12_UBWC_IL_CALC_BUF_SIZE_V2(size, width, height,
|
||||
VENUS_Y_STRIDE(media_fmt, width), VENUS_Y_SCANLINES(media_fmt, height),
|
||||
VENUS_UV_STRIDE(media_fmt, width), VENUS_UV_SCANLINES(media_fmt, height),
|
||||
VENUS_Y_META_STRIDE(media_fmt, width), VENUS_Y_META_SCANLINES(media_fmt,
|
||||
VIDEO_Y_STRIDE_BYTES(v4l2_fmt, width), VIDEO_Y_SCANLINES(v4l2_fmt, height),
|
||||
VIDEO_UV_STRIDE_BYTES(v4l2_fmt, width), VIDEO_UV_SCANLINES(v4l2_fmt, height),
|
||||
VIDEO_Y_META_STRIDE(v4l2_fmt, width), VIDEO_Y_META_SCANLINES(v4l2_fmt,
|
||||
height),
|
||||
VENUS_UV_META_STRIDE(media_fmt, width), VENUS_UV_META_SCANLINES(media_fmt,
|
||||
VIDEO_UV_META_STRIDE(v4l2_fmt, width), VIDEO_UV_META_SCANLINES(v4l2_fmt,
|
||||
height));
|
||||
} else if (color_fmt == MSM_VIDC_FMT_P010) {
|
||||
media_fmt = COLOR_FMT_P010_UBWC;
|
||||
v4l2_fmt = V4L2_PIX_FMT_VIDC_TP10C;
|
||||
HFI_YUV420_TP10_UBWC_CALC_BUF_SIZE(size,
|
||||
VENUS_Y_STRIDE(media_fmt, width), VENUS_Y_SCANLINES(media_fmt, height),
|
||||
VENUS_UV_STRIDE(media_fmt, width), VENUS_UV_SCANLINES(media_fmt, height),
|
||||
VENUS_Y_META_STRIDE(media_fmt, width), VENUS_Y_META_SCANLINES(media_fmt,
|
||||
VIDEO_Y_STRIDE_BYTES(v4l2_fmt, width), VIDEO_Y_SCANLINES(v4l2_fmt, height),
|
||||
VIDEO_UV_STRIDE_BYTES(v4l2_fmt, width), VIDEO_UV_SCANLINES(v4l2_fmt, height),
|
||||
VIDEO_Y_META_STRIDE(v4l2_fmt, width), VIDEO_Y_META_SCANLINES(v4l2_fmt,
|
||||
height),
|
||||
VENUS_UV_META_STRIDE(media_fmt, width), VENUS_UV_META_SCANLINES(media_fmt,
|
||||
VIDEO_UV_META_STRIDE(v4l2_fmt, width), VIDEO_UV_META_SCANLINES(v4l2_fmt,
|
||||
height));
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -191,8 +191,6 @@ 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);
|
||||
u32 v4l2_colorformat_to_media(u32 v4l2_fmt,
|
||||
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,
|
||||
|
@@ -1254,16 +1254,13 @@ static int msm_vdec_update_properties(struct msm_vidc_inst *inst)
|
||||
inst->fmts[INPUT_PORT].fmt.pix_mp.width = width;
|
||||
inst->fmts[INPUT_PORT].fmt.pix_mp.height = height;
|
||||
|
||||
inst->fmts[OUTPUT_PORT].fmt.pix_mp.width = VENUS_Y_STRIDE(
|
||||
v4l2_colorformat_to_media(
|
||||
inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat, __func__),
|
||||
width);
|
||||
inst->fmts[OUTPUT_PORT].fmt.pix_mp.height = VENUS_Y_SCANLINES(
|
||||
v4l2_colorformat_to_media(
|
||||
inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat, __func__),
|
||||
height);
|
||||
inst->fmts[OUTPUT_PORT].fmt.pix_mp.width = VIDEO_Y_STRIDE_PIX(
|
||||
inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat, width);
|
||||
inst->fmts[OUTPUT_PORT].fmt.pix_mp.height = VIDEO_Y_SCANLINES(
|
||||
inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat, height);
|
||||
inst->fmts[OUTPUT_PORT].fmt.pix_mp.plane_fmt[0].bytesperline =
|
||||
inst->fmts[OUTPUT_PORT].fmt.pix_mp.width;
|
||||
VIDEO_Y_STRIDE_BYTES(
|
||||
inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat, width);
|
||||
inst->fmts[OUTPUT_PORT].fmt.pix_mp.plane_fmt[0].sizeimage =
|
||||
call_session_op(core, buffer_size, inst, MSM_VIDC_BUF_OUTPUT);
|
||||
//inst->buffers.output.size = inst->fmts[OUTPUT_PORT].fmt.pix_mp.plane_fmt[0].sizeimage;
|
||||
@@ -1860,17 +1857,16 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
|
||||
f->fmt.pix_mp.width = fmt->fmt.pix_mp.width;
|
||||
}
|
||||
fmt->fmt.pix_mp.pixelformat = f->fmt.pix_mp.pixelformat;
|
||||
fmt->fmt.pix_mp.width = VENUS_Y_STRIDE(
|
||||
v4l2_colorformat_to_media(
|
||||
fmt->fmt.pix_mp.pixelformat, __func__),
|
||||
f->fmt.pix_mp.width);
|
||||
fmt->fmt.pix_mp.height = VENUS_Y_SCANLINES(
|
||||
v4l2_colorformat_to_media(
|
||||
fmt->fmt.pix_mp.pixelformat, __func__),
|
||||
fmt->fmt.pix_mp.width = VIDEO_Y_STRIDE_PIX(
|
||||
fmt->fmt.pix_mp.pixelformat, f->fmt.pix_mp.width);
|
||||
fmt->fmt.pix_mp.height = VIDEO_Y_SCANLINES(
|
||||
fmt->fmt.pix_mp.pixelformat,
|
||||
f->fmt.pix_mp.height);
|
||||
fmt->fmt.pix_mp.num_planes = 1;
|
||||
fmt->fmt.pix_mp.plane_fmt[0].bytesperline =
|
||||
fmt->fmt.pix_mp.width;
|
||||
VIDEO_Y_STRIDE_BYTES(
|
||||
inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat,
|
||||
f->fmt.pix_mp.width);
|
||||
fmt->fmt.pix_mp.plane_fmt[0].sizeimage = call_session_op(core,
|
||||
buffer_size, inst, MSM_VIDC_BUF_OUTPUT);
|
||||
|
||||
@@ -2238,14 +2234,15 @@ 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;
|
||||
f->fmt.pix_mp.width = VENUS_Y_STRIDE(
|
||||
v4l2_colorformat_to_media(f->fmt.pix_mp.pixelformat, __func__),
|
||||
f->fmt.pix_mp.width = VIDEO_Y_STRIDE_PIX(f->fmt.pix_mp.pixelformat,
|
||||
DEFAULT_WIDTH);
|
||||
f->fmt.pix_mp.height = VENUS_Y_SCANLINES(
|
||||
v4l2_colorformat_to_media(f->fmt.pix_mp.pixelformat, __func__),
|
||||
f->fmt.pix_mp.height = VIDEO_Y_SCANLINES(f->fmt.pix_mp.pixelformat,
|
||||
DEFAULT_HEIGHT);
|
||||
f->fmt.pix_mp.num_planes = 1;
|
||||
f->fmt.pix_mp.plane_fmt[0].bytesperline = f->fmt.pix_mp.width;
|
||||
f->fmt.pix_mp.plane_fmt[0].bytesperline =
|
||||
VIDEO_Y_STRIDE_BYTES(
|
||||
inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat,
|
||||
DEFAULT_WIDTH);
|
||||
f->fmt.pix_mp.plane_fmt[0].sizeimage = call_session_op(core,
|
||||
buffer_size, inst, MSM_VIDC_BUF_OUTPUT);
|
||||
f->fmt.pix_mp.colorspace = V4L2_COLORSPACE_DEFAULT;
|
||||
|
@@ -1100,16 +1100,15 @@ static int msm_venc_s_fmt_input(struct msm_vidc_inst *inst, struct v4l2_format *
|
||||
fmt = &inst->fmts[INPUT_PORT];
|
||||
fmt->type = INPUT_MPLANE;
|
||||
fmt->fmt.pix_mp.pixelformat = f->fmt.pix_mp.pixelformat;
|
||||
fmt->fmt.pix_mp.width = VENUS_Y_STRIDE(
|
||||
v4l2_colorformat_to_media(fmt->fmt.pix_mp.pixelformat, __func__),
|
||||
fmt->fmt.pix_mp.width = VIDEO_Y_STRIDE_PIX(fmt->fmt.pix_mp.pixelformat,
|
||||
f->fmt.pix_mp.width);
|
||||
fmt->fmt.pix_mp.height = VENUS_Y_SCANLINES(
|
||||
v4l2_colorformat_to_media(fmt->fmt.pix_mp.pixelformat, __func__),
|
||||
fmt->fmt.pix_mp.height = VIDEO_Y_SCANLINES(fmt->fmt.pix_mp.pixelformat,
|
||||
f->fmt.pix_mp.height);
|
||||
|
||||
fmt->fmt.pix_mp.num_planes = 1;
|
||||
fmt->fmt.pix_mp.plane_fmt[0].bytesperline =
|
||||
fmt->fmt.pix_mp.width;
|
||||
VIDEO_Y_STRIDE_BYTES(fmt->fmt.pix_mp.pixelformat,
|
||||
f->fmt.pix_mp.width);
|
||||
fmt->fmt.pix_mp.plane_fmt[0].sizeimage = call_session_op(core,
|
||||
buffer_size, inst, MSM_VIDC_BUF_INPUT);
|
||||
fmt->fmt.pix_mp.colorspace = f->fmt.pix_mp.colorspace;
|
||||
@@ -1775,14 +1774,14 @@ 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.width = VENUS_Y_STRIDE(
|
||||
v4l2_colorformat_to_media(f->fmt.pix_mp.pixelformat, __func__),
|
||||
f->fmt.pix_mp.width = VIDEO_Y_STRIDE_PIX(f->fmt.pix_mp.pixelformat,
|
||||
DEFAULT_WIDTH);
|
||||
f->fmt.pix_mp.height = VENUS_Y_SCANLINES(
|
||||
v4l2_colorformat_to_media(f->fmt.pix_mp.pixelformat, __func__),
|
||||
f->fmt.pix_mp.height = VIDEO_Y_SCANLINES(f->fmt.pix_mp.pixelformat,
|
||||
DEFAULT_HEIGHT);
|
||||
f->fmt.pix_mp.num_planes = 1;
|
||||
f->fmt.pix_mp.plane_fmt[0].bytesperline = f->fmt.pix_mp.width;
|
||||
f->fmt.pix_mp.plane_fmt[0].bytesperline =
|
||||
VIDEO_Y_STRIDE_BYTES(f->fmt.pix_mp.pixelformat,
|
||||
DEFAULT_WIDTH);
|
||||
f->fmt.pix_mp.plane_fmt[0].sizeimage = call_session_op(core,
|
||||
buffer_size, inst, MSM_VIDC_BUF_INPUT);
|
||||
f->fmt.pix_mp.colorspace = V4L2_COLORSPACE_DEFAULT;
|
||||
|
@@ -264,13 +264,12 @@ u32 msm_vidc_decoder_input_size(struct msm_vidc_inst *inst)
|
||||
u32 msm_vidc_decoder_output_size(struct msm_vidc_inst *inst)
|
||||
{
|
||||
u32 size;
|
||||
u32 format;
|
||||
struct v4l2_format *f;
|
||||
|
||||
f = &inst->fmts[OUTPUT_PORT];
|
||||
format = v4l2_colorformat_to_media(f->fmt.pix_mp.pixelformat, __func__);
|
||||
size = VENUS_BUFFER_SIZE(format, f->fmt.pix_mp.width,
|
||||
f->fmt.pix_mp.height);
|
||||
size = VIDEO_RAW_BUFFER_SIZE(f->fmt.pix_mp.pixelformat,
|
||||
f->fmt.pix_mp.width,
|
||||
f->fmt.pix_mp.height, true);
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -287,12 +286,11 @@ u32 msm_vidc_decoder_output_meta_size(struct msm_vidc_inst *inst)
|
||||
u32 msm_vidc_encoder_input_size(struct msm_vidc_inst *inst)
|
||||
{
|
||||
u32 size;
|
||||
u32 format;
|
||||
struct v4l2_format *f;
|
||||
|
||||
f = &inst->fmts[INPUT_PORT];
|
||||
format = v4l2_colorformat_to_media(f->fmt.pix_mp.pixelformat, __func__);
|
||||
size = VENUS_BUFFER_SIZE_USED(format, f->fmt.pix_mp.width,
|
||||
size = VIDEO_RAW_BUFFER_SIZE(f->fmt.pix_mp.pixelformat,
|
||||
f->fmt.pix_mp.width,
|
||||
f->fmt.pix_mp.height, false);
|
||||
return size;
|
||||
}
|
||||
|
@@ -223,28 +223,6 @@ u32 v4l2_colorformat_from_driver(enum msm_vidc_colorformat_type colorformat,
|
||||
return v4l2_colorformat;
|
||||
}
|
||||
|
||||
u32 v4l2_colorformat_to_media(u32 v4l2_fmt, const char *func)
|
||||
{
|
||||
switch (v4l2_fmt) {
|
||||
case V4L2_PIX_FMT_NV12:
|
||||
return COLOR_FMT_NV12;
|
||||
case V4L2_PIX_FMT_NV21:
|
||||
return COLOR_FMT_NV21;
|
||||
case V4L2_PIX_FMT_VIDC_P010:
|
||||
return COLOR_FMT_P010;
|
||||
case V4L2_PIX_FMT_VIDC_NV12C:
|
||||
return COLOR_FMT_NV12_UBWC;
|
||||
case V4L2_PIX_FMT_VIDC_TP10C:
|
||||
return COLOR_FMT_NV12_BPP10_UBWC;
|
||||
case V4L2_PIX_FMT_VIDC_ARGB32C:
|
||||
return COLOR_FMT_RGBA8888_UBWC;
|
||||
default:
|
||||
d_vpr_e("%s: invalid v4l2 color fmt: %#x, set default (NV12)",
|
||||
func, v4l2_fmt);
|
||||
return COLOR_FMT_NV12;
|
||||
}
|
||||
}
|
||||
|
||||
int v4l2_type_to_driver_port(struct msm_vidc_inst *inst, u32 type,
|
||||
const char *func)
|
||||
{
|
||||
|
Reference in New Issue
Block a user