diff --git a/drivers/media/platform/msm/vidc/msm_vdec.c b/drivers/media/platform/msm/vidc/msm_vdec.c index ec693d3274d6..05232f862e55 100644 --- a/drivers/media/platform/msm/vidc/msm_vdec.c +++ b/drivers/media/platform/msm/vidc/msm_vdec.c @@ -1095,23 +1095,8 @@ int msm_vdec_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) f->fmt.pix_mp.pixelformat = fmt->fourcc; f->fmt.pix_mp.num_planes = fmt->num_planes; if (inst->in_reconfig) { - bool ds_enabled = msm_comm_g_ctrl_for_id(inst, - V4L2_CID_MPEG_VIDC_VIDEO_KEEP_ASPECT_RATIO); - - /* - * Do not update height and width on capture port, if - * downscalar is explicitly enabled from v4l2 client. - */ - if (msm_comm_get_stream_output_mode(inst) == - HAL_VIDEO_DECODER_SECONDARY && ds_enabled) { - inst->prop.height[OUTPUT_PORT] = inst->reconfig_height; - inst->prop.width[OUTPUT_PORT] = inst->reconfig_width; - } else { - inst->prop.height[CAPTURE_PORT] = inst->reconfig_height; - inst->prop.width[CAPTURE_PORT] = inst->reconfig_width; - inst->prop.height[OUTPUT_PORT] = inst->reconfig_height; - inst->prop.width[OUTPUT_PORT] = inst->reconfig_width; - } + inst->prop.height[OUTPUT_PORT] = inst->reconfig_height; + inst->prop.width[OUTPUT_PORT] = inst->reconfig_width; rc = msm_vidc_check_session_supported(inst); if (rc) { @@ -1138,6 +1123,12 @@ int msm_vdec_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) f->fmt.pix_mp.plane_fmt[i].sizeimage = plane_sizes[i]; } + f->fmt.pix_mp.height = inst->prop.height[OUTPUT_PORT]; + f->fmt.pix_mp.width = inst->prop.width[OUTPUT_PORT]; + f->fmt.pix_mp.plane_fmt[0].bytesperline = + (__u16)inst->prop.width[OUTPUT_PORT]; + f->fmt.pix_mp.plane_fmt[0].reserved[0] = + (__u16)inst->prop.height[OUTPUT_PORT]; } else { switch (fmt->fourcc) { case V4L2_PIX_FMT_NV12: @@ -1176,34 +1167,15 @@ int msm_vdec_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) for (i = 0; i < fmt->num_planes; ++i) inst->bufq[CAPTURE_PORT].vb2_bufq.plane_sizes[i] = f->fmt.pix_mp.plane_fmt[i].sizeimage; - } - if (stride && scanlines) { + f->fmt.pix_mp.height = inst->prop.height[CAPTURE_PORT]; + f->fmt.pix_mp.width = inst->prop.width[CAPTURE_PORT]; f->fmt.pix_mp.plane_fmt[0].bytesperline = (__u16)stride; f->fmt.pix_mp.plane_fmt[0].reserved[0] = (__u16)scanlines; - } else { - f->fmt.pix_mp.plane_fmt[0].bytesperline = - (__u16)inst->prop.width[CAPTURE_PORT]; - f->fmt.pix_mp.plane_fmt[0].reserved[0] = - (__u16)inst->prop.height[CAPTURE_PORT]; } - if (msm_comm_get_stream_output_mode(inst) == - HAL_VIDEO_DECODER_SECONDARY) { - if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { - f->fmt.pix_mp.height = inst->prop.height[CAPTURE_PORT]; - f->fmt.pix_mp.width = inst->prop.width[CAPTURE_PORT]; - } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { - f->fmt.pix_mp.height = inst->prop.height[OUTPUT_PORT]; - f->fmt.pix_mp.width = inst->prop.width[OUTPUT_PORT]; - f->fmt.pix_mp.plane_fmt[0].bytesperline = - (__u16)inst->prop.width[OUTPUT_PORT]; - f->fmt.pix_mp.plane_fmt[0].reserved[0] = - (__u16)inst->prop.height[OUTPUT_PORT]; - } - } exit: return rc; } @@ -1306,11 +1278,6 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { inst->prop.width[OUTPUT_PORT] = f->fmt.pix_mp.width; inst->prop.height[OUTPUT_PORT] = f->fmt.pix_mp.height; - if (msm_comm_get_stream_output_mode(inst) == - HAL_VIDEO_DECODER_PRIMARY) { - inst->prop.width[CAPTURE_PORT] = f->fmt.pix_mp.width; - inst->prop.height[CAPTURE_PORT] = f->fmt.pix_mp.height; - } fmt = msm_comm_get_pixel_fmt_fourcc(vdec_formats, ARRAY_SIZE(vdec_formats), diff --git a/drivers/media/platform/msm/vidc/msm_vidc_common.c b/drivers/media/platform/msm/vidc/msm_vidc_common.c index 69c4211768e5..10dcc30f4aaa 100644 --- a/drivers/media/platform/msm/vidc/msm_vidc_common.c +++ b/drivers/media/platform/msm/vidc/msm_vidc_common.c @@ -284,8 +284,12 @@ static int msm_comm_get_mbs_per_sec(struct msm_vidc_inst *inst) int fps, rc; struct v4l2_control ctrl; - output_port_mbs = NUM_MBS_PER_FRAME(inst->prop.width[OUTPUT_PORT], - inst->prop.height[OUTPUT_PORT]); + output_port_mbs = inst->in_reconfig ? + NUM_MBS_PER_FRAME(inst->reconfig_width, + inst->reconfig_height) : + NUM_MBS_PER_FRAME(inst->prop.width[OUTPUT_PORT], + inst->prop.height[OUTPUT_PORT]); + capture_port_mbs = NUM_MBS_PER_FRAME(inst->prop.width[CAPTURE_PORT], inst->prop.height[CAPTURE_PORT]); @@ -1227,14 +1231,12 @@ static void handle_event_change(enum hal_command_response cmd, void *data) inst->in_reconfig = true; } else { dprintk(VIDC_DBG, "V4L2_EVENT_SEQ_CHANGED_SUFFICIENT\n"); - dprintk(VIDC_DBG, - "event_notify->height = %d event_notify->width = %d\n", - event_notify->height, - event_notify->width); - inst->prop.height[CAPTURE_PORT] = event_notify->height; - inst->prop.width[CAPTURE_PORT] = event_notify->width; - inst->prop.height[OUTPUT_PORT] = event_notify->height; - inst->prop.width[OUTPUT_PORT] = event_notify->width; + dprintk(VIDC_DBG, + "event_notify->height = %d event_notify->width = %d\n", + event_notify->height, + event_notify->width); + inst->prop.height[OUTPUT_PORT] = event_notify->height; + inst->prop.width[OUTPUT_PORT] = event_notify->width; } inst->seqchanged_count++;