1. 07 8月, 2014 1 次提交
  2. 05 8月, 2014 1 次提交
  3. 23 7月, 2014 11 次提交
    • J
    • S
    • S
      5fafe292
    • P
      drm/i915: reorganize the unclaimed register detection code · 5978118c
      Paulo Zanoni 提交于
      The current code only runs when we do an I915_WRITE operation. It
      checks if the unclaimed register flag is set before we do the
      operation, and then it checks it again after we do the operation. This
      double check allows us to find out if the I915_WRITE operation in
      question is the bad one, or if some previous code is the bad one. When
      it finds a problem, our code uses DRM_ERROR to signal it.
      
      The good thing about the current code is that it detects the problem,
      so at least we can know we did something wrong. The problem is that
      even though we find the problem, we don't really have much information
      to actually debug it. So whenever I see one of these DRM_ERROR
      messages on my systems, the first thing I do is apply a patch to
      change the DRM_ERROR to a WARN and also check for unclaimed registers
      on I915_READ operations. This local patch makes things even slower,
      but it usually helps a lot in finding the bad code.
      
      The first point here is that since the current code is only useful to
      detect whether we have a problem or not, but it is not really good to
      find the cause of the problem, I don't think we should be checking
      both before and after every I915_WRITE operation: just doing the check
      once should be enough for us to quickly detect problems. With this
      change, the code that runs by default for every single user will only
      do 1 read operation for every single I915_WRITE, instead of 2. This
      patch does this change.
      
      The second point is that the local patch I have should be upstream,
      but since it makes things slower it should be disabled by default. So
      I added the i915.mmio_debug option to enable it.
      
      So after this patch, this is what will happen:
       - By default, we will try to detect unclaimed registers once after
         every I915_WRITE operation. Previously we tried twice for every
         I915_WRITE.
       - When we find an unclaimed register we will still print a DRM_ERROR
         message, but we will now tell the user to try again with
         i915.mmio_debug=1.
       - When we use i915.mmio_debug=1 we will try to find unclaimed
         registers both before and after every I915_READ and I915_WRITE
         operation, and we will print stack traces in case we find them.
         This should really help locating the exact point of the bad code
         (or at least finding out that i915.ko is not the problem).
      
      This commit also opens space for really-slow register debugging
      operations on other platforms. In theory we can now add lots and lots
      of debug code behind i915.mmio_debug, enable this option on our tests,
      and catch more problems.
      
      v2: - Remove not-so-useful comments (Daniel)
          - Fix the param definition macros (Rodrigo)
      Reviewed-by: NRodrigo Vivi <rodrigo.vivi@gmail.com>
      Signed-off-by: NPaulo Zanoni <paulo.r.zanoni@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      5978118c
    • J
      drm/i915: add helper for checking whether IRQs are enabled · 9df7575f
      Jesse Barnes 提交于
      Now that we use the runtime IRQ enable/disable functions in our suspend
      path, we can simply check the pm._irqs_disabled flag everywhere.  So
      rename it to catch the users, and add an inline for it to make the
      checks clear everywhere.
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Reviewed-by: NPaulo Zanoni <paulo.r.zanoni@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      9df7575f
    • D
      drm/i915: Also give the sprite width for WM computation · ed57cb8a
      Damien Lespiau 提交于
      In the future, we'll need the height of the fb to fetch from memory for
      WM computation.
      Signed-off-by: NDamien Lespiau <damien.lespiau@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ed57cb8a
    • D
      drm/i915: Fix up PSR frontbuffer tracking · 9ca15301
      Daniel Vetter 提交于
      I've tried to split this up, but all the changes are so tightly
      related that I didn't find a good way to do this without breaking
      bisecting. Essentially this completely changes how psr is glued into
      the overall driver, and there's not much you can do to soften such a
      paradigm change.
      
      - Use frontbuffer tracking bits stuff to separate disable and
        re-enable.
      
      - Don't re-check everything in the psr work. We have now accurate
        tracking for everything, so no need to check for sprites or tiling
        really. Allows us to ditch tons of locks.
      
      - That in turn allows us to properly cancel the work in the disable
        function - no more deadlocks.
      
      - Add a check for HSW sprites and force a flush. Apparently the
        hardware doesn't forward the flushing when updating the sprite base
        address. We can do the same trick everywhere else we have such
        issues, e.g. on baytrail with ... everything.
      
      - Don't re-enable psr with a delay in psr_exit. It really must be
        turned off forever if we detect a gtt write. At least with the
        current frontbuffer render tracking. Userspace can do a busy ioctl
        call or no-op pageflip to re-enable psr.
      
      - Drop redundant checks for crtc and crtc->active - now that they're
        only called from enable this is guaranteed.
      
      - Fix up the hsw port check. eDP can also happen on port D, but the
        issue is exactly that it doesn't work there. So an || check is
        wrong.
      
      - We still schedule the psr work with a delay. The frontbuffer
        flushing interface mandates that we upload the next full frame, so
        need to wait a bit. Once we have single-shot frame uploads we can do
        better here.
      
      v2: Don't enable psr initially, rely upon the fb flush of the initial
      plane setup for that. Gives us more unified code flow and makes the
      crtc enable sequence less a special case.
      
      v3: s/psr_exit/psr_invalidate/ for consistency
      
      v4: Fixup whitespace.
      
      v5: Correctly bail out of psr_invalidate/flush when
      dev_priv->psr.enabled is NULL. Spotted by Rodrigo.
      
      v6:
      - Only schedule work when there's work to do. Fixes WARNINGs reported
        by Rodrigo.
      - Comments Chris requested to clarify the code.
      
      v7: Fix conflict on rebase (Rodrigo)
      
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> (v6)
      Signed-off-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      9ca15301
    • D
      drm/i915: Add locking to psr code · f0355c4a
      Daniel Vetter 提交于
      It's not really optional to have locking ...
      
      The ugly part is how much locking the psr work needs since it has to
      recheck everything. Which is way too much. But we need to ditch the
      psr work in it's current form anyway and implement proper frontbuffer
      tracking.
      
      The other nasty bit that had to go was the delayed work cancle in
      psr_exit. Which means a bunch of races just became a bit more likely,
      but mea culpa.
      
      v2: Fixup HAS_PSR checks, resulting in uninitialized mutex issues.
      Reviewed-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      f0355c4a
    • D
      drm/i915: Track the psr dp connector in dev_priv->psr.enabled · 2807cf69
      Daniel Vetter 提交于
      Trying to fish that one out through looping is a bit a locking
      nightmare. So just set it and use it in the work struct.
      
      v2:
      - Don't Oops in psr_work, spotted by Rodrigo.
      - Fix compile warning.
      Reviewed-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      2807cf69
    • D
      drm/i915: Run psr_setup unconditionally · 9a603f48
      Daniel Vetter 提交于
      Due to runtime pm and system s/r we need to restore hw state every
      time we enable a pipe again. Hence trying to avoid that is just
      pointless book-keeping which Rodrigo then tried to work around by
      manually adding psr_setup calls to our resume code.
      
      Much simpler to just remove code instead.
      
      v2: Properly bail out of psr exit if psr isn't enabled. Spotted by
      Rodrigo.
      Reviewed-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      9a603f48
    • B
      drm/i915: Power gating display wells during i915_pm_suspend · b04c5bd6
      Borun Fu 提交于
      On VLV, after i915_pm_suspend display power wells are staying
      power ungated. So, after initiating mem sleep "echo mem > /sys/power/state"
      Display is staing D0 State. There might be better way/place to power gate
      these wells. Also, we need to make sure that if wells are power gated due to
      DPMS OFF sequence, they need not be turned off by i915_pm_suspend again.
      
      v2: Extracted helper for intel_crtc_disable and power gating CRTC power wells.
      [Daniel]
      
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Change-Id: I34c80da66aa24c423a5576c68aa1f3a8d0f43848
      Signed-off-by: NBorun Fu <borun.fu@intel.com>
      Signed-off-by: NSagar Kamble <sagar.a.kamble@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      b04c5bd6
  4. 22 7月, 2014 1 次提交
    • D
      drm/i915: add DP 1.2 MST support (v0.7) · 0e32b39c
      Dave Airlie 提交于
      This adds DP 1.2 MST support on Haswell systems.
      
      Notes:
      a) this reworks irq handling for DP MST ports, so that we can
      avoid the mode config locking in the current hpd handlers, as
      we need to process up/down msgs at a better time.
      
      Changes since v0.1:
      use PORT_PCH_HOTPLUG to detect short vs long pulses
      add a workqueue to deal with digital events as they can get blocked on the
      main workqueue beyong mode_config mutex
      fix a bunch of modeset checker warnings
      acks irqs in the driver
      cleanup the MST encoders
      
      Changes since v0.2:
      check irq status again in work handler
      move around bring up and tear down to fix DPMS on/off
      use path properties.
      
      Changes since v0.3:
      updates for mst apis
      more state checker fixes
      irq handling improvements
      fbcon handling support
      improved reference counting of link - fixes redocking.
      
      Changes since v0.4:
      handle gpu reset hpd reinit without oopsing
      check link status on HPD irqs
      fix suspend/resume
      
      Changes since v0.5:
      use proper functions to get max link/lane counts
      fix another checker backtrace - due to connectors disappearing.
      set output type in more places fro, unknown->displayport
      don't talk to devices if no HPD asserted
      check mst on short irqs only
      check link status properly
      rebase onto prepping irq changes.
      drop unsued force_act
      
      Changes since v0.6:
      cleanup unused struct entry.
      
      [airlied: fix some sparse warnings].
      Reviewed-by: NTodd Previte <tprevite@gmail.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      0e32b39c
  5. 12 7月, 2014 1 次提交
  6. 11 7月, 2014 8 次提交
  7. 09 7月, 2014 2 次提交
  8. 08 7月, 2014 7 次提交
    • O
      drm/i915: Add kerneldoc comments to the intel_context struct · 31b7a88d
      Oscar Mateo 提交于
      A bit of background on the context elements.
      
      Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NOscar Mateo <oscar.mateo@intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      [danvet: Appease checkpatch.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      31b7a88d
    • O
      drm/i915: Emphasize that ctx->id is merely a user handle · 821d66dd
      Oscar Mateo 提交于
      This is an Execlists preparatory patch, since they make context ID become an
      overloaded term:
      
      - In the software, it was used to distinguish which context userspace was
        trying to use.
      - In the BSpec, the term is used to describe the 20-bits long field the
        hardware uses to it to discriminate the contexts that are submitted to
        the ELSP and inform the driver about their current status (via Context
        Switch Interrupts and Context Status Buffers).
      
      Initially, I tried to make the different meanings converge, but it proved
      impossible:
      
      - The software ctx->id is per-filp, while the hardware one needs to be
        globally unique.
      - Also, we multiplex several backing states objects per intel_context,
        and all of them need unique HW IDs.
      - I tried adding a per-filp ID and then composing the HW context ID as:
        ctx->id + file_priv->id + ring->id, but the fact that the hardware only
        uses 20-bits means we have to artificially limit the number of filps or
        contexts the userspace can create.
      
      The ctx->user_handle renaming bits are done with this Cocci patch (plus
      manual frobbing of the struct declaration):
      
          @@
          struct intel_context c;
          @@
          - (c).id
          + c.user_handle
      
          @@
          struct intel_context *c;
          @@
          - (c)->id
          + c->user_handle
      
      Also, while we are at it, s/DEFAULT_CONTEXT_ID/DEFAULT_CONTEXT_HANDLE and
      change the type to unsigned 32 bits.
      
      v2: s/handle/user_handle and change the type to uint32_t as suggested by
      Chris Wilson.
      
      Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> (v1)
      Signed-off-by: NOscar Mateo <oscar.mateo@intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      821d66dd
    • O
      drm/i915: Emphasize that ctx->obj & ctx->is_initialized refer to the legacy rcs ctx · ea0c76f8
      Oscar Mateo 提交于
      We have already advanced that Logical Ring Contexts have their own kind
      of backing objects, but everything will be better explained in the Execlists
      series. For now, suffice it to say that the current backing object is only
      ever used with the render ring, so we're making this fact more explicit
      (which is a good reason on its own).
      
      As for the is_initialized flag, we only use to signify that the render state
      has been initialized (a.k.a. golden context, a.k.a. null context). It doesn't
      mean anything for the other engines, so make that distinction obvious.
      
      Done with the following Coccinelle patch (plus manual frobbing of the struct):
      
          @@
          struct intel_context c;
          @@
          - (c).obj
          + c.legacy_hw_ctx.rcs_state
      
          @@
          struct intel_context *c;
          @@
          - (c)->obj
          + c->legacy_hw_ctx.rcs_state
      
          @@
          struct intel_context c;
          @@
          - (c).is_initialized
          + c.legacy_hw_ctx.initialized
      
          @@
          struct intel_context *c;
          @@
          - (c)->is_initialized
          + c->legacy_hw_ctx.initialized
      
      This Execlists prep-work patch has been suggested by Chris Wilson and Daniel
      Vetter separately.
      
      Initially, it was two separate patches:
      drm/i915: Rename ctx->obj to ctx->rcs_state
      drm/i915: Make it obvious that ctx->id is merely a user handle
      Signed-off-by: NOscar Mateo <oscar.mateo@intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      [danvet: s/id/is_initialized/ to fix the subject and resolve a
      conflict in i915_gem_context_reset. Also introduce a new lctx local
      variable to avoid overtly long lines.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ea0c76f8
    • 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
    • B
      drm/i915/bdw: collect semaphore error state · 0ca36d78
      Ben Widawsky 提交于
      Since the semaphore information is in an object, just dump it, and let
      the user parse it later.
      
      NOTE: The page being used for the semaphores are incoherent with the
      CPU. No matter what I do, I cannot figure out a way to read anything but
      0s. Note that the semaphore waits are indeed working.
      
      v2: Don't print signal, and wait (they should be the same). Instead,
      print sync_seqno (Chris)
      
      v3: Free the semaphore error object (Chris)
      
      v4: Fix semaphore offset calculation during error state collection
      (Ville)
      
      v5: VCS2 rebase
      Make semaphore object error capture coding style consistent (Ville)
      Do the proper math for the signal offset (Ville)
      
      v6: Fix small conflicts on rebase and s/ring_buffer/engine_cs (Rodrigo)
      Reviewed-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      0ca36d78
    • B
      drm/i915/bdw: implement semaphore signal · 3e78998a
      Ben Widawsky 提交于
      Semaphore signalling works similarly to previous GENs with the exception
      that the per ring mailboxes no longer exist. Instead you must define
      your own space, somewhere in the GTT.
      
      The comments in the code define the layout I've opted for, which should
      be fairly future proof. Ie. I tried to define offsets in abstract terms
      (NUM_RINGS, seqno size, etc).
      
      NOTE: If one wanted to move this to the HWSP they could. I've decided
      one 4k object would be easier to deal with, and provide potential wins
      with cache locality, but that's all speculative.
      
      v2: Update the macro to not need the other ring's ring->id (Chris)
      Update the comment to use the correct formula (Chris)
      
      v3: Move the macros the ringbuffer.h to prevent churn in next patch
      (Ville)
      
      v4: Fixed compilation rebase conflict
      commit 1ec9e26d
      Author: Daniel Vetter <daniel.vetter@ffwll.ch>
      Date:   Fri Feb 14 14:01:11 2014 +0100
      
          drm/i915: Consolidate binding parameters into flags
      
      v5: VCS2 rebase
      Replace hweight_long with hweight32
      
      v6 (Rodrigo): * Add missed VC2 gen8 ring signal init
         	      * fixing conflicst on rebase
          	      * minor fixes on address table
      	      * remove WARN_ON
      Reviewed-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      [danvet: s/BUG_ON/WARN_ON/]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      3e78998a
    • J
      drm/i915: Corrected 'file_priv' to 'file' in 'i915_driver_preclose()' · 2885f6ac
      John Harrison 提交于
      The 'i915_driver_preclose()' function has a parameter called 'file_priv'.
      However, this is misleading as the structure it points to is a 'drm_file' not a
      'drm_i915_file_private'. It should be named just 'file' to avoid confusion.
      Signed-off-by: NJohn Harrison <John.C.Harrison@Intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      2885f6ac
  9. 07 7月, 2014 2 次提交
    • D
      drm/i915: rework digital port IRQ handling (v2) · 13cf5504
      Dave Airlie 提交于
      The digital ports from Ironlake and up have the ability to distinguish
      between long and short HPD pulses. Displayport 1.1 only uses the short
      form to request link retraining usually, so we haven't really needed
      support for it until now.
      
      However with DP 1.2 MST we need to handle the short irqs on their
      own outside the modesetting locking the long hpd's involve. This
      patch adds the framework to distinguish between short/long to the
      current code base, to lay the basis for future DP 1.2 MST work.
      
      This should mean we get better bisectability in case of regression
      due to the new irq handling.
      
      v2: add GM45 support (untested, due to lack of hw)
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      Reviewed-by: NTodd Previte <tprevite@gmail.com>
      [danvet: Fix conflicts in i915_irq.c with Oscar Mateo's irq handling
      race fixes and a trivial one in intel_drv.h with the psr code.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      13cf5504
    • I
      drm/i915: gmch: factor out intel_set_memory_cxsr · 5209b1f4
      Imre Deak 提交于
      This functionality will be also needed by an upcoming patch, so factor
      it out. As a bonus this also makes things a bit more uniform across
      platforms. Note that this also changes the register read-modify-write
      to a simple write during disabling. This is what we do during enabling
      anyway and according to the spec all the relevant bits are reserved-MBZ
      or reserved with a 0 default value.
      
      v2:
      - unchanged
      v3:
      - fix missing cxsr disabling on pineview (Deepak)
      Signed-off-by: NImre Deak <imre.deak@intel.com>
      Reviewed-by: NDeepak S <deepak.s@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      5209b1f4
  10. 03 7月, 2014 2 次提交
    • B
      drm/i915: Try harder to get FBC · 5e59f717
      Ben Widawsky 提交于
      The GEN FBC unit provides the ability to set a low pass on frames it
      attempts to compress. If a frame is less than a certain amount
      compressibility (2:1, 4:1) it will not bother. This allows the driver to
      reduce the size it requests out of stolen memory.
      
      Unluckily, a few months ago, Ville actually began using this feature for
      framebuffers that are 16bpp (not sure why not 8bpp). In those cases, we
      are already using this mechanism for a different purpose, and so we can
      only achieve one further level of compression (2:1 -> 4:1)
      
      FBC GEN1, ie. pre-G45 is ignored.
      
      The cleverness of the patch is Art's. The bugs are mine.
      
      v2: Update message and including missing threshold case 3 (Spotted by Arthur).
      
      Cc: Art Runyan <arthur.j.runyan@intel.com>
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      5e59f717
    • B
      drm/i915: Move compressed_fb to static allocation · c4213885
      Ben Widawsky 提交于
      We are already using the size to determine whether or not to free the
      object, so there is no functional change there. Almost everything else
      has changed to static allocations of the drm_mm_node too.
      
      Aside from bringing this inline with much of our other code, this makes
      error paths slightly simpler, which benefits the look of an upcoming
      patch.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Reviewed-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      c4213885
  11. 23 6月, 2014 1 次提交
  12. 20 6月, 2014 3 次提交
    • D
      drm/i915: Update DRIVER_DATE to 20140620 · 34882298
      Daniel Vetter 提交于
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      34882298
    • D
      drm/i915: Track frontbuffer invalidation/flushing · f99d7069
      Daniel Vetter 提交于
      So these are the guts of the new beast. This tracks when a frontbuffer
      gets invalidated (due to frontbuffer rendering) and hence should be
      constantly scaned out, and when it's flushed again and can be
      compressed/one-shot-upload.
      
      Rules for flushing are simple: The frontbuffer needs one more full
      upload starting from the next vblank. Which means that the flushing
      can _only_ be called once the frontbuffer update has been latched.
      
      But this poses a problem for pageflips: We can't just delay the
      flushing until the pageflip is latched, since that would pose the risk
      that we override frontbuffer rendering that has been scheduled
      in-between the pageflip ioctl and the actual latching.
      
      To handle this track asynchronous invalidations (and also pageflip)
      state per-ring and delay any in-between flushing until the rendering
      has completed. And also cancel any delayed flushing if we get a new
      invalidation request (whether delayed or not).
      
      Also call intel_mark_fb_busy in both cases in all cases to make sure
      that we keep the screen at the highest refresh rate both on flips,
      synchronous plane updates and for frontbuffer rendering.
      
      v2: Lots of improvements
      
      Suggestions from Chris:
      - Move invalidate/flush in flush_*_domain and set_to_*_domain.
      - Drop the flush in busy_ioctl since it's redundant. Was a leftover
        from an earlier concept to track flips/delayed flushes.
      - Don't forget about the initial modeset enable/final disable.
        Suggested by Chris.
      
      Track flips accurately, too. Since flips complete independently of
      rendering we need to track pending flips in a separate mask. Again if
      an invalidate happens we need to cancel the evenutal flush to avoid
      races.
      
      v3:
      Provide correct header declarations for flip functions. Currently not
      needed outside of intel_display.c, but part of the proper interface.
      
      v4: Add proper domain management to fbcon so that the fbcon buffer is
      also tracked correctly.
      
      v5: Fixup locking around the fbcon set_to_gtt_domain call.
      
      v6: More comments from Chris:
      - Split out fbcon changes.
      - Drop superflous checks for potential scanout before calling intel_fb
        functions - we can micro-optimize this later.
      - s/intel_fb_/intel_fb_obj_/ to make it clear that this deals in gem
        object. We already have precedence for fb_obj in the pin_and_fence
        functions.
      
      v7: Clarify the semantics of the flip flush handling by renaming
      things a bit:
      - Don't go through a gem object but take the relevant frontbuffer bits
        directly. These functions center on the plane, the actual object is
        irrelevant - even a flip to the same object as already active should
        cause a flush.
      - Add a new intel_frontbuffer_flip for synchronous plane updates. It
        currently just calls intel_frontbuffer_flush since the implemenation
        differs.
      
      This way we achieve a clear split between one-shot update events on
      one side and frontbuffer rendering with potentially a very long delay
      between the invalidate and flush.
      
      Chris and I also had some discussions about mark_busy and whether it
      is appropriate to call from flush. But mark busy is a state which
      should be derived from the 3 events (invalidate, flush, flip) we now
      have by the users, like psr does by tracking relevant information in
      psr.busy_frontbuffer_bits. DRRS (the only real use of mark_busy for
      frontbuffer) needs to have similar logic. With that the overall
      mark_busy in the core could be removed.
      
      v8: Only when retiring gpu buffers only flush frontbuffer bits we
      actually invalidated in a batch. Just for safety since before any
      additional usage/invalidate we should always retire current rendering.
      Suggested by Chris Wilson.
      
      v9: Actually use intel_frontbuffer_flip in all appropriate places.
      Spotted by Chris.
      
      v10: Address more comments from Chris:
      - Don't call _flip in set_base when the crtc is inactive, avoids redunancy
        in the modeset case with the initial enabling of all planes.
      - Add comments explaining that the initial/final plane enable/disable
        still has work left to do before it's fully generic.
      
      v11: Only invalidate for gtt/cpu access when writing. Spotted by Chris.
      
      v12: s/_flush/_flip/ in intel_overlay.c per Chris' comment.
      
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      f99d7069
    • D
      drm/i915: Use new frontbuffer bits to increase pll clock · cc36513c
      Daniel Vetter 提交于
      The downclocking checks a few more things, so not that simple to
      convert. Also, this should get unified with the drrs handling and also
      use the locking of that. Otoh the drrs locking is about as hapzardous
      as no locking, at least on first sight.
      
      For easier conversion ditch the upclocking on unload - we'll turn off
      everything anyway.
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      cc36513c