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

Commit 91388a25 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: vidc: Fix tile info table generation"

parents 6618051a d7f9d95c
Loading
Loading
Loading
Loading
+0 −36
Original line number Diff line number Diff line
@@ -1548,10 +1548,6 @@ int msm_venc_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
	}
	case V4L2_CID_MPEG_VIDC_IMG_GRID_DIMENSION:
	{
		int i = 0, j = 0;
		u32 width = 0, height = 0;
		u32 trows, tcols;

		property_id = HAL_CONFIG_HEIC_GRID_ENABLE;
		if (inst->fmts[CAPTURE_PORT].fourcc != V4L2_PIX_FMT_HEVC) {
			dprintk(VIDC_ERR, "Grid is supported only for HEVC\n");
@@ -1566,38 +1562,6 @@ int msm_venc_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
		grid_enable.grid_enable = ctrl->val;
		inst->img_grid_dimension = ctrl->val;
		pdata = &grid_enable;

		/* Update tile info table */
		width = inst->prop.width[OUTPUT_PORT];
		height = inst->prop.height[OUTPUT_PORT];
		tcols = (width + inst->img_grid_dimension - 1) /
					inst->img_grid_dimension;
		trows = (height + inst->img_grid_dimension - 1) /
					inst->img_grid_dimension;
		inst->tinfo.count = trows * tcols;
		if (inst->tinfo.count > MAX_HEIC_TILES_COUNT) {
			dprintk(VIDC_ERR, "Tiles count exceeds maximum\n");
			rc = -ENOTSUPP;
			break;
		}

		dprintk(VIDC_DBG,
			"Grid dimension %d width %d height %d row %d col %d\n",
			inst->img_grid_dimension, width, height,
			trows, tcols);

		for (j = 0; j < trows; ++j) {
			for (i = 0; i < tcols; ++i) {
				inst->tinfo.tile_rects[j*tcols+i].left =
					(i * inst->img_grid_dimension);
				inst->tinfo.tile_rects[j*tcols+i].top =
					(j * inst->img_grid_dimension);
				inst->tinfo.tile_rects[j*tcols+i].width =
					inst->img_grid_dimension;
				inst->tinfo.tile_rects[j*tcols+i].height =
					inst->img_grid_dimension;
			}
		}
		break;
	}
	case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK:
+52 −0
Original line number Diff line number Diff line
@@ -901,6 +901,51 @@ static inline int msm_vidc_verify_buffer_counts(struct msm_vidc_inst *inst)
	return rc;
}

static int msm_vidc_create_tile_info_table(struct msm_vidc_inst *inst)
{
	int i = 0, j = 0;
	u32 width = 0, height = 0;
	u32 trows = 0, tcols = 0;

	/* Don't create table for non-HEIC formats*/
	if (inst->img_grid_dimension <= 0 ||
		inst->fmts[CAPTURE_PORT].fourcc != V4L2_PIX_FMT_HEVC)
		return 0;

	width = inst->prop.width[OUTPUT_PORT];
	height = inst->prop.height[OUTPUT_PORT];
	tcols = (width + inst->img_grid_dimension - 1) /
		inst->img_grid_dimension;
	trows = (height + inst->img_grid_dimension - 1) /
		inst->img_grid_dimension;
	inst->tinfo.count = trows * tcols;
	if (inst->tinfo.count > MAX_HEIC_TILES_COUNT) {
		dprintk(VIDC_ERR,
			"Tiles count (%d) exceeds maximum\n",
			inst->tinfo.count);
		return -ENOTSUPP;
	}

	dprintk(VIDC_DBG,
		"Grid dimension %d width %d height %d row %d col %d\n",
		inst->img_grid_dimension, width, height,
		trows, tcols);

	for (j = 0; j < trows; ++j) {
		for (i = 0; i < tcols; ++i) {
			inst->tinfo.tile_rects[j*tcols+i].left =
				(i * inst->img_grid_dimension);
			inst->tinfo.tile_rects[j*tcols+i].top =
				(j * inst->img_grid_dimension);
			inst->tinfo.tile_rects[j*tcols+i].width =
				inst->img_grid_dimension;
			inst->tinfo.tile_rects[j*tcols+i].height =
				inst->img_grid_dimension;
		}
	}
	return 0;
}

static inline int start_streaming(struct msm_vidc_inst *inst)
{
	int rc = 0;
@@ -909,6 +954,13 @@ static inline int start_streaming(struct msm_vidc_inst *inst)

	hdev = inst->core->device;

	/* Create tile info table */
	rc = msm_vidc_create_tile_info_table(inst);
	if (rc) {
		dprintk(VIDC_ERR, "Tile info table was not generated\n");
		goto fail_start;
	}

	/* Check if current session is under HW capability */
	rc = msm_vidc_check_session_supported(inst);
	if (rc) {