]>
Commit | Line | Data |
---|---|---|
5b809074 NT |
1 | /* |
2 | * Copyright (C) 2016 Noralf Trønnes | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
8 | */ | |
9 | ||
10 | #ifndef __LINUX_DRM_SIMPLE_KMS_HELPER_H | |
11 | #define __LINUX_DRM_SIMPLE_KMS_HELPER_H | |
12 | ||
13 | struct drm_simple_display_pipe; | |
14 | ||
15 | /** | |
16 | * struct drm_simple_display_pipe_funcs - helper operations for a simple | |
17 | * display pipeline | |
18 | */ | |
19 | struct drm_simple_display_pipe_funcs { | |
20 | /** | |
21 | * @enable: | |
22 | * | |
23 | * This function should be used to enable the pipeline. | |
24 | * It is called when the underlying crtc is enabled. | |
25 | * This hook is optional. | |
26 | */ | |
27 | void (*enable)(struct drm_simple_display_pipe *pipe, | |
28 | struct drm_crtc_state *crtc_state); | |
29 | /** | |
30 | * @disable: | |
31 | * | |
32 | * This function should be used to disable the pipeline. | |
33 | * It is called when the underlying crtc is disabled. | |
34 | * This hook is optional. | |
35 | */ | |
36 | void (*disable)(struct drm_simple_display_pipe *pipe); | |
37 | ||
38 | /** | |
39 | * @check: | |
40 | * | |
41 | * This function is called in the check phase of an atomic update, | |
42 | * specifically when the underlying plane is checked. | |
43 | * The simple display pipeline helpers already check that the plane is | |
44 | * not scaled, fills the entire visible area and is always enabled | |
45 | * when the crtc is also enabled. | |
46 | * This hook is optional. | |
47 | * | |
48 | * RETURNS: | |
49 | * | |
50 | * 0 on success, -EINVAL if the state or the transition can't be | |
51 | * supported, -ENOMEM on memory allocation failure and -EDEADLK if an | |
52 | * attempt to obtain another state object ran into a &drm_modeset_lock | |
53 | * deadlock. | |
54 | */ | |
55 | int (*check)(struct drm_simple_display_pipe *pipe, | |
56 | struct drm_plane_state *plane_state, | |
57 | struct drm_crtc_state *crtc_state); | |
58 | /** | |
59 | * @update: | |
60 | * | |
61 | * This function is called when the underlying plane state is updated. | |
62 | * This hook is optional. | |
6dcf0de7 DV |
63 | * |
64 | * This is the function drivers should submit the | |
65 | * &drm_pending_vblank_event from. Using either | |
66 | * drm_crtc_arm_vblank_event(), when the driver supports vblank | |
67 | * interrupt handling, or drm_crtc_send_vblank_event() directly in case | |
68 | * the hardware lacks vblank support entirely. | |
5b809074 NT |
69 | */ |
70 | void (*update)(struct drm_simple_display_pipe *pipe, | |
71 | struct drm_plane_state *plane_state); | |
7d83a155 MV |
72 | |
73 | /** | |
74 | * @prepare_fb: | |
75 | * | |
76 | * Optional, called by struct &drm_plane_helper_funcs ->prepare_fb . | |
77 | * Please read the documentation for the ->prepare_fb hook in | |
78 | * struct &drm_plane_helper_funcs for more details. | |
79 | */ | |
80 | int (*prepare_fb)(struct drm_simple_display_pipe *pipe, | |
81 | struct drm_plane_state *plane_state); | |
82 | ||
83 | /** | |
84 | * @cleanup_fb: | |
85 | * | |
86 | * Optional, called by struct &drm_plane_helper_funcs ->cleanup_fb . | |
87 | * Please read the documentation for the ->cleanup_fb hook in | |
88 | * struct &drm_plane_helper_funcs for more details. | |
89 | */ | |
90 | void (*cleanup_fb)(struct drm_simple_display_pipe *pipe, | |
91 | struct drm_plane_state *plane_state); | |
5b809074 NT |
92 | }; |
93 | ||
94 | /** | |
95 | * struct drm_simple_display_pipe - simple display pipeline | |
96 | * @crtc: CRTC control structure | |
97 | * @plane: Plane control structure | |
98 | * @encoder: Encoder control structure | |
99 | * @connector: Connector control structure | |
100 | * @funcs: Pipeline control functions (optional) | |
101 | * | |
102 | * Simple display pipeline with plane, crtc and encoder collapsed into one | |
103 | * entity. It should be initialized by calling drm_simple_display_pipe_init(). | |
104 | */ | |
105 | struct drm_simple_display_pipe { | |
106 | struct drm_crtc crtc; | |
107 | struct drm_plane plane; | |
108 | struct drm_encoder encoder; | |
109 | struct drm_connector *connector; | |
110 | ||
111 | const struct drm_simple_display_pipe_funcs *funcs; | |
112 | }; | |
113 | ||
315486c6 AM |
114 | int drm_simple_display_pipe_attach_bridge(struct drm_simple_display_pipe *pipe, |
115 | struct drm_bridge *bridge); | |
116 | ||
117 | void drm_simple_display_pipe_detach_bridge(struct drm_simple_display_pipe *pipe); | |
118 | ||
5b809074 NT |
119 | int drm_simple_display_pipe_init(struct drm_device *dev, |
120 | struct drm_simple_display_pipe *pipe, | |
121 | const struct drm_simple_display_pipe_funcs *funcs, | |
122 | const uint32_t *formats, unsigned int format_count, | |
123 | struct drm_connector *connector); | |
124 | ||
125 | #endif /* __LINUX_DRM_SIMPLE_KMS_HELPER_H */ |