示例#1
0
/**
 * ispresizer_config_size - Configures input and output image size.
 * @pipe: Resizer data path parameters.
 *
 * Configures the appropriate values stored in the isp_res structure in the
 * resizer registers.
 *
 * Returns 0 if successful, or -EINVAL if passed values haven't been verified
 * with ispresizer_try_size() previously.
 **/
int ispresizer_s_pipeline(struct isp_res_device *isp_res,
			  struct isp_node *pipe)
{
	struct device *dev = to_device(isp_res);
	int bpp = ISP_BYTES_PER_PIXEL;

	ispresizer_set_source(isp_res, pipe->in.path);
	ispresizer_set_intype(isp_res, pipe->in.path);
	ispresizer_set_start_phase(dev, NULL);
	ispresizer_set_luma_enhance(dev, NULL);

	if (pipe->in.image.pixelformat == V4L2_PIX_FMT_YUYV)
		ispresizer_config_ycpos(isp_res, 1);
	else
		ispresizer_config_ycpos(isp_res, 0);

	ispresizer_try_pipeline(isp_res, pipe);

	ispresizer_set_ratio(dev, isp_res->h_resz, isp_res->v_resz);
	ispresizer_set_coeffs(dev, NULL, isp_res->h_resz, isp_res->v_resz);

	/* Switch filter, releated to up/down scale */
	if (ispresizer_is_upscale(pipe))
		ispresizer_enable_cbilin(isp_res, 1);
	else
		ispresizer_enable_cbilin(isp_res, 0);

	/* Set input and output size */
	ispresizer_set_input_size(dev, isp_res->phy_rect.width,
				  isp_res->phy_rect.height);
	ispresizer_set_output_size(dev, pipe->out.image.width,
				   pipe->out.image.height);

	/* Set input address and line offset address */
	if (pipe->in.path != RSZ_OTFLY_YUV) {
		/* Set the input address, plus calculated crop offset */
		ispresizer_set_inaddr(isp_res, isp_res->in_buff_addr, pipe);
		/* Set the input line offset/length */
		ispresizer_set_in_offset(isp_res, pipe->in.image.bytesperline);
	} else {
		/* Set the input address.*/
		ispresizer_set_inaddr(isp_res, 0, NULL);
		/* Set the starting pixel offset */
		ispresizer_set_start(dev, isp_res->phy_rect.left * bpp,
				     isp_res->phy_rect.top);
		ispresizer_set_in_offset(isp_res, 0);
	}

	/* Set output line offset */
	ispresizer_set_out_offset(isp_res, pipe->out.image.bytesperline);

	return 0;
}
示例#2
0
/**
 * ispresizer_applycrop - Apply crop to input image.
 **/
void ispresizer_applycrop(struct isp_res_device *isp_res)
{
	struct isp_device *isp = to_isp_device(isp_res);
	struct isp_node *pipe = &isp->pipeline.rsz;
	int bpp = ISP_BYTES_PER_PIXEL;

	if (!isp_res->applycrop)
		return;

	ispresizer_set_ratio(isp->dev, isp_res->h_resz, isp_res->v_resz);
	ispresizer_set_coeffs(isp->dev, NULL, isp_res->h_resz, isp_res->v_resz);

	/* Switch filter, releated to up/down scale */
	if (ispresizer_is_upscale(pipe))
		ispresizer_enable_cbilin(isp_res, 1);
	else
		ispresizer_enable_cbilin(isp_res, 0);

	/* Set input and output size */
	ispresizer_set_input_size(isp->dev, isp_res->phy_rect.width,
				  isp_res->phy_rect.height);
	ispresizer_set_output_size(isp->dev, pipe->out.image.width,
				   pipe->out.image.height);

	/* Set input address and line offset address */
	if (pipe->in.path != RSZ_OTFLY_YUV) {
		/* Set the input address, plus calculated crop offset */
		ispresizer_set_inaddr(isp_res, isp_res->in_buff_addr, pipe);
		/* Set the input line offset/length */
		ispresizer_set_in_offset(isp_res, pipe->in.image.bytesperline);
	} else {
		/* Set the input address.*/
		ispresizer_set_inaddr(isp_res, 0, NULL);
		/* Set the starting pixel offset */
		ispresizer_set_start(isp->dev, isp_res->phy_rect.left * bpp,
				     isp_res->phy_rect.top);
		ispresizer_set_in_offset(isp_res, 0);
	}

	/* Set output line offset */
	ispresizer_set_out_offset(isp_res, pipe->out.image.bytesperline);

	isp_res->applycrop = 0;
}
示例#3
0
/** ispdss_begin - Function to be called by DSS when resizing of the input
  * image buffer is needed
  * @slot: buffer index where the input image is stored
  * @output_buffer_index: output buffer index where output of resizer will
  * be stored
  * @out_off: The line size in bytes for output buffer. as most probably
  * this will be VRFB with YUV422 data, it should come 0x2000 as input
  * @out_phy_add: physical address of the start of output memory area for this
  * @in_phy_add: physical address of the start of input memory area for this
  * @in_off:: The line size in bytes for output buffer.
  * ispdss_begin()  takes the input buffer index and output buffer index
  * to start the process of resizing. after resizing is complete,
  * the callback function will be called with the argument.
  * Indexes of the input and output buffers are used so that it is faster
  * and easier to configure the input and output address for the ISP resizer.
  * As per the current implementation, DSS uses six VRFB contexts for rotation.
  * for both input and output buffers index and physical address has been taken
  * as argument. if this buffer is not already mapped to ISP address space we
  * use physical address to map it, otherwise only the index is used.
  **/
int ispdss_begin(struct isp_node *pipe, u32 input_buffer_index,
		 int output_buffer_index, u32 out_off, u32 out_phy_add,
		 u32 in_phy_add, u32 in_off)
{
	unsigned int output_size;
	struct isp_device *isp = dev_get_drvdata(dev_ctx.isp);
	struct isp_res_device *isp_res = &isp->isp_res;
//LGE_CHANGE_S [[email protected]]  2011_04_22, for improve ISP to get 30fps (OMAPS00236923)
	u32 speed_val = 0;
//LGE_CHANGE_E [[email protected]]  2011_04_22, for improve ISP to get 30fps (OMAPS00236923)	

//LGE_CHANGE_S [[email protected]] 2011_07_19 Froyo_to_GB
	struct device *dev = to_device(isp_res);
//LGE_CHANGE_E [[email protected]] 2011_07_19 Froyo_to_GB

	if (output_buffer_index >= dev_ctx.num_video_buffers) {
		dev_err(dev_ctx.isp,
		"ouput buffer index is out of range %d", output_buffer_index);
		return -EINVAL;
	}

	if (dev_ctx.config_state != STATE_CONFIGURED) {
		dev_err(dev_ctx.isp, "State not configured \n");
		return -EINVAL;
	}

	dev_ctx.tmp_buf_size = PAGE_ALIGN(pipe->out.image.bytesperline *
					  pipe->out.image.height);
	ispdss_tmp_buf_alloc(dev_ctx.tmp_buf_size);

	pipe->in.path = RSZ_MEM_YUV;
	if (ispresizer_s_pipeline(isp_res, pipe) != 0)
		return -EINVAL;

	/* If this output buffer has not been mapped till now then map it */
	if (!dev_ctx.out_buf_virt_addr[output_buffer_index]) {
		output_size = pipe->out.image.height * out_off;
		dev_ctx.out_buf_virt_addr[output_buffer_index] =
			iommu_kmap(isp->iommu, 0, out_phy_add, output_size,
				   IOMMU_FLAG);
		if (IS_ERR_VALUE(
			dev_ctx.out_buf_virt_addr[output_buffer_index])) {
			dev_err(dev_ctx.isp, "Mapping of output buffer failed"
						"for index \n");
			return -ENOMEM;
		}
	}

	if (!dev_ctx.in_buf_virt_addr[input_buffer_index]) {
		dev_ctx.in_buf_virt_addr[input_buffer_index] =
			iommu_kmap(isp->iommu, 0, in_phy_add, in_off,
				   IOMMU_FLAG);
		if (IS_ERR_VALUE(
			dev_ctx.in_buf_virt_addr[input_buffer_index])) {
			dev_err(dev_ctx.isp, "Mapping of input buffer failed"
						"for index \n");
			return -ENOMEM;
		}
	}

	if (ispresizer_set_inaddr(isp_res,
				  dev_ctx.in_buf_virt_addr[input_buffer_index],
				  pipe) != 0)
		return -EINVAL;

	if (ispresizer_set_out_offset(isp_res, out_off) != 0)
		return -EINVAL;

	if (ispresizer_set_outaddr(isp_res,
		(u32)dev_ctx.out_buf_virt_addr[output_buffer_index]) != 0)
		return -EINVAL;

	/* Set ISP callback for the resizing complete even */
	if (isp_set_callback(dev_ctx.isp, CBK_RESZ_DONE, ispdss_isr,
			     (void *) NULL, (void *)NULL)) {
		dev_err(dev_ctx.isp, "No callback for RSZR\n");
		return -1;
	}

	/* All settings are done.Enable the resizer */
	init_completion(&dev_ctx.compl_isr);

//LGE_CHANGE_S [[email protected]]  2011_04_22, for improve ISP to get 30fps (OMAPS00236923)
//	isp_start(dev_ctx.isp);
	/* Only for 720p case*/
	if (use_isp_resizer_decoder){
		/*decoder */
		speed_val = 0;

	}else{
		/* encoder */
		speed_val = 8;

	}
//LGE_CHANGE_S [[email protected]] 2011_07_19 Froyo_to_GB
	
	isp_reg_and_or(dev, OMAP3_ISP_IOMEM_SBL, ISPSBL_SDR_REQ_EXP,
		       ~ISPSBL_SDR_REQ_RSZ_EXP_MASK,
				speed_val << ISPSBL_SDR_REQ_RSZ_EXP_SHIFT);

	isp_start(dev_ctx.isp);
//LGE_CHANGE_E [[email protected]] 2011_07_19 Froyo_to_GB
	ispresizer_enable(isp_res, 1);

	/* Wait for resizing complete event */
	if (wait_for_completion_interruptible_timeout(
				&dev_ctx.compl_isr, msecs_to_jiffies(500)) == 0)
		dev_crit(dev_ctx.isp, "\nTimeout exit from "
			 "wait_for_completion\n");

	/* Unset the ISP callback function */
	isp_unset_callback(dev_ctx.isp, CBK_RESZ_DONE);

	return 0;
}