diff options
author | Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> | 2020-04-17 17:09:29 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-04-29 12:02:30 +0200 |
commit | 9a42a5ff3daccc37ae4dbcfb6ce5c5d95419740b (patch) | |
tree | beebc31fa5bbad98b908c63c4a5e51b7f053185c /drivers/media/test-drivers/vimc | |
parent | media: si2157: ensure wait_status is initialized (diff) | |
download | linux-9a42a5ff3daccc37ae4dbcfb6ce5c5d95419740b.tar.xz linux-9a42a5ff3daccc37ae4dbcfb6ce5c5d95419740b.zip |
media: vimc: cap: Report a colorspace
The colorspace reported by a video nodes should not be
V4L2_COLORSPACE_DEFAULT. Instead a default colorspace should be picked
by the driver if V4L2_COLORSPACE_DEFAULT is given by userspace to
{G,S,TRY}_FMT.
The colorspace V4L2_COLORSPACE_SRGB is arbitrary chosen as the vimc
default format to report as it's used for most webcams.
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/test-drivers/vimc')
-rw-r--r-- | drivers/media/test-drivers/vimc/vimc-capture.c | 5 | ||||
-rw-r--r-- | drivers/media/test-drivers/vimc/vimc-debayer.c | 2 | ||||
-rw-r--r-- | drivers/media/test-drivers/vimc/vimc-scaler.c | 2 | ||||
-rw-r--r-- | drivers/media/test-drivers/vimc/vimc-sensor.c | 2 |
4 files changed, 7 insertions, 4 deletions
diff --git a/drivers/media/test-drivers/vimc/vimc-capture.c b/drivers/media/test-drivers/vimc/vimc-capture.c index 5315c201314c..20c2f5e281bc 100644 --- a/drivers/media/test-drivers/vimc/vimc-capture.c +++ b/drivers/media/test-drivers/vimc/vimc-capture.c @@ -37,7 +37,7 @@ static const struct v4l2_pix_format fmt_default = { .height = 480, .pixelformat = V4L2_PIX_FMT_RGB24, .field = V4L2_FIELD_NONE, - .colorspace = V4L2_COLORSPACE_DEFAULT, + .colorspace = V4L2_COLORSPACE_SRGB, }; struct vimc_cap_buffer { @@ -107,6 +107,9 @@ static int vimc_cap_try_fmt_vid_cap(struct file *file, void *priv, vimc_colorimetry_clamp(format); + if (format->colorspace == V4L2_COLORSPACE_DEFAULT) + format->colorspace = fmt_default.colorspace; + return 0; } diff --git a/drivers/media/test-drivers/vimc/vimc-debayer.c b/drivers/media/test-drivers/vimc/vimc-debayer.c index d10aee9f84c4..c4765ebaeec2 100644 --- a/drivers/media/test-drivers/vimc/vimc-debayer.c +++ b/drivers/media/test-drivers/vimc/vimc-debayer.c @@ -48,7 +48,7 @@ static const struct v4l2_mbus_framefmt sink_fmt_default = { .height = 480, .code = MEDIA_BUS_FMT_SRGGB8_1X8, .field = V4L2_FIELD_NONE, - .colorspace = V4L2_COLORSPACE_DEFAULT, + .colorspace = V4L2_COLORSPACE_SRGB, }; static const struct vimc_deb_pix_map vimc_deb_pix_map_list[] = { diff --git a/drivers/media/test-drivers/vimc/vimc-scaler.c b/drivers/media/test-drivers/vimc/vimc-scaler.c index 465b906b7497..2231e72b24e2 100644 --- a/drivers/media/test-drivers/vimc/vimc-scaler.c +++ b/drivers/media/test-drivers/vimc/vimc-scaler.c @@ -42,7 +42,7 @@ static const struct v4l2_mbus_framefmt sink_fmt_default = { .height = VIMC_SCA_FMT_HEIGHT_DEFAULT, .code = MEDIA_BUS_FMT_RGB888_1X24, .field = V4L2_FIELD_NONE, - .colorspace = V4L2_COLORSPACE_DEFAULT, + .colorspace = V4L2_COLORSPACE_SRGB, }; static const struct v4l2_rect crop_rect_default = { diff --git a/drivers/media/test-drivers/vimc/vimc-sensor.c b/drivers/media/test-drivers/vimc/vimc-sensor.c index 228120b3a6dd..56e8ec14be46 100644 --- a/drivers/media/test-drivers/vimc/vimc-sensor.c +++ b/drivers/media/test-drivers/vimc/vimc-sensor.c @@ -30,7 +30,7 @@ static const struct v4l2_mbus_framefmt fmt_default = { .height = 480, .code = MEDIA_BUS_FMT_RGB888_1X24, .field = V4L2_FIELD_NONE, - .colorspace = V4L2_COLORSPACE_DEFAULT, + .colorspace = V4L2_COLORSPACE_SRGB, }; static int vimc_sen_init_cfg(struct v4l2_subdev *sd, |