static void rk3288_vpu_set_src_img_ctrl(struct rockchip_vpu_dev *vpu,
					struct rockchip_vpu_ctx *ctx)
{
	struct v4l2_pix_format_mplane *pix_fmt = &ctx->src_fmt;
	u32 reg;

	reg = VEPU_REG_IN_IMG_CTRL_ROW_LEN(pix_fmt->width)
		| VEPU_REG_IN_IMG_CTRL_OVRFLR_D4(0)
		| VEPU_REG_IN_IMG_CTRL_OVRFLB_D4(0)
		| VEPU_REG_IN_IMG_CTRL_FMT(ctx->vpu_src_fmt->enc_fmt);
	vepu_write_relaxed(vpu, reg, VEPU_REG_IN_IMG_CTRL);
}
Beispiel #2
0
static inline u32 enc_in_img_ctrl(struct rk3288_vpu_ctx *ctx)
{
	struct v4l2_pix_format_mplane *pix_fmt = &ctx->src_fmt;
	struct v4l2_rect *crop = &ctx->src_crop;
	unsigned bytes_per_line, overfill_r, overfill_b;

	/*
	 * The hardware needs only the value for luma plane, because
	 * values of other planes are calculated internally based on
	 * format setting.
	 */
	bytes_per_line = pix_fmt->plane_fmt[0].bytesperline;
	overfill_r = (pix_fmt->width - crop->width) / 4;
	overfill_b = pix_fmt->height - crop->height;

	return VEPU_REG_IN_IMG_CTRL_ROW_LEN(bytes_per_line)
			| VEPU_REG_IN_IMG_CTRL_OVRFLR_D4(overfill_r)
			| VEPU_REG_IN_IMG_CTRL_OVRFLB_D4(overfill_b)
			| VEPU_REG_IN_IMG_CTRL_FMT(ctx->vpu_src_fmt->enc_fmt);
}