Commit Graph

109 Commits

Author SHA1 Message Date
mikairyuu
b2b74a3f0d Inline the kernel 2022-11-13 14:13:34 +10:00
Danny Lin
0e4c247c72 Suppress overly verbose log spam
It's hard to see anything that's actually useful with so much verbose
spam in the log buffer.

Signed-off-by: Danny Lin <danny@kdrag0n.dev>
2022-11-12 11:24:53 +00:00
Park Ju Hyung
33ce619f2f techpack: display: add some bp hints to hot paths
Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
[@0ctobot: Adapted for 4.19]
Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
2022-11-12 11:24:41 +00:00
Park Ju Hyung
aeef1bc25e drm/msm: use kmem_cache pool for struct vblank_work
These get allocated and freed millions of times on this kernel tree.

Use a dedicated kmem_cache pool and avoid costly dynamic memory allocations.

Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
2022-11-12 11:24:41 +00:00
Park Ju Hyung
737ee0e2bf techpack: camera: use kmem_cache pool for struct sync_user_payload
These get allocated and freed millions of times on this kernel tree.

Use a dedicated kmem_cache pool and avoid costly dynamic memory allocations.

Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
[@0ctobot: Adapted for 4.19]
Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
2022-11-12 11:24:39 +00:00
Sultan Alsawaf
7efe3414b7 qos: Change cpus_affine to not be atomic
There isn't a need for cpus_affine to be atomic, and reading/writing to
it outside of the global pm_qos lock is racy anyway. As such, we can
simply turn it into a primitive integer type.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
2022-11-12 11:24:19 +00:00
Sultan Alsawaf
da748e58a9 drm/msm/sde: Don't clear dim layers when there aren't any applied
Clearing dim layers indiscriminately for each blend stage on each commit
wastes a lot of CPU time since the clearing process is heavy on register
accesses. We can optimize this by only clearing dim layers when they're
actually set, and only clearing them on a per-stage basis at that. This
reduces display commit latency considerably.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
2022-11-12 11:24:16 +00:00
Sultan Alsawaf
85bc91328d drm/msm/sde: Don't read and clear VBIF errors upon commit
Reading and clearing any errors from the VBIF error registers takes a
significant amount of time during kickoff, and is only used to produce
debug logs when errors are detected. Since we're not debugging hardware
issues in MDSS, remove the VBIF error clearing entirely to reduce
display rendering latency.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
2022-11-12 11:24:14 +00:00
Sultan Alsawaf
952dfb1b3f drm/msm/sde: Remove redundant write memory barriers from IRQ routines
Explicit write memory barriers are unneeded here since releasing a lock
already implies a full memory barrier.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
2022-11-12 11:24:14 +00:00
Sultan Alsawaf
07276d430e drm/msm/sde: Consolidate IRQ status reads into IRQ dispatcher
The IRQ status reads are decoupled from the IRQ dispatcher, even though
the dispatcher is the only one using the IRQ statuses. This results in a
lot of redundant work being done as the IRQ status reader also reads the
IRQ-enable register and clears the IRQ mask, both of which are already
handled by the IRQ dispatcher. We can cut out the redundant work done in
the hardware IRQ handler by consolidating the IRQ status reads into the
IRQ dispatcher.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
2022-11-12 11:24:14 +00:00
Sultan Alsawaf
eb696e16c7 drm/msm/sde: Skip heavy autorefresh checks when it's not enabled
These heavy checks for seeing if autorefresh is enabled are unneeded
when the autorefresh config is disabled. These checks are performed on
every display commit and show up as using a significant amount of CPU
time in perf top. Skip them when it's unnecessary in order to improve
display rendering performance.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
2022-11-12 11:24:14 +00:00
Sultan Alsawaf
ee675ad54d drm/msm/sde: Don't allocate memory dynamically for CRTC atomic check
Every atomic frame commit allocates memory dynamically to check the
states of the CRTCs, when those allocations can just be stored on the
stack instead. Eliminate these dynamic memory allocations in the frame
commit path to improve performance. They don't need need to be zeroed
out either.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Diab Neiroukh <lazerl0rd@thezest.dev>
2022-11-12 11:24:13 +00:00
Danny Lin
98adc65124 drm/msm/sde: Cache register values when performing clock control
Remote register I/O amounts to a measurably significant portion of CPU
time due to how frequently this function is used. Cache the value of
each register on-demand and use this value in future invocations to
mitigate the expensive I/O.

Co-authored-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Danny Lin <danny@kdrag0n.dev>
[@0ctobot: Adapted for msm-4.19]
Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
2022-11-12 11:24:12 +00:00
Sultan Alsawaf
aafe02c4d8 drm/msm/sde: Don't allocate memory dynamically for plane states
The plane states allocation and free show up on perf top as taking up a
non-trivial amount of time on every commit. Since the allocation is
small, just place it on the stack to eliminate the dynamic allocation
overhead completely.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Diab Neiroukh <lazerl0rd@thezest.dev>
2022-11-12 11:24:12 +00:00
Sultan Alsawaf
238880552e drm/msm/sde: Skip unneeded register reads when getting write line count
More often than not, get_vsync_info() is used to only get the write line
count, while the other values it returns are left unused. This is not
optimal since it is done on every display commit. We can eliminate the
superfluous register reads by adding a parameter specifying if only the
write line count is requested.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Diab Neiroukh <lazerl0rd@thezest.dev>
2022-11-12 11:24:12 +00:00
Sultan Alsawaf
2fb480b5de drm/msm: Offload commit cleanup onto little CPUs
The cleanup portion of non-blocking commits can be offloaded to little
CPUs to reduce latency in the display commit path, since it takes up a
non-trivial amount of CPU time. This reduces display commit latency.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
[lazerl0rd: Adjust for Linux 4.19, with different commit cleanup.]
Signed-off-by: Diab Neiroukh <lazerl0rd@thezest.dev>
2022-11-12 11:24:11 +00:00
Sultan Alsawaf
78d0f9faf4 drm/msm: Speed up interrupt processing upon commit
Since we know an interrupt will be arriving soon when a frame is
committed, we can anticipate it and prevent the CPU servicing that
interrupt from entering deep idle states. This reduces display rendering
latency.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Diab Neiroukh <lazerl0rd@thezest.dev>
2022-11-12 11:24:11 +00:00
Sultan Alsawaf
df7fe36f50 disp: msm: Remove debug print from sde_reg_write()
This unused debug print wastes CPU time when writing to registers,
resulting in perf top reporting a decent chunk of time spent inside
sde_reg_write(). Removing the debug print gets sde_reg_write() off perf
top's radar.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
2022-11-12 11:24:09 +00:00
Sultan Alsawaf
008fd45714 msm: camera: Stub out the camera_debug_util API and compile it out
A measurably significant amount of CPU time is spent in these routines
while the camera is open. These are also responsible for a grotesque
amount of dmesg spam, so let's nuke them.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
2022-11-12 11:24:04 +00:00
Sultan Alsawaf
92924c9df1 disp: msm: Use the PM_QOS_REQ_AFFINE_IRQ feature to control SDE PM QoS
Instead of registering a custom IRQ notifier, we should just use the PM
QoS framework's PM_QOS_REQ_AFFINE_IRQ feature.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
2022-11-12 11:24:04 +00:00
Sultan Alsawaf
614ff8afe7 disp: msm: Remove unneeded PM QoS requests
These are blocking some CPUs in the LITTLE cluster from entering deep
idle because the driver assumes that display rendering work occurs on a
hardcoded set of CPUs, which is false. We already have the IRQ PM QoS
machinery, so this cruft is unneeded.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
2022-11-12 11:24:04 +00:00
Sultan Alsawaf
b6bbd4193e qos: Replace expensive cpumask usage with raw bitwise operations
cpumask_set_cpu() uses the set_bit() helper, which, in typical kernels
prior to 4.19, uses a spin lock to guarantee atomicity. This is
expensive and unneeded, especially since the qos functions are hot code
paths. The rest of the cpumask functions use the bitmap API, which is
also more expensive than just doing some simple operations on a word.

Since we're operating with a CPU count that can fit within a word,
replace the expensive cpumask operations with raw bitwise operations
wherever possible to make the pm_qos framework more efficient.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
2022-11-12 11:24:02 +00:00
Sultan Alsawaf
c01b5c4adb disp: msm: Affine important kthreads to the prime CPU cluster
These kthreads (particularly crtc_event and crtc_commit) play a major
role in rendering frames to the display, so affine them to the prime CPU
cluster, matching the DRM IRQ.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
2022-11-12 11:23:56 +00:00
Juhyung Park
2bb013bd39 mm: compaction: allow using different proactiveness value depending on the screen state
Signed-off-by: Juhyung Park <qkrwngud825@gmail.com>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
Change-Id: I94d15bd4da794d134a10095c4f432f6d77c8f32e
2022-11-12 11:22:27 +00:00
spakkkk
586d4f5545 techpack: audio: promote send_tfa_cal_apr out of DEBUG_FS
To disable debugfs
2022-11-12 11:19:57 +00:00
UtsavBalar1231
2338b91a59 techpack: audio: Remove DEBUG definations
find techpack/audio -type f -exec sed -i -e '/define DEBUG/d' $(git grep -l DEBUG | tr '\n' ' ') {} \;

Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
Change-Id: I2dfe2ebbc223cb38ede08facc1bb6316c1421272
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:19:57 +00:00
spakkkk
c216439fa5 techpack: video: remove log spam 2022-11-12 11:19:55 +00:00
spakkkk
b8aba0da16 techpack: audio: disable log spam 2022-11-12 11:19:55 +00:00
spakkkk
0b858bf25e techpack: display: disable log spam 2022-11-12 11:19:54 +00:00
Yashwanth
0823222013 disp: msm: sde: add vblank mutex lock during irq unregister
Currently, during ctl reset in video mode, irq register or
unregister might result in race condition with vblank
enable/disable calls on event thread resulting in enable
cnt mismatch. This change adds mutex locks to avoid race
conditions in such cases.

Change-Id: I45aef19864475ac1b02dd8e84810eee233fc60ea
Signed-off-by: Yashwanth <yvulapu@codeaurora.org>
Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:19:50 +00:00
Mahadevan
cb223c487d disp: msm: sde: add check to fix null pointer dereference
In pstate_cmp the plane_state structures are accessed
without checking it is allocated or not, which leads to
null pointer dereference. To fix it NULL check is added.

Change-Id: I5982138b396b70979205d87bc9aa260d9501fee0
Signed-off-by: Mahadevan <mahap@codeaurora.org>
Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:19:50 +00:00
Jayaprakash
ca24a04be8 disp: msm: sde: fix null dereference in drm_atomic_get_property
Add changes to fix the null dereference in
drm_atomic_get_property caused by connector->state
being NULL. This change allows the drm_mode_config_reset
operation to happen before drm_dev_register to avoid this.
In current scenario, connector->state->crtc is being
accessed due to call to drm_mode_getconnector ioctl with
the drm_mode_config_reset operation pending.

Change-Id: I374d9485819fad85100d1837f4ae22fc2a3ccc40
Signed-off-by: Jayaprakash <jmadiset@codeaurora.org>
Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:19:50 +00:00
UtsavBalar1231
644d3825bd disp: pll: Disable PLL Spread Spectrum Clocking for 7nm CPHY
Change-Id: I09f37185ee61dcc8d6afb3b38adc9ef1191321f1
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:19:50 +00:00
UtsavBalar1231
a2e9d692e8 disp: msm: Implement custom ESD IRQ handling
Change-Id: Ic1b928f941b7c573714e24aeb9e62cde0d6f2b13
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:19:50 +00:00
Amine Najahi
bca6c98700 disp: msm: fix kasan out of bound in dsi reception
Fix out of bound access that occurs when reading dsi
commands with custom non 4 bytes aligned payload.
When misaligned, the code is overfetching data due
to 32 bits reading constraint. This creates an offset
in receiving buffer. Using a local copy buffer large
enough to hold the extra bytes fixes the issue.

Bug: 139655049
Change-Id: Ia0ee791d2e87639edd58191cfd5cb6f8f825f8c8
Signed-off-by: Amine Najahi <anajahi@codeaurora.org>
(cherry picked from 8f44ae7ca74a5faf6d7caaac48899192301f250d)
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:19:49 +00:00
Ping Li
25838aad41 disp: msm: sde: fix potential race condition
Move the hist irq handling out of callback function, i.e., the hw
interrupt irq_lock context, to avoid dead lock between crtc spin_lock
and irq_lock. This change also extends crtc spin_lock coverage in
_sde_cp_crtc_enable_hist_irq to prevent null pointer dereference on
event node, which can be deleted during crtc event de-registration.

Change-Id: Iadaed54ab93c4c4abe065a8762d2addccb0c65c6
Signed-off-by: Ping Li <pingli@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:19:49 +00:00
Demon000
b87a34af2c techpack: display: Implement doze mode 2022-11-12 11:19:49 +00:00
yarpiin
f470e80bdf techpack: display: remove stock doze implementation 2022-11-12 11:19:49 +00:00
EcrosoftXiao
6207c41cc9 techpack: display: Temporary disable dimlayer exposure while in HBM 2022-11-12 11:19:49 +00:00
EcrosoftXiao
da82ae5c24 techpack: display: Make dimlayer exposure switchable
Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx>
2022-11-12 11:19:48 +00:00
EcrosoftXiao
ea4666c703 techpack: display: Adapt dimlayer exposure alpha model for sm7250
Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx>
2022-11-12 11:19:48 +00:00
Carlos Ayrton Lopez Arroyo
c827832977 techpack: display: enable CONFIG_DRM_SDE_EXPO
Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx>
2022-11-12 11:19:48 +00:00
DevriesL
a73e986502 techpack: display: Introduce new exposure dim layer driver
This driver provides exposure adjustment function by Qcom SDE dim
layer without change panel hardware brightness to avoid PWM flicker
on OLED devices. Thanks to OnePlus' opensource code for inspiring
me to use dim layer.

Use expo_calc_backlight to remap brightness with hardware and SDE,
checking Disable Hardware Overlays in developer options if you face
blocks with differents brightness issue.

[Ayrton: Backported from lahaina to SMxx50.0 SDE Driver for compatibility]

Signed-off-by: DevriesL <therkduan@gmail.com>
Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx>
2022-11-12 11:19:48 +00:00
Adrian Salido
b26fd3f0db techpack: display: drm/msm: add idle state sysfs node
Add a sysfs mechanism to track the idle state of display subsystem.
This allows user space to poll on the idle state node to detect when
display goes idle for longer than the time set.

Bug: 139655049
Bug: 126304228
Change-Id: I21e3c7b0830a9695db9f65526c111ce5153d1764
Signed-off-by: Adrian Salido <salidoa@google.com>
Signed-off-by: Robb Glasser <rglasser@google.com>
(cherry picked from commit 11a2193b434cb3130743fbff89a161062883132e)
Signed-off-by: Ken Huang <kenbshuang@google.com>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:19:48 +00:00
Cosmin Tanislav
187ffd126f techpack: display: msm: further increase delay times while waiting to turn off rscc clocks 2022-11-12 11:19:47 +00:00
Pig
405d668172 uapi: sde_drm: Define FOD_PRESSED_LAYER_ZORDER
Change-Id: I5b25d19fab3a2901948d639c785165e70786f4ab
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:19:46 +00:00
Demon000
a0671a4f76 techpack: display: msm: notify sysfs for fod ui changes
Change-Id: I5559a9cfe00af58847e089764452a24c39830e20
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:19:46 +00:00
Demon000
005cf4305a techpack: display: msm: implement fod handling
Change-Id: Id29333eb3b5282b25c52ff14492622bd12e1ee79
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:19:46 +00:00
Demon000
9f7815acfe techpack: display: msm: dsi: add dsi_panel_get_backlight
Change-Id: Ifab7f9b0a7fbe5846c24c611a16cfcb7f29684dc
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:19:46 +00:00
DevriesL
98ba22686e techpack: display: msm: dsi: add get_main_display
Change-Id: Id670875adc18659521c424a716cf0ef194f9627f
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2022-11-12 11:19:46 +00:00