return false;
}
-static bool stream_adjust_vmin_vmax(struct dc *dc,
+bool dc_stream_adjust_vmin_vmax(struct dc *dc,
struct dc_stream_state **streams, int num_streams,
int vmin, int vmax)
{
return ret;
}
-static bool stream_get_crtc_position(struct dc *dc,
+bool dc_stream_get_crtc_position(struct dc *dc,
struct dc_stream_state **streams, int num_streams,
unsigned int *v_pos, unsigned int *nom_v_pos)
{
return ret;
}
-static bool set_gamut_remap(struct dc *dc, const struct dc_stream_state *stream)
-{
- int i = 0;
- bool ret = false;
- struct pipe_ctx *pipes;
-
- for (i = 0; i < MAX_PIPES; i++) {
- if (dc->current_state->res_ctx.pipe_ctx[i].stream == stream) {
- pipes = &dc->current_state->res_ctx.pipe_ctx[i];
- dc->hwss.program_gamut_remap(pipes);
- ret = true;
- }
- }
-
- return ret;
-}
-
-static bool program_csc_matrix(struct dc *dc, struct dc_stream_state *stream)
-{
- int i = 0;
- bool ret = false;
- struct pipe_ctx *pipes;
-
- for (i = 0; i < MAX_PIPES; i++) {
- if (dc->current_state->res_ctx.pipe_ctx[i].stream
- == stream) {
-
- pipes = &dc->current_state->res_ctx.pipe_ctx[i];
- dc->hwss.program_csc_matrix(pipes,
- stream->output_color_space,
- stream->csc_color_matrix.matrix);
- ret = true;
- }
- }
-
- return ret;
-}
-
-static void set_static_screen_events(struct dc *dc,
+void dc_stream_set_static_screen_events(struct dc *dc,
struct dc_stream_state **streams,
int num_streams,
const struct dc_static_screen_events *events)
cust_pattern_size);
}
-static void set_dither_option(struct dc_stream_state *stream,
- enum dc_dither_option option)
-{
- struct bit_depth_reduction_params params;
- struct dc_link *link = stream->status.link;
- struct pipe_ctx *pipes = NULL;
- int i;
-
- for (i = 0; i < MAX_PIPES; i++) {
- if (link->dc->current_state->res_ctx.pipe_ctx[i].stream ==
- stream) {
- pipes = &link->dc->current_state->res_ctx.pipe_ctx[i];
- break;
- }
- }
-
- memset(¶ms, 0, sizeof(params));
- if (!pipes)
- return;
- if (option > DITHER_OPTION_MAX)
- return;
-
- stream->dither_option = option;
-
- resource_build_bit_depth_reduction_params(stream,
- ¶ms);
- stream->bit_depth_params = params;
- pipes->stream_res.opp->funcs->
- opp_program_bit_depth_reduction(pipes->stream_res.opp, ¶ms);
-}
-
-void set_dpms(
- struct dc *dc,
- struct dc_stream_state *stream,
- bool dpms_off)
-{
- struct pipe_ctx *pipe_ctx = NULL;
- int i;
-
- for (i = 0; i < MAX_PIPES; i++) {
- if (dc->current_state->res_ctx.pipe_ctx[i].stream == stream) {
- pipe_ctx = &dc->current_state->res_ctx.pipe_ctx[i];
- break;
- }
- }
-
- if (!pipe_ctx) {
- ASSERT(0);
- return;
- }
-
- if (stream->dpms_off != dpms_off) {
- stream->dpms_off = dpms_off;
-
- if (dpms_off) {
- core_link_disable_stream(pipe_ctx,
- KEEP_ACQUIRED_RESOURCE);
-
- dc->hwss.pplib_apply_display_requirements(
- dc, dc->current_state);
- } else {
- dc->hwss.pplib_apply_display_requirements(
- dc, dc->current_state);
-
- core_link_enable_stream(dc->current_state, pipe_ctx);
- }
- }
-}
-
static void allocate_dc_stream_funcs(struct dc *dc)
{
- if (dc->hwss.set_drr != NULL) {
- dc->stream_funcs.adjust_vmin_vmax =
- stream_adjust_vmin_vmax;
- }
-
- dc->stream_funcs.set_static_screen_events =
- set_static_screen_events;
-
- dc->stream_funcs.get_crtc_position =
- stream_get_crtc_position;
-
- dc->stream_funcs.set_gamut_remap =
- set_gamut_remap;
-
- dc->stream_funcs.program_csc_matrix =
- program_csc_matrix;
-
- dc->stream_funcs.set_dither_option =
- set_dither_option;
-
- dc->stream_funcs.set_dpms =
- set_dpms;
-
dc->link_funcs.set_drive_settings =
set_drive_settings;
#define MOD_FREESYNC_TO_CORE(mod_freesync)\
container_of(mod_freesync, struct core_freesync, public)
-static bool check_dc_support(const struct dc *dc)
-{
- if (dc->stream_funcs.adjust_vmin_vmax == NULL)
- return false;
-
- return true;
-}
-
struct mod_freesync *mod_freesync_create(struct dc *dc)
{
struct core_freesync *core_freesync =
core_freesync->dc = dc;
- if (!check_dc_support(dc))
- goto fail_construct;
-
/* Create initial module folder in registry for freesync enable data */
flag.save_per_edid = true;
flag.save_per_link = false;
update_stream_freesync_context(core_freesync,
streams[stream_idx]);
- core_freesync->dc->stream_funcs.
- adjust_vmin_vmax(core_freesync->dc, streams,
- num_streams, v_total_min,
- v_total_max);
+ dc_stream_adjust_vmin_vmax(core_freesync->dc, streams,
+ num_streams, v_total_min,
+ v_total_max);
return true;
core_freesync,
streams[stream_idx]);
- core_freesync->dc->stream_funcs.
- adjust_vmin_vmax(
+ dc_stream_adjust_vmin_vmax(
core_freesync->dc, streams,
num_streams, v_total_nominal,
v_total_nominal);
core_freesync,
streams[stream_idx]);
- core_freesync->dc->stream_funcs.
- adjust_vmin_vmax(
- core_freesync->dc, streams,
- num_streams, v_total_nominal,
- v_total_nominal);
+ dc_stream_adjust_vmin_vmax(core_freesync->dc, streams,
+ num_streams, v_total_nominal,
+ v_total_nominal);
/* Reset the cached variables */
reset_freesync_state_variables(state);
* not support freesync because a former stream has
* be programmed
*/
- core_freesync->dc->stream_funcs.
- adjust_vmin_vmax(
- core_freesync->dc, streams,
- num_streams, v_total_nominal,
- v_total_nominal);
+ dc_stream_adjust_vmin_vmax(core_freesync->dc, streams,
+ num_streams, v_total_nominal,
+ v_total_nominal);
/* Reset the cached variables */
reset_freesync_state_variables(state);
}
vmin = inserted_frame_v_total;
/* Program V_TOTAL */
- core_freesync->dc->stream_funcs.adjust_vmin_vmax(
- core_freesync->dc, streams,
- num_streams, vmin, vmax);
+ dc_stream_adjust_vmin_vmax(core_freesync->dc, streams,
+ num_streams, vmin, vmax);
}
if (state->btr.frame_counter > 0)
update_stream_freesync_context(core_freesync, streams[0]);
/* Program static screen ramp values */
- core_freesync->dc->stream_funcs.adjust_vmin_vmax(
- core_freesync->dc, streams,
- num_streams, v_total,
- v_total);
+ dc_stream_adjust_vmin_vmax(core_freesync->dc, streams,
+ num_streams, v_total,
+ v_total);
triggers.overlay_update = true;
triggers.surface_update = true;
- core_freesync->dc->stream_funcs.set_static_screen_events(
- core_freesync->dc, streams, num_streams,
- &triggers);
+ dc_stream_set_static_screen_events(core_freesync->dc, streams,
+ num_streams, &triggers);
}
}
triggers.overlay_update = true;
triggers.surface_update = true;
- core_freesync->dc->stream_funcs.set_static_screen_events(
- core_freesync->dc, streams, num_streams,
- &triggers);
+ dc_stream_set_static_screen_events(core_freesync->dc, streams,
+ num_streams, &triggers);
if (freesync_program_required)
/* Program freesync according to current state*/
max_refresh);
/* Program vtotal min/max */
- core_freesync->dc->stream_funcs.adjust_vmin_vmax(
- core_freesync->dc, &streams, 1,
- state->freesync_range.vmin,
- state->freesync_range.vmax);
+ dc_stream_adjust_vmin_vmax(core_freesync->dc, &streams, 1,
+ state->freesync_range.vmin,
+ state->freesync_range.vmax);
}
if (min_refresh != 0 &&
core_freesync = MOD_FREESYNC_TO_CORE(mod_freesync);
index = map_index_from_stream(core_freesync, stream);
- if (core_freesync->dc->stream_funcs.get_crtc_position(
- core_freesync->dc, &stream, 1,
- &position.vertical_count, &position.nominal_vcount)) {
+ if (dc_stream_get_crtc_position(core_freesync->dc, &stream, 1,
+ &position.vertical_count,
+ &position.nominal_vcount)) {
*nom_v_pos = position.nominal_vcount;
*v_pos = position.vertical_count;
triggers.overlay_update = true;
triggers.surface_update = true;
- core_freesync->dc->stream_funcs.set_static_screen_events(
- core_freesync->dc, streams, num_streams,
- &triggers);
+ dc_stream_set_static_screen_events(core_freesync->dc,
+ streams, num_streams,
+ &triggers);
}
}
vmax = vmin;
- core_freesync->dc->stream_funcs.adjust_vmin_vmax(
- core_freesync->dc, &stream,
- 1, vmin,
- vmax);
+ dc_stream_adjust_vmin_vmax(core_freesync->dc, &stream,
+ 1, vmin, vmax);
}
}