aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2013-06-20 09:49:09 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-06-28 14:33:27 -0400
commit1c26190a8d492adadac4711fe5762d46204b18b0 (patch)
tree6d3b7b51c87f419568893b5e4ff3a19caf73764d /drivers/media
parent3ad8624524e5cae532381461e929bee649a92994 (diff)
[media] exynos4-is: Correct colorspace handling at FIMC-LITE
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> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/exynos4-is/fimc-lite.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c
index 4fa2e05186bd..08fbfedea90f 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[] = {
44 { 44 {
45 .name = "YUV 4:2:2 packed, YCbYCr", 45 .name = "YUV 4:2:2 packed, YCbYCr",
46 .fourcc = V4L2_PIX_FMT_YUYV, 46 .fourcc = V4L2_PIX_FMT_YUYV,
47 .colorspace = V4L2_COLORSPACE_JPEG,
47 .depth = { 16 }, 48 .depth = { 16 },
48 .color = FIMC_FMT_YCBYCR422, 49 .color = FIMC_FMT_YCBYCR422,
49 .memplanes = 1, 50 .memplanes = 1,
@@ -52,6 +53,7 @@ static const struct fimc_fmt fimc_lite_formats[] = {
52 }, { 53 }, {
53 .name = "YUV 4:2:2 packed, CbYCrY", 54 .name = "YUV 4:2:2 packed, CbYCrY",
54 .fourcc = V4L2_PIX_FMT_UYVY, 55 .fourcc = V4L2_PIX_FMT_UYVY,
56 .colorspace = V4L2_COLORSPACE_JPEG,
55 .depth = { 16 }, 57 .depth = { 16 },
56 .color = FIMC_FMT_CBYCRY422, 58 .color = FIMC_FMT_CBYCRY422,
57 .memplanes = 1, 59 .memplanes = 1,
@@ -60,6 +62,7 @@ static const struct fimc_fmt fimc_lite_formats[] = {
60 }, { 62 }, {
61 .name = "YUV 4:2:2 packed, CrYCbY", 63 .name = "YUV 4:2:2 packed, CrYCbY",
62 .fourcc = V4L2_PIX_FMT_VYUY, 64 .fourcc = V4L2_PIX_FMT_VYUY,
65 .colorspace = V4L2_COLORSPACE_JPEG,
63 .depth = { 16 }, 66 .depth = { 16 },
64 .color = FIMC_FMT_CRYCBY422, 67 .color = FIMC_FMT_CRYCBY422,
65 .memplanes = 1, 68 .memplanes = 1,
@@ -68,6 +71,7 @@ static const struct fimc_fmt fimc_lite_formats[] = {
68 }, { 71 }, {
69 .name = "YUV 4:2:2 packed, YCrYCb", 72 .name = "YUV 4:2:2 packed, YCrYCb",
70 .fourcc = V4L2_PIX_FMT_YVYU, 73 .fourcc = V4L2_PIX_FMT_YVYU,
74 .colorspace = V4L2_COLORSPACE_JPEG,
71 .depth = { 16 }, 75 .depth = { 16 },
72 .color = FIMC_FMT_YCRYCB422, 76 .color = FIMC_FMT_YCRYCB422,
73 .memplanes = 1, 77 .memplanes = 1,
@@ -76,6 +80,7 @@ static const struct fimc_fmt fimc_lite_formats[] = {
76 }, { 80 }, {
77 .name = "RAW8 (GRBG)", 81 .name = "RAW8 (GRBG)",
78 .fourcc = V4L2_PIX_FMT_SGRBG8, 82 .fourcc = V4L2_PIX_FMT_SGRBG8,
83 .colorspace = V4L2_COLORSPACE_SRGB,
79 .depth = { 8 }, 84 .depth = { 8 },
80 .color = FIMC_FMT_RAW8, 85 .color = FIMC_FMT_RAW8,
81 .memplanes = 1, 86 .memplanes = 1,
@@ -84,6 +89,7 @@ static const struct fimc_fmt fimc_lite_formats[] = {
84 }, { 89 }, {
85 .name = "RAW10 (GRBG)", 90 .name = "RAW10 (GRBG)",
86 .fourcc = V4L2_PIX_FMT_SGRBG10, 91 .fourcc = V4L2_PIX_FMT_SGRBG10,
92 .colorspace = V4L2_COLORSPACE_SRGB,
87 .depth = { 10 }, 93 .depth = { 10 },
88 .color = FIMC_FMT_RAW10, 94 .color = FIMC_FMT_RAW10,
89 .memplanes = 1, 95 .memplanes = 1,
@@ -92,6 +98,7 @@ static const struct fimc_fmt fimc_lite_formats[] = {
92 }, { 98 }, {
93 .name = "RAW12 (GRBG)", 99 .name = "RAW12 (GRBG)",
94 .fourcc = V4L2_PIX_FMT_SGRBG12, 100 .fourcc = V4L2_PIX_FMT_SGRBG12,
101 .colorspace = V4L2_COLORSPACE_SRGB,
95 .depth = { 12 }, 102 .depth = { 12 },
96 .color = FIMC_FMT_RAW12, 103 .color = FIMC_FMT_RAW12,
97 .memplanes = 1, 104 .memplanes = 1,
@@ -577,6 +584,7 @@ static const struct fimc_fmt *fimc_lite_subdev_try_fmt(struct fimc_lite *fimc,
577 if (WARN_ON(!fmt)) 584 if (WARN_ON(!fmt))
578 return NULL; 585 return NULL;
579 586
587 mf->colorspace = fmt->colorspace;
580 mf->code = fmt->mbus_code; 588 mf->code = fmt->mbus_code;
581 } else { 589 } else {
582 struct flite_frame *sink = &fimc->inp_frame; 590 struct flite_frame *sink = &fimc->inp_frame;
@@ -588,11 +596,13 @@ static const struct fimc_fmt *fimc_lite_subdev_try_fmt(struct fimc_lite *fimc,
588 FLITE_SD_PAD_SINK); 596 FLITE_SD_PAD_SINK);
589 597
590 mf->code = sink_fmt->code; 598 mf->code = sink_fmt->code;
599 mf->colorspace = sink_fmt->colorspace;
591 600
592 rect = v4l2_subdev_get_try_crop(fh, 601 rect = v4l2_subdev_get_try_crop(fh,
593 FLITE_SD_PAD_SINK); 602 FLITE_SD_PAD_SINK);
594 } else { 603 } else {
595 mf->code = sink->fmt->mbus_code; 604 mf->code = sink->fmt->mbus_code;
605 mf->colorspace = sink->fmt->colorspace;
596 rect = &sink->rect; 606 rect = &sink->rect;
597 } 607 }
598 608
@@ -696,7 +706,7 @@ static int fimc_lite_g_fmt_mplane(struct file *file, void *fh,
696 pixm->width = frame->f_width; 706 pixm->width = frame->f_width;
697 pixm->height = frame->f_height; 707 pixm->height = frame->f_height;
698 pixm->field = V4L2_FIELD_NONE; 708 pixm->field = V4L2_FIELD_NONE;
699 pixm->colorspace = V4L2_COLORSPACE_JPEG; 709 pixm->colorspace = fmt->colorspace;
700 return 0; 710 return 0;
701} 711}
702 712
@@ -739,7 +749,7 @@ static int fimc_lite_try_fmt(struct fimc_lite *fimc,
739 fmt->depth[0]) / 8; 749 fmt->depth[0]) / 8;
740 pixm->num_planes = fmt->memplanes; 750 pixm->num_planes = fmt->memplanes;
741 pixm->pixelformat = fmt->fourcc; 751 pixm->pixelformat = fmt->fourcc;
742 pixm->colorspace = V4L2_COLORSPACE_JPEG; 752 pixm->colorspace = fmt->colorspace;
743 pixm->field = V4L2_FIELD_NONE; 753 pixm->field = V4L2_FIELD_NONE;
744 return 0; 754 return 0;
745} 755}
@@ -1071,9 +1081,9 @@ static int fimc_lite_subdev_get_fmt(struct v4l2_subdev *sd,
1071 fmt->format = *mf; 1081 fmt->format = *mf;
1072 return 0; 1082 return 0;
1073 } 1083 }
1074 mf->colorspace = V4L2_COLORSPACE_JPEG;
1075 1084
1076 mutex_lock(&fimc->lock); 1085 mutex_lock(&fimc->lock);
1086 mf->colorspace = f->fmt->colorspace;
1077 mf->code = f->fmt->mbus_code; 1087 mf->code = f->fmt->mbus_code;
1078 1088
1079 if (fmt->pad == FLITE_SD_PAD_SINK) { 1089 if (fmt->pad == FLITE_SD_PAD_SINK) {
@@ -1102,7 +1112,6 @@ static int fimc_lite_subdev_set_fmt(struct v4l2_subdev *sd,
1102 v4l2_dbg(1, debug, sd, "pad%d: code: 0x%x, %dx%d\n", 1112 v4l2_dbg(1, debug, sd, "pad%d: code: 0x%x, %dx%d\n",
1103 fmt->pad, mf->code, mf->width, mf->height); 1113 fmt->pad, mf->code, mf->width, mf->height);
1104 1114
1105 mf->colorspace = V4L2_COLORSPACE_JPEG;
1106 mutex_lock(&fimc->lock); 1115 mutex_lock(&fimc->lock);
1107 1116
1108 if ((atomic_read(&fimc->out_path) == FIMC_IO_ISP && 1117 if ((atomic_read(&fimc->out_path) == FIMC_IO_ISP &&