Commit 996d2155 authored by Dikshita Agarwal's avatar Dikshita Agarwal Committed by Mauro Carvalho Chehab
Browse files

media: venus: add handling of bit depth change from firmware



Set opb format to TP10_UWC and dpb to client set format
when bit depth change to 10 bit is detecting by firmware.

Acked-by: default avatarKonrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: default avatarDikshita Agarwal <quic_dikshita@quicinc.com>
Signed-off-by: default avatarStanimir Varbanov <stanimir.k.varbanov@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 58b64dd0
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
@@ -1765,6 +1765,22 @@ int venus_helper_get_out_fmts(struct venus_inst *inst, u32 v4l2_fmt,
	if (!caps)
	if (!caps)
		return -EINVAL;
		return -EINVAL;


	if (inst->bit_depth == VIDC_BITDEPTH_10 && inst->session_type == VIDC_SESSION_TYPE_DEC) {
		found_ubwc = find_fmt_from_caps(caps, HFI_BUFFER_OUTPUT,
						HFI_COLOR_FORMAT_YUV420_TP10_UBWC);
		found = find_fmt_from_caps(caps, HFI_BUFFER_OUTPUT2, fmt);
		if (found_ubwc && found) {
			/*
			 * Hard-code DPB buffers to be 10bit UBWC
			 * until V4L2 is able to expose compressed/tiled
			 * formats to applications.
			 */
			*out_fmt = HFI_COLOR_FORMAT_YUV420_TP10_UBWC;
			*out2_fmt = fmt;
			return 0;
		}
	}

	if (ubwc) {
	if (ubwc) {
		ubwc_fmt = fmt | HFI_COLOR_FORMAT_UBWC_BASE;
		ubwc_fmt = fmt | HFI_COLOR_FORMAT_UBWC_BASE;
		found_ubwc = find_fmt_from_caps(caps, HFI_BUFFER_OUTPUT,
		found_ubwc = find_fmt_from_caps(caps, HFI_BUFFER_OUTPUT,
+4 −1
Original line number Original line Diff line number Diff line
@@ -736,6 +736,9 @@ static int vdec_set_work_route(struct venus_inst *inst)
}
}


#define is_ubwc_fmt(fmt) (!!((fmt) & HFI_COLOR_FORMAT_UBWC_BASE))
#define is_ubwc_fmt(fmt) (!!((fmt) & HFI_COLOR_FORMAT_UBWC_BASE))
#define is_10bit_ubwc_fmt(fmt) (!!((fmt) & HFI_COLOR_FORMAT_10_BIT_BASE & \
				 HFI_COLOR_FORMAT_UBWC_BASE))



static int vdec_output_conf(struct venus_inst *inst)
static int vdec_output_conf(struct venus_inst *inst)
{
{
@@ -783,7 +786,7 @@ static int vdec_output_conf(struct venus_inst *inst)
		inst->opb_fmt = out2_fmt;
		inst->opb_fmt = out2_fmt;
		inst->dpb_buftype = HFI_BUFFER_OUTPUT;
		inst->dpb_buftype = HFI_BUFFER_OUTPUT;
		inst->dpb_fmt = out_fmt;
		inst->dpb_fmt = out_fmt;
	} else if (is_ubwc_fmt(out2_fmt)) {
	} else if (is_ubwc_fmt(out2_fmt) || is_10bit_ubwc_fmt(out_fmt)) {
		inst->opb_buftype = HFI_BUFFER_OUTPUT;
		inst->opb_buftype = HFI_BUFFER_OUTPUT;
		inst->opb_fmt = out_fmt;
		inst->opb_fmt = out_fmt;
		inst->dpb_buftype = HFI_BUFFER_OUTPUT2;
		inst->dpb_buftype = HFI_BUFFER_OUTPUT2;