root/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: GPL-2.0-only */
   2 /*
   3  * Copyright (c) 2014, The Linux Foundation. All rights reserved.
   4  * Copyright (C) 2013 Red Hat
   5  * Author: Rob Clark <robdclark@gmail.com>
   6  */
   7 
   8 #ifndef __MDP5_SMP_H__
   9 #define __MDP5_SMP_H__
  10 
  11 #include <drm/drm_print.h>
  12 
  13 #include "msm_drv.h"
  14 
  15 /*
  16  * SMP - Shared Memory Pool:
  17  *
  18  * SMP blocks are shared between all the clients, where each plane in
  19  * a scanout buffer is a SMP client.  Ie. scanout of 3 plane I420 on
  20  * pipe VIG0 => 3 clients: VIG0_Y, VIG0_CB, VIG0_CR.
  21  *
  22  * Based on the size of the attached scanout buffer, a certain # of
  23  * blocks must be allocated to that client out of the shared pool.
  24  *
  25  * In some hw, some blocks are statically allocated for certain pipes
  26  * and CANNOT be re-allocated (eg: MMB0 and MMB1 both tied to RGB0).
  27  *
  28  *
  29  * Atomic SMP State:
  30  *
  31  * On atomic updates that modify SMP configuration, the state is cloned
  32  * (copied) and modified.  For test-only, or in cases where atomic
  33  * update fails (or if we hit ww_mutex deadlock/backoff condition) the
  34  * new state is simply thrown away.
  35  *
  36  * Because the SMP registers are not double buffered, updates are a
  37  * two step process:
  38  *
  39  * 1) in _prepare_commit() we configure things (via read-modify-write)
  40  *    for the newly assigned pipes, so we don't take away blocks
  41  *    assigned to pipes that are still scanning out
  42  * 2) in _complete_commit(), after vblank/etc, we clear things for the
  43  *    released clients, since at that point old pipes are no longer
  44  *    scanning out.
  45  */
  46 struct mdp5_smp_state {
  47         /* global state of what blocks are in use: */
  48         mdp5_smp_state_t state;
  49 
  50         /* per client state of what blocks they are using: */
  51         mdp5_smp_state_t client_state[MAX_CLIENTS];
  52 
  53         /* assigned pipes (hw updated at _prepare_commit()): */
  54         unsigned long assigned;
  55 
  56         /* released pipes (hw updated at _complete_commit()): */
  57         unsigned long released;
  58 };
  59 
  60 struct mdp5_kms;
  61 struct mdp5_smp;
  62 
  63 /*
  64  * SMP module prototypes:
  65  * mdp5_smp_init() returns a SMP @handler,
  66  * which is then used to call the other mdp5_smp_*(handler, ...) functions.
  67  */
  68 
  69 struct mdp5_smp *mdp5_smp_init(struct mdp5_kms *mdp5_kms,
  70                 const struct mdp5_smp_block *cfg);
  71 void  mdp5_smp_destroy(struct mdp5_smp *smp);
  72 
  73 void mdp5_smp_dump(struct mdp5_smp *smp, struct drm_printer *p);
  74 
  75 uint32_t mdp5_smp_calculate(struct mdp5_smp *smp,
  76                 const struct mdp_format *format,
  77                 u32 width, bool hdecim);
  78 
  79 int mdp5_smp_assign(struct mdp5_smp *smp, struct mdp5_smp_state *state,
  80                 enum mdp5_pipe pipe, uint32_t blkcfg);
  81 void mdp5_smp_release(struct mdp5_smp *smp, struct mdp5_smp_state *state,
  82                 enum mdp5_pipe pipe);
  83 
  84 void mdp5_smp_prepare_commit(struct mdp5_smp *smp, struct mdp5_smp_state *state);
  85 void mdp5_smp_complete_commit(struct mdp5_smp *smp, struct mdp5_smp_state *state);
  86 
  87 #endif /* __MDP5_SMP_H__ */

/* [<][>][^][v][top][bottom][index][help] */