blob: bf4bbc104f8802d5398e2babd729bbed0cebfa41 [file] [log] [blame]
Abhijit Kulkarni40e38162016-06-26 22:12:09 -04001/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef _SDE_CRTC_H_
14#define _SDE_CRTC_H_
15
16#include "drm_crtc.h"
17
Abhijit Kulkarni40e38162016-06-26 22:12:09 -040018#define CRTC_DUAL_MIXERS 2
19#define PENDING_FLIP 2
20/* worst case one frame wait time based on 30 FPS : 33.33ms*/
21#define CRTC_MAX_WAIT_ONE_FRAME 34
22#define CRTC_HW_MIXER_MAXSTAGES(c, idx) ((c)->mixer[idx].sblk->maxblendstages)
23
24/**
25 * struct sde_crtc_mixer - stores the map for each virtual pipeline in the CRTC
26 * @hw_dspp : DSPP HW Driver context
27 * @hw_lm : LM HW Driver context
28 * @hw_ctl : CTL Path HW driver context
29 * @intf_idx : Interface idx
30 * @mode : Interface mode Active/CMD
31 * @flush_mask : Flush mask value for this commit
32 */
33struct sde_crtc_mixer {
34 struct sde_hw_dspp *hw_dspp;
35 struct sde_hw_mixer *hw_lm;
36 struct sde_hw_ctl *hw_ctl;
37 enum sde_intf intf_idx;
38 enum sde_intf_mode mode;
39 u32 flush_mask;
40};
41
42/**
43 * struct sde_crtc - virtualized CRTC data structure
44 * @base : Base drm crtc structure
45 * @name : ASCII description of this crtc
46 * @encoder : Associated drm encoder object
47 * @id : Unique crtc identifier
48 * @lm_lock : LM register access spinlock
49 * @num_ctls : Number of ctl paths in use
50 * @num_mixers : Number of mixers in use
51 * @mixer : List of active mixers
52 * @event : Pointer to last received drm vblank event
53 * @pending : Whether or not an update is pending
54 * @vsync_count : Running count of received vsync events
Lloyd Atkinsone5c2c0b2016-07-05 12:23:29 -040055 * @drm_requested_vblank : Whether vblanks have been enabled in the encoder
Abhijit Kulkarni40e38162016-06-26 22:12:09 -040056 */
57struct sde_crtc {
58 struct drm_crtc base;
59 char name[8];
60 struct drm_encoder *encoder;
61 int id;
62
63 spinlock_t lm_lock; /* protect registers */
64
65 /* HW Resources reserved for the crtc */
66 u32 num_ctls;
67 u32 num_mixers;
68 struct sde_crtc_mixer mixer[CRTC_DUAL_MIXERS];
69
70 /*if there is a pending flip, these will be non-null */
71 struct drm_pending_vblank_event *event;
72 atomic_t pending;
73 u32 vsync_count;
Lloyd Atkinsone5c2c0b2016-07-05 12:23:29 -040074 bool drm_requested_vblank;
Abhijit Kulkarni40e38162016-06-26 22:12:09 -040075};
76
77#define to_sde_crtc(x) container_of(x, struct sde_crtc, base)
78
79#endif /* _SDE_CRTC_H_ */