Adding driver-private objects to atomic state
Subsystems (3)
v8 cover Adding driver-private objects to atomic state
Resending for CI.
Pandiyan, Dhinakaran (4):
drm: Add driver-private objects to atomic state
drm/dp: Introduce MST topology state to track available link bandwidth drm/dp: Add DP MST helpers to atomically find and release vcpi slots drm/dp: Track MST link bandwidth
drivers/gpu/drm/drm_atomic.c | 65 +++++++++++++++ drivers/gpu/drm/drm_atomic_helper.c | 5 ++ drivers/gpu/drm/drm_dp_mst_topology.c | 150 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_dp_mst.c | 48 +++++++++-- include/drm/drm_atomic.h | 95 +++++++++++++++++++++ include/drm/drm_dp_mst_helper.h | 26 ++++++ 6 files changed, 383 insertions(+), 6 deletions(-)
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH RESEND v8 1/4 drm: Add driver-private objects to atomic state
From: "Pandiyan, Dhinakaran" <[email protected]>
It is necessary to track states for objects other than connector, crtc and plane for atomic modesets. But adding objects like DP MST link bandwidth to drm_atomic_state would mean that a non-core object will be modified by the core helper functions for swapping and clearing it's state. So, lets add void * objects and helper functions that operate on void * types to keep these objects and states private to the core. Drivers can then implement specific functions to swap and clear states. The other advantage having just void * for these objects in drm_atomic_state is that objects of different types can be managed in the same state array.
v7: Use __for_each_private_obj to define for_each_private_obj (Maarten)
v6: More kernel-doc to keep 0-day happy
v5: Remove more NULL checks (Maarten)
v4: Avoid redundant NULL checks when private_objs array is empty (Maarten)
v3: Macro alignment (Chris)
v2: Added docs and new iterator to filter private objects (Daniel)
--- drivers/gpu/drm/drm_atomic.c | 65 +++++++++++++++++++++++++ drivers/gpu/drm/drm_atomic_helper.c | 5 ++ include/drm/drm_atomic.h | 95 +++++++++++++++++++++++++++++++++++++ 3 files changed, 165 insertions(+)
drivers/gpu/drm/drm_atomic.c +65 -0
@@ -57,6 +57,7 @@ void drm_atomic_state_default_release(struct drm_atomic_state *state)kfree (state->connectors);kfree (state->crtcs);kfree (state->planes); +kfree (state->private_objs); }EXPORT_SYMBOL (drm_atomic_state_default_release);
@@ -184,6 +185,17 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state) state->planes[i].ptr =NULL ; state->planes[i].state =NULL ; } + +for (i =0 ; i < state->num_private_objs; i++) { +void *obj_state = state->private_objs[i].obj_state; + + state->private_objs[i].funcs->destroy_state (obj_state); + state->private_objs[i].obj =NULL ; + state->private_objs[i].obj_state =NULL ; + state->private_objs[i].funcs =NULL ; + } + state->num_private_objs =0 ; + }EXPORT_SYMBOL (drm_atomic_state_default_clear);
@@ -978,6 +990,59 @@ static void drm_atomic_plane_print_state(struct drm_printer *p, }/** +* drm_atomic_get_private_obj_state - get private object state +* @state: global atomic state +* @obj: private object to get the state for +* @funcs: pointer to the struct of function pointers that identify the object +* type +* +* This function returns the private object state for the given private object, +* allocating the state if needed. It does not grab any locks as the caller is +* expected to care of any required locking. +* +* RETURNS: +* +* Either the allocated state or the error code encoded into a pointer. +*/ +void * +drm_atomic_get_private_obj_state (struct drm_atomic_state *state,void *obj, +const struct drm_private_state_funcs *funcs) +{ +int index, num_objs, i; +size_t size; +struct __drm_private_objs_state *arr; + +for (i =0 ; i < state->num_private_objs; i++) +if (obj == state->private_objs[i].obj && + state->private_objs[i].obj_state) +return state->private_objs[i].obj_state; + + num_objs = state->num_private_objs +1 ; + size =sizeof (*state->private_objs) * num_objs; + arr =krealloc (state->private_objs, size,GFP_KERNEL ); +if (!arr) +return ERR_PTR (-ENOMEM ); + + state->private_objs = arr; + index = state->num_private_objs; +memset (&state->private_objs[index],0 ,sizeof (*state->private_objs)); + + state->private_objs[index].obj_state = funcs->duplicate_state (state, obj); +if (!state->private_objs[index].obj_state) +return ERR_PTR (-ENOMEM ); + + state->private_objs[index].obj = obj; + state->private_objs[index].funcs = funcs; + state->num_private_objs = num_objs; + +DRM_DEBUG_ATOMIC ("Added new private object state %p to %p\n" , + state->private_objs[index].obj_state, state); + +return state->private_objs[index].obj_state; +} +EXPORT_SYMBOL (drm_atomic_get_private_obj_state); + +/** * drm_atomic_get_connector_state - get connector state * @state: global atomic state object * @connector: connector to get state object for
drivers/gpu/drm/drm_atomic_helper.c +5 -0
@@ -2032,6 +2032,8 @@ void drm_atomic_helper_swap_state(struct drm_atomic_state *state,struct drm_plane *plane;struct drm_plane_state *old_plane_state, *new_plane_state;struct drm_crtc_commit *commit; +void *obj, *obj_state; +const struct drm_private_state_funcs *funcs;if (stall) {for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) {
@@ -2092,6 +2094,9 @@ void drm_atomic_helper_swap_state(struct drm_atomic_state *state, state->planes[i].state = old_plane_state; plane->state = new_plane_state; } + +__for_each_private_obj (state, obj, obj_state, i, funcs) + funcs->swap_state (obj, &state->private_objs[i].obj_state); }EXPORT_SYMBOL (drm_atomic_helper_swap_state);
include/drm/drm_atomic.h +95 -0
125 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH RESEND v8 2/4 drm/dp: Introduce MST topology state to track available link bandwidth
In reply to Dhinakaran PandiyanFrom: "Pandiyan, Dhinakaran" <[email protected]>
Link bandwidth is shared between multiple display streams in DP MST configurations. The DP MST topology manager structure maintains the shared link bandwidth for a primary link directly connected to the GPU. For atomic modesetting drivers, checking if there is sufficient link bandwidth for a mode needs to be done during the atomic_check phase to avoid failed modesets. Let's encapsulate the available link bw information in a private state structure so that bw can be allocated and released atomically for each of the ports sharing the primary link.
v3: WARN_ON() if connection_mutex is not held (Archit)
v2: Included kernel doc, moved state initialization and switched to kmemdup() for allocation (Daniel)
--- drivers/gpu/drm/drm_dp_mst_topology.c | 75 +++++++++++++++++++++++++++++++++++ include/drm/drm_dp_mst_helper.h | 20 ++++++++++ 2 files changed, 95 insertions(+)
drivers/gpu/drm/drm_dp_mst_topology.c +75 -0
@@ -2936,6 +2936,69 @@ static void drm_dp_destroy_connector_work(struct work_struct *work) (*mgr->cbs->hotplug)(mgr); } +void *drm_dp_mst_duplicate_state (struct drm_atomic_state *state,void *obj) +{ +struct drm_dp_mst_topology_mgr *mgr = obj; +struct drm_dp_mst_topology_state *new_mst_state; + +if (WARN_ON (!mgr->state)) +return NULL ; + + new_mst_state =kmemdup (mgr->state,sizeof (*new_mst_state),GFP_KERNEL ); +if (new_mst_state) + new_mst_state->state = state; +return new_mst_state; +} + +void drm_dp_mst_swap_state (void *obj,void **obj_state_ptr) +{ +struct drm_dp_mst_topology_mgr *mgr = obj; +struct drm_dp_mst_topology_state **topology_state_ptr; + + topology_state_ptr = (struct drm_dp_mst_topology_state **)obj_state_ptr; + + mgr->state->state = (*topology_state_ptr)->state; +swap (*topology_state_ptr, mgr->state); + mgr->state->state =NULL ; +} + +void drm_dp_mst_destroy_state (void *obj_state) +{ +kfree (obj_state); +} + +static const struct drm_private_state_funcs mst_state_funcs = { + .duplicate_state = drm_dp_mst_duplicate_state, + .swap_state = drm_dp_mst_swap_state, + .destroy_state = drm_dp_mst_destroy_state, +}; + +/** +* drm_atomic_get_mst_topology_state: get MST topology state +* +* @state: global atomic state +* @mgr: MST topology manager, also the private object in this case +* +* This function wraps drm_atomic_get_priv_obj_state() passing in the MST atomic +* state vtable so that the private object state returned is that of a MST +* topology object. Also, drm_atomic_get_private_obj_state() expects the caller +* to care of the locking, so warn if don't hold the connection_mutex. +* +* RETURNS: +* +* The MST topology state or error pointer. +*/ +struct drm_dp_mst_topology_state *drm_atomic_get_mst_topology_state (struct drm_atomic_state *state, +struct drm_dp_mst_topology_mgr *mgr) +{ +struct drm_device *dev = mgr->dev; + +WARN_ON (!drm_modeset_is_locked (&dev->mode_config.connection_mutex)); +return drm_atomic_get_private_obj_state (state, mgr, + &mst_state_funcs); +} +EXPORT_SYMBOL (drm_atomic_get_mst_topology_state); +/** * drm_dp_mst_topology_mgr_init - initialise a topology manager * @mgr: manager struct to initialise
@@ -2980,6 +3043,15 @@ int drm_dp_mst_topology_mgr_init(struct drm_dp_mst_topology_mgr *mgr,if (test_calc_pbn_mode () <0 )DRM_ERROR ("MST PBN self-test failed\n" ); + mgr->state =kzalloc (sizeof (*mgr->state),GFP_KERNEL ); +if (mgr->state ==NULL ) +return -ENOMEM ; + mgr->state->mgr = mgr; + +/* max. time slots - one slot for MTP header */ + mgr->state->avail_slots =63 ; + mgr->funcs = &mst_state_funcs; +return 0 ; }EXPORT_SYMBOL (drm_dp_mst_topology_mgr_init);
@@ -3000,6 +3072,9 @@ void drm_dp_mst_topology_mgr_destroy(struct drm_dp_mst_topology_mgr *mgr)mutex_unlock (&mgr->payload_lock); mgr->dev =NULL ; mgr->aux =NULL ; +kfree (mgr->state); + mgr->state =NULL ; + mgr->funcs =NULL ; }EXPORT_SYMBOL (drm_dp_mst_topology_mgr_destroy);
include/drm/drm_dp_mst_helper.h +20 -0
@@ -24,6 +24,7 @@#include <linux/types.h> #include <drm/drm_dp_helper.h> +#include <drm/drm_atomic.h> struct drm_dp_mst_branch ;
@@ -403,6 +404,12 @@ struct drm_dp_payload {int vcpi; }; +struct drm_dp_mst_topology_state { +int avail_slots; +struct drm_atomic_state *state; +struct drm_dp_mst_topology_mgr *mgr; +}; +/** * struct drm_dp_mst_topology_mgr - DisplayPort MST manager *
@@ -481,6 +488,16 @@ struct drm_dp_mst_topology_mgr {int pbn_div;/** +* @state: State information for topology manager +*/ +struct drm_dp_mst_topology_state *state; + +/** +* @funcs: Atomic helper callbacks +*/ +const struct drm_private_state_funcs *funcs; + +/** * @qlock: protects @tx_msg_downq, the &drm_dp_mst_branch.txslost and * &drm_dp_sideband_msg_tx.state once they are queued */
@@ -596,4 +613,7 @@ void drm_dp_mst_dump_topology(struct seq_file *m,void drm_dp_mst_topology_mgr_suspend (struct drm_dp_mst_topology_mgr *mgr);int drm_dp_mst_topology_mgr_resume (struct drm_dp_mst_topology_mgr *mgr); +struct drm_dp_mst_topology_state *drm_atomic_get_mst_topology_state (struct drm_atomic_state *state, +struct drm_dp_mst_topology_mgr *mgr); +#endif
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH RESEND v8 3/4 drm/dp: Add DP MST helpers to atomically find and release vcpi slots
In reply to Dhinakaran PandiyanFrom: "Pandiyan, Dhinakaran" <[email protected]>
drm_dp_atomic_find_vcpi_slots() should be called from ->atomic_check() to check there are sufficient vcpi slots for a mode and to add that to the state. This should be followed by a call to drm_dp_mst_allocate_vcpi() in ->atomic_commit() to initialize a struct vcpi for the port.
drm_dp_atomic_release_vcpi_slots() should be called from ->atomic_check() to release a port's vcpi slot allocation from the state.
Drivers that do not make use of this atomic helper are expected to call drm_dp_find_vcpi_slots() instead before calling drm_dp_mst_allocate_vcpi().
v3: drm_dp_atomic_release_vcpi_slots() now needs to know how many slots
to release as we may not have a valid reference to port.
v2:
Added checks for verifying the port reference is valid
Moved get_mst_topology_state() into the helpers (Daniel) Changed find_vcpi_slots() to not depend on current allocation
--- drivers/gpu/drm/drm_dp_mst_topology.c | 75 +++++++++++++++++++++++++++++++++++ include/drm/drm_dp_mst_helper.h | 6 +++ 2 files changed, 81 insertions(+)
drivers/gpu/drm/drm_dp_mst_topology.c +75 -0
@@ -2498,6 +2498,81 @@ static int drm_dp_init_vcpi(struct drm_dp_mst_topology_mgr *mgr, }/** +* drm_dp_atomic_find_vcpi_slots() - Find and add vcpi slots to the state +* @state: global atomic state +* @mgr: MST topology manager for the port +* @port: port to find vcpi slots for +* @pbn: bandwidth required for the mode in PBN +* +* RETURNS: +* Total slots in the atomic state assigned for this port or error +*/ +int drm_dp_atomic_find_vcpi_slots (struct drm_atomic_state *state, +struct drm_dp_mst_topology_mgr *mgr, +struct drm_dp_mst_port *port,int pbn) +{ +struct drm_dp_mst_topology_state *topology_state; +int req_slots; + + topology_state =drm_atomic_get_mst_topology_state (state, mgr); +if (topology_state ==NULL ) +return -ENOMEM ; + + port =drm_dp_get_validated_port_ref (mgr, port); +if (port ==NULL ) +return -EINVAL ; + req_slots =DIV_ROUND_UP (pbn, mgr->pbn_div); +DRM_DEBUG_KMS ("vcpi slots req=%d, avail=%d\n" , + req_slots, topology_state->avail_slots); + +if (req_slots > topology_state->avail_slots) { +drm_dp_put_port (port); +return -ENOSPC ; + } + + topology_state->avail_slots -= req_slots; +DRM_DEBUG_KMS ("vcpi slots avail=%d" , topology_state->avail_slots); + +drm_dp_put_port (port); +return req_slots; +} +EXPORT_SYMBOL (drm_dp_atomic_find_vcpi_slots); + +/** +* drm_dp_atomic_release_vcpi_slots() - Release allocated vcpi slots +* @state: global atomic state +* @mgr: MST topology manager for the port +* @slots: number of vcpi slots to release +* +* RETURNS: +* 0 if @slots were added back to &drm_dp_mst_topology_state->avail_slots or +* negative error code +*/ +int drm_dp_atomic_release_vcpi_slots (struct drm_atomic_state *state, +struct drm_dp_mst_topology_mgr *mgr, +int slots) +{ +struct drm_dp_mst_topology_state *topology_state; + + topology_state =drm_atomic_get_mst_topology_state (state, mgr); +if (topology_state ==NULL ) +return -ENOMEM ; + +/* We cannot rely on port->vcpi.num_slots to update +* topology_state->avail_slots as the port may not exist if the parent +* branch device was unplugged. This should be fixed by tracking +* per-port slot allocation in drm_dp_mst_topology_state instead of +* depending on the caller to tell us how many slots to release. +*/ + topology_state->avail_slots += slots; +DRM_DEBUG_KMS ("vcpi slots released=%d, avail=%d\n" , + slots, topology_state->avail_slots); + +return 0 ; +} +EXPORT_SYMBOL (drm_dp_atomic_release_vcpi_slots); + +/** * drm_dp_mst_allocate_vcpi() - Allocate a virtual channel * @mgr: manager for this port * @port: port to allocate a virtual channel for.
include/drm/drm_dp_mst_helper.h +6 -0
@@ -615,5 +615,11 @@ void drm_dp_mst_topology_mgr_suspend(struct drm_dp_mst_topology_mgr *mgr);int drm_dp_mst_topology_mgr_resume (struct drm_dp_mst_topology_mgr *mgr);struct drm_dp_mst_topology_state *drm_atomic_get_mst_topology_state (struct drm_atomic_state *state,struct drm_dp_mst_topology_mgr *mgr); +int drm_dp_atomic_find_vcpi_slots (struct drm_atomic_state *state, +struct drm_dp_mst_topology_mgr *mgr, +struct drm_dp_mst_port *port,int pbn); +int drm_dp_atomic_release_vcpi_slots (struct drm_atomic_state *state, +struct drm_dp_mst_topology_mgr *mgr, +int slots);#endif
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH RESEND v8 4/4 drm/dp: Track MST link bandwidth
In reply to Dhinakaran PandiyanFrom: "Pandiyan, Dhinakaran" <[email protected]>
Use the added helpers to track MST link bandwidth for atomic modesets. Link bw is acquired in the ->atomic_check() phase when CRTCs are being enabled with drm_atomic_find_vcpi_slots(). Similarly, link bw is released during ->atomic_check() with the connector helper callback ->atomic_check() when CRTCs are disabled.
v6: active_changed does not alter vcpi allocations (Maarten)
v5: Implement connector->atomic_check() in place of atomic_release()
v4: Return an int from intel_dp_mst_atomic_release() (Maarten) v3:
Handled the case where ->atomic_release() is called more than once during an atomic_check() for the same state.
v2:
Squashed atomic_release() implementation and caller (Daniel) Fixed logic for connector-crtc switching case (Daniel) Fixed logic for suspend-resume case.
--- drivers/gpu/drm/i915/intel_dp_mst.c | 48 ++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_dp_mst.c +42 -6
@@ -39,7 +39,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,struct intel_dp *intel_dp = &intel_dig_port->dp;struct intel_connector *connector =to_intel_connector (conn_state->connector); -struct drm_atomic_state *state; +struct drm_atomic_state *state = pipe_config->base.state;int bpp;int lane_count, slots;const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
@@ -57,20 +57,24 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,* seem to suggest we should do otherwise. */ lane_count =intel_dp_max_lane_count (intel_dp); - pipe_config->lane_count = lane_count; pipe_config->pipe_bpp = bpp; - pipe_config->port_clock =intel_dp_max_link_rate (intel_dp); - state = pipe_config->base.state; + pipe_config->port_clock =intel_dp_max_link_rate (intel_dp);if (drm_dp_mst_port_has_audio (&intel_dp->mst_mgr, connector->port)) pipe_config->has_audio = true; - mst_pbn =drm_dp_calc_pbn_mode (adjusted_mode->crtc_clock, bpp); + mst_pbn =drm_dp_calc_pbn_mode (adjusted_mode->crtc_clock, bpp); pipe_config->pbn = mst_pbn; - slots =drm_dp_find_vcpi_slots (&intel_dp->mst_mgr, mst_pbn); + + slots =drm_dp_atomic_find_vcpi_slots (state, &intel_dp->mst_mgr, + connector->port, mst_pbn); +if (slots <0 ) { +DRM_DEBUG_KMS ("failed finding vcpi slots:%d\n" , slots); +return false; + } intel_link_compute_m_n(bpp, lane_count, adjusted_mode->crtc_clock,
@@ -80,7 +84,38 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, pipe_config->dp_m_n.tu = slots;return true; +} +static int intel_dp_mst_atomic_check (struct drm_connector *connector, +struct drm_connector_state *new_conn_state) +{ +struct drm_atomic_state *state = new_conn_state->state; +struct drm_connector_state *old_conn_state; +struct drm_crtc *old_crtc; +struct drm_crtc_state *crtc_state; +int slots, ret =0 ; + + old_conn_state =drm_atomic_get_old_connector_state (state, connector); + old_crtc = old_conn_state->crtc; +if (!old_crtc) +return ret; + + crtc_state =drm_atomic_get_new_crtc_state (state, old_crtc); + slots =to_intel_crtc_state (crtc_state)->dp_m_n.tu; +if (drm_atomic_crtc_needs_modeset (crtc_state) && slots >0 ) { +struct drm_dp_mst_topology_mgr *mgr; +struct drm_encoder *old_encoder; + + old_encoder = old_conn_state->best_encoder; + mgr = &enc_to_mst (old_encoder)->primary->dp.mst_mgr; + + ret =drm_dp_atomic_release_vcpi_slots (state, mgr, slots); +if (ret) +DRM_DEBUG_KMS ("failed releasing %d vcpi slots:%d\n" , slots, ret); +else +to_intel_crtc_state (crtc_state)->dp_m_n.tu =0 ; + } +return ret; } static void intel_mst_disable_dp(struct intel_encoder *encoder,
@@ -378,6 +413,7 @@ static const struct drm_connector_helper_funcs intel_dp_mst_connector_helper_fun .mode_valid = intel_dp_mst_mode_valid, .atomic_best_encoder = intel_mst_atomic_best_encoder, .best_encoder = intel_mst_best_encoder, + .atomic_check = intel_dp_mst_atomic_check, };static void intel_dp_mst_encoder_destroy (struct drm_encoder *encoder)
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RESEND FOR CI PATCH v8 4/4] drm/dp: Track MST link bandwidth
Quoted 25 lines · Dhinakaran Pandiyan
From: "Pandiyan, Dhinakaran" <[email protected]>
Use the added helpers to track MST link bandwidth for atomic modesets. Link bw is acquired in the ->atomic_check() phase when CRTCs are being enabled with
drm_atomic_find_vcpi_slots(). Similarly, link bw is released during ->atomic_check() with the connector helper callback ->atomic_check() when CRTCs are disabled.v6:
active_changeddoes not alter vcpi allocations (Maarten)
v5: Implementconnector->atomic_check()in place ofatomic_release()
v4: Return an int fromintel_dp_mst_atomic_release()(Maarten) v3:
Handled the case where ->atomic_release() is called more than once during anatomic_check()for the same state.
v2:
Squashedatomic_release()implementation and caller (Daniel) Fixed logic for connector-crtc switching case (Daniel) Fixed logic for suspend-resume case.Cc Daniel Vetter <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Archit Taneja <[email protected]>Cc Chris Wilson <[email protected]>Cc Harry Wentland <[email protected]>
Quoted 6 lines
Acked-by Harry Wentland <[email protected]>Reviewed-by Maarten Lankhorst <[email protected]>Signed-off-by Dhinakaran Pandiyan <[email protected]>--- drivers/gpu/drm/i915/intel_dp_mst.c | 48 ++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 6 deletions(-)
This only touches i915 code, the prefix for the patch title should be drm/i915 or drm/i915/dp, not drm/dp. drm/dp is only for core dp code shared among drivers.
-Daniel
Quoted 98 lines
drivers/gpu/drm/i915/intel_dp_mst.c +42
-6@@ -39,7 +39,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,struct intel_dp *intel_dp = &intel_dig_port->dp;struct intel_connector *connector =to_intel_connector (conn_state->connector); -struct drm_atomic_state *state; +struct drm_atomic_state *state = pipe_config->base.state;int bpp;int lane_count, slots;const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;@@ -57,20 +57,24 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,* seem to suggest we should do otherwise. */ lane_count =intel_dp_max_lane_count (intel_dp); - pipe_config->lane_count = lane_count; pipe_config->pipe_bpp = bpp; - pipe_config->port_clock =intel_dp_max_link_rate (intel_dp); - state = pipe_config->base.state; + pipe_config->port_clock =intel_dp_max_link_rate (intel_dp);if (drm_dp_mst_port_has_audio (&intel_dp->mst_mgr, connector->port)) pipe_config->has_audio = true; - mst_pbn =drm_dp_calc_pbn_mode (adjusted_mode->crtc_clock, bpp); + mst_pbn =drm_dp_calc_pbn_mode (adjusted_mode->crtc_clock, bpp); pipe_config->pbn = mst_pbn; - slots =drm_dp_find_vcpi_slots (&intel_dp->mst_mgr, mst_pbn); + + slots =drm_dp_atomic_find_vcpi_slots (state, &intel_dp->mst_mgr, + connector->port, mst_pbn); +if (slots <0 ) { +DRM_DEBUG_KMS ("failed finding vcpi slots:%d\n" , slots); +return false; + } intel_link_compute_m_n(bpp, lane_count, adjusted_mode->crtc_clock,@@ -80,7 +84,38 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, pipe_config->dp_m_n.tu = slots;return true; +} +static int intel_dp_mst_atomic_check (struct drm_connector *connector, +struct drm_connector_state *new_conn_state) +{ +struct drm_atomic_state *state = new_conn_state->state; +struct drm_connector_state *old_conn_state; +struct drm_crtc *old_crtc; +struct drm_crtc_state *crtc_state; +int slots, ret =0 ; + + old_conn_state =drm_atomic_get_old_connector_state (state, connector); + old_crtc = old_conn_state->crtc; +if (!old_crtc) +return ret; + + crtc_state =drm_atomic_get_new_crtc_state (state, old_crtc); + slots =to_intel_crtc_state (crtc_state)->dp_m_n.tu; +if (drm_atomic_crtc_needs_modeset (crtc_state) && slots >0 ) { +struct drm_dp_mst_topology_mgr *mgr; +struct drm_encoder *old_encoder; + + old_encoder = old_conn_state->best_encoder; + mgr = &enc_to_mst (old_encoder)->primary->dp.mst_mgr; + + ret =drm_dp_atomic_release_vcpi_slots (state, mgr, slots); +if (ret) +DRM_DEBUG_KMS ("failed releasing %d vcpi slots:%d\n" , slots, ret); +else +to_intel_crtc_state (crtc_state)->dp_m_n.tu =0 ; + } +return ret; } static void intel_mst_disable_dp(struct intel_encoder *encoder,@@ -378,6 +413,7 @@ static const struct drm_connector_helper_funcs intel_dp_mst_connector_helper_fun .mode_valid = intel_dp_mst_mode_valid, .atomic_best_encoder = intel_mst_atomic_best_encoder, .best_encoder = intel_mst_best_encoder, + .atomic_check = intel_dp_mst_atomic_check, };static void intel_dp_mst_encoder_destroy (struct drm_encoder *encoder)Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for Adding driver-private objects to atomic state
In reply to Dhinakaran Pandiyan== Series Details ==
== Series Details ==
Series: Adding driver-private objects to atomic state
URL : https://patchwork.freedesktop.org/series/23775/
State : success
== Summary ==
Series 23775v1 Adding driver-private objects to atomic state
https://patchwork.freedesktop.org/api/1.0/series/23775/revisions/1/mbox/
Test gvt_basic:
Subgroup invalid-placeholder-test:
skip -> INCOMPLETE (fi-hsw-4770r) fdo#100256fdo#100256 https://bugs.freedesktop.org/show_bug.cgi?id=100256
fi-bdw-5557u total:278 pass:267 dwarn:0 dfail:0 fail:0 skip:11 time:431s fi-bdw-gvtdvm total:278 pass:256 dwarn:8 dfail:0 fail:0 skip:14 time:434s fi-bsw-n3050 total:278 pass:242 dwarn:0 dfail:0 fail:0 skip:36 time:566s fi-bxt-j4205 total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time:507s fi-bxt-t5700 total:278 pass:258 dwarn:0 dfail:0 fail:0 skip:20 time:544s fi-byt-j1900 total:278 pass:254 dwarn:0 dfail:0 fail:0 skip:24 time:485s fi-byt-n2820 total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:486s fi-hsw-4770 total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:410s fi-hsw-4770r total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:15 fi-ilk-650 total:278 pass:228 dwarn:0 dfail:0 fail:0 skip:50 time:414s fi-ivb-3520m total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:492s fi-ivb-3770 total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:467s fi-kbl-7500u total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:456s fi-kbl-7560u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:671s fi-skl-6260u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:457s fi-skl-6700hq total:278 pass:261 dwarn:0 dfail:0 fail:0 skip:17 time:577s fi-skl-6700k total:278 pass:256 dwarn:4 dfail:0 fail:0 skip:18 time:461s fi-skl-6770hq total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:488s fi-snb-2520m total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:529s fi-snb-2600 total:278 pass:249 dwarn:0 dfail:0 fail:0 skip:29 time:409s
fi-skl-gvtdvm failed to collect. IGT log at Patchwork_4588/fi-skl-gvtdvm/igt.log
1d490e4b6d5324cfbf8dc800cf4a99471252802c drm-tip: 2017y-04m-28d-14h-14m-47s UTC integration manifest 0e053d7 drm/dp: Track MST link bandwidth
e47590e drm/dp: Add DP MST helpers to atomically find and release vcpi slots
57ae56a drm/dp: Introduce MST topology state to track available link bandwidth 969f6f6 drm: Add driver-private objects to atomic state
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4588/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx