samsungexynos7420 / android_device_samsung_universal7420-common

Universal7420 devices. Based off the Exynos7420 organization source with improvements
0 stars 2 forks source link

UI lags with HWC enabled #1

Closed fakemanoan closed 5 months ago

fakemanoan commented 8 months ago

After using the device normally for a while, the UI will begin to chug and lag noticeably, almost to the point where its unusable.

Disabling the hardware overlays fixes the problem, however this is not practical as this reduces performance overall, and decreases battery life.

Reserving a small amount of memory with the /proc/syc/vm/min_free_kbytes setting alleviates the issue somewhat, but it is still noticeable

Another thing that seems to remedy the issue is initiating a scrcpy via ADB. Something about that process smooths out (not perfectly, but close) the UI to the point where its a non-issue. This could be related to PM needs QOS, the specific clocks that are requested or another kernel issue.

fakemanoan commented 8 months ago

I have attempted some fixes in this area

1) I have manually changed the decon qos to request 550MHz from INT clocks 2) whenever decon is preparing a frame, increase memory frequency to ~1100mhz 3) actually define a memory qos in the decon driver 4) stop parts of the gpu sleeping so soon

and (for now) the issue seems to be better. edit: ehh kinda better kinda not. still shooting in the dark

fakemanoan commented 8 months ago

also to note, this is with the dirty memory hack still in place that seemed to help for whatever reason. changing 1 variable at a time to see what is causing/not causing the problem.

fakemanoan commented 7 months ago

Using HWCSevices and HDMI instead of dummyhdmi, the issue is better, but still not perfect.

It could be possible that a clock is running low when it should be high.

fakemanoan commented 7 months ago
cat /sys/kernel/debug/pm_qos with no scrcpy ``` cpu_dma_latency default value: 2000000000 target value: 2000000000 requests: network_latency default value: 2000000000 target value: 2000000000 requests: memory_throughput default value: 0 target value: 0 requests: device_throughput default value: 0 target value: 1026000 requests: 0000000000000000(lpass_probe:1139): 0 0000000000000000(sc_probe:3349): 0 0000000000000000(fimg2d_pm_qos_add_bus:170): 0 0000000000000000(esa_probe:2358): 0 0000000000000000(vpp_probe:1289): 0 0000000000000000(exynos7_devfreq_int_qos_init:416): 0 0000000000000000(secos_booster_init:336): 0 0000000000000000(vpp_probe:1289): 0 0000000000000000(vpp_probe:1289): 0 0000000000000000(sc_probe:3349): 0 0000000000000000(vpp_probe:1289): 0 0000000000000000(decon_probe:6295): 96923 0000000000000000(exynos7_devfreq_int_qos_init:418): 100000 0000000000000000(exynos7_devfreq_int_qos_init:419): 100000 0000000000000000(exynos7_init_bts_ioremap:1704): 193846 0000000000000000(decon_probe:6297): 1026000 bus_throughput default value: 0 target value: 1026000 requests: 0000000000000000(lpass_probe:1138): 0 0000000000000000(fimg2d_pm_qos_add_bus:168): 0 0000000000000000(esa_probe:2357): 0 0000000000000000(vpp_probe:1291): 0 0000000000000000(vpp_probe:1291): 0 0000000000000000(vpp_probe:1291): 0 0000000000000000(exynos7_devfreq_mif_qos_init:532): 0 0000000000000000(vpp_probe:1291): 0 0000000000000000(exynos7_init_bts_ioremap:1703): 252000 0000000000000000(exynos7_devfreq_mif_qos_init:530): 259000 0000000000000000(exynos7_devfreq_mif_qos_init:531): 259000 0000000000000000(gpu_pm_qos_command:52): 416000 0000000000000000(exynos7_bts_init:1944): 416000 0000000000000000(exynos_cpufreq_init:2054): 416000 0000000000000000(exynos7_devfreq_int_qos_init:417): 632000 0000000000000000(exynos_cpufreq_init:2054): 1026000 bus_throughput_max default value: 2147483647 target value: 2147483647 requests: 0000000000000000(gpu_pm_qos_command:54): 2147483647 network_throughput default value: 0 target value: 0 requests: cluster1_freq_min default value: 0 target value: 0 requests: 0000000000000000(lpass_probe:1136): 0 0000000000000000(gpu_pm_qos_command:60): 0 0000000000000000(fimg2d_pm_qos_add_cpu:95): 0 0000000000000000(exynos_cpufreq_init:2019): 0 0000000000000000(exynos_cpufreq_init:2023): 0 0000000000000000(exynos_cpufreq_init:2029): 0 0000000000000000(secos_booster_init:335): 0 cluster1_freq_max default value: 2100000 target value: 2100000 requests: 0000000000000000(exynos_cpufreq_init:2021): 2100000 0000000000000000(exynos_cpufreq_init:2025): 2100000 0000000000000000(exynos_cpufreq_init:2040): 2100000 0000000000000000(gpu_pm_qos_command:58): 2100000 cluster0_freq_min default value: 0 target value: 1296000 requests: 0000000000000000(lpass_probe:1137): 0 0000000000000000(fimg2d_pm_qos_add_cpu:96): 0 0000000000000000(exynos_cpufreq_init:2019): 0 0000000000000000(exynos_cpufreq_init:2023): 0 0000000000000000(exynos_cpufreq_init:2029): 0 0000000000000000(gpu_pm_qos_command:57): 0 0000000000000000(input_booster_idle_state:460): 1296000 cluster0_freq_max default value: 1500000 target value: 1500000 requests: 0000000000000000(exynos_cpufreq_init:2021): 1500000 0000000000000000(exynos_cpufreq_init:2025): 1500000 0000000000000000(exynos_cpufreq_init:2040): 1500000 display_throughput default value: 0 target value: 167000 requests: 0000000000000000(exynos7_devfreq_disp_qos_init:294): 0 0000000000000000(exynos7_devfreq_disp_qos_init:295): 100000 0000000000000000(exynos7_devfreq_disp_qos_init:296): 100000 0000000000000000(decon_probe:6299): 167000 cam_throughput default value: 0 target value: 500000 requests: 0000000000000000(exynos7_devfreq_isp_qos_init:300): 500000 0000000000000000(exynos7_devfreq_isp_qos_init:301): 500000 0000000000000000(exynos7_devfreq_isp_qos_init:302): 500000 ```
cat /sys/kernel/debug/pm_qos with scrcpy ``` cpu_dma_latency default value: 2000000000 target value: 2000000000 requests: network_latency default value: 2000000000 target value: 2000000000 requests: memory_throughput default value: 0 target value: 0 requests: device_throughput default value: 0 target value: 1026000 requests: 0000000000000000(lpass_probe:1139): 0 0000000000000000(sc_probe:3349): 0 0000000000000000(fimg2d_pm_qos_add_bus:170): 0 0000000000000000(esa_probe:2358): 0 0000000000000000(vpp_probe:1289): 0 0000000000000000(exynos7_devfreq_int_qos_init:416): 0 0000000000000000(secos_booster_init:336): 0 0000000000000000(vpp_probe:1289): 0 0000000000000000(vpp_probe:1289): 0 0000000000000000(sc_probe:3349): 0 0000000000000000(vpp_probe:1289): 0 0000000000000000(decon_probe:6295): 96923 0000000000000000(exynos7_devfreq_int_qos_init:418): 100000 0000000000000000(exynos7_devfreq_int_qos_init:419): 100000 0000000000000000(exynos7_init_bts_ioremap:1704): 193846 0000000000000000(mfc_qos_operate:65): 550000 0000000000000000(decon_probe:6297): 1026000 bus_throughput default value: 0 target value: 1026000 requests: 0000000000000000(lpass_probe:1138): 0 0000000000000000(fimg2d_pm_qos_add_bus:168): 0 0000000000000000(esa_probe:2357): 0 0000000000000000(vpp_probe:1291): 0 0000000000000000(vpp_probe:1291): 0 0000000000000000(vpp_probe:1291): 0 0000000000000000(exynos7_devfreq_mif_qos_init:532): 0 0000000000000000(vpp_probe:1291): 0 0000000000000000(exynos7_init_bts_ioremap:1703): 252000 0000000000000000(exynos7_devfreq_mif_qos_init:530): 259000 0000000000000000(exynos7_devfreq_mif_qos_init:531): 259000 0000000000000000(gpu_pm_qos_command:52): 416000 0000000000000000(exynos7_bts_init:1944): 416000 0000000000000000(exynos_cpufreq_init:2054): 543000 0000000000000000(exynos7_devfreq_int_qos_init:417): 632000 0000000000000000(exynos_cpufreq_init:2054): 1026000 0000000000000000(mfc_qos_operate:74): 1026000 bus_throughput_max default value: 2147483647 target value: 2147483647 requests: 0000000000000000(gpu_pm_qos_command:54): 2147483647 network_throughput default value: 0 target value: 0 requests: cluster1_freq_min default value: 0 target value: 0 requests: 0000000000000000(lpass_probe:1136): 0 0000000000000000(gpu_pm_qos_command:60): 0 0000000000000000(fimg2d_pm_qos_add_cpu:95): 0 0000000000000000(exynos_cpufreq_init:2019): 0 0000000000000000(exynos_cpufreq_init:2023): 0 0000000000000000(exynos_cpufreq_init:2029): 0 0000000000000000(secos_booster_init:335): 0 0000000000000000(mfc_qos_operate:84): 0 cluster1_freq_max default value: 2100000 target value: 2100000 requests: 0000000000000000(exynos_cpufreq_init:2021): 2100000 0000000000000000(exynos_cpufreq_init:2025): 2100000 0000000000000000(exynos_cpufreq_init:2040): 2100000 0000000000000000(gpu_pm_qos_command:58): 2100000 cluster0_freq_min default value: 0 target value: 1296000 requests: 0000000000000000(lpass_probe:1137): 0 0000000000000000(fimg2d_pm_qos_add_cpu:96): 0 0000000000000000(exynos_cpufreq_init:2019): 0 0000000000000000(exynos_cpufreq_init:2023): 0 0000000000000000(exynos_cpufreq_init:2029): 0 0000000000000000(gpu_pm_qos_command:57): 0 0000000000000000(mfc_qos_operate:87): 0 0000000000000000(input_booster_idle_state:460): 1296000 cluster0_freq_max default value: 1500000 target value: 1500000 requests: 0000000000000000(exynos_cpufreq_init:2021): 1500000 0000000000000000(exynos_cpufreq_init:2025): 1500000 0000000000000000(exynos_cpufreq_init:2040): 1500000 display_throughput default value: 0 target value: 167000 requests: 0000000000000000(exynos7_devfreq_disp_qos_init:294): 0 0000000000000000(exynos7_devfreq_disp_qos_init:295): 100000 0000000000000000(exynos7_devfreq_disp_qos_init:296): 100000 0000000000000000(decon_probe:6299): 167000 cam_throughput default value: 0 target value: 500000 requests: 0000000000000000(exynos7_devfreq_isp_qos_init:300): 500000 0000000000000000(exynos7_devfreq_isp_qos_init:301): 500000 0000000000000000(exynos7_devfreq_isp_qos_init:302): 500000 ```

Seems like there is some qos in device_throughput and bus_throughput (and some in cluster0 min and max freq) Trying without mfc qos.

If this qos does influence stuff, then in the decon driver look to do what MFC does

fakemanoan commented 7 months ago

removing the qos entries has no effect, the performance is still better with MFC enabled doing a scrcpy.

weird. still looking at stuff

fakemanoan commented 7 months ago
cat /sys/kernel/debug/bts_dbg/qos_status scrcpy NOT on ``` bts[0] usbdrd30 : axi: usbdrd30 control disable, scen:bts_disable bts[1] modemx : axi: modemx on, priority ch_r:0x4444,ch_w:0x4444, scen:bts_default bts[2] sdcardx : axi: sdcardx control disable, scen:bts_disable bts[3] wifi1 : axi: wifi1 on, priority ch_r:0x4444,ch_w:0x4444, scen:bts_default bts[4] embedded : axi: embedded control disable, scen:bts_disable bts[5] m2m1 : bts: m2m1 off bts[6] m2m0 : bts: m2m0 off bts[7] jpeg0 : bts: jpeg0 off bts[8] g2d : bts: g2d off bts[9] g3d0 : bts: g3d0 off bts[10] g3d1 : bts: g3d1 off bts[11] slimsss : axi: slimsss control disable, scen:bts_disable bts[12] sss : axi: sss control disable, scen:bts_disable bts[13] smdma : axi: smdma control disable, scen:bts_disable bts[14] mcomp : axi: mcomp control disable, scen:bts_disable bts[15] apollo : axi: apollo control disable, scen:bts_disable bts[16] atlas : axi: atlas control disable, scen:bts_disable bts[17] disp_ro_0 : axi: disp_ro_0 on, priority ch_r:0xaaaa,ch_w:0xaaaa, scen:bts_default bts[18] disp_ro_1 : axi: disp_ro_1 on, priority ch_r:0xaaaa,ch_w:0xaaaa, scen:bts_default bts[19] disp_rw_0 : axi: disp_rw_0 on, priority ch_r:0xaaaa,ch_w:0xaaaa, scen:bts_default bts[20] disp_rw_1 : bts: disp_rw_1 off bts[21] vpp_0 : bts: vpp_0 off bts[22] vpp_1 : bts: vpp_1 off bts[23] vpp_2 : bts: vpp_2 off bts[24] vpp_3 : bts: vpp_3 off bts[25] fimc_bns_a : bts: fimc_bns_a off bts[26] fimc_bns_b : bts: fimc_bns_b off bts[27] fimc_bns_c : bts: fimc_bns_c off bts[28] fimc_bns_d : bts: fimc_bns_d off bts[29] 3aa0 : bts: 3aa0 off bts[30] 3aa1 : bts: 3aa1 off bts[31] ispcpu : bts: ispcpu off bts[32] vra : bts: vra off bts[33] scaler : bts: scaler off bts[34] isp1 : bts: isp1 off bts[35] tpu : bts: tpu off bts[36] isp0 : bts: isp0 off bts[37] mfc_0 : bts: mfc_0 off bts[38] mfc_1 : bts: mfc_1 off ```
cat /sys/kernel/debug/bts_dbg/qos_status scrcpy active ``` bts[0] usbdrd30 : axi: usbdrd30 control disable, scen:bts_disable bts[1] modemx : axi: modemx on, priority ch_r:0x4444,ch_w:0x4444, scen:bts_default bts[2] sdcardx : axi: sdcardx control disable, scen:bts_disable bts[3] wifi1 : axi: wifi1 on, priority ch_r:0x4444,ch_w:0x4444, scen:bts_default bts[4] embedded : axi: embedded control disable, scen:bts_disable bts[5] m2m1 : bts: m2m1 off bts[6] m2m0 : bts: m2m0 off bts[7] jpeg0 : bts: jpeg0 off bts[8] g2d : bts: g2d off bts[9] g3d0 : bts: g3d0 off bts[10] g3d1 : bts: g3d1 off bts[11] slimsss : axi: slimsss control disable, scen:bts_disable bts[12] sss : axi: sss control disable, scen:bts_disable bts[13] smdma : axi: smdma control disable, scen:bts_disable bts[14] mcomp : axi: mcomp control disable, scen:bts_disable bts[15] apollo : axi: apollo control disable, scen:bts_disable bts[16] atlas : axi: atlas control disable, scen:bts_disable bts[17] disp_ro_0 : axi: disp_ro_0 on, priority ch_r:0xaaaa,ch_w:0xaaaa, scen:bts_default bts[18] disp_ro_1 : axi: disp_ro_1 on, priority ch_r:0xaaaa,ch_w:0xaaaa, scen:bts_default bts[19] disp_rw_0 : axi: disp_rw_0 on, priority ch_r:0xaaaa,ch_w:0xaaaa, scen:bts_default bts[20] disp_rw_1 : bts: disp_rw_1 off bts[21] vpp_0 : bts: vpp_0 off bts[22] vpp_1 : bts: vpp_1 off bts[23] vpp_2 : bts: vpp_2 off bts[24] vpp_3 : bts: vpp_3 off bts[25] fimc_bns_a : bts: fimc_bns_a off bts[26] fimc_bns_b : bts: fimc_bns_b off bts[27] fimc_bns_c : bts: fimc_bns_c off bts[28] fimc_bns_d : bts: fimc_bns_d off bts[29] 3aa0 : bts: 3aa0 off bts[30] 3aa1 : bts: 3aa1 off bts[31] ispcpu : bts: ispcpu off bts[32] vra : bts: vra off bts[33] scaler : bts: scaler off bts[34] isp1 : bts: isp1 off bts[35] tpu : bts: tpu off bts[36] isp0 : bts: isp0 off bts[37] mfc_0 : axi: mfc_0 control disable, scen:bts_default bts[38] mfc_1 : axi: mfc_1 control disable, scen:bts_default ```

look for exynos7420 bts stuff, try disable that see if that changes anything

fakemanoan commented 7 months ago

disabled all of mfc qos, bts and it still had no adverse effect on anything.

safe to say that it isnt pm_qos or bts related, at least directly. some clock is probably running low when it should be high

fakemanoan commented 7 months ago

All previous tests were conducted on lineage 20

Swapping to lineage 19 for the time being, as the problem is a bit worse over there at times

After merging some kernel commits from 3.14 into 3.10, specifically ARM64 (from v7 compat to v8) and a decon compat merge from 8890, the problem is much reduced. Still laggy notification pulldown in the camera app though, but gesture navigation is now somewhat usable in 19

fakemanoan commented 6 months ago

Seems like some of the issues can be attributed to a bad kernel (maybe)

HWC is now much smoother on a testing kernel by backporting some gpu stuff from 8890, but the memory hack remains for now.

fakemanoan commented 5 months ago

This issue will be addressed in the next version.

Exynos 7420 kernel sources ship with a bad ion memory allocator, which caused this issue to happen. It was not related to any power management issues (as indicated by tests earlier). Discovered via a kmemleak scan and attempting to use a different ION as the logs indicated something regarding ion allocation (blind attempt at a fix)

Copying the ION memory allocator from a 7580 device resolved the issue. This solution can be "backported" to older android 11 and earlier kernels too. We now have fully backported HWC from a stock device that is smooth. This issue is resolved and the fix will be applied in the next ASB