Merge tag 'amd-drm-next-5.13-2021-04-12' of https://gitlab.freedesktop.org/agd5f...
[sfrench/cifs-2.6.git] / drivers / gpu / drm / amd / display / dc / inc / link_enc_cfg.h
1 /*
2  * Copyright 2021 Advanced Micro Devices, Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * Authors: AMD
23  *
24  */
25
26 #ifndef DC_INC_LINK_ENC_CFG_H_
27 #define DC_INC_LINK_ENC_CFG_H_
28
29 /* This module implements functionality for dynamically assigning DIG link
30  * encoder resources to display endpoints (links).
31  */
32
33 #include "core_types.h"
34
35 /*
36  * Initialise link encoder resource tracking.
37  */
38 void link_enc_cfg_init(
39                 struct dc *dc,
40                 struct dc_state *state);
41
42 /*
43  * Algorithm for assigning available DIG link encoders to streams.
44  *
45  * Update link_enc_assignments table and link_enc_avail list accordingly in
46  * struct resource_context.
47  *
48  * Loop over all streams twice:
49  * a) First assign encoders to unmappable endpoints.
50  * b) Then assign encoders to mappable endpoints.
51  */
52 void link_enc_cfg_link_encs_assign(
53                 struct dc *dc,
54                 struct dc_state *state,
55                 struct dc_stream_state *streams[],
56                 uint8_t stream_count);
57
58 /*
59  * Unassign a link encoder from a stream.
60  *
61  * Update link_enc_assignments table and link_enc_avail list accordingly in
62  * struct resource_context.
63  */
64 void link_enc_cfg_link_enc_unassign(
65                 struct dc_state *state,
66                 struct dc_stream_state *stream);
67
68 /*
69  * Check whether the transmitter driven by a link encoder is a mappable
70  * endpoint.
71  */
72 bool link_enc_cfg_is_transmitter_mappable(
73                 struct dc_state *state,
74                 struct link_encoder *link_enc);
75
76 /* Return link using DIG link encoder resource. NULL if unused. */
77 struct dc_link *link_enc_cfg_get_link_using_link_enc(
78                 struct dc_state *state,
79                 enum engine_id eng_id);
80
81 /* Return DIG link encoder used by link. NULL if unused. */
82 struct link_encoder *link_enc_cfg_get_link_enc_used_by_link(
83                 struct dc_state *state,
84                 struct dc_link *link);
85
86 #endif /* DC_INC_LINK_ENC_CFG_H_ */