2 * Copyright 2015 Advanced Micro Devices, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
25 #include "dm_services.h"
27 #include "dc_bios_types.h"
28 #include "core_types.h"
29 #include "core_status.h"
31 #include "dm_helpers.h"
32 #include "dce110_hw_sequencer.h"
33 #include "dce110_timing_generator.h"
34 #include "dce/dce_hwseq.h"
35 #include "gpio_service_interface.h"
37 #include "dce110_compressor.h"
39 #include "bios/bios_parser_helper.h"
40 #include "timing_generator.h"
41 #include "mem_input.h"
44 #include "transform.h"
45 #include "stream_encoder.h"
46 #include "link_encoder.h"
47 #include "link_hwss.h"
48 #include "clock_source.h"
51 #include "reg_helper.h"
53 /* include DCE11 register header files */
54 #include "dce/dce_11_0_d.h"
55 #include "dce/dce_11_0_sh_mask.h"
56 #include "custom_float.h"
58 #include "atomfirmware.h"
61 * All values are in milliseconds;
62 * For eDP, after power-up/power/down,
63 * 300/500 msec max. delay from LCDVCC to black video generation
65 #define PANEL_POWER_UP_TIMEOUT 300
66 #define PANEL_POWER_DOWN_TIMEOUT 500
67 #define HPD_CHECK_INTERVAL 10
72 #define DC_LOGGER_INIT()
78 #define FN(reg_name, field_name) \
79 hws->shifts->field_name, hws->masks->field_name
81 struct dce110_hw_seq_reg_offsets {
85 static const struct dce110_hw_seq_reg_offsets reg_offsets[] = {
87 .crtc = (mmCRTC0_CRTC_GSL_CONTROL - mmCRTC_GSL_CONTROL),
90 .crtc = (mmCRTC1_CRTC_GSL_CONTROL - mmCRTC_GSL_CONTROL),
93 .crtc = (mmCRTC2_CRTC_GSL_CONTROL - mmCRTC_GSL_CONTROL),
96 .crtc = (mmCRTCV_GSL_CONTROL - mmCRTC_GSL_CONTROL),
100 #define HW_REG_BLND(reg, id)\
101 (reg + reg_offsets[id].blnd)
103 #define HW_REG_CRTC(reg, id)\
104 (reg + reg_offsets[id].crtc)
106 #define MAX_WATERMARK 0xFFFF
107 #define SAFE_NBP_MARK 0x7FFF
109 /*******************************************************************************
110 * Private definitions
111 ******************************************************************************/
112 /***************************PIPE_CONTROL***********************************/
113 static void dce110_init_pte(struct dc_context *ctx)
117 uint32_t chunk_int = 0;
118 uint32_t chunk_mul = 0;
120 addr = mmUNP_DVMM_PTE_CONTROL;
121 value = dm_read_reg(ctx, addr);
127 DVMM_USE_SINGLE_PTE);
133 DVMM_PTE_BUFFER_MODE0);
139 DVMM_PTE_BUFFER_MODE1);
141 dm_write_reg(ctx, addr, value);
143 addr = mmDVMM_PTE_REQ;
144 value = dm_read_reg(ctx, addr);
146 chunk_int = get_reg_field_value(
149 HFLIP_PTEREQ_PER_CHUNK_INT);
151 chunk_mul = get_reg_field_value(
154 HFLIP_PTEREQ_PER_CHUNK_MULTIPLIER);
156 if (chunk_int != 0x4 || chunk_mul != 0x4) {
162 MAX_PTEREQ_TO_ISSUE);
168 HFLIP_PTEREQ_PER_CHUNK_INT);
174 HFLIP_PTEREQ_PER_CHUNK_MULTIPLIER);
176 dm_write_reg(ctx, addr, value);
179 /**************************************************************************/
181 static void enable_display_pipe_clock_gating(
182 struct dc_context *ctx,
188 static bool dce110_enable_display_power_gating(
190 uint8_t controller_id,
192 enum pipe_gating_control power_gating)
194 enum bp_result bp_result = BP_RESULT_OK;
195 enum bp_pipe_control_action cntl;
196 struct dc_context *ctx = dc->ctx;
197 unsigned int underlay_idx = dc->res_pool->underlay_pipe_index;
199 if (IS_FPGA_MAXIMUS_DC(ctx->dce_environment))
202 if (power_gating == PIPE_GATING_CONTROL_INIT)
203 cntl = ASIC_PIPE_INIT;
204 else if (power_gating == PIPE_GATING_CONTROL_ENABLE)
205 cntl = ASIC_PIPE_ENABLE;
207 cntl = ASIC_PIPE_DISABLE;
209 if (controller_id == underlay_idx)
210 controller_id = CONTROLLER_ID_UNDERLAY0 - 1;
212 if (power_gating != PIPE_GATING_CONTROL_INIT || controller_id == 0){
214 bp_result = dcb->funcs->enable_disp_power_gating(
215 dcb, controller_id + 1, cntl);
217 /* Revert MASTER_UPDATE_MODE to 0 because bios sets it 2
218 * by default when command table is called
220 * Bios parser accepts controller_id = 6 as indicative of
221 * underlay pipe in dce110. But we do not support more
224 if (controller_id < CONTROLLER_ID_MAX - 1)
226 HW_REG_CRTC(mmCRTC_MASTER_UPDATE_MODE, controller_id),
230 if (power_gating != PIPE_GATING_CONTROL_ENABLE)
231 dce110_init_pte(ctx);
233 if (bp_result == BP_RESULT_OK)
239 static void build_prescale_params(struct ipp_prescale_params *prescale_params,
240 const struct dc_plane_state *plane_state)
242 prescale_params->mode = IPP_PRESCALE_MODE_FIXED_UNSIGNED;
244 switch (plane_state->format) {
245 case SURFACE_PIXEL_FORMAT_GRPH_RGB565:
246 prescale_params->scale = 0x2082;
248 case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888:
249 case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
250 prescale_params->scale = 0x2020;
252 case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
253 case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
254 prescale_params->scale = 0x2008;
256 case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616:
257 case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F:
258 prescale_params->scale = 0x2000;
267 dce110_set_input_transfer_func(struct pipe_ctx *pipe_ctx,
268 const struct dc_plane_state *plane_state)
270 struct input_pixel_processor *ipp = pipe_ctx->plane_res.ipp;
271 const struct dc_transfer_func *tf = NULL;
272 struct ipp_prescale_params prescale_params = { 0 };
278 if (plane_state->in_transfer_func)
279 tf = plane_state->in_transfer_func;
281 build_prescale_params(&prescale_params, plane_state);
282 ipp->funcs->ipp_program_prescale(ipp, &prescale_params);
284 if (plane_state->gamma_correction &&
285 !plane_state->gamma_correction->is_identity &&
286 dce_use_lut(plane_state->format))
287 ipp->funcs->ipp_program_input_lut(ipp, plane_state->gamma_correction);
290 /* Default case if no input transfer function specified */
291 ipp->funcs->ipp_set_degamma(ipp, IPP_DEGAMMA_MODE_HW_sRGB);
292 } else if (tf->type == TF_TYPE_PREDEFINED) {
294 case TRANSFER_FUNCTION_SRGB:
295 ipp->funcs->ipp_set_degamma(ipp, IPP_DEGAMMA_MODE_HW_sRGB);
297 case TRANSFER_FUNCTION_BT709:
298 ipp->funcs->ipp_set_degamma(ipp, IPP_DEGAMMA_MODE_HW_xvYCC);
300 case TRANSFER_FUNCTION_LINEAR:
301 ipp->funcs->ipp_set_degamma(ipp, IPP_DEGAMMA_MODE_BYPASS);
303 case TRANSFER_FUNCTION_PQ:
308 } else if (tf->type == TF_TYPE_BYPASS) {
309 ipp->funcs->ipp_set_degamma(ipp, IPP_DEGAMMA_MODE_BYPASS);
311 /*TF_TYPE_DISTRIBUTED_POINTS - Not supported in DCE 11*/
318 static bool convert_to_custom_float(struct pwl_result_data *rgb_resulted,
319 struct curve_points *arr_points,
320 uint32_t hw_points_num)
322 struct custom_float_format fmt;
324 struct pwl_result_data *rgb = rgb_resulted;
328 fmt.exponenta_bits = 6;
329 fmt.mantissa_bits = 12;
332 if (!convert_to_custom_float_format(arr_points[0].x, &fmt,
333 &arr_points[0].custom_float_x)) {
338 if (!convert_to_custom_float_format(arr_points[0].offset, &fmt,
339 &arr_points[0].custom_float_offset)) {
344 if (!convert_to_custom_float_format(arr_points[0].slope, &fmt,
345 &arr_points[0].custom_float_slope)) {
350 fmt.mantissa_bits = 10;
353 if (!convert_to_custom_float_format(arr_points[1].x, &fmt,
354 &arr_points[1].custom_float_x)) {
359 if (!convert_to_custom_float_format(arr_points[1].y, &fmt,
360 &arr_points[1].custom_float_y)) {
365 if (!convert_to_custom_float_format(arr_points[1].slope, &fmt,
366 &arr_points[1].custom_float_slope)) {
371 fmt.mantissa_bits = 12;
374 while (i != hw_points_num) {
375 if (!convert_to_custom_float_format(rgb->red, &fmt,
381 if (!convert_to_custom_float_format(rgb->green, &fmt,
387 if (!convert_to_custom_float_format(rgb->blue, &fmt,
393 if (!convert_to_custom_float_format(rgb->delta_red, &fmt,
394 &rgb->delta_red_reg)) {
399 if (!convert_to_custom_float_format(rgb->delta_green, &fmt,
400 &rgb->delta_green_reg)) {
405 if (!convert_to_custom_float_format(rgb->delta_blue, &fmt,
406 &rgb->delta_blue_reg)) {
418 #define MAX_LOW_POINT 25
419 #define NUMBER_REGIONS 16
420 #define NUMBER_SW_SEGMENTS 16
423 dce110_translate_regamma_to_hw_format(const struct dc_transfer_func *output_tf,
424 struct pwl_params *regamma_params)
426 struct curve_points *arr_points;
427 struct pwl_result_data *rgb_resulted;
428 struct pwl_result_data *rgb;
429 struct pwl_result_data *rgb_plus_1;
430 struct fixed31_32 y_r;
431 struct fixed31_32 y_g;
432 struct fixed31_32 y_b;
433 struct fixed31_32 y1_min;
434 struct fixed31_32 y3_max;
436 int32_t region_start, region_end;
437 uint32_t i, j, k, seg_distr[NUMBER_REGIONS], increment, start_index, hw_points;
439 if (output_tf == NULL || regamma_params == NULL || output_tf->type == TF_TYPE_BYPASS)
442 arr_points = regamma_params->arr_points;
443 rgb_resulted = regamma_params->rgb_resulted;
446 memset(regamma_params, 0, sizeof(struct pwl_params));
448 if (output_tf->tf == TRANSFER_FUNCTION_PQ) {
450 * segments are from 2^-11 to 2^5
453 region_end = region_start + NUMBER_REGIONS;
455 for (i = 0; i < NUMBER_REGIONS; i++)
460 * segment is from 2^-10 to 2^1
461 * We include an extra segment for range [2^0, 2^1). This is to
462 * ensure that colors with normalized values of 1 don't miss the
486 for (k = 0; k < 16; k++) {
487 if (seg_distr[k] != -1)
488 hw_points += (1 << seg_distr[k]);
492 for (k = 0; k < (region_end - region_start); k++) {
493 increment = NUMBER_SW_SEGMENTS / (1 << seg_distr[k]);
494 start_index = (region_start + k + MAX_LOW_POINT) *
496 for (i = start_index; i < start_index + NUMBER_SW_SEGMENTS;
498 if (j == hw_points - 1)
500 rgb_resulted[j].red = output_tf->tf_pts.red[i];
501 rgb_resulted[j].green = output_tf->tf_pts.green[i];
502 rgb_resulted[j].blue = output_tf->tf_pts.blue[i];
508 start_index = (region_end + MAX_LOW_POINT) * NUMBER_SW_SEGMENTS;
509 rgb_resulted[hw_points - 1].red = output_tf->tf_pts.red[start_index];
510 rgb_resulted[hw_points - 1].green = output_tf->tf_pts.green[start_index];
511 rgb_resulted[hw_points - 1].blue = output_tf->tf_pts.blue[start_index];
513 arr_points[0].x = dc_fixpt_pow(dc_fixpt_from_int(2),
514 dc_fixpt_from_int(region_start));
515 arr_points[1].x = dc_fixpt_pow(dc_fixpt_from_int(2),
516 dc_fixpt_from_int(region_end));
518 y_r = rgb_resulted[0].red;
519 y_g = rgb_resulted[0].green;
520 y_b = rgb_resulted[0].blue;
522 y1_min = dc_fixpt_min(y_r, dc_fixpt_min(y_g, y_b));
524 arr_points[0].y = y1_min;
525 arr_points[0].slope = dc_fixpt_div(arr_points[0].y,
528 y_r = rgb_resulted[hw_points - 1].red;
529 y_g = rgb_resulted[hw_points - 1].green;
530 y_b = rgb_resulted[hw_points - 1].blue;
532 /* see comment above, m_arrPoints[1].y should be the Y value for the
533 * region end (m_numOfHwPoints), not last HW point(m_numOfHwPoints - 1)
535 y3_max = dc_fixpt_max(y_r, dc_fixpt_max(y_g, y_b));
537 arr_points[1].y = y3_max;
539 arr_points[1].slope = dc_fixpt_zero;
541 if (output_tf->tf == TRANSFER_FUNCTION_PQ) {
542 /* for PQ, we want to have a straight line from last HW X point,
543 * and the slope to be such that we hit 1.0 at 10000 nits.
545 const struct fixed31_32 end_value = dc_fixpt_from_int(125);
547 arr_points[1].slope = dc_fixpt_div(
548 dc_fixpt_sub(dc_fixpt_one, arr_points[1].y),
549 dc_fixpt_sub(end_value, arr_points[1].x));
552 regamma_params->hw_points_num = hw_points;
555 for (k = 0; k < 16 && i < 16; k++) {
556 if (seg_distr[k] != -1) {
557 regamma_params->arr_curve_points[k].segments_num = seg_distr[k];
558 regamma_params->arr_curve_points[i].offset =
559 regamma_params->arr_curve_points[k].offset + (1 << seg_distr[k]);
564 if (seg_distr[k] != -1)
565 regamma_params->arr_curve_points[k].segments_num = seg_distr[k];
568 rgb_plus_1 = rgb_resulted + 1;
572 while (i != hw_points + 1) {
573 if (dc_fixpt_lt(rgb_plus_1->red, rgb->red))
574 rgb_plus_1->red = rgb->red;
575 if (dc_fixpt_lt(rgb_plus_1->green, rgb->green))
576 rgb_plus_1->green = rgb->green;
577 if (dc_fixpt_lt(rgb_plus_1->blue, rgb->blue))
578 rgb_plus_1->blue = rgb->blue;
580 rgb->delta_red = dc_fixpt_sub(rgb_plus_1->red, rgb->red);
581 rgb->delta_green = dc_fixpt_sub(rgb_plus_1->green, rgb->green);
582 rgb->delta_blue = dc_fixpt_sub(rgb_plus_1->blue, rgb->blue);
589 convert_to_custom_float(rgb_resulted, arr_points, hw_points);
595 dce110_set_output_transfer_func(struct pipe_ctx *pipe_ctx,
596 const struct dc_stream_state *stream)
598 struct transform *xfm = pipe_ctx->plane_res.xfm;
600 xfm->funcs->opp_power_on_regamma_lut(xfm, true);
601 xfm->regamma_params.hw_points_num = GAMMA_HW_POINTS_NUM;
603 if (stream->out_transfer_func &&
604 stream->out_transfer_func->type == TF_TYPE_PREDEFINED &&
605 stream->out_transfer_func->tf == TRANSFER_FUNCTION_SRGB) {
606 xfm->funcs->opp_set_regamma_mode(xfm, OPP_REGAMMA_SRGB);
607 } else if (dce110_translate_regamma_to_hw_format(stream->out_transfer_func,
608 &xfm->regamma_params)) {
609 xfm->funcs->opp_program_regamma_pwl(xfm, &xfm->regamma_params);
610 xfm->funcs->opp_set_regamma_mode(xfm, OPP_REGAMMA_USER);
612 xfm->funcs->opp_set_regamma_mode(xfm, OPP_REGAMMA_BYPASS);
615 xfm->funcs->opp_power_on_regamma_lut(xfm, false);
620 static enum dc_status bios_parser_crtc_source_select(
621 struct pipe_ctx *pipe_ctx)
624 /* call VBIOS table to set CRTC source for the HW
626 * note: video bios clears all FMT setting here. */
627 struct bp_crtc_source_select crtc_source_select = {0};
628 const struct dc_sink *sink = pipe_ctx->stream->sink;
630 crtc_source_select.engine_id = pipe_ctx->stream_res.stream_enc->id;
631 crtc_source_select.controller_id = pipe_ctx->stream_res.tg->inst + 1;
632 /*TODO: Need to un-hardcode color depth, dp_audio and account for
633 * the case where signal and sink signal is different (translator
635 crtc_source_select.signal = pipe_ctx->stream->signal;
636 crtc_source_select.enable_dp_audio = false;
637 crtc_source_select.sink_signal = pipe_ctx->stream->signal;
639 switch (pipe_ctx->stream->timing.display_color_depth) {
640 case COLOR_DEPTH_666:
641 crtc_source_select.display_output_bit_depth = PANEL_6BIT_COLOR;
643 case COLOR_DEPTH_888:
644 crtc_source_select.display_output_bit_depth = PANEL_8BIT_COLOR;
646 case COLOR_DEPTH_101010:
647 crtc_source_select.display_output_bit_depth = PANEL_10BIT_COLOR;
649 case COLOR_DEPTH_121212:
650 crtc_source_select.display_output_bit_depth = PANEL_12BIT_COLOR;
654 crtc_source_select.display_output_bit_depth = PANEL_8BIT_COLOR;
658 dcb = sink->ctx->dc_bios;
660 if (BP_RESULT_OK != dcb->funcs->crtc_source_select(
662 &crtc_source_select)) {
663 return DC_ERROR_UNEXPECTED;
669 void dce110_update_info_frame(struct pipe_ctx *pipe_ctx)
674 ASSERT(pipe_ctx->stream);
676 if (pipe_ctx->stream_res.stream_enc == NULL)
677 return; /* this is not root pipe */
679 is_hdmi = dc_is_hdmi_signal(pipe_ctx->stream->signal);
680 is_dp = dc_is_dp_signal(pipe_ctx->stream->signal);
682 if (!is_hdmi && !is_dp)
686 pipe_ctx->stream_res.stream_enc->funcs->update_hdmi_info_packets(
687 pipe_ctx->stream_res.stream_enc,
688 &pipe_ctx->stream_res.encoder_info_frame);
690 pipe_ctx->stream_res.stream_enc->funcs->update_dp_info_packets(
691 pipe_ctx->stream_res.stream_enc,
692 &pipe_ctx->stream_res.encoder_info_frame);
695 void dce110_enable_stream(struct pipe_ctx *pipe_ctx)
697 enum dc_lane_count lane_count =
698 pipe_ctx->stream->sink->link->cur_link_settings.lane_count;
700 struct dc_crtc_timing *timing = &pipe_ctx->stream->timing;
701 struct dc_link *link = pipe_ctx->stream->sink->link;
704 uint32_t active_total_with_borders;
705 uint32_t early_control = 0;
706 struct timing_generator *tg = pipe_ctx->stream_res.tg;
708 /* For MST, there are multiply stream go to only one link.
709 * connect DIG back_end to front_end while enable_stream and
710 * disconnect them during disable_stream
711 * BY this, it is logic clean to separate stream and link */
712 link->link_enc->funcs->connect_dig_be_to_fe(link->link_enc,
713 pipe_ctx->stream_res.stream_enc->id, true);
715 /* update AVI info frame (HDMI, DP)*/
716 /* TODO: FPGA may change to hwss.update_info_frame */
717 dce110_update_info_frame(pipe_ctx);
719 /* enable early control to avoid corruption on DP monitor*/
720 active_total_with_borders =
721 timing->h_addressable
722 + timing->h_border_left
723 + timing->h_border_right;
726 early_control = active_total_with_borders % lane_count;
728 if (early_control == 0)
729 early_control = lane_count;
731 tg->funcs->set_early_control(tg, early_control);
733 /* enable audio only within mode set */
734 if (pipe_ctx->stream_res.audio != NULL) {
735 if (dc_is_dp_signal(pipe_ctx->stream->signal))
736 pipe_ctx->stream_res.stream_enc->funcs->dp_audio_enable(pipe_ctx->stream_res.stream_enc);
744 /*todo: cloned in stream enc, fix*/
745 static bool is_panel_backlight_on(struct dce_hwseq *hws)
749 REG_GET(LVTMA_PWRSEQ_CNTL, LVTMA_BLON, &value);
754 static bool is_panel_powered_on(struct dce_hwseq *hws)
756 uint32_t pwr_seq_state, dig_on, dig_on_ovrd;
759 REG_GET(LVTMA_PWRSEQ_STATE, LVTMA_PWRSEQ_TARGET_STATE_R, &pwr_seq_state);
761 REG_GET_2(LVTMA_PWRSEQ_CNTL, LVTMA_DIGON, &dig_on, LVTMA_DIGON_OVRD, &dig_on_ovrd);
763 return (pwr_seq_state == 1) || (dig_on == 1 && dig_on_ovrd == 1);
766 static enum bp_result link_transmitter_control(
767 struct dc_bios *bios,
768 struct bp_transmitter_control *cntl)
770 enum bp_result result;
772 result = bios->funcs->transmitter_control(bios, cntl);
781 void hwss_edp_wait_for_hpd_ready(
782 struct dc_link *link,
785 struct dc_context *ctx = link->ctx;
786 struct graphics_object_id connector = link->link_enc->connector;
788 bool edp_hpd_high = false;
789 uint32_t time_elapsed = 0;
790 uint32_t timeout = power_up ?
791 PANEL_POWER_UP_TIMEOUT : PANEL_POWER_DOWN_TIMEOUT;
793 if (dal_graphics_object_id_get_connector_id(connector)
794 != CONNECTOR_ID_EDP) {
801 * From KV, we will not HPD low after turning off VCC -
802 * instead, we will check the SW timer in power_up().
807 * When we power on/off the eDP panel,
808 * we need to wait until SENSE bit is high/low.
812 /* TODO what to do with this? */
813 hpd = get_hpd_gpio(ctx->dc_bios, connector, ctx->gpio_service);
820 dal_gpio_open(hpd, GPIO_MODE_INTERRUPT);
822 /* wait until timeout or panel detected */
825 uint32_t detected = 0;
827 dal_gpio_get_value(hpd, &detected);
829 if (!(detected ^ power_up)) {
834 msleep(HPD_CHECK_INTERVAL);
836 time_elapsed += HPD_CHECK_INTERVAL;
837 } while (time_elapsed < timeout);
841 dal_gpio_destroy_irq(&hpd);
843 if (false == edp_hpd_high) {
845 "%s: wait timed out!\n", __func__);
849 void hwss_edp_power_control(
850 struct dc_link *link,
853 struct dc_context *ctx = link->ctx;
854 struct dce_hwseq *hwseq = ctx->dc->hwseq;
855 struct bp_transmitter_control cntl = { 0 };
856 enum bp_result bp_result;
859 if (dal_graphics_object_id_get_connector_id(link->link_enc->connector)
860 != CONNECTOR_ID_EDP) {
865 if (power_up != is_panel_powered_on(hwseq)) {
866 /* Send VBIOS command to prompt eDP panel power */
868 unsigned long long current_ts = dm_get_timestamp(ctx);
869 unsigned long long duration_in_ms =
870 div64_u64(dm_get_elapse_time_in_ns(
873 link->link_trace.time_stamp.edp_poweroff), 1000000);
874 unsigned long long wait_time_ms = 0;
876 /* max 500ms from LCDVDD off to on */
877 unsigned long long edp_poweroff_time_ms = 500;
879 if (link->local_sink != NULL)
880 edp_poweroff_time_ms =
881 500 + link->local_sink->edid_caps.panel_patch.extra_t12_ms;
882 if (link->link_trace.time_stamp.edp_poweroff == 0)
883 wait_time_ms = edp_poweroff_time_ms;
884 else if (duration_in_ms < edp_poweroff_time_ms)
885 wait_time_ms = edp_poweroff_time_ms - duration_in_ms;
888 msleep(wait_time_ms);
889 dm_output_to_console("%s: wait %lld ms to power on eDP.\n",
890 __func__, wait_time_ms);
896 "%s: Panel Power action: %s\n",
897 __func__, (power_up ? "On":"Off"));
899 cntl.action = power_up ?
900 TRANSMITTER_CONTROL_POWER_ON :
901 TRANSMITTER_CONTROL_POWER_OFF;
902 cntl.transmitter = link->link_enc->transmitter;
903 cntl.connector_obj_id = link->link_enc->connector;
904 cntl.coherent = false;
905 cntl.lanes_number = LANE_COUNT_FOUR;
906 cntl.hpd_sel = link->link_enc->hpd_source;
907 bp_result = link_transmitter_control(ctx->dc_bios, &cntl);
910 /*save driver power off time stamp*/
911 link->link_trace.time_stamp.edp_poweroff = dm_get_timestamp(ctx);
913 link->link_trace.time_stamp.edp_poweron = dm_get_timestamp(ctx);
915 if (bp_result != BP_RESULT_OK)
917 "%s: Panel Power bp_result: %d\n",
918 __func__, bp_result);
921 "%s: Skipping Panel Power action: %s\n",
922 __func__, (power_up ? "On":"Off"));
926 /*todo: cloned in stream enc, fix*/
929 * eDP only. Control the backlight of the eDP panel
931 void hwss_edp_backlight_control(
932 struct dc_link *link,
935 struct dc_context *ctx = link->ctx;
936 struct dce_hwseq *hws = ctx->dc->hwseq;
937 struct bp_transmitter_control cntl = { 0 };
939 if (dal_graphics_object_id_get_connector_id(link->link_enc->connector)
940 != CONNECTOR_ID_EDP) {
945 if (enable && is_panel_backlight_on(hws)) {
947 "%s: panel already powered up. Do nothing.\n",
952 /* Send VBIOS command to control eDP panel backlight */
955 "%s: backlight action: %s\n",
956 __func__, (enable ? "On":"Off"));
958 cntl.action = enable ?
959 TRANSMITTER_CONTROL_BACKLIGHT_ON :
960 TRANSMITTER_CONTROL_BACKLIGHT_OFF;
962 /*cntl.engine_id = ctx->engine;*/
963 cntl.transmitter = link->link_enc->transmitter;
964 cntl.connector_obj_id = link->link_enc->connector;
966 cntl.lanes_number = LANE_COUNT_FOUR;
967 cntl.hpd_sel = link->link_enc->hpd_source;
968 cntl.signal = SIGNAL_TYPE_EDP;
970 /* For eDP, the following delays might need to be considered
971 * after link training completed:
972 * idle period - min. accounts for required BS-Idle pattern,
973 * max. allows for source frame synchronization);
974 * 50 msec max. delay from valid video data from source
975 * to video on dislpay or backlight enable.
977 * Disable the delay for now.
978 * Enable it in the future if necessary.
980 /* dc_service_sleep_in_milliseconds(50); */
982 if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
983 edp_receiver_ready_T7(link);
984 link_transmitter_control(ctx->dc_bios, &cntl);
986 if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_OFF)
987 edp_receiver_ready_T9(link);
990 void dce110_enable_audio_stream(struct pipe_ctx *pipe_ctx)
992 struct dc *core_dc = pipe_ctx->stream->ctx->dc;
993 /* notify audio driver for audio modes of monitor */
994 struct pp_smu_funcs_rv *pp_smu = core_dc->res_pool->pp_smu;
995 unsigned int i, num_audio = 1;
997 if (pipe_ctx->stream_res.audio) {
998 for (i = 0; i < MAX_PIPES; i++) {
999 /*current_state not updated yet*/
1000 if (core_dc->current_state->res_ctx.pipe_ctx[i].stream_res.audio != NULL)
1004 pipe_ctx->stream_res.audio->funcs->az_enable(pipe_ctx->stream_res.audio);
1006 if (num_audio >= 1 && pp_smu != NULL && pp_smu->set_pme_wa_enable != NULL)
1007 /*this is the first audio. apply the PME w/a in order to wake AZ from D3*/
1008 pp_smu->set_pme_wa_enable(&pp_smu->pp_smu);
1010 /* TODO: audio should be per stream rather than per link */
1011 pipe_ctx->stream_res.stream_enc->funcs->audio_mute_control(
1012 pipe_ctx->stream_res.stream_enc, false);
1016 void dce110_disable_audio_stream(struct pipe_ctx *pipe_ctx, int option)
1018 struct dc *dc = pipe_ctx->stream->ctx->dc;
1020 pipe_ctx->stream_res.stream_enc->funcs->audio_mute_control(
1021 pipe_ctx->stream_res.stream_enc, true);
1022 if (pipe_ctx->stream_res.audio) {
1023 struct pp_smu_funcs_rv *pp_smu = dc->res_pool->pp_smu;
1025 if (option != KEEP_ACQUIRED_RESOURCE ||
1026 !dc->debug.az_endpoint_mute_only) {
1027 /*only disalbe az_endpoint if power down or free*/
1028 pipe_ctx->stream_res.audio->funcs->az_disable(pipe_ctx->stream_res.audio);
1031 if (dc_is_dp_signal(pipe_ctx->stream->signal))
1032 pipe_ctx->stream_res.stream_enc->funcs->dp_audio_disable(
1033 pipe_ctx->stream_res.stream_enc);
1035 pipe_ctx->stream_res.stream_enc->funcs->hdmi_audio_disable(
1036 pipe_ctx->stream_res.stream_enc);
1037 /*don't free audio if it is from retrain or internal disable stream*/
1038 if (option == FREE_ACQUIRED_RESOURCE && dc->caps.dynamic_audio == true) {
1039 /*we have to dynamic arbitrate the audio endpoints*/
1040 /*we free the resource, need reset is_audio_acquired*/
1041 update_audio_usage(&dc->current_state->res_ctx, dc->res_pool, pipe_ctx->stream_res.audio, false);
1042 pipe_ctx->stream_res.audio = NULL;
1044 if (pp_smu != NULL && pp_smu->set_pme_wa_enable != NULL)
1045 /*this is the first audio. apply the PME w/a in order to wake AZ from D3*/
1046 pp_smu->set_pme_wa_enable(&pp_smu->pp_smu);
1048 /* TODO: notify audio driver for if audio modes list changed
1049 * add audio mode list change flag */
1050 /* dal_audio_disable_azalia_audio_jack_presence(stream->audio,
1051 * stream->stream_engine_id);
1056 void dce110_disable_stream(struct pipe_ctx *pipe_ctx, int option)
1058 struct dc_stream_state *stream = pipe_ctx->stream;
1059 struct dc_link *link = stream->sink->link;
1060 struct dc *dc = pipe_ctx->stream->ctx->dc;
1062 if (dc_is_hdmi_signal(pipe_ctx->stream->signal))
1063 pipe_ctx->stream_res.stream_enc->funcs->stop_hdmi_info_packets(
1064 pipe_ctx->stream_res.stream_enc);
1066 if (dc_is_dp_signal(pipe_ctx->stream->signal))
1067 pipe_ctx->stream_res.stream_enc->funcs->stop_dp_info_packets(
1068 pipe_ctx->stream_res.stream_enc);
1070 dc->hwss.disable_audio_stream(pipe_ctx, option);
1072 link->link_enc->funcs->connect_dig_be_to_fe(
1074 pipe_ctx->stream_res.stream_enc->id,
1079 void dce110_unblank_stream(struct pipe_ctx *pipe_ctx,
1080 struct dc_link_settings *link_settings)
1082 struct encoder_unblank_param params = { { 0 } };
1083 struct dc_stream_state *stream = pipe_ctx->stream;
1084 struct dc_link *link = stream->sink->link;
1086 /* only 3 items below are used by unblank */
1087 params.pixel_clk_khz =
1088 pipe_ctx->stream->timing.pix_clk_khz;
1089 params.link_settings.link_rate = link_settings->link_rate;
1091 if (dc_is_dp_signal(pipe_ctx->stream->signal))
1092 pipe_ctx->stream_res.stream_enc->funcs->dp_unblank(pipe_ctx->stream_res.stream_enc, ¶ms);
1094 if (link->local_sink && link->local_sink->sink_signal == SIGNAL_TYPE_EDP) {
1095 link->dc->hwss.edp_backlight_control(link, true);
1096 stream->bl_pwm_level = EDP_BACKLIGHT_RAMP_DISABLE_LEVEL;
1099 void dce110_blank_stream(struct pipe_ctx *pipe_ctx)
1101 struct dc_stream_state *stream = pipe_ctx->stream;
1102 struct dc_link *link = stream->sink->link;
1104 if (link->local_sink && link->local_sink->sink_signal == SIGNAL_TYPE_EDP) {
1105 link->dc->hwss.edp_backlight_control(link, false);
1106 dc_link_set_abm_disable(link);
1109 if (dc_is_dp_signal(pipe_ctx->stream->signal))
1110 pipe_ctx->stream_res.stream_enc->funcs->dp_blank(pipe_ctx->stream_res.stream_enc);
1114 void dce110_set_avmute(struct pipe_ctx *pipe_ctx, bool enable)
1116 if (pipe_ctx != NULL && pipe_ctx->stream_res.stream_enc != NULL)
1117 pipe_ctx->stream_res.stream_enc->funcs->set_avmute(pipe_ctx->stream_res.stream_enc, enable);
1120 static enum audio_dto_source translate_to_dto_source(enum controller_id crtc_id)
1123 case CONTROLLER_ID_D0:
1124 return DTO_SOURCE_ID0;
1125 case CONTROLLER_ID_D1:
1126 return DTO_SOURCE_ID1;
1127 case CONTROLLER_ID_D2:
1128 return DTO_SOURCE_ID2;
1129 case CONTROLLER_ID_D3:
1130 return DTO_SOURCE_ID3;
1131 case CONTROLLER_ID_D4:
1132 return DTO_SOURCE_ID4;
1133 case CONTROLLER_ID_D5:
1134 return DTO_SOURCE_ID5;
1136 return DTO_SOURCE_UNKNOWN;
1140 static void build_audio_output(
1141 struct dc_state *state,
1142 const struct pipe_ctx *pipe_ctx,
1143 struct audio_output *audio_output)
1145 const struct dc_stream_state *stream = pipe_ctx->stream;
1146 audio_output->engine_id = pipe_ctx->stream_res.stream_enc->id;
1148 audio_output->signal = pipe_ctx->stream->signal;
1150 /* audio_crtc_info */
1152 audio_output->crtc_info.h_total =
1153 stream->timing.h_total;
1156 * Audio packets are sent during actual CRTC blank physical signal, we
1157 * need to specify actual active signal portion
1159 audio_output->crtc_info.h_active =
1160 stream->timing.h_addressable
1161 + stream->timing.h_border_left
1162 + stream->timing.h_border_right;
1164 audio_output->crtc_info.v_active =
1165 stream->timing.v_addressable
1166 + stream->timing.v_border_top
1167 + stream->timing.v_border_bottom;
1169 audio_output->crtc_info.pixel_repetition = 1;
1171 audio_output->crtc_info.interlaced =
1172 stream->timing.flags.INTERLACE;
1174 audio_output->crtc_info.refresh_rate =
1175 (stream->timing.pix_clk_khz*1000)/
1176 (stream->timing.h_total*stream->timing.v_total);
1178 audio_output->crtc_info.color_depth =
1179 stream->timing.display_color_depth;
1181 audio_output->crtc_info.requested_pixel_clock =
1182 pipe_ctx->stream_res.pix_clk_params.requested_pix_clk;
1184 audio_output->crtc_info.calculated_pixel_clock =
1185 pipe_ctx->stream_res.pix_clk_params.requested_pix_clk;
1187 /*for HDMI, audio ACR is with deep color ratio factor*/
1188 if (dc_is_hdmi_signal(pipe_ctx->stream->signal) &&
1189 audio_output->crtc_info.requested_pixel_clock ==
1190 stream->timing.pix_clk_khz) {
1191 if (pipe_ctx->stream_res.pix_clk_params.pixel_encoding == PIXEL_ENCODING_YCBCR420) {
1192 audio_output->crtc_info.requested_pixel_clock =
1193 audio_output->crtc_info.requested_pixel_clock/2;
1194 audio_output->crtc_info.calculated_pixel_clock =
1195 pipe_ctx->stream_res.pix_clk_params.requested_pix_clk/2;
1200 if (pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT ||
1201 pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST) {
1202 audio_output->pll_info.dp_dto_source_clock_in_khz =
1203 state->dis_clk->funcs->get_dp_ref_clk_frequency(
1207 audio_output->pll_info.feed_back_divider =
1208 pipe_ctx->pll_settings.feedback_divider;
1210 audio_output->pll_info.dto_source =
1211 translate_to_dto_source(
1212 pipe_ctx->stream_res.tg->inst + 1);
1214 /* TODO hard code to enable for now. Need get from stream */
1215 audio_output->pll_info.ss_enabled = true;
1217 audio_output->pll_info.ss_percentage =
1218 pipe_ctx->pll_settings.ss_percentage;
1221 static void get_surface_visual_confirm_color(const struct pipe_ctx *pipe_ctx,
1222 struct tg_color *color)
1224 uint32_t color_value = MAX_TG_COLOR_VALUE * (4 - pipe_ctx->stream_res.tg->inst) / 4;
1226 switch (pipe_ctx->plane_res.scl_data.format) {
1227 case PIXEL_FORMAT_ARGB8888:
1228 /* set boarder color to red */
1229 color->color_r_cr = color_value;
1232 case PIXEL_FORMAT_ARGB2101010:
1233 /* set boarder color to blue */
1234 color->color_b_cb = color_value;
1236 case PIXEL_FORMAT_420BPP8:
1237 /* set boarder color to green */
1238 color->color_g_y = color_value;
1240 case PIXEL_FORMAT_420BPP10:
1241 /* set boarder color to yellow */
1242 color->color_g_y = color_value;
1243 color->color_r_cr = color_value;
1245 case PIXEL_FORMAT_FP16:
1246 /* set boarder color to white */
1247 color->color_r_cr = color_value;
1248 color->color_b_cb = color_value;
1249 color->color_g_y = color_value;
1256 static void program_scaler(const struct dc *dc,
1257 const struct pipe_ctx *pipe_ctx)
1259 struct tg_color color = {0};
1261 #if defined(CONFIG_DRM_AMD_DC_DCN1_0)
1263 if (pipe_ctx->plane_res.xfm->funcs->transform_set_pixel_storage_depth == NULL)
1267 if (dc->debug.visual_confirm == VISUAL_CONFIRM_SURFACE)
1268 get_surface_visual_confirm_color(pipe_ctx, &color);
1270 color_space_to_black_color(dc,
1271 pipe_ctx->stream->output_color_space,
1274 pipe_ctx->plane_res.xfm->funcs->transform_set_pixel_storage_depth(
1275 pipe_ctx->plane_res.xfm,
1276 pipe_ctx->plane_res.scl_data.lb_params.depth,
1277 &pipe_ctx->stream->bit_depth_params);
1279 if (pipe_ctx->stream_res.tg->funcs->set_overscan_blank_color) {
1281 * The way 420 is packed, 2 channels carry Y component, 1 channel
1282 * alternate between Cb and Cr, so both channels need the pixel
1285 if (pipe_ctx->stream->timing.pixel_encoding == PIXEL_ENCODING_YCBCR420)
1286 color.color_r_cr = color.color_g_y;
1288 pipe_ctx->stream_res.tg->funcs->set_overscan_blank_color(
1289 pipe_ctx->stream_res.tg,
1293 pipe_ctx->plane_res.xfm->funcs->transform_set_scaler(pipe_ctx->plane_res.xfm,
1294 &pipe_ctx->plane_res.scl_data);
1297 static enum dc_status dce110_enable_stream_timing(
1298 struct pipe_ctx *pipe_ctx,
1299 struct dc_state *context,
1302 struct dc_stream_state *stream = pipe_ctx->stream;
1303 struct pipe_ctx *pipe_ctx_old = &dc->current_state->res_ctx.
1304 pipe_ctx[pipe_ctx->pipe_idx];
1305 struct tg_color black_color = {0};
1307 if (!pipe_ctx_old->stream) {
1309 /* program blank color */
1310 color_space_to_black_color(dc,
1311 stream->output_color_space, &black_color);
1312 pipe_ctx->stream_res.tg->funcs->set_blank_color(
1313 pipe_ctx->stream_res.tg,
1317 * Must blank CRTC after disabling power gating and before any
1318 * programming, otherwise CRTC will be hung in bad state
1320 pipe_ctx->stream_res.tg->funcs->set_blank(pipe_ctx->stream_res.tg, true);
1322 if (false == pipe_ctx->clock_source->funcs->program_pix_clk(
1323 pipe_ctx->clock_source,
1324 &pipe_ctx->stream_res.pix_clk_params,
1325 &pipe_ctx->pll_settings)) {
1326 BREAK_TO_DEBUGGER();
1327 return DC_ERROR_UNEXPECTED;
1330 pipe_ctx->stream_res.tg->funcs->program_timing(
1331 pipe_ctx->stream_res.tg,
1335 pipe_ctx->stream_res.tg->funcs->set_static_screen_control(
1336 pipe_ctx->stream_res.tg,
1340 if (!pipe_ctx_old->stream) {
1341 if (false == pipe_ctx->stream_res.tg->funcs->enable_crtc(
1342 pipe_ctx->stream_res.tg)) {
1343 BREAK_TO_DEBUGGER();
1344 return DC_ERROR_UNEXPECTED;
1353 static enum dc_status apply_single_controller_ctx_to_hw(
1354 struct pipe_ctx *pipe_ctx,
1355 struct dc_state *context,
1358 struct dc_stream_state *stream = pipe_ctx->stream;
1359 struct pipe_ctx *pipe_ctx_old = &dc->current_state->res_ctx.
1360 pipe_ctx[pipe_ctx->pipe_idx];
1362 if (pipe_ctx->stream_res.audio != NULL) {
1363 struct audio_output audio_output;
1365 build_audio_output(context, pipe_ctx, &audio_output);
1367 if (dc_is_dp_signal(pipe_ctx->stream->signal))
1368 pipe_ctx->stream_res.stream_enc->funcs->dp_audio_setup(
1369 pipe_ctx->stream_res.stream_enc,
1370 pipe_ctx->stream_res.audio->inst,
1371 &pipe_ctx->stream->audio_info);
1373 pipe_ctx->stream_res.stream_enc->funcs->hdmi_audio_setup(
1374 pipe_ctx->stream_res.stream_enc,
1375 pipe_ctx->stream_res.audio->inst,
1376 &pipe_ctx->stream->audio_info,
1377 &audio_output.crtc_info);
1379 pipe_ctx->stream_res.audio->funcs->az_configure(
1380 pipe_ctx->stream_res.audio,
1381 pipe_ctx->stream->signal,
1382 &audio_output.crtc_info,
1383 &pipe_ctx->stream->audio_info);
1387 dc->hwss.enable_stream_timing(pipe_ctx, context, dc);
1389 /* FPGA does not program backend */
1390 if (IS_FPGA_MAXIMUS_DC(dc->ctx->dce_environment)) {
1391 pipe_ctx->stream_res.opp->funcs->opp_set_dyn_expansion(
1392 pipe_ctx->stream_res.opp,
1393 COLOR_SPACE_YCBCR601,
1394 stream->timing.display_color_depth,
1395 pipe_ctx->stream->signal);
1397 pipe_ctx->stream_res.opp->funcs->opp_program_fmt(
1398 pipe_ctx->stream_res.opp,
1399 &stream->bit_depth_params,
1403 /* TODO: move to stream encoder */
1404 if (pipe_ctx->stream->signal != SIGNAL_TYPE_VIRTUAL)
1405 if (DC_OK != bios_parser_crtc_source_select(pipe_ctx)) {
1406 BREAK_TO_DEBUGGER();
1407 return DC_ERROR_UNEXPECTED;
1409 pipe_ctx->stream_res.opp->funcs->opp_set_dyn_expansion(
1410 pipe_ctx->stream_res.opp,
1411 COLOR_SPACE_YCBCR601,
1412 stream->timing.display_color_depth,
1413 pipe_ctx->stream->signal);
1415 if (pipe_ctx->stream->signal != SIGNAL_TYPE_VIRTUAL)
1416 stream->sink->link->link_enc->funcs->setup(
1417 stream->sink->link->link_enc,
1418 pipe_ctx->stream->signal);
1420 if (pipe_ctx->stream->signal != SIGNAL_TYPE_VIRTUAL)
1421 pipe_ctx->stream_res.stream_enc->funcs->setup_stereo_sync(
1422 pipe_ctx->stream_res.stream_enc,
1423 pipe_ctx->stream_res.tg->inst,
1424 stream->timing.timing_3d_format != TIMING_3D_FORMAT_NONE);
1427 pipe_ctx->stream_res.opp->funcs->opp_program_fmt(
1428 pipe_ctx->stream_res.opp,
1429 &stream->bit_depth_params,
1432 if (dc_is_dp_signal(pipe_ctx->stream->signal))
1433 pipe_ctx->stream_res.stream_enc->funcs->dp_set_stream_attribute(
1434 pipe_ctx->stream_res.stream_enc,
1436 stream->output_color_space);
1438 if (dc_is_hdmi_signal(pipe_ctx->stream->signal))
1439 pipe_ctx->stream_res.stream_enc->funcs->hdmi_set_stream_attribute(
1440 pipe_ctx->stream_res.stream_enc,
1442 stream->phy_pix_clk,
1443 pipe_ctx->stream_res.audio != NULL);
1445 if (dc_is_dvi_signal(pipe_ctx->stream->signal))
1446 pipe_ctx->stream_res.stream_enc->funcs->dvi_set_stream_attribute(
1447 pipe_ctx->stream_res.stream_enc,
1449 (pipe_ctx->stream->signal == SIGNAL_TYPE_DVI_DUAL_LINK) ?
1452 resource_build_info_frame(pipe_ctx);
1453 dce110_update_info_frame(pipe_ctx);
1454 if (!pipe_ctx_old->stream)
1455 core_link_enable_stream(context, pipe_ctx);
1457 pipe_ctx->plane_res.scl_data.lb_params.alpha_en = pipe_ctx->bottom_pipe != 0;
1459 pipe_ctx->stream->sink->link->psr_enabled = false;
1464 /******************************************************************************/
1466 static void power_down_encoders(struct dc *dc)
1469 enum connector_id connector_id;
1470 enum signal_type signal = SIGNAL_TYPE_NONE;
1472 /* do not know BIOS back-front mapping, simply blank all. It will not
1475 for (i = 0; i < dc->res_pool->stream_enc_count; i++) {
1476 dc->res_pool->stream_enc[i]->funcs->dp_blank(
1477 dc->res_pool->stream_enc[i]);
1480 for (i = 0; i < dc->link_count; i++) {
1481 connector_id = dal_graphics_object_id_get_connector_id(dc->links[i]->link_id);
1482 if ((connector_id == CONNECTOR_ID_DISPLAY_PORT) ||
1483 (connector_id == CONNECTOR_ID_EDP)) {
1485 if (!dc->links[i]->wa_flags.dp_keep_receiver_powered)
1486 dp_receiver_power_ctrl(dc->links[i], false);
1487 if (connector_id == CONNECTOR_ID_EDP)
1488 signal = SIGNAL_TYPE_EDP;
1491 dc->links[i]->link_enc->funcs->disable_output(
1492 dc->links[i]->link_enc, signal);
1496 static void power_down_controllers(struct dc *dc)
1500 for (i = 0; i < dc->res_pool->timing_generator_count; i++) {
1501 dc->res_pool->timing_generators[i]->funcs->disable_crtc(
1502 dc->res_pool->timing_generators[i]);
1506 static void power_down_clock_sources(struct dc *dc)
1510 if (dc->res_pool->dp_clock_source->funcs->cs_power_down(
1511 dc->res_pool->dp_clock_source) == false)
1512 dm_error("Failed to power down pll! (dp clk src)\n");
1514 for (i = 0; i < dc->res_pool->clk_src_count; i++) {
1515 if (dc->res_pool->clock_sources[i]->funcs->cs_power_down(
1516 dc->res_pool->clock_sources[i]) == false)
1517 dm_error("Failed to power down pll! (clk src index=%d)\n", i);
1521 static void power_down_all_hw_blocks(struct dc *dc)
1523 power_down_encoders(dc);
1525 power_down_controllers(dc);
1527 power_down_clock_sources(dc);
1529 if (dc->fbc_compressor)
1530 dc->fbc_compressor->funcs->disable_fbc(dc->fbc_compressor);
1533 static void disable_vga_and_power_gate_all_controllers(
1537 struct timing_generator *tg;
1538 struct dc_context *ctx = dc->ctx;
1540 for (i = 0; i < dc->res_pool->timing_generator_count; i++) {
1541 tg = dc->res_pool->timing_generators[i];
1543 if (tg->funcs->disable_vga)
1544 tg->funcs->disable_vga(tg);
1546 for (i = 0; i < dc->res_pool->pipe_count; i++) {
1547 /* Enable CLOCK gating for each pipe BEFORE controller
1549 enable_display_pipe_clock_gating(ctx,
1552 dc->current_state->res_ctx.pipe_ctx[i].pipe_idx = i;
1553 dc->hwss.disable_plane(dc,
1554 &dc->current_state->res_ctx.pipe_ctx[i]);
1558 static struct dc_link *get_link_for_edp(struct dc *dc)
1562 for (i = 0; i < dc->link_count; i++) {
1563 if (dc->links[i]->connector_signal == SIGNAL_TYPE_EDP)
1564 return dc->links[i];
1569 static struct dc_link *get_link_for_edp_not_in_use(
1571 struct dc_state *context)
1574 struct dc_link *link = NULL;
1576 /* check if eDP panel is suppose to be set mode, if yes, no need to disable */
1577 for (i = 0; i < context->stream_count; i++) {
1578 if (context->streams[i]->signal == SIGNAL_TYPE_EDP)
1582 /* check if there is an eDP panel not in use */
1583 for (i = 0; i < dc->link_count; i++) {
1584 if (dc->links[i]->local_sink &&
1585 dc->links[i]->local_sink->sink_signal == SIGNAL_TYPE_EDP) {
1586 link = dc->links[i];
1595 * When ASIC goes from VBIOS/VGA mode to driver/accelerated mode we need:
1596 * 1. Power down all DC HW blocks
1597 * 2. Disable VGA engine on all controllers
1598 * 3. Enable power gating for controller
1599 * 4. Set acc_mode_change bit (VBIOS will clear this bit when going to FSDOS)
1601 void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context)
1603 struct dc_link *edp_link_to_turnoff = NULL;
1604 struct dc_link *edp_link = get_link_for_edp(dc);
1605 bool can_eDP_fast_boot_optimize = false;
1608 /* this seems to cause blank screens on DCE8 */
1609 if ((dc->ctx->dce_version == DCE_VERSION_8_0) ||
1610 (dc->ctx->dce_version == DCE_VERSION_8_1) ||
1611 (dc->ctx->dce_version == DCE_VERSION_8_3))
1612 can_eDP_fast_boot_optimize = false;
1614 can_eDP_fast_boot_optimize =
1615 edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc);
1618 if (can_eDP_fast_boot_optimize) {
1619 edp_link_to_turnoff = get_link_for_edp_not_in_use(dc, context);
1621 /* if OS doesn't light up eDP and eDP link is available, we want to disable
1622 * If resume from S4/S5, should optimization.
1624 if (!edp_link_to_turnoff)
1625 dc->apply_edp_fast_boot_optimization = true;
1628 if (!dc->apply_edp_fast_boot_optimization) {
1629 if (edp_link_to_turnoff) {
1630 /*turn off backlight before DP_blank and encoder powered down*/
1631 dc->hwss.edp_backlight_control(edp_link_to_turnoff, false);
1633 /*resume from S3, no vbios posting, no need to power down again*/
1634 power_down_all_hw_blocks(dc);
1635 disable_vga_and_power_gate_all_controllers(dc);
1636 if (edp_link_to_turnoff)
1637 dc->hwss.edp_power_control(edp_link_to_turnoff, false);
1639 bios_set_scratch_acc_mode_change(dc->ctx->dc_bios);
1642 static uint32_t compute_pstate_blackout_duration(
1643 struct bw_fixed blackout_duration,
1644 const struct dc_stream_state *stream)
1646 uint32_t total_dest_line_time_ns;
1647 uint32_t pstate_blackout_duration_ns;
1649 pstate_blackout_duration_ns = 1000 * blackout_duration.value >> 24;
1651 total_dest_line_time_ns = 1000000UL *
1652 stream->timing.h_total /
1653 stream->timing.pix_clk_khz +
1654 pstate_blackout_duration_ns;
1656 return total_dest_line_time_ns;
1659 static void dce110_set_displaymarks(
1660 const struct dc *dc,
1661 struct dc_state *context)
1663 uint8_t i, num_pipes;
1664 unsigned int underlay_idx = dc->res_pool->underlay_pipe_index;
1666 for (i = 0, num_pipes = 0; i < MAX_PIPES; i++) {
1667 struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
1668 uint32_t total_dest_line_time_ns;
1670 if (pipe_ctx->stream == NULL)
1673 total_dest_line_time_ns = compute_pstate_blackout_duration(
1674 dc->bw_vbios->blackout_duration, pipe_ctx->stream);
1675 pipe_ctx->plane_res.mi->funcs->mem_input_program_display_marks(
1676 pipe_ctx->plane_res.mi,
1677 context->bw.dce.nbp_state_change_wm_ns[num_pipes],
1678 context->bw.dce.stutter_exit_wm_ns[num_pipes],
1679 context->bw.dce.stutter_entry_wm_ns[num_pipes],
1680 context->bw.dce.urgent_wm_ns[num_pipes],
1681 total_dest_line_time_ns);
1682 if (i == underlay_idx) {
1684 pipe_ctx->plane_res.mi->funcs->mem_input_program_chroma_display_marks(
1685 pipe_ctx->plane_res.mi,
1686 context->bw.dce.nbp_state_change_wm_ns[num_pipes],
1687 context->bw.dce.stutter_exit_wm_ns[num_pipes],
1688 context->bw.dce.urgent_wm_ns[num_pipes],
1689 total_dest_line_time_ns);
1695 void dce110_set_safe_displaymarks(
1696 struct resource_context *res_ctx,
1697 const struct resource_pool *pool)
1700 int underlay_idx = pool->underlay_pipe_index;
1701 struct dce_watermarks max_marks = {
1702 MAX_WATERMARK, MAX_WATERMARK, MAX_WATERMARK, MAX_WATERMARK };
1703 struct dce_watermarks nbp_marks = {
1704 SAFE_NBP_MARK, SAFE_NBP_MARK, SAFE_NBP_MARK, SAFE_NBP_MARK };
1705 struct dce_watermarks min_marks = { 0, 0, 0, 0};
1707 for (i = 0; i < MAX_PIPES; i++) {
1708 if (res_ctx->pipe_ctx[i].stream == NULL || res_ctx->pipe_ctx[i].plane_res.mi == NULL)
1711 res_ctx->pipe_ctx[i].plane_res.mi->funcs->mem_input_program_display_marks(
1712 res_ctx->pipe_ctx[i].plane_res.mi,
1719 if (i == underlay_idx)
1720 res_ctx->pipe_ctx[i].plane_res.mi->funcs->mem_input_program_chroma_display_marks(
1721 res_ctx->pipe_ctx[i].plane_res.mi,
1730 /*******************************************************************************
1732 ******************************************************************************/
1734 static void set_drr(struct pipe_ctx **pipe_ctx,
1735 int num_pipes, int vmin, int vmax)
1738 struct drr_params params = {0};
1740 params.vertical_total_max = vmax;
1741 params.vertical_total_min = vmin;
1743 /* TODO: If multiple pipes are to be supported, you need
1747 for (i = 0; i < num_pipes; i++) {
1748 pipe_ctx[i]->stream_res.tg->funcs->set_drr(pipe_ctx[i]->stream_res.tg, ¶ms);
1752 static void get_position(struct pipe_ctx **pipe_ctx,
1754 struct crtc_position *position)
1758 /* TODO: handle pipes > 1
1760 for (i = 0; i < num_pipes; i++)
1761 pipe_ctx[i]->stream_res.tg->funcs->get_position(pipe_ctx[i]->stream_res.tg, position);
1764 static void set_static_screen_control(struct pipe_ctx **pipe_ctx,
1765 int num_pipes, const struct dc_static_screen_events *events)
1768 unsigned int value = 0;
1770 if (events->overlay_update)
1772 if (events->surface_update)
1774 if (events->cursor_update)
1776 if (events->force_trigger)
1781 for (i = 0; i < num_pipes; i++)
1782 pipe_ctx[i]->stream_res.tg->funcs->
1783 set_static_screen_control(pipe_ctx[i]->stream_res.tg, value);
1786 /* unit: in_khz before mode set, get pixel clock from context. ASIC register
1787 * may not be programmed yet
1789 static uint32_t get_max_pixel_clock_for_all_paths(
1791 struct dc_state *context)
1793 uint32_t max_pix_clk = 0;
1796 for (i = 0; i < MAX_PIPES; i++) {
1797 struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
1799 if (pipe_ctx->stream == NULL)
1802 /* do not check under lay */
1803 if (pipe_ctx->top_pipe)
1806 if (pipe_ctx->stream_res.pix_clk_params.requested_pix_clk > max_pix_clk)
1808 pipe_ctx->stream_res.pix_clk_params.requested_pix_clk;
1815 * Check if FBC can be enabled
1817 static bool should_enable_fbc(struct dc *dc,
1818 struct dc_state *context,
1822 struct pipe_ctx *pipe_ctx = NULL;
1823 struct resource_context *res_ctx = &context->res_ctx;
1826 ASSERT(dc->fbc_compressor);
1828 /* FBC memory should be allocated */
1829 if (!dc->ctx->fbc_gpu_addr)
1832 /* Only supports single display */
1833 if (context->stream_count != 1)
1836 for (i = 0; i < dc->res_pool->pipe_count; i++) {
1837 if (res_ctx->pipe_ctx[i].stream) {
1838 pipe_ctx = &res_ctx->pipe_ctx[i];
1844 /* Pipe context should be found */
1847 /* Only supports eDP */
1848 if (pipe_ctx->stream->sink->link->connector_signal != SIGNAL_TYPE_EDP)
1851 /* PSR should not be enabled */
1852 if (pipe_ctx->stream->sink->link->psr_enabled)
1855 /* Nothing to compress */
1856 if (!pipe_ctx->plane_state)
1859 /* Only for non-linear tiling */
1860 if (pipe_ctx->plane_state->tiling_info.gfx8.array_mode == DC_ARRAY_LINEAR_GENERAL)
1869 static void enable_fbc(struct dc *dc,
1870 struct dc_state *context)
1872 uint32_t pipe_idx = 0;
1874 if (should_enable_fbc(dc, context, &pipe_idx)) {
1875 /* Program GRPH COMPRESSED ADDRESS and PITCH */
1876 struct compr_addr_and_pitch_params params = {0, 0, 0};
1877 struct compressor *compr = dc->fbc_compressor;
1878 struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[pipe_idx];
1881 params.source_view_width = pipe_ctx->stream->timing.h_addressable;
1882 params.source_view_height = pipe_ctx->stream->timing.v_addressable;
1884 compr->compr_surface_address.quad_part = dc->ctx->fbc_gpu_addr;
1886 compr->funcs->surface_address_and_pitch(compr, ¶ms);
1887 compr->funcs->set_fbc_invalidation_triggers(compr, 1);
1889 compr->funcs->enable_fbc(compr, ¶ms);
1893 static void dce110_reset_hw_ctx_wrap(
1895 struct dc_state *context)
1899 /* Reset old context */
1900 /* look up the targets that have been removed since last commit */
1901 for (i = 0; i < MAX_PIPES; i++) {
1902 struct pipe_ctx *pipe_ctx_old =
1903 &dc->current_state->res_ctx.pipe_ctx[i];
1904 struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
1906 /* Note: We need to disable output if clock sources change,
1907 * since bios does optimization and doesn't apply if changing
1908 * PHY when not already disabled.
1911 /* Skip underlay pipe since it will be handled in commit surface*/
1912 if (!pipe_ctx_old->stream || pipe_ctx_old->top_pipe)
1915 if (!pipe_ctx->stream ||
1916 pipe_need_reprogram(pipe_ctx_old, pipe_ctx)) {
1917 struct clock_source *old_clk = pipe_ctx_old->clock_source;
1919 /* Disable if new stream is null. O/w, if stream is
1920 * disabled already, no need to disable again.
1922 if (!pipe_ctx->stream || !pipe_ctx->stream->dpms_off)
1923 core_link_disable_stream(pipe_ctx_old, FREE_ACQUIRED_RESOURCE);
1925 pipe_ctx_old->stream_res.tg->funcs->set_blank(pipe_ctx_old->stream_res.tg, true);
1926 if (!hwss_wait_for_blank_complete(pipe_ctx_old->stream_res.tg)) {
1927 dm_error("DC: failed to blank crtc!\n");
1928 BREAK_TO_DEBUGGER();
1930 pipe_ctx_old->stream_res.tg->funcs->disable_crtc(pipe_ctx_old->stream_res.tg);
1931 pipe_ctx_old->plane_res.mi->funcs->free_mem_input(
1932 pipe_ctx_old->plane_res.mi, dc->current_state->stream_count);
1934 if (old_clk && 0 == resource_get_clock_source_reference(&context->res_ctx,
1937 old_clk->funcs->cs_power_down(old_clk);
1939 dc->hwss.disable_plane(dc, pipe_ctx_old);
1941 pipe_ctx_old->stream = NULL;
1946 static void dce110_setup_audio_dto(
1948 struct dc_state *context)
1952 /* program audio wall clock. use HDMI as clock source if HDMI
1953 * audio active. Otherwise, use DP as clock source
1954 * first, loop to find any HDMI audio, if not, loop find DP audio
1956 /* Setup audio rate clock source */
1958 * Audio lag happened on DP monitor when unplug a HDMI monitor
1961 * In case of DP and HDMI connected or HDMI only, DCCG_AUDIO_DTO_SEL
1962 * is set to either dto0 or dto1, audio should work fine.
1963 * In case of DP connected only, DCCG_AUDIO_DTO_SEL should be dto1,
1964 * set to dto0 will cause audio lag.
1967 * Not optimized audio wall dto setup. When mode set, iterate pipe_ctx,
1968 * find first available pipe with audio, setup audio wall DTO per topology
1969 * instead of per pipe.
1971 for (i = 0; i < dc->res_pool->pipe_count; i++) {
1972 struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
1974 if (pipe_ctx->stream == NULL)
1977 if (pipe_ctx->top_pipe)
1980 if (pipe_ctx->stream->signal != SIGNAL_TYPE_HDMI_TYPE_A)
1983 if (pipe_ctx->stream_res.audio != NULL) {
1984 struct audio_output audio_output;
1986 build_audio_output(context, pipe_ctx, &audio_output);
1988 pipe_ctx->stream_res.audio->funcs->wall_dto_setup(
1989 pipe_ctx->stream_res.audio,
1990 pipe_ctx->stream->signal,
1991 &audio_output.crtc_info,
1992 &audio_output.pll_info);
1997 /* no HDMI audio is found, try DP audio */
1998 if (i == dc->res_pool->pipe_count) {
1999 for (i = 0; i < dc->res_pool->pipe_count; i++) {
2000 struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
2002 if (pipe_ctx->stream == NULL)
2005 if (pipe_ctx->top_pipe)
2008 if (!dc_is_dp_signal(pipe_ctx->stream->signal))
2011 if (pipe_ctx->stream_res.audio != NULL) {
2012 struct audio_output audio_output;
2014 build_audio_output(context, pipe_ctx, &audio_output);
2016 pipe_ctx->stream_res.audio->funcs->wall_dto_setup(
2017 pipe_ctx->stream_res.audio,
2018 pipe_ctx->stream->signal,
2019 &audio_output.crtc_info,
2020 &audio_output.pll_info);
2027 enum dc_status dce110_apply_ctx_to_hw(
2029 struct dc_state *context)
2031 struct dc_bios *dcb = dc->ctx->dc_bios;
2032 enum dc_status status;
2035 /* Reset old context */
2036 /* look up the targets that have been removed since last commit */
2037 dc->hwss.reset_hw_ctx_wrap(dc, context);
2039 /* Skip applying if no targets */
2040 if (context->stream_count <= 0)
2043 /* Apply new context */
2044 dcb->funcs->set_scratch_critical_state(dcb, true);
2046 /* below is for real asic only */
2047 for (i = 0; i < dc->res_pool->pipe_count; i++) {
2048 struct pipe_ctx *pipe_ctx_old =
2049 &dc->current_state->res_ctx.pipe_ctx[i];
2050 struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
2052 if (pipe_ctx->stream == NULL || pipe_ctx->top_pipe)
2055 if (pipe_ctx->stream == pipe_ctx_old->stream) {
2056 if (pipe_ctx_old->clock_source != pipe_ctx->clock_source)
2057 dce_crtc_switch_to_clk_src(dc->hwseq,
2058 pipe_ctx->clock_source, i);
2062 dc->hwss.enable_display_power_gating(
2063 dc, i, dc->ctx->dc_bios,
2064 PIPE_GATING_CONTROL_DISABLE);
2067 if (dc->fbc_compressor)
2068 dc->fbc_compressor->funcs->disable_fbc(dc->fbc_compressor);
2070 dce110_setup_audio_dto(dc, context);
2072 for (i = 0; i < dc->res_pool->pipe_count; i++) {
2073 struct pipe_ctx *pipe_ctx_old =
2074 &dc->current_state->res_ctx.pipe_ctx[i];
2075 struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
2077 if (pipe_ctx->stream == NULL)
2080 if (pipe_ctx->stream == pipe_ctx_old->stream)
2083 if (pipe_ctx_old->stream && !pipe_need_reprogram(pipe_ctx_old, pipe_ctx))
2086 if (pipe_ctx->top_pipe)
2089 status = apply_single_controller_ctx_to_hw(
2094 if (DC_OK != status)
2098 dcb->funcs->set_scratch_critical_state(dcb, false);
2100 if (dc->fbc_compressor)
2101 enable_fbc(dc, context);
2106 /*******************************************************************************
2107 * Front End programming
2108 ******************************************************************************/
2109 static void set_default_colors(struct pipe_ctx *pipe_ctx)
2111 struct default_adjustment default_adjust = { 0 };
2113 default_adjust.force_hw_default = false;
2114 default_adjust.in_color_space = pipe_ctx->plane_state->color_space;
2115 default_adjust.out_color_space = pipe_ctx->stream->output_color_space;
2116 default_adjust.csc_adjust_type = GRAPHICS_CSC_ADJUST_TYPE_SW;
2117 default_adjust.surface_pixel_format = pipe_ctx->plane_res.scl_data.format;
2119 /* display color depth */
2120 default_adjust.color_depth =
2121 pipe_ctx->stream->timing.display_color_depth;
2123 /* Lb color depth */
2124 default_adjust.lb_color_depth = pipe_ctx->plane_res.scl_data.lb_params.depth;
2126 pipe_ctx->plane_res.xfm->funcs->opp_set_csc_default(
2127 pipe_ctx->plane_res.xfm, &default_adjust);
2131 /*******************************************************************************
2132 * In order to turn on/off specific surface we will program
2135 * In case that we have two surfaces and they have a different visibility
2136 * we can't turn off the CRTC since it will turn off the entire display
2138 * |----------------------------------------------- |
2139 * |bottom pipe|curr pipe | | |
2140 * |Surface |Surface | Blender | CRCT |
2141 * |visibility |visibility | Configuration| |
2142 * |------------------------------------------------|
2143 * | off | off | CURRENT_PIPE | blank |
2144 * | off | on | CURRENT_PIPE | unblank |
2145 * | on | off | OTHER_PIPE | unblank |
2146 * | on | on | BLENDING | unblank |
2147 * -------------------------------------------------|
2149 ******************************************************************************/
2150 static void program_surface_visibility(const struct dc *dc,
2151 struct pipe_ctx *pipe_ctx)
2153 enum blnd_mode blender_mode = BLND_MODE_CURRENT_PIPE;
2154 bool blank_target = false;
2156 if (pipe_ctx->bottom_pipe) {
2158 /* For now we are supporting only two pipes */
2159 ASSERT(pipe_ctx->bottom_pipe->bottom_pipe == NULL);
2161 if (pipe_ctx->bottom_pipe->plane_state->visible) {
2162 if (pipe_ctx->plane_state->visible)
2163 blender_mode = BLND_MODE_BLENDING;
2165 blender_mode = BLND_MODE_OTHER_PIPE;
2167 } else if (!pipe_ctx->plane_state->visible)
2168 blank_target = true;
2170 } else if (!pipe_ctx->plane_state->visible)
2171 blank_target = true;
2173 dce_set_blender_mode(dc->hwseq, pipe_ctx->stream_res.tg->inst, blender_mode);
2174 pipe_ctx->stream_res.tg->funcs->set_blank(pipe_ctx->stream_res.tg, blank_target);
2178 static void program_gamut_remap(struct pipe_ctx *pipe_ctx)
2181 struct xfm_grph_csc_adjustment adjust;
2182 memset(&adjust, 0, sizeof(adjust));
2183 adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_BYPASS;
2186 if (pipe_ctx->stream->gamut_remap_matrix.enable_remap == true) {
2187 adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_SW;
2189 for (i = 0; i < CSC_TEMPERATURE_MATRIX_SIZE; i++)
2190 adjust.temperature_matrix[i] =
2191 pipe_ctx->stream->gamut_remap_matrix.matrix[i];
2194 pipe_ctx->plane_res.xfm->funcs->transform_set_gamut_remap(pipe_ctx->plane_res.xfm, &adjust);
2196 static void update_plane_addr(const struct dc *dc,
2197 struct pipe_ctx *pipe_ctx)
2199 struct dc_plane_state *plane_state = pipe_ctx->plane_state;
2201 if (plane_state == NULL)
2204 pipe_ctx->plane_res.mi->funcs->mem_input_program_surface_flip_and_addr(
2205 pipe_ctx->plane_res.mi,
2206 &plane_state->address,
2207 plane_state->flip_immediate);
2209 plane_state->status.requested_address = plane_state->address;
2212 static void dce110_update_pending_status(struct pipe_ctx *pipe_ctx)
2214 struct dc_plane_state *plane_state = pipe_ctx->plane_state;
2216 if (plane_state == NULL)
2219 plane_state->status.is_flip_pending =
2220 pipe_ctx->plane_res.mi->funcs->mem_input_is_flip_pending(
2221 pipe_ctx->plane_res.mi);
2223 if (plane_state->status.is_flip_pending && !plane_state->visible)
2224 pipe_ctx->plane_res.mi->current_address = pipe_ctx->plane_res.mi->request_address;
2226 plane_state->status.current_address = pipe_ctx->plane_res.mi->current_address;
2227 if (pipe_ctx->plane_res.mi->current_address.type == PLN_ADDR_TYPE_GRPH_STEREO &&
2228 pipe_ctx->stream_res.tg->funcs->is_stereo_left_eye) {
2229 plane_state->status.is_right_eye =\
2230 !pipe_ctx->stream_res.tg->funcs->is_stereo_left_eye(pipe_ctx->stream_res.tg);
2234 void dce110_power_down(struct dc *dc)
2236 power_down_all_hw_blocks(dc);
2237 disable_vga_and_power_gate_all_controllers(dc);
2240 static bool wait_for_reset_trigger_to_occur(
2241 struct dc_context *dc_ctx,
2242 struct timing_generator *tg)
2246 /* To avoid endless loop we wait at most
2247 * frames_to_wait_on_triggered_reset frames for the reset to occur. */
2248 const uint32_t frames_to_wait_on_triggered_reset = 10;
2251 for (i = 0; i < frames_to_wait_on_triggered_reset; i++) {
2253 if (!tg->funcs->is_counter_moving(tg)) {
2254 DC_ERROR("TG counter is not moving!\n");
2258 if (tg->funcs->did_triggered_reset_occur(tg)) {
2260 /* usually occurs at i=1 */
2261 DC_SYNC_INFO("GSL: reset occurred at wait count: %d\n",
2266 /* Wait for one frame. */
2267 tg->funcs->wait_for_state(tg, CRTC_STATE_VACTIVE);
2268 tg->funcs->wait_for_state(tg, CRTC_STATE_VBLANK);
2272 DC_ERROR("GSL: Timeout on reset trigger!\n");
2277 /* Enable timing synchronization for a group of Timing Generators. */
2278 static void dce110_enable_timing_synchronization(
2282 struct pipe_ctx *grouped_pipes[])
2284 struct dc_context *dc_ctx = dc->ctx;
2285 struct dcp_gsl_params gsl_params = { 0 };
2288 DC_SYNC_INFO("GSL: Setting-up...\n");
2290 /* Designate a single TG in the group as a master.
2291 * Since HW doesn't care which one, we always assign
2292 * the 1st one in the group. */
2293 gsl_params.gsl_group = 0;
2294 gsl_params.gsl_master = grouped_pipes[0]->stream_res.tg->inst;
2296 for (i = 0; i < group_size; i++)
2297 grouped_pipes[i]->stream_res.tg->funcs->setup_global_swap_lock(
2298 grouped_pipes[i]->stream_res.tg, &gsl_params);
2300 /* Reset slave controllers on master VSync */
2301 DC_SYNC_INFO("GSL: enabling trigger-reset\n");
2303 for (i = 1 /* skip the master */; i < group_size; i++)
2304 grouped_pipes[i]->stream_res.tg->funcs->enable_reset_trigger(
2305 grouped_pipes[i]->stream_res.tg,
2306 gsl_params.gsl_group);
2308 for (i = 1 /* skip the master */; i < group_size; i++) {
2309 DC_SYNC_INFO("GSL: waiting for reset to occur.\n");
2310 wait_for_reset_trigger_to_occur(dc_ctx, grouped_pipes[i]->stream_res.tg);
2311 grouped_pipes[i]->stream_res.tg->funcs->disable_reset_trigger(
2312 grouped_pipes[i]->stream_res.tg);
2315 /* GSL Vblank synchronization is a one time sync mechanism, assumption
2316 * is that the sync'ed displays will not drift out of sync over time*/
2317 DC_SYNC_INFO("GSL: Restoring register states.\n");
2318 for (i = 0; i < group_size; i++)
2319 grouped_pipes[i]->stream_res.tg->funcs->tear_down_global_swap_lock(grouped_pipes[i]->stream_res.tg);
2321 DC_SYNC_INFO("GSL: Set-up complete.\n");
2324 static void dce110_enable_per_frame_crtc_position_reset(
2327 struct pipe_ctx *grouped_pipes[])
2329 struct dc_context *dc_ctx = dc->ctx;
2330 struct dcp_gsl_params gsl_params = { 0 };
2333 gsl_params.gsl_group = 0;
2334 gsl_params.gsl_master = grouped_pipes[0]->stream->triggered_crtc_reset.event_source->status.primary_otg_inst;
2336 for (i = 0; i < group_size; i++)
2337 grouped_pipes[i]->stream_res.tg->funcs->setup_global_swap_lock(
2338 grouped_pipes[i]->stream_res.tg, &gsl_params);
2340 DC_SYNC_INFO("GSL: enabling trigger-reset\n");
2342 for (i = 1; i < group_size; i++)
2343 grouped_pipes[i]->stream_res.tg->funcs->enable_crtc_reset(
2344 grouped_pipes[i]->stream_res.tg,
2345 gsl_params.gsl_master,
2346 &grouped_pipes[i]->stream->triggered_crtc_reset);
2348 DC_SYNC_INFO("GSL: waiting for reset to occur.\n");
2349 for (i = 1; i < group_size; i++)
2350 wait_for_reset_trigger_to_occur(dc_ctx, grouped_pipes[i]->stream_res.tg);
2352 for (i = 0; i < group_size; i++)
2353 grouped_pipes[i]->stream_res.tg->funcs->tear_down_global_swap_lock(grouped_pipes[i]->stream_res.tg);
2357 static void init_hw(struct dc *dc)
2361 struct transform *xfm;
2364 bp = dc->ctx->dc_bios;
2365 for (i = 0; i < dc->res_pool->pipe_count; i++) {
2366 xfm = dc->res_pool->transforms[i];
2367 xfm->funcs->transform_reset(xfm);
2369 dc->hwss.enable_display_power_gating(
2371 PIPE_GATING_CONTROL_INIT);
2372 dc->hwss.enable_display_power_gating(
2374 PIPE_GATING_CONTROL_DISABLE);
2375 dc->hwss.enable_display_pipe_clock_gating(
2380 dce_clock_gating_power_up(dc->hwseq, false);
2381 /***************************************/
2383 for (i = 0; i < dc->link_count; i++) {
2384 /****************************************/
2385 /* Power up AND update implementation according to the
2386 * required signal (which may be different from the
2387 * default signal on connector). */
2388 struct dc_link *link = dc->links[i];
2390 if (link->link_enc->connector.id == CONNECTOR_ID_EDP)
2391 dc->hwss.edp_power_control(link, true);
2393 link->link_enc->funcs->hw_init(link->link_enc);
2396 for (i = 0; i < dc->res_pool->pipe_count; i++) {
2397 struct timing_generator *tg = dc->res_pool->timing_generators[i];
2399 tg->funcs->disable_vga(tg);
2401 /* Blank controller using driver code instead of
2403 tg->funcs->set_blank(tg, true);
2404 hwss_wait_for_blank_complete(tg);
2407 for (i = 0; i < dc->res_pool->audio_count; i++) {
2408 struct audio *audio = dc->res_pool->audios[i];
2409 audio->funcs->hw_init(audio);
2412 abm = dc->res_pool->abm;
2414 abm->funcs->init_backlight(abm);
2415 abm->funcs->abm_init(abm);
2418 if (dc->fbc_compressor)
2419 dc->fbc_compressor->funcs->power_up_fbc(dc->fbc_compressor);
2423 void dce110_fill_display_configs(
2424 const struct dc_state *context,
2425 struct dm_pp_display_configuration *pp_display_cfg)
2430 for (j = 0; j < context->stream_count; j++) {
2433 const struct dc_stream_state *stream = context->streams[j];
2434 struct dm_pp_single_disp_config *cfg =
2435 &pp_display_cfg->disp_configs[num_cfgs];
2436 const struct pipe_ctx *pipe_ctx = NULL;
2438 for (k = 0; k < MAX_PIPES; k++)
2439 if (stream == context->res_ctx.pipe_ctx[k].stream) {
2440 pipe_ctx = &context->res_ctx.pipe_ctx[k];
2444 ASSERT(pipe_ctx != NULL);
2446 /* only notify active stream */
2447 if (stream->dpms_off)
2451 cfg->signal = pipe_ctx->stream->signal;
2452 cfg->pipe_idx = pipe_ctx->stream_res.tg->inst;
2453 cfg->src_height = stream->src.height;
2454 cfg->src_width = stream->src.width;
2455 cfg->ddi_channel_mapping =
2456 stream->sink->link->ddi_channel_mapping.raw;
2458 stream->sink->link->link_enc->transmitter;
2459 cfg->link_settings.lane_count =
2460 stream->sink->link->cur_link_settings.lane_count;
2461 cfg->link_settings.link_rate =
2462 stream->sink->link->cur_link_settings.link_rate;
2463 cfg->link_settings.link_spread =
2464 stream->sink->link->cur_link_settings.link_spread;
2465 cfg->sym_clock = stream->phy_pix_clk;
2466 /* Round v_refresh*/
2467 cfg->v_refresh = stream->timing.pix_clk_khz * 1000;
2468 cfg->v_refresh /= stream->timing.h_total;
2469 cfg->v_refresh = (cfg->v_refresh + stream->timing.v_total / 2)
2470 / stream->timing.v_total;
2473 pp_display_cfg->display_count = num_cfgs;
2476 uint32_t dce110_get_min_vblank_time_us(const struct dc_state *context)
2479 uint32_t min_vertical_blank_time = -1;
2481 for (j = 0; j < context->stream_count; j++) {
2482 struct dc_stream_state *stream = context->streams[j];
2483 uint32_t vertical_blank_in_pixels = 0;
2484 uint32_t vertical_blank_time = 0;
2486 vertical_blank_in_pixels = stream->timing.h_total *
2487 (stream->timing.v_total
2488 - stream->timing.v_addressable);
2490 vertical_blank_time = vertical_blank_in_pixels
2491 * 1000 / stream->timing.pix_clk_khz;
2493 if (min_vertical_blank_time > vertical_blank_time)
2494 min_vertical_blank_time = vertical_blank_time;
2497 return min_vertical_blank_time;
2500 static int determine_sclk_from_bounding_box(
2501 const struct dc *dc,
2507 * Some asics do not give us sclk levels, so we just report the actual
2510 if (dc->sclk_lvls.num_levels == 0)
2511 return required_sclk;
2513 for (i = 0; i < dc->sclk_lvls.num_levels; i++) {
2514 if (dc->sclk_lvls.clocks_in_khz[i] >= required_sclk)
2515 return dc->sclk_lvls.clocks_in_khz[i];
2518 * even maximum level could not satisfy requirement, this
2519 * is unexpected at this stage, should have been caught at
2523 return dc->sclk_lvls.clocks_in_khz[dc->sclk_lvls.num_levels - 1];
2526 static void pplib_apply_display_requirements(
2528 struct dc_state *context)
2530 struct dm_pp_display_configuration *pp_display_cfg = &context->pp_display_cfg;
2532 pp_display_cfg->all_displays_in_sync =
2533 context->bw.dce.all_displays_in_sync;
2534 pp_display_cfg->nb_pstate_switch_disable =
2535 context->bw.dce.nbp_state_change_enable == false;
2536 pp_display_cfg->cpu_cc6_disable =
2537 context->bw.dce.cpuc_state_change_enable == false;
2538 pp_display_cfg->cpu_pstate_disable =
2539 context->bw.dce.cpup_state_change_enable == false;
2540 pp_display_cfg->cpu_pstate_separation_time =
2541 context->bw.dce.blackout_recovery_time_us;
2543 pp_display_cfg->min_memory_clock_khz = context->bw.dce.yclk_khz
2544 / MEMORY_TYPE_MULTIPLIER;
2546 pp_display_cfg->min_engine_clock_khz = determine_sclk_from_bounding_box(
2548 context->bw.dce.sclk_khz);
2550 pp_display_cfg->min_dcfclock_khz = pp_display_cfg->min_engine_clock_khz;
2552 pp_display_cfg->min_engine_clock_deep_sleep_khz
2553 = context->bw.dce.sclk_deep_sleep_khz;
2555 pp_display_cfg->avail_mclk_switch_time_us =
2556 dce110_get_min_vblank_time_us(context);
2558 pp_display_cfg->avail_mclk_switch_time_in_disp_active_us = 0;
2560 pp_display_cfg->disp_clk_khz = dc->res_pool->dccg->clks.dispclk_khz;
2562 dce110_fill_display_configs(context, pp_display_cfg);
2564 /* TODO: is this still applicable?*/
2565 if (pp_display_cfg->display_count == 1) {
2566 const struct dc_crtc_timing *timing =
2567 &context->streams[0]->timing;
2569 pp_display_cfg->crtc_index =
2570 pp_display_cfg->disp_configs[0].pipe_idx;
2571 pp_display_cfg->line_time_in_us = timing->h_total * 1000
2572 / timing->pix_clk_khz;
2575 if (memcmp(&dc->prev_display_config, pp_display_cfg, sizeof(
2576 struct dm_pp_display_configuration)) != 0)
2577 dm_pp_apply_display_requirements(dc->ctx, pp_display_cfg);
2579 dc->prev_display_config = *pp_display_cfg;
2582 static void dce110_set_bandwidth(
2584 struct dc_state *context,
2585 bool decrease_allowed)
2587 struct dc_clocks req_clks;
2589 req_clks.dispclk_khz = context->bw.dce.dispclk_khz;
2590 req_clks.phyclk_khz = get_max_pixel_clock_for_all_paths(dc, context);
2592 if (decrease_allowed)
2593 dce110_set_displaymarks(dc, context);
2595 dce110_set_safe_displaymarks(&context->res_ctx, dc->res_pool);
2597 dc->res_pool->dccg->funcs->update_clocks(
2601 pplib_apply_display_requirements(dc, context);
2604 static void dce110_program_front_end_for_pipe(
2605 struct dc *dc, struct pipe_ctx *pipe_ctx)
2607 struct mem_input *mi = pipe_ctx->plane_res.mi;
2608 struct pipe_ctx *old_pipe = NULL;
2609 struct dc_plane_state *plane_state = pipe_ctx->plane_state;
2610 struct xfm_grph_csc_adjustment adjust;
2611 struct out_csc_color_matrix tbl_entry;
2612 unsigned int underlay_idx = dc->res_pool->underlay_pipe_index;
2615 memset(&tbl_entry, 0, sizeof(tbl_entry));
2617 if (dc->current_state)
2618 old_pipe = &dc->current_state->res_ctx.pipe_ctx[pipe_ctx->pipe_idx];
2620 memset(&adjust, 0, sizeof(adjust));
2621 adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_BYPASS;
2623 dce_enable_fe_clock(dc->hwseq, mi->inst, true);
2625 set_default_colors(pipe_ctx);
2626 if (pipe_ctx->stream->csc_color_matrix.enable_adjustment
2628 tbl_entry.color_space =
2629 pipe_ctx->stream->output_color_space;
2631 for (i = 0; i < 12; i++)
2632 tbl_entry.regval[i] =
2633 pipe_ctx->stream->csc_color_matrix.matrix[i];
2635 pipe_ctx->plane_res.xfm->funcs->opp_set_csc_adjustment
2636 (pipe_ctx->plane_res.xfm, &tbl_entry);
2639 if (pipe_ctx->stream->gamut_remap_matrix.enable_remap == true) {
2640 adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_SW;
2642 for (i = 0; i < CSC_TEMPERATURE_MATRIX_SIZE; i++)
2643 adjust.temperature_matrix[i] =
2644 pipe_ctx->stream->gamut_remap_matrix.matrix[i];
2647 pipe_ctx->plane_res.xfm->funcs->transform_set_gamut_remap(pipe_ctx->plane_res.xfm, &adjust);
2649 pipe_ctx->plane_res.scl_data.lb_params.alpha_en = pipe_ctx->bottom_pipe != 0;
2651 program_scaler(dc, pipe_ctx);
2653 /* fbc not applicable on Underlay pipe */
2654 if (dc->fbc_compressor && old_pipe->stream &&
2655 pipe_ctx->pipe_idx != underlay_idx) {
2656 if (plane_state->tiling_info.gfx8.array_mode == DC_ARRAY_LINEAR_GENERAL)
2657 dc->fbc_compressor->funcs->disable_fbc(dc->fbc_compressor);
2659 enable_fbc(dc, dc->current_state);
2662 mi->funcs->mem_input_program_surface_config(
2664 plane_state->format,
2665 &plane_state->tiling_info,
2666 &plane_state->plane_size,
2667 plane_state->rotation,
2670 if (mi->funcs->set_blank)
2671 mi->funcs->set_blank(mi, pipe_ctx->plane_state->visible);
2673 if (dc->config.gpu_vm_support)
2674 mi->funcs->mem_input_program_pte_vm(
2675 pipe_ctx->plane_res.mi,
2676 plane_state->format,
2677 &plane_state->tiling_info,
2678 plane_state->rotation);
2680 /* Moved programming gamma from dc to hwss */
2681 if (pipe_ctx->plane_state->update_flags.bits.full_update ||
2682 pipe_ctx->plane_state->update_flags.bits.in_transfer_func_change ||
2683 pipe_ctx->plane_state->update_flags.bits.gamma_change)
2684 dc->hwss.set_input_transfer_func(pipe_ctx, pipe_ctx->plane_state);
2686 if (pipe_ctx->plane_state->update_flags.bits.full_update)
2687 dc->hwss.set_output_transfer_func(pipe_ctx, pipe_ctx->stream);
2690 "Pipe:%d %p: addr hi:0x%x, "
2693 " %d; dst: %d, %d, %d, %d;"
2694 "clip: %d, %d, %d, %d\n",
2696 (void *) pipe_ctx->plane_state,
2697 pipe_ctx->plane_state->address.grph.addr.high_part,
2698 pipe_ctx->plane_state->address.grph.addr.low_part,
2699 pipe_ctx->plane_state->src_rect.x,
2700 pipe_ctx->plane_state->src_rect.y,
2701 pipe_ctx->plane_state->src_rect.width,
2702 pipe_ctx->plane_state->src_rect.height,
2703 pipe_ctx->plane_state->dst_rect.x,
2704 pipe_ctx->plane_state->dst_rect.y,
2705 pipe_ctx->plane_state->dst_rect.width,
2706 pipe_ctx->plane_state->dst_rect.height,
2707 pipe_ctx->plane_state->clip_rect.x,
2708 pipe_ctx->plane_state->clip_rect.y,
2709 pipe_ctx->plane_state->clip_rect.width,
2710 pipe_ctx->plane_state->clip_rect.height);
2713 "Pipe %d: width, height, x, y\n"
2714 "viewport:%d, %d, %d, %d\n"
2715 "recout: %d, %d, %d, %d\n",
2717 pipe_ctx->plane_res.scl_data.viewport.width,
2718 pipe_ctx->plane_res.scl_data.viewport.height,
2719 pipe_ctx->plane_res.scl_data.viewport.x,
2720 pipe_ctx->plane_res.scl_data.viewport.y,
2721 pipe_ctx->plane_res.scl_data.recout.width,
2722 pipe_ctx->plane_res.scl_data.recout.height,
2723 pipe_ctx->plane_res.scl_data.recout.x,
2724 pipe_ctx->plane_res.scl_data.recout.y);
2727 static void dce110_apply_ctx_for_surface(
2729 const struct dc_stream_state *stream,
2731 struct dc_state *context)
2735 if (num_planes == 0)
2738 for (i = 0; i < dc->res_pool->pipe_count; i++) {
2739 struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
2740 struct pipe_ctx *old_pipe_ctx = &dc->current_state->res_ctx.pipe_ctx[i];
2742 if (stream == pipe_ctx->stream) {
2743 if (!pipe_ctx->top_pipe &&
2744 (pipe_ctx->plane_state || old_pipe_ctx->plane_state))
2745 dc->hwss.pipe_control_lock(dc, pipe_ctx, true);
2749 for (i = 0; i < dc->res_pool->pipe_count; i++) {
2750 struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
2752 if (pipe_ctx->stream != stream)
2755 /* Need to allocate mem before program front end for Fiji */
2756 pipe_ctx->plane_res.mi->funcs->allocate_mem_input(
2757 pipe_ctx->plane_res.mi,
2758 pipe_ctx->stream->timing.h_total,
2759 pipe_ctx->stream->timing.v_total,
2760 pipe_ctx->stream->timing.pix_clk_khz,
2761 context->stream_count);
2763 dce110_program_front_end_for_pipe(dc, pipe_ctx);
2765 dc->hwss.update_plane_addr(dc, pipe_ctx);
2767 program_surface_visibility(dc, pipe_ctx);
2771 for (i = 0; i < dc->res_pool->pipe_count; i++) {
2772 struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
2773 struct pipe_ctx *old_pipe_ctx = &dc->current_state->res_ctx.pipe_ctx[i];
2775 if ((stream == pipe_ctx->stream) &&
2776 (!pipe_ctx->top_pipe) &&
2777 (pipe_ctx->plane_state || old_pipe_ctx->plane_state))
2778 dc->hwss.pipe_control_lock(dc, pipe_ctx, false);
2782 static void dce110_power_down_fe(struct dc *dc, struct pipe_ctx *pipe_ctx)
2784 int fe_idx = pipe_ctx->plane_res.mi ?
2785 pipe_ctx->plane_res.mi->inst : pipe_ctx->pipe_idx;
2787 /* Do not power down fe when stream is active on dce*/
2788 if (dc->current_state->res_ctx.pipe_ctx[fe_idx].stream)
2791 dc->hwss.enable_display_power_gating(
2792 dc, fe_idx, dc->ctx->dc_bios, PIPE_GATING_CONTROL_ENABLE);
2794 dc->res_pool->transforms[fe_idx]->funcs->transform_reset(
2795 dc->res_pool->transforms[fe_idx]);
2798 static void dce110_wait_for_mpcc_disconnect(
2800 struct resource_pool *res_pool,
2801 struct pipe_ctx *pipe_ctx)
2806 static void program_csc_matrix(struct pipe_ctx *pipe_ctx,
2807 enum dc_color_space colorspace,
2811 struct out_csc_color_matrix tbl_entry;
2813 if (pipe_ctx->stream->csc_color_matrix.enable_adjustment
2815 enum dc_color_space color_space =
2816 pipe_ctx->stream->output_color_space;
2818 //uint16_t matrix[12];
2819 for (i = 0; i < 12; i++)
2820 tbl_entry.regval[i] = pipe_ctx->stream->csc_color_matrix.matrix[i];
2822 tbl_entry.color_space = color_space;
2823 //tbl_entry.regval = matrix;
2824 pipe_ctx->plane_res.xfm->funcs->opp_set_csc_adjustment(pipe_ctx->plane_res.xfm, &tbl_entry);
2828 void dce110_set_cursor_position(struct pipe_ctx *pipe_ctx)
2830 struct dc_cursor_position pos_cpy = pipe_ctx->stream->cursor_position;
2831 struct input_pixel_processor *ipp = pipe_ctx->plane_res.ipp;
2832 struct mem_input *mi = pipe_ctx->plane_res.mi;
2833 struct dc_cursor_mi_param param = {
2834 .pixel_clk_khz = pipe_ctx->stream->timing.pix_clk_khz,
2835 .ref_clk_khz = pipe_ctx->stream->ctx->dc->res_pool->ref_clock_inKhz,
2836 .viewport = pipe_ctx->plane_res.scl_data.viewport,
2837 .h_scale_ratio = pipe_ctx->plane_res.scl_data.ratios.horz,
2838 .v_scale_ratio = pipe_ctx->plane_res.scl_data.ratios.vert,
2839 .rotation = pipe_ctx->plane_state->rotation,
2840 .mirror = pipe_ctx->plane_state->horizontal_mirror
2843 if (pipe_ctx->plane_state->address.type
2844 == PLN_ADDR_TYPE_VIDEO_PROGRESSIVE)
2845 pos_cpy.enable = false;
2847 if (pipe_ctx->top_pipe && pipe_ctx->plane_state != pipe_ctx->top_pipe->plane_state)
2848 pos_cpy.enable = false;
2850 if (ipp->funcs->ipp_cursor_set_position)
2851 ipp->funcs->ipp_cursor_set_position(ipp, &pos_cpy, ¶m);
2852 if (mi->funcs->set_cursor_position)
2853 mi->funcs->set_cursor_position(mi, &pos_cpy, ¶m);
2856 void dce110_set_cursor_attribute(struct pipe_ctx *pipe_ctx)
2858 struct dc_cursor_attributes *attributes = &pipe_ctx->stream->cursor_attributes;
2860 if (pipe_ctx->plane_res.ipp &&
2861 pipe_ctx->plane_res.ipp->funcs->ipp_cursor_set_attributes)
2862 pipe_ctx->plane_res.ipp->funcs->ipp_cursor_set_attributes(
2863 pipe_ctx->plane_res.ipp, attributes);
2865 if (pipe_ctx->plane_res.mi &&
2866 pipe_ctx->plane_res.mi->funcs->set_cursor_attributes)
2867 pipe_ctx->plane_res.mi->funcs->set_cursor_attributes(
2868 pipe_ctx->plane_res.mi, attributes);
2870 if (pipe_ctx->plane_res.xfm &&
2871 pipe_ctx->plane_res.xfm->funcs->set_cursor_attributes)
2872 pipe_ctx->plane_res.xfm->funcs->set_cursor_attributes(
2873 pipe_ctx->plane_res.xfm, attributes);
2876 static void ready_shared_resources(struct dc *dc, struct dc_state *context) {}
2878 static void optimize_shared_resources(struct dc *dc) {}
2880 static const struct hw_sequencer_funcs dce110_funcs = {
2881 .program_gamut_remap = program_gamut_remap,
2882 .program_csc_matrix = program_csc_matrix,
2884 .apply_ctx_to_hw = dce110_apply_ctx_to_hw,
2885 .apply_ctx_for_surface = dce110_apply_ctx_for_surface,
2886 .update_plane_addr = update_plane_addr,
2887 .update_pending_status = dce110_update_pending_status,
2888 .set_input_transfer_func = dce110_set_input_transfer_func,
2889 .set_output_transfer_func = dce110_set_output_transfer_func,
2890 .power_down = dce110_power_down,
2891 .enable_accelerated_mode = dce110_enable_accelerated_mode,
2892 .enable_timing_synchronization = dce110_enable_timing_synchronization,
2893 .enable_per_frame_crtc_position_reset = dce110_enable_per_frame_crtc_position_reset,
2894 .update_info_frame = dce110_update_info_frame,
2895 .enable_stream = dce110_enable_stream,
2896 .disable_stream = dce110_disable_stream,
2897 .unblank_stream = dce110_unblank_stream,
2898 .blank_stream = dce110_blank_stream,
2899 .enable_audio_stream = dce110_enable_audio_stream,
2900 .disable_audio_stream = dce110_disable_audio_stream,
2901 .enable_display_pipe_clock_gating = enable_display_pipe_clock_gating,
2902 .enable_display_power_gating = dce110_enable_display_power_gating,
2903 .disable_plane = dce110_power_down_fe,
2904 .pipe_control_lock = dce_pipe_control_lock,
2905 .set_bandwidth = dce110_set_bandwidth,
2907 .get_position = get_position,
2908 .set_static_screen_control = set_static_screen_control,
2909 .reset_hw_ctx_wrap = dce110_reset_hw_ctx_wrap,
2910 .enable_stream_timing = dce110_enable_stream_timing,
2911 .setup_stereo = NULL,
2912 .set_avmute = dce110_set_avmute,
2913 .wait_for_mpcc_disconnect = dce110_wait_for_mpcc_disconnect,
2914 .ready_shared_resources = ready_shared_resources,
2915 .optimize_shared_resources = optimize_shared_resources,
2916 .pplib_apply_display_requirements = pplib_apply_display_requirements,
2917 .edp_backlight_control = hwss_edp_backlight_control,
2918 .edp_power_control = hwss_edp_power_control,
2919 .edp_wait_for_hpd_ready = hwss_edp_wait_for_hpd_ready,
2920 .set_cursor_position = dce110_set_cursor_position,
2921 .set_cursor_attribute = dce110_set_cursor_attribute
2924 void dce110_hw_sequencer_construct(struct dc *dc)
2926 dc->hwss = dce110_funcs;