1. 22 5月, 2020 5 次提交
    • L
      drm/nouveau/kms/nv50-: Move 8BPC limit for MST into nv50_mstc_get_modes() · bbdf6a58
      Lyude Paul 提交于
      This just limits the BPC for MST connectors to a maximum of 8 from
      nv50_mstc_get_modes(), instead of doing so during
      nv50_msto_atomic_check(). This doesn't introduce any functional changes
      yet (other then userspace now lying about the max bpc, but we can't
      support that yet anyway so meh). But, we'll need this in a moment so
      that we can share mode validation between SST and MST which will fix
      some real world issues.
      Signed-off-by: NLyude Paul <lyude@redhat.com>
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      bbdf6a58
    • L
      drm/nouveau/kms/nv50-: Probe SOR and PIOR caps for DP interlacing support · 4a2cb418
      Lyude Paul 提交于
      Right now, we make the mistake of allowing interlacing on all
      connectors. Nvidia hardware does not always support interlacing with DP
      though, so we need to make sure that we don't allow interlaced modes to
      be set in such situations as otherwise we'll end up accidentally hanging
      the display HW.
      
      This fixes some hangs with Turing, which would be caused by attempting
      to set an interlaced mode on hardware that doesn't support it. This
      patch likely fixes other hardware hanging in the same way as well.
      
      Note that we say we probe PIOR caps, but they don't actually have any
      interlacing caps. So, the get_caps() function for PIORs just sets
      interlacing support to true.
      
      Changes since v1:
      * Actually probe caps correctly this time, both on EVO and NVDisplay.
      Changes since v2:
      * Fix probing for < GF119
      * Use vfunc table, in prep for adding more caps in the future.
      Signed-off-by: NLyude Paul <lyude@redhat.com>
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      4a2cb418
    • L
      drm/nouveau/kms/nv50-: Initialize core channel in nouveau_display_create() · fa1232ea
      Lyude Paul 提交于
      We'll need the core channel initialized and ready by the time that we
      start creating modesetting objects, so that we can call the
      NV507D_GET_CAPABILITIES method to make the hardware expose it's
      modesetting capabilities for later probing.
      
      So, when loading the driver prepare the core channel from within
      nouveau_display_create(). Everywhere else, we initialize the core
      channel during resume.
      Signed-off-by: NLyude Paul <lyude@redhat.com>
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      fa1232ea
    • T
      drm/nouveau/kms: Fix regression by audio component transition · 61a41097
      Takashi Iwai 提交于
      Since the commit 742db30c ("drm/nouveau: Add HD-audio component
      notifier support"), the nouveau driver notifies and pokes the HD-audio
      HPD and ELD via audio component, but this seems broken.  The culprit
      is the naive assumption that crtc->index corresponds to the HDA pin.
      Actually this rather corresponds to the MST dev_id (alias "pipe" in
      the audio component framework) while the actual port number is given
      from the output ior id number.
      
      This patch corrects the assignment of port and dev_id arguments in the
      audio component ops to recover from the HDMI/DP audio regression.
      
      Fixes: 742db30c ("drm/nouveau: Add HD-audio component notifier support")
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207223
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      61a41097
    • J
      drm/nouveau/kms: Add format mod prop to base/ovly/nvdisp · c586f30b
      James Jones 提交于
      Advertise support for the full list of format
      modifiers supported by each class of NVIDIA
      desktop GPU display hardware.  Stash the array
      of modifiers in the nouveau_display struct for
      use when validating userspace framebuffer
      creation requests, which will be supportd in
      a subsequent change.
      Signed-off-by: NJames Jones <jajones@nvidia.com>
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      c586f30b
  2. 07 4月, 2020 1 次提交
  3. 12 3月, 2020 2 次提交
  4. 06 3月, 2020 1 次提交
  5. 03 2月, 2020 1 次提交
    • B
      drm/nouveau/kms/gv100-: move window ownership setup into modesetting path · 5bb88d07
      Ben Skeggs 提交于
      For various complicated reasons, we need to avoid sending a core update
      method during display init.  Something, which we've been required to do
      on GV100 and up because we've been assigning windows to heads there and
      the HW is rather picky about when that's allowed.
      
      This moves window assignment into the modesetting path at a point where
      it's much safer to send our first update methods to NVDisplay.
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      5bb88d07
  6. 29 1月, 2020 1 次提交
    • T
      drm/nouveau: Add HD-audio component notifier support · 742db30c
      Takashi Iwai 提交于
      This patch adds the support for the notification of HD-audio hotplug
      via the already existing drm_audio_component framework.  This allows
      us more reliable hotplug notification and ELD transfer without
      accessing HD-audio bus; it's more efficient, and more importantly, it
      works without waking up the runtime PM.
      
      The implementation is rather simplistic: nouveau driver provides the
      get_eld ops for HD-audio, and it notifies the audio hotplug via
      pin_eld_notify callback upon each nv50_audio_enable() and _disable()
      call.  As the HD-audio pin assignment seems corresponding to the CRTC,
      the crtc->index number is passed directly as the zero-based port
      number.
      
      The bind and unbind callbacks handle the device-link so that it
      assures the PM call order.
      
      Link: https://lore.kernel.org/r/20190722143815.7339-3-tiwai@suse.deReviewed-by: NLyude Paul <lyude@redhat.com>
      Cc: Jaroslav Kysela <perex@perex.cz>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      742db30c
  7. 23 1月, 2020 1 次提交
  8. 15 1月, 2020 3 次提交
    • L
      drm/nouveau/kms/nv50-: Report possible_crtcs incorrectly on mstos, for now · 48140495
      Lyude Paul 提交于
      This commit is seperate from the previous one to make it easier to
      revert in the future. Basically, while working on making MSTOs per-head
      as opposed to per-head-per-connector I discovered these lovely issues:
      
      https://gitlab.freedesktop.org/xorg/xserver/merge_requests/277
      https://gitlab.gnome.org/GNOME/mutter/issues/759
      
      Note as well that Intel already has a temporary workaround for this in
      their kernel driver. So, unfortunately we need to follow suit to avoid
      causing a regression in userspace. Once these issues get fixed, this
      commit should be reverted.
      Signed-off-by: NLyude Paul <lyude@redhat.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      48140495
    • L
      drm/nouveau/kms/nv50-: Use less encoders by making mstos per-head · 5ff0cb1c
      Lyude Paul 提交于
      Currently, for every single MST capable DRM connector we create a set of
      fake encoders, one for each possible head. Unfortunately this ends up
      being a huge waste of encoders. While this currently isn't causing us
      any problems, it's extremely close to doing so.
      
      The ThinkPad P71 is a good example of this. Originally when trying to
      figure out why nouveau was failing to load on this laptop, I discovered
      it was because nouveau was creating too many encoders. This ended up
      being because we were mistakenly creating MST encoders for the eDP port,
      however we are still extremely close to hitting the encoder limit on
      this machine as it exposes 1 eDP port and 5 DP ports, resulting in 31
      encoders.
      
      So while this fix didn't end up being necessary to fix the P71, we still
      need to implement this so that we avoid hitting the encoder limit for
      valid display configurations in the event that some machine with more
      connectors then this becomes available. Plus, we don't want to let good
      code go to waste :)
      
      So, use less encoders by only creating one MSTO per head. Then, attach
      each new MSTC to each MSTO which corresponds to a head that it's parent
      DP port is capable of using. This brings the number of encoders we
      register on the ThinkPad P71 from 31, down to just 15. Yay!
      Signed-off-by: NLyude Paul <lyude@redhat.com>
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      5ff0cb1c
    • L
      drm/nouveau/kms/nv50-: Remove nv50_mstc_best_encoder() · 122c1639
      Lyude Paul 提交于
      When drm_connector_helper_funcs->atomic_best_encoder is defined,
      ->best_encoder is ignored by the atomic modesetting helpers. That being
      said, this hook is completely broken anyway - it always returns the
      first msto for a given mstc, despite the fact it might already be in
      use.
      
      So, just get rid of it. We'll need this in a moment anyway, when we make
      mstos per-head as opposed to per-connector.
      
      Changes since v1:
      * Fix typo in documentation - imirkin
      Signed-off-by: NLyude Paul <lyude@redhat.com>
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      122c1639
  9. 10 1月, 2020 2 次提交
  10. 10 12月, 2019 4 次提交
    • B
      drm/nouveau/kms/nv50-: fix panel scaling · 3d1890ef
      Ben Skeggs 提交于
      Under certain circumstances, encoder atomic_check() can be entered
      without adjusted_mode having been reset to the same as mode, which
      confuses the scaling logic and can lead to a misprogrammed display.
      
      Fix this by checking against the user-provided mode directly.
      
      Link: https://bugs.freedesktop.org/show_bug.cgi?id=108615
      Link: https://gitlab.freedesktop.org/xorg/driver/xf86-video-nouveau/issues/464Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      3d1890ef
    • L
      drm/nouveau/kms/nv50-: Limit MST BPC to 8 · ae5769d4
      Lyude Paul 提交于
      Noticed this while working on some unrelated CRC stuff. Currently,
      userspace has very little support for BPCs higher than 8. While this
      doesn't matter for most things, on MST topologies we need to be careful
      about ensuring that we do our best to make any given display
      configuration fit within the bandwidth restraints of the topology, since
      otherwise less people's monitor configurations will work.
      
      Allowing for BPC settings higher than 8 dramatically increases the
      required bandwidth for displays in most configurations, and consequently
      makes it a lot less likely that said display configurations will pass
      the atomic check.
      
      In the future we want to fix this correctly by making it so that we
      adjust the bpp for each display in a topology to be as high as possible,
      while making sure to lower the bpp of each display in the event that we
      run out of bandwidth and need to rerun our atomic check. But for now,
      follow the behavior that both i915 and amdgpu are sticking to.
      Signed-off-by: NLyude Paul <lyude@redhat.com>
      Fixes: 232c9eec ("drm/nouveau: Use atomic VCPI helpers for MST")
      Cc: Ben Skeggs <bskeggs@redhat.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: David Airlie <airlied@redhat.com>
      Cc: Jerry Zuo <Jerry.Zuo@amd.com>
      Cc: Harry Wentland <harry.wentland@amd.com>
      Cc: Juston Li <juston.li@intel.com>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Sean Paul <seanpaul@chromium.org>
      Cc: <stable@vger.kernel.org> # v5.1+
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      ae5769d4
    • L
      drm/nouveau/kms/nv50-: Store the bpc we're using in nv50_head_atom · ac2d9275
      Lyude Paul 提交于
      In order to be able to use bpc values that are different from what the
      connector reports, we want to be able to store the bpc value we decide
      on using for an atomic state in nv50_head_atom and refer to that instead
      of simply using the value that the connector reports throughout the
      whole atomic check phase and commit phase. This will let us (eventually)
      implement the max bpc connector property, and will also be needed for
      limiting the bpc we use on MST displays to 8 in the next commit.
      Signed-off-by: NLyude Paul <lyude@redhat.com>
      Fixes: 232c9eec ("drm/nouveau: Use atomic VCPI helpers for MST")
      Cc: Ben Skeggs <bskeggs@redhat.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: David Airlie <airlied@redhat.com>
      Cc: Jerry Zuo <Jerry.Zuo@amd.com>
      Cc: Harry Wentland <harry.wentland@amd.com>
      Cc: Juston Li <juston.li@intel.com>
      Cc: Sean Paul <seanpaul@chromium.org>
      Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
      Cc: <stable@vger.kernel.org> # v5.1+
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      ac2d9275
    • L
      drm/nouveau/kms/nv50-: Call outp_atomic_check_view() before handling PBN · 310d3577
      Lyude Paul 提交于
      Since nv50_outp_atomic_check_view() can set crtc_state->mode_changed, we
      probably should be calling it before handling any PBN changes. Just a
      precaution.
      Signed-off-by: NLyude Paul <lyude@redhat.com>
      Fixes: 232c9eec ("drm/nouveau: Use atomic VCPI helpers for MST")
      Cc: Ben Skeggs <bskeggs@redhat.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: David Airlie <airlied@redhat.com>
      Cc: Jerry Zuo <Jerry.Zuo@amd.com>
      Cc: Harry Wentland <harry.wentland@amd.com>
      Cc: Juston Li <juston.li@intel.com>
      Cc: Sean Paul <seanpaul@chromium.org>
      Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
      Cc: <stable@vger.kernel.org> # v5.1+
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      310d3577
  11. 25 10月, 2019 2 次提交
    • L
      drm/dp_mst: Add basic topology reprobing when resuming · 6f85f738
      Lyude Paul 提交于
      Finally! For a very long time, our MST helpers have had one very
      annoying issue: They don't know how to reprobe the topology state when
      coming out of suspend. This means that if a user has a machine connected
      to an MST topology and decides to suspend their machine, we lose all
      topology changes that happened during that period. That can be a big
      problem if the machine was connected to a different topology on the same
      port before resuming, as we won't bother reprobing any of the ports and
      likely cause the user's monitors not to come back up as expected.
      
      So, we start fixing this by teaching our MST helpers how to reprobe the
      link addresses of each connected topology when resuming. As it turns
      out, the behavior that we want here is identical to the behavior we want
      when initially probing a newly connected MST topology, with a couple of
      important differences:
      
      - We need to be more careful about handling the potential races between
        events from the MST hub that could change the topology state as we're
        performing the link address reprobe
      - We need to be more careful about handling unlikely state changes on
        ports - such as an input port turning into an output port, something
        that would be far more likely to happen in situations like the MST hub
        we're connected to being changed while we're suspend
      
      Both of which have been solved by previous commits. That leaves one
      requirement:
      
      - We need to prune any MST ports in our in-memory topology state that
        were present when suspending, but have not appeared in the post-resume
        link address response from their parent branch device
      
      Which we can now handle in this commit by modifying
      drm_dp_send_link_address(). We then introduce suspend/resume reprobing
      by introducing drm_dp_mst_topology_mgr_invalidate_mstb(), which we call
      in drm_dp_mst_topology_mgr_suspend() to traverse the in-memory topology
      state to indicate that each mstb needs it's link address resent and PBN
      resources reprobed.
      
      On resume, we start back up &mgr->work and have it reprobe the topology
      in the same way we would on a hotplug, removing any leftover ports that
      no longer appear in the topology state.
      
      Changes since v4:
      * Split indenting changes in drm_dp_mst_topology_mgr_resume() into a
        separate patch
      * Only fire hotplugs when something has actually changed after a link
        address probe
      * Don't try to change port->connector at all on ports, just throw out
        ports that need their connectors removed to make things easier.
      
      Cc: Juston Li <juston.li@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Harry Wentland <hwentlan@amd.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: NSean Paul <sean@poorly.run>
      Signed-off-by: NLyude Paul <lyude@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20191022023641.8026-14-lyude@redhat.com
      6f85f738
    • L
      drm/dp_mst: Protect drm_dp_mst_port members with locking · 3f9b3f02
      Lyude Paul 提交于
      This is a complicated one. Essentially, there's currently a problem in the MST
      core that hasn't really caused any issues that we're aware of (emphasis on "that
      we're aware of"): locking.
      
      When we go through and probe the link addresses and path resources in a
      topology, we hold no locks when updating ports with said information. The
      members I'm referring to in particular are:
      
      - ldps
      - ddps
      - mcs
      - pdt
      - dpcd_rev
      - num_sdp_streams
      - num_sdp_stream_sinks
      - available_pbn
      - input
      - connector
      
      Now that we're handling UP requests asynchronously and will be using some of
      the struct members mentioned above in atomic modesetting in the future for
      features such as PBN validation, this is going to become a lot more important.
      As well, the next few commits that prepare us for and introduce suspend/resume
      reprobing will also need clear locking in order to prevent from additional
      racing hilarities that we never could have hit in the past.
      
      So, let's solve this issue by using &mgr->base.lock, the modesetting
      lock which currently only protects &mgr->base.state. This works
      perfectly because it allows us to avoid blocking connection_mutex
      unnecessarily, and we can grab this in connector detection paths since
      it's a ww mutex. We start by having drm_dp_mst_handle_up_req() hold this
      when updating ports. For drm_dp_mst_handle_link_address_port() things
      are a bit more complicated. As I've learned the hard way, we can grab
      &mgr->lock.base for everything except for port->connector. See, our
      normal driver probing paths end up generating this rather obvious
      lockdep chain:
      
      &drm->mode_config.mutex
        -> crtc_ww_class_mutex/crtc_ww_class_acquire
          -> &connector->mutex
      
      However, sysfs grabs &drm->mode_config.mutex in order to protect itself
      from connector state changing under it. Because this entails grabbing
      kn->count, e.g. the lock that the kernel provides for protecting sysfs
      contexts, we end up grabbing kn->count followed by
      &drm->mode_config.mutex. This ends up creating an extremely rude chain:
      
      &kn->count
        -> &drm->mode_config.mutex
          -> crtc_ww_class_mutex/crtc_ww_class_acquire
            -> &connector->mutex
      
      I mean, look at that thing! It's just evil!!! This gross thing ends up
      making any calls to drm_connector_register()/drm_connector_unregister()
      impossible when holding any kind of modesetting lock. This is annoying
      because ideally, we always want to ensure that
      drm_dp_mst_port->connector never changes when doing an atomic commit or
      check that would affect the atomic topology state so that it can
      reliably and easily be used from future DRM DP MST helpers to assist
      with tasks such as scanning through the current VCPI allocations and
      adding connectors which need to have their allocations updated in
      response to a bandwidth change or the like.
      
      Being able to hold &mgr->base.lock throughout the entire link probe
      process would have been _great_, since we could prevent userspace from
      ever seeing any states in-between individual port changes and as a
      result likely end up with a much faster probe and more consistent
      results from said probes. But without some rework of how we handle
      connector probing in sysfs it's not at all currently possible. In the
      future, maybe we can try using the sysfs locks to protect updates to
      connector probing state and fix this mess.
      
      So for now, to protect everything other than port->connector under
      &mgr->base.lock and ensure that we still have the guarantee that atomic
      check/commit contexts will never see port->connector change we use a
      silly trick. See: port->connector only needs to change in order to
      ensure that input ports (see the MST spec) never have a ghost connector
      associated with them. But, there's nothing stopping us from simply
      throwing the entire port out and creating a new one in order to maintain
      that requirement while still keeping port->connector consistent across
      the lifetime of the port in atomic check/commit contexts. For all
      intended purposes this works fine, as we validate ports in any contexts
      we care about before using them and as such will end up reporting the
      connector as disconnected until it's port's destruction finalizes. So,
      we just do that in cases where we detect port->input has transitioned
      from true->false. We don't need to worry about the other direction,
      since a port without a connector isn't visible to userspace and as such
      doesn't need to be protected by &mgr->base.lock until we finish
      registering a connector for it.
      
      For updating members of drm_dp_mst_port other than port->connector, we
      simply grab &mgr->base.lock in drm_dp_mst_link_probe_work() for already
      registered ports, update said members and drop the lock before
      potentially registering a connector and probing the link address of it's
      children.
      
      Finally, we modify drm_dp_mst_detect_port() to take a modesetting lock
      acquisition context in order to acquire &mgr->base.lock under
      &connection_mutex and convert all it's users over to using the
      .detect_ctx probe hooks.
      
      With that, we finally have well defined locking.
      
      Changes since v4:
      * Get rid of port->mutex, stop using connection_mutex and just use our own
        modesetting lock - mgr->base.lock. Also, add a probe_lock that comes
        before this patch.
      * Just throw out ports that get changed from an output to an input, and
        replace them with new ports. This lets us ensure that modesetting
        contexts never see port->connector go from having a connector to being
        NULL.
      * Write an extremely detailed explanation of what problems this is
        trying to fix, since there's a _lot_ of context here and I honestly
        forgot some of it myself a couple times.
      * Don't grab mgr->lock when reading port->mstb in
        drm_dp_mst_handle_link_address_port(). It's not needed.
      
      Cc: Juston Li <juston.li@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Harry Wentland <hwentlan@amd.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: NSean Paul <sean@poorly.run>
      Signed-off-by: NLyude Paul <lyude@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20191022023641.8026-7-lyude@redhat.com
      3f9b3f02
  12. 17 9月, 2019 2 次提交
  13. 23 8月, 2019 3 次提交
  14. 15 8月, 2019 1 次提交
    • L
      drm/nouveau: Only recalculate PBN/VCPI on mode/connector changes · db1231dd
      Lyude Paul 提交于
      I -thought- I had fixed this entirely, but it looks like that I didn't
      test this thoroughly enough as we apparently still make one big mistake
      with nv50_msto_atomic_check() - we don't handle the following scenario:
      
      * CRTC #1 has n VCPI allocated to it, is attached to connector DP-4
        which is attached to encoder #1. enabled=y active=n
      * CRTC #1 is changed from DP-4 to DP-5, causing:
        * DP-4 crtc=#1→NULL (VCPI n→0)
        * DP-5 crtc=NULL→#1
        * CRTC #1 steals encoder #1 back from DP-4 and gives it to DP-5
        * CRTC #1 maintains the same mode as before, just with a different
          connector
      * mode_changed=n connectors_changed=y
        (we _SHOULD_ do VCPI 0→n here, but don't)
      
      Once the above scenario is repeated once, we'll attempt freeing VCPI
      from the connector that we didn't allocate due to the connectors
      changing, but the mode staying the same. Sigh.
      
      Since nv50_msto_atomic_check() has broken a few times now, let's rethink
      things a bit to be more careful: limit both VCPI/PBN allocations to
      mode_changed || connectors_changed, since neither VCPI or PBN should
      ever need to change outside of routing and mode changes.
      
      Changes since v1:
      * Fix accidental reversal of clock and bpp arguments in
        drm_dp_calc_pbn_mode() - William Lewis
      Signed-off-by: NLyude Paul <lyude@redhat.com>
      Reported-by: NBohdan Milar <bmilar@redhat.com>
      Tested-by: NBohdan Milar <bmilar@redhat.com>
      Fixes: 232c9eec ("drm/nouveau: Use atomic VCPI helpers for MST")
      References: 412e85b6 ("drm/nouveau: Only release VCPI slots on mode changes")
      Cc: Lyude Paul <lyude@redhat.com>
      Cc: Ben Skeggs <bskeggs@redhat.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: David Airlie <airlied@redhat.com>
      Cc: Jerry Zuo <Jerry.Zuo@amd.com>
      Cc: Harry Wentland <harry.wentland@amd.com>
      Cc: Juston Li <juston.li@intel.com>
      Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
      Cc: Karol Herbst <karolherbst@gmail.com>
      Cc: Ilia Mirkin <imirkin@alum.mit.edu>
      Cc: <stable@vger.kernel.org> # v5.1+
      Acked-by: NBen Skeggs <bskeggs@redhat.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190809005307.18391-1-lyude@redhat.com
      db1231dd
  15. 02 8月, 2019 1 次提交
    • L
      drm/nouveau: Only release VCPI slots on mode changes · 412e85b6
      Lyude Paul 提交于
      Looks like a regression got introduced into nv50_mstc_atomic_check()
      that somehow didn't get found until now. If userspace changes
      crtc_state->active to false but leaves the CRTC enabled, we end up
      calling drm_dp_atomic_find_vcpi_slots() using the PBN calculated in
      asyh->dp.pbn. However, if the display is inactive we end up calculating
      a PBN of 0, which inadvertently causes us to have an allocation of 0.
      >From there, if userspace then disables the CRTC afterwards we end up
      accidentally attempting to free the VCPI twice:
      
      WARNING: CPU: 0 PID: 1484 at drivers/gpu/drm/drm_dp_mst_topology.c:3336
      drm_dp_atomic_release_vcpi_slots+0x87/0xb0 [drm_kms_helper]
      RIP: 0010:drm_dp_atomic_release_vcpi_slots+0x87/0xb0 [drm_kms_helper]
      Call Trace:
       drm_atomic_helper_check_modeset+0x3f3/0xa60 [drm_kms_helper]
       ? drm_atomic_check_only+0x43/0x780 [drm]
       drm_atomic_helper_check+0x15/0x90 [drm_kms_helper]
       nv50_disp_atomic_check+0x83/0x1d0 [nouveau]
       drm_atomic_check_only+0x54d/0x780 [drm]
       ? drm_atomic_set_crtc_for_connector+0xec/0x100 [drm]
       drm_atomic_commit+0x13/0x50 [drm]
       drm_atomic_helper_set_config+0x81/0x90 [drm_kms_helper]
       drm_mode_setcrtc+0x194/0x6a0 [drm]
       ? vprintk_emit+0x16a/0x230
       ? drm_ioctl+0x163/0x390 [drm]
       ? drm_mode_getcrtc+0x180/0x180 [drm]
       drm_ioctl_kernel+0xaa/0xf0 [drm]
       drm_ioctl+0x208/0x390 [drm]
       ? drm_mode_getcrtc+0x180/0x180 [drm]
       nouveau_drm_ioctl+0x63/0xb0 [nouveau]
       do_vfs_ioctl+0x405/0x660
       ? recalc_sigpending+0x17/0x50
       ? _copy_from_user+0x37/0x60
       ksys_ioctl+0x5e/0x90
       ? exit_to_usermode_loop+0x92/0xe0
       __x64_sys_ioctl+0x16/0x20
       do_syscall_64+0x59/0x190
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      WARNING: CPU: 0 PID: 1484 at drivers/gpu/drm/drm_dp_mst_topology.c:3336
      drm_dp_atomic_release_vcpi_slots+0x87/0xb0 [drm_kms_helper]
      ---[ end trace 4c395c0c51b1f88d ]---
      [drm:drm_dp_atomic_release_vcpi_slots [drm_kms_helper]] *ERROR* no VCPI for
      [MST PORT:00000000e288eb7d] found in mst state 000000008e642070
      
      So, fix this by doing what we probably should have done from the start: only
      call drm_dp_atomic_find_vcpi_slots() when crtc_state->mode_changed is set, so
      that VCPI allocations remain for as long as the CRTC is enabled.
      Signed-off-by: NLyude Paul <lyude@redhat.com>
      Fixes: 232c9eec ("drm/nouveau: Use atomic VCPI helpers for MST")
      Cc: Lyude Paul <lyude@redhat.com>
      Cc: Ben Skeggs <bskeggs@redhat.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: David Airlie <airlied@redhat.com>
      Cc: Jerry Zuo <Jerry.Zuo@amd.com>
      Cc: Harry Wentland <harry.wentland@amd.com>
      Cc: Juston Li <juston.li@intel.com>
      Cc: Karol Herbst <karolherbst@gmail.com>
      Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
      Cc: Ilia Mirkin <imirkin@alum.mit.edu>
      Cc: <stable@vger.kernel.org> # v5.1+
      Acked-by: NBen Skeggs <bskeggs@redhat.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190801220216.15323-1-lyude@redhat.com
      412e85b6
  16. 19 7月, 2019 1 次提交
  17. 14 6月, 2019 1 次提交
  18. 20 2月, 2019 4 次提交
  19. 06 2月, 2019 2 次提交
  20. 24 1月, 2019 1 次提交
  21. 11 1月, 2019 1 次提交
    • L
      drm/nouveau: Use atomic VCPI helpers for MST · 232c9eec
      Lyude Paul 提交于
      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.
      
      Changes since v6:
      * Cleanup atomic check logic and remove a bunch of unneeded checks -
        danvet
      Changes since v5:
      * Update nv50_msto_atomic_check() and nv50_mstc_atomic_check() to the
        new requirements for drm_dp_atomic_find_vcpi_slots() and
        drm_dp_atomic_release_vcpi_slots()
      Signed-off-by: NLyude Paul <lyude@redhat.com>
      Reviewed-by: NBen Skeggs <bskeggs@redhat.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: David Airlie <airlied@redhat.com>
      Cc: Jerry Zuo <Jerry.Zuo@amd.com>
      Cc: Harry Wentland <harry.wentland@amd.com>
      Cc: Juston Li <juston.li@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190111005343.17443-21-lyude@redhat.com
      232c9eec