uapi/if_ether.h: move __UAPI_DEF_ETHHDR libc define
[linux/fpc-iii.git] / include / drm / drm_simple_kms_helper.h
blob6d9adbb46293310cb09780ec509f048b94642a41
1 /*
2 * Copyright (C) 2016 Noralf Trønnes
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 */
10 #ifndef __LINUX_DRM_SIMPLE_KMS_HELPER_H
11 #define __LINUX_DRM_SIMPLE_KMS_HELPER_H
13 #include <drm/drm_crtc.h>
14 #include <drm/drm_encoder.h>
15 #include <drm/drm_plane.h>
17 struct drm_simple_display_pipe;
19 /**
20 * struct drm_simple_display_pipe_funcs - helper operations for a simple
21 * display pipeline
23 struct drm_simple_display_pipe_funcs {
24 /**
25 * @enable:
27 * This function should be used to enable the pipeline.
28 * It is called when the underlying crtc is enabled.
29 * This hook is optional.
31 void (*enable)(struct drm_simple_display_pipe *pipe,
32 struct drm_crtc_state *crtc_state);
33 /**
34 * @disable:
36 * This function should be used to disable the pipeline.
37 * It is called when the underlying crtc is disabled.
38 * This hook is optional.
40 void (*disable)(struct drm_simple_display_pipe *pipe);
42 /**
43 * @check:
45 * This function is called in the check phase of an atomic update,
46 * specifically when the underlying plane is checked.
47 * The simple display pipeline helpers already check that the plane is
48 * not scaled, fills the entire visible area and is always enabled
49 * when the crtc is also enabled.
50 * This hook is optional.
52 * RETURNS:
54 * 0 on success, -EINVAL if the state or the transition can't be
55 * supported, -ENOMEM on memory allocation failure and -EDEADLK if an
56 * attempt to obtain another state object ran into a &drm_modeset_lock
57 * deadlock.
59 int (*check)(struct drm_simple_display_pipe *pipe,
60 struct drm_plane_state *plane_state,
61 struct drm_crtc_state *crtc_state);
62 /**
63 * @update:
65 * This function is called when the underlying plane state is updated.
66 * This hook is optional.
68 * This is the function drivers should submit the
69 * &drm_pending_vblank_event from. Using either
70 * drm_crtc_arm_vblank_event(), when the driver supports vblank
71 * interrupt handling, or drm_crtc_send_vblank_event() directly in case
72 * the hardware lacks vblank support entirely.
74 void (*update)(struct drm_simple_display_pipe *pipe,
75 struct drm_plane_state *old_plane_state);
77 /**
78 * @prepare_fb:
80 * Optional, called by &drm_plane_helper_funcs.prepare_fb. Please read
81 * the documentation for the &drm_plane_helper_funcs.prepare_fb hook for
82 * more details.
84 int (*prepare_fb)(struct drm_simple_display_pipe *pipe,
85 struct drm_plane_state *plane_state);
87 /**
88 * @cleanup_fb:
90 * Optional, called by &drm_plane_helper_funcs.cleanup_fb. Please read
91 * the documentation for the &drm_plane_helper_funcs.cleanup_fb hook for
92 * more details.
94 void (*cleanup_fb)(struct drm_simple_display_pipe *pipe,
95 struct drm_plane_state *plane_state);
98 /**
99 * struct drm_simple_display_pipe - simple display pipeline
100 * @crtc: CRTC control structure
101 * @plane: Plane control structure
102 * @encoder: Encoder control structure
103 * @connector: Connector control structure
104 * @funcs: Pipeline control functions (optional)
106 * Simple display pipeline with plane, crtc and encoder collapsed into one
107 * entity. It should be initialized by calling drm_simple_display_pipe_init().
109 struct drm_simple_display_pipe {
110 struct drm_crtc crtc;
111 struct drm_plane plane;
112 struct drm_encoder encoder;
113 struct drm_connector *connector;
115 const struct drm_simple_display_pipe_funcs *funcs;
118 int drm_simple_display_pipe_attach_bridge(struct drm_simple_display_pipe *pipe,
119 struct drm_bridge *bridge);
121 int drm_simple_display_pipe_init(struct drm_device *dev,
122 struct drm_simple_display_pipe *pipe,
123 const struct drm_simple_display_pipe_funcs *funcs,
124 const uint32_t *formats, unsigned int format_count,
125 const uint64_t *format_modifiers,
126 struct drm_connector *connector);
128 #endif /* __LINUX_DRM_SIMPLE_KMS_HELPER_H */