1 /*
2  * Copyright (C) 2017 The Linux Foundation. All rights reserved.
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 2 as published by
6  * the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
11  * more details.
12  *
13  * You should have received a copy of the GNU General Public License along with
14  * this program.  If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef __MDP5_LM_H__
18 #define __MDP5_LM_H__
19 
20 /* represents a hw Layer Mixer, one (or more) is dynamically assigned to a crtc */
21 struct mdp5_hw_mixer {
22 	int idx;
23 
24 	const char *name;
25 
26 	int lm;			/* the LM instance # */
27 	uint32_t caps;
28 	int pp;
29 	int dspp;
30 
31 	uint32_t flush_mask;      /* used to commit LM registers */
32 };
33 
34 /* global atomic state of assignment between CRTCs and Layer Mixers: */
35 struct mdp5_hw_mixer_state {
36 	struct drm_crtc *hwmixer_to_crtc[8];
37 };
38 
39 struct mdp5_hw_mixer *mdp5_mixer_init(const struct mdp5_lm_instance *lm);
40 void mdp5_mixer_destroy(struct mdp5_hw_mixer *lm);
41 int mdp5_mixer_assign(struct drm_atomic_state *s, struct drm_crtc *crtc,
42 		      uint32_t caps, struct mdp5_hw_mixer **mixer,
43 		      struct mdp5_hw_mixer **r_mixer);
44 void mdp5_mixer_release(struct drm_atomic_state *s,
45 			struct mdp5_hw_mixer *mixer);
46 
47 #endif /* __MDP5_LM_H__ */
48