]>
Commit | Line | Data |
---|---|---|
dba4a180 LP |
1 | /* |
2 | * vsp1_pipe.h -- R-Car VSP1 Pipeline | |
3 | * | |
4 | * Copyright (C) 2013-2015 Renesas Electronics Corporation | |
5 | * | |
6 | * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) | |
7 | * | |
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. | |
12 | */ | |
13 | #ifndef __VSP1_PIPE_H__ | |
14 | #define __VSP1_PIPE_H__ | |
15 | ||
a0cdac56 | 16 | #include <linux/kref.h> |
dba4a180 LP |
17 | #include <linux/list.h> |
18 | #include <linux/spinlock.h> | |
19 | #include <linux/wait.h> | |
20 | ||
21 | #include <media/media-entity.h> | |
22 | ||
c2dd2513 | 23 | struct vsp1_dl_list; |
dba4a180 LP |
24 | struct vsp1_rwpf; |
25 | ||
c618b185 LP |
26 | /* |
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 | |
38 | */ | |
39 | struct vsp1_format_info { | |
40 | u32 fourcc; | |
41 | unsigned int mbus; | |
42 | unsigned int hwfmt; | |
43 | unsigned int swap; | |
44 | unsigned int planes; | |
45 | unsigned int bpp[3]; | |
46 | bool swap_yc; | |
47 | bool swap_uv; | |
48 | unsigned int hsub; | |
49 | unsigned int vsub; | |
50 | bool alpha; | |
51 | }; | |
52 | ||
dba4a180 LP |
53 | enum vsp1_pipeline_state { |
54 | VSP1_PIPELINE_STOPPED, | |
55 | VSP1_PIPELINE_RUNNING, | |
56 | VSP1_PIPELINE_STOPPING, | |
57 | }; | |
58 | ||
59 | /* | |
60 | * struct vsp1_pipeline - A VSP1 hardware pipeline | |
ba3a5c6d | 61 | * @pipe: the media pipeline |
dba4a180 | 62 | * @irqlock: protects the pipeline state |
ba3a5c6d | 63 | * @state: current state |
e98c59dd | 64 | * @wq: wait queue to wait for state change completion |
ba3a5c6d | 65 | * @frame_end: frame end interrupt handler |
dba4a180 | 66 | * @lock: protects the pipeline use count and stream count |
a0cdac56 | 67 | * @kref: pipeline reference count |
ba3a5c6d LP |
68 | * @stream_count: number of streaming video nodes |
69 | * @buffers_ready: bitmask of RPFs and WPFs with at least one buffer available | |
0c1a41b5 | 70 | * @sequence: frame sequence number |
ba3a5c6d | 71 | * @num_inputs: number of RPFs |
96bfa6a5 | 72 | * @inputs: array of RPFs in the pipeline (indexed by RPF index) |
ba3a5c6d LP |
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 | |
1517b039 | 79 | * @dl: display list associated with the pipeline |
df32c924 KB |
80 | * @div_size: The maximum allowed partition size for the pipeline |
81 | * @partitions: The number of partitions used to process one frame | |
fc6e514a | 82 | * @current_partition: The partition number currently being configured |
dba4a180 LP |
83 | */ |
84 | struct vsp1_pipeline { | |
85 | struct media_pipeline pipe; | |
86 | ||
87 | spinlock_t irqlock; | |
88 | enum vsp1_pipeline_state state; | |
89 | wait_queue_head_t wq; | |
90 | ||
91 | void (*frame_end)(struct vsp1_pipeline *pipe); | |
92 | ||
93 | struct mutex lock; | |
a0cdac56 | 94 | struct kref kref; |
dba4a180 LP |
95 | unsigned int stream_count; |
96 | unsigned int buffers_ready; | |
0c1a41b5 | 97 | unsigned int sequence; |
dba4a180 LP |
98 | |
99 | unsigned int num_inputs; | |
100 | struct vsp1_rwpf *inputs[VSP1_MAX_RPF]; | |
101 | struct vsp1_rwpf *output; | |
102 | struct vsp1_entity *bru; | |
103 | struct vsp1_entity *lif; | |
104 | struct vsp1_entity *uds; | |
105 | struct vsp1_entity *uds_input; | |
106 | ||
107 | struct list_head entities; | |
1517b039 | 108 | |
c2dd2513 | 109 | struct vsp1_dl_list *dl; |
df32c924 KB |
110 | |
111 | unsigned int div_size; | |
112 | unsigned int partitions; | |
fc6e514a KB |
113 | struct v4l2_rect partition; |
114 | unsigned int current_partition; | |
dba4a180 LP |
115 | }; |
116 | ||
dba4a180 | 117 | void vsp1_pipeline_reset(struct vsp1_pipeline *pipe); |
f294c2f7 | 118 | void vsp1_pipeline_init(struct vsp1_pipeline *pipe); |
dba4a180 LP |
119 | |
120 | void vsp1_pipeline_run(struct vsp1_pipeline *pipe); | |
121 | bool vsp1_pipeline_stopped(struct vsp1_pipeline *pipe); | |
122 | int vsp1_pipeline_stop(struct vsp1_pipeline *pipe); | |
123 | bool vsp1_pipeline_ready(struct vsp1_pipeline *pipe); | |
124 | ||
125 | void vsp1_pipeline_frame_end(struct vsp1_pipeline *pipe); | |
126 | ||
127 | void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe, | |
07a23c61 | 128 | struct vsp1_dl_list *dl, unsigned int alpha); |
dba4a180 LP |
129 | |
130 | void vsp1_pipelines_suspend(struct vsp1_device *vsp1); | |
131 | void vsp1_pipelines_resume(struct vsp1_device *vsp1); | |
132 | ||
c9f49607 LP |
133 | const struct vsp1_format_info *vsp1_get_format_info(struct vsp1_device *vsp1, |
134 | u32 fourcc); | |
c618b185 | 135 | |
dba4a180 | 136 | #endif /* __VSP1_PIPE_H__ */ |