1. 07 May, 2014 8 commits
  2. 06 May, 2014 13 commits
  3. 05 May, 2014 19 commits
    • Ben Widawsky's avatar
      drm/i915: Support 64b relocations · d9ceb957
      Ben Widawsky authored
      All the rest of the code to enable this is in my branch. Without my
      branch, hitting > 32b offsets is impossible. The code has always
      "supported" 64b, but it's never actually been run of tested. This change
      doesn't actually fix anything. [1] I am not sure why X won't work yet. I
      do not get hangs or obvious errors.
      
      There are 3 fixes grouped together here. First is to remove the
      hardcoded 0 for the upper dword of the relocation. The next fix is to
      use a 64b value for target_offset. The final fix is to not directly
      apply target_offset to reloc->delta. reloc->delta is part of ABI, and so
      we cannot change it. As it stands, 32b is enough to represent everything
      we're interested in representing anyway. The main problem is, we cannot
      add greater than 32b values to it directly.
      
      [1] Almost all of intel-gpu-tools is not yet ready to test 64b
      relocations. There are a few places that expect 32b values for offsets
      and these all won't work.
      
      Cc: Rafael Barbalho <rafael.barbalho@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarBen Widawsky <ben@bwidawsk.net>
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      d9ceb957
    • Ben Widawsky's avatar
      drm/i915: Support 64b execbuf · 9bcb144c
      Ben Widawsky authored
      Previously, our code only had a 32b offset value for where the
      batchbuffer starts. With full PPGTT, and 64b canonical GPU address
      space, that is an insufficient value. The code to expand is pretty
      straight forward, and only one platform needs to do anything with the
      extra bits.
      Signed-off-by: default avatarBen Widawsky <ben@bwidawsk.net>
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarRafael Barbalho <rafael.barbalho@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      9bcb144c
    • Daniel Vetter's avatar
      drm/i915/sdvo: Remove ->mode_set callback · 192d47a6
      Daniel Vetter authored
      SDVO is used by both crtcs using the i9xx_ and the ironlake_
      functions. For both cases there is nothing between the
      encoder->mode_set and the encoder->pre_enable calls that touches the
      hardware.
      
      The vlv_ functions are different since they enable the pll before the
      ->pre_enable hook. But SDVO isn't supported on vlv platforms, so this
      doesn't matter.
      
      We've also already clean up all the sdvo state computation logic, all
      relevant parts are already in the ->compute_config hook.  So we can
      just get rid of the ->mode_set hook by converting it to a ->pre_enable
      hook.
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      192d47a6
    • Daniel Vetter's avatar
      drm/i915/crt: Remove ->mode_set callback · 894ed1ec
      Daniel Vetter authored
      We only set a few bits in the ADPA register, which we then read back
      in the enable/disable hooks. So we can just move that bit of state
      computation code to the place where we need it since setting these
      bits without enabling the CRT encoder has no effects.
      
      The only exceptions are the hotplug bits since they affect the hotplug
      detection logic, but we already set those in the ->reset function and
      then never touch them.
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      894ed1ec
    • Daniel Vetter's avatar
      drm/i915/tv: Remove ->mode_set callback · 809a2a8b
      Daniel Vetter authored
      Currently for the i9xx crtc hooks there's nothing between the call to
      encoder->mode_set and encoder->pre_enable which touches the hardware.
      
      Therefore, since tv is only used on gen3/4, we can just move the hook.
      Yay for easy cases!
      
      The only other important thing to check is that the new
      ->pre_enable hook is idempotent wrt the sw state since now it can
      be called multiple times (due to DPMS). After a the bit of refactoring
      this is now easy to check: It only reads crtc->config and computes
      derived state but otherwise leaves it as-is, so we're good.
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      809a2a8b
    • Daniel Vetter's avatar
      drm/i915/tv: Rip out pipe-disabling nonsense from ->mode_set · 3fa2dd14
      Daniel Vetter authored
      The pipe and plane _are_ disabled when we call this. So replace it
      all with the corresponding assert (as self-documenting code) and
      rip out all the lore.
      
      Checking for a disabled plane would require us to export those macros
      from intel_display.c, but if the pipe is off the plane isn't working
      either. So this single check is good enough.
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      3fa2dd14
    • Daniel Vetter's avatar
      drm/i915/tv: De-magic device check · 5da92eef
      Daniel Vetter authored
      We only support TV-out on gen3/4 mobile platforms, and i915gm is the
      only one that matches.
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      5da92eef
    • Daniel Vetter's avatar
      drm/i915/tv: extract set_color_conversion · b8866ef8
      Daniel Vetter authored
      intel_tv_mode_set is still too bug.
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      b8866ef8
    • Daniel Vetter's avatar
      drm/i915/tv: extract set_tv_mode_timings · 8cb92203
      Daniel Vetter authored
      intel_tv_mode_set is just too big.
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      8cb92203
    • Daniel Vetter's avatar
      drm/i915/dvo: Remove ->mode_set callback · 912b0e2d
      Daniel Vetter authored
      Currently for the i9xx crtc hooks there's nothing between the call to
      encoder->mode_set and encoder->pre_enable which touches the hardware.
      
      Therefore, since dvo is only used on gen2, we can just move the hook.
      Yay for easy cases!
      
      The only other important thing to check is that the new
      ->pre_enable hook is idempotent wrt the sw state since now it can be
      called multiple times (due to DPMS). It only reads crtc->config but
      otherwise leaves it as-is, so we're good.
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      912b0e2d
    • Daniel Vetter's avatar
      drm/i915: Make encoder->mode_set callbacks optional · 0d56bf0b
      Daniel Vetter authored
      For a bunch of reasons we want to move away from the ->mode_set
      callbacks: All hw state setup needs to move into ->enable hooks (so
      that DOMS can do runtime pm) and all the configuration setup needs to
      move into the compute_config functions.
      
      To start with this make the enocer->mode_set callback optional.
      Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      0d56bf0b
    • Ville Syrjälä's avatar
      drm/i915: Make primary_enabled match the actual hardware state · 98ec7739
      Ville Syrjälä authored
      The BIOS can enable a pipe but leave the primary plane disabled. This
      coflicts with out current idea of primary_enabled. Read the actual
      hardware plane state and set primary_enabled appropriately.
      
      We currently assume that primary_enabled is always true when we're about
      to disable a crtc. That needs to change now as the plane may not be
      enabled. So replace the relevant WARNs with early returns in
      intel_{enable,disable}_primary_hw_plane().
      
      Fixes the following warning
      [    3.831602] WARNING: CPU: 0 PID: 1112 at linux/drivers/gpu/drm/i915/intel_display.c:1918 intel_disable_primary_hw_plane+0xe4/0xf0 [i915]()
      
      which got introduced here by me:
       commit e9e39655c0c30cddc3f8c09a757678a24dd36737
       Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
       Date:   Mon Apr 28 15:53:25 2014 +0300
      
          drm/i915: Remove useless checks from primary enable/disable
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Tested-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      98ec7739
    • Ben Widawsky's avatar
      drm/i915: Move ring_begin to signal() · 024a43e1
      Ben Widawsky authored
      Add_request has always contained both the semaphore mailbox updates as
      well as the breadcrumb writes. Since the semaphore signal is the one
      which actually knows about the number of dwords it needs to emit to the
      ring, we move the ring_begin to that function. This allows us to remove
      the hideously shared #define
      
      On a related not, gen8 will use a different number of dwords for
      semaphores, but not for add request.
      
      v2: Make number of dwords an explicit part of signalling (via function
      argument). (Chris)
      
      v3: very slight comment change
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      024a43e1
    • Ben Widawsky's avatar
      drm/i915: Virtualize the ringbuffer signal func · 78325f2d
      Ben Widawsky authored
      This abstraction again is in preparation for gen8. Gen8 will bring new
      semantics for doing this operation.
      
      While here, make the writes of MI_NOOPs explicit for non-existent rings.
      This should have been implicit before.
      
      NOTE: This is going to be removed in a few patches.
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      78325f2d
    • Ben Widawsky's avatar
      drm/i915: Move semaphore specific ring members to struct · ebc348b2
      Ben Widawsky authored
      This will be helpful in abstracting some of the code in preparation for
      gen8 semaphores.
      
      v2: Move mbox stuff to a separate struct
      
      v3: Rebased over VCS2 work
      
      Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> (v1)
      Signed-off-by: default avatarBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      ebc348b2
    • Imre Deak's avatar
      drm/i915: vlv: init only needed state during early power well enabling · 0d116a29
      Imre Deak authored
      During the initial power well enabling on the driver init/resume path
      we can avoid initialzing part of the HW/SW state that will be
      initialized anyway by the subsequent init/resume code. For some steps
      like HPD initialization this redundancy is not only an overhead but an
      actual problem, since they can't be run this early in the overall init
      sequence.
      
      Add a flag marking the init phase and skip reinitialzing state that is
      not strictly necessary based on that.
      
      This is also needed by the upcoming HPD init restructuring by Thierry
      and Daniel.
      Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      0d116a29
    • Chris Wilson's avatar
      drm/i915: Avoid NULL ctx->obj dereference in debugfs/i915_context_info · b77f6997
      Chris Wilson authored
      In commit 691e6415
      Author: Chris Wilson <chris@chris-wilson.co.uk>
      Date:   Wed Apr 9 09:07:36 2014 +0100
      
          drm/i915: Always use kref tracking for all contexts.
      
      we populated fake contexts on all platforms. These were identical to the
      full hardware context tracking structs, except for the ctx->obj used to
      store the hardware state. However, there remained one place where we
      assumed that if a context existed, it would have an object associated
      with it.
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77717
      Testcase: igt/drv_suspend/debugfs-reader
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      b77f6997
    • Ville Syrjälä's avatar
      drm/i915: Add intel_get_crtc_scanline() · a225f079
      Ville Syrjälä authored
      Add a new function intel_get_crtc_scanline() that returns the current
      scanline counter for the crtc.
      
      v2: Rebase after vblank timestamp changes.
          Use intel_ prefix instead of i915_ as is more customary for
          display related functions.
          Include DRM_SCANOUTPOS_INVBL in the return value even w/o
          adjustments, for a bit of extra consistency.
      v3: Change the implementation to be based on DSL on all gens,
          since that's enough for the needs of atomic updates, and
          it will avoid complicating the scanout position calculations
          for the vblank timestamps
      v4: Don't break scanline wraparound for interlaced modes
      Reviewed-by: default avatarSourab Gupta <sourabgupta@gmail.com>
      Reviewed-by: default avatarAkash Goel <akash.goels@gmail.com>
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      a225f079
    • Ville Syrjälä's avatar
      drm/i915: Fix scanout position for real · 78e8fc6b
      Ville Syrjälä authored
      Seems I've been a bit dense with regards to the start of vblank
      vs. the scanline counter / pixel counter.
      
      After staring at the pixel counter on gen4 I came to the conclusion
      that the start of vblank interrupt and scanline counter increment
      happen at the same time. The scanline counter increment is documented
      to occur at start of hsync, which means that the start of vblank
      interrupt must also trigger there. Looking at the pixel counter value
      when the scanline wraps from vtotal-1 to 0 confirms that, as the pixel
      counter at that point reads hsync_start. This also clarifies why we see
      need the +1 adjustment to the scaline counter. The counter actually
      starts counting from vtotal-1 on the first active line.
      
      I also confirmed that the frame start interrupt happens ~1 line after
      the start of vblank, but the frame start occurs at hblank_start instead.
      We only use the frame start interrupt on gen2 where the start of vblank
      interrupt isn't available. The only important thing to note here is that
      frame start occurs after vblank start, so we don't have to play any
      additional tricks to fix up the scanline counter.
      
      The other thing to note is the fact that the pixel counter on gen3-4
      starts counting from the start of horizontal active on the first active
      line. That means that when we get the start of vblank interrupt, the
      pixel counter reads (htotal*(vblank_start-1)+hsync_start). Since we
      consider vblank to start at (htotal*vblank_start) we need to add a
      constant (htotal-hsync_start) offset to the pixel counter, or else we
      risk misdetecting whether we're in vblank or not.
      
      I talked a bit with Art Runyan about these topics, and he confirmed my
      findings. And that the same rules should hold for platforms which don't
      have the pixel counter. That's good since without the pixel counter it's
      rather difficult to verify the timings to this accuracy.
      
      So the conclusion is that we can throw away all the ISR tricks I added,
      and just increment the scanline counter by one always.
      Reviewed-by: default avatarSourab Gupta <sourabgupta@gmail.com>
      Reviewed-by: default avatarAkash Goel <akash.goels@gmail.com>
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      78e8fc6b