diff mbox series

[RFC,2/5] media-device: Add a graph_complete callback to struct media_device_ops

Message ID 20200318213051.3200981-3-niklas.soderlund+renesas@ragnatech.se (mailing list archive)
State New, archived
Headers show
Series media-device: Report if graph is complete or not | expand

Commit Message

Niklas Söderlund March 18, 2020, 9:30 p.m. UTC
Add a new graph_complete operation to struct media_device_ops. The
callback is optional to implement. If it's implemented it shall return
the status about the media graphs completes. If all entities that the
media device could contain is registered in the graph it shall return
true, otherwise false.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 include/media/media-device.h | 3 +++
 1 file changed, 3 insertions(+)

Comments

Laurent Pinchart March 19, 2020, 2:40 a.m. UTC | #1
Hi Niklas,

Thank you for the patch.

On Wed, Mar 18, 2020 at 10:30:48PM +0100, Niklas Söderlund wrote:
> Add a new graph_complete operation to struct media_device_ops. The
> callback is optional to implement. If it's implemented it shall return
> the status about the media graphs completes. If all entities that the
> media device could contain is registered in the graph it shall return
> true, otherwise false.

I'd rather do it the other way around, implement a function that drivers
can call to signal completion. It will store the flag internally in
media_device, and will also be able to send an event to notify
userspace (once we get MC events).

> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> ---
>  include/media/media-device.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/include/media/media-device.h b/include/media/media-device.h
> index fa089543072052cf..f637ad2eee38f456 100644
> --- a/include/media/media-device.h
> +++ b/include/media/media-device.h
> @@ -61,6 +61,8 @@ struct media_entity_notify {
>   *	       request (and thus the buffer) must be available to the driver.
>   *	       And once a buffer is queued, then the driver can complete
>   *	       or delete objects from the request before req_queue exits.
> + * @graph_complete: Check if the media device graph is complete and all entries
> + *		    have been added to the graph.
>   */
>  struct media_device_ops {
>  	int (*link_notify)(struct media_link *link, u32 flags,
> @@ -69,6 +71,7 @@ struct media_device_ops {
>  	void (*req_free)(struct media_request *req);
>  	int (*req_validate)(struct media_request *req);
>  	void (*req_queue)(struct media_request *req);
> +	bool (*graph_complete)(struct media_device *mdev);
>  };
>  
>  /**
diff mbox series

Patch

diff --git a/include/media/media-device.h b/include/media/media-device.h
index fa089543072052cf..f637ad2eee38f456 100644
--- a/include/media/media-device.h
+++ b/include/media/media-device.h
@@ -61,6 +61,8 @@  struct media_entity_notify {
  *	       request (and thus the buffer) must be available to the driver.
  *	       And once a buffer is queued, then the driver can complete
  *	       or delete objects from the request before req_queue exits.
+ * @graph_complete: Check if the media device graph is complete and all entries
+ *		    have been added to the graph.
  */
 struct media_device_ops {
 	int (*link_notify)(struct media_link *link, u32 flags,
@@ -69,6 +71,7 @@  struct media_device_ops {
 	void (*req_free)(struct media_request *req);
 	int (*req_validate)(struct media_request *req);
 	void (*req_queue)(struct media_request *req);
+	bool (*graph_complete)(struct media_device *mdev);
 };
 
 /**