diff options
author | Stephane Viau <sviau@codeaurora.org> | 2015-03-09 09:11:06 -0400 |
---|---|---|
committer | Rob Clark <robdclark@gmail.com> | 2015-04-01 19:29:36 -0400 |
commit | 6fa6acdfa37737fce6f69a7aa50606825ccea5ea (patch) | |
tree | b1fcfa280738f4bde8d8d0c2c7816454e622641d /drivers/gpu/drm/msm/mdp/mdp5/mdp5_smp.c | |
parent | de50d351b37ba43a8d9e944e78c4df37f88d4ae2 (diff) |
drm/msm/mdp5: Get SMP client list from mdp5_cfg
SMP blocks are configured for specific client IDs (ports).
These client IDs can be different from one chip to another for a
given pipe.
e.g.: DMA0 pipe fetch Y component is connected to:
- port #10 for MDP5 v1.3
- port #4 for MDP5 v1.6
In order to be compatible for upcoming versions of MDP5, the
client ID list is passed through the MDP5 config module rather
than using a list of hard-coded enum values.
Signed-off-by: Stephane Viau <sviau@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/msm/mdp/mdp5/mdp5_smp.c')
-rw-r--r-- | drivers/gpu/drm/msm/mdp/mdp5/mdp5_smp.c | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_smp.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_smp.c index 361c064ba44c..16702aecf0df 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_smp.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_smp.c | |||
@@ -74,7 +74,7 @@ struct mdp5_smp { | |||
74 | spinlock_t state_lock; | 74 | spinlock_t state_lock; |
75 | mdp5_smp_state_t state; /* to track smp allocation amongst pipes: */ | 75 | mdp5_smp_state_t state; /* to track smp allocation amongst pipes: */ |
76 | 76 | ||
77 | struct mdp5_client_smp_state client_state[CID_MAX]; | 77 | struct mdp5_client_smp_state client_state[MAX_CLIENTS]; |
78 | }; | 78 | }; |
79 | 79 | ||
80 | static inline | 80 | static inline |
@@ -85,27 +85,31 @@ struct mdp5_kms *get_kms(struct mdp5_smp *smp) | |||
85 | return to_mdp5_kms(to_mdp_kms(priv->kms)); | 85 | return to_mdp5_kms(to_mdp_kms(priv->kms)); |
86 | } | 86 | } |
87 | 87 | ||
88 | static inline enum mdp5_client_id pipe2client(enum mdp5_pipe pipe, int plane) | 88 | static inline u32 pipe2client(enum mdp5_pipe pipe, int plane) |
89 | { | 89 | { |
90 | WARN_ON(plane >= pipe2nclients(pipe)); | 90 | #define CID_UNUSED 0 |
91 | switch (pipe) { | 91 | |
92 | case SSPP_VIG0: return CID_VIG0_Y + plane; | 92 | if (WARN_ON(plane >= pipe2nclients(pipe))) |
93 | case SSPP_VIG1: return CID_VIG1_Y + plane; | 93 | return CID_UNUSED; |
94 | case SSPP_VIG2: return CID_VIG2_Y + plane; | 94 | |
95 | case SSPP_RGB0: return CID_RGB0; | 95 | /* |
96 | case SSPP_RGB1: return CID_RGB1; | 96 | * Note on SMP clients: |
97 | case SSPP_RGB2: return CID_RGB2; | 97 | * For ViG pipes, fetch Y/Cr/Cb-components clients are always |
98 | case SSPP_DMA0: return CID_DMA0_Y + plane; | 98 | * consecutive, and in that order. |
99 | case SSPP_DMA1: return CID_DMA1_Y + plane; | 99 | * |
100 | case SSPP_VIG3: return CID_VIG3_Y + plane; | 100 | * e.g.: |
101 | case SSPP_RGB3: return CID_RGB3; | 101 | * if mdp5_cfg->smp.clients[SSPP_VIG0] = N, |
102 | default: return CID_UNUSED; | 102 | * Y plane's client ID is N |
103 | } | 103 | * Cr plane's client ID is N + 1 |
104 | * Cb plane's client ID is N + 2 | ||
105 | */ | ||
106 | |||
107 | return mdp5_cfg->smp.clients[pipe] + plane; | ||
104 | } | 108 | } |
105 | 109 | ||
106 | /* step #1: update # of blocks pending for the client: */ | 110 | /* step #1: update # of blocks pending for the client: */ |
107 | static int smp_request_block(struct mdp5_smp *smp, | 111 | static int smp_request_block(struct mdp5_smp *smp, |
108 | enum mdp5_client_id cid, int nblks) | 112 | u32 cid, int nblks) |
109 | { | 113 | { |
110 | struct mdp5_kms *mdp5_kms = get_kms(smp); | 114 | struct mdp5_kms *mdp5_kms = get_kms(smp); |
111 | const struct mdp5_cfg_hw *hw_cfg; | 115 | const struct mdp5_cfg_hw *hw_cfg; |
@@ -227,7 +231,7 @@ void mdp5_smp_release(struct mdp5_smp *smp, enum mdp5_pipe pipe) | |||
227 | } | 231 | } |
228 | 232 | ||
229 | static void update_smp_state(struct mdp5_smp *smp, | 233 | static void update_smp_state(struct mdp5_smp *smp, |
230 | enum mdp5_client_id cid, mdp5_smp_state_t *assigned) | 234 | u32 cid, mdp5_smp_state_t *assigned) |
231 | { | 235 | { |
232 | struct mdp5_kms *mdp5_kms = get_kms(smp); | 236 | struct mdp5_kms *mdp5_kms = get_kms(smp); |
233 | int cnt = smp->blk_cnt; | 237 | int cnt = smp->blk_cnt; |
@@ -267,7 +271,7 @@ void mdp5_smp_configure(struct mdp5_smp *smp, enum mdp5_pipe pipe) | |||
267 | int i; | 271 | int i; |
268 | 272 | ||
269 | for (i = 0; i < pipe2nclients(pipe); i++) { | 273 | for (i = 0; i < pipe2nclients(pipe); i++) { |
270 | enum mdp5_client_id cid = pipe2client(pipe, i); | 274 | u32 cid = pipe2client(pipe, i); |
271 | struct mdp5_client_smp_state *ps = &smp->client_state[cid]; | 275 | struct mdp5_client_smp_state *ps = &smp->client_state[cid]; |
272 | 276 | ||
273 | bitmap_or(assigned, ps->inuse, ps->pending, cnt); | 277 | bitmap_or(assigned, ps->inuse, ps->pending, cnt); |
@@ -283,7 +287,7 @@ void mdp5_smp_commit(struct mdp5_smp *smp, enum mdp5_pipe pipe) | |||
283 | int i; | 287 | int i; |
284 | 288 | ||
285 | for (i = 0; i < pipe2nclients(pipe); i++) { | 289 | for (i = 0; i < pipe2nclients(pipe); i++) { |
286 | enum mdp5_client_id cid = pipe2client(pipe, i); | 290 | u32 cid = pipe2client(pipe, i); |
287 | struct mdp5_client_smp_state *ps = &smp->client_state[cid]; | 291 | struct mdp5_client_smp_state *ps = &smp->client_state[cid]; |
288 | 292 | ||
289 | /* | 293 | /* |