1. 24 Jan, 2014 14 commits
    • Paulo Zanoni's avatar
      drm/i915: don't wait for power cycle when waiting for power off · 1a5ef5b7
      Paulo Zanoni authored
      Function ironlake_wait_panel_off should just wait for the power off
      delay, while function ironlake_wait_panel_power_cycle should wait for
      the panel cycle (that's required after we turn the panel off, before
      we enable it again).
      
      The problem is that, currently, ironlake_wait_panel_off is waiting not
      just for the panel to be off, but also for the power cycle delay and
      the backlight off delay. This function relies on the PP_STATUS bits
      3:0, which are not documented and not supposed to be used. A quick
      analysis of the values we get while waiting quickly shows that power
      off is reached while bits 3:0 are still 0x1, and the time it takes to
      become 0x0 is the power cycle delay.
      
      On my system with backlight off delay of 200ms, power down delay of
      50ms and power cycle delay of 500ms, this is what I get:
       - Start waiting with value 0x80000008, timestamp 6.429364.
       - Jumps to 0xa0000003, timestamp 6.431360 (time waited: 0.001996)
       - Jumps to 0xa0000002, timestamp 6.631277 (time waited: 0.201913)
       - Jumps to 0x08000001, timestamp 6.681258 (time waited: 0.251894)
       - Jumps to 0x00000000, timestamp 7.192012 (time waited: 0.762648)
      
      As you can see, ironlake_wait_panel_off is sleeping 760ms instead of
      the expected 50ms: the first 200ms matches the backlight off delay
      (which we should already have waited for!), then the 50ms for the real
      panel off delay, then the 500ms for the panel power cycle.
      
      This patch makes is look just at bits 31 and 29:28, which will ignore
      the panel power cycle.
      
      And just to be clear: this saves 500ms on my system every time we
      disable the panel. But we can still save 200ms more (the backlight off
      delay) on the next patches.
      Signed-off-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
      Reviewed-by: default avatarJesse Barnes <jbarnes@virtuougseek.org>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      1a5ef5b7
    • Paulo Zanoni's avatar
      drm/i915: remove a column of zeros from the eDP wait definitions · ffd6749d
      Paulo Zanoni authored
      I like how the macros are nicely column-aligned, so we can properly
      compare what each macro waits for, but a column full of zeroes doesn't
      really help anything: it just makes the lines bigger, and they're
      already way past 80 columns. I imagine this column was used in the
      past, but IMHO now we can get rid of it.
      Signed-off-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
      Reviewed-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      ffd6749d
    • Daniel Vetter's avatar
      drm/i915: drop ironlake_ prefix from edp panel/backlight functions · 4be73780
      Daniel Vetter authored
      They now also work on vlv, which has the regs somewhere else. And
      daring a glance into the looking glass it seems like this
      functionality will continue to work the same for the next few hardware
      platforms.
      
      So it's better to just remove that misleading prefix and have a bit
      shorter code for better readability.
      
      The only exceptions are the panel/backlight functions shared with
      intel_ddi.c, those get an intel_ prefix.
      
      While at it make the vdd_on/off functions static.
      
      And one straggler was missing the edp_ in the name, so make everything
      neatly OCD.
      
      Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      4be73780
    • Paulo Zanoni's avatar
      drm/i915: save some time when waiting the eDP timings · dce56b3c
      Paulo Zanoni authored
      The eDP spec defines some points where after you do action A, you have
      to wait some time before action B. The thing is that in our driver
      action B does not happen exactly after action A, but we still use
      msleep() calls directly. What this patch does is that we record the
      timestamp of when action A happened, then, just before action B, we
      look at how much time has passed and only sleep the remaining amount
      needed.
      
      With this change, I am able to save about 5-20ms (out of the total
      200ms) of the backlight_off delay and completely skip the 1ms
      backlight_on delay. The 600ms vdd_off delay doesn't happen during
      normal usage anymore due to a previous patch.
      
      v2: - Rename ironlake_wait_jiffies_delay to intel_wait_until_after and
            move it to intel_display.c
          - Fix the msleep call: diff is in jiffies
      v3: - Use "tmp_jiffies" so we don't need to worry about the value of
            "jiffies" advancing while we're doing the math.
      v4: - Rename function again.
          - Move function to i915_drv.h.
          - Store last_power_cycle at edp_panel_off too.
          - Use msecs_to_jiffies_timeout, then replace the msleep with an
            open-coded version that avoids the extra +1 jiffy.
          - Try to add units to every variable name so we don't confuse
            jiffies with milliseconds.
      Signed-off-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
      Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      dce56b3c
    • Paulo Zanoni's avatar
      drm/i915: init the DP panel power seq variables earlier · 0095e6dc
      Paulo Zanoni authored
      Our driver has two different ways of waiting for panel power
      sequencing delays. One of these ways is through
      ironlake_wait_panel_status, which implicitly uses the values written
      to our registers. The other way is through the functions that call
      intel_wait_until_after, and on this case we do direct msleep() calls
      on the intel_dp->xxx_delay variables.
      
      Function intel_dp_init_panel_power_sequencer is responsible for
      initializing the _delay variables and deciding which values we need to
      write to the registers, but it does not write these values to the
      registers. Only at intel_dp_init_panel_power_sequencer_registers we
      actually do this write.
      
      Then problem is that when we call intel_dp_i2c_init, we will get some
      I2C calls, which will trigger a VDD enable, which will make use of the
      panel power sequencing registers and the _delay variables, so we need
      to have both ready by this time. Today, when this happens, the _delay
      variables are zero (because they were not computed) and the panel
      power sequence registers contain whatever values were written by the
      BIOS (which are usually correct).
      
      What this patch does is to make sure that function
      intel_dp_init_panel_power_sequencer is called earlier, so by the time
      we call intel_dp_i2c_init, the _delay variables will already be
      initialized. The actual registers won't contain their final values,
      but at least they will contain the values set by the BIOS.
      
      The good side is that we were reading the values, but were not using
      them for anything (because we were just skipping the msleep(0) calls),
      so this "fix" shouldn't fix any real existing bugs. I was only able to
      identify the problem because I added some debug code to check how much
      time time we were saving with my previous patch.
      
      Regression introduced by:
          commit ed92f0b2
          Author: Paulo Zanoni <paulo.r.zanoni@intel.com>
          Date:   Wed Jun 12 17:27:24 2013 -0300
              drm/i915: extract intel_edp_init_connector
      
      v2: - Rewrite commit message.
      Reviewed-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      0095e6dc
    • Daniel Vetter's avatar
      drm/i915: Only restore backlight combination mode reg for ums · 7f1bdbcb
      Daniel Vetter authored
      This was forgotten in
      
      commit 565ee389
      Author: Jani Nikula <jani.nikula@intel.com>
      Date:   Wed Nov 13 12:56:29 2013 +0200
      
          drm/i915: do not save/restore backlight registers in KMS
      
      Since the confusion was likely due to the duplicated definition for
      this pci config register, let's unify that, too.
      
      Cc: Jani Nikula <jani.nikula@intel.com>
      Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      7f1bdbcb
    • Imre Deak's avatar
      drm/i915: clean up HPD IRQ debug printing · cc9bd499
      Imre Deak authored
      Atm, we don't print these events for all platforms and for VLV/G4X we
      also print them for DP AUX completion events which is unnecessary spam.
      Fix both issues.
      Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      cc9bd499
    • Damien Lespiau's avatar
      drm/i915: Don't use i915_preliminary_hw_support to mean pre-production · 4167e32c
      Damien Lespiau authored
      Those are two distinct concepts. Just use a comment to remind us to
      remove that W/A at some point.
      Signed-off-by: default avatarDamien Lespiau <damien.lespiau@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      4167e32c
    • Ville Syrjälä's avatar
      drm/i915: Set crtc->new_config to NULL for pipes that are about to be disabled · 7bd0a8e7
      Ville Syrjälä authored
      crtc->new_config is only relevant for pipes that are going to be active
      post-modeset. Set the pointer to NULL for all pipes that are going to
      be disabled. This is done to help catch bugs where some piece of code
      would go looking at crtc->new_config even if the data there is stale.
      
      v2: Clear new_config in disable_crtc_nofb() too (Imre)
      Suggested-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      7bd0a8e7
    • Ville Syrjälä's avatar
      drm/i915: Don't oops if the initial modeset fails · 7d00a1f5
      Ville Syrjälä authored
      If the first modeset operation fails, we will attempt to restore the
      previous configuration that we read out from the hardware. But as we
      don't yet reconstruct the framebuffer information, we end up calling
      the modeset code with an enabled crtc but with fb==NULL. This will
      lead to an oops within the modeset code.
      
      Check for NULL fb when restoring the configuration, and instead of
      oopsing simply disable the pipe.
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      7d00a1f5
    • Ville Syrjälä's avatar
      drm/i915: Use new_config and new_enabled to simplify the VLV cdclk code · 2f2d7aa1
      Ville Syrjälä authored
      On VLV we need to compute the new cdclk before we've updated the current
      state. The code achieved that in a somewhat complex way. Now that we
      have new_enabled and new_config, we can simplify the code quite a bit.
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      2f2d7aa1
    • Ville Syrjälä's avatar
      drm/i915: Prepare to track new pipe config per pipe · 50741abc
      Ville Syrjälä authored
      Add a new_config pointer to intel_crtc which will point to the new pipe
      config for said crtc while intel_crtc.config will still contain the old
      config during first parts of the modeset operation. This is a step
      towards having the entire new state available during the compute phase,
      so that we can make accurate decisions about global resource usage.
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      50741abc
    • Ville Syrjälä's avatar
      drm/i915: Pre-compute pipe enabled state · 7668851f
      Ville Syrjälä authored
      Add 'new_enabled' to intel_crtc and precompute it alongside new_encoder
      and new_crtc. This will allow making decisions about shared resources
      that are affected by the set of active pipes, before we've clobbered
      anything for real.
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      7668851f
    • Daniel Vetter's avatar
      Revert "drm/i915: Mask reserved bits in display/sprite address registers" · 85ba7b7d
      Daniel Vetter authored
      This reverts commit 446f2545.
      
      I've left the masking in the pageflip code since that seems to be some
      useful piece of preemptive robustness.
      
      Iirc I've merged this patch under the assumption that the BIOS leaves
      some random gunk in the lower bits and gets unhappy if we trample on
      them. We have quite a few case like this, so this made sense.
      
      Now I've just learned that there's actual hardware features bits in
      the low 12 bits, and the kernel needs to preserve them to allow a
      userspace blob to do its job. Given Dave Airlie's clear stance on
      userspace blob drivers I've quickly chatted with him and he doesn't
      seem too happy. So let's revert this.
      
      If there are indeed bits that we must preserve in this range then we
      can ressurrect this patch, but with proper documentation for those
      bits supplied. And we probably also need to think a bit about
      interactions with our driver.
      
      Cc: Armin Reese <armin.c.reese@intel.com>
      Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
      Cc: Dave Airlie <airlied@linux.ie>
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      85ba7b7d
  2. 23 Jan, 2014 1 commit
  3. 22 Jan, 2014 15 commits
  4. 21 Jan, 2014 6 commits
    • Dave Airlie's avatar
      Merge branch 'drm-vbl-timestamp' of git://gitorious.org/vsyrjala/linux into drm-next · f5395ba3
      Dave Airlie authored
      Here's the vblank timestamp pull request you wanted.
      
      I addressed the few bugs that Mario pointed out and added
      the r-bs.
      
      As it has been a while since I made the changes, I gave it a
      quick spin on a few different i915 machines. Fortunately
      everything still seems to be fine.
      
      * 'drm-vbl-timestamp' of git://gitorious.org/vsyrjala/linux:
        drm/i915: Add a kludge for DSL incrementing too late and ISR not working
        drm/radeon: Move the early vblank IRQ fixup to radeon_get_crtc_scanoutpos()
        drm: Pass 'flags' from the caller to .get_scanout_position()
        drm: Fix vblank timestamping constants for interlaced modes
        drm/i915: Fix scanoutpos calculations for interlaced modes
        drm: Change {pixel,line,frame}dur_ns from s64 to int
        drm: Use crtc_clock in drm_calc_timestamping_constants()
        drm/radeon: Populate crtc_clock in radeon_atom_get_tv_timings()
        drm: Simplify the math in drm_calc_timestamping_constants()
        drm: Improve drm_calc_timestamping_constants() documentation
        drm/i915: Call drm_calc_timestamping_constants() earlier
        drm/i915: Kill hwmode save/restore
        drm: Pass the display mode to drm_calc_vbltimestamp_from_scanoutpos()
        drm: Pass the display mode to drm_calc_timestamping_constants()
      f5395ba3
    • Dave Airlie's avatar
      Merge branch 'topic/core-stuff' of git://people.freedesktop.org/~danvet/drm-intel into drm-next · 2b76a676
      Dave Airlie authored
      Some straggling drm core patches
      
      * 'topic/core-stuff' of git://people.freedesktop.org/~danvet/drm-intel:
        drm/gem: Always initialize the gem object in object_init
        drm/edid: Populate picture aspect ratio for CEA modes
        drm/edid: parse the list of additional 3D modes
        drm/edid: split VIC display mode lookup into a separate function
        drm: Make the connector mode_valid() vfunc return a drm_mode_status enum
      2b76a676
    • Dave Airlie's avatar
      Merge branch 'vmwgfx-next' of git://people.freedesktop.org/~thomash/linux into drm-next · aec476a6
      Dave Airlie authored
      Just a single fix for sparse/smatch warnings introduced by the previous
      vmwgfx-next pull.
      
      * 'vmwgfx-next' of git://people.freedesktop.org/~thomash/linux:
        drm/vmwgfx: Fix recently introduced sparse / smatch warnings and errors
      aec476a6
    • Thomas Hellstrom's avatar
    • Daniel Vetter's avatar
      drm/gem: Always initialize the gem object in object_init · 6ab11a26
      Daniel Vetter authored
      At least drm/i915 expects that the obj->dev pointer is set even in
      failure paths. Specifically when the shmem initialization fails we
      call i915_gem_object_free which needs to deref obj->base.dev to get at
      the slab pointer in the device private structure. And the shmem
      allocation can easily fail when userspace is hitting open file limits.
      
      Doing the structure init even when the shmem file allocation fails
      prevents this Oops.
      
      This is a regression from
      
      commit 89c8233f
      Author: David Herrmann <dh.herrmann@gmail.com>
      Date:   Thu Jul 11 11:56:32 2013 +0200
      
          drm/gem: simplify object initialization
      
      v2: Add regression note which Chris supplied.
      
      Testcase: igt/gem_fd_exhaustion
      Reported-and-Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      References: http://lists.freedesktop.org/archives/intel-gfx/2014-January/038433.html
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      Cc: David Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      6ab11a26
    • Dave Airlie's avatar
      Merge branch 'drm-next-3.14' of git://people.freedesktop.org/~agd5f/linux into drm-next · 8c9b2e32
      Dave Airlie authored
      New tree with the INFO ioctl merge fixed up.  This also adds a couple
      of additional minor fixes.
      
      A few more changes for 3.14, mostly just bug fixes.  Note that:
      drm/radeon: add query to fetch the max engine clock.
      will conflict with 3.13 final, but the fix is pretty obvious.
      
      * 'drm-next-3.14' of git://people.freedesktop.org/~agd5f/linux: (22 commits)
        drm/radeon: add UVD support for OLAND
        drm/radeon: fix minor typos in si_dpm.c
        drm/radeon: set the full cache bit for fences on r7xx+
        drm/radeon: fix surface sync in fence on cayman (v2)
        drm/radeon/dpm: disable mclk switching on desktop RV770
        drm/radeon: fix endian handling in radeon_atom_init_mc_reg_table
        drm/radeon: write gfx pg bases even when gfx pg is disabled
        drm/radeon: bail early from enable ss in certain cases
        drm/radeon: handle ss percentage divider properly
        drm/radeon: add query to fetch the max engine clock (v2)
        drm/radeon/dp: sleep after powering up the display
        drm/radeon/dp: use usleep_range rather than udelay
        drm/radeon/dp: bump i2c-over-aux retries to 7
        drm/radeon: disable ss on DP for DCE3.x
        drm/radeon/cik: use hw defaults for TC_CFG registers
        drm/radeon: disable dpm on BTC
        drm/radeon/cik: use WAIT_REG_MEM special op for CP HDP flush
        drm/radeon/cik: use POLL_REG_MEM special op for sDMA HDP flush
        drm/radeon: consolidate sdma hdp flushing code for CIK
        drm/radeon: consolidate cp hdp flushing code for CIK
        ...
      8c9b2e32
  5. 20 Jan, 2014 4 commits