File Index
Files and directories
Sign in
FILE

vsp1_pipe.h

File preview with syntax highlighting.

linux-6.19.14/drivers/media/platform/renesas/vsp1/vsp1_pipe.h C
  1/* SPDX-License-Identifier: GPL-2.0+ */
  2/*
  3 * vsp1_pipe.h  --  R-Car VSP1 Pipeline
  4 *
  5 * Copyright (C) 2013-2015 Renesas Electronics Corporation
  6 *
  7 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
  8 */
  9#ifndef __VSP1_PIPE_H__
 10#define __VSP1_PIPE_H__
 11
 12#include <linux/dynamic_debug.h>
 13#include <linux/kref.h>
 14#include <linux/list.h>
 15#include <linux/spinlock.h>
 16#include <linux/wait.h>
 17
 18#include <media/media-entity.h>
 19
 20struct vsp1_dl_list;
 21struct vsp1_rwpf;
 22
 23/*
 24 * struct vsp1_format_info - VSP1 video format description
 25 * @fourcc: V4L2 pixel format FCC identifier
 26 * @mbus: media bus format code
 27 * @hwfmt: VSP1 hardware format
 28 * @swap: swap register control
 29 * @planes: number of planes
 30 * @bpp: bits per pixel
 31 * @swap_yc: the Y and C components are swapped (Y comes before C)
 32 * @swap_uv: the U and V components are swapped (V comes before U)
 33 * @hsub: horizontal subsampling factor
 34 * @vsub: vertical subsampling factor
 35 * @alpha: has an alpha channel
 36 */
 37struct vsp1_format_info {
 38	u32 fourcc;
 39	unsigned int mbus;
 40	unsigned int hwfmt;
 41	unsigned int swap;
 42	unsigned int planes;
 43	unsigned int bpp[3];
 44	bool swap_yc;
 45	bool swap_uv;
 46	unsigned int hsub;
 47	unsigned int vsub;
 48	bool alpha;
 49};
 50
 51enum vsp1_pipeline_state {
 52	VSP1_PIPELINE_STOPPED,
 53	VSP1_PIPELINE_RUNNING,
 54	VSP1_PIPELINE_STOPPING,
 55};
 56
 57/*
 58 * struct vsp1_partition - A description of a slice for the partition algorithm
 59 * @rpf: The RPF partition window configuration
 60 * @uds_sink: The UDS input partition window configuration
 61 * @uds_source: The UDS output partition window configuration
 62 * @sru: The SRU partition window configuration
 63 * @wpf: The WPF partition window configuration
 64 */
 65struct vsp1_partition {
 66	struct v4l2_rect rpf[VSP1_MAX_RPF];
 67	struct v4l2_rect uds_sink;
 68	struct v4l2_rect uds_source;
 69	struct v4l2_rect sru;
 70	struct v4l2_rect wpf;
 71};
 72
 73/*
 74 * struct vsp1_pipeline - A VSP1 hardware pipeline
 75 * @pipe: the media pipeline
 76 * @irqlock: protects the pipeline state
 77 * @state: current state
 78 * @wq: wait queue to wait for state change completion
 79 * @frame_end: frame end interrupt handler
 80 * @lock: protects the pipeline use count and stream count
 81 * @kref: pipeline reference count
 82 * @stream_count: number of streaming video nodes
 83 * @buffers_ready: bitmask of RPFs and WPFs with at least one buffer available
 84 * @sequence: frame sequence number
 85 * @num_inputs: number of RPFs
 86 * @inputs: array of RPFs in the pipeline (indexed by RPF index)
 87 * @output: WPF at the output of the pipeline
 88 * @brx: BRx entity, if present
 89 * @hgo: HGO entity, if present
 90 * @hgt: HGT entity, if present
 91 * @lif: LIF entity, if present
 92 * @uds: UDS entity, if present
 93 * @uds_input: entity at the input of the UDS, if the UDS is present
 94 * @entities: list of entities in the pipeline
 95 * @stream_config: cached stream configuration for video pipelines
 96 * @configured: when false the @stream_config shall be written to the hardware
 97 * @interlaced: True when the pipeline is configured in interlaced mode
 98 * @partitions: The number of partitions used to process one frame
 99 * @part_table: The pre-calculated partitions used by the pipeline
100 */
101struct vsp1_pipeline {
102	struct media_pipeline pipe;
103
104	spinlock_t irqlock;
105	enum vsp1_pipeline_state state;
106	wait_queue_head_t wq;
107
108	void (*frame_end)(struct vsp1_pipeline *pipe, unsigned int completion);
109
110	struct mutex lock;
111	struct kref kref;
112	unsigned int stream_count;
113	unsigned int buffers_ready;
114	unsigned int sequence;
115
116	unsigned int num_inputs;
117	struct vsp1_rwpf *inputs[VSP1_MAX_RPF];
118	struct vsp1_rwpf *output;
119	struct vsp1_entity *brx;
120	struct vsp1_entity *hgo;
121	struct vsp1_entity *hgt;
122	struct vsp1_entity *iif;
123	struct vsp1_entity *lif;
124	struct vsp1_entity *uds;
125	struct vsp1_entity *uds_input;
126
127	/*
128	 * The order of this list must be identical to the order of the entities
129	 * in the pipeline, as it is assumed by the partition algorithm that we
130	 * can walk this list in sequence.
131	 */
132	struct list_head entities;
133
134	struct vsp1_dl_body *stream_config;
135	bool configured;
136	bool interlaced;
137
138	unsigned int partitions;
139	struct vsp1_partition *part_table;
140
141	u32 underrun_count;
142};
143
144void vsp1_pipeline_reset(struct vsp1_pipeline *pipe);
145void vsp1_pipeline_init(struct vsp1_pipeline *pipe);
146
147void __vsp1_pipeline_dump(struct _ddebug *, struct vsp1_pipeline *pipe,
148			  const char *msg);
149
150#if defined(CONFIG_DYNAMIC_DEBUG) || \
151	(defined(CONFIG_DYNAMIC_DEBUG_CORE) && defined(DYNAMIC_DEBUG_MODULE))
152#define vsp1_pipeline_dump(pipe, msg)			\
153	_dynamic_func_call("vsp1_pipeline_dump()", __vsp1_pipeline_dump, pipe, msg)
154#elif defined(DEBUG)
155#define vsp1_pipeline_dump(pipe, msg)			\
156	__vsp1_pipeline_dump(NULL, pipe, msg)
157#else
158#define vsp1_pipeline_dump(pipe, msg)			\
159({							\
160	if (0)						\
161		__vsp1_pipeline_dump(NULL, pipe, msg);	\
162})
163#endif
164
165void vsp1_pipeline_run(struct vsp1_pipeline *pipe);
166bool vsp1_pipeline_stopped(struct vsp1_pipeline *pipe);
167int vsp1_pipeline_stop(struct vsp1_pipeline *pipe);
168bool vsp1_pipeline_ready(struct vsp1_pipeline *pipe);
169
170void vsp1_pipeline_frame_end(struct vsp1_pipeline *pipe);
171
172void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe,
173				   struct vsp1_dl_body *dlb,
174				   unsigned int alpha);
175
176void vsp1_pipeline_calculate_partition(struct vsp1_pipeline *pipe,
177				       struct vsp1_partition *partition,
178				       unsigned int div_size,
179				       unsigned int index);
180
181const struct vsp1_format_info *vsp1_get_format_info(struct vsp1_device *vsp1,
182						    u32 fourcc);
183const struct vsp1_format_info *
184vsp1_get_format_info_by_index(struct vsp1_device *vsp1, unsigned int index,
185			      u32 code);
186void vsp1_adjust_color_space(u32 code, u32 *colorspace, u8 *xfer_func,
187			     u8 *encoding, u8 *quantization);
188
189#endif /* __VSP1_PIPE_H__ */
~/ Read-only file preview.