Currently get vcpi info call is returning wrong slot info since update
payload function is called afterwards. The latter function is calculating
the slot info which is read back by get vcpi call. This change reorders
these function calls. Also, this change sets start_slot to be always 1.
This is the value expected by upstream driver for atomic drivers.
This is a follow up change for the commit 19a9abf064
("disp: msm: dp: update MST first link slot information").
Change-Id: I620125a2d73afb7537a3540ee129e2a4eb0c488c
Signed-off-by: Sandeep Gangadharaiah <quic_sandgang@quicinc.com>
In MST atomic check function, add a check to ensure it's a disable call
before releasing vcpi slots to ensure atomic_release_vcpi_slots() and
atomic_find_vcpi_slots() are never called in the same atomic check
as mentioned in the kernel docs.
Change-Id: I36cf689b4d3bf9d2469a6c402b6377a667f01c12
Signed-off-by: Andrew Bartfeld <quic_abartfel@quicinc.com>
This change updates the include file path for necessary dp
and dsc headers that have moved in upstream kernel.
File path changed in upstream:
include/drm/display/drm_dp_aux_bus.h
include/drm/display/drm_dp_dual_mode_helper.h
include/drm/display/drm_dp.h
include/drm/display/drm_dp_helper.h
include/drm/display/drm_dp_mst_helper.h
include/drm/display/drm_dsc.h
include/drm/display/drm_dsc_helper.h
include/drm/display/drm_hdcp.h
include/drm/display/drm_hdcp_helper.h
include/drm/display/drm_hdmi_helper.h
include/drm/display/drm_scdc.h
include/drm/display/drm_scdc_helper.h
Change-Id: Icb9a227c7464061f68fe60cbda6d93858fa768c5
Signed-off-by: GG Hou <quic_renjhou@quicinc.com>
Signed-off-by: Nilaan Gunabalachandran <quic_ngunabal@quicinc.com>
Addresses a race condition which could cause the RM to overcommiting LMs to
DP when multiple DP displays are used.
sde_rm_get_resource_info now uses the RM's mutex and assumes a null
encoder is not a built in display so that it can return an accurate
count of unreserved resources.
DP layer now maintains internal accounting of LMs in use to avoid
validating modes that have insufficient remaining resources.
Change-Id: I908c1597c1d651b6f9c9b74a34137f30087d8801
Signed-off-by: Alex Danila <quic_eadanila@quicinc.com>
Add existing debug logs to ipc logging to be
accessed through debugfs.
Change-Id: Id9bfe61cb7921674eadc5635847c81a0fbdaef5c
Signed-off-by: Nisarg Bhavsar <quic_bhavsar@quicinc.com>
MST driver is incorrectly using maximum bw_code while initializing
MST topology manager instead of maximum link clock in KHz. This
prevents the topology manager to set MST state on a subsequent MST
plug in causing all MST cases to fail.
Change-Id: I9fc4e0326fe0c7a6c9b81af8810b7098fa8ba967
Signed-off-by: Rajkumar Subbiah <quic_rsubbia@quicinc.com>
Commit 283560c ("disp: msm: dp: use Extended Base Receiver Capability DPCD space")
pass additional parameters to supply maximum lane count and rate to MST topology
manager. In cases where sources have lower maximum lane count or rate than default
MAX_LINK_RATE, these values will be used instead.
This change puts macros in the callers of function drm_dp_mst_topology_mgr_init to
handle interface change between kernel version 5.10 and version 5.15.
Change-Id: I394c70640606de477d67b08cafb495bebb6c549f
Signed-off-by: Bruce Hoo <bingchua@codeaurora.org>
Pass additional parameters to supply maximum lane count and
rate to MST topology manager. In cases where sources have
lower maximum lane count or rate than default MAX_LINK_RATE,
these values will be used instead.
Change-Id: I9278ce6cc9fbacaf3f6d964c5036208c0695a79b
Signed-off-by: Bruce Hoo <bingchua@codeaurora.org>
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Currently the DP driver always uses a compression ratio of 3, if
DSC is enabled. So if the sink supports 30bpp, the compressed
output is set to 10bpp. But since the hardware supports
compressing this to 8bpp, it would require less link bandwidth
than 10bpp compressed output. For compliance testing, the
test equipment limits the link bandwidth based on the most
efficient compression ratio and for some resolutions there
is not enough link bandwidth for 3:1 compression.
This change always sets the compression output to 8bpp to
minimize the link bandwidth utilization.
Change-Id: Ifa6129444c2bab4e9c357ddfe49f76efa5b04be0
Signed-off-by: Rajkumar Subbiah <rsubbia@codeaurora.org>
Currently edid cache is cleared only in the mst attention callback
flow i.e. if a monitor is plugged in/out of a mst dongle. If mst
dongle is plugged out directly, the edid cache is not cleared.
This change clears the edid cache also during the
connect/disconnect callback.
Change-Id: Icc4b4ca6a59f1ee32f7fe062831a3a19f4ab9f00
Signed-off-by: Sudarsan Ramesh <sudarame@codeaurora.org>
Signed-off-by: Sandeep Gangadharaiah <sandgang@codeaurora.org>
The connector detect function is currently implemented as a
callback from the framework, and creates a context before
calling the detect_port_ctx MST callback. This change updates
the callflow so that the framework calls the new detect_ctx
function in the MST case. This removes the need for creating a
new context before calling further downstream functions.
In addition, references to the mst_connector_get_info
function were replaced by connector_get_info to avoid
redundancy.
Change-Id: I224d09e77fad4b6925a42b1bc912a05e3e4d060a
Signed-off-by: Sudarsan Ramesh <sudarame@codeaurora.org>
This change adds logic to determine dsc switch based on
the connector property "CONNECTOR_PROP_DSC_MODE" and
performs seamless DSC switch if there is any change in
DSC configuration. The connector property is populated
in msm_sub_mode based on which suitable mode is selected.
Change-Id: Ifc4931f16dfb814781bc1d72b103e09103e6bfee
Signed-off-by: Yashwanth <yvulapu@codeaurora.org>
Currently, any edids read by the driver are cached in the
sde_connector object. In the event that subsequent edids are written,
the cached edid is used instead of the newly written edid.
In the event a new edid is written to the edid debugfs node over
dpsim, this change clears the current cached edid before overwriting
the new one.
Change-Id: I53f870e97c3b9ac5954d193f74e4b272386f67a8
Signed-off-by: Sudarsan Ramesh <sudarame@codeaurora.org>
Remove edid/dpcd simulation function from dp_debug and calls to
sim bridge instead to simplify dp_debug module. Also add mst edid
support and mst hpd simulation from aux level.
Move selected mode from dp_debug module to dp_panel module to
simplify mst handling and decouple dp_debug from main dp driver.
Remove custom edid/dpcd mode from dp_panel and dp_aux module.
Remove mst connector list handling from dp_display module.
Change-Id: Ife1d2deb0e353f0a9695b7b90e5bf3459e1c81f7
Signed-off-by: Xiaowen Wu <wxiaowen@codeaurora.org>
Signed-off-by: Karim Henain <khenain@codeaurora.org>
Signed-off-by: Sudarsan Ramesh <sudarame@codeaurora.org>
The modeset lock acquired in dp_mst_connector_detect is not
being released after the detection is completed, which
causes subsequent deadlock.
Added a call to drm_modeset_drop_locks when coming out of
dp_mst_connector_detect.
Change-Id: Ibce79934d0ac23fed4985291c5c6078cb982e812
Signed-off-by: Sudarsan Ramesh <sudarame@codeaurora.org>
Use of drm_display_mode vrefresh is being deprecated in
upstream DRM framework. Downstream driver need to use
drm_mode_vrefresh API from now on.
This change removes dependency on drm_display_mode vrefresh
and replaces it with drm_mode_vrefresh API in SDE, DSI and
DP driver. In addition, it also modifies drm_display_mode clock
to align with upstream approach where an uncompressed mode clock
is required to match drm_mode_vrefresh API.
Change-Id: Ie972a2e140adfd81c4e68df8e7bc69feaaca22e1
Signed-off-by: Nilaan Gunabalachandran <ngunabal@codeaurora.org>
Signed-off-by: Amine Najahi <anajahi@codeaurora.org>
Commit 1c6c1cb5afc7 ("drm/dp_mst: Manually overwrite
PBN divider for calculating timeslots") adds a parameter
enabling PBN divider to be overriden. This change updates
the dp driver to set this to 0, which will not override
by default.
Change-Id: I902acc29508f4d32abd34d616b4024e51ee71fd7
Signed-off-by: Samantha Tran <samtran@codeaurora.org>
Signed-off-by: Nilaan Gunabalachandran <ngunabal@codeaurora.org>
Commit 3f9b3f02dda5 ("drm/dp_mst: Protect drm_dp_mst_port
members with locking") adds locking while detecting mst ports.
This change updates the dp driver to pass in the ctx which
is acquired at that time.
Change-Id: I8e5ba9648494f9b4f8fa3d1654ec22dd2502e0b0
Signed-off-by: Samantha Tran <samtran@codeaurora.org>
Signed-off-by: Nilaan Gunabalachandran <ngunabal@codeaurora.org>
Commit 72dc0f515913 ("drm/dp_mst: Remove
drm_dp_mst_topology_cbs.destroy_connector and
commit a5c4dc165957 ("drm/dp_mst: Remove register_connector callback")
deprecate certain call back APIs in DP MST. This changes updates the
DP driver to remove the APIs and register the connector through
drm_register_connector.
Change-Id: Id553a95b930479c216be1744cce00a943575571e
Signed-off-by: Samantha Tran <samtran@codeaurora.org>
Signed-off-by: Nilaan Gunabalachandran <ngunabal@codeaurora.org>
Commit 62afb4ad425a ("drm/connector: Allow max possible encoders
to attach to a connector") enables additional encoders per
connector through use of a mask rather than encoder ids.
This change updates the driver when looking for an encoder
for the connector to look through the list of all possible encoders.
Change-Id: I69cc7c38cd0a9842ed2f15712feeb3c6b88daadf
Signed-off-by: Samantha Tran <samtran@codeaurora.org>
Signed-off-by: Nilaan Gunabalachandran <ngunabal@codeaurora.org>
Commit a25b988ff83f ("drm/bridge: Extend bridge API to
disable connector creation") and commit ee68c743f8d0 ("drm: Stop
including drm_bridge.h from drm_crtc.h) add additional input flags.
This change adds fixes to the drm bridge attach API and includes
relevant drm_bridge header files.
Change-Id: I85e84eaff7df2995243896108a217fae81716b63
Signed-off-by: Samantha Tran <samtran@codeaurora.org>
Signed-off-by: Nilaan Gunabalachandran <ngunabal@codeaurora.org>
Commit dc48529fb14e ("drm/dp_mst: Add PBN calculation for DSC modes")
adds support for handling fractional bpp values for dsc usecases.
This change sets this to false since the driver uses unadjusted bpp.
Change-Id: I10b4a74fd512c5ffb333f8664effb5efb8ea6c4e
Signed-off-by: Samantha Tran <samtran@codeaurora.org>
Signed-off-by: Nilaan Gunabalachandran <ngunabal@codeaurora.org>
Commit 05193dc38197 ("drm/bridge: Make the bridge chain
a double-linked list") creates a bridge chain linked
list. This change updates the relevant changes to msm
driver to use the list to find the bridge associated to
the encoder.
Change-Id: I59eb2910be96f4fff7bdbeb040d6ad204c41d747
Signed-off-by: Samantha Tran <samtran@codeaurora.org>
Signed-off-by: Nilaan Gunabalachandran <ngunabal@codeaurora.org>
Commit fcf463807596 ("drm/dp_mst: Use full_pbn instead of
available_pbn for bandwidth checks") changes bandwidth checks
to look at the Full PBN bandwidth rather than the available PBN.
This change updates the relevant changes to the dp driver.
Change-Id: I2a713a9b6fd10314bd768331dcea00950b6edf7f
Signed-off-by: Samantha Tran <samtran@codeaurora.org>
Signed-off-by: Nilaan Gunabalachandran <ngunabal@codeaurora.org>
Add support to send PPS command with every frame for DP.
This is needed to satisfy the requirement of certain bridge
chips which need the PPS to be sent every frame.
Change-Id: I8711dff41e60d8b1e1c515a5d34a370a2409ce14
Signed-off-by: Abhinav Kumar <abhinavk@codeaurora.org>
Signed-off-by: Sudarsan Ramesh <sudarame@codeaurora.org>
Currently, in SST mode, sink edid is read once after hpd
and reused on subsequent mode enumeration calls. But in
MST mode, there is no caching and the driver re-reads the
edid from the sink on every get_modes call for each monitor.
Each read takes more than 500ms causing unnecessary delays
during MST enumeration.
This change reads the edid once per hpd and uses the
cached data on subsequent calls.
Change-Id: I27545a44b9f9bd40000dde60735815f9c47fa54c
Signed-off-by: Sudarsan Ramesh <sudarame@codeaurora.org>
This change adds more debug logs and event logs to MST callflows
to help with MST stability issues.
Change-Id: I9053eab5932487fccce522cc17ed2e9fb8d887ab
Signed-off-by: Rajkumar Subbiah <rsubbia@codeaurora.org>
Enhance logging in dp mst functions by adding connector ids to
better identify operations for different streams and add more
trace logs.
Change-Id: Iaf5c67105c7af82fc5118674ddde5aef2319a611
Signed-off-by: Rajkumar Subbiah <rsubbia@codeaurora.org>
A mode switch on a real monitor can be triggered by forcing the new
mode using debugfs and initiating an hpd_irq. Due to a missing
check for simulator state, the current driver calls the hpd_irq
callback for simulator even for a real monitor. This change adds
this check.
Change-Id: I13480eccd27eac2f9df3dd766d0445c0a5ea9b2c
Signed-off-by: Rajkumar Subbiah <rsubbia@codeaurora.org>
DP MST driver registers bridge callback functions with the DRM framework.
mst_lock is used for synchronization of the mst bridge functions. These
functions call into dp_display where a session lock is obtained for
the display. HPD callbacks, on the other hand, are first handled by
dp_display. During these callbacks, dp_display takes a session lock
first before calling into DP MST driver layer. Currently, the DP MST
layer waits on mst_lock which can result in a deadlock.
This change removes the usage of mst_lock inside hpd callback functions
and just uses the session lock for synchronization.
Change-Id: I7ec338004eef43ac0f1e1f092463e9915cd60684
Signed-off-by: Rajkumar Subbiah <rsubbia@codeaurora.org>
The simulation case uses dp_mst_sim_detect_port which
calls the drm detect port function after checking
the mst state. The non simulation case calls the drm
function directly.
This leads to cases in the disconnect path where
connectors are detected while being unregistered.
This solution merges the simulation and non simulation
cases by using the same detect port function, where a
check for mst state is performed before calling the
drm function.
Change-Id: I4a93001131beda54f8146bd50edc036924c94ab1
Signed-off-by: Sudarsan Ramesh <sudarame@codeaurora.org>
When DRM property objects are created, the DRM framework attaches a
dellocator which can eventually free the object when the last reference
is removed from it. The framework can only do this before the driver is
registered. If a property is created after the registration then the
framework is unable to attach a deallocator causing a memory leak during
tear down.
The current DP driver creates a new colorspace property whenever a
new dp connector is initialized. It creates a base connector at probe
time prior to registration. But then it also creates new connectors,
post registration, whenever a new MST dongle is attached to the
topology, causing memory leaks.
This change limits the property creation to the base connector and
attaches the same object to MST connectors to avoid memory leak.
Change-Id: Ib97dc7aac260b4f3f96c1097f58bd276c68501f8
Signed-off-by: Rajkumar Subbiah <rsubbia@codeaurora.org>
On hpd low signaling, if MST is enabled, then the dp driver should
send the uevent to usermode and wait for the displays to be turned
off before destroying the connectors. In the current mst driver,
hpd low handling is a monolithic step. This change breaks this
into two separate callbacks into the mst driver so the display
driver can wait for usermode completion between these two steps.
When processing hpd low in sim mode, the mst driver uses the drm
framework's the port detection function. When hpd unplug is signaled
to the usermode, it checks the port status before disabling it. But
since the port hasn't been destroyed yet, the framework reports that
the port as still connected. This causes the driver to timeout while
waiting for the the displays to be disabled. This change adds a
wrapper which will report the port status as disconnected when hpd
low is signaled.
Change-Id: I1c59a4878018a300f258bd67c36d1cf4eaf5f67b
Signed-off-by: Rajkumar Subbiah <rsubbia@codeaurora.org>
MST simulation ports can be removed either through HPD unplug, which
removes all ports on the branch device or through hpd irq, which
removed individual ports. In the current driver, the mst state
on the topology manager is being cleared prematurely. This results
in incorrect port status values being reported when the usermode
queries the status prior to disabling the corresponding displays.
So in its current state, on a HPD unplug, the display is disabled
but the port objects are not cleaned up and new ports are added
on every replug. On hpd irq, not all references are removed on
the port object and also the connectors are prematurely being
removed from the connector list. Additionally, when the last
port is removed, the mst state is cleared on the topology manager,
which destroys the branch device. Once the branch device is
destroyed, the ports cannot be added anymore and this leaves the
MST driver in an invalid state.
This change adds a new helper to remove the port and update the
connector list. It also moves the clearing of mst state to hpd
disconnect callback where the branch device can be safely destroyed.
Change-Id: I3400006a47cc8ab5876809a19b711e3b26be857c
Signed-off-by: Rajkumar Subbiah <rsubbia@codeaurora.org>
When adding a new MST sim port check if the branch device was
destroyed already to avoid dereferencing a null pointer.
Change-Id: I8e6f82c5a6772a9b85d24feca52368da2027e96d
Signed-off-by: Rajkumar Subbiah <rsubbia@codeaurora.org>
sde_connector_init will return an ERR_PTR if connector
creation failed, so need to use IS_ERR_OR_NULL to check
the return value.
Change-Id: I4fee5a624261898bbd079c54705e6eaebc71bac6
Signed-off-by: Yuan Zhao <yzhao@codeaurora.org>
Current dp_mst_bridge has variables that are accessed by both
check phase and commit phase, which causes racing issues. This
change will add private state to dp_mst_bridge to separate check
phase and commit phase.
Furthermore, this change is a partial rollback of commit 2446602565ec
("drm/msm/dp: add private state to dp_mst_bridge") where active_enc_cnt
is removed. In this change we retain the encoder availability check in
mode_valid.
Change-Id: I8ac05cf5f1755375e4e9f34e42dbaea1d23bac64
Signed-off-by: Xiaowen Wu <wxiaowen@codeaurora.org>
Signed-off-by: Sankeerth Billakanti <sbillaka@codeaurora.org>
The single "port" refcount has been split in 2 on 5.4. MST sim
layer is only getting the topology refcount but never initializes
or obtains references for the memory allocated for this port.
Add the new refcount logic required on 5.4 to MST sim layer.
Change-Id: I6e25c048fa26352c4fb718996514a1ca91432408
Signed-off-by: Steve Cohen <cohens@codeaurora.org>
Signed-off-by: Rajkumar Subbiah <rsubbia@codeaurora.org>
Enable compilation of DP MST feature. Also ported drm mst implementation to
use updated API definitions. Changes to the API include; removal of hotplug
callback; separate refcounting for topology and memory allocation in mst
port; pass the entire port instead of slot count in
atomic_release_vcpi_slots API.
Change-Id: I951c2978339229ea7e124c2addc114ea5d3cbb3d
Signed-off-by: Rajkumar Subbiah <rsubbia@codeaurora.org>
Update the definition of the atomic_check function for
DisplayPort connectors to align with the DRM upstream changes.
Change-Id: Id942c8ef16ae773540c4bc7221e0b784354a527c
Signed-off-by: Tatenda Chipeperekwa <tatendac@codeaurora.org>
As overall display driver is moving away from hard-coded compression
ratios, prepare the DP driver for the same by removing the usage of
the compression ratio enum.
Change-Id: I298db7d20baed8afec9f96dff8c7e950702bfec9
Signed-off-by: Abhinav Kumar <abhinavk@codeaurora.org>
This change enforces dp, dsi and the sde drivers to use the
drm framework defined dsc_config data structure. As a part of this,
it introduces the sde_dsc_helper API to configure the dsc params
and creating a PPS command. Earlier each driver implemented it's
private versions leading to duplication of code. Additionaly the
helper api supports DSC spec 1.2 422 and 420 mode.
Change-Id: I25933fab08cdabbc6787079926885d1a78945e97
Signed-off-by: Abhijit Kulkarni <kabhijit@codeaurora.org>