diff --git a/driver/platform/waipio/src/msm_vidc_waipio.c b/driver/platform/waipio/src/msm_vidc_waipio.c index f44839723e..864704c7e0 100644 --- a/driver/platform/waipio/src/msm_vidc_waipio.c +++ b/driver/platform/waipio/src/msm_vidc_waipio.c @@ -117,13 +117,13 @@ static struct msm_platform_inst_capability instance_data_waipio[] = { {PIX_FMTS, ENC, H264, MSM_VIDC_FMT_NV12, MSM_VIDC_FMT_NV12C, - BIT(MSM_VIDC_FMT_NV12) | BIT(MSM_VIDC_FMT_NV21) | BIT(MSM_VIDC_FMT_NV12C), + MSM_VIDC_FMT_NV12 | MSM_VIDC_FMT_NV21 | MSM_VIDC_FMT_NV12C, MSM_VIDC_FMT_NV12C}, {PIX_FMTS, ENC, HEVC, MSM_VIDC_FMT_NV12, MSM_VIDC_FMT_TP10C, - BIT(MSM_VIDC_FMT_NV12) | BIT(MSM_VIDC_FMT_NV21) | BIT(MSM_VIDC_FMT_NV12C ) | - BIT(MSM_VIDC_FMT_P010) | BIT(MSM_VIDC_FMT_TP10C), + MSM_VIDC_FMT_NV12 | MSM_VIDC_FMT_NV21 | MSM_VIDC_FMT_NV12C | + MSM_VIDC_FMT_P010 | MSM_VIDC_FMT_TP10C, MSM_VIDC_FMT_NV12C, 0, 0, CAP_FLAG_ROOT, @@ -133,8 +133,8 @@ static struct msm_platform_inst_capability instance_data_waipio[] = { {PIX_FMTS, DEC, HEVC, MSM_VIDC_FMT_NV12, MSM_VIDC_FMT_TP10C, - BIT(MSM_VIDC_FMT_NV12) | BIT(MSM_VIDC_FMT_NV21) | BIT(MSM_VIDC_FMT_NV12C ) | - BIT(MSM_VIDC_FMT_P010) | BIT(MSM_VIDC_FMT_TP10C), + MSM_VIDC_FMT_NV12 | MSM_VIDC_FMT_NV21 | MSM_VIDC_FMT_NV12C | + MSM_VIDC_FMT_P010 | MSM_VIDC_FMT_TP10C, MSM_VIDC_FMT_NV12C, 0, 0, CAP_FLAG_ROOT, @@ -144,14 +144,14 @@ static struct msm_platform_inst_capability instance_data_waipio[] = { {PIX_FMTS, DEC, H264, MSM_VIDC_FMT_NV12, MSM_VIDC_FMT_NV12C, - BIT(MSM_VIDC_FMT_NV12) | BIT(MSM_VIDC_FMT_NV21) | BIT(MSM_VIDC_FMT_NV12C), + MSM_VIDC_FMT_NV12 | MSM_VIDC_FMT_NV21 | MSM_VIDC_FMT_NV12C, MSM_VIDC_FMT_NV12C}, {PIX_FMTS, DEC, VP9, MSM_VIDC_FMT_NV12, MSM_VIDC_FMT_TP10C, - BIT(MSM_VIDC_FMT_NV12) | BIT(MSM_VIDC_FMT_NV21) | BIT(MSM_VIDC_FMT_NV12C) | - BIT(MSM_VIDC_FMT_P010) | BIT(MSM_VIDC_FMT_TP10C), + MSM_VIDC_FMT_NV12 | MSM_VIDC_FMT_NV21 | MSM_VIDC_FMT_NV12C | + MSM_VIDC_FMT_P010 | MSM_VIDC_FMT_TP10C, MSM_VIDC_FMT_NV12C}, {MIN_BUFFERS_INPUT, ENC|DEC, CODECS_ALL, 0, 64, 1, 4, diff --git a/driver/variant/iris2/src/msm_vidc_buffer_iris2.c b/driver/variant/iris2/src/msm_vidc_buffer_iris2.c index 2d74363d84..a1cdd7ef98 100644 --- a/driver/variant/iris2/src/msm_vidc_buffer_iris2.c +++ b/driver/variant/iris2/src/msm_vidc_buffer_iris2.c @@ -125,7 +125,7 @@ static u32 msm_vidc_decoder_line_size_iris2(struct msm_vidc_inst *inst) u32 width, height, out_min_count, num_vpp_pipes, vpp_delay; struct v4l2_format *f; bool is_opb; - u32 pixelformat; + u32 color_fmt; if (!inst || !inst->core) { d_vpr_e("%s: invalid params\n", __func__); @@ -138,12 +138,17 @@ static u32 msm_vidc_decoder_line_size_iris2(struct msm_vidc_inst *inst) } num_vpp_pipes = core->capabilities[NUM_VPP_PIPE].value; - pixelformat = inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat; - if (pixelformat == MSM_VIDC_FMT_NV12 || - pixelformat == MSM_VIDC_FMT_P010) + color_fmt = v4l2_colorformat_to_driver( + inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat, __func__); + if (is_linear_colorformat(color_fmt)) is_opb = true; else is_opb = false; + /* + * assume worst case, since color format is unknown at this + * time + */ + is_opb = true; if (inst->decode_vpp_delay.enable) vpp_delay = inst->decode_vpp_delay.size; @@ -155,7 +160,6 @@ static u32 msm_vidc_decoder_line_size_iris2(struct msm_vidc_inst *inst) height = f->fmt.pix_mp.height; out_min_count = inst->buffers.output.min_count; out_min_count = max(vpp_delay + 1, out_min_count); - if (inst->codec == MSM_VIDC_H264) HFI_BUFFER_LINE_H264D(size, width, height, is_opb, num_vpp_pipes); diff --git a/driver/vidc/inc/msm_media_info.h b/driver/vidc/inc/msm_media_info.h index b61d7159da..f9aa5b2a51 100644 --- a/driver/vidc/inc/msm_media_info.h +++ b/driver/vidc/inc/msm_media_info.h @@ -49,10 +49,10 @@ enum color_fmts { * . . . . . . . . . . . . . . . . V * . . . . . . . . . . . . . . . . --> Buffer size alignment * - * Y_Stride : Width aligned to 512 - * UV_Stride : Width aligned to 512 - * Y_Scanlines: Height aligned to 512 - * UV_Scanlines: Height/2 aligned to 256 + * Y_Stride : Width aligned to 128 + * UV_Stride : Width aligned to 128 + * Y_Scanlines: Height aligned to 32 + * UV_Scanlines: Height/2 aligned to 16 * Total size = align(Y_Stride * Y_Scanlines * + UV_Stride * UV_Scanlines, 4096) */ @@ -84,10 +84,10 @@ enum color_fmts { * . . . . . . . . . . . . . . . . V * . . . . . . . . . . . . . . . . --> Padding & Buffer size alignment * - * Y_Stride : Width aligned to 512 - * UV_Stride : Width aligned to 512 - * Y_Scanlines: Height aligned to 512 - * UV_Scanlines: Height/2 aligned to 256 + * Y_Stride : Width aligned to 128 + * UV_Stride : Width aligned to 128 + * Y_Scanlines: Height aligned to 32 + * UV_Scanlines: Height/2 aligned to 16 * Total size = align(Y_Stride * Y_Scanlines * + UV_Stride * UV_Scanlines, 4096) */ @@ -731,41 +731,6 @@ enum color_fmts { * + UV_Stride * UV_Scanlines, 4096) */ COLOR_FMT_P010, - /* Venus NV12_512: - * YUV 4:2:0 image with a plane of 8 bit Y samples followed - * by an interleaved U/V plane containing 8 bit 2x2 subsampled - * colour difference samples. - * - * <-------- Y/UV_Stride --------> - * <------- Width -------> - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^ - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . V | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . V - * U V U V U V U V U V U V . . . . ^ - * U V U V U V U V U V U V . . . . | - * U V U V U V U V U V U V . . . . | - * U V U V U V U V U V U V . . . . UV_Scanlines - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . V - * . . . . . . . . . . . . . . . . --> Buffer size alignment - * - * Y_Stride : Width aligned to 512 - * UV_Stride : Width aligned to 512 - * Y_Scanlines: Height aligned to 512 - * UV_Scanlines: Height/2 aligned to 256 - * Total size = align((Y_Stride * Y_Scanlines - * + UV_Stride * UV_Scanlines), 4096) - */ - COLOR_FMT_NV12_512, }; /* @@ -786,10 +751,6 @@ static inline unsigned int VENUS_Y_STRIDE(unsigned int color_fmt, switch (color_fmt) { case COLOR_FMT_NV12: case COLOR_FMT_NV21: - case COLOR_FMT_NV12_512: - alignment = 512; - stride = MSM_MEDIA_ALIGN(width, alignment); - break; case COLOR_FMT_NV12_UBWC: alignment = 128; stride = MSM_MEDIA_ALIGN(width, alignment); @@ -829,10 +790,6 @@ static inline unsigned int VENUS_UV_STRIDE(unsigned int color_fmt, switch (color_fmt) { case COLOR_FMT_NV21: case COLOR_FMT_NV12: - case COLOR_FMT_NV12_512: - alignment = 512; - stride = MSM_MEDIA_ALIGN(width, alignment); - break; case COLOR_FMT_NV12_UBWC: alignment = 128; stride = MSM_MEDIA_ALIGN(width, alignment); @@ -872,9 +829,6 @@ static inline unsigned int VENUS_Y_SCANLINES(unsigned int color_fmt, switch (color_fmt) { case COLOR_FMT_NV12: case COLOR_FMT_NV21: - case COLOR_FMT_NV12_512: - alignment = 512; - break; case COLOR_FMT_NV12_UBWC: case COLOR_FMT_P010: alignment = 32; @@ -909,9 +863,6 @@ static inline unsigned int VENUS_UV_SCANLINES(unsigned int color_fmt, switch (color_fmt) { case COLOR_FMT_NV21: case COLOR_FMT_NV12: - case COLOR_FMT_NV12_512: - alignment = 256; - break; case COLOR_FMT_NV12_BPP10_UBWC: case COLOR_FMT_P010_UBWC: case COLOR_FMT_P010: @@ -1211,7 +1162,6 @@ static inline unsigned int VENUS_BUFFER_SIZE(unsigned int color_fmt, case COLOR_FMT_NV21: case COLOR_FMT_NV12: case COLOR_FMT_P010: - case COLOR_FMT_NV12_512: y_plane = y_stride * y_sclines; uv_plane = uv_stride * uv_sclines; size = y_plane + uv_plane; diff --git a/driver/vidc/inc/msm_vidc_internal.h b/driver/vidc/inc/msm_vidc_internal.h index 59ddc61136..302ce88cad 100644 --- a/driver/vidc/inc/msm_vidc_internal.h +++ b/driver/vidc/inc/msm_vidc_internal.h @@ -116,13 +116,13 @@ enum msm_vidc_codec_type { enum msm_vidc_colorformat_type { MSM_VIDC_FMT_NONE = 0, - MSM_VIDC_FMT_NV12 = 1, - MSM_VIDC_FMT_NV12C = 2, - MSM_VIDC_FMT_P010 = 3, - MSM_VIDC_FMT_TP10C = 4, - MSM_VIDC_FMT_RGBA8888 = 5, - MSM_VIDC_FMT_RGBA8888C = 6, - MSM_VIDC_FMT_NV21 = 7, + MSM_VIDC_FMT_NV12 = BIT(0), + MSM_VIDC_FMT_NV21 = BIT(1), + MSM_VIDC_FMT_NV12C = BIT(2), + MSM_VIDC_FMT_P010 = BIT(3), + MSM_VIDC_FMT_TP10C = BIT(4), + MSM_VIDC_FMT_RGBA8888 = BIT(5), + MSM_VIDC_FMT_RGBA8888C = BIT(6), }; enum msm_vidc_buffer_type { diff --git a/driver/vidc/src/hfi_packet.c b/driver/vidc/src/hfi_packet.c index 235cd42a88..501230fc32 100644 --- a/driver/vidc/src/hfi_packet.c +++ b/driver/vidc/src/hfi_packet.c @@ -66,7 +66,6 @@ u32 get_hfi_port_from_buffer_type(struct msm_vidc_inst *inst, case MSM_VIDC_BUF_COMV: case MSM_VIDC_BUF_NON_COMV: case MSM_VIDC_BUF_LINE: - case MSM_VIDC_BUF_DPB: hfi_port = HFI_PORT_BITSTREAM; break; case MSM_VIDC_BUF_PERSIST: @@ -75,6 +74,7 @@ u32 get_hfi_port_from_buffer_type(struct msm_vidc_inst *inst, break; case MSM_VIDC_BUF_OUTPUT: case MSM_VIDC_BUF_OUTPUT_META: + case MSM_VIDC_BUF_DPB: hfi_port = HFI_PORT_RAW; break; default: diff --git a/driver/vidc/src/msm_vdec.c b/driver/vidc/src/msm_vdec.c index 300e856109..c4f77d9c2a 100644 --- a/driver/vidc/src/msm_vdec.c +++ b/driver/vidc/src/msm_vdec.c @@ -787,9 +787,9 @@ static int msm_vdec_get_output_internal_buffers(struct msm_vidc_inst *inst) s_vpr_h(inst->sid, "output internal buffer: min size reuse\n"); s_vpr_h(inst->sid, "dpb buffer: %d %d %d\n", - inst->buffers.bin.min_count, - inst->buffers.bin.size, - inst->buffers.bin.reuse); + inst->buffers.dpb.min_count, + inst->buffers.dpb.size, + inst->buffers.dpb.reuse); return rc; } @@ -1519,11 +1519,11 @@ int msm_vdec_streamon_output(struct msm_vidc_inst *inst) if (rc) goto error; - rc = msm_vdec_queue_output_internal_buffers(inst); + rc = msm_vidc_session_streamon(inst, OUTPUT_PORT); if (rc) goto error; - rc = msm_vidc_session_streamon(inst, OUTPUT_PORT); + rc = msm_vdec_queue_output_internal_buffers(inst); if (rc) goto error; @@ -1704,6 +1704,10 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) } else if (f->type == OUTPUT_MPLANE) { fmt = &inst->fmts[OUTPUT_PORT]; fmt->type = OUTPUT_MPLANE; + if (inst->vb2q[INPUT_PORT].streaming) { + f->fmt.pix_mp.height = fmt->fmt.pix_mp.height; + 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( @@ -1718,8 +1722,10 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) fmt->fmt.pix_mp.width; fmt->fmt.pix_mp.plane_fmt[0].sizeimage = call_session_op(core, buffer_size, inst, MSM_VIDC_BUF_OUTPUT); - inst->buffers.output.min_count = call_session_op(core, - min_count, inst, MSM_VIDC_BUF_OUTPUT); + + if (!inst->vb2q[INPUT_PORT].streaming) + inst->buffers.output.min_count = call_session_op(core, + min_count, inst, MSM_VIDC_BUF_OUTPUT); inst->buffers.output.extra_count = call_session_op(core, extra_count, inst, MSM_VIDC_BUF_OUTPUT); if (inst->buffers.output.actual_count < @@ -1731,7 +1737,8 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) } inst->buffers.output.size = fmt->fmt.pix_mp.plane_fmt[0].sizeimage; - + inst->capabilities->cap[PIX_FMTS].value = + v4l2_colorformat_to_driver(f->fmt.pix_mp.pixelformat, __func__); //rc = msm_vidc_check_session_supported(inst); if (rc) goto err_invalid_fmt; @@ -1982,14 +1989,13 @@ int msm_vdec_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f) u32 codecs = core->capabilities[DEC_CODECS].value; while (codecs) { - if (idx > 31) + if (i > 31) break; if (codecs & BIT(i)) { array[idx] = codecs & BIT(i); idx++; } i++; - codecs >>= 1; } f->pixelformat = v4l2_codec_from_driver(array[f->index], __func__); @@ -2001,7 +2007,7 @@ int msm_vdec_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f) u32 formats = inst->capabilities->cap[PIX_FMTS].step_or_mask; while (formats) { - if (idx > 31) + if (i > 31) break; if (formats & BIT(i)) { if (msm_vdec_check_colorformat_supported(inst, @@ -2011,7 +2017,6 @@ int msm_vdec_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f) } } i++; - formats >>= 1; } f->pixelformat = v4l2_colorformat_from_driver(array[f->index], __func__); @@ -2028,8 +2033,9 @@ int msm_vdec_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f) } memset(f->reserved, 0, sizeof(f->reserved)); - s_vpr_h(inst->sid, "%s: index %d, %s : %#x, flags %#x\n", - __func__, f->index, f->description, f->pixelformat, f->flags); + s_vpr_h(inst->sid, "%s: index %d, %s : %#x, flags %#x, driver colorfmt %#x\n", + __func__, f->index, f->description, f->pixelformat, f->flags, + v4l2_colorformat_to_driver(f->pixelformat, __func__)); return rc; } diff --git a/driver/vidc/src/msm_venc.c b/driver/vidc/src/msm_venc.c index 60fa93c80c..ba4644e7f0 100644 --- a/driver/vidc/src/msm_venc.c +++ b/driver/vidc/src/msm_venc.c @@ -1463,14 +1463,13 @@ int msm_venc_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f) u32 codecs = core->capabilities[DEC_CODECS].value; while (codecs) { - if (idx > 31) + if (i > 31) break; if (codecs & BIT(i)) { array[idx] = codecs & BIT(i); idx++; } i++; - codecs >>= 1; } f->pixelformat = v4l2_codec_from_driver(array[f->index], __func__); @@ -1489,7 +1488,6 @@ int msm_venc_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f) idx++; } i++; - formats >>= 1; } f->pixelformat = v4l2_colorformat_from_driver(array[f->index], __func__); @@ -1506,8 +1504,9 @@ int msm_venc_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f) } memset(f->reserved, 0, sizeof(f->reserved)); - s_vpr_h(inst->sid, "%s: index %d, %s : %#x, flags %#x\n", - __func__, f->index, f->description, f->pixelformat, f->flags); + s_vpr_h(inst->sid, "%s: index %d, %s : %#x, flags %#x, driver colorfmt %#x\n", + __func__, f->index, f->description, f->pixelformat, f->flags, + v4l2_colorformat_to_driver(f->pixelformat, __func__)); return rc; } diff --git a/driver/vidc/src/msm_vidc_driver.c b/driver/vidc/src/msm_vidc_driver.c index 7dae2c3dd0..33fbd1f3ee 100644 --- a/driver/vidc/src/msm_vidc_driver.c +++ b/driver/vidc/src/msm_vidc_driver.c @@ -1707,8 +1707,11 @@ int msm_vidc_create_internal_buffers(struct msm_vidc_inst *inst, return 0; } - for (i = 0; i < buffers->min_count; i++) + for (i = 0; i < buffers->min_count; i++) { rc = msm_vidc_create_internal_buffer(inst, buffer_type, i); + if (rc) + return rc; + } return rc; }