xref: /linux/drivers/gpu/drm/amd/display/dc/dc_state.h (revision 7f4f3b14e8079ecde096bd734af10e30d40c27b7)
1 /*
2  * Copyright 2023 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_STATE_H_
27 #define _DC_STATE_H_
28 
29 #include "inc/core_status.h"
30 
31 struct dc_state *dc_state_create(struct dc *dc, struct dc_state_create_params *params);
32 void dc_state_copy(struct dc_state *dst_state, struct dc_state *src_state);
33 struct dc_state *dc_state_create_copy(struct dc_state *src_state);
34 void dc_state_copy_current(struct dc *dc, struct dc_state *dst_state);
35 struct dc_state *dc_state_create_current_copy(struct dc *dc);
36 void dc_state_construct(struct dc *dc, struct dc_state *state);
37 void dc_state_destruct(struct dc_state *state);
38 void dc_state_retain(struct dc_state *state);
39 void dc_state_release(struct dc_state *state);
40 
41 enum dc_status dc_state_add_stream(const struct dc *dc,
42 				    struct dc_state *state,
43 				    struct dc_stream_state *stream);
44 
45 enum dc_status dc_state_remove_stream(
46 		const struct dc *dc,
47 		struct dc_state *state,
48 		struct dc_stream_state *stream);
49 
50 bool dc_state_add_plane(
51 		const struct dc *dc,
52 		struct dc_stream_state *stream,
53 		struct dc_plane_state *plane_state,
54 		struct dc_state *state);
55 
56 bool dc_state_remove_plane(
57 		const struct dc *dc,
58 		struct dc_stream_state *stream,
59 		struct dc_plane_state *plane_state,
60 		struct dc_state *state);
61 
62 bool dc_state_rem_all_planes_for_stream(
63 		const struct dc *dc,
64 		struct dc_stream_state *stream,
65 		struct dc_state *state);
66 
67 bool dc_state_add_all_planes_for_stream(
68 		const struct dc *dc,
69 		struct dc_stream_state *stream,
70 		struct dc_plane_state * const *plane_states,
71 		int plane_count,
72 		struct dc_state *state);
73 
74 struct dc_stream_status *dc_state_get_stream_status(
75 	struct dc_state *state,
76 	const struct dc_stream_state *stream);
77 #endif /* _DC_STATE_H_ */
78