mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 19:13:47 +02:00
media: venus: vdec: Handle DRC after drain
If the DRC is near the end of the stream the client may send a V4L2_DEC_CMD_STOP before the DRC occurs. V4L2_DEC_CMD_STOP puts the driver into the VENUS_DEC_STATE_DRAIN state. DRC must be aware so that after the DRC event the state can be restored correctly. Signed-off-by: Fritz Koenig <frkoenig@chromium.org> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
d5ee32d7e5
commit
c8e8dabcd1
|
|
@ -413,6 +413,7 @@ struct venus_inst {
|
||||||
unsigned int core_acquired: 1;
|
unsigned int core_acquired: 1;
|
||||||
unsigned int bit_depth;
|
unsigned int bit_depth;
|
||||||
bool next_buf_last;
|
bool next_buf_last;
|
||||||
|
bool drain_active;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define IS_V1(core) ((core)->res->hfi_version == HFI_VERSION_1XX)
|
#define IS_V1(core) ((core)->res->hfi_version == HFI_VERSION_1XX)
|
||||||
|
|
|
||||||
|
|
@ -519,8 +519,10 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd)
|
||||||
|
|
||||||
ret = hfi_session_process_buf(inst, &fdata);
|
ret = hfi_session_process_buf(inst, &fdata);
|
||||||
|
|
||||||
if (!ret && inst->codec_state == VENUS_DEC_STATE_DECODING)
|
if (!ret && inst->codec_state == VENUS_DEC_STATE_DECODING) {
|
||||||
inst->codec_state = VENUS_DEC_STATE_DRAIN;
|
inst->codec_state = VENUS_DEC_STATE_DRAIN;
|
||||||
|
inst->drain_active = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unlock:
|
unlock:
|
||||||
|
|
@ -970,9 +972,13 @@ static int vdec_start_capture(struct venus_inst *inst)
|
||||||
|
|
||||||
inst->codec_state = VENUS_DEC_STATE_DECODING;
|
inst->codec_state = VENUS_DEC_STATE_DECODING;
|
||||||
|
|
||||||
|
if (inst->drain_active)
|
||||||
|
inst->codec_state = VENUS_DEC_STATE_DRAIN;
|
||||||
|
|
||||||
inst->streamon_cap = 1;
|
inst->streamon_cap = 1;
|
||||||
inst->sequence_cap = 0;
|
inst->sequence_cap = 0;
|
||||||
inst->reconfig = false;
|
inst->reconfig = false;
|
||||||
|
inst->drain_active = false;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
@ -1098,6 +1104,7 @@ static int vdec_stop_capture(struct venus_inst *inst)
|
||||||
fallthrough;
|
fallthrough;
|
||||||
case VENUS_DEC_STATE_DRAIN:
|
case VENUS_DEC_STATE_DRAIN:
|
||||||
inst->codec_state = VENUS_DEC_STATE_STOPPED;
|
inst->codec_state = VENUS_DEC_STATE_STOPPED;
|
||||||
|
inst->drain_active = false;
|
||||||
fallthrough;
|
fallthrough;
|
||||||
case VENUS_DEC_STATE_SEEK:
|
case VENUS_DEC_STATE_SEEK:
|
||||||
vdec_cancel_dst_buffers(inst);
|
vdec_cancel_dst_buffers(inst);
|
||||||
|
|
@ -1297,8 +1304,10 @@ static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type,
|
||||||
|
|
||||||
v4l2_event_queue_fh(&inst->fh, &ev);
|
v4l2_event_queue_fh(&inst->fh, &ev);
|
||||||
|
|
||||||
if (inst->codec_state == VENUS_DEC_STATE_DRAIN)
|
if (inst->codec_state == VENUS_DEC_STATE_DRAIN) {
|
||||||
|
inst->drain_active = false;
|
||||||
inst->codec_state = VENUS_DEC_STATE_STOPPED;
|
inst->codec_state = VENUS_DEC_STATE_STOPPED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bytesused)
|
if (!bytesused)
|
||||||
|
|
@ -1374,6 +1383,7 @@ static void vdec_event_change(struct venus_inst *inst,
|
||||||
inst->codec_state = VENUS_DEC_STATE_CAPTURE_SETUP;
|
inst->codec_state = VENUS_DEC_STATE_CAPTURE_SETUP;
|
||||||
break;
|
break;
|
||||||
case VENUS_DEC_STATE_DECODING:
|
case VENUS_DEC_STATE_DECODING:
|
||||||
|
case VENUS_DEC_STATE_DRAIN:
|
||||||
inst->codec_state = VENUS_DEC_STATE_DRC;
|
inst->codec_state = VENUS_DEC_STATE_DRC;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user