#include "dml2_mall_phantom.h"
#include "dml2_dc_types.h"
#include "dml2_internal_types.h"
#include "dml2_utils.h"
#include "dml2_dc_resource_mgmt.h"
#define MAX_ODM_FACTOR …
#define MAX_MPCC_FACTOR …
struct dc_plane_pipe_pool { … };
struct dc_pipe_mapping_scratch { … };
static bool get_plane_id(struct dml2_context *dml2, const struct dc_state *state, const struct dc_plane_state *plane,
unsigned int stream_id, unsigned int plane_index, unsigned int *plane_id)
{ … }
static int find_disp_cfg_idx_by_plane_id(struct dml2_dml_to_dc_pipe_mapping *mapping, unsigned int plane_id)
{ … }
static int find_disp_cfg_idx_by_stream_id(struct dml2_dml_to_dc_pipe_mapping *mapping, unsigned int stream_id)
{ … }
static struct pipe_ctx *find_master_pipe_of_stream(struct dml2_context *ctx, struct dc_state *state, unsigned int stream_id)
{ … }
static struct pipe_ctx *find_master_pipe_of_plane(struct dml2_context *ctx,
struct dc_state *state, unsigned int plane_id)
{ … }
static unsigned int find_pipes_assigned_to_plane(struct dml2_context *ctx,
struct dc_state *state, unsigned int plane_id, unsigned int *pipes)
{ … }
static bool validate_pipe_assignment(const struct dml2_context *ctx, const struct dc_state *state, const struct dml_display_cfg_st *disp_cfg, const struct dml2_dml_to_dc_pipe_mapping *mapping)
{ … }
static bool is_plane_using_pipe(const struct pipe_ctx *pipe)
{ … }
static bool is_pipe_free(const struct pipe_ctx *pipe)
{ … }
static unsigned int find_preferred_pipe_candidates(const struct dc_state *existing_state,
const int pipe_count,
const unsigned int stream_id,
unsigned int *preferred_pipe_candidates)
{ … }
static unsigned int find_last_resort_pipe_candidates(const struct dc_state *existing_state,
const int pipe_count,
const unsigned int stream_id,
unsigned int *last_resort_pipe_candidates)
{ … }
static bool is_pipe_in_candidate_array(const unsigned int pipe_idx,
const unsigned int *candidate_array,
const unsigned int candidate_array_size)
{ … }
static bool find_more_pipes_for_stream(struct dml2_context *ctx,
struct dc_state *state,
unsigned int stream_id,
int *assigned_pipes,
int *assigned_pipe_count,
int pipes_needed,
const struct dc_state *existing_state)
{ … }
static bool find_more_free_pipes(struct dml2_context *ctx,
struct dc_state *state,
unsigned int stream_id,
int *assigned_pipes,
int *assigned_pipe_count,
int pipes_needed,
const struct dc_state *existing_state)
{ … }
static void sort_pipes_for_splitting(struct dc_plane_pipe_pool *pipes)
{ … }
static void calculate_odm_slices(const struct dc_stream_state *stream, unsigned int odm_factor, unsigned int *odm_slice_end_x)
{ … }
static bool is_plane_in_odm_slice(const struct dc_plane_state *plane, unsigned int slice_index, unsigned int *odm_slice_end_x, unsigned int num_slices)
{ … }
static void add_odm_slice_to_odm_tree(struct dml2_context *ctx,
struct dc_state *state,
struct dc_pipe_mapping_scratch *scratch,
unsigned int odm_slice_index)
{ … }
static struct pipe_ctx *add_plane_to_blend_tree(struct dml2_context *ctx,
struct dc_state *state,
const struct dc_plane_state *plane,
struct dc_plane_pipe_pool *pipe_pool,
unsigned int odm_slice,
struct pipe_ctx *top_pipe)
{ … }
static unsigned int find_pipes_assigned_to_stream(struct dml2_context *ctx, struct dc_state *state, unsigned int stream_id, unsigned int *pipes)
{ … }
static struct pipe_ctx *assign_pipes_to_stream(struct dml2_context *ctx, struct dc_state *state,
const struct dc_stream_state *stream,
int odm_factor,
struct dc_plane_pipe_pool *pipe_pool,
const struct dc_state *existing_state)
{ … }
static struct pipe_ctx *assign_pipes_to_plane(struct dml2_context *ctx, struct dc_state *state,
const struct dc_stream_state *stream,
const struct dc_plane_state *plane,
int odm_factor,
int mpc_factor,
int plane_index,
struct dc_plane_pipe_pool *pipe_pool,
const struct dc_state *existing_state)
{ … }
static bool is_pipe_used(const struct dc_plane_pipe_pool *pool, unsigned int pipe_idx)
{ … }
static void free_pipe(struct pipe_ctx *pipe)
{ … }
static void free_unused_pipes_for_plane(struct dml2_context *ctx, struct dc_state *state,
const struct dc_plane_state *plane, const struct dc_plane_pipe_pool *pool, unsigned int stream_id, int plane_index)
{ … }
static void remove_pipes_from_blend_trees(struct dml2_context *ctx, struct dc_state *state, struct dc_plane_pipe_pool *pipe_pool, unsigned int odm_slice)
{ … }
static void map_pipes_for_stream(struct dml2_context *ctx, struct dc_state *state, const struct dc_stream_state *stream,
struct dc_pipe_mapping_scratch *scratch, const struct dc_state *existing_state)
{ … }
static void map_pipes_for_plane(struct dml2_context *ctx, struct dc_state *state, const struct dc_stream_state *stream, const struct dc_plane_state *plane,
int plane_index, struct dc_pipe_mapping_scratch *scratch, const struct dc_state *existing_state)
{ … }
static unsigned int get_target_mpc_factor(struct dml2_context *ctx,
struct dc_state *state,
const struct dml_display_cfg_st *disp_cfg,
struct dml2_dml_to_dc_pipe_mapping *mapping,
const struct dc_stream_status *status,
const struct dc_stream_state *stream,
int plane_idx)
{ … }
static unsigned int get_target_odm_factor(
const struct dml2_context *ctx,
struct dc_state *state,
const struct dml_display_cfg_st *disp_cfg,
struct dml2_dml_to_dc_pipe_mapping *mapping,
const struct dc_stream_state *stream)
{ … }
static unsigned int get_source_odm_factor(const struct dml2_context *ctx,
struct dc_state *state,
const struct dc_stream_state *stream)
{ … }
static unsigned int get_source_mpc_factor(const struct dml2_context *ctx,
struct dc_state *state,
const struct dc_plane_state *plane)
{ … }
static void populate_mpc_factors_for_stream(
struct dml2_context *ctx,
const struct dml_display_cfg_st *disp_cfg,
struct dml2_dml_to_dc_pipe_mapping *mapping,
struct dc_state *state,
unsigned int stream_idx,
struct dml2_pipe_combine_factor odm_factor,
struct dml2_pipe_combine_factor mpc_factors[MAX_PIPES])
{ … }
static void populate_odm_factors(const struct dml2_context *ctx,
const struct dml_display_cfg_st *disp_cfg,
struct dml2_dml_to_dc_pipe_mapping *mapping,
struct dc_state *state,
struct dml2_pipe_combine_factor odm_factors[MAX_PIPES])
{ … }
static bool unmap_dc_pipes_for_stream(struct dml2_context *ctx,
struct dc_state *state,
const struct dc_state *existing_state,
const struct dc_stream_state *stream,
const struct dc_stream_status *status,
struct dml2_pipe_combine_factor odm_factor,
struct dml2_pipe_combine_factor mpc_factors[MAX_PIPES])
{ … }
static bool map_dc_pipes_for_stream(struct dml2_context *ctx,
struct dc_state *state,
const struct dc_state *existing_state,
const struct dc_stream_state *stream,
const struct dc_stream_status *status,
struct dml2_pipe_combine_factor odm_factor,
struct dml2_pipe_combine_factor mpc_factors[MAX_PIPES])
{ … }
static bool map_dc_pipes_with_callbacks(struct dml2_context *ctx,
struct dc_state *state,
const struct dml_display_cfg_st *disp_cfg,
struct dml2_dml_to_dc_pipe_mapping *mapping,
const struct dc_state *existing_state)
{ … }
bool dml2_map_dc_pipes(struct dml2_context *ctx, struct dc_state *state, const struct dml_display_cfg_st *disp_cfg, struct dml2_dml_to_dc_pipe_mapping *mapping, const struct dc_state *existing_state)
{ … }