Re: [PATCH v12 26/30] media: v4l2-subdev: Add v4l2_subdev_state_xlate_streams() helper

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

 



Hi,

On 01/08/2022 15:37, Sakari Ailus wrote:

+u64 v4l2_subdev_state_xlate_streams(const struct v4l2_subdev_state *state,
+				    u32 pad0, u32 pad1, u64 *streams);
+
  /**
   * enum v4l2_subdev_routing_restriction - Subdevice internal routing restrictions
   *

How and where is this meant to be used?

I use it in subdev driver's .enable_streams(). E.g.:

static int ub953_enable_streams(struct v4l2_subdev *sd,
				struct v4l2_subdev_state *state, u32 pad,
				u64 streams_mask)
{
	struct ub953_data *priv = sd_to_ub953(sd);
	struct media_pad *remote_pad;
	u64 sink_streams;
	int ret;

	if (streams_mask & priv->enabled_source_streams)
		return -EALREADY;

	sink_streams = v4l2_subdev_state_xlate_streams(
		state, UB953_PAD_SOURCE, UB953_PAD_SINK, &streams_mask);

	remote_pad = media_entity_remote_pad(&priv->pads[UB953_PAD_SINK]);

	ret = v4l2_subdev_enable_streams(priv->source_sd, remote_pad->index,
					 sink_streams);
	if (ret)
		return ret;

	priv->enabled_source_streams |= streams_mask;

	return 0;
}

The driver gets the source pad & stream mask, and must get the
sink pad & stream mask so that it can then call enable_streams
on its source subdev.

 Tomi



[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