1. 25 Jul, 2016 2 commits
    • Imre Deak's avatar
      drm/i915/bxt: Fix inadvertent CPU snooping due to incorrect MOCS config · 1542f5d9
      Imre Deak authored
      Setting a write-back cache policy in the MOCS entry definition also
      implies snooping, which has a considerable overhead. This is
      unexpected for a few reasons:
      - From user-space's point of view since it didn't want a coherent
        surface (it didn't set the buffer as such via the set caching IOCTL).
      - There is a separate MOCS entry field for snooping (which we never
        set).
      - This MOCS table is about caching in (e)LLC and there is no (e)LLC on
        BXT. There is a separate table for L3 cache control.
      
      Considering the above the current behavior of snooping looks like an
      unintentional side-effect of the WB setting. Changing it to be LLC-UC
      gets rid of the snooping without any ill-effects. For a coherent
      surface the application would use a separate MOCS entry at index 1 and
      call the set caching IOCTL to setup the PTE entries for the
      corresponding buffer to be snooped. In the future we could also add a
      new MOCS entry for coherent surfaces.
      
      This resulted in 70% improvement in synthetic texturing benchmarks.
      
      Kudos to Valtteri Rantala, Eero Tamminen and Michael T Frederick and
      Ville who helped to narrow the source of problem to the kernel and to
      the snooping behaviour in particular.
      
      With a follow-up change to adjust the 3rd entry value
      igt/gem_mocs_settings is passing after this change.
      
      v2:
      - Rebase on v2 of patch 1/2.
      v3:
      - Set the entry as LLC uncached instead of PTE-passthrough. This way
        we also keep snooping disabled, but we also make the cacheability/
        coherency setting indepent of the PTE which is managed by the
        kernel. (Chris)
      
      CC: Rong R Yang <rong.r.yang@intel.com>
      CC: Yakui Zhao <yakui.zhao@intel.com>
      CC: Valtteri Rantala <valtteri.rantala@intel.com>
      CC: Eero Tamminen <eero.t.tamminen@intel.com>
      CC: Michael T Frederick <michael.t.frederick@intel.com>
      CC: Ville Syrjälä <ville.syrjala@linux.intel.com>
      CC: Chris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
      Acked-by: default avatarZhao Yakui <yakui.zhao@intel.com>
      Tested-by: default avatarRong R Yang <rong.r.yang@intel.com>
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1467380406-11954-3-git-send-email-imre.deak@intel.com
      (cherry picked from commit 6bee14ed)
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      1542f5d9
    • Imre Deak's avatar
      drm/i915/gen9: Clean up MOCS table definitions · 60050855
      Imre Deak authored
      Use named struct initializers for clarity. Also fix the target cache
      definition to reflect its role in GEN9 onwards. On GEN8 a TC value of 0
      meant ELLC but on GEN9+ it means the TC and LRU controls are taken from
      the PTE.
      
      No functional change, igt/gem_mocs_settings still passing after this
      change.
      
      v2: (Chris)
      - Add back the hexa literals for the entries.
        Add note that igt/gem_mocs_settings still passes.
      
      CC: Rong R Yang <rong.r.yang@intel.com>
      CC: Yakui Zhao <yakui.zhao@intel.com>
      CC: Chris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
      Acked-by: default avatarZhao Yakui <yakui.zhao@intel.com>
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1467380406-11954-2-git-send-email-imre.deak@intel.com
      (cherry picked from commit e419899b)
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      60050855
  2. 19 Jul, 2016 5 commits
    • Bob Paauwe's avatar
      drm/i915: Set legacy properties when using legacy gamma set IOCTL. (v2) · fa959860
      Bob Paauwe authored
      The i915 driver is now using atomic properties and atomic commit
      to handle the legacy set gamma IOCTL. However, if the driver is
      configured without atomic (nuclear_pageflip = false), it won't
      update the legacy properties for degamma_lut, gamma_lut and ctm
      leaving them out of sync with the atomic version of the properties.
      
      Until the driver is full atomic, make sure we update the non-atomic
      version of the properties.
      
      v2: Update the comment with a FIXME.  (Daniel)
      
      v3: Update arguments of the gamma_set vfunc (Lionel)
      
      v4: Fixed vfunc prototype (Lionel)
      
      igt-testcase: kms_pipe_color / legacy-gamma-reset-pipeX
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: stable@vger.kernel.org #v4.7
      Signed-off-by: default avatarBob Paauwe <bob.j.paauwe@intel.com>
      Signed-off-by: default avatarLionel Landwerlin <lionel.g.landwerlin@intel.com>
      Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1468591142-2253-1-git-send-email-lionel.g.landwerlin@intel.com
      (cherry picked from commit a8784875)
      fa959860
    • Lyude's avatar
      drm/i915: Enable polling when we don't have hpd · 84c8e096
      Lyude authored
      Unfortunately, there's two situations where we lose hpd right now:
      - Runtime suspend
      - When we've shut off all of the power wells on Valleyview/Cherryview
      
      While it would be nice if this didn't cause issues, this has the
      ability to get us in some awkward states where a user won't be able to
      get their display to turn on. For instance; if we boot a Valleyview
      system without any monitors connected, it won't need any of it's power
      wells and thus shut them off. Since this causes us to lose HPD, this
      means that unless the user knows how to ssh into their machine and do a
      manual reprobe for monitors, none of the monitors they connect after
      booting will actually work.
      
      Eventually we should come up with a better fix then having to enable
      polling for this, since this makes rpm a lot less useful, but for now
      the infrastructure in i915 just isn't there yet to get hpd in these
      situations.
      
      Changes since v1:
       - Add comment explaining the addition of the if
         (!mode_config->poll_running) in intel_hpd_init()
       - Remove unneeded if (!dev->mode_config.poll_enabled) in
         i915_hpd_poll_init_work()
       - Call to drm_helper_hpd_irq_event() after we disable polling
       - Add cancel_work_sync() call to intel_hpd_cancel_work()
      
      Changes since v2:
       - Apparently dev->mode_config.poll_running doesn't actually reflect
         whether or not a poll is currently in progress, and is actually used
         for dynamic module paramter enabling/disabling. So now we instead
         keep track of our own poll_running variable in dev_priv->hotplug
       - Clean i915_hpd_poll_init_work() a little bit
      
      Changes since v3:
       - Remove the now-redundant connector loop in intel_hpd_init(), just
         rely on intel_hpd_poll_enable() for setting connector->polled
         correctly on each connector
       - Get rid of poll_running
       - Don't assign enabled in i915_hpd_poll_init_work before we actually
         lock dev->mode_config.mutex
       - Wrap enabled assignment in i915_hpd_poll_init_work() in READ_ONCE()
         for doc purposes
       - Do the same for dev_priv->hotplug.poll_enabled with WRITE_ONCE in
         intel_hpd_poll_enable()
       - Add some comments about racing not mattering in intel_hpd_poll_enable
      
      Changes since v4:
       - Rename intel_hpd_poll_enable() to intel_hpd_poll_init()
       - Drop the bool argument from intel_hpd_poll_init()
       - Remove redundant calls to intel_hpd_poll_init()
       - Rename poll_enable_work to poll_init_work
       - Add some kerneldoc for intel_hpd_poll_init()
       - Cross-reference intel_hpd_poll_init() in intel_hpd_init()
       - Just copy the loop from intel_hpd_init() in intel_hpd_poll_init()
      
      Changes since v5:
       - Minor kerneldoc nitpicks
      
      Cc: stable@vger.kernel.org
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarLyude <cpaul@redhat.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      (cherry picked from commit 19625e85)
      84c8e096
    • Lyude's avatar
      drm/i915/vlv: Disable HPD in valleyview_crt_detect_hotplug() · 21842ea8
      Lyude authored
      One of the things preventing us from using polling is the fact that
      calling valleyview_crt_detect_hotplug() when there's a VGA cable
      connected results in sending another hotplug. With polling enabled when
      HPD is disabled, this results in a scenario like this:
      
      - We enable power wells and reset the ADPA
      - output_poll_exec does force probe on VGA, triggering a hpd
      - HPD handler waits for poll to unlock dev->mode_config.mutex
      - output_poll_exec shuts off the ADPA, unlocks dev->mode_config.mutex
      - HPD handler runs, resets ADPA and brings us back to the start
      
      This results in an endless irq storm getting sent from the ADPA
      whenever a VGA connector gets detected in the middle of polling.
      
      Somewhat based off of the "drm/i915: Disable CRT HPD around force
      trigger" patch Ville Syrjälä sent a while back
      
      Cc: stable@vger.kernel.org
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarLyude <cpaul@redhat.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      (cherry picked from commit b236d7c8)
      21842ea8
    • Lyude's avatar
      drm/i915/vlv: Reset the ADPA in vlv_display_power_well_init() · 4c732e6e
      Lyude authored
      While VGA hotplugging worked(ish) before, it looks like that was mainly
      because we'd unintentionally enable it in
      valleyview_crt_detect_hotplug() when we did a force trigger. This
      doesn't work reliably enough because whenever the display powerwell on
      vlv gets disabled, the values set in VLV_ADPA get cleared and
      consequently VGA hotplugging gets disabled. This causes bugs such as one
      we found on an Intel NUC, where doing the following sequence of
      hotplugs:
      
            - Disconnect all monitors
            - Connect VGA
            - Disconnect VGA
            - Connect HDMI
      
      Would result in VGA hotplugging becoming disabled, due to the powerwells
      getting toggled in the process of connecting HDMI.
      
      Changes since v3:
       - Expose intel_crt_reset() through intel_drv.h and call that in
         vlv_display_power_well_init() instead of
         encoder->base.funcs->reset(&encoder->base);
      
      Changes since v2:
       - Use intel_encoder structs instead of drm_encoder structs
      
      Changes since v1:
       - Instead of handling the register writes ourself, we just reuse
         intel_crt_detect()
       - Instead of resetting the ADPA during display IRQ installation, we now
         reset them in vlv_display_power_well_init()
      
      Cc: stable@vger.kernel.org
      Acked-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarLyude <cpaul@redhat.com>
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      [danvet: Rebase over dev_priv/drm_device embedding.]
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      (cherry picked from commit 9504a892)
      4c732e6e
    • Lyude's avatar
      drm/i915/vlv: Make intel_crt_reset() per-encoder · 4570d833
      Lyude authored
      This lets call intel_crt_reset() in contexts where IRQs are disabled and
      as such, can't hold the locks required to work with the connectors.
      
      Cc: stable@vger.kernel.org
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Acked-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarLyude <cpaul@redhat.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      (cherry picked from commit 28cf71ce)
      4570d833
  3. 14 Jul, 2016 2 commits
  4. 11 Jul, 2016 1 commit
  5. 10 Jul, 2016 2 commits
  6. 08 Jul, 2016 1 commit
  7. 07 Jul, 2016 13 commits
  8. 06 Jul, 2016 4 commits
  9. 05 Jul, 2016 8 commits
  10. 04 Jul, 2016 2 commits