linux/drivers/gpu/drm/amd/display/dc/core/dc_state.c

/*
 * Copyright 2023 Advanced Micro Devices, Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 * Authors: AMD
 *
 */
#include "core_types.h"
#include "core_status.h"
#include "dc_state.h"
#include "dc_state_priv.h"
#include "dc_stream_priv.h"
#include "dc_plane_priv.h"

#include "dm_services.h"
#include "resource.h"
#include "link_enc_cfg.h"

#if defined(CONFIG_DRM_AMD_DC_FP)
#include "dml2/dml2_wrapper.h"
#include "dml2/dml2_internal_types.h"
#endif

#define DC_LOGGER
#define DC_LOGGER_INIT(logger)

/* Private dc_state helper functions */
static bool dc_state_track_phantom_stream(struct dc_state *state,
		struct dc_stream_state *phantom_stream)
{}

static bool dc_state_untrack_phantom_stream(struct dc_state *state, struct dc_stream_state *phantom_stream)
{}

static bool dc_state_is_phantom_stream_tracked(struct dc_state *state, struct dc_stream_state *phantom_stream)
{}

static bool dc_state_track_phantom_plane(struct dc_state *state,
		struct dc_plane_state *phantom_plane)
{}

static bool dc_state_untrack_phantom_plane(struct dc_state *state, struct dc_plane_state *phantom_plane)
{}

static bool dc_state_is_phantom_plane_tracked(struct dc_state *state, struct dc_plane_state *phantom_plane)
{}

static void dc_state_copy_internal(struct dc_state *dst_state, struct dc_state *src_state)
{}

static void init_state(struct dc *dc, struct dc_state *state)
{}

/* Public dc_state functions */
struct dc_state *dc_state_create(struct dc *dc, struct dc_state_create_params *params)
{}

void dc_state_copy(struct dc_state *dst_state, struct dc_state *src_state)
{}

struct dc_state *dc_state_create_copy(struct dc_state *src_state)
{}

void dc_state_copy_current(struct dc *dc, struct dc_state *dst_state)
{}

struct dc_state *dc_state_create_current_copy(struct dc *dc)
{}

void dc_state_construct(struct dc *dc, struct dc_state *state)
{}

void dc_state_destruct(struct dc_state *state)
{}

void dc_state_retain(struct dc_state *state)
{}

static void dc_state_free(struct kref *kref)
{}

void dc_state_release(struct dc_state *state)
{}
/*
 * dc_state_add_stream() - Add a new dc_stream_state to a dc_state.
 */
enum dc_status dc_state_add_stream(
		const struct dc *dc,
		struct dc_state *state,
		struct dc_stream_state *stream)
{}

/*
 * dc_state_remove_stream() - Remove a stream from a dc_state.
 */
enum dc_status dc_state_remove_stream(
		const struct dc *dc,
		struct dc_state *state,
		struct dc_stream_state *stream)
{}

static void remove_mpc_combine_for_stream(const struct dc *dc,
		struct dc_state *new_ctx,
		const struct dc_state *cur_ctx,
		struct dc_stream_status *status)
{}

bool dc_state_add_plane(
		const struct dc *dc,
		struct dc_stream_state *stream,
		struct dc_plane_state *plane_state,
		struct dc_state *state)
{}

bool dc_state_remove_plane(
		const struct dc *dc,
		struct dc_stream_state *stream,
		struct dc_plane_state *plane_state,
		struct dc_state *state)
{}

/**
 * dc_state_rem_all_planes_for_stream - Remove planes attached to the target stream.
 *
 * @dc: Current dc state.
 * @stream: Target stream, which we want to remove the attached plans.
 * @state: context from which the planes are to be removed.
 *
 * Return:
 * Return true if DC was able to remove all planes from the target
 * stream, otherwise, return false.
 */
bool dc_state_rem_all_planes_for_stream(
		const struct dc *dc,
		struct dc_stream_state *stream,
		struct dc_state *state)
{}

bool dc_state_add_all_planes_for_stream(
		const struct dc *dc,
		struct dc_stream_state *stream,
		struct dc_plane_state * const *plane_states,
		int plane_count,
		struct dc_state *state)
{}

/* Private dc_state functions */

/**
 * dc_state_get_stream_status - Get stream status from given dc state
 * @state: DC state to find the stream status in
 * @stream: The stream to get the stream status for
 *
 * The given stream is expected to exist in the given dc state. Otherwise, NULL
 * will be returned.
 */
struct dc_stream_status *dc_state_get_stream_status(
		struct dc_state *state,
		const struct dc_stream_state *stream)
{}

enum mall_stream_type dc_state_get_pipe_subvp_type(const struct dc_state *state,
		const struct pipe_ctx *pipe_ctx)
{}

enum mall_stream_type dc_state_get_stream_subvp_type(const struct dc_state *state,
		const struct dc_stream_state *stream)
{}

struct dc_stream_state *dc_state_get_paired_subvp_stream(const struct dc_state *state,
		const struct dc_stream_state *stream)
{}

struct dc_stream_state *dc_state_create_phantom_stream(const struct dc *dc,
		struct dc_state *state,
		struct dc_stream_state *main_stream)
{}

void dc_state_release_phantom_stream(const struct dc *dc,
		struct dc_state *state,
		struct dc_stream_state *phantom_stream)
{}

struct dc_plane_state *dc_state_create_phantom_plane(const struct dc *dc,
		struct dc_state *state,
		struct dc_plane_state *main_plane)
{}

void dc_state_release_phantom_plane(const struct dc *dc,
		struct dc_state *state,
		struct dc_plane_state *phantom_plane)
{}

/* add phantom streams to context and generate correct meta inside dc_state */
enum dc_status dc_state_add_phantom_stream(const struct dc *dc,
		struct dc_state *state,
		struct dc_stream_state *phantom_stream,
		struct dc_stream_state *main_stream)
{}

enum dc_status dc_state_remove_phantom_stream(const struct dc *dc,
		struct dc_state *state,
		struct dc_stream_state *phantom_stream)
{}

bool dc_state_add_phantom_plane(
		const struct dc *dc,
		struct dc_stream_state *phantom_stream,
		struct dc_plane_state *phantom_plane,
		struct dc_state *state)
{}

bool dc_state_remove_phantom_plane(
		const struct dc *dc,
		struct dc_stream_state *phantom_stream,
		struct dc_plane_state *phantom_plane,
		struct dc_state *state)
{}

bool dc_state_rem_all_phantom_planes_for_stream(
		const struct dc *dc,
		struct dc_stream_state *phantom_stream,
		struct dc_state *state,
		bool should_release_planes)
{}

bool dc_state_add_all_phantom_planes_for_stream(
		const struct dc *dc,
		struct dc_stream_state *phantom_stream,
		struct dc_plane_state * const *phantom_planes,
		int plane_count,
		struct dc_state *state)
{}

bool dc_state_remove_phantom_streams_and_planes(
	const struct dc *dc,
	struct dc_state *state)
{}

void dc_state_release_phantom_streams_and_planes(
		const struct dc *dc,
		struct dc_state *state)
{}

struct dc_stream_state *dc_state_get_stream_from_id(const struct dc_state *state, unsigned int id)
{}

bool dc_state_is_fams2_in_use(
		const struct dc *dc,
		const struct dc_state *state)
{}