msm: vidc: Fix multistream issues

This change is to fix issues reported when OUTPUT and OUTPUT2
ports enabled in Venus. In this case following are the rules
    - s_fmt on OUTPUT port updates OUTPUT port dimensions.
    - s_fmt on CAPTURE port updates CAPTURE port dimensions.
    - reconfig dimensions are always updated on OUTPUT port.
    - All clocks scaling, bus scaling uses max of both ports.
    - DCVS is based on reconfig, CAPTURE and OUTPUT port dims.

CRs-Fixed: 1044772
Change-Id: Ib45424c70f995d856ad27107ae3ea24a59ca4e74
Signed-off-by: Praneeth Paladugu <ppaladug@codeaurora.org>
Signed-off-by: Abdulla Anam <abdullahanam@codeaurora.org>
This commit is contained in:
Praneeth Paladugu 2016-08-11 20:22:31 +05:30
parent c605e110ab
commit 35a1866858
2 changed files with 22 additions and 53 deletions

View file

@ -1096,23 +1096,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) {
@ -1139,6 +1124,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:
@ -1177,34 +1168,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;
}
@ -1312,11 +1284,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),

View file

@ -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++;