Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a108e35d authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: vidc: add superframe encode support"

parents 8daa6110 5e31da53
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -876,6 +876,7 @@ static struct hfi_packetization_ops hfi_default = {
	.session_get_buf_req = create_pkt_cmd_session_get_buf_req,
	.session_flush = create_pkt_cmd_session_flush,
	.session_set_property = create_pkt_cmd_session_set_property,
	.session_sync_process = create_pkt_cmd_session_sync_process,
};

struct hfi_packetization_ops *hfi_get_pkt_ops_handle(
+9 −0
Original line number Diff line number Diff line
@@ -397,6 +397,15 @@ static struct msm_vidc_ctrl msm_vdec_ctrls[] = {
		.default_value = V4L2_MPEG_MSM_VIDC_DISABLE,
		.step = 1,
	},
	{
		.id = V4L2_CID_MPEG_VIDC_SUPERFRAME,
		.name = "Superframe",
		.type = V4L2_CTRL_TYPE_INTEGER,
		.minimum = 0,
		.maximum = 0,
		.default_value = 0,
		.step = 1,
	},
};

#define NUM_CTRLS ARRAY_SIZE(msm_vdec_ctrls)
+16 −0
Original line number Diff line number Diff line
@@ -948,6 +948,15 @@ static struct msm_vidc_ctrl msm_venc_ctrls[] = {
		.default_value = 0,
		.step = 500,
	},
	{
		.id = V4L2_CID_MPEG_VIDC_SUPERFRAME,
		.name = "Superframe",
		.type = V4L2_CTRL_TYPE_INTEGER,
		.minimum = 0,
		.maximum = VIDC_SUPERFRAME_MAX,
		.default_value = 0,
		.step = 1,
	},
};

#define NUM_CTRLS ARRAY_SIZE(msm_venc_ctrls)
@@ -1798,6 +1807,7 @@ int msm_venc_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
	case V4L2_CID_MPEG_VIDC_VENC_RC_TIMESTAMP_DISABLE:
	case V4L2_CID_MPEG_VIDEO_VBV_DELAY:
	case V4L2_CID_MPEG_VIDC_VENC_BITRATE_SAVINGS:
	case V4L2_CID_MPEG_VIDC_SUPERFRAME:
		dprintk(VIDC_HIGH, "Control set: ID : %x Val : %d\n",
			ctrl->id, ctrl->val);
		break;
@@ -2166,6 +2176,12 @@ void msm_venc_decide_bframe(struct msm_vidc_inst *inst)
			goto disable_bframe;
		}
	}

	/* do not enable bframe if superframe is enabled */
	ctrl = get_ctrl(inst, V4L2_CID_MPEG_VIDC_SUPERFRAME);
	if (ctrl->val)
		goto disable_bframe;

	dprintk(VIDC_HIGH, "Bframe can be enabled!\n");

	return;
+18 −0
Original line number Diff line number Diff line
@@ -18,6 +18,10 @@
/* extra o/p buffers in case of decoder dcvs */
#define DCVS_DEC_EXTRA_OUTPUT_BUFFERS 4

/* extra buffers for encoder HFR usecase */
#define HFR_EXTRA_INPUT_BUFFERS 4
#define HFR_EXTRA_OUTPUT_BUFFERS 12

#define HFI_COLOR_FORMAT_YUV420_NV12_UBWC_Y_TILE_WIDTH 32
#define HFI_COLOR_FORMAT_YUV420_NV12_UBWC_Y_TILE_HEIGHT 8
#define HFI_COLOR_FORMAT_YUV420_NV12_UBWC_UV_TILE_WIDTH 16
@@ -724,6 +728,7 @@ int msm_vidc_get_extra_buff_count(struct msm_vidc_inst *inst,
	enum hal_buffer buffer_type)
{
	unsigned int count = 0;
	struct v4l2_format *f;

	if (!inst || !inst->core) {
		dprintk(VIDC_ERR, "%s Invalid args\n", __func__);
@@ -758,6 +763,19 @@ int msm_vidc_get_extra_buff_count(struct msm_vidc_inst *inst,
			count = inst->batch.size;
	}

	/* increase both input and output counts for HFR/HSR encode case */
	f = &inst->fmts[INPUT_PORT].v4l2_fmt;
	if (is_encode_session(inst) && msm_vidc_get_fps(inst) >= 120 &&
		!res_is_greater_than(f->fmt.pix_mp.width,
		f->fmt.pix_mp.height, 1920, 1088)) {
		if (buffer_type == HAL_BUFFER_INPUT &&
			count < HFR_EXTRA_INPUT_BUFFERS)
			count = HFR_EXTRA_INPUT_BUFFERS;
		if (buffer_type == HAL_BUFFER_OUTPUT &&
			count < HFR_EXTRA_OUTPUT_BUFFERS)
			count = HFR_EXTRA_OUTPUT_BUFFERS;
	}

	return count;
}

+7 −1
Original line number Diff line number Diff line
@@ -160,7 +160,7 @@ int msm_vidc_get_mbs_per_frame(struct msm_vidc_inst *inst)
	return NUM_MBS_PER_FRAME(height, width);
}

static int msm_vidc_get_fps(struct msm_vidc_inst *inst)
int msm_vidc_get_fps(struct msm_vidc_inst *inst)
{
	int fps;

@@ -176,10 +176,16 @@ static int msm_vidc_get_fps(struct msm_vidc_inst *inst)
void update_recon_stats(struct msm_vidc_inst *inst,
	struct recon_stats_type *recon_stats)
{
	struct v4l2_ctrl *ctrl;
	struct recon_buf *binfo;
	u32 CR = 0, CF = 0;
	u32 frame_size;

	/* do not consider recon stats in case of superframe */
	ctrl = get_ctrl(inst, V4L2_CID_MPEG_VIDC_SUPERFRAME);
	if (ctrl->val)
		return;

	CR = get_ubwc_compression_ratio(recon_stats->ubwc_stats_info);

	frame_size = (msm_vidc_get_mbs_per_frame(inst) / (32 * 8) * 3) / 2;
Loading