Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 44af70a7 authored by Leo (Sunpeng) Li's avatar Leo (Sunpeng) Li Committed by Alex Deucher
Browse files

drm/amd/display: Expose dither setting functionality to Linux



We will need this to disable dither for CRC capture.

Signed-off-by: default avatarLeo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 236d0e4f
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -300,6 +300,37 @@ bool dc_stream_get_crc(struct dc *dc, struct dc_stream_state *stream,
	return false;
}

void dc_stream_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(&params, 0, sizeof(params));
	if (!pipes)
		return;
	if (option > DITHER_OPTION_MAX)
		return;

	stream->dither_option = option;

	resource_build_bit_depth_reduction_params(stream,
				&params);
	stream->bit_depth_params = params;
	pipes->stream_res.opp->funcs->
		opp_program_bit_depth_reduction(pipes->stream_res.opp, &params);
}

void dc_stream_set_static_screen_events(struct dc *dc,
		struct dc_stream_state **streams,
		int num_streams,
+3 −0
Original line number Diff line number Diff line
@@ -287,6 +287,9 @@ void dc_stream_set_static_screen_events(struct dc *dc,
					int num_streams,
					const struct dc_static_screen_events *events);

void dc_stream_set_dither_option(struct dc_stream_state *stream,
				 enum dc_dither_option option);


bool dc_stream_adjust_vmin_vmax(struct dc *dc,
				struct dc_stream_state **stream,