1. 03 Dec, 2015 5 commits
    • Paulo Zanoni's avatar
      drm/i915: introduce intel_fbc_{enable,disable} · d029bcad
      Paulo Zanoni authored
      The goal is to call FBC enable/disable only once per modeset, while
      activate/deactivate/update will be called multiple times.
      
      The enable() function will be responsible for deciding if a CRTC will
      have FBC on it and then it will "lock" FBC on this CRTC: it won't be
      possible to change FBC's CRTC until disable(). With this, all checks
      and resource acquisition that only need to be done once per modeset
      can be moved from update() to enable(). And then the update(),
      activate() and deactivate() code will also get simpler since they
      won't need to worry about the CRTC being changed.
      
      The disable() function will do the reverse operation of enable(). One
      of its features is that it should only be called while the pipe is
      already off. This guarantees that FBC is stopped and nothing is
      using the CFB.
      
      With this, the activate() and deactivate() functions just start and
      temporarily stop FBC. They are the ones touching the hardware enable
      bit, so HW state reflects dev_priv->crtc.active.
      
      The last function remaining is update(). A lot of times I thought
      about renaming update() to activate() or try_to_activate() since it's
      called when we want to activate FBC. The thing is that update() may
      not only decide to activate FBC, but also deactivate or keep it on the
      same state, so I'll leave this name for now.
      
      Moving code to enable() and disable() will also help in case we decide
      to move FBC to pipe_config or something else later.
      
      The current patch only puts the very basic code on enable() and
      disable(). The next commits will take care of moving more stuff from
      update() to the new functions.
      
      v2:
        - Rebase.
        - Improve commit message (Chris).
      v3: Rebase after changing the patch order.
      v4: Rebase again after upstream changes.
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/
      d029bcad
    • Paulo Zanoni's avatar
      drm/i915: introduce is_active/activate/deactivate to the FBC terminology · 0e631adc
      Paulo Zanoni authored
      The long term goal is to have enable/disable as the higher level
      functions and activate/deactivate as the lower level functions, just
      like we do for PSR and for the CRTC. This way, we'll run enable and
      disable once per modeset, while update, activate and deactivate will
      be run many times. With this, we can move the checks and code that
      need to run only once per modeset to enable(), making the code simpler
      and possibly a little faster.
      
      This patch is just the first step on the conversion: it starts by
      converting the current low level functions from enable/disable to
      activate/deactivate. This patch by itself has no benefits other than
      making review and rebase easier. Please see the next patches for more
      details on the conversion.
      
      v2:
        - Rebase.
        - Improve commit message (Chris).
      v3: Rebase after changing the patch order.
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/
      0e631adc
    • Paulo Zanoni's avatar
      drm/i915: pass the crtc as an argument to intel_fbc_update() · 754d1133
      Paulo Zanoni authored
      There's no need to reevaluate the status of every single crtc when a
      single crtc changes its state.
      
      With this, we're cutting the case where due to a change in pipe B,
      intel_fbc_update() is called, then intel_fbc_find_crtc() concludes FBC
      should be enabled on pipe A, then it completely rechecks the state of
      pipe A only to conclude FBC should remain enabled on pipe A. If any
      change on pipe A triggers a need to recompute whether FBC is valid on
      pipe A, then at some point someone is going to call
      intel_fbc_update(PIPE_A).
      
      The addition of intel_fbc_deactivate() is necessary so we keep track
      of the previously selected CRTC when we do invalidate/flush. We're
      also going to continue the enable/disable/activate/deactivate concept
      in the next patches.
      
      v2: Rebase.
      v3: Rebase after changing the patch order.
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/
      754d1133
    • Paulo Zanoni's avatar
      drm/i915: set dev_priv->fbc.crtc before scheduling the enable work · e9c5fd26
      Paulo Zanoni authored
      This thing where we need to get the crtc either from the work
      structure or the fbc structure itself is confusing and unnecessary.
      Set fbc.crtc right when scheduling the enable work so we can always
      use it.
      
      The problem is not what gets passed and how to retrieve it. The
      problem is that when we're in the other parts of the code we always
      have to keep in mind that if FBC is already enabled we have to get the
      CRTC from place A, if FBC is scheduled we have to get the CRTC from
      place B, and if it's disabled there's no CRTC. Having a single place
      to retrieve the CRTC from allows us to treat the "is enabled" and "is
      scheduled" cases as the same case, reducing the mistake surface. I
      guess I should add this to the commit message.
      
      Besides the immediate advantages, this is also going to make one of
      the next commits much simpler. And even later, when we introduce
      enable/disable + activate/deactivate, this will be even simpler as
      we'll set the CRTC at enable time. So all the
      activate/deactivate/update code can just look at the single CRTC
      variable regardless of the current state.
      
      v2: Improve commit message (Chris).
      v3: Rebase after changing the patch order.
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/
      e9c5fd26
    • Paulo Zanoni's avatar
      drm/i915: fix the CFB size check · 90d5234f
      Paulo Zanoni authored
      In function find_compression_threshold() we try to over-allocate CFB
      space in order to reduce reallocations and fragmentation, and we're
      not considering that at the CFB size check. Consider it.
      
      There is also a longer-term plan to kill
      dev_priv->fbc.uncompressed_size, but this will come later.
      
      v2: Use drm_mm_node_allocated() (Chris).
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/
      90d5234f
  2. 02 Dec, 2015 15 commits
  3. 01 Dec, 2015 4 commits
  4. 30 Nov, 2015 4 commits
  5. 26 Nov, 2015 7 commits
  6. 24 Nov, 2015 5 commits