1. 01 6月, 2017 2 次提交
  2. 10 5月, 2017 4 次提交
    • D
      drm/vblank: Lock down vblank->hwmode more · 5caa0fea
      Daniel Vetter 提交于
      In the previous patch we've implemented hwmode tracking a la i915 for
      the vblank timestamp calculations. But that was just the basic
      semantics, i915 has some nice sanity checks to make sure we keep
      getting this right. Move them over too.
      
      v2:
      - WARN_ON_ONCE to avoid excessive spam (Ville)
      - Really only WARN on atomic drivers.
      
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NNeil Armstrong <narmstrong@baylibre.com>
      Acked-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170509140329.24114-5-daniel.vetter@ffwll.ch
      5caa0fea
    • D
      drm/vblank: drop the mode argument from drm_calc_vbltimestamp_from_scanoutpos · 1bf6ad62
      Daniel Vetter 提交于
      If we restrict this helper to only kms drivers (which is the case) we
      can look up the correct mode easily ourselves. But it's a bit tricky:
      
      - All legacy drivers look at crtc->hwmode. But that is updated already
        at the beginning of the modeset helper, which means when we disable
        a pipe. Hence the final timestamps might be a bit off. But since
        this is an existing bug I'm not going to change it, but just try to
        be bug-for-bug compatible with the current code. This only applies
        to radeon&amdgpu.
      
      - i915 tries to get it perfect by updating crtc->hwmode when the pipe
        is off (i.e. vblank->enabled = false).
      
      - All other atomic drivers look at crtc->state->adjusted_mode. Those
        that look at state->requested_mode simply don't adjust their mode,
        so it's the same. That has two problems: Accessing crtc->state from
        interrupt handling code is unsafe, and it's updated before we shut
        down the pipe. For nonblocking modesets it's even worse.
      
      For atomic drivers try to implement what i915 does. To do that we add
      a new hwmode field to the vblank structure, and update it from
      drm_calc_timestamping_constants(). For atomic drivers that's called
      from the right spot by the helper library already, so all fine. But
      for safety let's enforce that.
      
      For legacy driver this function is only called at the end (oh the
      fun), which is broken, so again let's not bother and just stay
      bug-for-bug compatible.
      
      The  benefit is that we can use drm_calc_vbltimestamp_from_scanoutpos
      directly to implement ->get_vblank_timestamp in every driver, deleting
      a lot of code.
      
      v2: Completely new approach, trying to mimick the i915 solution.
      
      v3: Fixup kerneldoc.
      
      v4: Drop the WARN_ON to check that the vblank is off, atomic helpers
      currently unconditionally call this. Recomputing the same stuff should
      be harmless.
      
      v5: Fix typos and move misplaced hunks to the right patches (Neil).
      
      v6: Undo hunk movement (kbuild).
      
      Cc: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
      Cc: Eric Anholt <eric@anholt.net>
      Cc: Rob Clark <robdclark@gmail.com>
      Cc: linux-arm-msm@vger.kernel.org
      Cc: freedreno@lists.freedesktop.org
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Christian König <christian.koenig@amd.com>
      Cc: Ben Skeggs <bskeggs@redhat.com>
      Reviewed-by: NNeil Armstrong <narmstrong@baylibre.com>
      Acked-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170509140329.24114-4-daniel.vetter@ffwll.ch
      1bf6ad62
    • D
      drm/vblank: Switch to bool in_vblank_irq in get_vblank_timestamp · 3fcdcb27
      Daniel Vetter 提交于
      It's overkill to have a flag parameter which is essentially used just
      as a boolean. This takes care of core + adjusting drivers.
      
      Adjusting the scanout position callback is a bit harder, since radeon
      also supplies it's own driver-private flags in there.
      
      v2: Fixup misplaced hunks (Neil).
      
      v3: kbuild says v1 was better ...
      
      Cc: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
      Cc: Eric Anholt <eric@anholt.net>
      Cc: Rob Clark <robdclark@gmail.com>
      Cc: linux-arm-msm@vger.kernel.org
      Cc: freedreno@lists.freedesktop.org
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Christian König <christian.koenig@amd.com>
      Cc: Ben Skeggs <bskeggs@redhat.com>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NNeil Armstrong <narmstrong@baylibre.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170509140329.24114-2-daniel.vetter@ffwll.ch
      3fcdcb27
    • D
      drm/vblank: Switch drm_driver->get_vblank_timestamp to return a bool · d673c02c
      Daniel Vetter 提交于
      There's really no reason for anything more:
      - Calling this while the crtc vblank stuff isn't set up is a driver
        bug. Those places alrready DRM_ERROR.
      - Calling this when the crtc is off is either a driver bug (calling
        drm_crtc_handle_vblank at the wrong time) or a core bug (for
        anything else). Again, we DRM_ERROR.
      - EINVAL is checked at higher levels already, and if we'd use struct
        drm_crtc * instead of (dev, pipe) it would be real obvious that
        those are again core bugs.
      
      The only valid failure mode is crap hardware that couldn't sample a
      useful timestamp, to ask the core to just grab a not-so-accurate
      timestamp. Bool is perfectly fine for that.
      
      v2: Also fix up the one caller, I lost that in the shuffling (Jani).
      
      v3: Fixup commit message (Neil).
      
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
      Cc: Eric Anholt <eric@anholt.net>
      Cc: Rob Clark <robdclark@gmail.com>
      Cc: linux-arm-msm@vger.kernel.org
      Cc: freedreno@lists.freedesktop.org
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Christian König <christian.koenig@amd.com>
      Cc: Ben Skeggs <bskeggs@redhat.com>
      Reviewed-by: NNeil Armstrong <narmstrong@baylibre.com>
      Acked-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170509140329.24114-1-daniel.vetter@ffwll.ch
      d673c02c
  3. 05 4月, 2017 1 次提交
  4. 30 3月, 2017 1 次提交
  5. 29 3月, 2017 5 次提交
  6. 26 3月, 2017 1 次提交
  7. 16 3月, 2017 2 次提交
    • C
      drm: Skip the waitqueue setup for vblank queries · 82c8e025
      Chris Wilson 提交于
      Avoid adding to the waitqueue and reprobing the current vblank if the
      caller is only querying the current vblank sequence and timestamp, where
      we know that the wait would return immediately.
      
      v2: Add CRTC identifier to debug messages
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: Michel Dänzer <michel@daenzer.net>
      Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
      Cc: Dave Airlie <airlied@redhat.com>,
      Cc: Mario Kleiner <mario.kleiner.de@gmail.com>
      Reviewed-by: NMichel Dänzer <michel@daenzer.net>
      Reviewed-and-tested-by: NMario Kleiner <mario.kleiner.de@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170315204027.20160-2-chris@chris-wilson.co.uk
      82c8e025
    • C
      drm: Defer disabling the vblank IRQ until the next interrupt (for instant-off) · 608b2050
      Chris Wilson 提交于
      On vblank instant-off systems, we can get into a situation where the cost
      of enabling and disabling the vblank IRQ around a drmWaitVblank query
      dominates. And with the advent of even deeper hardware sleep state,
      touching registers becomes ever more expensive.  However, we know that if
      the user wants the current vblank counter, they are also very likely to
      immediately queue a vblank wait and so we can keep the interrupt around
      and only turn it off if we have no further vblank requests queued within
      the interrupt interval.
      
      After vblank event delivery, this patch adds a shadow of one vblank where
      the interrupt is kept alive for the user to query and queue another vblank
      event. Similarly, if the user is using blocking drmWaitVblanks, the
      interrupt will be disabled on the IRQ following the wait completion.
      However, if the user is simply querying the current vblank counter and
      timestamp, the interrupt will be disabled after every IRQ and the user
      will enabled it again on the first query following the IRQ.
      
      v2: Mario Kleiner -
      After testing this, one more thing that would make sense is to move
      the disable block at the end of drm_handle_vblank() instead of at the
      top.
      
      Turns out that if high precision timestaming is disabled or doesn't
      work for some reason (as can be simulated by echo 0 >
      /sys/module/drm/parameters/timestamp_precision_usec), then with your
      delayed disable code at its current place, the vblank counter won't
      increment anymore at all for instant queries, ie. with your other
      "instant query" patches. Clients which repeatedly query the counter
      and wait for it to progress will simply hang, spinning in an endless
      query loop. There's that comment in vblank_disable_and_save:
      
      "* Skip this step if there isn't any high precision timestamp
       * available. In that case we can't account for this and just
       * hope for the best.
       */
      
      With the disable happening after leading edge of vblank (== hw counter
      increment already happened) but before the vblank counter/timestamp
      handling in drm_handle_vblank, that step is needed to keep the counter
      progressing, so skipping it is bad.
      
      Now without high precision timestamping support, a kms driver must not
      set dev->vblank_disable_immediate = true, as this would cause problems
      for clients, so this shouldn't matter, but it would be good to still
      make this robust against a future kms driver which might have
      unreliable high precision timestamping, e.g., high precision
      timestamping that intermittently doesn't work.
      
      v3: Patch before coffee needs extra coffee.
      
      Testcase: igt/kms_vblank
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: Michel Dänzer <michel@daenzer.net>
      Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
      Cc: Dave Airlie <airlied@redhat.com>,
      Cc: Mario Kleiner <mario.kleiner.de@gmail.com>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170315204027.20160-1-chris@chris-wilson.co.uk
      608b2050
  8. 14 3月, 2017 1 次提交
  9. 08 2月, 2017 2 次提交
  10. 26 1月, 2017 1 次提交
  11. 25 1月, 2017 1 次提交
  12. 30 12月, 2016 1 次提交
  13. 18 12月, 2016 1 次提交
  14. 16 11月, 2016 3 次提交
  15. 18 10月, 2016 1 次提交
  16. 04 10月, 2016 1 次提交
  17. 16 8月, 2016 1 次提交
  18. 09 8月, 2016 1 次提交
  19. 08 8月, 2016 2 次提交
  20. 19 7月, 2016 1 次提交
    • D
      drm: Extract&Document drm_irq.h · 34a67dd7
      Daniel Vetter 提交于
      The drm_irq docs want one function from drmP.h, but that one is a
      serious mess. Extract it, and while at it improve the docs a bit.
      There's a bit a header loop issue since core data structures like
      drm_device and drm_driver aren't in their own headers yet, which means
      the drm_irq.h include in drmP.h needs to be in just the right spot :(
      
      Also noticed that drm_vblank_crtc->last_wait is entirely unused,
      remove it.
      
      v2: git add drm_irq.h ...
      Acked-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      34a67dd7
  21. 12 7月, 2016 2 次提交
  22. 27 6月, 2016 1 次提交
  23. 21 6月, 2016 1 次提交
    • M
      drm: fix send_vblank_event use-after-free error · c001da4f
      Matthew Auld 提交于
      The drm_pending_event can be freed by drm_send_event_locked, as a
      result we should call trace_drm_vblank_event_delivered before this
      to avoid hitting a user-after-free error when accessing the pid member:
      
      [  378.438497] BUG: KASAN: use-after-free in send_vblank_event+0xf0/0x310 [drm] at addr ffff8801ac7e50a0
      [  378.438500] Read of size 4 by task Xorg/1562
      [  378.438501] =============================================================================
      [  378.438504] BUG kmalloc-128 (Tainted: G    B          ): kasan: bad access detected
      [  378.438506] -----------------------------------------------------------------------------
      
      [  378.438509] INFO: Freed in 0x10001309c age=18446737369265680575 cpu=0 pid=0
      [  378.438541]  drm_send_event_locked+0x207/0x2f0 [drm]
      [  378.438544]  __slab_free+0x24c/0x650
      [  378.438546]  kfree+0x3a2/0x760
      [  378.438578]  drm_send_event_locked+0x207/0x2f0 [drm]
      [  378.438610]  send_vblank_event+0xb7/0x310 [drm]
      [  378.438643]  drm_crtc_send_vblank_event+0x130/0x1f0 [drm]
      [  378.438722]  intel_atomic_commit_tail+0x23b5/0x53f0 [i915]
      [  378.438802]  intel_atomic_commit+0xbae/0x12f0 [i915]
      [  378.438839]  drm_atomic_commit+0xb0/0x120 [drm]
      [  378.438855]  drm_atomic_helper_connector_dpms+0x339/0x5d0 [drm_kms_helper]
      [  378.438891]  drm_mode_obj_set_property_ioctl+0x8f1/0xcc0 [drm]
      [  378.438927]  drm_mode_connector_property_set_ioctl+0xf3/0x170 [drm]
      [  378.438959]  drm_ioctl+0x2d7/0xae0 [drm]
      [  378.438962]  do_vfs_ioctl+0x1c9/0x1280
      [  378.438964]  SyS_ioctl+0x79/0x90
      [  378.438967]  entry_SYSCALL_64_fastpath+0x1a/0xa4
      
      Cc: dri-devel@lists.freedesktop.org
      Cc: Daniel Vetter <daniel.vetter@intel.com>
      Signed-off-by: NMatthew Auld <matthew.auld@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/1466440966-5410-1-git-send-email-matthew.auld@intel.com
      c001da4f
  24. 14 6月, 2016 3 次提交