Commit 6fa6acdf authored by Stephane Viau's avatar Stephane Viau Committed by Rob Clark

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: default avatarStephane Viau <sviau@codeaurora.org>
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
parent de50d351
...@@ -31,6 +31,11 @@ const struct mdp5_cfg_hw msm8x74_config = { ...@@ -31,6 +31,11 @@ const struct mdp5_cfg_hw msm8x74_config = {
.smp = { .smp = {
.mmb_count = 22, .mmb_count = 22,
.mmb_size = 4096, .mmb_size = 4096,
.clients = {
[SSPP_VIG0] = 1, [SSPP_VIG1] = 4, [SSPP_VIG2] = 7,
[SSPP_DMA0] = 10, [SSPP_DMA1] = 13,
[SSPP_RGB0] = 16, [SSPP_RGB1] = 17, [SSPP_RGB2] = 18,
},
}, },
.ctl = { .ctl = {
.count = 5, .count = 5,
...@@ -86,11 +91,18 @@ const struct mdp5_cfg_hw apq8084_config = { ...@@ -86,11 +91,18 @@ const struct mdp5_cfg_hw apq8084_config = {
.smp = { .smp = {
.mmb_count = 44, .mmb_count = 44,
.mmb_size = 8192, .mmb_size = 8192,
.clients = {
[SSPP_VIG0] = 1, [SSPP_VIG1] = 4,
[SSPP_VIG2] = 7, [SSPP_VIG3] = 19,
[SSPP_DMA0] = 10, [SSPP_DMA1] = 13,
[SSPP_RGB0] = 16, [SSPP_RGB1] = 17,
[SSPP_RGB2] = 18, [SSPP_RGB3] = 22,
},
.reserved_state[0] = GENMASK(7, 0), /* first 8 MMBs */ .reserved_state[0] = GENMASK(7, 0), /* first 8 MMBs */
.reserved[CID_RGB0] = 2, .reserved = {
.reserved[CID_RGB1] = 2, /* Two SMP blocks are statically tied to RGB pipes: */
.reserved[CID_RGB2] = 2, [16] = 2, [17] = 2, [18] = 2, [22] = 2,
.reserved[CID_RGB3] = 2, },
}, },
.ctl = { .ctl = {
.count = 5, .count = 5,
......
...@@ -52,6 +52,7 @@ struct mdp5_ctl_block { ...@@ -52,6 +52,7 @@ struct mdp5_ctl_block {
struct mdp5_smp_block { struct mdp5_smp_block {
int mmb_count; /* number of SMP MMBs */ int mmb_count; /* number of SMP MMBs */
int mmb_size; /* MMB: size in bytes */ int mmb_size; /* MMB: size in bytes */
uint32_t clients[MAX_CLIENTS]; /* SMP port allocation /pipe */
mdp5_smp_state_t reserved_state;/* SMP MMBs statically allocated */ mdp5_smp_state_t reserved_state;/* SMP MMBs statically allocated */
int reserved[MAX_CLIENTS]; /* # of MMBs allocated per client */ int reserved[MAX_CLIENTS]; /* # of MMBs allocated per client */
}; };
......
...@@ -74,7 +74,7 @@ struct mdp5_smp { ...@@ -74,7 +74,7 @@ struct mdp5_smp {
spinlock_t state_lock; spinlock_t state_lock;
mdp5_smp_state_t state; /* to track smp allocation amongst pipes: */ mdp5_smp_state_t state; /* to track smp allocation amongst pipes: */
struct mdp5_client_smp_state client_state[CID_MAX]; struct mdp5_client_smp_state client_state[MAX_CLIENTS];
}; };
static inline static inline
...@@ -85,27 +85,31 @@ struct mdp5_kms *get_kms(struct mdp5_smp *smp) ...@@ -85,27 +85,31 @@ struct mdp5_kms *get_kms(struct mdp5_smp *smp)
return to_mdp5_kms(to_mdp_kms(priv->kms)); return to_mdp5_kms(to_mdp_kms(priv->kms));
} }
static inline enum mdp5_client_id pipe2client(enum mdp5_pipe pipe, int plane) static inline u32 pipe2client(enum mdp5_pipe pipe, int plane)
{ {
WARN_ON(plane >= pipe2nclients(pipe)); #define CID_UNUSED 0
switch (pipe) {
case SSPP_VIG0: return CID_VIG0_Y + plane; if (WARN_ON(plane >= pipe2nclients(pipe)))
case SSPP_VIG1: return CID_VIG1_Y + plane; return CID_UNUSED;
case SSPP_VIG2: return CID_VIG2_Y + plane;
case SSPP_RGB0: return CID_RGB0; /*
case SSPP_RGB1: return CID_RGB1; * Note on SMP clients:
case SSPP_RGB2: return CID_RGB2; * For ViG pipes, fetch Y/Cr/Cb-components clients are always
case SSPP_DMA0: return CID_DMA0_Y + plane; * consecutive, and in that order.
case SSPP_DMA1: return CID_DMA1_Y + plane; *
case SSPP_VIG3: return CID_VIG3_Y + plane; * e.g.:
case SSPP_RGB3: return CID_RGB3; * if mdp5_cfg->smp.clients[SSPP_VIG0] = N,
default: return CID_UNUSED; * Y plane's client ID is N
} * Cr plane's client ID is N + 1
* Cb plane's client ID is N + 2
*/
return mdp5_cfg->smp.clients[pipe] + plane;
} }
/* step #1: update # of blocks pending for the client: */ /* step #1: update # of blocks pending for the client: */
static int smp_request_block(struct mdp5_smp *smp, static int smp_request_block(struct mdp5_smp *smp,
enum mdp5_client_id cid, int nblks) u32 cid, int nblks)
{ {
struct mdp5_kms *mdp5_kms = get_kms(smp); struct mdp5_kms *mdp5_kms = get_kms(smp);
const struct mdp5_cfg_hw *hw_cfg; const struct mdp5_cfg_hw *hw_cfg;
...@@ -227,7 +231,7 @@ void mdp5_smp_release(struct mdp5_smp *smp, enum mdp5_pipe pipe) ...@@ -227,7 +231,7 @@ void mdp5_smp_release(struct mdp5_smp *smp, enum mdp5_pipe pipe)
} }
static void update_smp_state(struct mdp5_smp *smp, static void update_smp_state(struct mdp5_smp *smp,
enum mdp5_client_id cid, mdp5_smp_state_t *assigned) u32 cid, mdp5_smp_state_t *assigned)
{ {
struct mdp5_kms *mdp5_kms = get_kms(smp); struct mdp5_kms *mdp5_kms = get_kms(smp);
int cnt = smp->blk_cnt; int cnt = smp->blk_cnt;
...@@ -267,7 +271,7 @@ void mdp5_smp_configure(struct mdp5_smp *smp, enum mdp5_pipe pipe) ...@@ -267,7 +271,7 @@ void mdp5_smp_configure(struct mdp5_smp *smp, enum mdp5_pipe pipe)
int i; int i;
for (i = 0; i < pipe2nclients(pipe); i++) { for (i = 0; i < pipe2nclients(pipe); i++) {
enum mdp5_client_id cid = pipe2client(pipe, i); u32 cid = pipe2client(pipe, i);
struct mdp5_client_smp_state *ps = &smp->client_state[cid]; struct mdp5_client_smp_state *ps = &smp->client_state[cid];
bitmap_or(assigned, ps->inuse, ps->pending, cnt); 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,7 +287,7 @@ void mdp5_smp_commit(struct mdp5_smp *smp, enum mdp5_pipe pipe)
int i; int i;
for (i = 0; i < pipe2nclients(pipe); i++) { for (i = 0; i < pipe2nclients(pipe); i++) {
enum mdp5_client_id cid = pipe2client(pipe, i); u32 cid = pipe2client(pipe, i);
struct mdp5_client_smp_state *ps = &smp->client_state[cid]; struct mdp5_client_smp_state *ps = &smp->client_state[cid];
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment