1. 08 7月, 2014 1 次提交
    • D
      drm/fb-helper: Fix hpd vs. initial config races · 50c3dc97
      Daniel Vetter 提交于
      Some drivers need to be able to have a perfect race-free fbcon setup.
      Current drivers only enable hotplug processing after the call to
      drm_fb_helper_initial_config which leaves a tiny but important race.
      
      This race is especially noticable on embedded platforms where the
      driver itself enables the voltage for the hdmi output, since only then
      will monitors (after a bit of delay, as usual) respond by asserting
      the hpd pin.
      
      Most of the infrastructure is already there with the split-out
      drm_fb_helper_init. And drm_fb_helper_initial_config already has all
      the required locking to handle concurrent hpd events since
      
      commit 53f1904b
      Author: Daniel Vetter <daniel.vetter@ffwll.ch>
      Date:   Thu Mar 20 14:26:35 2014 +0100
      
          drm/fb-helper: improve drm_fb_helper_initial_config locking
      
      The only missing bit is making drm_fb_helper_hotplug_event save
      against concurrent calls of drm_fb_helper_initial_config. The only
      unprotected bit is the check for fb_helper->fb.
      
      With that drivers can first initialize the fb helper, then enabel
      hotplug processing and then set up the initial config all in a
      completely race-free manner. Update kerneldoc and convert i915 as a
      proof of concept.
      
      Feature requested by Thierry since his tegra driver atm reliably boots
      slowly enough to misses the hotplug event for an external hdmi screen,
      but also reliably boots to quickly for the hpd pin to be asserted when
      the fb helper calls into the hdmi ->detect function.
      
      Cc: Thierry Reding <treding@nvidia.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      50c3dc97
  2. 05 6月, 2014 3 次提交
    • R
      drm/i915: BDW: Adding missing cursor offsets. · 15d24aa5
      Rodrigo Vivi 提交于
      BDW uses IVB cursor offsets.
      
      Whithout this patch it is not possible to use multiple outputs with cursor
      on BDW.
      The cursor gets completely crazy because update position uses the wrong
      cursor register for the second pipe.
      Signed-off-by: NRodrigo Vivi <rodrigo.vivi@gmail.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: NBen Widawsky <ben@bwidawsk.net>
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79621Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      15d24aa5
    • J
      drm/i915: tell the user if both KMS and UMS are disabled · c9cd7b65
      Jani Nikula 提交于
      If both KMS is disabled (by i915.modeset=0 or nomodeset parameters) and
      UMS is disabled (by CONFIG_DRM_I915_UMS=n, the default), the user might
      not be aware his setup is not supported. Inform the users (and, by
      extension, the poor i915 developers having to read their dmesgs in bug
      reports) why their graphics experience might be lacking.
      
      A similar message was added on the UMS path in
      commit e147accb
      Author: Jani Nikula <jani.nikula@intel.com>
      Date:   Thu Oct 10 15:25:37 2013 +0300
      
          drm/i915: tell the user KMS is required for gen6+
      
      but it won't be reached if CONFIG_DRM_I915_UMS=n since
      commit b30324ad
      Author: Daniel Vetter <daniel.vetter@ffwll.ch>
      Date:   Wed Nov 13 22:11:25 2013 +0100
      
          drm/i915: Deprecated UMS support
      
      v2: Use DRM_DEBUG_DRIVER.
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      c9cd7b65
    • D
      drm/i915: Improve irq handling after gpu resets · 78ad455f
      Daniel Vetter 提交于
      Currently we do a full re-init of all interrupts after a gpu hang.
      Which is pretty bad since we don't restore the interrupts we've
      enabled at runtime correctly. Even with that addressed it's rather
      horribly race.
      
      But on g4x and later we only reset the gt and not the entire gpu.
      Which means we only need to reset the GT interrupt bits. Which has the
      nice benefit that vblank waits, pipe CRC interrupts and everything
      else display related just keeps on working.
      
      The downside is that gt interrupt handling (i.e. ring->get/put_irq) is
      still racy. But as long as the gpu hang reliably wakes all waters and
      we have a short time where the refcount drops to 0 we'll recover. So
      not that bad really.
      
      v2: Ville noticed that GTIMR and PMIMR don't get cleared, only the
      subordinate per-ring registers. So let's rip out all the interrupt dancing.
      The FIXME comment is still required though since the ring irq handling
      happens at the per-ring interrupt mask registers, too.
      
      Testcase: igt/kms_flip/vblank-vs-hang
      Testcase: igt/kms_pipe_crc_basic/hang-*
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      78ad455f
  3. 04 6月, 2014 1 次提交
    • 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
  4. 23 5月, 2014 2 次提交
    • I
      drm/i915: disable GT power saving early during system suspend · fe5b1886
      Imre Deak 提交于
      Atm, we disable GT power saving during the end of the suspend sequence
      in i915_save_state(). Doing the disabling at that point seems arbitrary.
      One reason to disable it early though is to have a quiescent HW state
      before we do anything else (for example save registers). So move the
      disabling earlier, which also takes care canceling of the deferred RPS
      enabling work done by intel_disable_gt_powersave().
      
      Note that after the move we'll call intel_disable_gt_powersave() only
      in case modeset is enabled, but that's anyway the only case where we
      have it enabled in the first place.
      Signed-off-by: NImre Deak <imre.deak@intel.com>
      Reviewed-by: NRobert Beckett <robert.beckett@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      fe5b1886
    • I
      drm/i915: remove user GTT mappings early during runtime suspend · d6102977
      Imre Deak 提交于
      Currently user space can access GEM buffers mapped to GTT through
      existing mappings concurrently while the platform specific suspend
      handlers are running. Since these handlers may change the HW state in a
      way that would break such accesses, remove the mappings before calling
      the handlers. Spotted by Ville.
      
      Also Chris pointed out that the lists that i915_gem_release_all_mmaps()
      walks through need dev->struct_mutex, so take this lock. There is a
      potential deadlock against a concurrent RPM resume, resolve this by
      aborting and rescheduling the suspend (Daniel).
      
      v2:
      - take struct_mutex around i915_gem_release_all_mmaps() (Chris, Daniel)
      Signed-off-by: NImre Deak <imre.deak@intel.com>
      Reviewed-by: NRobert Beckett <robert.beckett@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      d6102977
  5. 22 5月, 2014 1 次提交
  6. 21 5月, 2014 1 次提交
  7. 20 5月, 2014 3 次提交
  8. 14 5月, 2014 1 次提交
  9. 13 5月, 2014 1 次提交
  10. 07 5月, 2014 2 次提交
    • I
      drm/i915: vlv: add runtime PM support · ddeea5b0
      Imre Deak 提交于
      Add runtime PM support for VLV, but leave it disabled. The next patch
      enables it.
      
      The suspend/resume sequence used is based on [1] and [2]. In practice we
      depend on the GT RC6 mechanism to save the HW context depending on the
      render and media power wells. By the time we run the runtime suspend
      callback the display side is also off and the HW context for that is
      managed by the display power domain framework.
      
      Besides the above there are Gunit registers that depend on a system-wide
      power well. This power well goes off once the device enters any of the
      S0i[R123] states. To handle this scenario, save/restore these Gunit
      registers. Note that this is not the complete register set dictated by
      [2], to remove some overhead, registers that are known not to be used are
      ignored. Also some registers are fully setup by initialization functions
      called during resume, these are not saved either. The list of registers
      can be further reduced, see the TODO note in the code.
      
      [1] VLV_gfx_clocking_PM_reset_y12w21d3 / "Driver D3 entry/exit"
      [2] VLV2_S0IXRegs
      
      v2:
      - unchanged
      v3:
      - fix s/GEN6_PMIIR/GEN6_PMIMR/ typo when saving/restoring registers
        (Ville)
      v4:
      - rebased on the previous patch fixing GEN register prefixes
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      [ rebased (according to v4) ]
      Signed-off-by: NImre Deak <imre.deak@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ddeea5b0
    • I
      drm/i915: propagate the error code from runtime PM callbacks · 0ab9cfeb
      Imre Deak 提交于
      Atm, none of the RPM callbacks can fail, but the next patch adding
      RPM support for VLV changes this, so prepare for it.
      
      In case one of these callbacks return error RPM will get permanently
      disabled until the error is explicitly cleared. In the future we could
      add support for re-enabling it, for example after resetting the HW, but
      for now - hopefully - we can live with the simpler solution.
      
      v2:
      - propagate the error from the resume callbacks too (Paulo)
      v3:
      - fix rebase fail typo around IS_GEN6() check in intel_runtime_suspend()
      Signed-off-by: NImre Deak <imre.deak@intel.com>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      0ab9cfeb
  11. 05 5月, 2014 12 次提交
  12. 23 4月, 2014 1 次提交
  13. 22 4月, 2014 1 次提交
    • D
      drm/irq: remove cargo-culted locking from irq_install/uninstall · e090c53b
      Daniel Vetter 提交于
      The dev->struct_mutex locking in drm_irq.c only protects
      dev->irq_enabled. Which isn't really much at all and only prevents
      especially nasty ums userspace from concurrently installing the
      interrupt handling a few times. Or at least trying.
      
      There are tons of unlocked readers of dev->irqs_enabled in the vblank
      wait code (and by extension also in the pageflip code since that uses
      the same vblank timestamp engine).
      
      Real modesetting drivers should ensure that nothing can go haywire
      with a sane setup teardown sequence. So we only really need this for
      the drm_control ioctl, everywhere else this will just paper over
      nastiness.
      
      Note that drm/i915 is a bit specially due to the gem+ums combination.
      So there we also need to properly protect the entervt and leavevt
      ioctls. But it's definitely saner to do everything in one go than to
      drop the lock in-between.
      
      Finally there's the gpu reset code in drm/i915. That one's just race
      (concurrent userspace calls to for vblank waits of pageflips could
      spuriously fail). So wrap it up in with a nice comment since fixing
      this is more involved.
      
      v2: Rebase and fix commit message (Thierry)
      Reviewed-by: NThierry Reding <treding@nvidia.com>
      Reviewed-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      e090c53b
  14. 04 4月, 2014 1 次提交
    • I
      drm/i915: move power domain init earlier during system resume · 76c4b250
      Imre Deak 提交于
      During resume the intel hda audio driver depends on the i915 driver
      reinitializing the audio power domain. Since the order of calling the
      i915 resume handler wrt. that of the audio driver is not guaranteed,
      move the power domain reinitialization step to the resume_early
      handler. This is guaranteed to run before the resume handler of any
      other driver.
      
      The power domain initialization in turn requires us to enable the i915
      pci device first, so move that part earlier too.
      
      Accordingly disabling of the i915 pci device should happen after the
      audio suspend handler ran. So move the disabling later from the i915
      resume handler to the resume_late handler.
      
      v2:
      - move intel_uncore_sanitize/early_sanitize earlier too, so they don't
        get reordered wrt. intel_power_domains_init_hw()
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76152Signed-off-by: NImre Deak <imre.deak@intel.com>
      Reviewed-by: NTakashi Iwai <tiwai@suse.de>
      Cc: stable@vger.kernel.org
      [danvet: Add cc: stable and loud comments that this is just a hack.]
      [danvet: Fix "Should it be static?" sparse warning reported by Wu
      Fengguang's kbuilder.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      76c4b250
  15. 02 4月, 2014 4 次提交
  16. 31 3月, 2014 1 次提交
  17. 19 3月, 2014 3 次提交
    • P
      drm/i915: rename __hsw_do_{en, dis}able_pc8 · a14cb6fc
      Paulo Zanoni 提交于
      After we removed all the intermediate abstractions, we can rename
      these functions to just hsw_{en,dis}able_pc8.
      
      v2: - Rebase.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NPaulo Zanoni <paulo.r.zanoni@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      a14cb6fc
    • P
      drm/i915: don't get/put PC8 reference on freeze/thaw · db8384f2
      Paulo Zanoni 提交于
      We already get runtime PM references, and PC8 is now part of runtime
      PM, so this is enough.
      
      v2: - Rebase.
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NPaulo Zanoni <paulo.r.zanoni@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      db8384f2
    • P
      drm/i915: make PC8 be part of runtime PM suspend/resume · a8a8bd54
      Paulo Zanoni 提交于
      Currently, when our driver becomes idle for i915.pc8_timeout (default:
      5s) we enable PC8, so we save some power, but not everything we can.
      Then, while PC8 is enabled, if we stay idle for more
      autosuspend_delay_ms (default: 10s) we'll enter runtime PM and put the
      graphics device in D3 state, saving even more power. The two features
      are separate things with increasing levels of power savings, but if we
      disable PC8 we'll never get into D3.
      
      While from the modularity point of view it would be nice to keep these
      features as separate, we have reasons to merge them:
       - We are not aware of anybody wanting a "PC8 without D3" environment.
       - If we keep both features as separate, we'll have to to test both
         PC8 and PC8+D3 code paths. We're already having a major pain to
         make QA do automated testing of just one thing, testing both paths
         will cost even more.
       - Only Haswell+ supports PC8, so if we want to add runtime PM support
         to, for example, IVB, we'll have to copy some code from the PC8
         feature to runtime PM, so merging both features as a single thing
         will make it easier for enabling runtime PM on other platforms.
      
      This patch only does the very basic steps required to have PC8 and
      runtime PM merged on a single feature: the next patches will take care
      of cleaning up everything.
      
      v2: - Rebase.
      v3: - Rebase.
          - Fully remove the deprecated i915 params since Daniel doesn't
            consider them as part of the ABI.
      v4: - Rebase.
          - Fix typo in the commit message.
      v5: - Rebase, again.
          - Add a huge comment explaining the different forcewake usage
            (Chris, Daniel).
          - Use open-coded forcewake functions (Daniel).
      Signed-off-by: NPaulo Zanoni <paulo.r.zanoni@intel.com>
      Reviewed-by: NImre Deak <imre.deak@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      a8a8bd54
  18. 13 3月, 2014 1 次提交