drm/msm/mdp4: drop attached planes table
Simplify things a bit for atomic, gets rid of some bookkeeping, and makes the code cleaner. TODO move iterator macro somewhere common. Signed-off-by: Rob Clark <robdclark@gmail.com>
This commit is contained in:
		
					parent
					
						
							
								88ff1c2f3b
							
						
					
				
			
			
				commit
				
					
						bb6c018d35
					
				
			
		
					 2 changed files with 21 additions and 25 deletions
				
			
		| 
						 | 
					@ -25,7 +25,6 @@
 | 
				
			||||||
struct mdp4_crtc {
 | 
					struct mdp4_crtc {
 | 
				
			||||||
	struct drm_crtc base;
 | 
						struct drm_crtc base;
 | 
				
			||||||
	char name[8];
 | 
						char name[8];
 | 
				
			||||||
	struct drm_plane *planes[8];
 | 
					 | 
				
			||||||
	int id;
 | 
						int id;
 | 
				
			||||||
	int ovlp;
 | 
						int ovlp;
 | 
				
			||||||
	enum mdp4_dma dma;
 | 
						enum mdp4_dma dma;
 | 
				
			||||||
| 
						 | 
					@ -96,15 +95,14 @@ static void crtc_flush(struct drm_crtc *crtc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc);
 | 
						struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc);
 | 
				
			||||||
	struct mdp4_kms *mdp4_kms = get_kms(crtc);
 | 
						struct mdp4_kms *mdp4_kms = get_kms(crtc);
 | 
				
			||||||
	uint32_t i, flush = 0;
 | 
						struct drm_plane *plane;
 | 
				
			||||||
 | 
						uint32_t flush = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < ARRAY_SIZE(mdp4_crtc->planes); i++) {
 | 
						for_each_plane_on_crtc(crtc, plane) {
 | 
				
			||||||
		struct drm_plane *plane = mdp4_crtc->planes[i];
 | 
					 | 
				
			||||||
		if (plane) {
 | 
					 | 
				
			||||||
		enum mdp4_pipe pipe_id = mdp4_plane_pipe(plane);
 | 
							enum mdp4_pipe pipe_id = mdp4_plane_pipe(plane);
 | 
				
			||||||
		flush |= pipe2flush(pipe_id);
 | 
							flush |= pipe2flush(pipe_id);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	}
 | 
					
 | 
				
			||||||
	flush |= ovlp2flush(mdp4_crtc->ovlp);
 | 
						flush |= ovlp2flush(mdp4_crtc->ovlp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	DBG("%s: flush=%08x", mdp4_crtc->name, flush);
 | 
						DBG("%s: flush=%08x", mdp4_crtc->name, flush);
 | 
				
			||||||
| 
						 | 
					@ -254,6 +252,7 @@ static void blend_setup(struct drm_crtc *crtc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc);
 | 
						struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc);
 | 
				
			||||||
	struct mdp4_kms *mdp4_kms = get_kms(crtc);
 | 
						struct mdp4_kms *mdp4_kms = get_kms(crtc);
 | 
				
			||||||
 | 
						struct drm_plane *plane;
 | 
				
			||||||
	int i, ovlp = mdp4_crtc->ovlp;
 | 
						int i, ovlp = mdp4_crtc->ovlp;
 | 
				
			||||||
	uint32_t mixer_cfg = 0;
 | 
						uint32_t mixer_cfg = 0;
 | 
				
			||||||
	static const enum mdp_mixer_stage_id stages[] = {
 | 
						static const enum mdp_mixer_stage_id stages[] = {
 | 
				
			||||||
| 
						 | 
					@ -283,9 +282,7 @@ static void blend_setup(struct drm_crtc *crtc)
 | 
				
			||||||
	mdp4_write(mdp4_kms, REG_MDP4_OVLP_TRANSP_HIGH0(ovlp), 0);
 | 
						mdp4_write(mdp4_kms, REG_MDP4_OVLP_TRANSP_HIGH0(ovlp), 0);
 | 
				
			||||||
	mdp4_write(mdp4_kms, REG_MDP4_OVLP_TRANSP_HIGH1(ovlp), 0);
 | 
						mdp4_write(mdp4_kms, REG_MDP4_OVLP_TRANSP_HIGH1(ovlp), 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < ARRAY_SIZE(mdp4_crtc->planes); i++) {
 | 
						for_each_plane_on_crtc(crtc, plane) {
 | 
				
			||||||
		struct drm_plane *plane = mdp4_crtc->planes[i];
 | 
					 | 
				
			||||||
		if (plane) {
 | 
					 | 
				
			||||||
		enum mdp4_pipe pipe_id = mdp4_plane_pipe(plane);
 | 
							enum mdp4_pipe pipe_id = mdp4_plane_pipe(plane);
 | 
				
			||||||
		int idx = idxs[pipe_id];
 | 
							int idx = idxs[pipe_id];
 | 
				
			||||||
		if (idx > 0) {
 | 
							if (idx > 0) {
 | 
				
			||||||
| 
						 | 
					@ -296,7 +293,6 @@ static void blend_setup(struct drm_crtc *crtc)
 | 
				
			||||||
		mixer_cfg = mixercfg(mixer_cfg, mdp4_crtc->mixer,
 | 
							mixer_cfg = mixercfg(mixer_cfg, mdp4_crtc->mixer,
 | 
				
			||||||
				pipe_id, stages[idx]);
 | 
									pipe_id, stages[idx]);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* this shouldn't happen.. and seems to cause underflow: */
 | 
						/* this shouldn't happen.. and seems to cause underflow: */
 | 
				
			||||||
	WARN_ON(!mixer_cfg);
 | 
						WARN_ON(!mixer_cfg);
 | 
				
			||||||
| 
						 | 
					@ -718,12 +714,6 @@ static void set_attach(struct drm_crtc *crtc, enum mdp4_pipe pipe_id,
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc);
 | 
						struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	BUG_ON(pipe_id >= ARRAY_SIZE(mdp4_crtc->planes));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (mdp4_crtc->planes[pipe_id] == plane)
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	mdp4_crtc->planes[pipe_id] = plane;
 | 
					 | 
				
			||||||
	blend_setup(crtc);
 | 
						blend_setup(crtc);
 | 
				
			||||||
	if (mdp4_crtc->enabled && (plane != crtc->primary))
 | 
						if (mdp4_crtc->enabled && (plane != crtc->primary))
 | 
				
			||||||
		crtc_flush(crtc);
 | 
							crtc_flush(crtc);
 | 
				
			||||||
| 
						 | 
					@ -785,6 +775,7 @@ struct drm_crtc *mdp4_crtc_init(struct drm_device *dev,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	drm_crtc_init_with_planes(dev, crtc, plane, NULL, &mdp4_crtc_funcs);
 | 
						drm_crtc_init_with_planes(dev, crtc, plane, NULL, &mdp4_crtc_funcs);
 | 
				
			||||||
	drm_crtc_helper_add(crtc, &mdp4_crtc_helper_funcs);
 | 
						drm_crtc_helper_add(crtc, &mdp4_crtc_helper_funcs);
 | 
				
			||||||
 | 
						plane->crtc = crtc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	mdp4_plane_install_properties(plane, &crtc->base);
 | 
						mdp4_plane_install_properties(plane, &crtc->base);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -65,4 +65,9 @@ static inline void msm_kms_init(struct msm_kms *kms,
 | 
				
			||||||
struct msm_kms *mdp4_kms_init(struct drm_device *dev);
 | 
					struct msm_kms *mdp4_kms_init(struct drm_device *dev);
 | 
				
			||||||
struct msm_kms *mdp5_kms_init(struct drm_device *dev);
 | 
					struct msm_kms *mdp5_kms_init(struct drm_device *dev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* TODO move these helper iterator macro somewhere common: */
 | 
				
			||||||
 | 
					#define for_each_plane_on_crtc(_crtc, _plane) \
 | 
				
			||||||
 | 
						list_for_each_entry((_plane), &(_crtc)->dev->mode_config.plane_list, head) \
 | 
				
			||||||
 | 
							if ((_plane)->crtc == (_crtc))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* __MSM_KMS_H__ */
 | 
					#endif /* __MSM_KMS_H__ */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue