media: atomisp: report colorspace information
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sat, 30 Oct 2021 11:01:30 +0000 (12:01 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 15 Nov 2021 08:11:42 +0000 (08:11 +0000)
While different sensors could have different colorspaces, the
colorspace V4L2 support didn't exist by the time atomisp driver
was written. So, the sensors won't have any data about that.

So, let's report what Asus T101HA uses (ov2680 sensor).

It may require further changes, if other sensors used on this
driver have different colorspaces.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/atomisp/pci/atomisp_cmd.c
drivers/staging/media/atomisp/pci/atomisp_ioctl.c

index 6b308c81ef772ea29281eac97a1a67af75ef72e9..ff8640314f651275903a58f593fce1643cbf16e3 100644 (file)
@@ -4916,6 +4916,13 @@ int atomisp_try_fmt(struct video_device *vdev, struct v4l2_pix_format *f,
        }
 
        f->pixelformat = fmt->pixelformat;
+       /*
+        * FIXME: do we need to setup this differently, depending on the
+        * sensor or the pipeline?
+        */
+       f->colorspace = V4L2_COLORSPACE_REC709;
+       f->ycbcr_enc = V4L2_YCBCR_ENC_709;
+       f->xfer_func = V4L2_XFER_FUNC_709;
 
        /*
         * If the format is jpeg or custom RAW, then the width and height will
@@ -6027,6 +6034,14 @@ done:
        pipe->pix.width = f->fmt.pix.width;
        pipe->pix.height = f->fmt.pix.height;
        pipe->pix.pixelformat = f->fmt.pix.pixelformat;
+       /*
+        * FIXME: do we need to setup this differently, depending on the
+        * sensor or the pipeline?
+        */
+       pipe->pix.colorspace = V4L2_COLORSPACE_REC709;
+       pipe->pix.ycbcr_enc = V4L2_YCBCR_ENC_709;
+       pipe->pix.xfer_func = V4L2_XFER_FUNC_709;
+
        if (format_bridge->planar) {
                pipe->pix.bytesperline = output_info.padded_width;
                pipe->pix.sizeimage = PAGE_ALIGN(f->fmt.pix.height *
index 37542ea17a387a9606dcbbc8a599ba7c0f5e20ac..f082d7a67875cccdea07fa74f9022780c18aa640 100644 (file)
@@ -884,6 +884,14 @@ static int atomisp_g_fmt_cap(struct file *file, void *fh,
        f->fmt.pix.bytesperline = (f->fmt.pix.width * depth) >> 3;
        f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline;
 
+       /*
+        * FIXME: do we need to setup this differently, depending on the
+        * sensor or the pipeline?
+        */
+       f->fmt.pix.colorspace = V4L2_COLORSPACE_REC709;
+       f->fmt.pix.ycbcr_enc = V4L2_YCBCR_ENC_709;
+       f->fmt.pix.xfer_func = V4L2_XFER_FUNC_709;
+
        return 0;
 }