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"
37 #include "dce110_compressor.h"
40 #include "bios/bios_parser_helper.h"
41 #include "timing_generator.h"
42 #include "mem_input.h"
45 #include "transform.h"
46 #include "stream_encoder.h"
47 #include "link_encoder.h"
48 #include "clock_source.h"
51 #include "dce/dce_hwseq.h"
52 #include "reg_helper.h"
54 /* include DCE11 register header files */
55 #include "dce/dce_11_0_d.h"
56 #include "dce/dce_11_0_sh_mask.h"
57 #include "custom_float.h"
59 struct dce110_hw_seq_reg_offsets
{
63 static const struct dce110_hw_seq_reg_offsets reg_offsets
[] = {
65 .crtc
= (mmCRTC0_CRTC_GSL_CONTROL
- mmCRTC_GSL_CONTROL
),
68 .crtc
= (mmCRTC1_CRTC_GSL_CONTROL
- mmCRTC_GSL_CONTROL
),
71 .crtc
= (mmCRTC2_CRTC_GSL_CONTROL
- mmCRTC_GSL_CONTROL
),
74 .crtc
= (mmCRTCV_GSL_CONTROL
- mmCRTC_GSL_CONTROL
),
78 #define HW_REG_BLND(reg, id)\
79 (reg + reg_offsets[id].blnd)
81 #define HW_REG_CRTC(reg, id)\
82 (reg + reg_offsets[id].crtc)
84 #define MAX_WATERMARK 0xFFFF
85 #define SAFE_NBP_MARK 0x7FFF
87 /*******************************************************************************
89 ******************************************************************************/
90 /***************************PIPE_CONTROL***********************************/
91 static void dce110_init_pte(struct dc_context
*ctx
)
95 uint32_t chunk_int
= 0;
96 uint32_t chunk_mul
= 0;
98 addr
= mmUNP_DVMM_PTE_CONTROL
;
99 value
= dm_read_reg(ctx
, addr
);
105 DVMM_USE_SINGLE_PTE
);
111 DVMM_PTE_BUFFER_MODE0
);
117 DVMM_PTE_BUFFER_MODE1
);
119 dm_write_reg(ctx
, addr
, value
);
121 addr
= mmDVMM_PTE_REQ
;
122 value
= dm_read_reg(ctx
, addr
);
124 chunk_int
= get_reg_field_value(
127 HFLIP_PTEREQ_PER_CHUNK_INT
);
129 chunk_mul
= get_reg_field_value(
132 HFLIP_PTEREQ_PER_CHUNK_MULTIPLIER
);
134 if (chunk_int
!= 0x4 || chunk_mul
!= 0x4) {
140 MAX_PTEREQ_TO_ISSUE
);
146 HFLIP_PTEREQ_PER_CHUNK_INT
);
152 HFLIP_PTEREQ_PER_CHUNK_MULTIPLIER
);
154 dm_write_reg(ctx
, addr
, value
);
157 /**************************************************************************/
159 static void enable_display_pipe_clock_gating(
160 struct dc_context
*ctx
,
166 static bool dce110_enable_display_power_gating(
168 uint8_t controller_id
,
170 enum pipe_gating_control power_gating
)
172 enum bp_result bp_result
= BP_RESULT_OK
;
173 enum bp_pipe_control_action cntl
;
174 struct dc_context
*ctx
= dc
->ctx
;
175 unsigned int underlay_idx
= dc
->res_pool
->underlay_pipe_index
;
177 if (IS_FPGA_MAXIMUS_DC(ctx
->dce_environment
))
180 if (power_gating
== PIPE_GATING_CONTROL_INIT
)
181 cntl
= ASIC_PIPE_INIT
;
182 else if (power_gating
== PIPE_GATING_CONTROL_ENABLE
)
183 cntl
= ASIC_PIPE_ENABLE
;
185 cntl
= ASIC_PIPE_DISABLE
;
187 if (controller_id
== underlay_idx
)
188 controller_id
= CONTROLLER_ID_UNDERLAY0
- 1;
190 if (power_gating
!= PIPE_GATING_CONTROL_INIT
|| controller_id
== 0){
192 bp_result
= dcb
->funcs
->enable_disp_power_gating(
193 dcb
, controller_id
+ 1, cntl
);
195 /* Revert MASTER_UPDATE_MODE to 0 because bios sets it 2
196 * by default when command table is called
198 * Bios parser accepts controller_id = 6 as indicative of
199 * underlay pipe in dce110. But we do not support more
202 if (controller_id
< CONTROLLER_ID_MAX
- 1)
204 HW_REG_CRTC(mmCRTC_MASTER_UPDATE_MODE
, controller_id
),
208 if (power_gating
!= PIPE_GATING_CONTROL_ENABLE
)
209 dce110_init_pte(ctx
);
211 if (bp_result
== BP_RESULT_OK
)
217 static void build_prescale_params(struct ipp_prescale_params
*prescale_params
,
218 const struct dc_plane_state
*plane_state
)
220 prescale_params
->mode
= IPP_PRESCALE_MODE_FIXED_UNSIGNED
;
222 switch (plane_state
->format
) {
223 case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888
:
224 case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888
:
225 prescale_params
->scale
= 0x2020;
227 case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010
:
228 case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010
:
229 prescale_params
->scale
= 0x2008;
231 case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616
:
232 case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F
:
233 prescale_params
->scale
= 0x2000;
241 static bool dce110_set_input_transfer_func(
242 struct pipe_ctx
*pipe_ctx
,
243 const struct dc_plane_state
*plane_state
)
245 struct input_pixel_processor
*ipp
= pipe_ctx
->plane_res
.ipp
;
246 const struct dc_transfer_func
*tf
= NULL
;
247 struct ipp_prescale_params prescale_params
= { 0 };
253 if (plane_state
->in_transfer_func
)
254 tf
= plane_state
->in_transfer_func
;
256 build_prescale_params(&prescale_params
, plane_state
);
257 ipp
->funcs
->ipp_program_prescale(ipp
, &prescale_params
);
259 if (plane_state
->gamma_correction
&& dce_use_lut(plane_state
))
260 ipp
->funcs
->ipp_program_input_lut(ipp
, plane_state
->gamma_correction
);
263 /* Default case if no input transfer function specified */
264 ipp
->funcs
->ipp_set_degamma(ipp
,
265 IPP_DEGAMMA_MODE_HW_sRGB
);
266 } else if (tf
->type
== TF_TYPE_PREDEFINED
) {
268 case TRANSFER_FUNCTION_SRGB
:
269 ipp
->funcs
->ipp_set_degamma(ipp
,
270 IPP_DEGAMMA_MODE_HW_sRGB
);
272 case TRANSFER_FUNCTION_BT709
:
273 ipp
->funcs
->ipp_set_degamma(ipp
,
274 IPP_DEGAMMA_MODE_HW_xvYCC
);
276 case TRANSFER_FUNCTION_LINEAR
:
277 ipp
->funcs
->ipp_set_degamma(ipp
,
278 IPP_DEGAMMA_MODE_BYPASS
);
280 case TRANSFER_FUNCTION_PQ
:
287 } else if (tf
->type
== TF_TYPE_BYPASS
) {
288 ipp
->funcs
->ipp_set_degamma(ipp
, IPP_DEGAMMA_MODE_BYPASS
);
290 /*TF_TYPE_DISTRIBUTED_POINTS - Not supported in DCE 11*/
297 static bool convert_to_custom_float(
298 struct pwl_result_data
*rgb_resulted
,
299 struct curve_points
*arr_points
,
300 uint32_t hw_points_num
)
302 struct custom_float_format fmt
;
304 struct pwl_result_data
*rgb
= rgb_resulted
;
308 fmt
.exponenta_bits
= 6;
309 fmt
.mantissa_bits
= 12;
312 if (!convert_to_custom_float_format(
315 &arr_points
[0].custom_float_x
)) {
320 if (!convert_to_custom_float_format(
321 arr_points
[0].offset
,
323 &arr_points
[0].custom_float_offset
)) {
328 if (!convert_to_custom_float_format(
331 &arr_points
[0].custom_float_slope
)) {
336 fmt
.mantissa_bits
= 10;
339 if (!convert_to_custom_float_format(
342 &arr_points
[1].custom_float_x
)) {
347 if (!convert_to_custom_float_format(
350 &arr_points
[1].custom_float_y
)) {
355 if (!convert_to_custom_float_format(
358 &arr_points
[2].custom_float_slope
)) {
363 fmt
.mantissa_bits
= 12;
366 while (i
!= hw_points_num
) {
367 if (!convert_to_custom_float_format(
375 if (!convert_to_custom_float_format(
383 if (!convert_to_custom_float_format(
391 if (!convert_to_custom_float_format(
394 &rgb
->delta_red_reg
)) {
399 if (!convert_to_custom_float_format(
402 &rgb
->delta_green_reg
)) {
407 if (!convert_to_custom_float_format(
410 &rgb
->delta_blue_reg
)) {
422 static bool dce110_translate_regamma_to_hw_format(const struct dc_transfer_func
423 *output_tf
, struct pwl_params
*regamma_params
)
425 struct curve_points
*arr_points
;
426 struct pwl_result_data
*rgb_resulted
;
427 struct pwl_result_data
*rgb
;
428 struct pwl_result_data
*rgb_plus_1
;
429 struct fixed31_32 y_r
;
430 struct fixed31_32 y_g
;
431 struct fixed31_32 y_b
;
432 struct fixed31_32 y1_min
;
433 struct fixed31_32 y3_max
;
435 int32_t segment_start
, segment_end
;
436 uint32_t i
, j
, k
, seg_distr
[16], increment
, start_index
, hw_points
;
438 if (output_tf
== NULL
|| regamma_params
== NULL
||
439 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
474 * segment is from 2^-10 to 2^0
497 for (k
= 0; k
< 16; k
++) {
498 if (seg_distr
[k
] != -1)
499 hw_points
+= (1 << seg_distr
[k
]);
503 for (k
= 0; k
< (segment_end
- segment_start
); k
++) {
504 increment
= 32 / (1 << seg_distr
[k
]);
505 start_index
= (segment_start
+ k
+ 25) * 32;
506 for (i
= start_index
; i
< start_index
+ 32; i
+= increment
) {
507 if (j
== hw_points
- 1)
509 rgb_resulted
[j
].red
= output_tf
->tf_pts
.red
[i
];
510 rgb_resulted
[j
].green
= output_tf
->tf_pts
.green
[i
];
511 rgb_resulted
[j
].blue
= output_tf
->tf_pts
.blue
[i
];
517 start_index
= (segment_end
+ 25) * 32;
518 rgb_resulted
[hw_points
- 1].red
=
519 output_tf
->tf_pts
.red
[start_index
];
520 rgb_resulted
[hw_points
- 1].green
=
521 output_tf
->tf_pts
.green
[start_index
];
522 rgb_resulted
[hw_points
- 1].blue
=
523 output_tf
->tf_pts
.blue
[start_index
];
525 arr_points
[0].x
= dal_fixed31_32_pow(dal_fixed31_32_from_int(2),
526 dal_fixed31_32_from_int(segment_start
));
527 arr_points
[1].x
= dal_fixed31_32_pow(dal_fixed31_32_from_int(2),
528 dal_fixed31_32_from_int(segment_end
));
529 arr_points
[2].x
= dal_fixed31_32_pow(dal_fixed31_32_from_int(2),
530 dal_fixed31_32_from_int(segment_end
));
532 y_r
= rgb_resulted
[0].red
;
533 y_g
= rgb_resulted
[0].green
;
534 y_b
= rgb_resulted
[0].blue
;
536 y1_min
= dal_fixed31_32_min(y_r
, dal_fixed31_32_min(y_g
, y_b
));
538 arr_points
[0].y
= y1_min
;
539 arr_points
[0].slope
= dal_fixed31_32_div(
543 y_r
= rgb_resulted
[hw_points
- 1].red
;
544 y_g
= rgb_resulted
[hw_points
- 1].green
;
545 y_b
= rgb_resulted
[hw_points
- 1].blue
;
547 /* see comment above, m_arrPoints[1].y should be the Y value for the
548 * region end (m_numOfHwPoints), not last HW point(m_numOfHwPoints - 1)
550 y3_max
= dal_fixed31_32_max(y_r
, dal_fixed31_32_max(y_g
, y_b
));
552 arr_points
[1].y
= y3_max
;
553 arr_points
[2].y
= y3_max
;
555 arr_points
[1].slope
= dal_fixed31_32_zero
;
556 arr_points
[2].slope
= dal_fixed31_32_zero
;
558 if (output_tf
->tf
== TRANSFER_FUNCTION_PQ
) {
559 /* for PQ, we want to have a straight line from last HW X point,
560 * and the slope to be such that we hit 1.0 at 10000 nits.
562 const struct fixed31_32 end_value
=
563 dal_fixed31_32_from_int(125);
565 arr_points
[1].slope
= dal_fixed31_32_div(
566 dal_fixed31_32_sub(dal_fixed31_32_one
, arr_points
[1].y
),
567 dal_fixed31_32_sub(end_value
, arr_points
[1].x
));
568 arr_points
[2].slope
= dal_fixed31_32_div(
569 dal_fixed31_32_sub(dal_fixed31_32_one
, arr_points
[1].y
),
570 dal_fixed31_32_sub(end_value
, arr_points
[1].x
));
573 regamma_params
->hw_points_num
= hw_points
;
576 for (k
= 0; k
< 16 && i
< 16; k
++) {
577 if (seg_distr
[k
] != -1) {
578 regamma_params
->arr_curve_points
[k
].segments_num
=
580 regamma_params
->arr_curve_points
[i
].offset
=
581 regamma_params
->arr_curve_points
[k
].
582 offset
+ (1 << seg_distr
[k
]);
587 if (seg_distr
[k
] != -1)
588 regamma_params
->arr_curve_points
[k
].segments_num
=
592 rgb_plus_1
= rgb_resulted
+ 1;
596 while (i
!= hw_points
+ 1) {
597 if (dal_fixed31_32_lt(rgb_plus_1
->red
, rgb
->red
))
598 rgb_plus_1
->red
= rgb
->red
;
599 if (dal_fixed31_32_lt(rgb_plus_1
->green
, rgb
->green
))
600 rgb_plus_1
->green
= rgb
->green
;
601 if (dal_fixed31_32_lt(rgb_plus_1
->blue
, rgb
->blue
))
602 rgb_plus_1
->blue
= rgb
->blue
;
604 rgb
->delta_red
= dal_fixed31_32_sub(
607 rgb
->delta_green
= dal_fixed31_32_sub(
610 rgb
->delta_blue
= dal_fixed31_32_sub(
619 convert_to_custom_float(rgb_resulted
, arr_points
, hw_points
);
624 static bool dce110_set_output_transfer_func(
625 struct pipe_ctx
*pipe_ctx
,
626 const struct dc_stream_state
*stream
)
628 struct transform
*xfm
= pipe_ctx
->plane_res
.xfm
;
630 xfm
->funcs
->opp_power_on_regamma_lut(xfm
, true);
631 xfm
->regamma_params
.hw_points_num
= GAMMA_HW_POINTS_NUM
;
633 if (stream
->out_transfer_func
&&
634 stream
->out_transfer_func
->type
==
635 TF_TYPE_PREDEFINED
&&
636 stream
->out_transfer_func
->tf
==
637 TRANSFER_FUNCTION_SRGB
) {
638 xfm
->funcs
->opp_set_regamma_mode(xfm
, OPP_REGAMMA_SRGB
);
639 } else if (dce110_translate_regamma_to_hw_format(
640 stream
->out_transfer_func
, &xfm
->regamma_params
)) {
641 xfm
->funcs
->opp_program_regamma_pwl(xfm
, &xfm
->regamma_params
);
642 xfm
->funcs
->opp_set_regamma_mode(xfm
, OPP_REGAMMA_USER
);
644 xfm
->funcs
->opp_set_regamma_mode(xfm
, OPP_REGAMMA_BYPASS
);
647 xfm
->funcs
->opp_power_on_regamma_lut(xfm
, false);
652 static enum dc_status
bios_parser_crtc_source_select(
653 struct pipe_ctx
*pipe_ctx
)
656 /* call VBIOS table to set CRTC source for the HW
658 * note: video bios clears all FMT setting here. */
659 struct bp_crtc_source_select crtc_source_select
= {0};
660 const struct dc_sink
*sink
= pipe_ctx
->stream
->sink
;
662 crtc_source_select
.engine_id
= pipe_ctx
->stream_res
.stream_enc
->id
;
663 crtc_source_select
.controller_id
= pipe_ctx
->pipe_idx
+ 1;
664 /*TODO: Need to un-hardcode color depth, dp_audio and account for
665 * the case where signal and sink signal is different (translator
667 crtc_source_select
.signal
= pipe_ctx
->stream
->signal
;
668 crtc_source_select
.enable_dp_audio
= false;
669 crtc_source_select
.sink_signal
= pipe_ctx
->stream
->signal
;
670 crtc_source_select
.display_output_bit_depth
= PANEL_8BIT_COLOR
;
672 dcb
= sink
->ctx
->dc_bios
;
674 if (BP_RESULT_OK
!= dcb
->funcs
->crtc_source_select(
676 &crtc_source_select
)) {
677 return DC_ERROR_UNEXPECTED
;
683 void dce110_update_info_frame(struct pipe_ctx
*pipe_ctx
)
685 ASSERT(pipe_ctx
->stream
);
687 if (pipe_ctx
->stream_res
.stream_enc
== NULL
)
688 return; /* this is not root pipe */
690 if (dc_is_hdmi_signal(pipe_ctx
->stream
->signal
))
691 pipe_ctx
->stream_res
.stream_enc
->funcs
->update_hdmi_info_packets(
692 pipe_ctx
->stream_res
.stream_enc
,
693 &pipe_ctx
->stream_res
.encoder_info_frame
);
694 else if (dc_is_dp_signal(pipe_ctx
->stream
->signal
))
695 pipe_ctx
->stream_res
.stream_enc
->funcs
->update_dp_info_packets(
696 pipe_ctx
->stream_res
.stream_enc
,
697 &pipe_ctx
->stream_res
.encoder_info_frame
);
700 void dce110_enable_stream(struct pipe_ctx
*pipe_ctx
)
702 enum dc_lane_count lane_count
=
703 pipe_ctx
->stream
->sink
->link
->cur_link_settings
.lane_count
;
705 struct dc_crtc_timing
*timing
= &pipe_ctx
->stream
->timing
;
706 struct dc_link
*link
= pipe_ctx
->stream
->sink
->link
;
708 /* 1. update AVI info frame (HDMI, DP)
709 * we always need to update info frame
711 uint32_t active_total_with_borders
;
712 uint32_t early_control
= 0;
713 struct timing_generator
*tg
= pipe_ctx
->stream_res
.tg
;
715 /* TODOFPGA may change to hwss.update_info_frame */
716 dce110_update_info_frame(pipe_ctx
);
717 /* enable early control to avoid corruption on DP monitor*/
718 active_total_with_borders
=
719 timing
->h_addressable
720 + timing
->h_border_left
721 + timing
->h_border_right
;
724 early_control
= active_total_with_borders
% lane_count
;
726 if (early_control
== 0)
727 early_control
= lane_count
;
729 tg
->funcs
->set_early_control(tg
, early_control
);
731 /* enable audio only within mode set */
732 if (pipe_ctx
->stream_res
.audio
!= NULL
) {
733 if (dc_is_dp_signal(pipe_ctx
->stream
->signal
))
734 pipe_ctx
->stream_res
.stream_enc
->funcs
->dp_audio_enable(pipe_ctx
->stream_res
.stream_enc
);
737 /* For MST, there are multiply stream go to only one link.
738 * connect DIG back_end to front_end while enable_stream and
739 * disconnect them during disable_stream
740 * BY this, it is logic clean to separate stream and link */
741 link
->link_enc
->funcs
->connect_dig_be_to_fe(link
->link_enc
,
742 pipe_ctx
->stream_res
.stream_enc
->id
, true);
746 void dce110_disable_stream(struct pipe_ctx
*pipe_ctx
)
748 struct dc_stream_state
*stream
= pipe_ctx
->stream
;
749 struct dc_link
*link
= stream
->sink
->link
;
751 if (pipe_ctx
->stream_res
.audio
) {
752 pipe_ctx
->stream_res
.audio
->funcs
->az_disable(pipe_ctx
->stream_res
.audio
);
754 if (dc_is_dp_signal(pipe_ctx
->stream
->signal
))
755 pipe_ctx
->stream_res
.stream_enc
->funcs
->dp_audio_disable(
756 pipe_ctx
->stream_res
.stream_enc
);
758 pipe_ctx
->stream_res
.stream_enc
->funcs
->hdmi_audio_disable(
759 pipe_ctx
->stream_res
.stream_enc
);
761 pipe_ctx
->stream_res
.audio
= NULL
;
763 /* TODO: notify audio driver for if audio modes list changed
764 * add audio mode list change flag */
765 /* dal_audio_disable_azalia_audio_jack_presence(stream->audio,
766 * stream->stream_engine_id);
770 if (dc_is_hdmi_signal(pipe_ctx
->stream
->signal
))
771 pipe_ctx
->stream_res
.stream_enc
->funcs
->stop_hdmi_info_packets(
772 pipe_ctx
->stream_res
.stream_enc
);
774 if (dc_is_dp_signal(pipe_ctx
->stream
->signal
))
775 pipe_ctx
->stream_res
.stream_enc
->funcs
->stop_dp_info_packets(
776 pipe_ctx
->stream_res
.stream_enc
);
778 pipe_ctx
->stream_res
.stream_enc
->funcs
->audio_mute_control(
779 pipe_ctx
->stream_res
.stream_enc
, true);
782 /* blank at encoder level */
783 if (dc_is_dp_signal(pipe_ctx
->stream
->signal
))
784 pipe_ctx
->stream_res
.stream_enc
->funcs
->dp_blank(pipe_ctx
->stream_res
.stream_enc
);
786 link
->link_enc
->funcs
->connect_dig_be_to_fe(
788 pipe_ctx
->stream_res
.stream_enc
->id
,
793 void dce110_unblank_stream(struct pipe_ctx
*pipe_ctx
,
794 struct dc_link_settings
*link_settings
)
796 struct encoder_unblank_param params
= { { 0 } };
798 /* only 3 items below are used by unblank */
799 params
.pixel_clk_khz
=
800 pipe_ctx
->stream
->timing
.pix_clk_khz
;
801 params
.link_settings
.link_rate
= link_settings
->link_rate
;
802 pipe_ctx
->stream_res
.stream_enc
->funcs
->dp_unblank(pipe_ctx
->stream_res
.stream_enc
, ¶ms
);
806 void dce110_set_avmute(struct pipe_ctx
*pipe_ctx
, bool enable
)
808 if (pipe_ctx
!= NULL
&& pipe_ctx
->stream_res
.stream_enc
!= NULL
)
809 pipe_ctx
->stream_res
.stream_enc
->funcs
->set_avmute(pipe_ctx
->stream_res
.stream_enc
, enable
);
812 static enum audio_dto_source
translate_to_dto_source(enum controller_id crtc_id
)
815 case CONTROLLER_ID_D0
:
816 return DTO_SOURCE_ID0
;
817 case CONTROLLER_ID_D1
:
818 return DTO_SOURCE_ID1
;
819 case CONTROLLER_ID_D2
:
820 return DTO_SOURCE_ID2
;
821 case CONTROLLER_ID_D3
:
822 return DTO_SOURCE_ID3
;
823 case CONTROLLER_ID_D4
:
824 return DTO_SOURCE_ID4
;
825 case CONTROLLER_ID_D5
:
826 return DTO_SOURCE_ID5
;
828 return DTO_SOURCE_UNKNOWN
;
832 static void build_audio_output(
833 const struct pipe_ctx
*pipe_ctx
,
834 struct audio_output
*audio_output
)
836 const struct dc_stream_state
*stream
= pipe_ctx
->stream
;
837 audio_output
->engine_id
= pipe_ctx
->stream_res
.stream_enc
->id
;
839 audio_output
->signal
= pipe_ctx
->stream
->signal
;
841 /* audio_crtc_info */
843 audio_output
->crtc_info
.h_total
=
844 stream
->timing
.h_total
;
847 * Audio packets are sent during actual CRTC blank physical signal, we
848 * need to specify actual active signal portion
850 audio_output
->crtc_info
.h_active
=
851 stream
->timing
.h_addressable
852 + stream
->timing
.h_border_left
853 + stream
->timing
.h_border_right
;
855 audio_output
->crtc_info
.v_active
=
856 stream
->timing
.v_addressable
857 + stream
->timing
.v_border_top
858 + stream
->timing
.v_border_bottom
;
860 audio_output
->crtc_info
.pixel_repetition
= 1;
862 audio_output
->crtc_info
.interlaced
=
863 stream
->timing
.flags
.INTERLACE
;
865 audio_output
->crtc_info
.refresh_rate
=
866 (stream
->timing
.pix_clk_khz
*1000)/
867 (stream
->timing
.h_total
*stream
->timing
.v_total
);
869 audio_output
->crtc_info
.color_depth
=
870 stream
->timing
.display_color_depth
;
872 audio_output
->crtc_info
.requested_pixel_clock
=
873 pipe_ctx
->stream_res
.pix_clk_params
.requested_pix_clk
;
875 audio_output
->crtc_info
.calculated_pixel_clock
=
876 pipe_ctx
->stream_res
.pix_clk_params
.requested_pix_clk
;
878 /*for HDMI, audio ACR is with deep color ratio factor*/
879 if (dc_is_hdmi_signal(pipe_ctx
->stream
->signal
) &&
880 audio_output
->crtc_info
.requested_pixel_clock
==
881 stream
->timing
.pix_clk_khz
) {
882 if (pipe_ctx
->stream_res
.pix_clk_params
.pixel_encoding
== PIXEL_ENCODING_YCBCR420
) {
883 audio_output
->crtc_info
.requested_pixel_clock
=
884 audio_output
->crtc_info
.requested_pixel_clock
/2;
885 audio_output
->crtc_info
.calculated_pixel_clock
=
886 pipe_ctx
->stream_res
.pix_clk_params
.requested_pix_clk
/2;
891 if (pipe_ctx
->stream
->signal
== SIGNAL_TYPE_DISPLAY_PORT
||
892 pipe_ctx
->stream
->signal
== SIGNAL_TYPE_DISPLAY_PORT_MST
) {
893 audio_output
->pll_info
.dp_dto_source_clock_in_khz
=
894 pipe_ctx
->dis_clk
->funcs
->get_dp_ref_clk_frequency(
898 audio_output
->pll_info
.feed_back_divider
=
899 pipe_ctx
->pll_settings
.feedback_divider
;
901 audio_output
->pll_info
.dto_source
=
902 translate_to_dto_source(
903 pipe_ctx
->pipe_idx
+ 1);
905 /* TODO hard code to enable for now. Need get from stream */
906 audio_output
->pll_info
.ss_enabled
= true;
908 audio_output
->pll_info
.ss_percentage
=
909 pipe_ctx
->pll_settings
.ss_percentage
;
912 static void get_surface_visual_confirm_color(const struct pipe_ctx
*pipe_ctx
,
913 struct tg_color
*color
)
915 uint32_t color_value
= MAX_TG_COLOR_VALUE
* (4 - pipe_ctx
->pipe_idx
) / 4;
917 switch (pipe_ctx
->plane_res
.scl_data
.format
) {
918 case PIXEL_FORMAT_ARGB8888
:
919 /* set boarder color to red */
920 color
->color_r_cr
= color_value
;
923 case PIXEL_FORMAT_ARGB2101010
:
924 /* set boarder color to blue */
925 color
->color_b_cb
= color_value
;
927 case PIXEL_FORMAT_420BPP8
:
928 /* set boarder color to green */
929 color
->color_g_y
= color_value
;
931 case PIXEL_FORMAT_420BPP10
:
932 /* set boarder color to yellow */
933 color
->color_g_y
= color_value
;
934 color
->color_r_cr
= color_value
;
936 case PIXEL_FORMAT_FP16
:
937 /* set boarder color to white */
938 color
->color_r_cr
= color_value
;
939 color
->color_b_cb
= color_value
;
940 color
->color_g_y
= color_value
;
947 static void program_scaler(const struct core_dc
*dc
,
948 const struct pipe_ctx
*pipe_ctx
)
950 struct tg_color color
= {0};
952 #if defined(CONFIG_DRM_AMD_DC_DCN1_0)
954 if (pipe_ctx
->plane_res
.xfm
->funcs
->transform_set_pixel_storage_depth
== NULL
)
958 if (dc
->public.debug
.surface_visual_confirm
)
959 get_surface_visual_confirm_color(pipe_ctx
, &color
);
961 color_space_to_black_color(dc
,
962 pipe_ctx
->stream
->output_color_space
,
965 pipe_ctx
->plane_res
.xfm
->funcs
->transform_set_pixel_storage_depth(
966 pipe_ctx
->plane_res
.xfm
,
967 pipe_ctx
->plane_res
.scl_data
.lb_params
.depth
,
968 &pipe_ctx
->stream
->bit_depth_params
);
970 if (pipe_ctx
->stream_res
.tg
->funcs
->set_overscan_blank_color
)
971 pipe_ctx
->stream_res
.tg
->funcs
->set_overscan_blank_color(
972 pipe_ctx
->stream_res
.tg
,
975 pipe_ctx
->plane_res
.xfm
->funcs
->transform_set_scaler(pipe_ctx
->plane_res
.xfm
,
976 &pipe_ctx
->plane_res
.scl_data
);
979 static enum dc_status
dce110_prog_pixclk_crtc_otg(
980 struct pipe_ctx
*pipe_ctx
,
981 struct validate_context
*context
,
984 struct dc_stream_state
*stream
= pipe_ctx
->stream
;
985 struct pipe_ctx
*pipe_ctx_old
= &dc
->current_context
->res_ctx
.
986 pipe_ctx
[pipe_ctx
->pipe_idx
];
987 struct tg_color black_color
= {0};
989 if (!pipe_ctx_old
->stream
) {
991 /* program blank color */
992 color_space_to_black_color(dc
,
993 stream
->output_color_space
, &black_color
);
994 pipe_ctx
->stream_res
.tg
->funcs
->set_blank_color(
995 pipe_ctx
->stream_res
.tg
,
999 * Must blank CRTC after disabling power gating and before any
1000 * programming, otherwise CRTC will be hung in bad state
1002 pipe_ctx
->stream_res
.tg
->funcs
->set_blank(pipe_ctx
->stream_res
.tg
, true);
1004 if (false == pipe_ctx
->clock_source
->funcs
->program_pix_clk(
1005 pipe_ctx
->clock_source
,
1006 &pipe_ctx
->stream_res
.pix_clk_params
,
1007 &pipe_ctx
->pll_settings
)) {
1008 BREAK_TO_DEBUGGER();
1009 return DC_ERROR_UNEXPECTED
;
1012 pipe_ctx
->stream_res
.tg
->funcs
->program_timing(
1013 pipe_ctx
->stream_res
.tg
,
1017 pipe_ctx
->stream_res
.tg
->funcs
->set_static_screen_control(
1018 pipe_ctx
->stream_res
.tg
,
1022 if (!pipe_ctx_old
->stream
) {
1023 if (false == pipe_ctx
->stream_res
.tg
->funcs
->enable_crtc(
1024 pipe_ctx
->stream_res
.tg
)) {
1025 BREAK_TO_DEBUGGER();
1026 return DC_ERROR_UNEXPECTED
;
1035 static enum dc_status
apply_single_controller_ctx_to_hw(
1036 struct pipe_ctx
*pipe_ctx
,
1037 struct validate_context
*context
,
1040 struct dc_stream_state
*stream
= pipe_ctx
->stream
;
1041 struct pipe_ctx
*pipe_ctx_old
= &dc
->current_context
->res_ctx
.
1042 pipe_ctx
[pipe_ctx
->pipe_idx
];
1045 dc
->hwss
.prog_pixclk_crtc_otg(pipe_ctx
, context
, dc
);
1047 /* FPGA does not program backend */
1048 if (IS_FPGA_MAXIMUS_DC(dc
->ctx
->dce_environment
)) {
1049 pipe_ctx
->stream_res
.opp
->funcs
->opp_set_dyn_expansion(
1050 pipe_ctx
->stream_res
.opp
,
1051 COLOR_SPACE_YCBCR601
,
1052 stream
->timing
.display_color_depth
,
1053 pipe_ctx
->stream
->signal
);
1055 pipe_ctx
->stream_res
.opp
->funcs
->opp_program_fmt(
1056 pipe_ctx
->stream_res
.opp
,
1057 &stream
->bit_depth_params
,
1061 /* TODO: move to stream encoder */
1062 if (pipe_ctx
->stream
->signal
!= SIGNAL_TYPE_VIRTUAL
)
1063 if (DC_OK
!= bios_parser_crtc_source_select(pipe_ctx
)) {
1064 BREAK_TO_DEBUGGER();
1065 return DC_ERROR_UNEXPECTED
;
1067 pipe_ctx
->stream_res
.opp
->funcs
->opp_set_dyn_expansion(
1068 pipe_ctx
->stream_res
.opp
,
1069 COLOR_SPACE_YCBCR601
,
1070 stream
->timing
.display_color_depth
,
1071 pipe_ctx
->stream
->signal
);
1073 if (pipe_ctx
->stream
->signal
!= SIGNAL_TYPE_VIRTUAL
)
1074 stream
->sink
->link
->link_enc
->funcs
->setup(
1075 stream
->sink
->link
->link_enc
,
1076 pipe_ctx
->stream
->signal
);
1078 if (pipe_ctx
->stream
->signal
!= SIGNAL_TYPE_VIRTUAL
)
1079 pipe_ctx
->stream_res
.stream_enc
->funcs
->setup_stereo_sync(
1080 pipe_ctx
->stream_res
.stream_enc
,
1081 pipe_ctx
->stream_res
.tg
->inst
,
1082 stream
->timing
.timing_3d_format
!= TIMING_3D_FORMAT_NONE
);
1085 /*vbios crtc_source_selection and encoder_setup will override fmt_C*/
1086 pipe_ctx
->stream_res
.opp
->funcs
->opp_program_fmt(
1087 pipe_ctx
->stream_res
.opp
,
1088 &stream
->bit_depth_params
,
1091 if (dc_is_dp_signal(pipe_ctx
->stream
->signal
))
1092 pipe_ctx
->stream_res
.stream_enc
->funcs
->dp_set_stream_attribute(
1093 pipe_ctx
->stream_res
.stream_enc
,
1095 stream
->output_color_space
);
1097 if (dc_is_hdmi_signal(pipe_ctx
->stream
->signal
))
1098 pipe_ctx
->stream_res
.stream_enc
->funcs
->hdmi_set_stream_attribute(
1099 pipe_ctx
->stream_res
.stream_enc
,
1101 stream
->phy_pix_clk
,
1102 pipe_ctx
->stream_res
.audio
!= NULL
);
1104 if (dc_is_dvi_signal(pipe_ctx
->stream
->signal
))
1105 pipe_ctx
->stream_res
.stream_enc
->funcs
->dvi_set_stream_attribute(
1106 pipe_ctx
->stream_res
.stream_enc
,
1108 (pipe_ctx
->stream
->signal
== SIGNAL_TYPE_DVI_DUAL_LINK
) ?
1111 resource_build_info_frame(pipe_ctx
);
1112 dce110_update_info_frame(pipe_ctx
);
1113 if (!pipe_ctx_old
->stream
) {
1114 core_link_enable_stream(pipe_ctx
);
1117 if (dc_is_dp_signal(pipe_ctx
->stream
->signal
))
1118 dce110_unblank_stream(pipe_ctx
,
1119 &stream
->sink
->link
->cur_link_settings
);
1122 pipe_ctx
->plane_res
.scl_data
.lb_params
.alpha_en
= pipe_ctx
->bottom_pipe
!= 0;
1123 /* program_scaler and allocate_mem_input are not new asic */
1124 if ((!pipe_ctx_old
||
1125 memcmp(&pipe_ctx_old
->plane_res
.scl_data
, &pipe_ctx
->plane_res
.scl_data
,
1126 sizeof(struct scaler_data
)) != 0) &&
1127 pipe_ctx
->plane_state
) {
1128 program_scaler(dc
, pipe_ctx
);
1131 /* mst support - use total stream count */
1132 #if defined(CONFIG_DRM_AMD_DC_DCN1_0)
1133 if (pipe_ctx
->plane_res
.mi
->funcs
->allocate_mem_input
!= NULL
)
1135 pipe_ctx
->plane_res
.mi
->funcs
->allocate_mem_input(
1136 pipe_ctx
->plane_res
.mi
,
1137 stream
->timing
.h_total
,
1138 stream
->timing
.v_total
,
1139 stream
->timing
.pix_clk_khz
,
1140 context
->stream_count
);
1142 pipe_ctx
->stream
->sink
->link
->psr_enabled
= false;
1147 /******************************************************************************/
1149 static void power_down_encoders(struct core_dc
*dc
)
1153 for (i
= 0; i
< dc
->link_count
; i
++) {
1154 dc
->links
[i
]->link_enc
->funcs
->disable_output(
1155 dc
->links
[i
]->link_enc
, SIGNAL_TYPE_NONE
);
1159 static void power_down_controllers(struct core_dc
*dc
)
1163 for (i
= 0; i
< dc
->res_pool
->pipe_count
; i
++) {
1164 dc
->res_pool
->timing_generators
[i
]->funcs
->disable_crtc(
1165 dc
->res_pool
->timing_generators
[i
]);
1169 static void power_down_clock_sources(struct core_dc
*dc
)
1173 if (dc
->res_pool
->dp_clock_source
->funcs
->cs_power_down(
1174 dc
->res_pool
->dp_clock_source
) == false)
1175 dm_error("Failed to power down pll! (dp clk src)\n");
1177 for (i
= 0; i
< dc
->res_pool
->clk_src_count
; i
++) {
1178 if (dc
->res_pool
->clock_sources
[i
]->funcs
->cs_power_down(
1179 dc
->res_pool
->clock_sources
[i
]) == false)
1180 dm_error("Failed to power down pll! (clk src index=%d)\n", i
);
1184 static void power_down_all_hw_blocks(struct core_dc
*dc
)
1186 power_down_encoders(dc
);
1188 power_down_controllers(dc
);
1190 power_down_clock_sources(dc
);
1193 if (dc
->fbc_compressor
)
1194 dc
->fbc_compressor
->funcs
->disable_fbc(dc
->fbc_compressor
);
1198 static void disable_vga_and_power_gate_all_controllers(
1202 struct timing_generator
*tg
;
1203 struct dc_context
*ctx
= dc
->ctx
;
1205 for (i
= 0; i
< dc
->res_pool
->pipe_count
; i
++) {
1206 tg
= dc
->res_pool
->timing_generators
[i
];
1208 if (tg
->funcs
->disable_vga
)
1209 tg
->funcs
->disable_vga(tg
);
1211 /* Enable CLOCK gating for each pipe BEFORE controller
1213 enable_display_pipe_clock_gating(ctx
,
1216 dc
->hwss
.power_down_front_end(dc
, i
);
1221 * When ASIC goes from VBIOS/VGA mode to driver/accelerated mode we need:
1222 * 1. Power down all DC HW blocks
1223 * 2. Disable VGA engine on all controllers
1224 * 3. Enable power gating for controller
1225 * 4. Set acc_mode_change bit (VBIOS will clear this bit when going to FSDOS)
1227 void dce110_enable_accelerated_mode(struct core_dc
*dc
)
1229 power_down_all_hw_blocks(dc
);
1231 disable_vga_and_power_gate_all_controllers(dc
);
1232 bios_set_scratch_acc_mode_change(dc
->ctx
->dc_bios
);
1235 static uint32_t compute_pstate_blackout_duration(
1236 struct bw_fixed blackout_duration
,
1237 const struct dc_stream_state
*stream
)
1239 uint32_t total_dest_line_time_ns
;
1240 uint32_t pstate_blackout_duration_ns
;
1242 pstate_blackout_duration_ns
= 1000 * blackout_duration
.value
>> 24;
1244 total_dest_line_time_ns
= 1000000UL *
1245 stream
->timing
.h_total
/
1246 stream
->timing
.pix_clk_khz
+
1247 pstate_blackout_duration_ns
;
1249 return total_dest_line_time_ns
;
1252 void dce110_set_displaymarks(
1253 const struct core_dc
*dc
,
1254 struct validate_context
*context
)
1256 uint8_t i
, num_pipes
;
1257 unsigned int underlay_idx
= dc
->res_pool
->underlay_pipe_index
;
1259 for (i
= 0, num_pipes
= 0; i
< MAX_PIPES
; i
++) {
1260 struct pipe_ctx
*pipe_ctx
= &context
->res_ctx
.pipe_ctx
[i
];
1261 uint32_t total_dest_line_time_ns
;
1263 if (pipe_ctx
->stream
== NULL
)
1266 total_dest_line_time_ns
= compute_pstate_blackout_duration(
1267 dc
->bw_vbios
.blackout_duration
, pipe_ctx
->stream
);
1268 pipe_ctx
->plane_res
.mi
->funcs
->mem_input_program_display_marks(
1269 pipe_ctx
->plane_res
.mi
,
1270 context
->bw
.dce
.nbp_state_change_wm_ns
[num_pipes
],
1271 context
->bw
.dce
.stutter_exit_wm_ns
[num_pipes
],
1272 context
->bw
.dce
.urgent_wm_ns
[num_pipes
],
1273 total_dest_line_time_ns
);
1274 if (i
== underlay_idx
) {
1276 pipe_ctx
->plane_res
.mi
->funcs
->mem_input_program_chroma_display_marks(
1277 pipe_ctx
->plane_res
.mi
,
1278 context
->bw
.dce
.nbp_state_change_wm_ns
[num_pipes
],
1279 context
->bw
.dce
.stutter_exit_wm_ns
[num_pipes
],
1280 context
->bw
.dce
.urgent_wm_ns
[num_pipes
],
1281 total_dest_line_time_ns
);
1287 static void set_safe_displaymarks(
1288 struct resource_context
*res_ctx
,
1289 const struct resource_pool
*pool
)
1292 int underlay_idx
= pool
->underlay_pipe_index
;
1293 struct dce_watermarks max_marks
= {
1294 MAX_WATERMARK
, MAX_WATERMARK
, MAX_WATERMARK
, MAX_WATERMARK
};
1295 struct dce_watermarks nbp_marks
= {
1296 SAFE_NBP_MARK
, SAFE_NBP_MARK
, SAFE_NBP_MARK
, SAFE_NBP_MARK
};
1298 for (i
= 0; i
< MAX_PIPES
; i
++) {
1299 if (res_ctx
->pipe_ctx
[i
].stream
== NULL
)
1302 res_ctx
->pipe_ctx
[i
].plane_res
.mi
->funcs
->mem_input_program_display_marks(
1303 res_ctx
->pipe_ctx
[i
].plane_res
.mi
,
1308 if (i
== underlay_idx
)
1309 res_ctx
->pipe_ctx
[i
].plane_res
.mi
->funcs
->mem_input_program_chroma_display_marks(
1310 res_ctx
->pipe_ctx
[i
].plane_res
.mi
,
1318 static void switch_dp_clock_sources(
1319 const struct core_dc
*dc
,
1320 struct resource_context
*res_ctx
)
1323 for (i
= 0; i
< MAX_PIPES
; i
++) {
1324 struct pipe_ctx
*pipe_ctx
= &res_ctx
->pipe_ctx
[i
];
1326 if (pipe_ctx
->stream
== NULL
|| pipe_ctx
->top_pipe
)
1329 if (dc_is_dp_signal(pipe_ctx
->stream
->signal
)) {
1330 struct clock_source
*clk_src
=
1331 resource_find_used_clk_src_for_sharing(
1335 clk_src
!= pipe_ctx
->clock_source
) {
1336 resource_unreference_clock_source(
1337 res_ctx
, dc
->res_pool
,
1338 &pipe_ctx
->clock_source
);
1339 pipe_ctx
->clock_source
= clk_src
;
1340 resource_reference_clock_source(
1341 res_ctx
, dc
->res_pool
, clk_src
);
1343 dce_crtc_switch_to_clk_src(dc
->hwseq
, clk_src
, i
);
1349 /*******************************************************************************
1351 ******************************************************************************/
1353 static void set_drr(struct pipe_ctx
**pipe_ctx
,
1354 int num_pipes
, int vmin
, int vmax
)
1357 struct drr_params params
= {0};
1359 params
.vertical_total_max
= vmax
;
1360 params
.vertical_total_min
= vmin
;
1362 /* TODO: If multiple pipes are to be supported, you need
1366 for (i
= 0; i
< num_pipes
; i
++) {
1367 pipe_ctx
[i
]->stream_res
.tg
->funcs
->set_drr(pipe_ctx
[i
]->stream_res
.tg
, ¶ms
);
1371 static void get_position(struct pipe_ctx
**pipe_ctx
,
1373 struct crtc_position
*position
)
1377 /* TODO: handle pipes > 1
1379 for (i
= 0; i
< num_pipes
; i
++)
1380 pipe_ctx
[i
]->stream_res
.tg
->funcs
->get_position(pipe_ctx
[i
]->stream_res
.tg
, position
);
1383 static void set_static_screen_control(struct pipe_ctx
**pipe_ctx
,
1384 int num_pipes
, const struct dc_static_screen_events
*events
)
1387 unsigned int value
= 0;
1389 if (events
->overlay_update
)
1391 if (events
->surface_update
)
1393 if (events
->cursor_update
)
1400 for (i
= 0; i
< num_pipes
; i
++)
1401 pipe_ctx
[i
]->stream_res
.tg
->funcs
->
1402 set_static_screen_control(pipe_ctx
[i
]->stream_res
.tg
, value
);
1405 /* unit: in_khz before mode set, get pixel clock from context. ASIC register
1406 * may not be programmed yet.
1407 * TODO: after mode set, pre_mode_set = false,
1408 * may read PLL register to get pixel clock
1410 static uint32_t get_max_pixel_clock_for_all_paths(
1412 struct validate_context
*context
,
1415 uint32_t max_pix_clk
= 0;
1418 if (!pre_mode_set
) {
1419 /* TODO: read ASIC register to get pixel clock */
1423 for (i
= 0; i
< MAX_PIPES
; i
++) {
1424 struct pipe_ctx
*pipe_ctx
= &context
->res_ctx
.pipe_ctx
[i
];
1426 if (pipe_ctx
->stream
== NULL
)
1429 /* do not check under lay */
1430 if (pipe_ctx
->top_pipe
)
1433 if (pipe_ctx
->stream_res
.pix_clk_params
.requested_pix_clk
> max_pix_clk
)
1435 pipe_ctx
->stream_res
.pix_clk_params
.requested_pix_clk
;
1438 if (max_pix_clk
== 0)
1444 /* Find clock state based on clock requested. if clock value is 0, simply
1445 * set clock state as requested without finding clock state by clock value
1446 *TODO: when dce120_hw_sequencer.c is created, override apply_min_clock.
1448 * TODOFPGA remove TODO after implement dal_display_clock_get_cur_clocks_value
1449 * etc support for dcn1.0
1451 static void apply_min_clocks(
1453 struct validate_context
*context
,
1454 enum dm_pp_clocks_state
*clocks_state
,
1457 struct state_dependent_clocks req_clocks
= {0};
1458 struct pipe_ctx
*pipe_ctx
;
1461 for (i
= 0; i
< MAX_PIPES
; i
++) {
1462 pipe_ctx
= &context
->res_ctx
.pipe_ctx
[i
];
1463 if (pipe_ctx
->dis_clk
!= NULL
)
1467 if (!pre_mode_set
) {
1468 /* set clock_state without verification */
1469 if (pipe_ctx
->dis_clk
->funcs
->set_min_clocks_state
) {
1470 pipe_ctx
->dis_clk
->funcs
->set_min_clocks_state(
1471 pipe_ctx
->dis_clk
, *clocks_state
);
1475 /* TODO: This is incorrect. Figure out how to fix. */
1476 pipe_ctx
->dis_clk
->funcs
->apply_clock_voltage_request(
1478 DM_PP_CLOCK_TYPE_DISPLAY_CLK
,
1479 pipe_ctx
->dis_clk
->cur_clocks_value
.dispclk_in_khz
,
1483 pipe_ctx
->dis_clk
->funcs
->apply_clock_voltage_request(
1485 DM_PP_CLOCK_TYPE_PIXELCLK
,
1486 pipe_ctx
->dis_clk
->cur_clocks_value
.max_pixelclk_in_khz
,
1490 pipe_ctx
->dis_clk
->funcs
->apply_clock_voltage_request(
1492 DM_PP_CLOCK_TYPE_DISPLAYPHYCLK
,
1493 pipe_ctx
->dis_clk
->cur_clocks_value
.max_non_dp_phyclk_in_khz
,
1499 /* get the required state based on state dependent clocks:
1500 * display clock and pixel clock
1502 req_clocks
.display_clk_khz
= context
->bw
.dce
.dispclk_khz
;
1504 req_clocks
.pixel_clk_khz
= get_max_pixel_clock_for_all_paths(
1507 if (pipe_ctx
->dis_clk
->funcs
->get_required_clocks_state
) {
1508 *clocks_state
= pipe_ctx
->dis_clk
->funcs
->get_required_clocks_state(
1509 pipe_ctx
->dis_clk
, &req_clocks
);
1510 pipe_ctx
->dis_clk
->funcs
->set_min_clocks_state(
1511 pipe_ctx
->dis_clk
, *clocks_state
);
1513 pipe_ctx
->dis_clk
->funcs
->apply_clock_voltage_request(
1515 DM_PP_CLOCK_TYPE_DISPLAY_CLK
,
1516 req_clocks
.display_clk_khz
,
1520 pipe_ctx
->dis_clk
->funcs
->apply_clock_voltage_request(
1522 DM_PP_CLOCK_TYPE_PIXELCLK
,
1523 req_clocks
.pixel_clk_khz
,
1527 pipe_ctx
->dis_clk
->funcs
->apply_clock_voltage_request(
1529 DM_PP_CLOCK_TYPE_DISPLAYPHYCLK
,
1530 req_clocks
.pixel_clk_khz
,
1539 * Check if FBC can be enabled
1541 static enum dc_status
validate_fbc(struct core_dc
*dc
,
1542 struct validate_context
*context
)
1544 struct pipe_ctx
*pipe_ctx
=
1545 &context
->res_ctx
.pipe_ctx
[0];
1547 ASSERT(dc
->fbc_compressor
);
1549 /* FBC memory should be allocated */
1550 if (!dc
->ctx
->fbc_gpu_addr
)
1551 return DC_ERROR_UNEXPECTED
;
1553 /* Only supports single display */
1554 if (context
->stream_count
!= 1)
1555 return DC_ERROR_UNEXPECTED
;
1557 /* Only supports eDP */
1558 if (pipe_ctx
->stream
->sink
->link
->connector_signal
!= SIGNAL_TYPE_EDP
)
1559 return DC_ERROR_UNEXPECTED
;
1561 /* PSR should not be enabled */
1562 if (pipe_ctx
->stream
->sink
->link
->psr_enabled
)
1563 return DC_ERROR_UNEXPECTED
;
1571 static enum dc_status
enable_fbc(struct core_dc
*dc
,
1572 struct validate_context
*context
)
1574 enum dc_status status
= validate_fbc(dc
, context
);
1576 if (status
== DC_OK
) {
1577 /* Program GRPH COMPRESSED ADDRESS and PITCH */
1578 struct compr_addr_and_pitch_params params
= {0, 0, 0};
1579 struct compressor
*compr
= dc
->fbc_compressor
;
1580 struct pipe_ctx
*pipe_ctx
=
1581 &context
->res_ctx
.pipe_ctx
[0];
1583 params
.source_view_width
=
1584 pipe_ctx
->stream
->timing
.h_addressable
;
1585 params
.source_view_height
=
1586 pipe_ctx
->stream
->timing
.v_addressable
;
1588 compr
->compr_surface_address
.quad_part
= dc
->ctx
->fbc_gpu_addr
;
1590 compr
->funcs
->surface_address_and_pitch(compr
, ¶ms
);
1591 compr
->funcs
->set_fbc_invalidation_triggers(compr
, 1);
1593 compr
->funcs
->enable_fbc(compr
, ¶ms
);
1599 static enum dc_status
apply_ctx_to_hw_fpga(
1601 struct validate_context
*context
)
1603 enum dc_status status
= DC_ERROR_UNEXPECTED
;
1606 for (i
= 0; i
< MAX_PIPES
; i
++) {
1607 struct pipe_ctx
*pipe_ctx_old
=
1608 &dc
->current_context
->res_ctx
.pipe_ctx
[i
];
1609 struct pipe_ctx
*pipe_ctx
= &context
->res_ctx
.pipe_ctx
[i
];
1611 if (pipe_ctx
->stream
== NULL
)
1614 if (pipe_ctx
->stream
== pipe_ctx_old
->stream
)
1617 status
= apply_single_controller_ctx_to_hw(
1622 if (status
!= DC_OK
)
1629 static void dce110_reset_hw_ctx_wrap(
1631 struct validate_context
*context
)
1635 /* Reset old context */
1636 /* look up the targets that have been removed since last commit */
1637 for (i
= 0; i
< MAX_PIPES
; i
++) {
1638 struct pipe_ctx
*pipe_ctx_old
=
1639 &dc
->current_context
->res_ctx
.pipe_ctx
[i
];
1640 struct pipe_ctx
*pipe_ctx
= &context
->res_ctx
.pipe_ctx
[i
];
1642 /* Note: We need to disable output if clock sources change,
1643 * since bios does optimization and doesn't apply if changing
1644 * PHY when not already disabled.
1647 /* Skip underlay pipe since it will be handled in commit surface*/
1648 if (!pipe_ctx_old
->stream
|| pipe_ctx_old
->top_pipe
)
1651 if (!pipe_ctx
->stream
||
1652 pipe_need_reprogram(pipe_ctx_old
, pipe_ctx
)) {
1653 core_link_disable_stream(pipe_ctx_old
);
1654 pipe_ctx_old
->stream_res
.tg
->funcs
->set_blank(pipe_ctx_old
->stream_res
.tg
, true);
1655 if (!hwss_wait_for_blank_complete(pipe_ctx_old
->stream_res
.tg
)) {
1656 dm_error("DC: failed to blank crtc!\n");
1657 BREAK_TO_DEBUGGER();
1659 pipe_ctx_old
->stream_res
.tg
->funcs
->disable_crtc(pipe_ctx_old
->stream_res
.tg
);
1660 pipe_ctx_old
->plane_res
.mi
->funcs
->free_mem_input(
1661 pipe_ctx_old
->plane_res
.mi
, dc
->current_context
->stream_count
);
1662 resource_unreference_clock_source(
1663 &dc
->current_context
->res_ctx
, dc
->res_pool
,
1664 &pipe_ctx_old
->clock_source
);
1666 dc
->hwss
.power_down_front_end(dc
, pipe_ctx_old
->pipe_idx
);
1668 pipe_ctx_old
->stream
= NULL
;
1674 enum dc_status
dce110_apply_ctx_to_hw(
1676 struct validate_context
*context
)
1678 struct dc_bios
*dcb
= dc
->ctx
->dc_bios
;
1679 enum dc_status status
;
1681 enum dm_pp_clocks_state clocks_state
= DM_PP_CLOCKS_STATE_INVALID
;
1683 /* Reset old context */
1684 /* look up the targets that have been removed since last commit */
1685 dc
->hwss
.reset_hw_ctx_wrap(dc
, context
);
1687 /* Skip applying if no targets */
1688 if (context
->stream_count
<= 0)
1691 if (IS_FPGA_MAXIMUS_DC(dc
->ctx
->dce_environment
)) {
1692 apply_ctx_to_hw_fpga(dc
, context
);
1696 /* Apply new context */
1697 dcb
->funcs
->set_scratch_critical_state(dcb
, true);
1699 /* below is for real asic only */
1700 for (i
= 0; i
< dc
->res_pool
->pipe_count
; i
++) {
1701 struct pipe_ctx
*pipe_ctx_old
=
1702 &dc
->current_context
->res_ctx
.pipe_ctx
[i
];
1703 struct pipe_ctx
*pipe_ctx
= &context
->res_ctx
.pipe_ctx
[i
];
1705 if (pipe_ctx
->stream
== NULL
|| pipe_ctx
->top_pipe
)
1708 if (pipe_ctx
->stream
== pipe_ctx_old
->stream
) {
1709 if (pipe_ctx_old
->clock_source
!= pipe_ctx
->clock_source
)
1710 dce_crtc_switch_to_clk_src(dc
->hwseq
,
1711 pipe_ctx
->clock_source
, i
);
1715 dc
->hwss
.enable_display_power_gating(
1716 dc
, i
, dc
->ctx
->dc_bios
,
1717 PIPE_GATING_CONTROL_DISABLE
);
1720 set_safe_displaymarks(&context
->res_ctx
, dc
->res_pool
);
1723 if (dc
->fbc_compressor
)
1724 dc
->fbc_compressor
->funcs
->disable_fbc(dc
->fbc_compressor
);
1726 /*TODO: when pplib works*/
1727 apply_min_clocks(dc
, context
, &clocks_state
, true);
1729 #if defined(CONFIG_DRM_AMD_DC_DCN1_0)
1730 if (dc
->ctx
->dce_version
>= DCN_VERSION_1_0
) {
1731 if (context
->bw
.dcn
.calc_clk
.fclk_khz
1732 > dc
->current_context
->bw
.dcn
.cur_clk
.fclk_khz
) {
1733 struct dm_pp_clock_for_voltage_req clock
;
1735 clock
.clk_type
= DM_PP_CLOCK_TYPE_FCLK
;
1736 clock
.clocks_in_khz
= context
->bw
.dcn
.calc_clk
.fclk_khz
;
1737 dm_pp_apply_clock_for_voltage_request(dc
->ctx
, &clock
);
1738 dc
->current_context
->bw
.dcn
.cur_clk
.fclk_khz
= clock
.clocks_in_khz
;
1739 context
->bw
.dcn
.cur_clk
.fclk_khz
= clock
.clocks_in_khz
;
1741 if (context
->bw
.dcn
.calc_clk
.dcfclk_khz
1742 > dc
->current_context
->bw
.dcn
.cur_clk
.dcfclk_khz
) {
1743 struct dm_pp_clock_for_voltage_req clock
;
1745 clock
.clk_type
= DM_PP_CLOCK_TYPE_DCFCLK
;
1746 clock
.clocks_in_khz
= context
->bw
.dcn
.calc_clk
.dcfclk_khz
;
1747 dm_pp_apply_clock_for_voltage_request(dc
->ctx
, &clock
);
1748 dc
->current_context
->bw
.dcn
.cur_clk
.dcfclk_khz
= clock
.clocks_in_khz
;
1749 context
->bw
.dcn
.cur_clk
.dcfclk_khz
= clock
.clocks_in_khz
;
1751 if (context
->bw
.dcn
.calc_clk
.dispclk_khz
1752 > dc
->current_context
->bw
.dcn
.cur_clk
.dispclk_khz
) {
1753 dc
->res_pool
->display_clock
->funcs
->set_clock(
1754 dc
->res_pool
->display_clock
,
1755 context
->bw
.dcn
.calc_clk
.dispclk_khz
);
1756 dc
->current_context
->bw
.dcn
.cur_clk
.dispclk_khz
=
1757 context
->bw
.dcn
.calc_clk
.dispclk_khz
;
1758 context
->bw
.dcn
.cur_clk
.dispclk_khz
=
1759 context
->bw
.dcn
.calc_clk
.dispclk_khz
;
1763 if (context
->bw
.dce
.dispclk_khz
1764 > dc
->current_context
->bw
.dce
.dispclk_khz
) {
1765 dc
->res_pool
->display_clock
->funcs
->set_clock(
1766 dc
->res_pool
->display_clock
,
1767 context
->bw
.dce
.dispclk_khz
* 115 / 100);
1769 /* program audio wall clock. use HDMI as clock source if HDMI
1770 * audio active. Otherwise, use DP as clock source
1771 * first, loop to find any HDMI audio, if not, loop find DP audio
1773 /* Setup audio rate clock source */
1775 * Audio lag happened on DP monitor when unplug a HDMI monitor
1778 * In case of DP and HDMI connected or HDMI only, DCCG_AUDIO_DTO_SEL
1779 * is set to either dto0 or dto1, audio should work fine.
1780 * In case of DP connected only, DCCG_AUDIO_DTO_SEL should be dto1,
1781 * set to dto0 will cause audio lag.
1784 * Not optimized audio wall dto setup. When mode set, iterate pipe_ctx,
1785 * find first available pipe with audio, setup audio wall DTO per topology
1786 * instead of per pipe.
1788 for (i
= 0; i
< dc
->res_pool
->pipe_count
; i
++) {
1789 struct pipe_ctx
*pipe_ctx
= &context
->res_ctx
.pipe_ctx
[i
];
1791 if (pipe_ctx
->stream
== NULL
)
1794 if (pipe_ctx
->top_pipe
)
1797 if (pipe_ctx
->stream
->signal
!= SIGNAL_TYPE_HDMI_TYPE_A
)
1800 if (pipe_ctx
->stream_res
.audio
!= NULL
) {
1801 struct audio_output audio_output
;
1803 build_audio_output(pipe_ctx
, &audio_output
);
1805 pipe_ctx
->stream_res
.audio
->funcs
->wall_dto_setup(
1806 pipe_ctx
->stream_res
.audio
,
1807 pipe_ctx
->stream
->signal
,
1808 &audio_output
.crtc_info
,
1809 &audio_output
.pll_info
);
1814 /* no HDMI audio is found, try DP audio */
1815 if (i
== dc
->res_pool
->pipe_count
) {
1816 for (i
= 0; i
< dc
->res_pool
->pipe_count
; i
++) {
1817 struct pipe_ctx
*pipe_ctx
= &context
->res_ctx
.pipe_ctx
[i
];
1819 if (pipe_ctx
->stream
== NULL
)
1822 if (pipe_ctx
->top_pipe
)
1825 if (!dc_is_dp_signal(pipe_ctx
->stream
->signal
))
1828 if (pipe_ctx
->stream_res
.audio
!= NULL
) {
1829 struct audio_output audio_output
;
1831 build_audio_output(pipe_ctx
, &audio_output
);
1833 pipe_ctx
->stream_res
.audio
->funcs
->wall_dto_setup(
1834 pipe_ctx
->stream_res
.audio
,
1835 pipe_ctx
->stream
->signal
,
1836 &audio_output
.crtc_info
,
1837 &audio_output
.pll_info
);
1843 for (i
= 0; i
< dc
->res_pool
->pipe_count
; i
++) {
1844 struct pipe_ctx
*pipe_ctx_old
=
1845 &dc
->current_context
->res_ctx
.pipe_ctx
[i
];
1846 struct pipe_ctx
*pipe_ctx
= &context
->res_ctx
.pipe_ctx
[i
];
1848 if (pipe_ctx
->stream
== NULL
)
1851 if (pipe_ctx
->stream
== pipe_ctx_old
->stream
)
1854 if (pipe_ctx
->stream
&& pipe_ctx_old
->stream
1855 && !pipe_need_reprogram(pipe_ctx_old
, pipe_ctx
))
1858 if (pipe_ctx
->top_pipe
)
1861 if (context
->res_ctx
.pipe_ctx
[i
].stream_res
.audio
!= NULL
) {
1863 struct audio_output audio_output
;
1865 build_audio_output(pipe_ctx
, &audio_output
);
1867 if (dc_is_dp_signal(pipe_ctx
->stream
->signal
))
1868 pipe_ctx
->stream_res
.stream_enc
->funcs
->dp_audio_setup(
1869 pipe_ctx
->stream_res
.stream_enc
,
1870 pipe_ctx
->stream_res
.audio
->inst
,
1871 &pipe_ctx
->stream
->audio_info
);
1873 pipe_ctx
->stream_res
.stream_enc
->funcs
->hdmi_audio_setup(
1874 pipe_ctx
->stream_res
.stream_enc
,
1875 pipe_ctx
->stream_res
.audio
->inst
,
1876 &pipe_ctx
->stream
->audio_info
,
1877 &audio_output
.crtc_info
);
1879 pipe_ctx
->stream_res
.audio
->funcs
->az_configure(
1880 pipe_ctx
->stream_res
.audio
,
1881 pipe_ctx
->stream
->signal
,
1882 &audio_output
.crtc_info
,
1883 &pipe_ctx
->stream
->audio_info
);
1886 status
= apply_single_controller_ctx_to_hw(
1891 if (dc
->hwss
.power_on_front_end
)
1892 dc
->hwss
.power_on_front_end(dc
, pipe_ctx
, context
);
1894 if (DC_OK
!= status
)
1898 dc
->hwss
.set_bandwidth(dc
, context
, true);
1901 apply_min_clocks(dc
, context
, &clocks_state
, false);
1903 dcb
->funcs
->set_scratch_critical_state(dcb
, false);
1905 switch_dp_clock_sources(dc
, &context
->res_ctx
);
1908 if (dc
->fbc_compressor
)
1909 enable_fbc(dc
, context
);
1916 /*******************************************************************************
1917 * Front End programming
1918 ******************************************************************************/
1919 static void set_default_colors(struct pipe_ctx
*pipe_ctx
)
1921 struct default_adjustment default_adjust
= { 0 };
1923 default_adjust
.force_hw_default
= false;
1924 if (pipe_ctx
->plane_state
== NULL
)
1925 default_adjust
.in_color_space
= COLOR_SPACE_SRGB
;
1927 default_adjust
.in_color_space
=
1928 pipe_ctx
->plane_state
->color_space
;
1929 if (pipe_ctx
->stream
== NULL
)
1930 default_adjust
.out_color_space
= COLOR_SPACE_SRGB
;
1932 default_adjust
.out_color_space
=
1933 pipe_ctx
->stream
->output_color_space
;
1934 default_adjust
.csc_adjust_type
= GRAPHICS_CSC_ADJUST_TYPE_SW
;
1935 default_adjust
.surface_pixel_format
= pipe_ctx
->plane_res
.scl_data
.format
;
1937 /* display color depth */
1938 default_adjust
.color_depth
=
1939 pipe_ctx
->stream
->timing
.display_color_depth
;
1941 /* Lb color depth */
1942 default_adjust
.lb_color_depth
= pipe_ctx
->plane_res
.scl_data
.lb_params
.depth
;
1944 pipe_ctx
->plane_res
.xfm
->funcs
->opp_set_csc_default(
1945 pipe_ctx
->plane_res
.xfm
, &default_adjust
);
1949 /*******************************************************************************
1950 * In order to turn on/off specific surface we will program
1953 * In case that we have two surfaces and they have a different visibility
1954 * we can't turn off the CRTC since it will turn off the entire display
1956 * |----------------------------------------------- |
1957 * |bottom pipe|curr pipe | | |
1958 * |Surface |Surface | Blender | CRCT |
1959 * |visibility |visibility | Configuration| |
1960 * |------------------------------------------------|
1961 * | off | off | CURRENT_PIPE | blank |
1962 * | off | on | CURRENT_PIPE | unblank |
1963 * | on | off | OTHER_PIPE | unblank |
1964 * | on | on | BLENDING | unblank |
1965 * -------------------------------------------------|
1967 ******************************************************************************/
1968 static void program_surface_visibility(const struct core_dc
*dc
,
1969 struct pipe_ctx
*pipe_ctx
)
1971 enum blnd_mode blender_mode
= BLND_MODE_CURRENT_PIPE
;
1972 bool blank_target
= false;
1974 if (pipe_ctx
->bottom_pipe
) {
1976 /* For now we are supporting only two pipes */
1977 ASSERT(pipe_ctx
->bottom_pipe
->bottom_pipe
== NULL
);
1979 if (pipe_ctx
->bottom_pipe
->plane_state
->visible
) {
1980 if (pipe_ctx
->plane_state
->visible
)
1981 blender_mode
= BLND_MODE_BLENDING
;
1983 blender_mode
= BLND_MODE_OTHER_PIPE
;
1985 } else if (!pipe_ctx
->plane_state
->visible
)
1986 blank_target
= true;
1988 } else if (!pipe_ctx
->plane_state
->visible
)
1989 blank_target
= true;
1991 dce_set_blender_mode(dc
->hwseq
, pipe_ctx
->pipe_idx
, blender_mode
);
1992 pipe_ctx
->stream_res
.tg
->funcs
->set_blank(pipe_ctx
->stream_res
.tg
, blank_target
);
1996 static void program_gamut_remap(struct pipe_ctx
*pipe_ctx
)
1998 struct xfm_grph_csc_adjustment adjust
;
1999 memset(&adjust
, 0, sizeof(adjust
));
2000 adjust
.gamut_adjust_type
= GRAPHICS_GAMUT_ADJUST_TYPE_BYPASS
;
2003 if (pipe_ctx
->stream
->gamut_remap_matrix
.enable_remap
== true) {
2004 adjust
.gamut_adjust_type
= GRAPHICS_GAMUT_ADJUST_TYPE_SW
;
2005 adjust
.temperature_matrix
[0] =
2007 gamut_remap_matrix
.matrix
[0];
2008 adjust
.temperature_matrix
[1] =
2010 gamut_remap_matrix
.matrix
[1];
2011 adjust
.temperature_matrix
[2] =
2013 gamut_remap_matrix
.matrix
[2];
2014 adjust
.temperature_matrix
[3] =
2016 gamut_remap_matrix
.matrix
[4];
2017 adjust
.temperature_matrix
[4] =
2019 gamut_remap_matrix
.matrix
[5];
2020 adjust
.temperature_matrix
[5] =
2022 gamut_remap_matrix
.matrix
[6];
2023 adjust
.temperature_matrix
[6] =
2025 gamut_remap_matrix
.matrix
[8];
2026 adjust
.temperature_matrix
[7] =
2028 gamut_remap_matrix
.matrix
[9];
2029 adjust
.temperature_matrix
[8] =
2031 gamut_remap_matrix
.matrix
[10];
2034 pipe_ctx
->plane_res
.xfm
->funcs
->transform_set_gamut_remap(pipe_ctx
->plane_res
.xfm
, &adjust
);
2038 * TODO REMOVE, USE UPDATE INSTEAD
2040 static void set_plane_config(
2041 const struct core_dc
*dc
,
2042 struct pipe_ctx
*pipe_ctx
,
2043 struct resource_context
*res_ctx
)
2045 struct mem_input
*mi
= pipe_ctx
->plane_res
.mi
;
2046 struct dc_plane_state
*plane_state
= pipe_ctx
->plane_state
;
2047 struct xfm_grph_csc_adjustment adjust
;
2048 struct out_csc_color_matrix tbl_entry
;
2051 memset(&adjust
, 0, sizeof(adjust
));
2052 memset(&tbl_entry
, 0, sizeof(tbl_entry
));
2053 adjust
.gamut_adjust_type
= GRAPHICS_GAMUT_ADJUST_TYPE_BYPASS
;
2055 dce_enable_fe_clock(dc
->hwseq
, pipe_ctx
->pipe_idx
, true);
2057 set_default_colors(pipe_ctx
);
2058 if (pipe_ctx
->stream
->csc_color_matrix
.enable_adjustment
2060 tbl_entry
.color_space
=
2061 pipe_ctx
->stream
->output_color_space
;
2063 for (i
= 0; i
< 12; i
++)
2064 tbl_entry
.regval
[i
] =
2065 pipe_ctx
->stream
->csc_color_matrix
.matrix
[i
];
2067 pipe_ctx
->plane_res
.xfm
->funcs
->opp_set_csc_adjustment
2068 (pipe_ctx
->plane_res
.xfm
, &tbl_entry
);
2071 if (pipe_ctx
->stream
->gamut_remap_matrix
.enable_remap
== true) {
2072 adjust
.gamut_adjust_type
= GRAPHICS_GAMUT_ADJUST_TYPE_SW
;
2073 adjust
.temperature_matrix
[0] =
2075 gamut_remap_matrix
.matrix
[0];
2076 adjust
.temperature_matrix
[1] =
2078 gamut_remap_matrix
.matrix
[1];
2079 adjust
.temperature_matrix
[2] =
2081 gamut_remap_matrix
.matrix
[2];
2082 adjust
.temperature_matrix
[3] =
2084 gamut_remap_matrix
.matrix
[4];
2085 adjust
.temperature_matrix
[4] =
2087 gamut_remap_matrix
.matrix
[5];
2088 adjust
.temperature_matrix
[5] =
2090 gamut_remap_matrix
.matrix
[6];
2091 adjust
.temperature_matrix
[6] =
2093 gamut_remap_matrix
.matrix
[8];
2094 adjust
.temperature_matrix
[7] =
2096 gamut_remap_matrix
.matrix
[9];
2097 adjust
.temperature_matrix
[8] =
2099 gamut_remap_matrix
.matrix
[10];
2102 pipe_ctx
->plane_res
.xfm
->funcs
->transform_set_gamut_remap(pipe_ctx
->plane_res
.xfm
, &adjust
);
2104 pipe_ctx
->plane_res
.scl_data
.lb_params
.alpha_en
= pipe_ctx
->bottom_pipe
!= 0;
2105 program_scaler(dc
, pipe_ctx
);
2107 program_surface_visibility(dc
, pipe_ctx
);
2109 mi
->funcs
->mem_input_program_surface_config(
2111 plane_state
->format
,
2112 &plane_state
->tiling_info
,
2113 &plane_state
->plane_size
,
2114 plane_state
->rotation
,
2117 if (mi
->funcs
->set_blank
)
2118 mi
->funcs
->set_blank(mi
, pipe_ctx
->plane_state
->visible
);
2120 if (dc
->public.config
.gpu_vm_support
)
2121 mi
->funcs
->mem_input_program_pte_vm(
2122 pipe_ctx
->plane_res
.mi
,
2123 plane_state
->format
,
2124 &plane_state
->tiling_info
,
2125 plane_state
->rotation
);
2128 static void update_plane_addr(const struct core_dc
*dc
,
2129 struct pipe_ctx
*pipe_ctx
)
2131 struct dc_plane_state
*plane_state
= pipe_ctx
->plane_state
;
2133 if (plane_state
== NULL
)
2136 pipe_ctx
->plane_res
.mi
->funcs
->mem_input_program_surface_flip_and_addr(
2137 pipe_ctx
->plane_res
.mi
,
2138 &plane_state
->address
,
2139 plane_state
->flip_immediate
);
2141 plane_state
->status
.requested_address
= plane_state
->address
;
2144 void dce110_update_pending_status(struct pipe_ctx
*pipe_ctx
)
2146 struct dc_plane_state
*plane_state
= pipe_ctx
->plane_state
;
2148 if (plane_state
== NULL
)
2151 plane_state
->status
.is_flip_pending
=
2152 pipe_ctx
->plane_res
.mi
->funcs
->mem_input_is_flip_pending(
2153 pipe_ctx
->plane_res
.mi
);
2155 if (plane_state
->status
.is_flip_pending
&& !plane_state
->visible
)
2156 pipe_ctx
->plane_res
.mi
->current_address
= pipe_ctx
->plane_res
.mi
->request_address
;
2158 plane_state
->status
.current_address
= pipe_ctx
->plane_res
.mi
->current_address
;
2159 if (pipe_ctx
->plane_res
.mi
->current_address
.type
== PLN_ADDR_TYPE_GRPH_STEREO
&&
2160 pipe_ctx
->stream_res
.tg
->funcs
->is_stereo_left_eye
) {
2161 plane_state
->status
.is_right_eye
=\
2162 !pipe_ctx
->stream_res
.tg
->funcs
->is_stereo_left_eye(pipe_ctx
->stream_res
.tg
);
2166 void dce110_power_down(struct core_dc
*dc
)
2168 power_down_all_hw_blocks(dc
);
2169 disable_vga_and_power_gate_all_controllers(dc
);
2172 static bool wait_for_reset_trigger_to_occur(
2173 struct dc_context
*dc_ctx
,
2174 struct timing_generator
*tg
)
2178 /* To avoid endless loop we wait at most
2179 * frames_to_wait_on_triggered_reset frames for the reset to occur. */
2180 const uint32_t frames_to_wait_on_triggered_reset
= 10;
2183 for (i
= 0; i
< frames_to_wait_on_triggered_reset
; i
++) {
2185 if (!tg
->funcs
->is_counter_moving(tg
)) {
2186 DC_ERROR("TG counter is not moving!\n");
2190 if (tg
->funcs
->did_triggered_reset_occur(tg
)) {
2192 /* usually occurs at i=1 */
2193 DC_SYNC_INFO("GSL: reset occurred at wait count: %d\n",
2198 /* Wait for one frame. */
2199 tg
->funcs
->wait_for_state(tg
, CRTC_STATE_VACTIVE
);
2200 tg
->funcs
->wait_for_state(tg
, CRTC_STATE_VBLANK
);
2204 DC_ERROR("GSL: Timeout on reset trigger!\n");
2209 /* Enable timing synchronization for a group of Timing Generators. */
2210 static void dce110_enable_timing_synchronization(
2214 struct pipe_ctx
*grouped_pipes
[])
2216 struct dc_context
*dc_ctx
= dc
->ctx
;
2217 struct dcp_gsl_params gsl_params
= { 0 };
2220 DC_SYNC_INFO("GSL: Setting-up...\n");
2222 /* Designate a single TG in the group as a master.
2223 * Since HW doesn't care which one, we always assign
2224 * the 1st one in the group. */
2225 gsl_params
.gsl_group
= 0;
2226 gsl_params
.gsl_master
= grouped_pipes
[0]->stream_res
.tg
->inst
;
2228 for (i
= 0; i
< group_size
; i
++)
2229 grouped_pipes
[i
]->stream_res
.tg
->funcs
->setup_global_swap_lock(
2230 grouped_pipes
[i
]->stream_res
.tg
, &gsl_params
);
2232 /* Reset slave controllers on master VSync */
2233 DC_SYNC_INFO("GSL: enabling trigger-reset\n");
2235 for (i
= 1 /* skip the master */; i
< group_size
; i
++)
2236 grouped_pipes
[i
]->stream_res
.tg
->funcs
->enable_reset_trigger(
2237 grouped_pipes
[i
]->stream_res
.tg
, gsl_params
.gsl_group
);
2241 for (i
= 1 /* skip the master */; i
< group_size
; i
++) {
2242 DC_SYNC_INFO("GSL: waiting for reset to occur.\n");
2243 wait_for_reset_trigger_to_occur(dc_ctx
, grouped_pipes
[i
]->stream_res
.tg
);
2244 /* Regardless of success of the wait above, remove the reset or
2245 * the driver will start timing out on Display requests. */
2246 DC_SYNC_INFO("GSL: disabling trigger-reset.\n");
2247 grouped_pipes
[i
]->stream_res
.tg
->funcs
->disable_reset_trigger(grouped_pipes
[i
]->stream_res
.tg
);
2251 /* GSL Vblank synchronization is a one time sync mechanism, assumption
2252 * is that the sync'ed displays will not drift out of sync over time*/
2253 DC_SYNC_INFO("GSL: Restoring register states.\n");
2254 for (i
= 0; i
< group_size
; i
++)
2255 grouped_pipes
[i
]->stream_res
.tg
->funcs
->tear_down_global_swap_lock(grouped_pipes
[i
]->stream_res
.tg
);
2257 DC_SYNC_INFO("GSL: Set-up complete.\n");
2260 static void init_hw(struct core_dc
*dc
)
2264 struct transform
*xfm
;
2267 bp
= dc
->ctx
->dc_bios
;
2268 for (i
= 0; i
< dc
->res_pool
->pipe_count
; i
++) {
2269 xfm
= dc
->res_pool
->transforms
[i
];
2270 xfm
->funcs
->transform_reset(xfm
);
2272 dc
->hwss
.enable_display_power_gating(
2274 PIPE_GATING_CONTROL_INIT
);
2275 dc
->hwss
.enable_display_power_gating(
2277 PIPE_GATING_CONTROL_DISABLE
);
2278 dc
->hwss
.enable_display_pipe_clock_gating(
2283 dce_clock_gating_power_up(dc
->hwseq
, false);
2284 /***************************************/
2286 for (i
= 0; i
< dc
->link_count
; i
++) {
2287 /****************************************/
2288 /* Power up AND update implementation according to the
2289 * required signal (which may be different from the
2290 * default signal on connector). */
2291 struct dc_link
*link
= dc
->links
[i
];
2292 link
->link_enc
->funcs
->hw_init(link
->link_enc
);
2295 for (i
= 0; i
< dc
->res_pool
->pipe_count
; i
++) {
2296 struct timing_generator
*tg
= dc
->res_pool
->timing_generators
[i
];
2298 tg
->funcs
->disable_vga(tg
);
2300 /* Blank controller using driver code instead of
2302 tg
->funcs
->set_blank(tg
, true);
2303 hwss_wait_for_blank_complete(tg
);
2306 for (i
= 0; i
< dc
->res_pool
->audio_count
; i
++) {
2307 struct audio
*audio
= dc
->res_pool
->audios
[i
];
2308 audio
->funcs
->hw_init(audio
);
2311 abm
= dc
->res_pool
->abm
;
2313 abm
->funcs
->init_backlight(abm
);
2314 abm
->funcs
->abm_init(abm
);
2317 if (dc
->fbc_compressor
)
2318 dc
->fbc_compressor
->funcs
->power_up_fbc(dc
->fbc_compressor
);
2323 void dce110_fill_display_configs(
2324 const struct validate_context
*context
,
2325 struct dm_pp_display_configuration
*pp_display_cfg
)
2330 for (j
= 0; j
< context
->stream_count
; j
++) {
2333 const struct dc_stream_state
*stream
= context
->streams
[j
];
2334 struct dm_pp_single_disp_config
*cfg
=
2335 &pp_display_cfg
->disp_configs
[num_cfgs
];
2336 const struct pipe_ctx
*pipe_ctx
= NULL
;
2338 for (k
= 0; k
< MAX_PIPES
; k
++)
2339 if (stream
== context
->res_ctx
.pipe_ctx
[k
].stream
) {
2340 pipe_ctx
= &context
->res_ctx
.pipe_ctx
[k
];
2344 ASSERT(pipe_ctx
!= NULL
);
2347 cfg
->signal
= pipe_ctx
->stream
->signal
;
2348 cfg
->pipe_idx
= pipe_ctx
->pipe_idx
;
2349 cfg
->src_height
= stream
->src
.height
;
2350 cfg
->src_width
= stream
->src
.width
;
2351 cfg
->ddi_channel_mapping
=
2352 stream
->sink
->link
->ddi_channel_mapping
.raw
;
2354 stream
->sink
->link
->link_enc
->transmitter
;
2355 cfg
->link_settings
.lane_count
=
2356 stream
->sink
->link
->cur_link_settings
.lane_count
;
2357 cfg
->link_settings
.link_rate
=
2358 stream
->sink
->link
->cur_link_settings
.link_rate
;
2359 cfg
->link_settings
.link_spread
=
2360 stream
->sink
->link
->cur_link_settings
.link_spread
;
2361 cfg
->sym_clock
= stream
->phy_pix_clk
;
2362 /* Round v_refresh*/
2363 cfg
->v_refresh
= stream
->timing
.pix_clk_khz
* 1000;
2364 cfg
->v_refresh
/= stream
->timing
.h_total
;
2365 cfg
->v_refresh
= (cfg
->v_refresh
+ stream
->timing
.v_total
/ 2)
2366 / stream
->timing
.v_total
;
2369 pp_display_cfg
->display_count
= num_cfgs
;
2372 uint32_t dce110_get_min_vblank_time_us(const struct validate_context
*context
)
2375 uint32_t min_vertical_blank_time
= -1;
2377 for (j
= 0; j
< context
->stream_count
; j
++) {
2378 struct dc_stream_state
*stream
= context
->streams
[j
];
2379 uint32_t vertical_blank_in_pixels
= 0;
2380 uint32_t vertical_blank_time
= 0;
2382 vertical_blank_in_pixels
= stream
->timing
.h_total
*
2383 (stream
->timing
.v_total
2384 - stream
->timing
.v_addressable
);
2386 vertical_blank_time
= vertical_blank_in_pixels
2387 * 1000 / stream
->timing
.pix_clk_khz
;
2389 if (min_vertical_blank_time
> vertical_blank_time
)
2390 min_vertical_blank_time
= vertical_blank_time
;
2393 return min_vertical_blank_time
;
2396 static int determine_sclk_from_bounding_box(
2397 const struct core_dc
*dc
,
2403 * Some asics do not give us sclk levels, so we just report the actual
2406 if (dc
->sclk_lvls
.num_levels
== 0)
2407 return required_sclk
;
2409 for (i
= 0; i
< dc
->sclk_lvls
.num_levels
; i
++) {
2410 if (dc
->sclk_lvls
.clocks_in_khz
[i
] >= required_sclk
)
2411 return dc
->sclk_lvls
.clocks_in_khz
[i
];
2414 * even maximum level could not satisfy requirement, this
2415 * is unexpected at this stage, should have been caught at
2419 return dc
->sclk_lvls
.clocks_in_khz
[dc
->sclk_lvls
.num_levels
- 1];
2422 static void pplib_apply_display_requirements(
2424 struct validate_context
*context
)
2426 struct dm_pp_display_configuration
*pp_display_cfg
= &context
->pp_display_cfg
;
2428 pp_display_cfg
->all_displays_in_sync
=
2429 context
->bw
.dce
.all_displays_in_sync
;
2430 pp_display_cfg
->nb_pstate_switch_disable
=
2431 context
->bw
.dce
.nbp_state_change_enable
== false;
2432 pp_display_cfg
->cpu_cc6_disable
=
2433 context
->bw
.dce
.cpuc_state_change_enable
== false;
2434 pp_display_cfg
->cpu_pstate_disable
=
2435 context
->bw
.dce
.cpup_state_change_enable
== false;
2436 pp_display_cfg
->cpu_pstate_separation_time
=
2437 context
->bw
.dce
.blackout_recovery_time_us
;
2439 pp_display_cfg
->min_memory_clock_khz
= context
->bw
.dce
.yclk_khz
2440 / MEMORY_TYPE_MULTIPLIER
;
2442 pp_display_cfg
->min_engine_clock_khz
= determine_sclk_from_bounding_box(
2444 context
->bw
.dce
.sclk_khz
);
2446 pp_display_cfg
->min_engine_clock_deep_sleep_khz
2447 = context
->bw
.dce
.sclk_deep_sleep_khz
;
2449 pp_display_cfg
->avail_mclk_switch_time_us
=
2450 dce110_get_min_vblank_time_us(context
);
2452 pp_display_cfg
->avail_mclk_switch_time_in_disp_active_us
= 0;
2454 pp_display_cfg
->disp_clk_khz
= context
->bw
.dce
.dispclk_khz
;
2456 dce110_fill_display_configs(context
, pp_display_cfg
);
2458 /* TODO: is this still applicable?*/
2459 if (pp_display_cfg
->display_count
== 1) {
2460 const struct dc_crtc_timing
*timing
=
2461 &context
->streams
[0]->timing
;
2463 pp_display_cfg
->crtc_index
=
2464 pp_display_cfg
->disp_configs
[0].pipe_idx
;
2465 pp_display_cfg
->line_time_in_us
= timing
->h_total
* 1000
2466 / timing
->pix_clk_khz
;
2469 if (memcmp(&dc
->prev_display_config
, pp_display_cfg
, sizeof(
2470 struct dm_pp_display_configuration
)) != 0)
2471 dm_pp_apply_display_requirements(dc
->ctx
, pp_display_cfg
);
2473 dc
->prev_display_config
= *pp_display_cfg
;
2476 static void dce110_set_bandwidth(
2478 struct validate_context
*context
,
2479 bool decrease_allowed
)
2481 dce110_set_displaymarks(dc
, context
);
2483 if (decrease_allowed
|| context
->bw
.dce
.dispclk_khz
> dc
->current_context
->bw
.dce
.dispclk_khz
) {
2484 dc
->res_pool
->display_clock
->funcs
->set_clock(
2485 dc
->res_pool
->display_clock
,
2486 context
->bw
.dce
.dispclk_khz
* 115 / 100);
2487 dc
->current_context
->bw
.dce
.dispclk_khz
= context
->bw
.dce
.dispclk_khz
;
2490 pplib_apply_display_requirements(dc
, context
);
2493 static void dce110_program_front_end_for_pipe(
2494 struct core_dc
*dc
, struct pipe_ctx
*pipe_ctx
)
2496 struct mem_input
*mi
= pipe_ctx
->plane_res
.mi
;
2497 struct pipe_ctx
*old_pipe
= NULL
;
2498 struct dc_plane_state
*plane_state
= pipe_ctx
->plane_state
;
2499 struct xfm_grph_csc_adjustment adjust
;
2500 struct out_csc_color_matrix tbl_entry
;
2503 memset(&tbl_entry
, 0, sizeof(tbl_entry
));
2505 if (dc
->current_context
)
2506 old_pipe
= &dc
->current_context
->res_ctx
.pipe_ctx
[pipe_ctx
->pipe_idx
];
2508 memset(&adjust
, 0, sizeof(adjust
));
2509 adjust
.gamut_adjust_type
= GRAPHICS_GAMUT_ADJUST_TYPE_BYPASS
;
2511 dce_enable_fe_clock(dc
->hwseq
, pipe_ctx
->pipe_idx
, true);
2513 set_default_colors(pipe_ctx
);
2514 if (pipe_ctx
->stream
->csc_color_matrix
.enable_adjustment
2516 tbl_entry
.color_space
=
2517 pipe_ctx
->stream
->output_color_space
;
2519 for (i
= 0; i
< 12; i
++)
2520 tbl_entry
.regval
[i
] =
2521 pipe_ctx
->stream
->csc_color_matrix
.matrix
[i
];
2523 pipe_ctx
->plane_res
.xfm
->funcs
->opp_set_csc_adjustment
2524 (pipe_ctx
->plane_res
.xfm
, &tbl_entry
);
2527 if (pipe_ctx
->stream
->gamut_remap_matrix
.enable_remap
== true) {
2528 adjust
.gamut_adjust_type
= GRAPHICS_GAMUT_ADJUST_TYPE_SW
;
2529 adjust
.temperature_matrix
[0] =
2531 gamut_remap_matrix
.matrix
[0];
2532 adjust
.temperature_matrix
[1] =
2534 gamut_remap_matrix
.matrix
[1];
2535 adjust
.temperature_matrix
[2] =
2537 gamut_remap_matrix
.matrix
[2];
2538 adjust
.temperature_matrix
[3] =
2540 gamut_remap_matrix
.matrix
[4];
2541 adjust
.temperature_matrix
[4] =
2543 gamut_remap_matrix
.matrix
[5];
2544 adjust
.temperature_matrix
[5] =
2546 gamut_remap_matrix
.matrix
[6];
2547 adjust
.temperature_matrix
[6] =
2549 gamut_remap_matrix
.matrix
[8];
2550 adjust
.temperature_matrix
[7] =
2552 gamut_remap_matrix
.matrix
[9];
2553 adjust
.temperature_matrix
[8] =
2555 gamut_remap_matrix
.matrix
[10];
2558 pipe_ctx
->plane_res
.xfm
->funcs
->transform_set_gamut_remap(pipe_ctx
->plane_res
.xfm
, &adjust
);
2560 pipe_ctx
->plane_res
.scl_data
.lb_params
.alpha_en
= pipe_ctx
->bottom_pipe
!= 0;
2562 program_scaler(dc
, pipe_ctx
);
2564 mi
->funcs
->mem_input_program_surface_config(
2566 plane_state
->format
,
2567 &plane_state
->tiling_info
,
2568 &plane_state
->plane_size
,
2569 plane_state
->rotation
,
2572 if (mi
->funcs
->set_blank
)
2573 mi
->funcs
->set_blank(mi
, pipe_ctx
->plane_state
->visible
);
2575 if (dc
->public.config
.gpu_vm_support
)
2576 mi
->funcs
->mem_input_program_pte_vm(
2577 pipe_ctx
->plane_res
.mi
,
2578 plane_state
->format
,
2579 &plane_state
->tiling_info
,
2580 plane_state
->rotation
);
2582 dm_logger_write(dc
->ctx
->logger
, LOG_SURFACE
,
2583 "Pipe:%d 0x%x: addr hi:0x%x, "
2586 " %d; dst: %d, %d, %d, %d;"
2587 "clip: %d, %d, %d, %d\n",
2589 pipe_ctx
->plane_state
,
2590 pipe_ctx
->plane_state
->address
.grph
.addr
.high_part
,
2591 pipe_ctx
->plane_state
->address
.grph
.addr
.low_part
,
2592 pipe_ctx
->plane_state
->src_rect
.x
,
2593 pipe_ctx
->plane_state
->src_rect
.y
,
2594 pipe_ctx
->plane_state
->src_rect
.width
,
2595 pipe_ctx
->plane_state
->src_rect
.height
,
2596 pipe_ctx
->plane_state
->dst_rect
.x
,
2597 pipe_ctx
->plane_state
->dst_rect
.y
,
2598 pipe_ctx
->plane_state
->dst_rect
.width
,
2599 pipe_ctx
->plane_state
->dst_rect
.height
,
2600 pipe_ctx
->plane_state
->clip_rect
.x
,
2601 pipe_ctx
->plane_state
->clip_rect
.y
,
2602 pipe_ctx
->plane_state
->clip_rect
.width
,
2603 pipe_ctx
->plane_state
->clip_rect
.height
);
2605 dm_logger_write(dc
->ctx
->logger
, LOG_SURFACE
,
2606 "Pipe %d: width, height, x, y\n"
2607 "viewport:%d, %d, %d, %d\n"
2608 "recout: %d, %d, %d, %d\n",
2610 pipe_ctx
->plane_res
.scl_data
.viewport
.width
,
2611 pipe_ctx
->plane_res
.scl_data
.viewport
.height
,
2612 pipe_ctx
->plane_res
.scl_data
.viewport
.x
,
2613 pipe_ctx
->plane_res
.scl_data
.viewport
.y
,
2614 pipe_ctx
->plane_res
.scl_data
.recout
.width
,
2615 pipe_ctx
->plane_res
.scl_data
.recout
.height
,
2616 pipe_ctx
->plane_res
.scl_data
.recout
.x
,
2617 pipe_ctx
->plane_res
.scl_data
.recout
.y
);
2620 static void dce110_apply_ctx_for_surface(
2622 const struct dc_stream_state
*stream
,
2624 struct validate_context
*context
)
2628 if (num_planes
== 0)
2632 for (i
= 0; i
< dc
->res_pool
->pipe_count
; i
++) {
2633 if (stream
== context
->res_ctx
.pipe_ctx
[i
].stream
) {
2634 be_idx
= context
->res_ctx
.pipe_ctx
[i
].stream_res
.tg
->inst
;
2639 for (i
= 0; i
< dc
->res_pool
->pipe_count
; i
++) {
2640 struct pipe_ctx
*pipe_ctx
= &context
->res_ctx
.pipe_ctx
[i
];
2642 if (pipe_ctx
->stream
== stream
)
2645 dce110_program_front_end_for_pipe(dc
, pipe_ctx
);
2646 program_surface_visibility(dc
, pipe_ctx
);
2651 static void dce110_power_down_fe(struct core_dc
*dc
, int fe_idx
)
2653 /* Do not power down fe when stream is active on dce*/
2654 if (dc
->current_context
->res_ctx
.pipe_ctx
[fe_idx
].stream
)
2657 dc
->hwss
.enable_display_power_gating(
2658 dc
, fe_idx
, dc
->ctx
->dc_bios
, PIPE_GATING_CONTROL_ENABLE
);
2660 dc
->res_pool
->transforms
[fe_idx
]->funcs
->transform_reset(
2661 dc
->res_pool
->transforms
[fe_idx
]);
2664 static void dce110_wait_for_mpcc_disconnect(
2666 struct resource_pool
*res_pool
,
2667 struct pipe_ctx
*pipe_ctx
)
2672 static void program_csc_matrix(struct pipe_ctx
*pipe_ctx
,
2673 enum dc_color_space colorspace
,
2677 struct out_csc_color_matrix tbl_entry
;
2679 if (pipe_ctx
->stream
->csc_color_matrix
.enable_adjustment
2681 enum dc_color_space color_space
=
2682 pipe_ctx
->stream
->output_color_space
;
2684 //uint16_t matrix[12];
2685 for (i
= 0; i
< 12; i
++)
2686 tbl_entry
.regval
[i
] = pipe_ctx
->stream
->csc_color_matrix
.matrix
[i
];
2688 tbl_entry
.color_space
= color_space
;
2689 //tbl_entry.regval = matrix;
2690 pipe_ctx
->plane_res
.xfm
->funcs
->opp_set_csc_adjustment(pipe_ctx
->plane_res
.xfm
, &tbl_entry
);
2694 static const struct hw_sequencer_funcs dce110_funcs
= {
2695 .program_gamut_remap
= program_gamut_remap
,
2696 .program_csc_matrix
= program_csc_matrix
,
2698 .apply_ctx_to_hw
= dce110_apply_ctx_to_hw
,
2699 .apply_ctx_for_surface
= dce110_apply_ctx_for_surface
,
2700 .set_plane_config
= set_plane_config
,
2701 .update_plane_addr
= update_plane_addr
,
2702 .update_pending_status
= dce110_update_pending_status
,
2703 .set_input_transfer_func
= dce110_set_input_transfer_func
,
2704 .set_output_transfer_func
= dce110_set_output_transfer_func
,
2705 .power_down
= dce110_power_down
,
2706 .enable_accelerated_mode
= dce110_enable_accelerated_mode
,
2707 .enable_timing_synchronization
= dce110_enable_timing_synchronization
,
2708 .update_info_frame
= dce110_update_info_frame
,
2709 .enable_stream
= dce110_enable_stream
,
2710 .disable_stream
= dce110_disable_stream
,
2711 .unblank_stream
= dce110_unblank_stream
,
2712 .enable_display_pipe_clock_gating
= enable_display_pipe_clock_gating
,
2713 .enable_display_power_gating
= dce110_enable_display_power_gating
,
2714 .power_down_front_end
= dce110_power_down_fe
,
2715 .pipe_control_lock
= dce_pipe_control_lock
,
2716 .set_bandwidth
= dce110_set_bandwidth
,
2718 .get_position
= get_position
,
2719 .set_static_screen_control
= set_static_screen_control
,
2720 .reset_hw_ctx_wrap
= dce110_reset_hw_ctx_wrap
,
2721 .prog_pixclk_crtc_otg
= dce110_prog_pixclk_crtc_otg
,
2722 .setup_stereo
= NULL
,
2723 .set_avmute
= dce110_set_avmute
,
2724 .wait_for_mpcc_disconnect
= dce110_wait_for_mpcc_disconnect
2727 bool dce110_hw_sequencer_construct(struct core_dc
*dc
)
2729 dc
->hwss
= dce110_funcs
;