@@ -39,15 +39,17 @@ struct intel_color_funcs {
39
39
* the next vblank start, alongside any other double buffered
40
40
* registers involved with the same commit. This hook is optional.
41
41
*/
42
- void (* color_commit_noarm )(const struct intel_crtc_state * crtc_state );
42
+ void (* color_commit_noarm )(struct intel_dsb * dsb ,
43
+ const struct intel_crtc_state * crtc_state );
43
44
/*
44
45
* Program arming double buffered color management registers
45
46
* during vblank evasion. The registers (and whatever other registers
46
47
* they arm that were written by color_commit_noarm) should then latch
47
48
* during the next vblank start, alongside any other double buffered
48
49
* registers involved with the same commit.
49
50
*/
50
- void (* color_commit_arm )(const struct intel_crtc_state * crtc_state );
51
+ void (* color_commit_arm )(struct intel_dsb * dsb ,
52
+ const struct intel_crtc_state * crtc_state );
51
53
/*
52
54
* Perform any extra tasks needed after all the
53
55
* double buffered registers have been latched.
@@ -205,37 +207,44 @@ static u64 *ctm_mult_by_limited(u64 *result, const u64 *input)
205
207
return result ;
206
208
}
207
209
208
- static void ilk_update_pipe_csc (struct intel_crtc * crtc ,
210
+ static void ilk_update_pipe_csc (struct intel_dsb * dsb ,
211
+ struct intel_crtc * crtc ,
209
212
const struct intel_csc_matrix * csc )
210
213
{
211
- struct drm_i915_private * i915 = to_i915 (crtc -> base .dev );
214
+ struct intel_display * display = to_intel_display (crtc -> base .dev );
212
215
enum pipe pipe = crtc -> pipe ;
213
216
214
- intel_de_write_fw (i915 , PIPE_CSC_PREOFF_HI (pipe ), csc -> preoff [0 ]);
215
- intel_de_write_fw (i915 , PIPE_CSC_PREOFF_ME (pipe ), csc -> preoff [1 ]);
216
- intel_de_write_fw (i915 , PIPE_CSC_PREOFF_LO (pipe ), csc -> preoff [2 ]);
217
-
218
- intel_de_write_fw (i915 , PIPE_CSC_COEFF_RY_GY (pipe ),
219
- csc -> coeff [0 ] << 16 | csc -> coeff [1 ]);
220
- intel_de_write_fw (i915 , PIPE_CSC_COEFF_BY (pipe ),
221
- csc -> coeff [2 ] << 16 );
222
-
223
- intel_de_write_fw (i915 , PIPE_CSC_COEFF_RU_GU (pipe ),
224
- csc -> coeff [3 ] << 16 | csc -> coeff [4 ]);
225
- intel_de_write_fw (i915 , PIPE_CSC_COEFF_BU (pipe ),
226
- csc -> coeff [5 ] << 16 );
227
-
228
- intel_de_write_fw (i915 , PIPE_CSC_COEFF_RV_GV (pipe ),
229
- csc -> coeff [6 ] << 16 | csc -> coeff [7 ]);
230
- intel_de_write_fw (i915 , PIPE_CSC_COEFF_BV (pipe ),
231
- csc -> coeff [8 ] << 16 );
232
-
233
- if (DISPLAY_VER (i915 ) < 7 )
217
+ intel_de_write_dsb (display , dsb , PIPE_CSC_PREOFF_HI (pipe ),
218
+ csc -> preoff [0 ]);
219
+ intel_de_write_dsb (display , dsb , PIPE_CSC_PREOFF_ME (pipe ),
220
+ csc -> preoff [1 ]);
221
+ intel_de_write_dsb (display , dsb , PIPE_CSC_PREOFF_LO (pipe ),
222
+ csc -> preoff [2 ]);
223
+
224
+ intel_de_write_dsb (display , dsb , PIPE_CSC_COEFF_RY_GY (pipe ),
225
+ csc -> coeff [0 ] << 16 | csc -> coeff [1 ]);
226
+ intel_de_write_dsb (display , dsb , PIPE_CSC_COEFF_BY (pipe ),
227
+ csc -> coeff [2 ] << 16 );
228
+
229
+ intel_de_write_dsb (display , dsb , PIPE_CSC_COEFF_RU_GU (pipe ),
230
+ csc -> coeff [3 ] << 16 | csc -> coeff [4 ]);
231
+ intel_de_write_dsb (display , dsb , PIPE_CSC_COEFF_BU (pipe ),
232
+ csc -> coeff [5 ] << 16 );
233
+
234
+ intel_de_write_dsb (display , dsb , PIPE_CSC_COEFF_RV_GV (pipe ),
235
+ csc -> coeff [6 ] << 16 | csc -> coeff [7 ]);
236
+ intel_de_write_dsb (display , dsb , PIPE_CSC_COEFF_BV (pipe ),
237
+ csc -> coeff [8 ] << 16 );
238
+
239
+ if (DISPLAY_VER (display ) < 7 )
234
240
return ;
235
241
236
- intel_de_write_fw (i915 , PIPE_CSC_POSTOFF_HI (pipe ), csc -> postoff [0 ]);
237
- intel_de_write_fw (i915 , PIPE_CSC_POSTOFF_ME (pipe ), csc -> postoff [1 ]);
238
- intel_de_write_fw (i915 , PIPE_CSC_POSTOFF_LO (pipe ), csc -> postoff [2 ]);
242
+ intel_de_write_dsb (display , dsb , PIPE_CSC_POSTOFF_HI (pipe ),
243
+ csc -> postoff [0 ]);
244
+ intel_de_write_dsb (display , dsb , PIPE_CSC_POSTOFF_ME (pipe ),
245
+ csc -> postoff [1 ]);
246
+ intel_de_write_dsb (display , dsb , PIPE_CSC_POSTOFF_LO (pipe ),
247
+ csc -> postoff [2 ]);
239
248
}
240
249
241
250
static void ilk_read_pipe_csc (struct intel_crtc * crtc ,
@@ -304,34 +313,41 @@ static void skl_read_csc(struct intel_crtc_state *crtc_state)
304
313
ilk_read_pipe_csc (crtc , & crtc_state -> csc );
305
314
}
306
315
307
- static void icl_update_output_csc (struct intel_crtc * crtc ,
316
+ static void icl_update_output_csc (struct intel_dsb * dsb ,
317
+ struct intel_crtc * crtc ,
308
318
const struct intel_csc_matrix * csc )
309
319
{
310
- struct drm_i915_private * i915 = to_i915 (crtc -> base .dev );
320
+ struct intel_display * display = to_intel_display (crtc -> base .dev );
311
321
enum pipe pipe = crtc -> pipe ;
312
322
313
- intel_de_write_fw (i915 , PIPE_CSC_OUTPUT_PREOFF_HI (pipe ), csc -> preoff [0 ]);
314
- intel_de_write_fw (i915 , PIPE_CSC_OUTPUT_PREOFF_ME (pipe ), csc -> preoff [1 ]);
315
- intel_de_write_fw (i915 , PIPE_CSC_OUTPUT_PREOFF_LO (pipe ), csc -> preoff [2 ]);
323
+ intel_de_write_dsb (display , dsb , PIPE_CSC_OUTPUT_PREOFF_HI (pipe ),
324
+ csc -> preoff [0 ]);
325
+ intel_de_write_dsb (display , dsb , PIPE_CSC_OUTPUT_PREOFF_ME (pipe ),
326
+ csc -> preoff [1 ]);
327
+ intel_de_write_dsb (display , dsb , PIPE_CSC_OUTPUT_PREOFF_LO (pipe ),
328
+ csc -> preoff [2 ]);
316
329
317
- intel_de_write_fw ( i915 , PIPE_CSC_OUTPUT_COEFF_RY_GY (pipe ),
318
- csc -> coeff [0 ] << 16 | csc -> coeff [1 ]);
319
- intel_de_write_fw ( i915 , PIPE_CSC_OUTPUT_COEFF_BY (pipe ),
320
- csc -> coeff [2 ] << 16 );
330
+ intel_de_write_dsb ( display , dsb , PIPE_CSC_OUTPUT_COEFF_RY_GY (pipe ),
331
+ csc -> coeff [0 ] << 16 | csc -> coeff [1 ]);
332
+ intel_de_write_dsb ( display , dsb , PIPE_CSC_OUTPUT_COEFF_BY (pipe ),
333
+ csc -> coeff [2 ] << 16 );
321
334
322
- intel_de_write_fw ( i915 , PIPE_CSC_OUTPUT_COEFF_RU_GU (pipe ),
323
- csc -> coeff [3 ] << 16 | csc -> coeff [4 ]);
324
- intel_de_write_fw ( i915 , PIPE_CSC_OUTPUT_COEFF_BU (pipe ),
325
- csc -> coeff [5 ] << 16 );
335
+ intel_de_write_dsb ( display , dsb , PIPE_CSC_OUTPUT_COEFF_RU_GU (pipe ),
336
+ csc -> coeff [3 ] << 16 | csc -> coeff [4 ]);
337
+ intel_de_write_dsb ( display , dsb , PIPE_CSC_OUTPUT_COEFF_BU (pipe ),
338
+ csc -> coeff [5 ] << 16 );
326
339
327
- intel_de_write_fw ( i915 , PIPE_CSC_OUTPUT_COEFF_RV_GV (pipe ),
328
- csc -> coeff [6 ] << 16 | csc -> coeff [7 ]);
329
- intel_de_write_fw ( i915 , PIPE_CSC_OUTPUT_COEFF_BV (pipe ),
330
- csc -> coeff [8 ] << 16 );
340
+ intel_de_write_dsb ( display , dsb , PIPE_CSC_OUTPUT_COEFF_RV_GV (pipe ),
341
+ csc -> coeff [6 ] << 16 | csc -> coeff [7 ]);
342
+ intel_de_write_dsb ( display , dsb , PIPE_CSC_OUTPUT_COEFF_BV (pipe ),
343
+ csc -> coeff [8 ] << 16 );
331
344
332
- intel_de_write_fw (i915 , PIPE_CSC_OUTPUT_POSTOFF_HI (pipe ), csc -> postoff [0 ]);
333
- intel_de_write_fw (i915 , PIPE_CSC_OUTPUT_POSTOFF_ME (pipe ), csc -> postoff [1 ]);
334
- intel_de_write_fw (i915 , PIPE_CSC_OUTPUT_POSTOFF_LO (pipe ), csc -> postoff [2 ]);
345
+ intel_de_write_dsb (display , dsb , PIPE_CSC_OUTPUT_POSTOFF_HI (pipe ),
346
+ csc -> postoff [0 ]);
347
+ intel_de_write_dsb (display , dsb , PIPE_CSC_OUTPUT_POSTOFF_ME (pipe ),
348
+ csc -> postoff [1 ]);
349
+ intel_de_write_dsb (display , dsb , PIPE_CSC_OUTPUT_POSTOFF_LO (pipe ),
350
+ csc -> postoff [2 ]);
335
351
}
336
352
337
353
static void icl_read_output_csc (struct intel_crtc * crtc ,
@@ -526,12 +542,13 @@ static void ilk_assign_csc(struct intel_crtc_state *crtc_state)
526
542
}
527
543
}
528
544
529
- static void ilk_load_csc_matrix (const struct intel_crtc_state * crtc_state )
545
+ static void ilk_load_csc_matrix (struct intel_dsb * dsb ,
546
+ const struct intel_crtc_state * crtc_state )
530
547
{
531
548
struct intel_crtc * crtc = to_intel_crtc (crtc_state -> uapi .crtc );
532
549
533
550
if (crtc_state -> csc_enable )
534
- ilk_update_pipe_csc (crtc , & crtc_state -> csc );
551
+ ilk_update_pipe_csc (dsb , crtc , & crtc_state -> csc );
535
552
}
536
553
537
554
static void icl_assign_csc (struct intel_crtc_state * crtc_state )
@@ -563,15 +580,16 @@ static void icl_assign_csc(struct intel_crtc_state *crtc_state)
563
580
}
564
581
}
565
582
566
- static void icl_load_csc_matrix (const struct intel_crtc_state * crtc_state )
583
+ static void icl_load_csc_matrix (struct intel_dsb * dsb ,
584
+ const struct intel_crtc_state * crtc_state )
567
585
{
568
586
struct intel_crtc * crtc = to_intel_crtc (crtc_state -> uapi .crtc );
569
587
570
588
if (crtc_state -> csc_mode & ICL_CSC_ENABLE )
571
- ilk_update_pipe_csc (crtc , & crtc_state -> csc );
589
+ ilk_update_pipe_csc (dsb , crtc , & crtc_state -> csc );
572
590
573
591
if (crtc_state -> csc_mode & ICL_OUTPUT_CSC_ENABLE )
574
- icl_update_output_csc (crtc , & crtc_state -> output_csc );
592
+ icl_update_output_csc (dsb , crtc , & crtc_state -> output_csc );
575
593
}
576
594
577
595
static u16 ctm_to_twos_complement (u64 coeff , int int_bits , int frac_bits )
@@ -953,7 +971,8 @@ static void ilk_lut_12p4_pack(struct drm_color_lut *entry, u32 ldw, u32 udw)
953
971
REG_FIELD_GET (PREC_PALETTE_12P4_BLUE_LDW_MASK , ldw );
954
972
}
955
973
956
- static void icl_color_commit_noarm (const struct intel_crtc_state * crtc_state )
974
+ static void icl_color_commit_noarm (struct intel_dsb * dsb ,
975
+ const struct intel_crtc_state * crtc_state )
957
976
{
958
977
/*
959
978
* Despite Wa_1406463849, ICL no longer suffers from the SKL
@@ -963,10 +982,11 @@ static void icl_color_commit_noarm(const struct intel_crtc_state *crtc_state)
963
982
*
964
983
* On TGL+ all CSC arming issues have been properly fixed.
965
984
*/
966
- icl_load_csc_matrix (crtc_state );
985
+ icl_load_csc_matrix (dsb , crtc_state );
967
986
}
968
987
969
- static void skl_color_commit_noarm (const struct intel_crtc_state * crtc_state )
988
+ static void skl_color_commit_noarm (struct intel_dsb * dsb ,
989
+ const struct intel_crtc_state * crtc_state )
970
990
{
971
991
/*
972
992
* Possibly related to display WA #1184, SKL CSC loses the latched
@@ -979,21 +999,24 @@ static void skl_color_commit_noarm(const struct intel_crtc_state *crtc_state)
979
999
* which is called after PSR exit.
980
1000
*/
981
1001
if (!crtc_state -> has_psr )
982
- ilk_load_csc_matrix (crtc_state );
1002
+ ilk_load_csc_matrix (dsb , crtc_state );
983
1003
}
984
1004
985
- static void ilk_color_commit_noarm (const struct intel_crtc_state * crtc_state )
1005
+ static void ilk_color_commit_noarm (struct intel_dsb * dsb ,
1006
+ const struct intel_crtc_state * crtc_state )
986
1007
{
987
- ilk_load_csc_matrix (crtc_state );
1008
+ ilk_load_csc_matrix (dsb , crtc_state );
988
1009
}
989
1010
990
- static void i9xx_color_commit_arm (const struct intel_crtc_state * crtc_state )
1011
+ static void i9xx_color_commit_arm (struct intel_dsb * dsb ,
1012
+ const struct intel_crtc_state * crtc_state )
991
1013
{
992
1014
/* update TRANSCONF GAMMA_MODE */
993
1015
i9xx_set_pipeconf (crtc_state );
994
1016
}
995
1017
996
- static void ilk_color_commit_arm (const struct intel_crtc_state * crtc_state )
1018
+ static void ilk_color_commit_arm (struct intel_dsb * dsb ,
1019
+ const struct intel_crtc_state * crtc_state )
997
1020
{
998
1021
struct intel_crtc * crtc = to_intel_crtc (crtc_state -> uapi .crtc );
999
1022
struct drm_i915_private * i915 = to_i915 (crtc -> base .dev );
@@ -1005,7 +1028,8 @@ static void ilk_color_commit_arm(const struct intel_crtc_state *crtc_state)
1005
1028
crtc_state -> csc_mode );
1006
1029
}
1007
1030
1008
- static void hsw_color_commit_arm (const struct intel_crtc_state * crtc_state )
1031
+ static void hsw_color_commit_arm (struct intel_dsb * dsb ,
1032
+ const struct intel_crtc_state * crtc_state )
1009
1033
{
1010
1034
struct intel_crtc * crtc = to_intel_crtc (crtc_state -> uapi .crtc );
1011
1035
struct drm_i915_private * i915 = to_i915 (crtc -> base .dev );
@@ -1076,15 +1100,16 @@ static void skl_get_config(struct intel_crtc_state *crtc_state)
1076
1100
crtc_state -> csc_enable = true;
1077
1101
}
1078
1102
1079
- static void skl_color_commit_arm (const struct intel_crtc_state * crtc_state )
1103
+ static void skl_color_commit_arm (struct intel_dsb * dsb ,
1104
+ const struct intel_crtc_state * crtc_state )
1080
1105
{
1081
1106
struct intel_crtc * crtc = to_intel_crtc (crtc_state -> uapi .crtc );
1082
- struct drm_i915_private * i915 = to_i915 (crtc -> base .dev );
1107
+ struct intel_display * display = to_intel_display (crtc -> base .dev );
1083
1108
enum pipe pipe = crtc -> pipe ;
1084
1109
u32 val = 0 ;
1085
1110
1086
1111
if (crtc_state -> has_psr )
1087
- ilk_load_csc_matrix (crtc_state );
1112
+ ilk_load_csc_matrix (dsb , crtc_state );
1088
1113
1089
1114
/*
1090
1115
* We don't (yet) allow userspace to control the pipe background color,
@@ -1095,32 +1120,29 @@ static void skl_color_commit_arm(const struct intel_crtc_state *crtc_state)
1095
1120
val |= SKL_BOTTOM_COLOR_GAMMA_ENABLE ;
1096
1121
if (crtc_state -> csc_enable )
1097
1122
val |= SKL_BOTTOM_COLOR_CSC_ENABLE ;
1098
- intel_de_write ( i915 , SKL_BOTTOM_COLOR (pipe ), val );
1123
+ intel_de_write_dsb ( display , dsb , SKL_BOTTOM_COLOR (pipe ), val );
1099
1124
1100
- intel_de_write (i915 , GAMMA_MODE (crtc -> pipe ),
1101
- crtc_state -> gamma_mode );
1125
+ intel_de_write_dsb (display , dsb , GAMMA_MODE (crtc -> pipe ), crtc_state -> gamma_mode );
1102
1126
1103
- intel_de_write_fw (i915 , PIPE_CSC_MODE (crtc -> pipe ),
1104
- crtc_state -> csc_mode );
1127
+ intel_de_write_dsb (display , dsb , PIPE_CSC_MODE (crtc -> pipe ), crtc_state -> csc_mode );
1105
1128
}
1106
1129
1107
- static void icl_color_commit_arm (const struct intel_crtc_state * crtc_state )
1130
+ static void icl_color_commit_arm (struct intel_dsb * dsb ,
1131
+ const struct intel_crtc_state * crtc_state )
1108
1132
{
1109
1133
struct intel_crtc * crtc = to_intel_crtc (crtc_state -> uapi .crtc );
1110
- struct drm_i915_private * i915 = to_i915 (crtc -> base .dev );
1134
+ struct intel_display * display = to_intel_display (crtc -> base .dev );
1111
1135
enum pipe pipe = crtc -> pipe ;
1112
1136
1113
1137
/*
1114
1138
* We don't (yet) allow userspace to control the pipe background color,
1115
1139
* so force it to black.
1116
1140
*/
1117
- intel_de_write ( i915 , SKL_BOTTOM_COLOR (pipe ), 0 );
1141
+ intel_de_write_dsb ( display , dsb , SKL_BOTTOM_COLOR (pipe ), 0 );
1118
1142
1119
- intel_de_write (i915 , GAMMA_MODE (crtc -> pipe ),
1120
- crtc_state -> gamma_mode );
1143
+ intel_de_write_dsb (display , dsb , GAMMA_MODE (crtc -> pipe ), crtc_state -> gamma_mode );
1121
1144
1122
- intel_de_write_fw (i915 , PIPE_CSC_MODE (crtc -> pipe ),
1123
- crtc_state -> csc_mode );
1145
+ intel_de_write_dsb (display , dsb , PIPE_CSC_MODE (crtc -> pipe ), crtc_state -> csc_mode );
1124
1146
}
1125
1147
1126
1148
static void icl_color_post_update (const struct intel_crtc_state * crtc_state )
@@ -1876,19 +1898,21 @@ void intel_color_load_luts(const struct intel_crtc_state *crtc_state)
1876
1898
i915 -> display .funcs .color -> load_luts (crtc_state );
1877
1899
}
1878
1900
1879
- void intel_color_commit_noarm (const struct intel_crtc_state * crtc_state )
1901
+ void intel_color_commit_noarm (struct intel_dsb * dsb ,
1902
+ const struct intel_crtc_state * crtc_state )
1880
1903
{
1881
1904
struct drm_i915_private * i915 = to_i915 (crtc_state -> uapi .crtc -> dev );
1882
1905
1883
1906
if (i915 -> display .funcs .color -> color_commit_noarm )
1884
- i915 -> display .funcs .color -> color_commit_noarm (crtc_state );
1907
+ i915 -> display .funcs .color -> color_commit_noarm (dsb , crtc_state );
1885
1908
}
1886
1909
1887
- void intel_color_commit_arm (const struct intel_crtc_state * crtc_state )
1910
+ void intel_color_commit_arm (struct intel_dsb * dsb ,
1911
+ const struct intel_crtc_state * crtc_state )
1888
1912
{
1889
1913
struct drm_i915_private * i915 = to_i915 (crtc_state -> uapi .crtc -> dev );
1890
1914
1891
- i915 -> display .funcs .color -> color_commit_arm (crtc_state );
1915
+ i915 -> display .funcs .color -> color_commit_arm (dsb , crtc_state );
1892
1916
1893
1917
if (crtc_state -> dsb_color_commit )
1894
1918
intel_dsb_commit (crtc_state -> dsb_color_commit , false);
@@ -1907,8 +1931,8 @@ void intel_color_modeset(const struct intel_crtc_state *crtc_state)
1907
1931
struct intel_display * display = to_intel_display (crtc_state );
1908
1932
1909
1933
intel_color_load_luts (crtc_state );
1910
- intel_color_commit_noarm (crtc_state );
1911
- intel_color_commit_arm (crtc_state );
1934
+ intel_color_commit_noarm (NULL , crtc_state );
1935
+ intel_color_commit_arm (NULL , crtc_state );
1912
1936
1913
1937
if (DISPLAY_VER (display ) < 9 ) {
1914
1938
struct intel_crtc * crtc = to_intel_crtc (crtc_state -> uapi .crtc );
0 commit comments