2 * Copyright 2023 Advanced Micro Devices, Inc.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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.
26 #ifndef _DC_STATE_PRIV_H_
27 #define _DC_STATE_PRIV_H_
30 #include "dc_stream.h"
32 struct dc_stream_state *dc_state_get_stream_from_id(const struct dc_state *state, unsigned int id);
34 /* Get the type of the provided resource (none, phantom, main) based on the provided
35 * context. If the context is unavailable, determine only if phantom or not.
37 enum mall_stream_type dc_state_get_pipe_subvp_type(const struct dc_state *state,
38 const struct pipe_ctx *pipe_ctx);
39 enum mall_stream_type dc_state_get_stream_subvp_type(const struct dc_state *state,
40 const struct dc_stream_state *stream);
42 /* Gets the phantom stream if main is provided, gets the main if phantom is provided.*/
43 struct dc_stream_state *dc_state_get_paired_subvp_stream(const struct dc_state *state,
44 const struct dc_stream_state *stream);
46 /* allocate's phantom stream or plane and returns pointer to the object */
47 struct dc_stream_state *dc_state_create_phantom_stream(const struct dc *dc,
48 struct dc_state *state,
49 struct dc_stream_state *main_stream);
50 struct dc_plane_state *dc_state_create_phantom_plane(const struct dc *dc,
51 struct dc_state *state,
52 struct dc_plane_state *main_plane);
54 /* deallocate's phantom stream or plane */
55 void dc_state_release_phantom_stream(const struct dc *dc,
56 struct dc_state *state,
57 struct dc_stream_state *phantom_stream);
58 void dc_state_release_phantom_plane(const struct dc *dc,
59 struct dc_state *state,
60 struct dc_plane_state *phantom_plane);
62 /* add/remove phantom stream to context and generate subvp meta data */
63 enum dc_status dc_state_add_phantom_stream(const struct dc *dc,
64 struct dc_state *state,
65 struct dc_stream_state *phantom_stream,
66 struct dc_stream_state *main_stream);
67 enum dc_status dc_state_remove_phantom_stream(const struct dc *dc,
68 struct dc_state *state,
69 struct dc_stream_state *phantom_stream);
71 bool dc_state_add_phantom_plane(
73 struct dc_stream_state *phantom_stream,
74 struct dc_plane_state *phantom_plane,
75 struct dc_state *state);
77 bool dc_state_remove_phantom_plane(
79 struct dc_stream_state *phantom_stream,
80 struct dc_plane_state *phantom_plane,
81 struct dc_state *state);
83 bool dc_state_rem_all_phantom_planes_for_stream(
85 struct dc_stream_state *phantom_stream,
86 struct dc_state *state,
87 bool should_release_planes);
89 bool dc_state_add_all_phantom_planes_for_stream(
91 struct dc_stream_state *phantom_stream,
92 struct dc_plane_state * const *phantom_planes,
94 struct dc_state *state);
96 bool dc_state_remove_phantom_streams_and_planes(
98 struct dc_state *state);
100 void dc_state_release_phantom_streams_and_planes(
102 struct dc_state *state);
104 bool dc_state_is_fams2_in_use(
106 const struct dc_state *state);
108 #endif /* _DC_STATE_PRIV_H_ */