@@ -316,7 +316,7 @@ static void amdgpu_dm_set_crc_window_default(struct drm_crtc *crtc, struct dc_st
316
316
spin_unlock_irqrestore (& drm_dev -> event_lock , flags );
317
317
318
318
/* Disable secure_display if it was enabled */
319
- if (was_activated ) {
319
+ if (was_activated && dm -> secure_display_ctx . op_mode == LEGACY_MODE ) {
320
320
/* stop ROI update on this crtc */
321
321
flush_work (& dm -> secure_display_ctx .crtc_ctx [crtc -> index ].notify_ta_work );
322
322
flush_work (& dm -> secure_display_ctx .crtc_ctx [crtc -> index ].forward_roi_work );
@@ -691,7 +691,8 @@ int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name)
691
691
692
692
#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY )
693
693
/* Initialize phy id mapping table for secure display*/
694
- if (!dm -> secure_display_ctx .phy_mapping_updated )
694
+ if (dm -> secure_display_ctx .op_mode == LEGACY_MODE &&
695
+ !dm -> secure_display_ctx .phy_mapping_updated )
695
696
update_phy_id_mapping (adev );
696
697
#endif
697
698
@@ -774,6 +775,7 @@ void amdgpu_dm_crtc_handle_crc_window_irq(struct drm_crtc *crtc)
774
775
bool forward_roi_change = false;
775
776
bool notify_ta = false;
776
777
bool all_crc_ready = true;
778
+ struct dc_stream_state * stream_state ;
777
779
int i ;
778
780
779
781
if (crtc == NULL )
@@ -782,6 +784,7 @@ void amdgpu_dm_crtc_handle_crc_window_irq(struct drm_crtc *crtc)
782
784
acrtc = to_amdgpu_crtc (crtc );
783
785
adev = drm_to_adev (crtc -> dev );
784
786
drm_dev = crtc -> dev ;
787
+ stream_state = to_dm_crtc_state (crtc -> state )-> stream ;
785
788
786
789
spin_lock_irqsave (& drm_dev -> event_lock , flags1 );
787
790
cur_crc_src = acrtc -> dm_irq_params .crc_src ;
@@ -807,6 +810,17 @@ void amdgpu_dm_crtc_handle_crc_window_irq(struct drm_crtc *crtc)
807
810
}
808
811
809
812
for (i = 0 ; i < MAX_CRC_WINDOW_NUM ; i ++ ) {
813
+ struct crc_params crc_window = {
814
+ .windowa_x_start = acrtc -> dm_irq_params .window_param [i ].x_start ,
815
+ .windowa_y_start = acrtc -> dm_irq_params .window_param [i ].y_start ,
816
+ .windowa_x_end = acrtc -> dm_irq_params .window_param [i ].x_end ,
817
+ .windowa_y_end = acrtc -> dm_irq_params .window_param [i ].y_end ,
818
+ .windowb_x_start = acrtc -> dm_irq_params .window_param [i ].x_start ,
819
+ .windowb_y_start = acrtc -> dm_irq_params .window_param [i ].y_start ,
820
+ .windowb_x_end = acrtc -> dm_irq_params .window_param [i ].x_end ,
821
+ .windowb_y_end = acrtc -> dm_irq_params .window_param [i ].y_end ,
822
+ };
823
+
810
824
crtc_ctx -> roi [i ].enable = acrtc -> dm_irq_params .window_param [i ].enable ;
811
825
812
826
if (!acrtc -> dm_irq_params .window_param [i ].enable ) {
@@ -821,15 +835,20 @@ void amdgpu_dm_crtc_handle_crc_window_irq(struct drm_crtc *crtc)
821
835
}
822
836
823
837
if (acrtc -> dm_irq_params .window_param [i ].update_win ) {
824
- /* prepare work for dmub to update ROI */
825
- crtc_ctx -> roi [i ].rect .x = acrtc -> dm_irq_params .window_param [i ].x_start ;
826
- crtc_ctx -> roi [i ].rect .y = acrtc -> dm_irq_params .window_param [i ].y_start ;
827
- crtc_ctx -> roi [i ].rect .width = acrtc -> dm_irq_params .window_param [i ].x_end -
828
- acrtc -> dm_irq_params .window_param [i ].x_start ;
829
- crtc_ctx -> roi [i ].rect .height = acrtc -> dm_irq_params .window_param [i ].y_end -
830
- acrtc -> dm_irq_params .window_param [i ].y_start ;
831
-
832
- forward_roi_change = true;
838
+ crtc_ctx -> roi [i ].rect .x = crc_window .windowa_x_start ;
839
+ crtc_ctx -> roi [i ].rect .y = crc_window .windowa_y_start ;
840
+ crtc_ctx -> roi [i ].rect .width = crc_window .windowa_x_end -
841
+ crc_window .windowa_x_start ;
842
+ crtc_ctx -> roi [i ].rect .height = crc_window .windowa_y_end -
843
+ crc_window .windowa_y_start ;
844
+
845
+ if (adev -> dm .secure_display_ctx .op_mode == LEGACY_MODE )
846
+ /* forward task to dmub to update ROI */
847
+ forward_roi_change = true;
848
+ else if (adev -> dm .secure_display_ctx .op_mode == DISPLAY_CRC_MODE )
849
+ /* update ROI via dm*/
850
+ dc_stream_configure_crc (stream_state -> ctx -> dc , stream_state ,
851
+ & crc_window , true, true, i , false);
833
852
834
853
reset_crc_frame_count [i ] = true;
835
854
@@ -843,14 +862,18 @@ void amdgpu_dm_crtc_handle_crc_window_irq(struct drm_crtc *crtc)
843
862
acrtc -> dm_irq_params .window_param [i ].skip_frame_cnt = 1 ;
844
863
crtc_ctx -> crc_info .crc [i ].crc_ready = false;
845
864
} else {
846
- struct dc_stream_state * stream_state = to_dm_crtc_state (crtc -> state )-> stream ;
847
-
848
865
if (!dc_stream_get_crc (stream_state -> ctx -> dc , stream_state , i ,
849
866
& crc_r [i ], & crc_g [i ], & crc_b [i ]))
850
867
DRM_ERROR ("Secure Display: fail to get crc from engine %d\n" , i );
851
868
852
- /* prepare work for psp to read ROI/CRC and send to I2C */
853
- notify_ta = true;
869
+ if (adev -> dm .secure_display_ctx .op_mode == LEGACY_MODE )
870
+ /* forward task to psp to read ROI/CRC and output via I2C */
871
+ notify_ta = true;
872
+ else if (adev -> dm .secure_display_ctx .op_mode == DISPLAY_CRC_MODE )
873
+ /* Avoid ROI window get changed, keep overwriting. */
874
+ dc_stream_configure_crc (stream_state -> ctx -> dc , stream_state ,
875
+ & crc_window , true, true, i , false);
876
+
854
877
/* crc ready for psp to read out */
855
878
crtc_ctx -> crc_info .crc [i ].crc_ready = true;
856
879
}
@@ -914,6 +937,7 @@ void amdgpu_dm_crtc_secure_display_create_contexts(struct amdgpu_device *adev)
914
937
}
915
938
916
939
adev -> dm .secure_display_ctx .crtc_ctx = crtc_ctx ;
917
- return ;
940
+
941
+ adev -> dm .secure_display_ctx .op_mode = DISPLAY_CRC_MODE ;
918
942
}
919
943
#endif
0 commit comments