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.
10 #ifndef __LINUX_DRM_SIMPLE_KMS_HELPER_H
11 #define __LINUX_DRM_SIMPLE_KMS_HELPER_H
13 struct drm_simple_display_pipe
;
16 * struct drm_simple_display_pipe_funcs - helper operations for a simple
19 struct drm_simple_display_pipe_funcs
{
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.
27 void (*enable
)(struct drm_simple_display_pipe
*pipe
,
28 struct drm_crtc_state
*crtc_state
);
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.
36 void (*disable
)(struct drm_simple_display_pipe
*pipe
);
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.
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
55 int (*check
)(struct drm_simple_display_pipe
*pipe
,
56 struct drm_plane_state
*plane_state
,
57 struct drm_crtc_state
*crtc_state
);
61 * This function is called when the underlying plane state is updated.
62 * This hook is optional.
64 void (*update
)(struct drm_simple_display_pipe
*pipe
,
65 struct drm_plane_state
*plane_state
);
69 * struct drm_simple_display_pipe - simple display pipeline
70 * @crtc: CRTC control structure
71 * @plane: Plane control structure
72 * @encoder: Encoder control structure
73 * @connector: Connector control structure
74 * @funcs: Pipeline control functions (optional)
76 * Simple display pipeline with plane, crtc and encoder collapsed into one
77 * entity. It should be initialized by calling drm_simple_display_pipe_init().
79 struct drm_simple_display_pipe
{
81 struct drm_plane plane
;
82 struct drm_encoder encoder
;
83 struct drm_connector
*connector
;
85 const struct drm_simple_display_pipe_funcs
*funcs
;
88 int drm_simple_display_pipe_init(struct drm_device
*dev
,
89 struct drm_simple_display_pipe
*pipe
,
90 const struct drm_simple_display_pipe_funcs
*funcs
,
91 const uint32_t *formats
, unsigned int format_count
,
92 struct drm_connector
*connector
);
94 #endif /* __LINUX_DRM_SIMPLE_KMS_HELPER_H */