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_PRIV_H_ 27 #define _DC_STATE_PRIV_H_ 28 29 #include "dc_state.h" 30 #include "dc_stream.h" 31 32 struct dc_stream_state *dc_state_get_stream_from_id(const struct dc_state *state, unsigned int id); 33 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. 36 */ 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); 41 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); 45 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); 53 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); 61 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); 70 71 bool dc_state_add_phantom_plane( 72 const struct dc *dc, 73 struct dc_stream_state *phantom_stream, 74 struct dc_plane_state *phantom_plane, 75 struct dc_state *state); 76 77 bool dc_state_remove_phantom_plane( 78 const struct dc *dc, 79 struct dc_stream_state *phantom_stream, 80 struct dc_plane_state *phantom_plane, 81 struct dc_state *state); 82 83 bool dc_state_rem_all_phantom_planes_for_stream( 84 const struct dc *dc, 85 struct dc_stream_state *phantom_stream, 86 struct dc_state *state, 87 bool should_release_planes); 88 89 bool dc_state_add_all_phantom_planes_for_stream( 90 const struct dc *dc, 91 struct dc_stream_state *phantom_stream, 92 struct dc_plane_state * const *phantom_planes, 93 int plane_count, 94 struct dc_state *state); 95 96 bool dc_state_remove_phantom_streams_and_planes( 97 const struct dc *dc, 98 struct dc_state *state); 99 100 void dc_state_release_phantom_streams_and_planes( 101 const struct dc *dc, 102 struct dc_state *state); 103 104 #endif /* _DC_STATE_PRIV_H_ */ 105