Merge tag 'drm-intel-next-2016-02-14' of git://anongit.freedesktop.org/drm-intel...
[deliverable/linux.git] / drivers / media / platform / vsp1 / vsp1_pipe.h
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
16 #include <linux/list.h>
17 #include <linux/spinlock.h>
18 #include <linux/wait.h>
19
20 #include <media/media-entity.h>
21
22 struct vsp1_dl;
23 struct vsp1_rwpf;
24
25 /*
26 * struct vsp1_format_info - VSP1 video format description
27 * @mbus: media bus format code
28 * @fourcc: V4L2 pixel format FCC identifier
29 * @planes: number of planes
30 * @bpp: bits per pixel
31 * @hwfmt: VSP1 hardware format
32 * @swap_yc: the Y and C components are swapped (Y comes before C)
33 * @swap_uv: the U and V components are swapped (V comes before U)
34 * @hsub: horizontal subsampling factor
35 * @vsub: vertical subsampling factor
36 * @alpha: has an alpha channel
37 */
38 struct vsp1_format_info {
39 u32 fourcc;
40 unsigned int mbus;
41 unsigned int hwfmt;
42 unsigned int swap;
43 unsigned int planes;
44 unsigned int bpp[3];
45 bool swap_yc;
46 bool swap_uv;
47 unsigned int hsub;
48 unsigned int vsub;
49 bool alpha;
50 };
51
52 enum vsp1_pipeline_state {
53 VSP1_PIPELINE_STOPPED,
54 VSP1_PIPELINE_RUNNING,
55 VSP1_PIPELINE_STOPPING,
56 };
57
58 /*
59 * struct vsp1_pipeline - A VSP1 hardware pipeline
60 * @pipe: the media pipeline
61 * @irqlock: protects the pipeline state
62 * @state: current state
63 * @wq: work queue to wait for state change completion
64 * @frame_end: frame end interrupt handler
65 * @lock: protects the pipeline use count and stream count
66 * @use_count: number of video nodes using the pipeline
67 * @stream_count: number of streaming video nodes
68 * @buffers_ready: bitmask of RPFs and WPFs with at least one buffer available
69 * @num_inputs: number of RPFs
70 * @inputs: array of RPFs in the pipeline (indexed by RPF index)
71 * @output: WPF at the output of the pipeline
72 * @bru: BRU entity, if present
73 * @lif: LIF entity, if present
74 * @uds: UDS entity, if present
75 * @uds_input: entity at the input of the UDS, if the UDS is present
76 * @entities: list of entities in the pipeline
77 * @dl: display list associated with the pipeline
78 */
79 struct vsp1_pipeline {
80 struct media_pipeline pipe;
81
82 spinlock_t irqlock;
83 enum vsp1_pipeline_state state;
84 wait_queue_head_t wq;
85
86 void (*frame_end)(struct vsp1_pipeline *pipe);
87
88 struct mutex lock;
89 unsigned int use_count;
90 unsigned int stream_count;
91 unsigned int buffers_ready;
92
93 unsigned int num_inputs;
94 struct vsp1_rwpf *inputs[VSP1_MAX_RPF];
95 struct vsp1_rwpf *output;
96 struct vsp1_entity *bru;
97 struct vsp1_entity *lif;
98 struct vsp1_entity *uds;
99 struct vsp1_entity *uds_input;
100
101 struct list_head entities;
102
103 struct vsp1_dl *dl;
104 };
105
106 static inline struct vsp1_pipeline *to_vsp1_pipeline(struct media_entity *e)
107 {
108 if (likely(e->pipe))
109 return container_of(e->pipe, struct vsp1_pipeline, pipe);
110 else
111 return NULL;
112 }
113
114 void vsp1_pipeline_reset(struct vsp1_pipeline *pipe);
115 void vsp1_pipeline_init(struct vsp1_pipeline *pipe);
116
117 void vsp1_pipeline_run(struct vsp1_pipeline *pipe);
118 bool vsp1_pipeline_stopped(struct vsp1_pipeline *pipe);
119 int vsp1_pipeline_stop(struct vsp1_pipeline *pipe);
120 bool vsp1_pipeline_ready(struct vsp1_pipeline *pipe);
121
122 void vsp1_pipeline_display_start(struct vsp1_pipeline *pipe);
123 void vsp1_pipeline_frame_end(struct vsp1_pipeline *pipe);
124
125 void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe,
126 struct vsp1_entity *input,
127 unsigned int alpha);
128
129 void vsp1_pipelines_suspend(struct vsp1_device *vsp1);
130 void vsp1_pipelines_resume(struct vsp1_device *vsp1);
131
132 const struct vsp1_format_info *vsp1_get_format_info(u32 fourcc);
133
134 #endif /* __VSP1_PIPE_H__ */
This page took 0.045851 seconds and 5 git commands to generate.