Message ID | 1459295387-12090-1-git-send-email-helen.koike@collabora.co.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Helen, On Tue, Mar 29, 2016 at 08:49:47PM -0300, Helen Mae Koike Fornazier wrote: > According to the V4L2 API, the VIDIOC_STREAMON ioctl should return EPIPE > if there is a format mismatch in the pipeline configuration. > > As the .vidioc_streamon in the v4l2_ioctl_ops usually forwards the error > caused by the v4l2_subdev_link_validate_default (if it is in use), it > should return -EPIPE when it detect the mismatch. > > When an entity is connected to a non enabled link, > media_entity_pipeline_start should return -ENOLINK, as the link does not > exist. > > Signed-off-by: Helen Mae Koike Fornazier <helen.koike@collabora.co.uk> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> While at it, could you change the documentation of VIDIOC_STREAMON as well? It documents EPIPE but no ENOLINK. I think it could be e.g. "The driver implements Media controller interface and the pipeline link configuration is invalid."
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index c53c1d5..d8a2299 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c @@ -445,7 +445,7 @@ __must_check int __media_entity_pipeline_start(struct media_entity *entity, bitmap_or(active, active, has_no_links, entity->num_pads); if (!bitmap_full(active, entity->num_pads)) { - ret = -EPIPE; + ret = -ENOLINK; dev_dbg(entity->graph_obj.mdev->dev, "\"%s\":%u must be connected by an enabled link\n", entity->name, diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index d630838..918e79d 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -508,7 +508,7 @@ int v4l2_subdev_link_validate_default(struct v4l2_subdev *sd, if (source_fmt->format.width != sink_fmt->format.width || source_fmt->format.height != sink_fmt->format.height || source_fmt->format.code != sink_fmt->format.code) - return -EINVAL; + return -EPIPE; /* The field order must match, or the sink field order must be NONE * to support interlaced hardware connected to bridges that support @@ -516,7 +516,7 @@ int v4l2_subdev_link_validate_default(struct v4l2_subdev *sd, */ if (source_fmt->format.field != sink_fmt->format.field && sink_fmt->format.field != V4L2_FIELD_NONE) - return -EINVAL; + return -EPIPE; return 0; }
According to the V4L2 API, the VIDIOC_STREAMON ioctl should return EPIPE if there is a format mismatch in the pipeline configuration. As the .vidioc_streamon in the v4l2_ioctl_ops usually forwards the error caused by the v4l2_subdev_link_validate_default (if it is in use), it should return -EPIPE when it detect the mismatch. When an entity is connected to a non enabled link, media_entity_pipeline_start should return -ENOLINK, as the link does not exist. Signed-off-by: Helen Mae Koike Fornazier <helen.koike@collabora.co.uk> --- The patch is based on 'media/master' branch and available at https://github.com/helen-fornazier/opw-staging media/devel Changes since v1: * Commit message, it was "v4l2-subdev: return -EPIPE instead of -EINVAL in link validate default" * EPIPE to ENOLINK in the __media_entity_pipeline_start drivers/media/media-entity.c | 2 +- drivers/media/v4l2-core/v4l2-subdev.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)