OSDN Git Service

[media] v4l: vsp1: Disable VYUY on Gen3
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Thu, 15 Sep 2016 19:08:09 +0000 (16:08 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Mon, 19 Sep 2016 18:02:22 +0000 (15:02 -0300)
The VYUY format isn't supported on Gen3 hardware, disable it.

Gen2 hardware supports VYUY in practice even though the documentation
doesn't advertise it, so keep it for Gen2 devices.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/platform/vsp1/vsp1_drm.c
drivers/media/platform/vsp1/vsp1_pipe.c
drivers/media/platform/vsp1/vsp1_pipe.h
drivers/media/platform/vsp1/vsp1_video.c

index 8322869..54795b5 100644 (file)
@@ -286,7 +286,7 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index,
        /* Store the format, stride, memory buffer address, crop and compose
         * rectangles and Z-order position and for the input.
         */
-       fmtinfo = vsp1_get_format_info(cfg->pixelformat);
+       fmtinfo = vsp1_get_format_info(vsp1, cfg->pixelformat);
        if (!fmtinfo) {
                dev_dbg(vsp1->dev, "Unsupport pixel format %08x for RPF\n",
                        cfg->pixelformat);
index 474de82..78b6184 100644 (file)
@@ -138,15 +138,21 @@ static const struct vsp1_format_info vsp1_video_formats[] = {
 
 /*
  * vsp1_get_format_info - Retrieve format information for a 4CC
+ * @vsp1: the VSP1 device
  * @fourcc: the format 4CC
  *
  * Return a pointer to the format information structure corresponding to the
  * given V4L2 format 4CC, or NULL if no corresponding format can be found.
  */
-const struct vsp1_format_info *vsp1_get_format_info(u32 fourcc)
+const struct vsp1_format_info *vsp1_get_format_info(struct vsp1_device *vsp1,
+                                                   u32 fourcc)
 {
        unsigned int i;
 
+       /* Special case, the VYUY format is supported on Gen2 only. */
+       if (vsp1->info->gen != 2 && fourcc == V4L2_PIX_FMT_VYUY)
+               return NULL;
+
        for (i = 0; i < ARRAY_SIZE(vsp1_video_formats); ++i) {
                const struct vsp1_format_info *info = &vsp1_video_formats[i];
 
index f15b697..ac4ad26 100644 (file)
@@ -130,6 +130,7 @@ void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe,
 void vsp1_pipelines_suspend(struct vsp1_device *vsp1);
 void vsp1_pipelines_resume(struct vsp1_device *vsp1);
 
-const struct vsp1_format_info *vsp1_get_format_info(u32 fourcc);
+const struct vsp1_format_info *vsp1_get_format_info(struct vsp1_device *vsp1,
+                                                   u32 fourcc);
 
 #endif /* __VSP1_PIPE_H__ */
index 15d08cb..e773d3d 100644 (file)
@@ -117,9 +117,9 @@ static int __vsp1_video_try_format(struct vsp1_video *video,
        /* Retrieve format information and select the default format if the
         * requested format isn't supported.
         */
-       info = vsp1_get_format_info(pix->pixelformat);
+       info = vsp1_get_format_info(video->vsp1, pix->pixelformat);
        if (info == NULL)
-               info = vsp1_get_format_info(VSP1_VIDEO_DEF_FORMAT);
+               info = vsp1_get_format_info(video->vsp1, VSP1_VIDEO_DEF_FORMAT);
 
        pix->pixelformat = info->fourcc;
        pix->colorspace = V4L2_COLORSPACE_SRGB;