diff options
Diffstat (limited to 'isp')
| -rw-r--r-- | isp/omap3isp.c | 162 | 
1 files changed, 81 insertions, 81 deletions
| diff --git a/isp/omap3isp.c b/isp/omap3isp.c index d9a64d9..a19e65d 100644 --- a/isp/omap3isp.c +++ b/isp/omap3isp.c @@ -853,87 +853,6 @@ void omap3_isp_close(struct omap3_isp_device *isp)   * Viewfinder   */ -static int omap3_isp_viewfinder_setup_pipeline(struct omap3_isp_device *isp) -{ -	return omap3_isp_pipeline_activate(isp, &isp->viewfinder); -} - -int omap3_isp_viewfinder_setup(struct omap3_isp_device *isp, -			       struct v4l2_mbus_framefmt *ofmt) -{ -	struct omap3_isp_pool *pool; -	int ret; - -	ret = omap3_isp_pipeline_build(isp, &isp->viewfinder, ":SENSOR", -				       ENTITY_CCDC, ENTITY_PREVIEW, ENTITY_RESIZER, -				       ENTITY_RESIZER_OUTPUT, NULL); -	if (ret < 0) { -		printf("error: unable to build viewfinder pipeline (%d)\n", ret); -		return ret; -	} - -	isp->viewfinder.scaler = OMAP3_ISP_SCALER_ISP; - -	/* Try the format. */ -	ret = omap3_isp_pipeline_try_format(isp, &isp->viewfinder, ofmt, -					    isp->viewfinder.scaler); -	if (ret < 0) -		return ret; - -	/* Setup the pipeline. */ -	ret = omap3_isp_viewfinder_setup_pipeline(isp); -	if (ret < 0) -		return ret; - -	/* Allocate buffers for intermediate pools. */ -	list_for_each_entry(pool, &isp->viewfinder.pools, list) -		omap3_isp_pool_alloc_buffers(pool); - -	return 0; -} - -int omap3_isp_viewfinder_set_pool(struct omap3_isp_device *isp, -				  struct v4l2_buffers_pool *pool) -{ -	int ret; - -	/* Allocate video buffers. */ -	ret = v4l2_alloc_buffers(isp->viewfinder.output->video, pool, V4L2_MEMORY_USERPTR); -	if (ret < 0) { -		printf("error: unable to allocate buffers for viewfinder.\n"); -		return ret; -	} - -	isp->viewfinder.output->dequeued = 0; -	isp->viewfinder.output->queued = 0; -	return 0; -} - -int omap3_isp_viewfinder_set_scaler(struct omap3_isp_device *isp, -				    enum omap3_isp_scaler scaler) -{ -	struct v4l2_mbus_framefmt format; -	int ret; - -	if (isp->viewfinder.scaler == scaler) -		return 0; - -	isp->viewfinder.scaler = scaler; - -	/* If omap3_isp_viewfinder_setup() hasn't been called yet return now. */ -	if (isp->viewfinder.output->format.width == 0 || -	    isp->viewfinder.output->format.height == 0) -		return 0; - -	format = isp->viewfinder.output->format; -	ret = omap3_isp_pipeline_try_format(isp, &isp->viewfinder, &format, -					    isp->viewfinder.scaler); -	if (ret < 0) -		return ret; - -	return 0; -} -  static void omap3_isp_viewfinder_event(void *priv)  {  	struct omap3_isp_device *isp = priv; @@ -1022,6 +941,87 @@ int omap3_isp_viewfinder_stop(struct omap3_isp_device *isp)  	return 0;  } +static int omap3_isp_viewfinder_setup_pipeline(struct omap3_isp_device *isp) +{ +	return omap3_isp_pipeline_activate(isp, &isp->viewfinder); +} + +int omap3_isp_viewfinder_setup(struct omap3_isp_device *isp, +			       struct v4l2_mbus_framefmt *ofmt) +{ +	struct omap3_isp_pool *pool; +	int ret; + +	ret = omap3_isp_pipeline_build(isp, &isp->viewfinder, ":SENSOR", +				       ENTITY_CCDC, ENTITY_PREVIEW, ENTITY_RESIZER, +				       ENTITY_RESIZER_OUTPUT, NULL); +	if (ret < 0) { +		printf("error: unable to build viewfinder pipeline (%d)\n", ret); +		return ret; +	} + +	isp->viewfinder.scaler = OMAP3_ISP_SCALER_ISP; + +	/* Try the format. */ +	ret = omap3_isp_pipeline_try_format(isp, &isp->viewfinder, ofmt, +					    isp->viewfinder.scaler); +	if (ret < 0) +		return ret; + +	/* Setup the pipeline. */ +	ret = omap3_isp_viewfinder_setup_pipeline(isp); +	if (ret < 0) +		return ret; + +	/* Allocate buffers for intermediate pools. */ +	list_for_each_entry(pool, &isp->viewfinder.pools, list) +		omap3_isp_pool_alloc_buffers(pool); + +	return 0; +} + +int omap3_isp_viewfinder_set_pool(struct omap3_isp_device *isp, +				  struct v4l2_buffers_pool *pool) +{ +	int ret; + +	/* Allocate video buffers. */ +	ret = v4l2_alloc_buffers(isp->viewfinder.output->video, pool, V4L2_MEMORY_USERPTR); +	if (ret < 0) { +		printf("error: unable to allocate buffers for viewfinder.\n"); +		return ret; +	} + +	isp->viewfinder.output->dequeued = 0; +	isp->viewfinder.output->queued = 0; +	return 0; +} + +int omap3_isp_viewfinder_set_scaler(struct omap3_isp_device *isp, +				    enum omap3_isp_scaler scaler) +{ +	struct v4l2_mbus_framefmt format; +	int ret; + +	if (isp->viewfinder.scaler == scaler) +		return 0; + +	isp->viewfinder.scaler = scaler; + +	/* If omap3_isp_viewfinder_setup() hasn't been called yet return now. */ +	if (isp->viewfinder.output->format.width == 0 || +	    isp->viewfinder.output->format.height == 0) +		return 0; + +	format = isp->viewfinder.output->format; +	ret = omap3_isp_pipeline_try_format(isp, &isp->viewfinder, &format, +					    isp->viewfinder.scaler); +	if (ret < 0) +		return ret; + +	return 0; +} +  int omap3_isp_viewfinder_put_buffer(struct omap3_isp_device *isp,  				    struct v4l2_video_buffer *buffer)  { | 
