@@ -606,79 +606,85 @@ static void a6xx_set_cp_protect(struct msm_gpu *gpu)
606
606
607
607
static int a6xx_calc_ubwc_config (struct adreno_gpu * gpu )
608
608
{
609
+ const struct qcom_ubwc_cfg_data * common_cfg ;
610
+ struct qcom_ubwc_cfg_data * cfg = & gpu -> _ubwc_config ;
611
+
609
612
/* Inherit the common config and make some necessary fixups */
610
- gpu -> common_ubwc_cfg = qcom_ubwc_config_get_data ();
611
- if (IS_ERR (gpu -> common_ubwc_cfg ))
612
- return PTR_ERR (gpu -> common_ubwc_cfg );
613
+ common_cfg = qcom_ubwc_config_get_data ();
614
+ if (IS_ERR (common_cfg ))
615
+ return PTR_ERR (common_cfg );
616
+
617
+ /* Copy the data into the internal struct to drop the const qualifier (temporarily) */
618
+ * cfg = * common_cfg ;
613
619
614
- gpu -> ubwc_config .ubwc_swizzle = 0x6 ;
615
- gpu -> ubwc_config .macrotile_mode = 0 ;
616
- gpu -> ubwc_config .highest_bank_bit = 15 ;
620
+ cfg -> ubwc_swizzle = 0x6 ;
621
+ cfg -> highest_bank_bit = 15 ;
617
622
618
623
if (adreno_is_a610 (gpu )) {
619
- gpu -> ubwc_config . highest_bank_bit = 13 ;
620
- gpu -> ubwc_config . ubwc_swizzle = 0x7 ;
624
+ cfg -> highest_bank_bit = 13 ;
625
+ cfg -> ubwc_swizzle = 0x7 ;
621
626
}
622
627
623
628
if (adreno_is_a618 (gpu ))
624
- gpu -> ubwc_config . highest_bank_bit = 14 ;
629
+ cfg -> highest_bank_bit = 14 ;
625
630
626
631
if (adreno_is_a619 (gpu ))
627
632
/* TODO: Should be 14 but causes corruption at e.g. 1920x1200 on DP */
628
- gpu -> ubwc_config . highest_bank_bit = 13 ;
633
+ cfg -> highest_bank_bit = 13 ;
629
634
630
635
if (adreno_is_a619_holi (gpu ))
631
- gpu -> ubwc_config . highest_bank_bit = 13 ;
636
+ cfg -> highest_bank_bit = 13 ;
632
637
633
638
if (adreno_is_a621 (gpu ))
634
- gpu -> ubwc_config .highest_bank_bit = 13 ;
635
-
636
- if (adreno_is_a623 (gpu )) {
637
- gpu -> ubwc_config .highest_bank_bit = 16 ;
638
- gpu -> ubwc_config .macrotile_mode = 1 ;
639
- }
639
+ cfg -> highest_bank_bit = 13 ;
640
640
641
- if (adreno_is_a680 (gpu ))
642
- gpu -> ubwc_config . macrotile_mode = 1 ;
641
+ if (adreno_is_a623 (gpu ))
642
+ cfg -> highest_bank_bit = 16 ;
643
643
644
644
if (adreno_is_a650 (gpu ) ||
645
645
adreno_is_a660 (gpu ) ||
646
646
adreno_is_a690 (gpu ) ||
647
647
adreno_is_a730 (gpu ) ||
648
648
adreno_is_a740_family (gpu )) {
649
- /* TODO: get ddr type from bootloader and use 2 for LPDDR4 */
650
- gpu -> ubwc_config .highest_bank_bit = 16 ;
651
- gpu -> ubwc_config .macrotile_mode = 1 ;
649
+ /* TODO: get ddr type from bootloader and use 15 for LPDDR4 */
650
+ cfg -> highest_bank_bit = 16 ;
652
651
}
653
652
654
653
if (adreno_is_a663 (gpu )) {
655
- gpu -> ubwc_config .highest_bank_bit = 13 ;
656
- gpu -> ubwc_config .macrotile_mode = 1 ;
657
- gpu -> ubwc_config .ubwc_swizzle = 0x4 ;
654
+ cfg -> highest_bank_bit = 13 ;
655
+ cfg -> ubwc_swizzle = 0x4 ;
658
656
}
659
657
660
- if (adreno_is_7c3 (gpu )) {
661
- gpu -> ubwc_config .highest_bank_bit = 14 ;
662
- gpu -> ubwc_config .macrotile_mode = 1 ;
663
- }
658
+ if (adreno_is_7c3 (gpu ))
659
+ cfg -> highest_bank_bit = 14 ;
664
660
665
661
if (adreno_is_a702 (gpu ))
666
- gpu -> ubwc_config .highest_bank_bit = 14 ;
662
+ cfg -> highest_bank_bit = 14 ;
663
+
664
+ if (cfg -> highest_bank_bit != common_cfg -> highest_bank_bit )
665
+ DRM_WARN_ONCE ("Inconclusive highest_bank_bit value: %u (GPU) vs %u (UBWC_CFG)\n" ,
666
+ cfg -> highest_bank_bit , common_cfg -> highest_bank_bit );
667
+
668
+ if (cfg -> ubwc_swizzle != common_cfg -> ubwc_swizzle )
669
+ DRM_WARN_ONCE ("Inconclusive ubwc_swizzle value: %u (GPU) vs %u (UBWC_CFG)\n" ,
670
+ cfg -> ubwc_swizzle , common_cfg -> ubwc_swizzle );
671
+
672
+ gpu -> ubwc_config = & gpu -> _ubwc_config ;
667
673
668
674
return 0 ;
669
675
}
670
676
671
677
static void a6xx_set_ubwc_config (struct msm_gpu * gpu )
672
678
{
673
679
struct adreno_gpu * adreno_gpu = to_adreno_gpu (gpu );
674
- const struct qcom_ubwc_cfg_data * cfg = adreno_gpu -> common_ubwc_cfg ;
680
+ const struct qcom_ubwc_cfg_data * cfg = adreno_gpu -> ubwc_config ;
675
681
/*
676
682
* We subtract 13 from the highest bank bit (13 is the minimum value
677
683
* allowed by hw) and write the lowest two bits of the remaining value
678
684
* as hbb_lo and the one above it as hbb_hi to the hardware.
679
685
*/
680
- BUG_ON (adreno_gpu -> ubwc_config . highest_bank_bit < 13 );
681
- u32 hbb = adreno_gpu -> ubwc_config . highest_bank_bit - 13 ;
686
+ BUG_ON (cfg -> highest_bank_bit < 13 );
687
+ u32 hbb = cfg -> highest_bank_bit - 13 ;
682
688
bool rgb565_predicator = cfg -> ubwc_enc_version >= UBWC_4_0 ;
683
689
u32 level2_swizzling_dis = !(cfg -> ubwc_swizzle & UBWC_SWIZZLE_ENABLE_LVL2 );
684
690
bool ubwc_mode = qcom_ubwc_get_ubwc_mode (cfg );
@@ -720,7 +726,7 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
720
726
min_acc_len_64b << 23 | hbb_lo << 21 );
721
727
722
728
gpu_write (gpu , REG_A6XX_RBBM_NC_MODE_CNTL ,
723
- adreno_gpu -> ubwc_config . macrotile_mode );
729
+ cfg -> macrotile_mode );
724
730
}
725
731
726
732
static void a7xx_patch_pwrup_reglist (struct msm_gpu * gpu )
0 commit comments