]> git.ipfire.org Git - thirdparty/linux.git/blame - drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.h
treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234
[thirdparty/linux.git] / drivers / gpu / drm / msm / disp / mdp5 / mdp5_smp.h
CommitLineData
caab277b 1/* SPDX-License-Identifier: GPL-2.0-only */
06c0dd96 2/*
bfcdfb0e 3 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
06c0dd96
RC
4 * Copyright (C) 2013 Red Hat
5 * Author: Rob Clark <robdclark@gmail.com>
06c0dd96
RC
6 */
7
8#ifndef __MDP5_SMP_H__
9#define __MDP5_SMP_H__
10
bc5289ee
RC
11#include <drm/drm_print.h>
12
06c0dd96
RC
13#include "msm_drv.h"
14
49ec5b2e
RC
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 */
46struct 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;
06c0dd96
RC
58};
59
60struct mdp5_kms;
42238da8 61struct mdp5_smp;
06c0dd96 62
bfcdfb0e
SV
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
49ec5b2e
RC
69struct mdp5_smp *mdp5_smp_init(struct mdp5_kms *mdp5_kms,
70 const struct mdp5_smp_block *cfg);
42238da8 71void mdp5_smp_destroy(struct mdp5_smp *smp);
06c0dd96 72
bc5289ee
RC
73void mdp5_smp_dump(struct mdp5_smp *smp, struct drm_printer *p);
74
49ec5b2e
RC
75uint32_t mdp5_smp_calculate(struct mdp5_smp *smp,
76 const struct mdp_format *format,
77 u32 width, bool hdecim);
78
79int mdp5_smp_assign(struct mdp5_smp *smp, struct mdp5_smp_state *state,
80 enum mdp5_pipe pipe, uint32_t blkcfg);
81void mdp5_smp_release(struct mdp5_smp *smp, struct mdp5_smp_state *state,
82 enum mdp5_pipe pipe);
83
84void mdp5_smp_prepare_commit(struct mdp5_smp *smp, struct mdp5_smp_state *state);
85void mdp5_smp_complete_commit(struct mdp5_smp *smp, struct mdp5_smp_state *state);
06c0dd96
RC
86
87#endif /* __MDP5_SMP_H__ */