1. 26 5月, 2017 1 次提交
  2. 22 5月, 2017 1 次提交
  3. 10 5月, 2017 3 次提交
    • 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
  4. 06 4月, 2017 1 次提交
  5. 30 3月, 2017 1 次提交
  6. 29 3月, 2017 1 次提交
  7. 01 3月, 2017 1 次提交
  8. 09 2月, 2017 1 次提交
  9. 03 2月, 2017 1 次提交
    • C
      drm: Improve drm_mm search (and fix topdown allocation) with rbtrees · 4e64e553
      Chris Wilson 提交于
      The drm_mm range manager claimed to support top-down insertion, but it
      was neither searching for the top-most hole that could fit the
      allocation request nor fitting the request to the hole correctly.
      
      In order to search the range efficiently, we create a secondary index
      for the holes using either their size or their address. This index
      allows us to find the smallest hole or the hole at the bottom or top of
      the range efficiently, whilst keeping the hole stack to rapidly service
      evictions.
      
      v2: Search for holes both high and low. Rename flags to mode.
      v3: Discover rb_entry_safe() and use it!
      v4: Kerneldoc for enum drm_mm_insert_mode.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: "Christian König" <christian.koenig@amd.com>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Russell King <rmk+kernel@armlinux.org.uk>
      Cc: Daniel Vetter <daniel.vetter@intel.com>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Sean Paul <seanpaul@chromium.org>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
      Cc: Rob Clark <robdclark@gmail.com>
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Cc: Stephen Warren <swarren@wwwdotorg.org>
      Cc: Alexandre Courbot <gnurou@gmail.com>
      Cc: Eric Anholt <eric@anholt.net>
      Cc: Sinclair Yeh <syeh@vmware.com>
      Cc: Thomas Hellstrom <thellstrom@vmware.com>
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Reviewed-by: Sinclair Yeh <syeh@vmware.com> # vmwgfx
      Reviewed-by: Lucas Stach <l.stach@pengutronix.de> #etnaviv
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170202210438.28702-1-chris@chris-wilson.co.uk
      4e64e553
  10. 02 2月, 2017 1 次提交
  11. 18 1月, 2017 1 次提交
  12. 17 1月, 2017 1 次提交
  13. 10 12月, 2016 1 次提交
  14. 30 11月, 2016 1 次提交
  15. 07 10月, 2016 2 次提交
    • E
      drm/vc4: Add support for double-clocked modes. · dfccd937
      Eric Anholt 提交于
      Now that we have infoframes to report the pixel repeat flag, we can
      start using it.  Fixes locking the 720x480i and 720x576i modes on my
      Dell 2408WFP.  Like the 1920x1080i case, they don't fit properly on
      the screen, though.
      Signed-off-by: NEric Anholt <eric@anholt.net>
      dfccd937
    • E
      drm/vc4: Fix support for interlaced modes on HDMI. · 682e62c4
      Eric Anholt 提交于
      We really do need to be using the halved V fields.  I had been
      confused by the code I was using as a reference because it stored
      halved vsync fields but not halved vdisplay, so it looked like I only
      needed to divide vdisplay by 2.
      
      This reverts part of Mario's timestamping fixes that prevented
      CRTC_HALVE_V from applying, and instead adjusts the timestamping code
      to not use the crtc field in that case.
      
      Fixes locking of 1920x1080x60i on my Dell 2408WFP.  There are black
      bars on the top and bottom, but I suspect that might be an
      under/overscan flags problem as opposed to video timings.
      Signed-off-by: NEric Anholt <eric@anholt.net>
      682e62c4
  16. 20 8月, 2016 4 次提交
  17. 12 7月, 2016 1 次提交
    • M
      drm/vc4: Implement precise vblank timestamping. · 1bf59f1d
      Mario Kleiner 提交于
      Precise vblank timestamping is implemented via the
      usual scanout position based method. On VC4 the
      pixelvalves PV do not have a scanout position
      register. Only the hardware video scaler HVS has a
      similar register which describes which scanline for
      the output is currently composited and stored in the
      HVS fifo for later consumption by the PV.
      
      This causes a problem in that the HVS runs at a much
      faster clock (system clock / audio gate) than the PV
      which runs at video mode dot clock, so the unless the
      fifo between HVS and PV is full, the HVS will progress
      faster in its observable read line position than video
      scan rate, so the HVS position reading can't be directly
      translated into a scanout position for timestamp correction.
      
      Additionally when the PV is in vblank, it doesn't consume
      from the fifo, so the fifo gets full very quickly and then
      the HVS stops compositing until the PV enters active scanout
      and starts consuming scanlines from the fifo again, making
      new space for the HVS to composite.
      
      Therefore a simple translation of HVS read position into
      elapsed time since (or to) start of active scanout does
      not work, but for the most interesting cases we can still
      get useful and sufficiently accurate results:
      
      1. The PV enters active scanout of a new frame with the
         fifo of the HVS completely full, and the HVS can refill
         any fifo line which gets consumed and thereby freed up by
         the PV during active scanout very quickly. Therefore the
         PV and HVS work effectively in lock-step during active
         scanout with the fifo never having more than 1 scanline
         freed up by the PV before it gets refilled. The PV's
         real scanout position is therefore trailing the HVS
         compositing position as scanoutpos = hvspos - fifosize
         and we can get the true scanoutpos as HVS readpos minus
         fifo size, so precise timestamping works while in active
         scanout, except for the last few scanlines of the frame,
         when the HVS reaches end of frame, stops compositing and
         the PV catches up and drains the fifo. This special case
         would only introduce minor errors though.
      
      2. If we are in vblank, then we can only guess something
         reasonable. If called from vblank irq, we assume the irq is
         usually dispatched with minimum delay, so we can take a
         timestamp taken at entry into the vblank irq handler as a
         baseline and then add a full vblank duration until the
         guessed start of active scanout. As irq dispatch is usually
         pretty low latency this works with relatively low jitter and
         good results.
      
         If we aren't called from vblank then we could be anywhere
         within the vblank interval, so we return a neutral result,
         simply the current system timestamp, and hope for the best.
      
      Measurement shows the generated timestamps to be rather precise,
      and at least never off more than 1 vblank duration worst-case.
      
      Limitations: Doesn't work well yet for interlaced video modes,
                   therefore disabled in interlaced mode for now.
      
      v2: Use the DISPBASE registers to determine the FIFO size (changes
          by anholt)
      Signed-off-by: NMario Kleiner <mario.kleiner.de@gmail.com>
      Signed-off-by: NEric Anholt <eric@anholt.net>
      Reviewed-and-tested-by: Mario Kleiner <mario.kleiner.de@gmail.com> (v2)
      1bf59f1d
  18. 07 6月, 2016 2 次提交
    • M
      drm/core: Change declaration for gamma_set. · 7ea77283
      Maarten Lankhorst 提交于
      Change return value to int to propagate errors from gamma_set,
      and remove start parameter. Updates always use the full size,
      and some drivers even ignore the start parameter altogether.
      
      This is needed for atomic drivers, where an atomic commit can
      fail with -EINTR or -ENOMEM and should be restarted. This is already
      and issue for drm_atomic_helper_legacy_set_gamma, which this patch
      fixes up.
      
      Changes since v1:
      - Fix compiler warning. (Emil)
      - Fix commit message (Daniel)
      
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Acked-by: NAlex Deucher <alexander.deucher@amd.com>
      Cc: Christian König <christian.koenig@amd.com>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
      Cc: Ben Skeggs <bskeggs@redhat.com>
      Cc: Eric Anholt <eric@anholt.net>
      Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
      Cc: Mathieu Larouche <mathieu.larouche@matrox.com>
      Cc: Thierry Reding <treding@nvidia.com>
      Acked-by: NPatrik Jakobsson <patrik.r.jakobsson@gmail.com>
      Signed-off-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      [danvet: Improve commit message a bit more, mention that this fixes
      the helper.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/742944bc-9f41-1acb-df4f-0fd4c8a10168@linux.intel.com
      7ea77283
    • M
      drm/vc4: Make pageflip completion handling more robust. · 56d1fe09
      Mario Kleiner 提交于
      Protect both the setup of the pageflip event and the
      latching of the new requested displaylist head pointer
      by the event lock, so we can't get into a situation
      where vc4_atomic_flush latches the new display list via
      HVS_WRITE, then immediately gets preempted before queueing
      the pageflip event, then the page-flip completes in hw and
      the vc4_crtc_handle_page_flip() runs and no-ops due to
      lack of a pending pageflip event, then vc4_atomic_flush
      continues and only then queues the pageflip event - after
      the page flip handling already no-oped. This would cause
      flip completion handling only at the next vblank - one
      frame too late.
      
      In vc4_crtc_handle_page_flip() check the actual DL head
      pointer in SCALER_DISPLACTX against the requested pointer
      for page flip to make sure that the flip actually really
      completed in the current vblank and doesn't get deferred
      to the next one because the DL head pointer was written
      a bit too late into SCALER_DISPLISTX, after start of
      vblank, and missed the boat. This avoids handling a
      pageflip completion too early - one frame too early.
      
      According to Eric, DL head pointer updates which were
      written into the HVS DISPLISTX reg get committed to hardware
      at the last pixel of active scanout. Our vblank interrupt
      handler, as triggered by PV_INT_VFP_START irq, gets to run
      earliest at the first pixel of HBLANK at the end of the
      last scanline of active scanout, ie. vblank irq handling
      runs at least 1 pixel duration after a potential pageflip
      completion happened in hardware.
      
      This ordering of events in the hardware, together with the
      lock protection and SCALER_DISPLACTX sampling of this patch,
      guarantees that pageflip completion handling only runs at
      exactly the vblank irq of actual pageflip completion in all
      cases.
      
      Background info from Eric about the relative timing of
      HVS, PV's and trigger points for interrupts, DL updates:
      
      https://lists.freedesktop.org/archives/dri-devel/2016-May/107510.html
      
      Tested on RPi 2B with hardware timing measurement equipment
      and shown to no longer complete flips too early or too late.
      Signed-off-by: NMario Kleiner <mario.kleiner.de@gmail.com>
      Reviewed-by: NEric Anholt <eric@anholt.net>
      56d1fe09
  19. 02 6月, 2016 1 次提交
  20. 01 6月, 2016 1 次提交
  21. 17 5月, 2016 1 次提交
  22. 03 5月, 2016 1 次提交
    • E
      drm/vc4: Add support for gamma ramps. · e582b6c7
      Eric Anholt 提交于
      We could possibly save a bit of power by not requesting gamma
      conversion when the ramp happens to be 1:1, but at least if all the
      CRTCs are off the SRAM will be disabled.
      
      This should fix brightness sliders in a lot of fullscreen games.
      Signed-off-by: NEric Anholt <eric@anholt.net>
      e582b6c7
  23. 27 2月, 2016 4 次提交
  24. 17 2月, 2016 2 次提交
  25. 08 2月, 2016 1 次提交
  26. 06 1月, 2016 1 次提交
  27. 11 12月, 2015 1 次提交
    • V
      drm: Pass 'name' to drm_crtc_init_with_planes() · f9882876
      Ville Syrjälä 提交于
      Done with coccinelle for the most part. However, it thinks '...' is
      part of the semantic patch, so I put an 'int DOTDOTDOT' placeholder
      in its place and got rid of it with sed afterwards.
      
      I didn't convert drm_crtc_init() since passing the varargs through
      would mean either cpp macros or va_list, and I figured we don't
      care about these legacy functions enough to warrant the extra pain.
      
      @@
      identifier dev, crtc, primary, cursor, funcs;
      @@
       int drm_crtc_init_with_planes(struct drm_device *dev,
                                     struct drm_crtc *crtc,
                                     struct drm_plane *primary, struct drm_plane *cursor,
                                     const struct drm_crtc_funcs *funcs
      +                              ,const char *name, int DOTDOTDOT
                                     )
      { ... }
      
      @@
      identifier dev, crtc, primary, cursor, funcs;
      @@
       int drm_crtc_init_with_planes(struct drm_device *dev,
                                     struct drm_crtc *crtc,
                                     struct drm_plane *primary, struct drm_plane *cursor,
                                     const struct drm_crtc_funcs *funcs
      +                              ,const char *name, int DOTDOTDOT
                                     );
      
      @@
      expression E1, E2, E3, E4, E5;
      @@
       drm_crtc_init_with_planes(E1, E2, E3, E4, E5
      +                          ,NULL
                                 )
      
      v2: Split crtc and plane changes apart
          Pass NULL for no-name instead of ""
          Leave drm_crtc_init() alone
      v3: Add ', or NULL...' to @name kernel doc (Jani)
          Annotate the function with __printf() attribute (Jani)
      Signed-off-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/1449670771-2751-1-git-send-email-ville.syrjala@linux.intel.com
      f9882876
  28. 08 12月, 2015 1 次提交
  29. 18 11月, 2015 1 次提交