Re: [RFC 4/5] rcar-vin: Report the completeness of the media graph

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Niklas,

Thank you for the patch.

On Wed, Mar 18, 2020 at 10:30:50PM +0100, Niklas Söderlund wrote:
> Implement the graph_complete callback and report if the media graph is
> complete or not.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx>
> ---
>  drivers/media/platform/rcar-vin/rcar-core.c | 13 +++++++++++++
>  drivers/media/platform/rcar-vin/rcar-vin.h  |  4 ++++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c
> index 7440c8965d27e64f..21ce3de8168c3224 100644
> --- a/drivers/media/platform/rcar-vin/rcar-core.c
> +++ b/drivers/media/platform/rcar-vin/rcar-core.c
> @@ -221,8 +221,16 @@ static int rvin_group_link_notify(struct media_link *link, u32 flags,
>  	return ret;
>  }
>  
> +static bool rvin_group_graph_complete(struct media_device *mdev)
> +{
> +	struct rvin_group *group = container_of(mdev, struct rvin_group, mdev);
> +
> +	return group->complete;
> +}
> +
>  static const struct media_device_ops rvin_media_ops = {
>  	.link_notify = rvin_group_link_notify,
> +	.graph_complete = rvin_group_graph_complete,
>  };
>  
>  /* -----------------------------------------------------------------------------
> @@ -735,6 +743,9 @@ static int rvin_group_notify_complete(struct v4l2_async_notifier *notifier)
>  			break;
>  		}
>  	}
> +
> +	vin->group->complete = true;

Going from incomplete to complete is fine...

> +
>  	mutex_unlock(&vin->group->lock);
>  
>  	return ret;
> @@ -761,6 +772,8 @@ static void rvin_group_notify_unbind(struct v4l2_async_notifier *notifier,
>  		break;
>  	}
>  
> +	vin->group->complete = false;
> +

... but the other way around is more problematic. We need to define the
exact semantics for userspace, and how it should handle this event.

>  	mutex_unlock(&vin->group->lock);
>  }
>  
> diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h b/drivers/media/platform/rcar-vin/rcar-vin.h
> index c19d077ce1cb4f4b..ff04adbb969b07de 100644
> --- a/drivers/media/platform/rcar-vin/rcar-vin.h
> +++ b/drivers/media/platform/rcar-vin/rcar-vin.h
> @@ -263,6 +263,8 @@ struct rvin_dev {
>   * @vin:		VIN instances which are part of the group
>   * @csi:		array of pairs of fwnode and subdev pointers
>   *			to all CSI-2 subdevices.
> + * @complete:		True if all devices of the group are in the media graph,
> + *			false otherwise.
>   */
>  struct rvin_group {
>  	struct kref refcount;
> @@ -278,6 +280,8 @@ struct rvin_group {
>  		struct fwnode_handle *fwnode;
>  		struct v4l2_subdev *subdev;
>  	} csi[RVIN_CSI_MAX];
> +
> +	bool complete;
>  };
>  
>  int rvin_dma_register(struct rvin_dev *vin, int irq);

-- 
Regards,

Laurent Pinchart



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux