Commit 9d432419 authored by Dillon Varone's avatar Dillon Varone Committed by Alex Deucher

drm/amd/display: Refactor DML2 interfaces

[Why&How}
Some interfaces needed changes to support future architectures.
Reviewed-by: default avatarChaitanya Dhere <chaitanya.dhere@amd.com>
Acked-by: default avatarTom Chung <chiahsuan.chung@amd.com>
Signed-off-by: default avatarDillon Varone <dillon.varone@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 8cffa89b
......@@ -340,7 +340,7 @@ 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(
struct dc *dc,
const struct dc *dc,
struct dc_state *state,
struct dc_stream_state *stream)
{
......@@ -369,7 +369,7 @@ enum dc_status dc_state_add_stream(
* dc_state_remove_stream() - Remove a stream from a dc_state.
*/
enum dc_status dc_state_remove_stream(
struct dc *dc,
const struct dc *dc,
struct dc_state *state,
struct dc_stream_state *stream)
{
......@@ -679,7 +679,7 @@ void dc_state_release_phantom_stream(const struct dc *dc,
dc_stream_release(phantom_stream);
}
struct dc_plane_state *dc_state_create_phantom_plane(struct dc *dc,
struct dc_plane_state *dc_state_create_phantom_plane(const struct dc *dc,
struct dc_state *state,
struct dc_plane_state *main_plane)
{
......@@ -715,7 +715,7 @@ void dc_state_release_phantom_plane(const struct dc *dc,
}
/* add phantom streams to context and generate correct meta inside dc_state */
enum dc_status dc_state_add_phantom_stream(struct dc *dc,
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)
......@@ -741,7 +741,7 @@ enum dc_status dc_state_add_phantom_stream(struct dc *dc,
return res;
}
enum dc_status dc_state_remove_phantom_stream(struct dc *dc,
enum dc_status dc_state_remove_phantom_stream(const struct dc *dc,
struct dc_state *state,
struct dc_stream_state *phantom_stream)
{
......@@ -835,7 +835,7 @@ bool dc_state_add_all_phantom_planes_for_stream(
}
bool dc_state_remove_phantom_streams_and_planes(
struct dc *dc,
const struct dc *dc,
struct dc_state *state)
{
int i;
......@@ -857,7 +857,7 @@ bool dc_state_remove_phantom_streams_and_planes(
}
void dc_state_release_phantom_streams_and_planes(
struct dc *dc,
const struct dc *dc,
struct dc_state *state)
{
int i;
......
......@@ -103,7 +103,7 @@ void enable_surface_flip_reporting(struct dc_plane_state *plane_state,
/*register_flip_interrupt(surface);*/
}
struct dc_plane_state *dc_create_plane_state(struct dc *dc)
struct dc_plane_state *dc_create_plane_state(const struct dc *dc)
{
struct dc_plane_state *plane_state = kvzalloc(sizeof(*plane_state),
GFP_KERNEL);
......
......@@ -996,6 +996,7 @@ struct dc_debug_options {
bool enable_idle_reg_checks;
unsigned int static_screen_wait_frames;
bool force_chroma_subsampling_1tap;
bool disable_422_left_edge_pixel;
};
struct gpu_info_soc_bounding_box_v1_0;
......
......@@ -29,7 +29,7 @@
#include "dc.h"
#include "dc_hw_types.h"
struct dc_plane_state *dc_create_plane_state(struct dc *dc);
struct dc_plane_state *dc_create_plane_state(const struct dc *dc);
const struct dc_plane_status *dc_plane_get_status(
const struct dc_plane_state *plane_state);
void dc_plane_state_retain(struct dc_plane_state *plane_state);
......
......@@ -39,12 +39,12 @@ void dc_state_destruct(struct dc_state *state);
void dc_state_retain(struct dc_state *state);
void dc_state_release(struct dc_state *state);
enum dc_status dc_state_add_stream(struct dc *dc,
enum dc_status dc_state_add_stream(const struct dc *dc,
struct dc_state *state,
struct dc_stream_state *stream);
enum dc_status dc_state_remove_stream(
struct dc *dc,
const struct dc *dc,
struct dc_state *state,
struct dc_stream_state *stream);
......
......@@ -47,7 +47,7 @@ struct dc_stream_state *dc_state_get_paired_subvp_stream(const struct dc_state *
struct dc_stream_state *dc_state_create_phantom_stream(const struct dc *dc,
struct dc_state *state,
struct dc_stream_state *main_stream);
struct dc_plane_state *dc_state_create_phantom_plane(struct dc *dc,
struct dc_plane_state *dc_state_create_phantom_plane(const struct dc *dc,
struct dc_state *state,
struct dc_plane_state *main_plane);
......@@ -60,11 +60,11 @@ void dc_state_release_phantom_plane(const struct dc *dc,
struct dc_plane_state *phantom_plane);
/* add/remove phantom stream to context and generate subvp meta data */
enum dc_status dc_state_add_phantom_stream(struct dc *dc,
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(struct dc *dc,
enum dc_status dc_state_remove_phantom_stream(const struct dc *dc,
struct dc_state *state,
struct dc_stream_state *phantom_stream);
......@@ -94,11 +94,11 @@ bool dc_state_add_all_phantom_planes_for_stream(
struct dc_state *state);
bool dc_state_remove_phantom_streams_and_planes(
struct dc *dc,
const struct dc *dc,
struct dc_state *state);
void dc_state_release_phantom_streams_and_planes(
struct dc *dc,
const struct dc *dc,
struct dc_state *state);
#endif /* _DC_STATE_PRIV_H_ */
......@@ -794,7 +794,7 @@ static void map_pipes_for_plane(struct dml2_context *ctx, struct dc_state *state
}
static unsigned int get_mpc_factor(struct dml2_context *ctx,
const struct dc_state *state,
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,
......@@ -805,10 +805,10 @@ static unsigned int get_mpc_factor(struct dml2_context *ctx,
unsigned int cfg_idx;
unsigned int mpc_factor;
get_plane_id(ctx, state, status->plane_states[plane_idx],
stream->stream_id, plane_idx, &plane_id);
cfg_idx = find_disp_cfg_idx_by_plane_id(mapping, plane_id);
if (ctx->architecture == dml2_architecture_20) {
get_plane_id(ctx, state, status->plane_states[plane_idx],
stream->stream_id, plane_idx, &plane_id);
cfg_idx = find_disp_cfg_idx_by_plane_id(mapping, plane_id);
mpc_factor = (unsigned int)disp_cfg->hw.DPPPerSurface[cfg_idx];
} else {
mpc_factor = 1;
......@@ -824,14 +824,16 @@ static unsigned int get_mpc_factor(struct dml2_context *ctx,
static unsigned int get_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)
{
unsigned int cfg_idx = find_disp_cfg_idx_by_stream_id(
mapping, stream->stream_id);
unsigned int cfg_idx;
if (ctx->architecture == dml2_architecture_20)
if (ctx->architecture == dml2_architecture_20) {
cfg_idx = find_disp_cfg_idx_by_stream_id(
mapping, stream->stream_id);
switch (disp_cfg->hw.ODMMode[cfg_idx]) {
case dml_odm_mode_bypass:
return 1;
......@@ -842,6 +844,7 @@ static unsigned int get_odm_factor(
default:
break;
}
}
ASSERT(false);
return 1;
}
......@@ -850,7 +853,7 @@ 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,
const struct dc_state *state,
struct dc_state *state,
unsigned int stream_idx,
unsigned int odm_factor,
unsigned int mpc_factors[MAX_PIPES])
......@@ -870,14 +873,14 @@ static void populate_mpc_factors_for_stream(
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,
const struct dc_state *state,
struct dc_state *state,
unsigned int odm_factors[MAX_PIPES])
{
int i;
for (i = 0; i < state->stream_count; i++)
odm_factors[i] = get_odm_factor(
ctx, disp_cfg, mapping, state->streams[i]);
ctx, state, disp_cfg, mapping, state->streams[i]);
}
static bool map_dc_pipes_for_stream(struct dml2_context *ctx,
......
......@@ -681,7 +681,7 @@ static void dml2_apply_debug_options(const struct dc *dc, struct dml2_context *d
}
}
bool dml2_validate(struct dc *in_dc, struct dc_state *context, bool fast_validate)
bool dml2_validate(const struct dc *in_dc, struct dc_state *context, bool fast_validate)
{
bool out = false;
......
......@@ -109,10 +109,10 @@ struct dml2_dc_svp_callbacks {
struct dc_stream_state* (*create_phantom_stream)(const struct dc *dc,
struct dc_state *state,
struct dc_stream_state *main_stream);
struct dc_plane_state* (*create_phantom_plane)(struct dc *dc,
struct dc_plane_state* (*create_phantom_plane)(const struct dc *dc,
struct dc_state *state,
struct dc_plane_state *main_plane);
enum dc_status (*add_phantom_stream)(struct dc *dc,
enum dc_status (*add_phantom_stream)(const struct dc *dc,
struct dc_state *state,
struct dc_stream_state *phantom_stream,
struct dc_stream_state *main_stream);
......@@ -121,7 +121,7 @@ struct dml2_dc_svp_callbacks {
struct dc_stream_state *stream,
struct dc_plane_state *plane_state,
struct dc_state *context);
enum dc_status (*remove_phantom_stream)(struct dc *dc,
enum dc_status (*remove_phantom_stream)(const struct dc *dc,
struct dc_state *state,
struct dc_stream_state *stream);
void (*release_phantom_plane)(const struct dc *dc,
......@@ -135,10 +135,10 @@ struct dml2_dc_svp_callbacks {
enum mall_stream_type (*get_stream_subvp_type)(const struct dc_state *state, const struct dc_stream_state *stream);
struct dc_stream_state *(*get_paired_subvp_stream)(const struct dc_state *state, const struct dc_stream_state *stream);
bool (*remove_phantom_streams_and_planes)(
struct dc *dc,
const struct dc *dc,
struct dc_state *state);
void (*release_phantom_streams_and_planes)(
struct dc *dc,
const struct dc *dc,
struct dc_state *state);
unsigned int (*calculate_mall_ways_from_bytes)(
const struct dc *dc,
......@@ -264,7 +264,7 @@ void dml2_reinit(const struct dc *in_dc,
* separate dc_states for validation.
* Return: True if mode is supported, false otherwise.
*/
bool dml2_validate(struct dc *in_dc,
bool dml2_validate(const struct dc *in_dc,
struct dc_state *context,
bool fast_validate);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment