コード例 #1
0
static int fimc_is_queue_set_format_mplane(struct fimc_is_queue *queue,
	void *device,
	struct v4l2_format *format)
{
	int ret = 0;
	u32 plane;
	struct v4l2_pix_format_mplane *pix;
	struct fimc_is_fmt *fmt;

	BUG_ON(!queue);

	pix = &format->fmt.pix_mp;
	fmt = fimc_is_find_format(&pix->pixelformat, NULL);
	if (!fmt) {
		err("pixel format is not found\n");
		ret = -EINVAL;
		goto p_err;
	}

	queue->framecfg.format.pixelformat	= fmt->pixelformat;
	queue->framecfg.colorspace		= pix->colorspace;
	queue->framecfg.format.mbus_code	= fmt->mbus_code;
	queue->framecfg.format.num_planes	= fmt->num_planes;
	queue->framecfg.width			= pix->width;
	queue->framecfg.height			= pix->height;

	for (plane = 0; plane < fmt->num_planes; ++plane) {
		if (pix->plane_fmt[plane].bytesperline) {
			queue->framecfg.bytesperline[plane] =
				pix->plane_fmt[plane].bytesperline;
			queue->framecfg.width_stride[plane] =
				pix->plane_fmt[plane].bytesperline - pix->width;
		} else {
			queue->framecfg.bytesperline[plane] = 0;
			queue->framecfg.width_stride[plane] = 0;
		}
	}

	ret = CALL_QOPS(queue, s_format, device, queue);
	if (ret) {
		err("s_format is fail(%d)", ret);
		goto p_err;
	}

p_err:
	return ret;
}
コード例 #2
0
static int fimc_is_queue_set_format_mplane(struct fimc_is_queue *queue,
	struct v4l2_format *format)
{
	int ret = 0;
	u32 plane;
	struct v4l2_pix_format_mplane *pix;
	struct fimc_is_fmt *fmt;

	pix = &format->fmt.pix_mp;
	fmt = fimc_is_find_format(&pix->pixelformat, NULL, 0);
	if (!fmt) {
		err("pixel format is not found\n");
		ret = -EINVAL;
		goto p_err;
	}

	queue->framecfg.format.pixelformat	= fmt->pixelformat;
	queue->framecfg.format.mbus_code	= fmt->mbus_code;
	queue->framecfg.format.num_planes	= fmt->num_planes;
	queue->framecfg.width			= pix->width;
	queue->framecfg.height			= pix->height;

	for (plane = 0; plane < fmt->num_planes; ++plane) {
		if (pix->plane_fmt[plane].bytesperline) {
			queue->framecfg.bytesperline[plane] =
				pix->plane_fmt[plane].bytesperline;
			queue->framecfg.width_stride[plane] =
				pix->plane_fmt[plane].bytesperline - pix->width;
		} else {
			queue->framecfg.bytesperline[plane] = 0;
			queue->framecfg.width_stride[plane] = 0;
		}
	}

p_err:
	return ret;
}