[HTC 10 ROMs, Kernels, Recoveries, & Other Developm] dRm42:
Further on the thermal issue:

I assume this is the conf file that [MENTION=4453138]fagyi[/MENTION] was referring to,: https://android.googlesource.com/device/google/marlin/+/android-9.0.0_r21/thermal-engine-marlin.conf

It is indeed the same as our default config file.

Thresholds in the above conf file are all in Celsius: 60000 is 60 degrees, 59000 is 59 degrees, etc. Most of these are compared with values reported by a sensor called "emmc_therm". The absolute maximum value in this config file is 60 degrees and yet my phone went up to 80-85 after a couple of shots with HDR+, so it was clear that these settings were ignored for some reason. By looking at logcat, I've also found that ThermalEngine was only adjusting Cluster 1's clock speed and did so only by a little. This was probably due to some other monitoring settings, but it clearly did not throttle the CPU as it was defined in the config file.

By looking at the list of temp sensors in EX Kernel Manager, emmc_therm wasn't even listed, so it must have been:

a, emmc_therm sensor doesn't exist in the HTC 10

b, emmc_therm sensor is present, but it's not working/queried/handled correctly in LineageOS (not saying it's [MENTION=4453138]fagyi[/MENTION]'s fault, can be an inherent thing that comes from LOS source)

c, EX Kernel Manager is wrong :)

After some research, I have found the CPU sensor numbering in thermal.c of the Pixel XL's Android Nougat code: https://android.googlesource.com/device/google/marlin/+/nougat-dr1-release/thermal/thermal.c

Since the Pixel XL is based on SD821, which is almost identical in design to the SD820, it is safe to assume that this numbering scheme is the same for the HTC 10: const int CPU_SENSORS[] = {4, 6, 9, 11};. The numbers are referring to tsens_tz_sensor4, tsens_tz_sensor6, tsens_tz_sensor9 and tsens_tz_sensor11 respectively, which perfectly aligns with my own test results. That is, sensors 4, 6, 9, and 11 were always by far the 4 hottest sensors when the CPU was overloaded (see first screenshot).

The last missing bit was to understand what the actual "ss" alghorithm does and if it can be used with other sensors. I have found a thermal debugging guide on Qualcomm's Developer site for the SD410. Some parts of the document are obviously irrelevant to us, but it does explain well what each thermal alghorithms do and how they can be utilised. If you are interested, it's available here: https://developer.qualcomm.com/download/db410c/thermal-debugging-guide-dragonboard-410c.pdf

So weaponizing all this newly aquired knowledge, I have remounted the /system partition as RW and edited /vendor/etc/thermal-engine.conf to monitor tsens_tz_sensor9 instead of emmc_therm in all cases. And voila, the phone's never got uncomfortably hot again. Temperature is correctly maintained and is always in the range that is defined in the config file (see second screenshot made under the same conditions).

The easiest way to check is to use something that shows thermal sensor values (like EX Kernel Manager) and make a lot of photos with a Google Camera port with HDR+. That will make your CPU sweat. While the "HDR+ image processing" notification is on, check your sensor temperatures and you'll see it's close to 80 for the above sensors. Make the above changes, redo the test and they will be around 50-55. The phone's gonna be comfortable to hold., no matter what you're doing.

If someone could confirm my results using the attached conf file (need to remove the .txt extension first) just so we can see that we are on the right path, I could probably tweak this further. We could probably have more frequent polling, less throttling and perhaps we could also raise trigger temperature by a very little. Now that I have Qualcomm's documentation at hand, I could probably do this per cluster as well, so we don't throttle the big cluster as much as the small cluster.

Please only test this if you know what you are doing. I take no responsibilities.

View attachment thermal-engine-perfume.conf.txt