1. 11 6月, 2014 4 次提交
  2. 05 6月, 2014 7 次提交
  3. 04 6月, 2014 3 次提交
    • D
      drm: Split connection_mutex out of mode_config.mutex (v3) · 6e9f798d
      Daniel Vetter 提交于
      After the split-out of crtc locks from the big mode_config.mutex
      there's still two major areas it protects:
      - Various connector probe states, like connector->status, EDID
        properties, probed mode lists and similar information.
      - The links from connector->encoder and encoder->crtc and other
        modeset-relevant connector state (e.g. properties which control the
        panel fitter).
      
      The later is used by modeset operations. But they don't really care
      about the former since it's allowed to e.g. enable a disconnected VGA
      output or with a mode not in the probed list.
      
      Thus far this hasn't been a problem, but for the atomic modeset
      conversion Rob Clark needs to convert all modeset relevant locks into
      w/w locks. This is required because the order of acquisition is
      determined by how userspace supplies the atomic modeset data. This has
      run into troubles in the detect path since the i915 load detect code
      needs _both_ protections offered by the mode_config.mutex: It updates
      probe state and it needs to change the modeset configuration to enable
      the temporary load detect pipe.
      
      The big deal here is that for the probe/detect users of this lock a
      plain mutex fits best, but for atomic modesets we really want a w/w
      mutex. To fix this lets split out a new connection_mutex lock for the
      modeset relevant parts.
      
      For simplicity I've decided to only add one additional lock for all
      connector/encoder links and modeset configuration states. We have
      piles of different modeset objects in addition to those (like bridges
      or panels), so adding per-object locks would be much more effort.
      
      Also, we're guaranteed (at least for now) to do a full modeset if we
      need to acquire this lock. Which means that fine-grained locking is
      fairly irrelevant compared to the amount of time the full modeset will
      take.
      
      I've done a full audit, and there's just a few things that justify
      special focus:
      - Locking in drm_sysfs.c is almost completely absent. We should
        sprinkle mode_config.connection_mutex over this file a bit, but
        since it already lacks mode_config.mutex this patch wont make the
        situation any worse. This is material for a follow-up patch.
      
      - omap has a omap_framebuffer_flush function which walks the
        connector->encoder->crtc links and is called from many contexts.
        Some look like they don't acquire mode_config.mutex, so this is
        already racy. Again fixing this is material for a separate patch.
      
      - The radeon hot_plug function to retrain DP links looks at
        connector->dpms. Currently this happens without any locking, so is
        already racy. I think radeon_hotplug_work_func should gain
        mutex_lock/unlock calls for the mode_config.connection_mutex.
      
      - Same applies to i915's intel_dp_hot_plug. But again, this is already
        racy.
      
      - i915 load_detect code needs to acquire this lock. Which means the
        w/w dance due to Rob's work will be nicely contained to _just_ this
        function.
      
      I've added fixme comments everywhere where it looks suspicious but in
      the sysfs code. After a quick irc discussion with Dave Airlie it
      sounds like the lack of locking in there is due to sysfs cleanup fun
      at module unload.
      
      v1: original (only compile tested)
      
      v2: missing mutex_init(), etc (from Rob Clark)
      
      v3: i915 needs more care in the conversion:
      - Protect the edp pp logic with the connection_mutex.
      - Use connection_mutex in the backlight code due to
        get_pipe_from_connector.
      - Use drm_modeset_lock_all in suspend/resume paths.
      - Update lock checks in the overlay code.
      
      Cc: Alex Deucher <alexdeucher@gmail.com>
      Cc: Rob Clark <robdclark@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      6e9f798d
    • J
      drm/i915: replace drm_get_encoder_name() with direct name field use · 8e329a03
      Jani Nikula 提交于
      Generated using semantic patches:
      
      @@
      expression E;
      @@
      
      - drm_get_encoder_name(&E)
      + E.name
      
      @@
      expression E;
      @@
      
      - drm_get_encoder_name(E)
      + E->name
      
      v2: Turn drm_get_encoder_name(&E) into E.name instead of &(E)->name.
      Acked-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      8e329a03
    • J
      drm/i915: replace drm_get_connector_name() with direct name field use · c23cc417
      Jani Nikula 提交于
      Generated using semantic patches:
      
      @@
      expression E;
      @@
      
      - drm_get_connector_name(&E)
      + E.name
      
      @@
      expression E;
      @@
      
      - drm_get_connector_name(E)
      + E->name
      
      v2: Turn drm_get_connector_name(&E) into E.name instead of &(E)->name.
      Acked-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      c23cc417
  4. 27 5月, 2014 1 次提交
  5. 23 5月, 2014 1 次提交
  6. 22 5月, 2014 4 次提交
  7. 21 5月, 2014 9 次提交
    • V
      drm/i915: Re-enable vblank irqs for already active pipes · d3eaf884
      Ville Syrjälä 提交于
      If a pipe is already active when we init/resume there might not be a
      full modeset afterwards so drm_vblank_on() may not get called. In such
      a case if someone is holding a vblank reference across a suspend/resume
      cycle drm_vblank_get() called after resuming won't re-enable the vblank
      interrupts.
      
      So in order to make sure vblank interrupts get re-enabled post-resume,
      call drm_vblank_on() in intel_sanitize_crtc() if the crtc is already
      active.
      
      v2: Also drm_vblank_off() if the pipe got disabled magically
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Testecase: igt/kms_flip/vblank-vs-suspend
      Tested-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      d3eaf884
    • D
      drm/i915: Accurately initialize fifo underrun state on gmch platforms · c5ab3bc0
      Daniel Vetter 提交于
      We don't have hardware based disable bits on gmch platforms, so need
      to block spurious underrun reports in software. Which means that we
      _must_ start out with fifo underrun reporting disabled everywhere.
      
      This is in big contrast to ilk/hsw/cpt where there's only _one_
      disable bit for all platforms and hence we must allow underrun
      reporting on disabled pipes. Otherwise nothing really works,
      especially the CRC support since that's key'ed off the same irq
      disable bit.
      
      This allows us to ditch the fifo underrun reporting hack from the vlv
      runtime pm code and unexport the internal function from i915_irq.c
      again. Yay!
      
      v2: Keep the display irq disabling, spotted by Imre.
      
      Cc: Imre Deak <imre.deak@intel.com>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      c5ab3bc0
    • D
      drm/i915: Use new kms-native vblank functions · 87b6b101
      Daniel Vetter 提交于
      Only the low-level irq handling functions still use integer crtc
      indices with this. But fixing that will require a lot more sugery
      and some good ideas for backwards compat with old ums userspace.
      Both in drivers and in the drm core.
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      87b6b101
    • D
      drm/i915: Remove drm_vblank_pre/post_modeset calls · add1d008
      Daniel Vetter 提交于
      Originally these functions have been for user modesetting drivers to
      ensure vblank processing doesn't fall over completely around modeset
      changes. This has been carried over ever since then.
      
      Now that Ville cleaned our vblank handling with an explicit
      drm_vblank_off/on braket when disabling/enabling crtcs. So this seems
      to be unnecessary now. The most important side effect was that due to
      the delayed vblank disabling we have been pretty much guaranteed to
      receive a vblank interrupt soonish after a crtc was enabled.
      
      Note that our vblank handling across modeset is still fairly decent
      fubar - we don't actually handle vblank counter all to well.
      drm_update_vblank_count will make sure that the frame counter always
      rolls forward, but userspace isn't really all to ready to cope with
      the big jumps this causes.
      
      This isn't a big mostly because the hardware retains the frame
      counter. But with runtime pm and also across suspend/resume we fall
      over.
      
      Fixing this is a lot more involved and also needs som i-g-ts. So
      material for another patch series.
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      add1d008
    • V
      drm/i915: Move buffer pinning and ring selection to intel_crtc_page_flip() · 4fa62c89
      Ville Syrjälä 提交于
      All of the .queue_flip() callbacks duplicate the same code to pin the
      buffers and calculate the gtt_offset. Move that code to
      intel_crtc_page_flip(). In order to do that we must also move the ring
      selection logic there.
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      4fa62c89
    • V
      drm/i915: Drop the excessive vblank waits from modeset codepaths · 6304cd91
      Ville Syrjälä 提交于
      Now that we've plugged the mmio vs. ring flip race, we shouldn't need
      these vblank waits in the modeset codepaths anymore. So get rid of
      them.
      
      v2: gen2 needs to wait for planes to turn off before disabling pipe
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NRodrigo Vivi <rodrigo.vivi@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      6304cd91
    • V
      drm/i915: Wait for vblank in hsw_enable_ips() · cea165c3
      Ville Syrjälä 提交于
      Now that the vblank wait is gone from intel_enable_primary_plane(),
      hsw_enable_ips() needs to do the vblank wait itself.
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NRodrigo Vivi <rodrigo.vivi@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      cea165c3
    • V
      drm/i915: Fix mmio vs. CS flip race on ILK+ · 75f7f3ec
      Ville Syrjälä 提交于
      Starting from ILK, mmio flips also cause a flip done interrupt to be
      signalled. This means if we first do a set_base and follow it
      immediately with the CS flip, we might mistake the flip done interrupt
      caused by the set_base as the flip done interrupt caused by the CS
      flip.
      
      The hardware has a flip counter which increments every time a mmio or
      CS flip is issued. It basically counts the number of DSPSURF register
      writes. This means we can sample the counter before we put the CS
      flip into the ring, and then when we get a flip done interrupt we can
      check whether the CS flip has actually performed the surface address
      update, or if the interrupt was caused by a previous but yet
      unfinished mmio flip.
      
      Even with the flip counter we still have a race condition of the CS flip
      base address update happens after the mmio flip done interrupt was
      raised but not yet processed by the driver. When the interrupt is
      eventually processed, the flip counter will already indicate that the
      CS flip has been executed, but it would not actually complete until the
      next start of vblank. We can use the DSPSURFLIVE register to check
      whether the hardware is actually scanning out of the buffer we expect,
      or if we managed hit this race window.
      
      This covers all the cases where the CS flip actually changes the base
      address. If the base address remains unchanged, we might still complete
      the CS flip before it has actually completed. But since the address
      didn't change anyway, the premature flip completion can't result in
      userspace overwriting data that's still being scanned out.
      
      CTG already has the flip counter and DSPSURFLIVE registers, and
      although the flip done interrupt is still limited to CS flips alone,
      the code now also checks the flip counter on CTG as well.
      
      v2: s/dspsurf/gtt_offset/ (Chris)
      
      Testcase: igt/kms_mmio_vs_cs_flip/setcrtc_vs_cs_flip
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73027Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NRodrigo Vivi <rodrigo.vivi@gmail.com>
      [danvet: Add g4x_ prefix to flip_count_after_eq.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      75f7f3ec
    • V
      drm: Add drm_vblank_on() · f2752282
      Ville Syrjälä 提交于
      drm_vblank_off() will turn off vblank interrupts, but as long as the
      refcount is elevated drm_vblank_get() will not re-enable them. This
      is a problem is someone is holding a vblank reference while a modeset is
      happening, and the driver requires vblank interrupt to work during that
      time.
      
      Add drm_vblank_on() as a counterpart to drm_vblank_off() which will
      re-enabled vblank interrupts if the refcount is already elevated. This
      will allow drivers to choose the specific places in the modeset sequence
      at which vblank interrupts get disabled and enabled.
      
      Testcase: igt/kms_flip/*-vs-suspend
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      [danvet: Add Testcase tag for the igt I've written.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      f2752282
  8. 20 5月, 2014 11 次提交