示例#1
0
static int rotator_src_set_size(struct device *dev, int swap,
						struct drm_exynos_pos *pos,
						struct drm_exynos_sz *sz)
{
	struct rot_context *rot = dev_get_drvdata(dev);
	struct drm_exynos_ipp_property *property = &rot->property;
	struct drm_exynos_ipp_config *config =
					&property->config[EXYNOS_DRM_OPS_SRC];

	/* Check boundary */
	if ((pos->x + pos->w > sz->hsize) || (pos->y + pos->h > sz->vsize)) {
		DRM_ERROR("out of bound\n");
		return -EINVAL;
	}

	/* Set buffer size configuration */
	config->sz.hsize = sz->hsize;
	config->sz.vsize = sz->vsize;

	rotator_reg_set_src_buf_size(rot, config->sz.hsize, config->sz.vsize);

	/* Set crop image position configuration */
	config->pos.x = pos->x;
	config->pos.y = pos->y;
	config->pos.w = pos->w;
	config->pos.h = pos->h;

	rotator_reg_set_src_crop_pos(rot, config->pos.x, config->pos.y);
	rotator_reg_set_src_crop_size(rot, config->pos.w, config->pos.h);

	return 0;
}
static int rotator_src_set_size(struct device *dev, int swap,
						struct drm_exynos_pos *pos,
						struct drm_exynos_sz *sz)
{
	struct rot_context *rot = dev_get_drvdata(dev);
	u32 fmt, hsize, vsize;

	/* Get format */
	fmt = rotator_reg_get_format(rot);

	/* Align buffer size */
	hsize = sz->hsize;
	vsize = sz->vsize;
	rotator_align_size(rot, fmt, &hsize, &vsize);

	/* Set buffer size configuration */
	rotator_reg_set_src_buf_size(rot, hsize, vsize);

	/* Set crop image position configuration */
	rotator_reg_set_src_crop_pos(rot, pos->x, pos->y);
	rotator_reg_set_src_crop_size(rot, pos->w, pos->h);

	return 0;
}