Commit Graph

338 Commits

Author SHA1 Message Date
Venkata Prahlad Valluru
a2ed5b2400 disp: msm: sde: fix null dereference in sde_encoder_destroy
Avoid use-after-free for phys_encs.

Change-Id: Ic44013dbe7099c3ef22338f4531fb42a55bb38ef
Signed-off-by: Venkata Prahlad Valluru <quic_vvalluru@quicinc.com>
2023-12-04 01:59:48 -08:00
Yojana Juadi
48f118202c disp: msm: sde: wait for autorefresh_status to be idle in prepare kickoff
If cont splash is enabled, wait for autorefresh_status to be idle for
1 vsync in prepare kickoff. This patch also prevents entering to
rsc_solver_mode if autorefresh_status is busy.

Change-Id: Ic4458dcbe8e06ff6f338dd264eb9371365120dd1
Signed-off-by: Yojana Juadi <quic_yjuadi@quicinc.com>
2023-09-10 11:49:16 +05:30
Yojana Juadi
2ecc30acde disp: msm: sde: add null check for pointer to drm_connector
Check for null value before dereferencing pointer to
drm_connector.

Change-Id: I38845ccab521e6e5e9ad052df57b25eba6bae9c0
Signed-off-by: Yojana Juadi <quic_yjuadi@quicinc.com>
2023-08-10 14:44:14 +05:30
qctecmdr
1ed1b82a86 Merge "disp: msm: sde: add out of bound check for interrupt id" 2023-07-26 05:56:21 -07:00
qctecmdr
185e0e7bf3 Merge "disp: msm: sde: avoid returning vsync count for cwb encoder" 2023-07-24 11:04:58 -07:00
qctecmdr
6d21952dd2 Merge "disp: msm: sde: adjust the vblank refcount until the completion of poms" 2023-07-22 20:48:21 -07:00
Akash Gajjar
4a5e3080f2 disp: msm: sde: avoid returning vsync count for cwb encoder
In CWB use case along with suspend commit, the function
drm_crtc_funcs.get_vblank_counter returns a zero vsync count
value. This causes blocking of drm_crtc_funcs.disable_vblank,
leading to a wait for vsync timeout while disabling the encoder.
hence clear a cwb encoder mask in encoder disable and set it
while performing mode set.

Change-Id: Ic994aa0a86faf48e2b25955cf6fe12166fe9d328
Signed-off-by: Akash Gajjar <quic_agajjar@quicinc.com>
2023-07-21 16:43:08 +05:30
Akash Gajjar
4cb481f5f8 disp: msm: sde: adjust the vblank refcount until the completion of poms
In POMS use case, the handling of the wait for vsync event
completion coincides with the concurrent
drm_crtc_funcs.enable_vblank. This concurrency causes a vsync
event complete timeout while disabling the encoder. to fix this
concurrency problem, increment the vblank refcount in encoder
disable and release the vblank refcount in encoder enable.

Change-Id: I79671e4a2bafdd01a6b2523a80fe511bff23d6b6
Signed-off-by: Akash Gajjar <quic_agajjar@quicinc.com>
2023-07-21 10:22:17 +05:30
Andhavarapu Karthik
cd672fbb9d disp: msm: sde: add out of bound check for interrupt id
This change adds out of bound check for interrupt id.

Change-Id: I10e786ee434629b0735c96da3c03eeac708935a1
Signed-off-by: Andhavarapu Karthik <quic_kartkart@quicinc.com>
2023-07-20 14:23:40 +05:30
Akash Gajjar
15a6e6deda disp: msm: sde: avoid returning zero vsync count in poms usecase
In POMS use case while disabling the virtual encoder, the virt
reset function sets the current master to null. concurrently, if
there is a query from the DRM client for the current vsync count,
it returns a zero value. This results in the blocking of the
drm_crtc_funcs.disable_vblank function. since the vsync count
has been relocated to the virtual encoder, remove the physical
encoder structure.

Change-Id: Ie692df657b5a86b6b8915a15e9a070642243fcfb
Signed-off-by: Akash Gajjar <quic_agajjar@quicinc.com>
2023-07-06 23:19:10 +05:30
Akash Gajjar
f4865f480d disp: msm: sde: add vsync count in virtual encoder
Introduce vsync count variable in virtual encoder structure
to keep the vsync count variable value in sync while performing
the poms. Consequently, this prevents the blocking of
drm_vblank_put and the invocation of
drm_crtc_funcs.disable_vblank.

Change-Id: I74903a89b17a8f46fb1b21338500553f36771dd0
Signed-off-by: Akash Gajjar <quic_agajjar@quicinc.com>
2023-06-14 15:50:35 +05:30
qctecmdr
8d51ce3720 Merge "disp: msm: sde: update idle_pc_duration based on frame rate" 2023-04-06 23:16:19 -07:00
qctecmdr
d883854ebb Merge "disp: msm: sde: avoid idlepc power collapse for wfd display" 2023-04-05 17:11:31 -07:00
Yojana Juadi
5ce42a7435 disp: msm: sde: update idle_pc_duration based on frame rate
This change updates the time required to enter idle_pc based
on frame rate instead of default time. In the current issue,
customer is facing janks where frame rate is 30fps and race
happens between sde_encoder_off_work and drm_atomic_commit
scheduled from userspace. It also sets max and min bound for
optimized performance.

Change-Id: I5e95e920a2f7b2142b5f63e8ce6b82cf1d482db1
Signed-off-by: Yojana Juadi <quic_yjuadi@quicinc.com>
2023-03-29 23:30:08 +05:30
qctecmdr
428f30bc92 Merge "disp: msm: sde: add input handler unregister check before encoder wakeup" 2023-03-24 07:35:21 -07:00
Jayaprakash Madisetty
2c2f2d3448 disp: msm: sde: add input handler unregister check before encoder wakeup
During PM suspend in dual display usecase, the power off commit to
turn off primary and secondary crtcs is done with only one
drm_atomic_state scheduled on primary crtc_commit thread. At the
same, touch events can happen on secondary panel, which will
run input_event_work and schedule the sde_enc->delayed_off_work
to turn off its enabled resources. There can be race between primary
crtc_commit thread which unregisters input_event, cancels
all the pending works before setting sde_enc->cur_master to NULL
and input_event_work_handler which schedules the delayed_off_work
without checking the input_event_handler state.
This change adds input handler unregister check before triggering
_sde_encoder_rc_early_wakeup.

Change-Id: I553843f81078810784f18e92347f918ab6e4a9fe
Signed-off-by: Jayaprakash Madisetty <quic_jmadiset@quicinc.com>
2023-03-20 02:24:02 -07:00
Gaurav LNU
14364f2db4 disp: msm: sde: out of bounds check for phys_encs array
Check for array out of bounds while accessing
phys_encs lists.

Change-Id: If0af4bd274df5729d8edb62199cbd848586ef0d7
Signed-off-by: Gaurav LNU <quic_glnu@quicinc.com>
2023-03-13 02:02:23 -07:00
Mahadevan
f349b4b629 disp: msm: sde: avoid idlepc power collapse for wfd display
When wfd display is connected, qseed3 coefficient lut programming
is getting erased due to idle pc entry for wfd pipes. On idlepc
exit commit, plane properties are not reconfigured from userspace
since support is not present for writeback crtc. This patch
updates idle pc handling to avoid gdsc power off when writeback
crtc is connected and for CWB encoder gdsc power off will happen
on idle pc entry.

Change-Id: I5dbab75bdc647b8f3c2a23cbb4e9d82239fe533d
Signed-off-by: Mahadevan <quic_mahap@quicinc.com>
2023-03-06 12:33:27 +05:30
Mahadevan
902ca46c21 Revert "disp: msm: sde: update idlepc handling for wfd display"
This reverts commit a5b326dc2d.

Change-Id: Ib2c4bd379807047bc5bc4dc8ebb8ec2dddfa45be
Signed-off-by: Mahadevan <quic_mahap@quicinc.com>
2023-03-06 11:50:23 +05:30
Christina Oliveira
f102c29b00 disp: msm: sde: increase display kickoff timeout for hw-fences
Starting with HW-Fencing, the frames hw kickoff
can take longer to trigger, given that HW will wait for the
input fences signal. Therefore, this change increments
the time-outs to wait up to ~10 secs, which corresponds
to the current input dma-fences timeout. This ~10secs
wait is given in intervals, where the dma-fence is also
checked, so in case that the client producer of the fence
signals the dma-fence, but misses the hw-fence signaling,
Display driver can handle this case and do a sw-override
to start the fetching of the incoming frame without waiting
for the input hw-fence ipc signal.

Change-Id: I6fcacbbaa79ca9847da616bd52efdda4bb8fccae
Signed-off-by: Christina Oliveira <quic_coliveir@quicinc.com>
2023-01-12 11:08:35 -08:00
qctecmdr
f875b6cc0a Merge "disp: msm: sde: disable encoder pp for 10bpp or 10bpc dsc config" 2023-01-06 20:03:12 -08:00
Raviteja Tamatam
b38e3c9e5a disp: msm: sde: wait for pending vsync event in encoder disable
In some corner cases there is pending vsync timestamp event to
sf when encoder is getting disabled. This is keeping vblank irq
to be enabled after sde_encoder_virt_reset leading to NULL ptr
access. In these cases, wait for vsync event to be completed which
disables the irq.

Change-Id: If0a6be1fc282906fb1b9c0fd18ede1d31d2549b3
Signed-off-by: Raviteja Tamatam <quic_travitej@quicinc.com>
2023-01-06 11:04:01 +05:30
Raviteja Tamatam
32bd9ab86f disp: msm: sde: prevent wb commit till cwb is disabled
There is race condition in below scenario leading to crash
in sde_encoder_virt_enable as sde_enc->cur_master is set to
NULL in sde_encoder_virt_reset in earlier CWB disable commit.
1) commit1-CWB retire fence signalled.
2) commit1-CWB disable commit still in progress.
3) commit2-New WB commit in progress.
4) commit1-sde_enc->cur_master is set to NULL in CWB disable commit.
5) commit2-Crash seen in sde_encoder_virt_enable in WB commit.

Also, as WB HW is still attached to commit1 till the next wr_ptr,
new WB session cannot be allowed. Adding validate check to fail
WB session when CWB is still not cleared in CTL path.

Change-Id: I62aca05f8380d3621d4980c0820cdd4da37b3dc1
Signed-off-by: Raviteja Tamatam <quic_travitej@quicinc.com>
2023-01-06 11:02:31 +05:30
Sanskar Omar
6679663a7f disp: msm: sde: disable encoder pp for 10bpp or 10bpc dsc config
disable encoder post processing module for all ping pong
modules in a given topology.

Change-Id: If81aa7c392e2270dab599e1d15c2ea905cb437d8
Signed-off-by: Sanskar Omar <quic_sansomar@quicinc.com>
2023-01-05 16:13:17 +05:30
qctecmdr
a8c5bc0da0 Merge "disp: msm: sde: update idlepc handling for wfd display" 2022-12-21 04:18:21 -08:00
Mahadevan
32509a9815 disp: msm: sde: wait for a vsync on suspend
The current scenario is as follows commit N with autorefresh
enabled and frame starts processing. On suspend commit N+1,
during virt_disable software resets CTL path after autorefresh
config is disabled. Since in hardware frame is still processing
sw reset is causing fifo underflow. This change waits for
vsync so that current autorefresh frame transaction completes
before issuing a CTL_SW_RESET.

Change-Id: I79fa81531d9f479d84d3873b5e855fcd73dc88c3
Signed-off-by: Mahadevan <quic_mahap@quicinc.com>
2022-12-12 19:52:06 +05:30
Jayaprakash Madisetty
a5b326dc2d disp: msm: sde: update idlepc handling for wfd display
When wfd display is connected, qseed3 coefficient lut
programming is getting erased due to idle pc entry for wfd pipes.
On idlepc exit commit, plane properties are not reconfigured from
userspace since support is not present for writeback crtc. This patch
updates idle pc handling to avoid gdsc power off when writeback
crtc is connected.

Change-Id: Ic4a4b5a6e4ccd59aaa4a076d6d8f1f7cfa27974f
Signed-off-by: Jayaprakash Madisetty <quic_jmadiset@quicinc.com>
2022-12-12 11:43:25 +05:30
Nisarg Bhavsar
a3032958a7 disp: msm: dp: issue peripheral flush on every DP commit
As per DP HPG recommendation, controller flush mode is
set to be synchronous with a vsync. This requires a
peripheral flush to be issued for HDR SDP to be processed.
Currently in a static HDR use case, since the peripheral
flush is not issued after queueing an HDR SDP, it never
gets sent to the sink and it stays in SDR mode. This change
issues a peripheral flush on every DP commit, so that
any pending SDPs are flushed.

Change-Id: I0ed82b6cd8df33539a3067c6ad9827f74de2ed51
Signed-off-by: Nisarg Bhavsar <quic_bhavsar@quicinc.com>
2022-11-06 12:14:00 -08:00
qctecmdr
adfcb0f857 Merge "disp: msm: sde: improve qsync trigger window accuracy" 2022-10-20 19:18:13 -07:00
Amine Najahi
5421008a85 disp: msm: sde: improve qsync trigger window accuracy
Currently, panel jitter and loss of precision are not
compensated when calculating the trigger window size
for a QSYNC panel. These errors can be signigicant on
panels supporting very slow frame rate (10 Hz).

This change improves fixed point calculation and take
into account panel jitter when calculating the minimum
qsync time period.

Change-Id: Ibe620862afbd853580992fccec09cac8307b92bd
Signed-off-by: Amine Najahi <quic_anajahi@quicinc.com>
2022-10-18 06:50:27 -07:00
Veera Sundaram Sankaran
6f3f3e7839 disp: msm: sde: avoid setting plane qos_dirty during cwb modeset
The encoder modeset updates all the plane's qos_dirty flag attached
to the crtc to make sure the qos params are updated during seamless
mode-switch cases like fps or resolution switch. But this is not
required for cwb encoder modeset as it does not have any effect on
the planes attached to the main display. Add check to avoid this
reprogramming.

Change-Id: I1ab7a71971b7200a50e6643407327734b1c9cbc5
Signed-off-by: Veera Sundaram Sankaran <quic_veeras@quicinc.com>
2022-10-13 14:47:26 -07:00
Veera Sundaram Sankaran
1055b42576 disp: msm: sde: cache cwb enc mask to use during seamless transitions
The cwb_enc_mask is set by the wb phys encoder during the validate
phase and this is in-turn used during the commit phase. During
seamless transition cases like poms with cwb, the encoders are
disabled and then enabled back after the validate phase. The cwb
flags are reset during this time leading to issues. Cache the flag
and reapply it during the modeset to avoid this case.

Change-Id: I5df1be18a5e30bb1107dc0f2e87d771a735f1ab6
Signed-off-by: Veera Sundaram Sankaran <quic_veeras@quicinc.com>
2022-10-11 14:55:29 -07:00
Yashwanth
3c695fabab disp: msm: sde: detach dsc/vdc encoder blocks properly during modeswitch
In the current code if there is a switch from DSC to non-DSC
mode, all the DSC blocks attached to the sde_encoder are not
cleaned up properly. Due to this, during virt disable these
DSC blocks are disabled and flushed resulting in underruns
on other ctl paths which might be using them. This change
properly cleans up all the dsc/vdc attached to the sde
encoder to avoid such issues.

Change-Id: Ie644701cbda6b4d056bc7ef30300be96096c5214
Signed-off-by: Yashwanth <quic_yvulapu@quicinc.com>
Signed-off-by: Narendra Muppalla <quic_nmuppall@quicinc.com>
2022-09-28 13:07:34 -07:00
Veera Sundaram Sankaran
965ac39c84 disp: msm: sde: enable encoder resources before phys enc disable
Enable the clks/irqs & update RSC state during encoder disable.
This ensures RSC is in correct state during the non-primary disable
commit as it might have entered idle power collapse before the
disable.

Change-Id: Idf82efb3a7bc895e1a97c6cdeeb62970184c8e5d
Signed-off-by: Veera Sundaram Sankaran <quic_veeras@quicinc.com>
2022-08-08 10:15:11 -07:00
qctecmdr
57cd9e59bc Merge "disp: msm: sde: avoid null pointer dereference" 2022-07-23 20:11:28 -07:00
qctecmdr
aff5c915e2 Merge "disp: msm: sde: add tx wait for WB display during modeset" 2022-07-18 07:31:34 -07:00
Linux Build Service Account
f6df1dc160 Merge "disp: msm: sde: update uidle ctl register only for master encoder" into display-kernel.lnx.5.15 2022-07-17 12:56:32 -07:00
Linux Build Service Account
b08fbb8ed4 Merge "disp: msm: sde: update encoder wait event timeout condition" into display-kernel.lnx.5.15 2022-07-17 12:55:31 -07:00
Narendra Muppalla
8d8d5c1b74 disp: msm: sde: avoid null pointer dereference
This change avoids null pointer dereference in encoder kickoff.

Change-Id: I83c2c6f327ffb367a1cf5fc3a6cf0309a1187441
Signed-off-by: Narendra Muppalla <quic_nmuppall@quicinc.com>
2022-07-14 11:52:05 -07:00
Lei Chen
6f17f3e63e disp: msm: sde: add tx wait for WB display during modeset
Add tx wait for WB display during modeset to avoid unbalanced
IRQ handle.

Change-Id: I18337e2a06fe5ec98d4d6e6d766abbf4ec585703
Signed-off-by: Lei Chen <quic_chenlei@quicinc.com>
2022-07-06 19:26:11 -07:00
Yashwanth
2b4adfd6d3 disp: msm: sde: update uidle ctl register only for master encoder
In case of dual dsi usecase, since both the encoders use
the same CTL path, this change ensures that uidle ctl
settings are updated only by the master encoder.

Change-Id: Ic47703aeee69999b4535034b5cd7a65cf53cd0fb
Signed-off-by: Yashwanth <quic_yvulapu@quicinc.com>
2022-07-05 09:21:51 -07:00
Yashwanth
a5e9316dd1 disp: msm: sde: update encoder wait event timeout condition
The sequence during which issue is observed:

1) wb pending_retire_fence_cnt is equal to 2 due to which
it waits for WB_DONE irq. Current pending_retire_fence_cnt
is 2 and required pending_retire_fence_cnt is 1.

2) Due to external reasons, irq's are disabled and after
some duration, back to back irq's are received.

3) Because of this, pending_retire_fence_cnt becomes zero
before the commit thread could wakeup and validate the
condition.

sde_encoder_helper_wait_for_irq API will wait for complete
timeout due to the count mismatch. This change adds
required check to early exit in such usecases.

Change-Id: I4f9c817cc7acee17424b77928d34b039afcaeae5
Signed-off-by: Yashwanth <quic_yvulapu@quicinc.com>
2022-07-05 09:18:11 -07:00
Jayaprakash Madisetty
e09db6e5c2 disp: msm: sde: avoid clear_pending_flush on hw_ctl during power_on commit
CTL datapath idx can be switched between secondary and external displays
as per current SW code. This change avoids the clearing the SW flush ctx
in prepare_commit during resume use case. It fixes the GPU fence timeouts
seen during below scenario.
Issue scenario:
1. Primary display was using CTL_0 and it is reserved.
2. Secondary display was using CTL_1 and suspend occurred.
   CTL_1 is added to RM free list.
3. When external Display is connected, it starts using CTL_1
   datapath.
4. Secondary display is resumed and it starts using CTL_2.
   During prepare_commit, phys_enc->hw_ctl was CTL_1 and
   SW is clearing the flush ctx of external Display.
5. Since CTL_1 flush bits are cleared, SW is not programming the
   CTL_FLUSH register for this composition and release/retire fences
   are not signaled causing fence timeouts at GPU end and Input fence
   timeout at display end finally leading to SF hung.

Change-Id: Ic843ce5c4f06f1620636abd24d443952c2ba8dc5
Signed-off-by: Jayaprakash Madisetty <quic_jmadiset@quicinc.com>
2022-07-05 09:17:10 -07:00
qctecmdr
7b00783abe Merge "disp: msm: sde: add support for display emulation on RUMI." 2022-06-29 19:02:15 -07:00
Veera Sundaram Sankaran
4672a64057 disp: msm: sde: handle vsync wait status check during timeout
When VSYNC interrupts are delayed due to irq latencies, there is a
possibility that the timeout handler checking the irq status and the
irq handler clearing the status bit happening at the same time on
different CPU cores. This is reported as an error, though there is
not actual issue. Handle this case, by adding an additional ctl-flush
register check in the vsync timeout handler. As part of the change
add error/eventlogs in commit-done wait failures.

Change-Id: Ie7e30dc4ef1e50651cee9015cd3f2caeacf47e5f
Signed-off-by: Veera Sundaram Sankaran <quic_veeras@quicinc.com>
2022-06-21 13:13:20 -07:00
Amine Najahi
11672b46fc disp: msm: sde: add support for display emulation on RUMI.
Add support display emulation targets on RUMI

This change does the following:
-parse dt node to enable display emulation mode.
-use sde_reg_read for pool timeout ops and debug fs dump.
-increases the kickoff timeout when emulation is enabled.
-bypass AXI halt operation when emulation is enabled.

Change-Id: Idc493964c0b8fc89f5d85fcc5755e0874a12d211
Signed-off-by: Amine Najahi <quic_anajahi@quicinc.com>
2022-06-08 15:20:46 -04:00
Veera Sundaram Sankaran
b40c05519d disp: msm: sde: log vblank timestamp in eventlogs
Log the vblank timestamp during vblank callback. This will be
useful in calculating the precise difference between the vsync
while debugging. As part of the change, remove the vblank
counter logging in sde_crtc as it floods the logs with 4 entries
for each vblank request.

Change-Id: I6b532ad657581fb2a34318541acbd81a44858819
Signed-off-by: Veera Sundaram Sankaran <quic_veeras@quicinc.com>
2022-05-23 14:09:11 -07:00
Christina Oliveira
21ca2acab9 disp: msm: sde: add support for hwfence profiling
This change adds hwfence input and output fence profiling
registers and debugfs to enable them.
To enable input hw fences timestamps:
echo 0x1 > /d/dri/0/debug/hw_fence_status
To enable output hw fences timestamps:
echo 0x2 > /d/dri/0/debug/hw_fence_status
To enable both, input and output hw fences timestamps:
echo 0x3 > /d/dri/0/debug/hw_fence_status.

Change-Id: I269a38f3843a01ec8c0816890e50bb7d847a4ed9
Signed-off-by: Christina Oliveira <quic_coliveir@quicinc.com>
2022-05-18 09:38:40 -07:00
Christina Oliveira
d2d060cf80 disp: msm: sde: add hw fence support for prog line count
This change adds support for triggering output
hw fence upon programmable line count.

Change-Id: Ie4b8252e4f9a448a8c11d17696b9bb0ded81b04b
Signed-off-by: Christina Oliveira <quic_coliveir@quicinc.com>
2022-05-16 12:45:49 -07:00
Christina Oliveira
640c8111d3 disp: msm: sde: add support for hw-fence feature
Starting mdss 9.0, dpu supports triggering
the frame fetch through hw-fencing. This change
adds support for this hw-fence feature.

Change-Id: Icc7d0b69fc2a51103d14612f5ac89b44a47ed826
Signed-off-by: Ingrid Gallardo <quic_ingridg@quicinc.com>
Signed-off-by: Christina Oliveira <quic_coliveir@quicinc.com>
2022-05-16 12:41:28 -07:00