mirror of
https://github.com/torvalds/linux.git
synced 2025-01-01 15:51:46 +00:00
drm/dp_mst: Add helper to determine if an MST port is downstream of another port
Add drm_dp_mst_port_downstream_of_parent() required by the i915 driver in a follow-up patch to resolve a BW overallocation of MST streams going through a given MST port. Cc: Lyude Paul <lyude@redhat.com> Cc: dri-devel@lists.freedesktop.org Reviewed-by: Lyude Paul <lyude@redhat.com> Acked-by: Maxime Ripard <mripard@kernel.org> Signed-off-by: Imre Deak <imre.deak@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20231030155843.2251023-4-imre.deak@intel.com
This commit is contained in:
parent
7707dd6022
commit
9dcf67deea
@ -5126,6 +5126,58 @@ static bool drm_dp_mst_port_downstream_of_branch(struct drm_dp_mst_port *port,
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool
|
||||
drm_dp_mst_port_downstream_of_parent_locked(struct drm_dp_mst_topology_mgr *mgr,
|
||||
struct drm_dp_mst_port *port,
|
||||
struct drm_dp_mst_port *parent)
|
||||
{
|
||||
if (!mgr->mst_primary)
|
||||
return false;
|
||||
|
||||
port = drm_dp_mst_topology_get_port_validated_locked(mgr->mst_primary,
|
||||
port);
|
||||
if (!port)
|
||||
return false;
|
||||
|
||||
if (!parent)
|
||||
return true;
|
||||
|
||||
parent = drm_dp_mst_topology_get_port_validated_locked(mgr->mst_primary,
|
||||
parent);
|
||||
if (!parent)
|
||||
return false;
|
||||
|
||||
if (!parent->mstb)
|
||||
return false;
|
||||
|
||||
return drm_dp_mst_port_downstream_of_branch(port, parent->mstb);
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_dp_mst_port_downstream_of_parent - check if a port is downstream of a parent port
|
||||
* @mgr: MST topology manager
|
||||
* @port: the port being looked up
|
||||
* @parent: the parent port
|
||||
*
|
||||
* The function returns %true if @port is downstream of @parent. If @parent is
|
||||
* %NULL - denoting the root port - the function returns %true if @port is in
|
||||
* @mgr's topology.
|
||||
*/
|
||||
bool
|
||||
drm_dp_mst_port_downstream_of_parent(struct drm_dp_mst_topology_mgr *mgr,
|
||||
struct drm_dp_mst_port *port,
|
||||
struct drm_dp_mst_port *parent)
|
||||
{
|
||||
bool ret;
|
||||
|
||||
mutex_lock(&mgr->lock);
|
||||
ret = drm_dp_mst_port_downstream_of_parent_locked(mgr, port, parent);
|
||||
mutex_unlock(&mgr->lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_dp_mst_port_downstream_of_parent);
|
||||
|
||||
static int
|
||||
drm_dp_mst_atomic_check_port_bw_limit(struct drm_dp_mst_port *port,
|
||||
struct drm_dp_mst_topology_state *state);
|
||||
|
@ -892,6 +892,9 @@ drm_atomic_get_new_mst_topology_state(struct drm_atomic_state *state,
|
||||
struct drm_dp_mst_atomic_payload *
|
||||
drm_atomic_get_mst_payload_state(struct drm_dp_mst_topology_state *state,
|
||||
struct drm_dp_mst_port *port);
|
||||
bool drm_dp_mst_port_downstream_of_parent(struct drm_dp_mst_topology_mgr *mgr,
|
||||
struct drm_dp_mst_port *port,
|
||||
struct drm_dp_mst_port *parent);
|
||||
int __must_check
|
||||
drm_dp_atomic_find_time_slots(struct drm_atomic_state *state,
|
||||
struct drm_dp_mst_topology_mgr *mgr,
|
||||
|
Loading…
Reference in New Issue
Block a user