* [PATCH 3/6] exynos4-is: Fix format propagation on FIMC-IS-ISP subdev
@ 2013-06-21 13:00 Sylwester Nawrocki
2013-06-21 13:00 ` [PATCH 4/6] exynos4-is: Set valid initial format on FIMC-IS-ISP subdev pads Sylwester Nawrocki
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Sylwester Nawrocki @ 2013-06-21 13:00 UTC (permalink / raw)
To: linux-media; +Cc: kyungmin.park, j.anaszewski, a.hajda, Sylwester Nawrocki
Ensure TRY formats are propagated from the sink pad to the source pads
of the FIMC-IS-ISP subdev and the TRY and ACTIVE formats are separated.
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/media/platform/exynos4-is/fimc-isp.c | 90 ++++++++++++++++++--------
drivers/media/platform/exynos4-is/fimc-isp.h | 3 +-
2 files changed, 64 insertions(+), 29 deletions(-)
diff --git a/drivers/media/platform/exynos4-is/fimc-isp.c b/drivers/media/platform/exynos4-is/fimc-isp.c
index eda8134..9a37272 100644
--- a/drivers/media/platform/exynos4-is/fimc-isp.c
+++ b/drivers/media/platform/exynos4-is/fimc-isp.c
@@ -129,31 +129,26 @@ static int fimc_isp_subdev_get_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_format *fmt)
{
struct fimc_isp *isp = v4l2_get_subdevdata(sd);
- struct fimc_is *is = fimc_isp_to_is(isp);
struct v4l2_mbus_framefmt *mf = &fmt->format;
- struct v4l2_mbus_framefmt cur_fmt;
if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
- mf = v4l2_subdev_get_try_format(fh, fmt->pad);
- fmt->format = *mf;
+ *mf = *v4l2_subdev_get_try_format(fh, fmt->pad);
return 0;
}
mf->colorspace = V4L2_COLORSPACE_SRGB;
mutex_lock(&isp->subdev_lock);
- __is_get_frame_size(is, &cur_fmt);
if (fmt->pad == FIMC_ISP_SD_PAD_SINK) {
- /* full camera input frame size */
- mf->width = cur_fmt.width + FIMC_ISP_CAC_MARGIN_WIDTH;
- mf->height = cur_fmt.height + FIMC_ISP_CAC_MARGIN_HEIGHT;
- mf->code = V4L2_MBUS_FMT_SGRBG10_1X10;
+ /* ISP OTF input image format */
+ *mf = isp->sink_fmt;
} else {
- /* crop size */
- mf->width = cur_fmt.width;
- mf->height = cur_fmt.height;
- mf->code = V4L2_MBUS_FMT_YUV10_1X30;
+ /* ISP OTF output image format */
+ *mf = isp->src_fmt;
+
+ if (fmt->pad == FIMC_ISP_SD_PAD_SRC_FIFO)
+ mf->code = V4L2_MBUS_FMT_YUV10_1X30;
}
mutex_unlock(&isp->subdev_lock);
@@ -165,21 +160,37 @@ static int fimc_isp_subdev_get_fmt(struct v4l2_subdev *sd,
}
static void __isp_subdev_try_format(struct fimc_isp *isp,
- struct v4l2_subdev_format *fmt)
+ struct v4l2_subdev_fh *fh,
+ struct v4l2_subdev_format *fmt)
{
struct v4l2_mbus_framefmt *mf = &fmt->format;
+ struct v4l2_mbus_framefmt *format;
+
+ mf->colorspace = V4L2_COLORSPACE_SRGB;
if (fmt->pad == FIMC_ISP_SD_PAD_SINK) {
v4l_bound_align_image(&mf->width, FIMC_ISP_SINK_WIDTH_MIN,
FIMC_ISP_SINK_WIDTH_MAX, 0,
&mf->height, FIMC_ISP_SINK_HEIGHT_MIN,
FIMC_ISP_SINK_HEIGHT_MAX, 0, 0);
- isp->subdev_fmt = *mf;
+ mf->code = V4L2_MBUS_FMT_SGRBG10_1X10;
} else {
+ if (fmt->which == V4L2_SUBDEV_FORMAT_TRY)
+ format = v4l2_subdev_get_try_format(fh,
+ FIMC_ISP_SD_PAD_SINK);
+ else
+ format = &isp->sink_fmt;
+
/* Allow changing format only on sink pad */
- mf->width = isp->subdev_fmt.width - FIMC_ISP_CAC_MARGIN_WIDTH;
- mf->height = isp->subdev_fmt.height - FIMC_ISP_CAC_MARGIN_HEIGHT;
- mf->code = isp->subdev_fmt.code;
+ mf->width = format->width - FIMC_ISP_CAC_MARGIN_WIDTH;
+ mf->height = format->height - FIMC_ISP_CAC_MARGIN_HEIGHT;
+
+ if (fmt->pad == FIMC_ISP_SD_PAD_SRC_FIFO) {
+ mf->code = V4L2_MBUS_FMT_YUV10_1X30;
+ mf->colorspace = V4L2_COLORSPACE_JPEG;
+ } else {
+ mf->code = format->code;
+ }
}
}
@@ -195,24 +206,47 @@ static int fimc_isp_subdev_set_fmt(struct v4l2_subdev *sd,
isp_dbg(1, sd, "%s: pad%d: code: 0x%x, %dx%d\n",
__func__, fmt->pad, mf->code, mf->width, mf->height);
- mf->colorspace = V4L2_COLORSPACE_SRGB;
-
mutex_lock(&isp->subdev_lock);
- __isp_subdev_try_format(isp, fmt);
+ __isp_subdev_try_format(isp, fh, fmt);
if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
mf = v4l2_subdev_get_try_format(fh, fmt->pad);
*mf = fmt->format;
- mutex_unlock(&isp->subdev_lock);
- return 0;
+
+ /* Propagate format to the source pads */
+ if (fmt->pad == FIMC_ISP_SD_PAD_SINK) {
+ struct v4l2_subdev_format format = *fmt;
+ unsigned int pad;
+
+ for (pad = FIMC_ISP_SD_PAD_SRC_FIFO;
+ pad < FIMC_ISP_SD_PADS_NUM; pad++) {
+ format.pad = pad;
+ __isp_subdev_try_format(isp, fh, &format);
+ mf = v4l2_subdev_get_try_format(fh, pad);
+ *mf = format.format;
+ }
+ }
+ } else {
+ if (sd->entity.stream_count == 0) {
+ if (fmt->pad == FIMC_ISP_SD_PAD_SINK) {
+ struct v4l2_subdev_format format = *fmt;
+
+ isp->sink_fmt = *mf;
+
+ format.pad = FIMC_ISP_SD_PAD_SRC_DMA;
+ __isp_subdev_try_format(isp, fh, &format);
+
+ isp->src_fmt = format.format;
+ __is_set_frame_size(is, &isp->src_fmt);
+ } else {
+ isp->src_fmt = *mf;
+ }
+ } else {
+ ret = -EBUSY;
+ }
}
- if (sd->entity.stream_count == 0)
- __is_set_frame_size(is, mf);
- else
- ret = -EBUSY;
mutex_unlock(&isp->subdev_lock);
-
return ret;
}
diff --git a/drivers/media/platform/exynos4-is/fimc-isp.h b/drivers/media/platform/exynos4-is/fimc-isp.h
index 0aa2a54..4dc55a1 100644
--- a/drivers/media/platform/exynos4-is/fimc-isp.h
+++ b/drivers/media/platform/exynos4-is/fimc-isp.h
@@ -164,7 +164,8 @@ struct fimc_isp {
struct vb2_alloc_ctx *alloc_ctx;
struct v4l2_subdev subdev;
struct media_pad subdev_pads[FIMC_ISP_SD_PADS_NUM];
- struct v4l2_mbus_framefmt subdev_fmt;
+ struct v4l2_mbus_framefmt src_fmt;
+ struct v4l2_mbus_framefmt sink_fmt;
struct v4l2_ctrl *test_pattern;
struct fimc_isp_ctrls ctrls;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 4/6] exynos4-is: Set valid initial format on FIMC-IS-ISP subdev pads 2013-06-21 13:00 [PATCH 3/6] exynos4-is: Fix format propagation on FIMC-IS-ISP subdev Sylwester Nawrocki @ 2013-06-21 13:00 ` Sylwester Nawrocki 2013-06-21 13:00 ` [PATCH 5/6] exynos4-is: Set valid initial format on FIMC.n subdevs Sylwester Nawrocki 2013-06-21 13:00 ` [PATCH 6/6] exynos4-is: Correct colorspace handling at FIMC-LITE Sylwester Nawrocki 2 siblings, 0 replies; 5+ messages in thread From: Sylwester Nawrocki @ 2013-06-21 13:00 UTC (permalink / raw) To: linux-media; +Cc: kyungmin.park, j.anaszewski, a.hajda, Sylwester Nawrocki Ensure there is a valid initial resolution and pixel format set at the FIMC-IS-ISP subdev pads. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> --- drivers/media/platform/exynos4-is/fimc-isp.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/media/platform/exynos4-is/fimc-isp.c b/drivers/media/platform/exynos4-is/fimc-isp.c index 9a37272..bc515f0 100644 --- a/drivers/media/platform/exynos4-is/fimc-isp.c +++ b/drivers/media/platform/exynos4-is/fimc-isp.c @@ -670,6 +670,22 @@ static const struct v4l2_ctrl_ops fimc_isp_ctrl_ops = { .s_ctrl = fimc_is_s_ctrl, }; +static void __isp_subdev_set_default_format(struct fimc_isp *isp) +{ + struct fimc_is *is = fimc_isp_to_is(isp); + + isp->sink_fmt.width = DEFAULT_PREVIEW_STILL_WIDTH + + FIMC_ISP_CAC_MARGIN_WIDTH; + isp->sink_fmt.height = DEFAULT_PREVIEW_STILL_HEIGHT + + FIMC_ISP_CAC_MARGIN_HEIGHT; + isp->sink_fmt.code = V4L2_MBUS_FMT_SGRBG10_1X10; + + isp->src_fmt.width = DEFAULT_PREVIEW_STILL_WIDTH; + isp->src_fmt.height = DEFAULT_PREVIEW_STILL_HEIGHT; + isp->src_fmt.code = V4L2_MBUS_FMT_SGRBG10_1X10; + __is_set_frame_size(is, &isp->src_fmt); +} + int fimc_isp_subdev_create(struct fimc_isp *isp) { const struct v4l2_ctrl_ops *ops = &fimc_isp_ctrl_ops; @@ -750,6 +766,8 @@ int fimc_isp_subdev_create(struct fimc_isp *isp) sd->entity.ops = &fimc_is_subdev_media_ops; v4l2_set_subdevdata(sd, isp); + __isp_subdev_set_default_format(isp); + return 0; } -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 5/6] exynos4-is: Set valid initial format on FIMC.n subdevs 2013-06-21 13:00 [PATCH 3/6] exynos4-is: Fix format propagation on FIMC-IS-ISP subdev Sylwester Nawrocki 2013-06-21 13:00 ` [PATCH 4/6] exynos4-is: Set valid initial format on FIMC-IS-ISP subdev pads Sylwester Nawrocki @ 2013-06-21 13:00 ` Sylwester Nawrocki 2013-06-21 18:22 ` Sylwester Nawrocki 2013-06-21 13:00 ` [PATCH 6/6] exynos4-is: Correct colorspace handling at FIMC-LITE Sylwester Nawrocki 2 siblings, 1 reply; 5+ messages in thread From: Sylwester Nawrocki @ 2013-06-21 13:00 UTC (permalink / raw) To: linux-media; +Cc: kyungmin.park, j.anaszewski, a.hajda, Sylwester Nawrocki Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> --- drivers/media/platform/exynos4-is/fimc-capture.c | 19 +++++++++++++++++-- drivers/media/platform/exynos4-is/fimc-core.h | 2 ++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c b/drivers/media/platform/exynos4-is/fimc-capture.c index 2b045b6..fb27ff7 100644 --- a/drivers/media/platform/exynos4-is/fimc-capture.c +++ b/drivers/media/platform/exynos4-is/fimc-capture.c @@ -1722,8 +1722,8 @@ static int fimc_capture_set_default_format(struct fimc_dev *fimc) struct v4l2_format fmt = { .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, .fmt.pix_mp = { - .width = 640, - .height = 480, + .width = FIMC_DEFAULT_WIDTH, + .height = FIMC_DEFAULT_HEIGHT, .pixelformat = V4L2_PIX_FMT_YUYV, .field = V4L2_FIELD_NONE, .colorspace = V4L2_COLORSPACE_JPEG, @@ -1741,6 +1741,7 @@ static int fimc_register_capture_device(struct fimc_dev *fimc, struct vb2_queue *q = &fimc->vid_cap.vbq; struct fimc_ctx *ctx; struct fimc_vid_cap *vid_cap; + struct fimc_fmt *fmt; int ret = -ENOMEM; ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); @@ -1788,6 +1789,20 @@ static int fimc_register_capture_device(struct fimc_dev *fimc, if (ret) goto err_free_ctx; + /* Default format configuration */ + fmt = fimc_find_format(NULL, NULL, FMT_FLAGS_CAM, 0); + vid_cap->ci_fmt.width = FIMC_DEFAULT_WIDTH; + vid_cap->ci_fmt.height = FIMC_DEFAULT_HEIGHT; + vid_cap->ci_fmt.code = fmt->mbus_code; + + ctx->s_frame.width = FIMC_DEFAULT_WIDTH; + ctx->s_frame.height = FIMC_DEFAULT_HEIGHT; + ctx->s_frame.fmt = fmt; + + fmt = fimc_find_format(NULL, NULL, FMT_FLAGS_WRITEBACK, 0); + vid_cap->wb_fmt = vid_cap->ci_fmt; + vid_cap->wb_fmt.code = fmt->mbus_code; + vid_cap->vd_pad.flags = MEDIA_PAD_FL_SINK; ret = media_entity_init(&vfd->entity, 1, &vid_cap->vd_pad, 0); if (ret) diff --git a/drivers/media/platform/exynos4-is/fimc-core.h b/drivers/media/platform/exynos4-is/fimc-core.h index 0f25ce0..65c8ce7 100644 --- a/drivers/media/platform/exynos4-is/fimc-core.h +++ b/drivers/media/platform/exynos4-is/fimc-core.h @@ -47,6 +47,8 @@ #define FIMC_DEF_MIN_SIZE 16 #define FIMC_DEF_HEIGHT_ALIGN 2 #define FIMC_DEF_HOR_OFFS_ALIGN 1 +#define FIMC_DEFAULT_WIDTH 640 +#define FIMC_DEFAULT_HEIGHT 480 /* indices to the clocks array */ enum { -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 5/6] exynos4-is: Set valid initial format on FIMC.n subdevs 2013-06-21 13:00 ` [PATCH 5/6] exynos4-is: Set valid initial format on FIMC.n subdevs Sylwester Nawrocki @ 2013-06-21 18:22 ` Sylwester Nawrocki 0 siblings, 0 replies; 5+ messages in thread From: Sylwester Nawrocki @ 2013-06-21 18:22 UTC (permalink / raw) To: linux-media; +Cc: Sylwester Nawrocki, kyungmin.park, j.anaszewski, a.hajda On 06/21/2013 03:00 PM, Sylwester Nawrocki wrote: *sigh* looks like I've posted wrong version of this series, please just ignore it. I'll post v2 next week. > Signed-off-by: Sylwester Nawrocki<s.nawrocki@samsung.com> > Signed-off-by: Kyungmin Park<kyungmin.park@samsung.com> > --- > drivers/media/platform/exynos4-is/fimc-capture.c | 19 +++++++++++++++++-- > drivers/media/platform/exynos4-is/fimc-core.h | 2 ++ > 2 files changed, 19 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c b/drivers/media/platform/exynos4-is/fimc-capture.c > index 2b045b6..fb27ff7 100644 > --- a/drivers/media/platform/exynos4-is/fimc-capture.c > +++ b/drivers/media/platform/exynos4-is/fimc-capture.c > @@ -1722,8 +1722,8 @@ static int fimc_capture_set_default_format(struct fimc_dev *fimc) > struct v4l2_format fmt = { > .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, > .fmt.pix_mp = { > - .width = 640, > - .height = 480, > + .width = FIMC_DEFAULT_WIDTH, > + .height = FIMC_DEFAULT_HEIGHT, > .pixelformat = V4L2_PIX_FMT_YUYV, > .field = V4L2_FIELD_NONE, > .colorspace = V4L2_COLORSPACE_JPEG, > @@ -1741,6 +1741,7 @@ static int fimc_register_capture_device(struct fimc_dev *fimc, > struct vb2_queue *q =&fimc->vid_cap.vbq; > struct fimc_ctx *ctx; > struct fimc_vid_cap *vid_cap; > + struct fimc_fmt *fmt; > int ret = -ENOMEM; > > ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); > @@ -1788,6 +1789,20 @@ static int fimc_register_capture_device(struct fimc_dev *fimc, > if (ret) > goto err_free_ctx; > > + /* Default format configuration */ > + fmt = fimc_find_format(NULL, NULL, FMT_FLAGS_CAM, 0); > + vid_cap->ci_fmt.width = FIMC_DEFAULT_WIDTH; > + vid_cap->ci_fmt.height = FIMC_DEFAULT_HEIGHT; > + vid_cap->ci_fmt.code = fmt->mbus_code; > + > + ctx->s_frame.width = FIMC_DEFAULT_WIDTH; > + ctx->s_frame.height = FIMC_DEFAULT_HEIGHT; > + ctx->s_frame.fmt = fmt; > + > + fmt = fimc_find_format(NULL, NULL, FMT_FLAGS_WRITEBACK, 0); > + vid_cap->wb_fmt = vid_cap->ci_fmt; > + vid_cap->wb_fmt.code = fmt->mbus_code; > + > vid_cap->vd_pad.flags = MEDIA_PAD_FL_SINK; > ret = media_entity_init(&vfd->entity, 1,&vid_cap->vd_pad, 0); > if (ret) > diff --git a/drivers/media/platform/exynos4-is/fimc-core.h b/drivers/media/platform/exynos4-is/fimc-core.h > index 0f25ce0..65c8ce7 100644 > --- a/drivers/media/platform/exynos4-is/fimc-core.h > +++ b/drivers/media/platform/exynos4-is/fimc-core.h > @@ -47,6 +47,8 @@ > #define FIMC_DEF_MIN_SIZE 16 > #define FIMC_DEF_HEIGHT_ALIGN 2 > #define FIMC_DEF_HOR_OFFS_ALIGN 1 > +#define FIMC_DEFAULT_WIDTH 640 > +#define FIMC_DEFAULT_HEIGHT 480 > > /* indices to the clocks array */ > enum { ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 6/6] exynos4-is: Correct colorspace handling at FIMC-LITE 2013-06-21 13:00 [PATCH 3/6] exynos4-is: Fix format propagation on FIMC-IS-ISP subdev Sylwester Nawrocki 2013-06-21 13:00 ` [PATCH 4/6] exynos4-is: Set valid initial format on FIMC-IS-ISP subdev pads Sylwester Nawrocki 2013-06-21 13:00 ` [PATCH 5/6] exynos4-is: Set valid initial format on FIMC.n subdevs Sylwester Nawrocki @ 2013-06-21 13:00 ` Sylwester Nawrocki 2 siblings, 0 replies; 5+ messages in thread From: Sylwester Nawrocki @ 2013-06-21 13:00 UTC (permalink / raw) To: linux-media; +Cc: kyungmin.park, j.anaszewski, a.hajda, Sylwester Nawrocki Ensure the colorspace is properly adjusted by the driver for YUV and Bayer image formats. The subdev try_fmt helper is simplified. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> --- drivers/media/platform/exynos4-is/fimc-lite.c | 50 +++++++++++++------------ include/media/s5p_fimc.h | 2 + 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c index b4a0785..d1e869e 100644 --- a/drivers/media/platform/exynos4-is/fimc-lite.c +++ b/drivers/media/platform/exynos4-is/fimc-lite.c @@ -44,6 +44,7 @@ static const struct fimc_fmt fimc_lite_formats[] = { { .name = "YUV 4:2:2 packed, YCbYCr", .fourcc = V4L2_PIX_FMT_YUYV, + .colorspace = V4L2_COLORSPACE_JPEG, .depth = { 16 }, .color = FIMC_FMT_YCBYCR422, .memplanes = 1, @@ -52,6 +53,7 @@ static const struct fimc_fmt fimc_lite_formats[] = { }, { .name = "YUV 4:2:2 packed, CbYCrY", .fourcc = V4L2_PIX_FMT_UYVY, + .colorspace = V4L2_COLORSPACE_JPEG, .depth = { 16 }, .color = FIMC_FMT_CBYCRY422, .memplanes = 1, @@ -60,6 +62,7 @@ static const struct fimc_fmt fimc_lite_formats[] = { }, { .name = "YUV 4:2:2 packed, CrYCbY", .fourcc = V4L2_PIX_FMT_VYUY, + .colorspace = V4L2_COLORSPACE_JPEG, .depth = { 16 }, .color = FIMC_FMT_CRYCBY422, .memplanes = 1, @@ -68,6 +71,7 @@ static const struct fimc_fmt fimc_lite_formats[] = { }, { .name = "YUV 4:2:2 packed, YCrYCb", .fourcc = V4L2_PIX_FMT_YVYU, + .colorspace = V4L2_COLORSPACE_JPEG, .depth = { 16 }, .color = FIMC_FMT_YCRYCB422, .memplanes = 1, @@ -76,6 +80,7 @@ static const struct fimc_fmt fimc_lite_formats[] = { }, { .name = "RAW8 (GRBG)", .fourcc = V4L2_PIX_FMT_SGRBG8, + .colorspace = V4L2_COLORSPACE_SRGB, .depth = { 8 }, .color = FIMC_FMT_RAW8, .memplanes = 1, @@ -84,6 +89,7 @@ static const struct fimc_fmt fimc_lite_formats[] = { }, { .name = "RAW10 (GRBG)", .fourcc = V4L2_PIX_FMT_SGRBG10, + .colorspace = V4L2_COLORSPACE_SRGB, .depth = { 10 }, .color = FIMC_FMT_RAW10, .memplanes = 1, @@ -92,6 +98,7 @@ static const struct fimc_fmt fimc_lite_formats[] = { }, { .name = "RAW12 (GRBG)", .fourcc = V4L2_PIX_FMT_SGRBG12, + .colorspace = V4L2_COLORSPACE_SRGB, .depth = { 12 }, .color = FIMC_FMT_RAW12, .memplanes = 1, @@ -560,38 +567,35 @@ static const struct v4l2_file_operations fimc_lite_fops = { * Format and crop negotiation helpers */ -static const struct fimc_fmt *fimc_lite_try_format(struct fimc_lite *fimc, - u32 *width, u32 *height, - u32 *code, u32 *fourcc, int pad) +static const struct fimc_fmt *fimc_lite_subdev_try_fmt(struct fimc_lite *fimc, + struct v4l2_subdev_format *format) { struct flite_drvdata *dd = fimc->dd; + struct v4l2_mbus_framefmt *mf = &format->format; const struct fimc_fmt *fmt; unsigned int flags = 0; - if (pad == FLITE_SD_PAD_SINK) { - v4l_bound_align_image(width, 8, dd->max_width, - ffs(dd->out_width_align) - 1, - height, 0, dd->max_height, 0, 0); + if (format->pad == FLITE_SD_PAD_SINK) { + v4l_bound_align_image(&mf->width, 8, dd->max_width, + ffs(dd->out_width_align) - 1, + &mf->height, 0, dd->max_height, 0, 0); } else { - v4l_bound_align_image(width, 8, fimc->inp_frame.rect.width, - ffs(dd->out_width_align) - 1, - height, 0, fimc->inp_frame.rect.height, - 0, 0); + v4l_bound_align_image(&mf->width, 8, fimc->inp_frame.rect.width, + ffs(dd->out_width_align) - 1, + &mf->height, 0, fimc->inp_frame.rect.height, + 0, 0); flags = fimc->inp_frame.fmt->flags; } - fmt = fimc_lite_find_format(fourcc, code, flags, 0); + fmt = fimc_lite_find_format(NULL, &mf->code, flags, 0); if (WARN_ON(!fmt)) return NULL; - if (code) - *code = fmt->mbus_code; - if (fourcc) - *fourcc = fmt->fourcc; + mf->colorspace = fmt->colorspace; + mf->code = fmt->mbus_code; v4l2_dbg(1, debug, &fimc->subdev, "code: 0x%x, %dx%d\n", - code ? *code : 0, *width, *height); - + mf->code, mf->width, mf->height); return fmt; } @@ -682,7 +686,7 @@ static int fimc_lite_g_fmt_mplane(struct file *file, void *fh, pixm->width = frame->f_width; pixm->height = frame->f_height; pixm->field = V4L2_FIELD_NONE; - pixm->colorspace = V4L2_COLORSPACE_JPEG; + pixm->colorspace = fmt->colorspace; return 0; } @@ -725,7 +729,7 @@ static int fimc_lite_try_fmt(struct fimc_lite *fimc, fmt->depth[0]) / 8; pixm->num_planes = fmt->memplanes; pixm->pixelformat = fmt->fourcc; - pixm->colorspace = V4L2_COLORSPACE_JPEG; + pixm->colorspace = fmt->colorspace; pixm->field = V4L2_FIELD_NONE; return 0; } @@ -1057,9 +1061,9 @@ static int fimc_lite_subdev_get_fmt(struct v4l2_subdev *sd, fmt->format = *mf; return 0; } - mf->colorspace = V4L2_COLORSPACE_JPEG; mutex_lock(&fimc->lock); + mf->colorspace = f->fmt->colorspace; mf->code = f->fmt->mbus_code; if (fmt->pad == FLITE_SD_PAD_SINK) { @@ -1088,7 +1092,6 @@ static int fimc_lite_subdev_set_fmt(struct v4l2_subdev *sd, v4l2_dbg(1, debug, sd, "pad%d: code: 0x%x, %dx%d\n", fmt->pad, mf->code, mf->width, mf->height); - mf->colorspace = V4L2_COLORSPACE_JPEG; mutex_lock(&fimc->lock); if ((atomic_read(&fimc->out_path) == FIMC_IO_ISP && @@ -1099,8 +1102,7 @@ static int fimc_lite_subdev_set_fmt(struct v4l2_subdev *sd, return -EBUSY; } - ffmt = fimc_lite_try_format(fimc, &mf->width, &mf->height, - &mf->code, NULL, fmt->pad); + ffmt = fimc_lite_subdev_try_fmt(fimc, fmt); if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { struct v4l2_mbus_framefmt *src_fmt; diff --git a/include/media/s5p_fimc.h b/include/media/s5p_fimc.h index 0afadb6..b975c28 100644 --- a/include/media/s5p_fimc.h +++ b/include/media/s5p_fimc.h @@ -116,6 +116,7 @@ struct s5p_platform_fimc { * @color: the driver's private color format id * @memplanes: number of physically non-contiguous data planes * @colplanes: number of physically contiguous data planes + * @colorspace: v4l2 colorspace (V4L2_COLORSPACE_*) * @depth: per plane driver's private 'number of bits per pixel' * @mdataplanes: bitmask indicating meta data plane(s), (1 << plane_no) * @flags: flags indicating which operation mode format applies to @@ -127,6 +128,7 @@ struct fimc_fmt { u32 color; u16 memplanes; u16 colplanes; + u8 colorspace; u8 depth[FIMC_MAX_PLANES]; u16 mdataplanes; u16 flags; -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-06-21 18:23 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-06-21 13:00 [PATCH 3/6] exynos4-is: Fix format propagation on FIMC-IS-ISP subdev Sylwester Nawrocki 2013-06-21 13:00 ` [PATCH 4/6] exynos4-is: Set valid initial format on FIMC-IS-ISP subdev pads Sylwester Nawrocki 2013-06-21 13:00 ` [PATCH 5/6] exynos4-is: Set valid initial format on FIMC.n subdevs Sylwester Nawrocki 2013-06-21 18:22 ` Sylwester Nawrocki 2013-06-21 13:00 ` [PATCH 6/6] exynos4-is: Correct colorspace handling at FIMC-LITE Sylwester Nawrocki
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.