1. 23 2月, 2015 2 次提交
    • D
      drm/irq: Don't call ->get_vblank_counter directly from irq_uninstall/cleanup · 3bff93d6
      Daniel Vetter 提交于
      The pipe might already have been shut down, and then it's not a good
      idea to call hw accessor functions. Instead use the same logic as
      drm_vblank_off which has all the necessary checks to avoid troubles or
      inconsistency.
      
      Noticed by Imre while reviewing my patches to remove some sanity
      checks from ->get_vblank_counter.
      
      v2: Try harder. disable_and_save can still access the vblank stuff
      when vblank->enabled isn't set. It has to, since vlbank irq could be
      disable but the pipe is still on when being called from
      drm_vblank_off. But we still want to use that code for more code
      sharing. So add a check for vblank->enabled on top - if that's not set
      we shouldn't have anyone waiting for the vblank. If we have that's a
      pretty serious bug.
      
      The other issue that Imre spotted is drm_vblank_cleanup. That code
      again calls disable_and_save and so suffers from the same issues. But
      really drm_irq_uninstall should have cleaned that all up, so replace
      the code with WARN_ON. Note that we can't delete the timer cleanup
      since drivers aren't required to use drm_irq_install/uninstall, but
      can do their own irq handling.
      
      v3: Make it clear that all that gunk in drm_irq_uninstall is really
      just bandaids for UMS races between the irq/vblank code. In UMS
      userspace is in control of enabling/disabling interrupts in general
      and vblanks specifically.
      
      v4: Imre observed that KMS drivers all call drm_vblank_cleanup before
      drm_irq_uninstall (as they should), so again the code in there is dead
      for KMS (due to dev->num_crtcs == 0 after drm_vblank_cleanup). Or
      should be, so only WARN for KMS - with UMS userspace could try to do
      evil things.
      
      v5: After more discussion on irc we've gone back to v3: the
      del_timer_sync is required in all cases in drm_vblank_cleanup, but
      let's restrict the WARN_ON to kms drivers only. Imre was also
      concerned that bad things could happen without the disable_and_save
      call. But we immediately free vblank structures afterwards which makes
      the save useless. And drm_handle_vblank has a check for dev->num_crtcs
      to avoid surprises with ums.
      
      Cc: Imre Deak <imre.deak@intel.com>
      Reviewed-by: NImre Deak <imre.deak@intel.com>
      Acked-by: NDave Airlie <airlied@redhat.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      3bff93d6
    • D
      drm/irq: Add drm_crtc_vblank_reset · 9625604c
      Daniel Vetter 提交于
      At driver load we need to tell the vblank code about the state of the
      pipes, so that the logic around reject vblank_get when the pipe is off
      works correctly.
      
      Thus far i915 used drm_vblank_off, but one of the side-effects of it
      is that it also saves the vblank counter. And for that it calls down
      into the ->get_vblank_counter hook. Which isn't really a good idea
      when the pipe is off for a few reasons:
      - With runtime pm the register might not respond.
      - If the pipe is off some datastructures might not be around or
        unitialized.
      
      The later is what blew up on gen3: We look at intel_crtc->config to
      compute the vblank counter, and for a disabled pipe at boot-up that's
      just not there. Thus far this was papered over by a check for
      intel_crtc->active, but I want to get rid of that (since it's fairly
      race, vblank hooks are called from all kinds of places).
      
      So prep for that by adding a _reset functions which only does what we
      really need to be done at driver load: Mark the vblank pipe as off,
      but don't do any vblank counter saving or event flushing - neither of
      that is required.
      
      v2: Clarify the code flow slightly as suggested by Ville.
      
      v3: Fix kerneldoc spelling, spotted by Laurent.
      
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Reviewed-by: Imre Deak <imre.deak@intel.com> (v2)
      Acked-by: NDave Airlie <airlied@redhat.com>
      Acked-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      9625604c
  2. 17 12月, 2014 3 次提交
  3. 10 12月, 2014 2 次提交
  4. 09 12月, 2014 1 次提交
  5. 20 11月, 2014 1 次提交
  6. 21 10月, 2014 1 次提交
  7. 24 9月, 2014 2 次提交
  8. 12 9月, 2014 1 次提交
  9. 11 9月, 2014 4 次提交
  10. 10 9月, 2014 1 次提交
  11. 11 8月, 2014 1 次提交
    • D
      drm/irq: Implement a generic vblank_wait function · e8450f51
      Daniel Vetter 提交于
      As usual in both a crtc index and a struct drm_crtc * version.
      
      The function assumes that no one drivers their display below 10Hz, and
      it will complain if the vblank wait takes longer than that.
      
      v2: Also check dev->max_vblank_counter since some drivers register a
      fake get_vblank_counter function.
      
      v3: Use drm_vblank_count instead of calling the low-level
      ->get_vblank_counter callback. That way we'll get the sw-cooked
      counter for platforms without proper vblank support and so can ditch
      the max_vblank_counter check again.
      
      v4: Review from Michel Dänzer:
      - Restore lost notes about v3:
      - Spelling in kerneldoc.
      - Inline wait_event condition.
      - s/vblank_wait/wait_one_vblank/
      
      Cc: Michel Dänzer <michel@daenzer.net>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NMichel Dänzer <michel.daenzer@amd.com>
      Reviewed-by: NMatt Roper <matthew.d.roper@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      e8450f51
  12. 07 8月, 2014 15 次提交
  13. 24 7月, 2014 1 次提交
  14. 22 5月, 2014 1 次提交
  15. 21 5月, 2014 4 次提交