2 * vsp1_pipe.h -- R-Car VSP1 Pipeline
4 * Copyright (C) 2013-2015 Renesas Electronics Corporation
6 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 #ifndef __VSP1_PIPE_H__
14 #define __VSP1_PIPE_H__
16 #include <linux/kref.h>
17 #include <linux/list.h>
18 #include <linux/spinlock.h>
19 #include <linux/wait.h>
21 #include <media/media-entity.h>
27 * struct vsp1_format_info - VSP1 video format description
28 * @mbus: media bus format code
29 * @fourcc: V4L2 pixel format FCC identifier
30 * @planes: number of planes
31 * @bpp: bits per pixel
32 * @hwfmt: VSP1 hardware format
33 * @swap_yc: the Y and C components are swapped (Y comes before C)
34 * @swap_uv: the U and V components are swapped (V comes before U)
35 * @hsub: horizontal subsampling factor
36 * @vsub: vertical subsampling factor
37 * @alpha: has an alpha channel
39 struct vsp1_format_info
{
53 enum vsp1_pipeline_state
{
54 VSP1_PIPELINE_STOPPED
,
55 VSP1_PIPELINE_RUNNING
,
56 VSP1_PIPELINE_STOPPING
,
60 * struct vsp1_pipeline - A VSP1 hardware pipeline
61 * @pipe: the media pipeline
62 * @irqlock: protects the pipeline state
63 * @state: current state
64 * @wq: wait queue to wait for state change completion
65 * @frame_end: frame end interrupt handler
66 * @lock: protects the pipeline use count and stream count
67 * @kref: pipeline reference count
68 * @stream_count: number of streaming video nodes
69 * @buffers_ready: bitmask of RPFs and WPFs with at least one buffer available
70 * @sequence: frame sequence number
71 * @num_inputs: number of RPFs
72 * @inputs: array of RPFs in the pipeline (indexed by RPF index)
73 * @output: WPF at the output of the pipeline
74 * @bru: BRU entity, if present
75 * @lif: LIF entity, if present
76 * @uds: UDS entity, if present
77 * @uds_input: entity at the input of the UDS, if the UDS is present
78 * @entities: list of entities in the pipeline
79 * @dl: display list associated with the pipeline
81 struct vsp1_pipeline
{
82 struct media_pipeline pipe
;
85 enum vsp1_pipeline_state state
;
88 void (*frame_end
)(struct vsp1_pipeline
*pipe
);
92 unsigned int stream_count
;
93 unsigned int buffers_ready
;
94 unsigned int sequence
;
96 unsigned int num_inputs
;
97 struct vsp1_rwpf
*inputs
[VSP1_MAX_RPF
];
98 struct vsp1_rwpf
*output
;
99 struct vsp1_entity
*bru
;
100 struct vsp1_entity
*lif
;
101 struct vsp1_entity
*uds
;
102 struct vsp1_entity
*uds_input
;
104 struct list_head entities
;
106 struct vsp1_dl_list
*dl
;
109 void vsp1_pipeline_reset(struct vsp1_pipeline
*pipe
);
110 void vsp1_pipeline_init(struct vsp1_pipeline
*pipe
);
112 void vsp1_pipeline_run(struct vsp1_pipeline
*pipe
);
113 bool vsp1_pipeline_stopped(struct vsp1_pipeline
*pipe
);
114 int vsp1_pipeline_stop(struct vsp1_pipeline
*pipe
);
115 bool vsp1_pipeline_ready(struct vsp1_pipeline
*pipe
);
117 void vsp1_pipeline_frame_end(struct vsp1_pipeline
*pipe
);
119 void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline
*pipe
,
120 struct vsp1_dl_list
*dl
, unsigned int alpha
);
122 void vsp1_pipelines_suspend(struct vsp1_device
*vsp1
);
123 void vsp1_pipelines_resume(struct vsp1_device
*vsp1
);
125 const struct vsp1_format_info
*vsp1_get_format_info(u32 fourcc
);
127 #endif /* __VSP1_PIPE_H__ */