Skip to content
Snippets Groups Projects
  1. Oct 23, 2018
    • Lyude Paul's avatar
      wip: drm/dp_mst: Add ->pre_enable/->post_disable() hooks · 8b0e7e8f
      Lyude Paul authored
      Some drivers, nouveau in particular, need to perform some hardware setup
      before enabling the MST topology. Ideally, we want this setup to always
      be done whenever topologies are enabled or disabled, even if it's not
      because the driver choose to change the topology state. So, add some
      hooks that get called under the main MST topology manager's lock and
      implement said hooks in nouveau.
      
      TODO: test this works
      8b0e7e8f
    • Lyude Paul's avatar
    • Lyude Paul's avatar
      drm/dp_mst: Don't set mgr->mst_state until topology is ready · c56f09fa
      Lyude Paul authored
      
      Currently we set mgr->mst_state in drm_dp_mst_topology_mgr_set_mst()
      before we have actually performed any operations that could fail,
      meaning that mgr->mst_state will get set even if we fail to setup the
      topology.
      
      Signed-off-by: Lyude Paul's avatarLyude Paul <lyude@redhat.com>
      c56f09fa
    • Lyude Paul's avatar
      drm/nouveau: Stop checking dpcd in nv50_mstm_enable() · a16af064
      Lyude Paul authored
      
      We already check the DPCD in nv50_mstm_detect(), and we also want to be
      able to call this without having to read the DPCD.
      
      Signed-off-by: Lyude Paul's avatarLyude Paul <lyude@redhat.com>
      a16af064
    • Lyude Paul's avatar
      drm/dp_mst: Hide struct drm_dp_mst_port's definition · 5ca26893
      Lyude Paul authored
      
      Seeing as this is not a structure drivers are ever supposed to be
      modifying or looking at anyway, we shouldn't be exposing it to drivers
      because then people will think you are supposed to touch it.
      
      Signed-off-by: Lyude Paul's avatarLyude Paul <lyude@redhat.com>
      5ca26893
    • Lyude Paul's avatar
      drm/amdgpu/dm: Fix race condition in dm_dp_mst_dc_sink_create() · f699b3ce
      Lyude Paul authored
      
      Investigation done, it's NULL because you didn't grab connection_mutex,
      which you need to modify anything within your drm connector structures.
      
      WIP FIXME: test this? probably make amd test this
      
      Signed-off-by: Lyude Paul's avatarLyude Paul <lyude@redhat.com>
      f699b3ce
    • Lyude Paul's avatar
      drm/nouveau: Stop reading port->mgr in nv50_mstc_detect() · e8c007d8
      Lyude Paul authored
      
      Same as the previous commit, but for nv50_mstc_detect() this time.
      
      Signed-off-by: Lyude Paul's avatarLyude Paul <lyude@redhat.com>
      Cc: stable@vger.kernel.org
      e8c007d8
    • Lyude Paul's avatar
      drm/nouveau: Stop reading port->mgr in n50_mstc_get_modes() · 1ae9ac77
      Lyude Paul authored
      
      mstc->port isn't validated here so it could be null or worse when we
      access it. And drivers aren't ever supposed to be looking at it's
      contents anyway. Plus, we can already get the MST manager from
      &mstc->mstm->mgr.
      
      Signed-off-by: Lyude Paul's avatarLyude Paul <lyude@redhat.com>
      Cc: stable@vger.kernel.org
      1ae9ac77
    • Lyude Paul's avatar
      drm/nouveau: Use drm_dp_get_payload_info() for getting payload/vcpi · 06075b56
      Lyude Paul authored
      
      Currently, nouveau tries to go through the drm_dp_mst_port structures
      itself in order to retrieve the relevant payload and VCPI information
      that it needs to report to the GPU. This is wrong: mstc->port could be
      destroyed at any point, and additionally the payload could be changed at
      any point because it doesn't bother trying to grab the payload lock. So;
      remove nv50_msto_payload entirely and use the new
      drm_dp_get_payload_info() helper.
      
      Signed-off-by: Lyude Paul's avatarLyude Paul <lyude@redhat.com>
      06075b56
    • Lyude Paul's avatar
      drm/dp_mst: Add drm_dp_get_payload_info() · 20d01044
      Lyude Paul authored
      
      Some hardware (nvidia hardware in particular) needs to be notified of
      the exact VCPI and payload settings that the topology manager decided on
      for each mstb port. Since there isn't currently any way to get this
      information without going through port (which drivers are very much not
      supposed to do by themselves, ever), let's add one.
      
      Signed-off-by: Lyude Paul's avatarLyude Paul <lyude@redhat.com>
      20d01044
    • Lyude Paul's avatar
      drm/nouveau: Use atomic VCPI helpers for MST · b5916859
      Lyude Paul authored
      
      Currently, nouveau uses the yolo method of setting up MST displays: it
      uses the old VCPI helpers (drm_dp_find_vcpi_slots()) for computing the
      display configuration. These helpers don't take care to make sure they
      take a reference to the mstb port that they're checking, and
      additionally don't actually check whether or not the topology still has
      enough bandwidth to provide the VCPI tokens required.
      
      So, drop usage of the old helpers and move entirely over to the atomic
      helpers.
      
      Signed-off-by: Lyude Paul's avatarLyude Paul <lyude@redhat.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      b5916859
    • Lyude Paul's avatar
      drm/dp_mst: Check payload count in ->atomic_check() · 0184d88d
      Lyude Paul authored
      
      It occurred to me that we never actually check this! So let's start
      doing that.
      
      Signed-off-by: Lyude Paul's avatarLyude Paul <lyude@redhat.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      0184d88d
    • Lyude Paul's avatar
      drm/dp_mst: Start tracking per-port VCPI allocations · 0cbd6765
      Lyude Paul authored
      
      There has been a TODO waiting for quite a long time in
      drm_dp_mst_topology.c:
      
      	/* 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.
      	 */
      
      That's not the only reason we should fix this: forcing the driver to
      track the VCPI allocations throughout a state's atomic check is
      error prone, because it means that extra care has to be taken with the
      order that drm_dp_atomic_find_vcpi_slots() and
      drm_dp_atomic_release_vcpi_slots() are called in in order to ensure
      idempotency. Currently the only driver actually using these helpers,
      i915, doesn't even do this correctly: multiple ->best_encoder() checks
      with i915's current implementation would not be idempotent and would
      over-allocate VCPI slots, something I learned trying to implement
      fallback retraining in MST.
      
      So: simplify this whole mess, and teach drm_dp_atomic_find_vcpi_slots()
      and drm_dp_atomic_release_vcpi_slots() to track the VCPI allocations for
      each port. This allows us to ensure idempotency without having to rely
      on the driver as much. Additionally: the driver doesn't need to do any
      kind of VCPI slot tracking anymore if it doesn't need it for it's own
      internal state.
      
      Additionally; this moves the code for checking whether or not the
      VCPI allocations in the atomic state are valid into the new
      ->atomic_check() hook for private objects, so we can ensure that we only
      check the final VCPI allocation that would be incurred by the new state
      and not the mid-check VCPI allocations. This prevents us from failing
      checks which end up allocating VCPI slots to ports before freeing any of
      the VCPI slots allocated by ports which are about to be disabled.
      
      Also: update the documentation and make it more obvious that these
      /must/ be called by /all/ atomic drivers supporting MST.
      
      Signed-off-by: Lyude Paul's avatarLyude Paul <lyude@redhat.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      0cbd6765
    • Lyude Paul's avatar
      drm/atomic: Add ->atomic_check() hook for private objects · 3df41efe
      Lyude Paul authored
      
      Currently; private objects are mostly used just for driver-specific
      atomic state, but not entirely. MST also uses private objects for
      holding it's atomic state, but in order to make our MST helpers safer
      for atomic we need to be able to check that state after the driver has
      performed it's own checks on the atomic state. So, add an optional
      ->atomic_check() callback into drm_private_state_funcs that gets called
      after the driver's atomic checks.
      
      Signed-off-by: Lyude Paul's avatarLyude Paul <lyude@redhat.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      3df41efe
    • Lyude Paul's avatar
      drm/dp_mst: Remove all evil duplicate state pointers · 278b5761
      Lyude Paul authored
      
      There's no reason to track the atomic state three times. Unfortunately,
      this is currently what we're doing, and even worse is that there is only
      one actually correct state pointer: the one in mst_state->base.state.
      mgr->state never seems to be used, along with the one in
      mst_state->state.
      
      This confused me for over 4 hours until I realized there was no magic
      behind these pointers. So, let's save everyone else from the trouble.
      
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com&gt;.>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      278b5761
    • Lyude Paul's avatar
      drm/dp_mst: Fix indentation in drm_dp_atomic_find_vcpi_slots() · 845669dc
      Lyude Paul authored
      
      No functional changes
      
      Signed-off-by: Lyude Paul's avatarLyude Paul <lyude@redhat.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      845669dc
  2. Oct 18, 2018
Loading