Lines Matching full:smp

32 struct mdp5_kms *get_kms(struct mdp5_smp *smp)  in get_kms()  argument
34 struct msm_drm_private *priv = smp->dev->dev_private; in get_kms()
47 * Note on SMP clients: in pipe2client()
52 * if mdp5_cfg->smp.clients[SSPP_VIG0] = N, in pipe2client()
58 return mdp5_cfg->smp.clients[pipe] + plane; in pipe2client()
62 static int smp_request_block(struct mdp5_smp *smp, in smp_request_block() argument
67 int i, avail, cnt = smp->blk_cnt; in smp_request_block()
73 reserved = smp->reserved[cid]; in smp_request_block()
82 DRM_DEV_ERROR(smp->dev->dev, "out of blks (req=%d > avail=%d)\n", in smp_request_block()
96 static void set_fifo_thresholds(struct mdp5_smp *smp, in set_fifo_thresholds() argument
99 u32 smp_entries_per_blk = smp->blk_size / (128 / BITS_PER_BYTE); in set_fifo_thresholds()
102 /* 1/4 of SMP pool that is being fetched */ in set_fifo_thresholds()
105 smp->pipe_reqprio_fifo_wm0[pipe] = val * 1; in set_fifo_thresholds()
106 smp->pipe_reqprio_fifo_wm1[pipe] = val * 2; in set_fifo_thresholds()
107 smp->pipe_reqprio_fifo_wm2[pipe] = val * 3; in set_fifo_thresholds()
112 * then the width used to calculate SMP block requirements is the post-
113 * decimated width. Ie. SMP buffering sits downstream of decimation (which
116 uint32_t mdp5_smp_calculate(struct mdp5_smp *smp, in mdp5_smp_calculate() argument
121 struct mdp5_kms *mdp5_kms = get_kms(smp); in mdp5_smp_calculate()
134 * them together, writes to SMP using a single client. in mdp5_smp_calculate()
152 n = DIV_ROUND_UP(fetch_stride * nlines, smp->blk_size); in mdp5_smp_calculate()
164 int mdp5_smp_assign(struct mdp5_smp *smp, struct mdp5_smp_state *state, in mdp5_smp_assign() argument
167 struct mdp5_kms *mdp5_kms = get_kms(smp); in mdp5_smp_assign()
178 DBG("%s[%d]: request %d SMP blocks", pipe2name(pipe), i, n); in mdp5_smp_assign()
179 ret = smp_request_block(smp, state, cid, n); in mdp5_smp_assign()
181 DRM_DEV_ERROR(dev->dev, "Cannot allocate %d SMP blocks: %d\n", in mdp5_smp_assign()
194 /* Release SMP blocks for all clients of the pipe */
195 void mdp5_smp_release(struct mdp5_smp *smp, struct mdp5_smp_state *state, in mdp5_smp_release() argument
199 int cnt = smp->blk_cnt; in mdp5_smp_release()
218 static unsigned update_smp_state(struct mdp5_smp *smp, in update_smp_state() argument
221 int cnt = smp->blk_cnt; in update_smp_state()
229 val = smp->alloc_w[idx]; in update_smp_state()
246 smp->alloc_w[idx] = val; in update_smp_state()
247 smp->alloc_r[idx] = val; in update_smp_state()
255 static void write_smp_alloc_regs(struct mdp5_smp *smp) in write_smp_alloc_regs() argument
257 struct mdp5_kms *mdp5_kms = get_kms(smp); in write_smp_alloc_regs()
260 num_regs = smp->blk_cnt / 3 + 1; in write_smp_alloc_regs()
264 smp->alloc_w[i]); in write_smp_alloc_regs()
266 smp->alloc_r[i]); in write_smp_alloc_regs()
270 static void write_smp_fifo_regs(struct mdp5_smp *smp) in write_smp_fifo_regs() argument
272 struct mdp5_kms *mdp5_kms = get_kms(smp); in write_smp_fifo_regs()
280 smp->pipe_reqprio_fifo_wm0[pipe]); in write_smp_fifo_regs()
282 smp->pipe_reqprio_fifo_wm1[pipe]); in write_smp_fifo_regs()
284 smp->pipe_reqprio_fifo_wm2[pipe]); in write_smp_fifo_regs()
288 void mdp5_smp_prepare_commit(struct mdp5_smp *smp, struct mdp5_smp_state *state) in mdp5_smp_prepare_commit() argument
299 nblks += update_smp_state(smp, cid, cs); in mdp5_smp_prepare_commit()
305 set_fifo_thresholds(smp, pipe, nblks); in mdp5_smp_prepare_commit()
308 write_smp_alloc_regs(smp); in mdp5_smp_prepare_commit()
309 write_smp_fifo_regs(smp); in mdp5_smp_prepare_commit()
314 void mdp5_smp_complete_commit(struct mdp5_smp *smp, struct mdp5_smp_state *state) in mdp5_smp_complete_commit() argument
320 set_fifo_thresholds(smp, pipe, 0); in mdp5_smp_complete_commit()
323 write_smp_fifo_regs(smp); in mdp5_smp_complete_commit()
328 void mdp5_smp_dump(struct mdp5_smp *smp, struct drm_printer *p) in mdp5_smp_dump() argument
330 struct mdp5_kms *mdp5_kms = get_kms(smp); in mdp5_smp_dump()
346 state = &global_state->smp; in mdp5_smp_dump()
355 int inuse = bitmap_weight(cs, smp->blk_cnt); in mdp5_smp_dump()
365 drm_printf(p, "TOTAL:\t%d\t(of %d)\n", total, smp->blk_cnt); in mdp5_smp_dump()
366 drm_printf(p, "AVAIL:\t%d\n", smp->blk_cnt - in mdp5_smp_dump()
367 bitmap_weight(state->state, smp->blk_cnt)); in mdp5_smp_dump()
373 void mdp5_smp_destroy(struct mdp5_smp *smp) in mdp5_smp_destroy() argument
375 kfree(smp); in mdp5_smp_destroy()
382 struct mdp5_smp *smp = NULL; in mdp5_smp_init() local
385 smp = kzalloc(sizeof(*smp), GFP_KERNEL); in mdp5_smp_init()
386 if (unlikely(!smp)) { in mdp5_smp_init()
391 smp->dev = mdp5_kms->dev; in mdp5_smp_init()
392 smp->blk_cnt = cfg->mmb_count; in mdp5_smp_init()
393 smp->blk_size = cfg->mmb_size; in mdp5_smp_init()
396 state = &global_state->smp; in mdp5_smp_init()
399 bitmap_copy(state->state, cfg->reserved_state, smp->blk_cnt); in mdp5_smp_init()
400 memcpy(smp->reserved, cfg->reserved, sizeof(smp->reserved)); in mdp5_smp_init()
402 return smp; in mdp5_smp_init()
404 if (smp) in mdp5_smp_init()
405 mdp5_smp_destroy(smp); in mdp5_smp_init()