109 lines · c
1/*2 * Copyright 2023 Advanced Micro Devices, Inc.3 *4 * Permission is hereby granted, free of charge, to any person obtaining a5 * copy of this software and associated documentation files (the "Software"),6 * to deal in the Software without restriction, including without limitation7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,8 * and/or sell copies of the Software, and to permit persons to whom the9 * Software is furnished to do so, subject to the following conditions:10 *11 * The above copyright notice and this permission notice shall be included in12 * all copies or substantial portions of the Software.13 *14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR18 * 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 OR20 * OTHER DEALINGS IN THE SOFTWARE.21 *22 * Authors: AMD23 *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 32struct 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 provided35 * context. If the context is unavailable, determine only if phantom or not.36 */37enum mall_stream_type dc_state_get_pipe_subvp_type(const struct dc_state *state,38 const struct pipe_ctx *pipe_ctx);39enum 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.*/43struct 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 */47struct dc_stream_state *dc_state_create_phantom_stream(const struct dc *dc,48 struct dc_state *state,49 struct dc_stream_state *main_stream);50struct 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 */55void dc_state_release_phantom_stream(const struct dc *dc,56 struct dc_state *state,57 struct dc_stream_state *phantom_stream);58void 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 */63enum 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);67enum dc_status dc_state_remove_phantom_stream(const struct dc *dc,68 struct dc_state *state,69 struct dc_stream_state *phantom_stream);70 71bool 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 77bool 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 83bool 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 89bool 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 96bool dc_state_remove_phantom_streams_and_planes(97 const struct dc *dc,98 struct dc_state *state);99 100void dc_state_release_phantom_streams_and_planes(101 const struct dc *dc,102 struct dc_state *state);103 104bool dc_state_is_fams2_in_use(105 const struct dc *dc,106 const struct dc_state *state);107 108#endif /* _DC_STATE_PRIV_H_ */109