1. 25 Jul, 2012 14 commits
    • Paulo Zanoni's avatar
      drm/i915: move common code to intel_dp_set_link_train · 47ea7542
      Paulo Zanoni authored
      We have some common code that we always run before calling
      intel_dp_set_link_train. This common code sets the correct training
      patterns to the DP variable. If we add more calls to
      intel_dp_set_link_train, we'll also have to duplicate this common
      code. So instead of repeating this code whenever we call
      intel_dp_set_link_train, we move the code to inside the function: now
      we check which training pattern we're going to set and then we set the
      DP register according to it.
      
      One of the side-effects of this change is that now we never forget to
      mask the training pattern bits before changing them. It looks like
      this was working before because we were first masking the bits, then
      writing 00, 01 and then 11.
      
      This patch also enables us to use the intel_dp_set_link_train function
      when disabling link training: in this case we need to avoid writing
      the DP_TRAINING_LANE*_SET AUX commands.
      
      As a bonus, the big intel_dp_{start,complete}_link_train functions
      will get smaller and a little bit easier to read.
      
      Version 2 changes:
       - Rewrite commit message.
       - Also clear the training pattern bits before changing them.
      Signed-off-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      47ea7542
    • Daniel Vetter's avatar
      drm/i915: add port parameter to intel_hdmi_init · 08d644ad
      Daniel Vetter authored
      Instead of having a giant if cascade to figure this out according to
      the passed-in register. We could do quite a bit more cleaning up and
      all by using the port at more places, but I think this should be part
      of a bigger rework to introduce a struct intel_digital_port which
      would keep track of all these things. I guess this will be part of
      some haswell-DP-induced refactoring.
      
      For now this rips out the big cascade, which is what annoyed me so
      much.
      
      v2: Add port variable name back for the func decl (I've tried to trick
      myself below the 80 char limit).
      Reviewed-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
      Signed-Off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      08d644ad
    • Daniel Vetter's avatar
      drm/i915: simplify possible_clones computation · 66a9278e
      Daniel Vetter authored
      Intel hw only has one MUX for encoders, so outputs are either not
      cloneable or all in the same group of cloneable outputs. This neatly
      simplifies the code and allows us to ditch some ugly if cascades in
      the dp and hdmi init code (well, we need these if cascades for other
      stuff still, but that can be taken care of in follow-up patches).
      
      Note that this changes two things:
      - dvo can now be cloned with sdvo, but dvo is gen2 whereas sdvo is
        gen3+, so no problem. Note that the old code had a bug and didn't
        allow cloning crt with dvo (but only the other way round).
      - sdvo-lvds can now be cloned with sdvo-non-tv. Spec says this won't
        work, but the only reason I've found is that you can't use the
        panel-fitter (used for lvds upscaling) with anything else. But we
        don't use the panel fitter for sdvo-lvds. Imo this part of Bspec is
        a) rather confusing b) mostly as a guideline to implementors (i.e.
        explicitly stating what is already implicit from the spec, without
        always going into the details of why). So I think we can ignore this
        - worst case we'll get a bug report from a user with with sdvo-lvds
        and sdvo-tmds and have to add that special case back in.
      
      Because sdvo lvds is a bit special explain in comments why sdvo LVDS
      outputs can be cloned, but native LVDS and eDP can't be cloned - we
      use the panel fitter for the later, but not for sdvo.
      
      Note that this also uncoditionally initializes the panel_vdd work used
      by eDP. Trying to be clever doesn't buy us anything (but strange bugs)
      and this way we can kill the is_edp check.
      
      v2: Incorporate review from Paulo
      - Add in a missing space.
      - Pimp comment message to address his concerns.
      Reviewed-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
      Signed-Off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      66a9278e
    • Daniel Vetter's avatar
      drm/i915: group ADPA #defines together · ebc0fd88
      Daniel Vetter authored
      Splitting them up between pch and gmch variants just makes it harder
      to find things. Especially since the hotplug bits are actually valid
      on earlier chips, too.
      
      v2: Fixed the comment as pointed out by Paulo Zanoni.
      Reviewed-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      ebc0fd88
    • Chris Wilson's avatar
      drm/i915: Cleanup context switching through do_switch() · 9a3b5304
      Chris Wilson authored
      When bug hunting, I found the interface to do_switch() overly
      complicated and I believe festered the earlier bug. This aims to make
      the code a little clearer.
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      9a3b5304
    • Shobhit Kumar's avatar
      drm/i915: Move DP structs to shared location · 54d63ca6
      Shobhit Kumar authored
      Move the DP structure to shared location so that it can be used from
      within the ddi module.
      
      Changes from Paulo:
      - Move less code to intel_drv.h
      - Remove #include statement
      - Replace a tab with a space in train_set
      Signed-off-by: default avatarShobhit Kumar <shobhit.kumar@intel.com>
      Signed-off-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      54d63ca6
    • Daniel Vetter's avatar
      drm/i915: unbreak lastclose for failed driver init · e8aeaee7
      Daniel Vetter authored
      We now refuse to load on gen6+ if kms is not enabled:
      
      commit 26394d92
      Author: Daniel Vetter <daniel.vetter@ffwll.ch>
      Date:   Mon Mar 26 21:33:18 2012 +0200
      
          drm/i915: refuse to load on gen6+ without kms
      
      Which results in the drm core calling our lastclose function to clean
      up the mess, but that one is neatly broken for such failure cases
      since kms has been introduced in
      
      commit 79e53945
      Author: Jesse Barnes <jbarnes@virtuousgeek.org>
      Date:   Fri Nov 7 14:24:08 2008 -0800
      
          DRM: i915: add mode setting support
      Reported-and-tested-by: default avatarPaulo Zanoni <przanoni@gmail.com>
      Signed-Off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      e8aeaee7
    • Eric Anholt's avatar
      drm/i915: Set the context before setting up regs for the context. · 0da5cec1
      Eric Anholt authored
      Fixes failures in transform feedback on gen7 because our SOL_RESET
      flag was setting the transform feedback offsets in the old context
      (occasionally happened to be ours) instead of the new context.
      Signed-off-by: default avatarEric Anholt <eric@anholt.net>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      0da5cec1
    • Daniel Vetter's avatar
      drm/i915: constify mode in crtc_mode_fixup · 35313cde
      Daniel Vetter authored
      Laurent Pinchart missed this when sending in is giant constify patch:
      
      commit e811f5ae
      Author: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
      Date:   Tue Jul 17 17:56:50 2012 +0200
      
          drm: Make the .mode_fixup() operations mode argument a const pointer
      
      Acked-by; Laurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-Off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      35313cde
    • Daniel Vetter's avatar
      drm/i915/lvds: ditch ->prepare special case · 520c41cf
      Daniel Vetter authored
      LVDS is the first output where dpms on/off and prepare/commit don't
      perfectly match. Now the idea behind this special case seems to be
      that for simple resolution changes on the LVDS we don't need to stop
      the pipe, because (at least on newer chips) we can adjust the panel
      fitter on the fly.
      
      There are a few problems with the current code though:
      - We still stop and restart the pipe unconditionally, because the crtc
        helper code isn't flexible enough.
      - We show some ugly flickering, especially when changing crtcs (this
        the crtc helper would actually take into account, but we don't
        implement the encoder->get_crtc callback required to make this work
        properly).
      
      So it doesn't even work as advertised. I agree that it would be nice
      to do resolution changes on LVDS (and also eDP) whithout blacking the
      screen where the panel fitter allows to do that. But imo we should
      implement this as a special case a few layers up in the mode set code,
      akin to how we already detect simple framebuffer changes (and only
      update the required registers with ->mode_set_base).
      
      Until this is all in place, make our lives easier and just rip it out.
      
      Also note that this seems to fix actual bugs with enabling the lvds
      output, see:
      
      http://lists.freedesktop.org/archives/intel-gfx/2012-July/018614.html
      
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Giacomo Comes <comes@naic.edu>
      Acked-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Tested-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-Off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      520c41cf
    • Dan Carpenter's avatar
      drm/i915: dereferencing an error pointer · be636387
      Dan Carpenter authored
      We need to check that "ctx" is a valid pointer before dereferencing it.
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      be636387
    • Chris Wilson's avatar
      drm/i915: fix invalid reference handling of the default ctx obj · b259b312
      Chris Wilson authored
      Otherwise we end up trying to unpin a freed object and BUG.
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      b259b312
    • Chris Wilson's avatar
      drm/i915: Add -EIO to the list of known errors for __wait_seqno · eeef9b38
      Chris Wilson authored
      This prevents a WARN introduced with
      
        commit de2b9985
        Author: Daniel Vetter <daniel.vetter@ffwll.ch>
        Date:   Wed Jul 4 22:52:50 2012 +0200
      
            drm/i915: don't return a spurious -EIO from intel_ring_begin
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      eeef9b38
    • Chris Wilson's avatar
      drm/i915: Flush the context object from the CPU caches upon switching · d3373a24
      Chris Wilson authored
      The issue is that we stale data in the CPU caches, when we come to
      swap-out the object, the CPU may short-circuit the reads from those
      cacheline and so corrupt the context object.
      
      Secondary, leaving the context object as being marked in the CPU write
      domain whilst on the GPU active list is a bad idea and will throw
      warnings later.
      
      Note: Thanks to calling set_to_gtt_domain with write = false and not
      setting any gpu write domain when putting a context object onto the
      active list (when we switch away from it) the set_to_gtt_domain call
      won't block.
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarBen Widawsky <ben@bwidawsk.net>
      [danvet: Added a note to the commit message and a comment in the code
      to explain the clever non-blocking trick.]
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      d3373a24
  2. 20 Jul, 2012 26 commits