Commit Graph

51 Commits

Author SHA1 Message Date
Jayaprakash Madisetty
2c8aa84b33 Revert "disp: msm: sde: remove all preclose logic"
This change reverts commit ae2dceb0b6 ("disp: msm:
 sde: remove all preclose logic"). This change also
modifies the force disable plane logic since
__drm_atomic_helper_disable_plane is not exposed to
drivers.

Change-Id: I89e19dead9ade724798952b1934b45b5663e1a42
Signed-off-by: Jayaprakash Madisetty <jmadiset@codeaurora.org>
2021-05-26 11:35:04 +05:30
Jayaprakash Madisetty
a799d5f7b6 disp: msm: sde: avoid seamless crtc transition when CWB is enabled
Add changes to avoid primary crtc seamless transition when CWB is
enabled in bootup first commit. This ensures atomic_enable gets called
for primary crtc in splash handoff commit and software states get updated.

Change-Id: I7faab3e4839ab6a69023790ee2874250091f32f0
Signed-off-by: Jayaprakash Madisetty <jmadiset@codeaurora.org>
2021-05-18 17:41:33 +05:30
Jayaprakash
ddbcaa93eb 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>
2021-02-23 12:04:23 +05:30
qctecmdr
a2a3c5e864 Merge "disp: msm: sde: cache encoder_mask for vblank_work" 2020-11-24 06:44:04 -08:00
Veera Sundaram Sankaran
e07097c244 disp: msm: sde: use drm mode set by user-mode in trusted-vm
Trusted-vm uses the cont-splash path to initialize the software
states by reading the hardware registers and populating the
SDE & DRM software states. But drm mode cannot be determined by
register reads, so rely on user-mode to get the mode which comes
as part of the first atomic_commit check phase which handles the
transition. The primary-vm user-mode passes the current mode to
trusted-vm through qrtr which is in-turn passed to driver to
set that particular mode.

Change-Id: I4fb86b40b8a0583c8edb539b0a51dcd33de731ff
Signed-off-by: Veera Sundaram Sankaran <veeras@codeaurora.org>
2020-11-18 17:32:58 -08:00
Steve Cohen
aa064ada86 disp: msm: sde: cache encoder_mask for vblank_work
There is a race between disable commit swap-state on display
thread and vblank work on event thread which may skip applying
the vblank vote if the encoder_mask has already been cleared.
To avoid the race, use a cached encoder_mask that is gauranteed
to be valid between the vblank_on and vblank_off calls.

Also, vblank queue work is initializing a variable that's never
used and msm_disable_outputs has 2 instances of pointers to old
CRTC state. Remove this dead code.

Change-Id: I5e4a482b8f067e272a2aef5afa08cc0e1ab89434
Signed-off-by: Steve Cohen <cohens@codeaurora.org>
2020-11-17 17:24:30 -05:00
Yashwanth
2683324973 disp: msm: register rotator platform driver after genpd init
Due to power-domain, if rotator driver is registered early,
probe might get deferred several times and get stuck
indefinitely. So, this change adds driver registration
after genpd init to handle such cases.

Change-Id: I8dcb640d0ab0cdf0818cbce1b1fb460c28d8b9e7
Signed-off-by: Yashwanth <yvulapu@codeaurora.org>
2020-09-25 21:16:42 +05:30
Ping Li
97a5b52ebd disp: msm: sde: add event to event_list after register is successful
Add event to event_list after msm_register_event is successful to avoid
use-after-free vulnerability.

Change-Id: I34fb39c99051978cbab64a852851964691a5ea9e
Signed-off-by: Ping Li <pingli@codeaurora.org>
2020-09-11 13:52:52 -07:00
Ping Li
76a1d81e9d Revert "disp: msm: sde: add event to event_list after register is successful"
This reverts commit 91fc51777c67ddc92d0ba1fcddf6cd149f7a0560.
The original fix missed to add the client to list in cases when count is
larger than zero and client doesn't need to be deleted from list if
msm_register_event fails as it was not added to list yet.
Revert this change to upload the correct fix.

Change-Id: I00923d65387753b05b6b03efec109c019826f5d5
Signed-off-by: Ping Li <pingli@codeaurora.org>
2020-09-11 13:52:05 -07:00
Ping Li
9450155b4f disp: msm: sde: add event to event_list after register is successful
Add event to event_list after msm_register_event is successful to avoid
use-after-free vulnerability.

Change-Id: I144ae82c657c1e2cf16608c0e8768b12a7d27974
Signed-off-by: Ping Li <pingli@codeaurora.org>
2020-08-31 16:23:27 -07:00
qctecmdr
2b8aaf8652 Merge "disp: msm: fix driver unload issues in gki config" 2020-07-24 11:17:20 -07:00
Orion Brody
66f04c4716 disp: msm: fix driver unload issues in gki config
Resolves segmentation fault during driver unload in GKI
configuration, caused by repeated debugfs destroy calls.
Also removes redundant unload calls.

Change-Id: I20a8efc1916b9a60766f9c7714a4b458aa518566
Signed-off-by: Orion Brody <obrody@codeaurora.org>
2020-07-15 12:26:08 -07:00
Lei Chen
eb679f5289 disp: msm: add support for display early wakeup
Display clocks and IRQs are disabled during idle state
on command mode for power saving, and will be enabled
when a new frame commits to display driver. But enable
display clocks and IRQs will cause some latency.
So add a new SDE custom IOCTL for user-space to early wake
up display before first frame commits to kernel.

Change-Id: I6ca0188d321c4964f29c46e588b64d06b9634c59
Signed-off-by: Lei Chen <chenlei@codeaurora.org>
2020-07-12 19:08:23 -07:00
Jeykumar Sankaran
99df0d5052 disp: msm: add support for vm event register framework
Besides SDE, other subdrivers may be interested in participating in
the VM switch. This change provides framework for display dependent
drivers like DSI, DP and RSCC to register for various VM switch
event hooks.

The following hooks to provided through msm_vm_ops:
post_hw_acquire: invoked before the first frame push after gaining
                 HW access.
pre_hw_release: invoked after the last frame commit before releasing
                the HW.
check:       check with vm clients for their readiness for HW
             releasing.

Change-Id: I616db04e979f78f76f6f97ee3b068dd348339ab6
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
2020-07-08 23:14:31 -07:00
qctecmdr
4fbdcba865 Merge "disp: msm: sde: wait for pending crtcs before lastclose commits" 2020-06-30 17:33:14 -07:00
Steve Cohen
f030fa4c2a disp: msm: sde: wait for pending crtcs before lastclose commits
If a SIG_TERM/SIG_KILL or other signal is sent to the final drm
client, the driver will be force-closed. A -ERESTARTSYS error is
occasionally seen from the interruptible wait in
msm_atomic_commit when this occurs, and causes the lastclose
cleanup to fail if any crtc is busy at that point. To prevent
this, wait for any pending crtcs to complete before calling
the lastclose cleanup commits.

Change-Id: Ib6a5e55a4b737213756cb9ed8364d5c34ab47c16
Signed-off-by: Steve Cohen <cohens@codeaurora.org>
2020-06-29 23:45:19 -04:00
qctecmdr
4d45309328 Merge "disp: msm: fix vram allocation when IOMMU is not present" 2020-06-28 04:32:57 -07:00
Dhaval Patel
44cde01fc7 disp: msm: sde: manage vblank refcount concurrency
Vblank refcount can reach out of sync with below case
 1. event_thread triggers the vblank_enable
 2. commit_thread triggers the modeset
   2.a modeset resets the vblank refcount with mode_set
 3. event_thread triggers the vblank_disable

Event 2.a resets the vblank refcount and vblank disable
request after 2.a is going to fail. This can be fixed
by avoiding concurrency between mode_set call and vblank
request.

Change-Id: Ibb810ec90e81d63feee443f1c37dd736d5cfac0d
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
2020-06-25 13:54:21 -07:00
Veera Sundaram Sankaran
88037da799 disp: msm: fix vram allocation when IOMMU is not present
Allocate DSI/LUTDMA buffers from VRAM when IOMMU is not
available. Add checks in msm_gem to avoid few operations
when aspace is not available due to no IOMMU. Parse the
VRAM size from device tree, when available.

Change-Id: Iedf5749b71c2e772ac5434048520a34705c54b45
Signed-off-by: Veera Sundaram Sankaran <veeras@codeaurora.org>
2020-06-24 16:20:38 -07:00
Amine Najahi
ed868466f5 disp: msm: dp: Extend mode filtering to support 8K
Currently DP driver determines if a mode is DSC capable
based on a DTSI entry and the required number of DSC
to support it. This approach does not scale when there
is an overlap in DSC requirement between DSI displays
and external DP display, thus causing one of the display to
report modes that cannot be supported.

This change compares the resources reserved for DP driver
calculated at initialization time and the currently available
ones to determine the correct number of resources that DP driver
can use. It also adds DSC and topology filtering logic and moves
DSC hardware specific from DP driver to SDE driver.

Change-Id: I8e601de33422b7c6d786826f7bfe152c4af8a6b5
Signed-off-by: Amine Najahi <anajahi@codeaurora.org>
2020-06-09 09:17:38 -04:00
Abhijit Kulkarni
c789d0fb8a disp: msm: check if kms is instantiated
This defensive check is now required since the allocation
of driver private data has moved from bind to probe phase.
There is a chance that device shutdown can be called before
bind phase and this can cause invalid memory access.

Change-Id: I2d471a4aff93ae03291e19f6f902f1e5c28dc50f
Signed-off-by: Abhijit Kulkarni <kabhijit@codeaurora.org>
2020-05-14 14:43:27 -07:00
Yashwanth
37d86a4d83 disp: msm: queue vblank work on disp thread during modeset
If vblank work is queued to event thread, during modeset,
there might be a case where vblank is enabled in between
resulting in vblank ref count mismatch. This change queues
vblank request to disp thread during modeset.

Change-Id: I98b87b4209e1f7f535980eef22a50df17c346c23
Signed-off-by: Yashwanth <yvulapu@codeaurora.org>
2020-05-06 13:18:14 -07:00
Abhijit Kulkarni
802b5e31eb disp: msm: fix probe deferral logic
msm_drv should be probe deferred until rsc driver
probe is done. OF_POPULATED flag only checks if platform
driver is registered and hence additional condition to
check if driver is attached to this device, is needed.

Change-Id: I070965cc8d3ba3984032ad3704ec86066680eef0
Signed-off-by: Abhijit Kulkarni <kabhijit@codeaurora.org>
2020-05-01 09:57:07 -07:00
Shashank Babu Chinta Venkata
8b8bfe0165 disp: msm: make msm_drm into single module
Make msm_drm into single module and all child driver
registers and unregisters are handled from parent's
register and unregister respectively.

Change-Id: I017513d1de3b6b25dd5543d7fa7741c0bac1740d
Signed-off-by: Shashank Babu Chinta Venkata <sbchin@codeaurora.org>
Signed-off-by: Narendra Muppalla <NarendraM@codeaurora.org>
Signed-off-by: Chandan Uddaraju <chandanu@codeaurora.org>
2020-04-28 15:52:39 -07:00
Chandan Uddaraju
eaa458b165 disp: msm: move MDSS resource voting to probe
sync_state driver disables any resources that
don't have any votes after driver probe is completed.
Move MDSS resource votes to probe so that any resources
that are needed for continuous splash are intact until
the bind of all the components is complete.

Change-Id: I0056bf1ec56bcd6a1b620a81143d4b49d7ea2921
Signed-off-by: Chandan Uddaraju <chandanu@codeaurora.org>
2020-04-28 12:09:13 -07:00
Dhaval Patel
d4566743e0 disp: msm: avoid msm_drv probe if sde_rsc is not probed yet
Msm_drv device node has dependency on sde_rsc device
node for power resource enable if sde_rsc device
device is enabled. This change moves the msm_drv device
to probe defer state during component addition if
sde_rsc device is not probed yet. It also removes
the master_drm device node access from sde_rsc device.

Change-Id: Ibb7457279b3376f45e82e5c9373aabd84a37ed36
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
2020-04-23 10:29:44 -07:00
Samantha Tran
22923230ef disp: msm: modify handling of debugfs initialization
Add support to allow creation of debugfs node only if
CONFIG_DEBUG_FS is enabled.

Change-Id: Iaeaf51b3654c9458cf8131a9756e6b905007c4ae
Signed-off-by: Krishna Manikandan <mkrishn@codeaurora.org>
Signed-off-by: Samantha Tran <samtran@codeaurora.org>
2020-04-16 23:55:48 -07:00
Narendra Muppalla
d6141f8472 disp: msm: fix kw issues in sde driver
This change addresses out of range and null checks in
sde driver.

Change-Id: I905d795edf6715aa990dd7bbaf061734e95ddea6
Signed-off-by: Narendra Muppalla <NarendraM@codeaurora.org>
2020-03-30 15:22:34 -07:00
Samantha Tran
bf06be4737 disp: msm: queue vblank work on event thread
This change queues vblank work to event thread rather than
the display thread. This allows vblank events to be processed
without potentially being delayed by crtc commit being processed.

Change-Id: I9cbf9b3de646716e4698af9f338a7140346b65fd
Signed-off-by: Samantha Tran <samtran@codeaurora.org>
2020-03-29 19:24:15 -07:00
Renchao Liu
b3cb4343b1 disp: msm: Fix byte alignment problem on 32bits OS
There is potential byte alignment problem on 32bits OS which will
cause incorrect histogram blob id getting from the user space.
This change fixes byte alignment problem on 32bits OS by keeping
the struct members in one complete struct as the user space using.

In previous code start address of 'info' would align to multiple of 8,
so there would be 4 bytes padding between member 'event' and 'info'
on 32 bits OS. It is affected by member 'base'. But user space just
uses struct drm_msm_event_resp only, not affected by member 'base'.
Driver code intends to send drm_msm_event_resp, but actually send
unpacked members.

Change-Id: I5410f5b1626387707a57cbcef9c651aa11914d9d
Signed-off-by: Renchao Liu <rencliu@codeaurora.org>
2020-03-29 16:52:16 -07:00
Abhijit Kulkarni
a752925112 disp: msm: sde: re-factor probe time initialization
This change moves the msm_driver power resource initialization from
bind time to probe time. This keeps the resource vote on until all the
devices are bound. This is required since the regulator and clock
sync_state driver will remove the proxy votes as soon as msm_driver
has probed.

Change-Id: Icb0e59e4ff0290ef0c1bd3914d6fdbf99bf5d9fa
Signed-off-by: Abhijit Kulkarni <kabhijit@codeaurora.org>
2020-03-23 12:07:40 -07:00
Satya Rama Aditya Pinapala
d97b665e1d disp: msm: move msm_drv probe to module level
With the introduction of sync state drivers, msm_drm probe can be
moved back to module level from late init.  It is now guaranteed
that the dependencies are probed before the actual driver is.

Change-Id: Ib7c3e0e3c3d32b37b7672b6119bcf5371783659d
Signed-off-by: Satya Rama Aditya Pinapala <psraditya30@codeaurora.org>
2020-03-02 11:38:00 -08:00
Abhinav Kumar
e3f23771ba disp: msm: add support for variable compression ratios
Currently the compression ratio is hard-coded to either 2:1 or
3:1 in several places. This is not sufficient for new compression
algorithms as they can support higher compression ratios.

Add support for calculating the compression ratios from the source
and target bpp thereby eliminating hard-coding.

Change-Id: I6383f3d0c781193d0a9ed74df5a95d8e856edb3d
Signed-off-by: Abhinav Kumar <abhinavk@codeaurora.org>
2020-01-29 13:46:57 -08:00
Linux Build Service Account
6ad6641d3a Merge changes I36a55b91,Icc225bd1 into display-kernel.lnx.1.0
* changes:
  disp: msm: sde: update shmbridge header file path
  disp: msm: delay msm_drv probe
2019-12-09 12:26:54 -08:00
Steve Cohen
ae2dceb0b6 disp: msm: sde: remove all preclose logic
The DRM framework only calls the driver's preclose callback
function if the LEGACY driver feature is enabled. Therefore
strip out this logic as it never gets executed since LEGACY
is not supported for msm_drm driver.

Change-Id: I95474cd5424423ef194faae12f1241698f3e467e
Signed-off-by: Steve Cohen <cohens@codeaurora.org>
2019-12-09 08:36:00 -08:00
Steve Cohen
ff5365a1e0 disp: msm: make kms a DRM client for lastclose logic
Since some APIs previously used during lastclose are no longer
exposed to drivers (__drm_atomic_helper_disable_plane, and
__drm_atomic_helper_set_config), make kms a DRM client and use
the drm_client_modeset_commit_force API to do lastclose cleanup.

Change-Id: I543392fe79558a3996e326a0f222793c56d71e4f
Signed-off-by: Steve Cohen <cohens@codeaurora.org>
2019-12-09 10:57:54 -05:00
Abhijit Kulkarni
29fecbebc7 disp: msm: delay msm_drv probe
This change delays the probe of msm_drv by changing the init call
order to ensure that all the dependent resource drivers are
probed and all resources are available for use by the msm_drv.

Change-Id: Icc225bd14052a8d83e9976fbaa9c83c17f5319aa
Signed-off-by: Abhijit Kulkarni <kabhijit@codeaurora.org>
2019-12-06 10:19:45 -08:00
Narendra Muppalla
d1d9ae8b19 Disp: Snapshot change for lahaina display driver
This snapshot change adds downstream support
for drm 5.x+(msm_lahaina branch) linux kernel.

Change-Id: Ia691c95da155a00e449c91a2f1a5b20a8e71aed4
Signed-off-by: Narendra Muppalla <NarendraM@codeaurora.org>
2019-11-24 12:30:51 -08:00
qctecmdr
1f35fd007a Merge "disp: msm: update topology based on clock requirement" 2019-09-21 03:22:17 -07:00
Tatenda Chipeperekwa
da892c0b91 disp: msm: update topology based on clock requirement
Update the topology allocation by considering the required
mode clock (vtotal x htotal x fps * fudge factor). Modes with
a clock that exceeds the maximum SDE clock will be denoted as
requiring a topology that uses two layer mixers.

Change-Id: I3c773598b0d79cb6fea9d3a0e04d89ff84d67e13
Signed-off-by: Tatenda Chipeperekwa <tatendac@codeaurora.org>
2019-09-20 14:39:54 -07:00
Jayaprakash
669557d6eb disp: msm: add changes for bengal target compilation
This change corrects the definitions of functions
invoked when their config keys are not enabled.

Change-Id: Iba4631b8019a5e5a6b95516c5c9f9e28942e60c9
Signed-off-by: Jayaprakash <jmadiset@codeaurora.org>
2019-09-18 19:32:32 +05:30
Abhijit Kulkarni
484d909f94 disp:msm: fix return type from runtime api
pm_runtime_get_sync api can return non-zero return value
for success case. For such cases the IOCTL should return
success.

Change-Id: I5868cfc3c0cdeb63c3b2e68f1dcddadcd0aae9ce
Signed-off-by: Abhijit Kulkarni <kabhijit@codeaurora.org>
2019-06-20 15:53:04 -07:00
Lakshmi Narayana Kalavala
9e17babe6a disp: msm: sde: turn off/on vblank callbacks as per crtc
Current sde driver allows vblank enable and wait requests
even after crtc is disabled which would eventually lead to
enable of irq and timeouts in caller context. This change fixes
it by updating vblank callback status as 'on' during crtc enable
and shutdowns vblank callbacks before crtc disable is complete.

Change-Id: I52b74f685107f4dc8c83305c28f23cdcb4747730
Signed-off-by: Prabhanjan Kandula <pkandula@codeaurora.org>
Signed-off-by: Lakshmi Narayana Kalavala <lkalaval@codeaurora.org>
2019-05-30 16:13:09 -07:00
qctecmdr
9c05197ef9 Merge "disp: msm: sde: use wr_ptr interrupt instead of ctl_start" 2019-05-24 09:38:19 -07:00
Samantha Tran
3be27eafcc disp: msm: snapshot of msm and sde driver
This snapshot ports changes from 4.14 to 4.19 into
the msm and sde layer. Snapshot was taken as of
commit 0f8fb25421ff ("cnss2: Add device version to
SOC info structure").

Change-Id: I59b799a78319c2db6930a2a10bc38976f8c09898
Signed-off-by: Samantha Tran <samtran@codeaurora.org>
2019-05-22 13:08:31 -07:00
Manoj Kumar AVM
6af277472c Revert "disp: msm: sde: turn off/on vblank callbacks as per crtc"
This reverts commit 16bfab7ddf.

Change-Id: I5c5ef6a2fcb83607acd2c737f574199c010c89fa
Signed-off-by: Manoj Kumar AVM <manojavm@codeaurora.org>
2019-05-21 18:33:54 -07:00
Douglas Anderson
9455b48fbb drm/msm: Only add available components
When trying to get the display up on my sdm845 board I noticed that
the display wouldn't probe if I had the dsi1 node marked as "disabled"
even though my board doesn't use dsi1.  It looks like the msm code
adds all nodes to its list of components even if they are disabled.  I
believe this doesn't work because all registered components need to
come up before we finish probing.  Let's do like other DRM code and
only add available components.

Change-Id: I00738a7f9fa572f12067066e86ea7974693b3aab
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Link: https://patchwork.kernel.org/patch/10712329/
Git-commit: d1d9d0e172
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Nilaan Gunabalachandran <ngunabal@codeaurora.org>
2019-05-09 14:04:18 -04:00
qctecmdr
8205140d9c Merge "disp: msm: sde: turn off/on vblank callbacks as per crtc" 2019-05-05 19:42:43 -07:00
Lakshmi Narayana Kalavala
16bfab7ddf disp: msm: sde: turn off/on vblank callbacks as per crtc
Current sde driver allows vblank enable and wait requests
even after crtc is disabled which would eventually lead to
enable of irq and timeouts in caller context. This change fixes
it by updating vblank callback status as 'on' during crtc enable
and shutdowns vblank callbacks before crtc disable is complete.

Change-Id: I9085103ced06e5fad51219f26bd8dd655fa36fea
Signed-off-by: Prabhanjan Kandula <pkandula@codeaurora.org>
Signed-off-by: Lakshmi Narayana Kalavala <lkalaval@codeaurora.org>
2019-04-26 17:03:21 -07:00
Dhaval Patel
a74d2cf7fa disp: msm: add runtime_pm ops support in drm driver
Add runtime_pm ops support in drm driver instead
of direct sde_power_resource_enable/disable call.
It allows drm driver to use runtime pm refcount logic
to track the resources instead of custom implementation.
The change also removes the NRT_CLIENT support from
sde_power_handle code to simplify it further.

Change-Id: Ib14692dca5876703d0a230da2512d731b69b8ebb
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
2019-04-24 13:27:48 -07:00