Skip to content
  1. Mar 30, 2021
  2. Mar 29, 2021
  3. Mar 26, 2021
  4. Mar 25, 2021
  5. Mar 24, 2021
    • Imre Deak's avatar
      drm/i915: Fix the GT fence revocation runtime PM logic · 9d58aa46
      Imre Deak authored
      
      
      To optimize some task deferring it until runtime resume unless someone
      holds a runtime PM reference (because in this case the task can be done
      w/o the overhead of runtime resume), we have to use the runtime PM
      get-if-active logic: If the runtime PM usage count is 0 (and so
      get-if-in-use would return false) the runtime suspend handler is not
      necessarily called yet (it could be just pending), so the device is not
      necessarily powered down, and so the runtime resume handler is not
      guaranteed to be called.
      
      The fence revocation depends on the above deferral, so add a
      get-if-active helper and use it during fence revocation.
      
      v2:
      - Add code comment explaining the fence reg programming deferral logic
        to i915_vma_revoke_fence(). (Chris)
      - Add Cc: stable and Fixes: tags. (Chris)
      - Fix the function docbook comment.
      
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: <stable@vger.kernel.org> # v4.12+
      Fixes: 181df2d4 ("drm/i915: Take rpm wakelock for releasing the fence on unbind")
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210322204223.919936-1-imre.deak@intel.com
      9d58aa46
    • Matt Roper's avatar
      drm/i915/display: Simplify GLK display version tests · 2b5a4562
      Matt Roper authored
      
      
      GLK has always been a bit of a special case since it reports INTEL_GEN()
      as 9, but has version 10 display IP.  Now we can properly represent the
      display version as 10 and simplify the display generation tests
      throughout the display code.
      
      Aside from manually adding the version to the glk_info structure, the
      rest of this patch is generated with a Coccinelle semantic patch.  Note
      that we also need to switch any code that matches gen10 today but *not*
      GLK to be CNL-specific:
      
              @@ expression dev_priv; @@
              - DISPLAY_VER(dev_priv) > 9
              + DISPLAY_VER(dev_priv) >= 10
      
              @@ expression dev_priv, E; @@
              (
              - DISPLAY_VER(dev_priv) >= 10 && E
              + (DISPLAY_VER(dev_priv) >= 11 || IS_CANNONLAKE(dev_priv)) && E
              |
              - DISPLAY_VER(dev_priv) >= 10
              + DISPLAY_VER(dev_priv) >= 11 || IS_CANNONLAKE(dev_priv)
              |
              - IS_DISPLAY_RANGE(dev_priv, 10, E)
              + IS_DISPLAY_RANGE(dev_priv, 11, E) || IS_CANNONLAKE(dev_priv)
              )
      
              @@ expression dev_priv, E, E2; @@
              (
              - (IS_CANNONLAKE(dev_priv) || IS_GEMINILAKE(dev_priv))
              + IS_DISPLAY_VER(dev_priv, 10)
              |
              - E || IS_CANNONLAKE(dev_priv) || IS_GEMINILAKE(dev_priv)
              + E || IS_DISPLAY_VER(dev_priv, 10)
              |
              - (IS_GEMINILAKE(dev_priv) || IS_CANNONLAKE(dev_priv))
              + IS_DISPLAY_VER(dev_priv, 10)
              |
              - IS_GEMINILAKE(dev_priv) || E || IS_CANNONLAKE(dev_priv)
              + E || IS_DISPLAY_VER(dev_priv, 10)
              |
              - E || IS_GEMINILAKE(dev_priv) || E2 || IS_CANNONLAKE(dev_priv)
              + E || E2 || IS_DISPLAY_VER(dev_priv, 10)
              |
              - (IS_DISPLAY_VER(dev_priv, 10) || IS_GEMINILAKE(dev_priv))
              + IS_DISPLAY_VER(dev_priv, 10)
              |
              - (IS_GEMINILAKE(dev_priv) || IS_DISPLAY_VER(dev_priv, 10))
              + IS_DISPLAY_VER(dev_priv, 10)
              )
      
              @@ expression dev_priv; @@
              - (IS_DISPLAY_VER(dev_priv, 9) && !IS_GEMINILAKE(dev_priv))
              + IS_DISPLAY_VER(dev_priv, 9)
      
              @@ expression dev_priv; @@
              (
              - !(DISPLAY_VER(dev_priv) >= 11 || IS_DISPLAY_VER(dev_priv, 10))
              + DISPLAY_VER(dev_priv) < 10
              |
              - (DISPLAY_VER(dev_priv) >= 11 || IS_DISPLAY_VER(dev_priv, 10))
              + DISPLAY_VER(dev_priv) >= 10
              )
      
              @@ expression dev_priv, E; @@
              - E || DISPLAY_VER(dev_priv) >= 11 || IS_DISPLAY_VER(dev_priv, 10)
              + E || DISPLAY_VER(dev_priv) >= 10
      
              @@ expression dev_priv, E; @@
              - (IS_DISPLAY_RANGE(dev_priv, 11, E) || IS_DISPLAY_VER(dev_priv, 10))
              + IS_DISPLAY_RANGE(dev_priv, 10, E)
      
              @@ expression dev_priv; @@
              (
              - DISPLAY_VER(dev_priv) >= 11 || IS_CANNONLAKE(dev_priv) || IS_GEN9_LP(dev_priv)
              + DISPLAY_VER(dev_priv) >= 10 || IS_GEN9_LP(dev_priv)
              |
              - IS_GEN9_LP(dev_priv) || DISPLAY_VER(dev_priv) >= 11 || IS_CANNONLAKE(dev_priv)
              + IS_GEN9_LP(dev_priv) || DISPLAY_VER(dev_priv) >= 10
              )
      
              @@ expression dev_priv, E; @@
              - !(DISPLAY_VER(dev_priv) >= E)
              + DISPLAY_VER(dev_priv) < E
      
      v2:
       - Convert gen10 conditions that don't include GLK into CNL conditions.
         (Ville)
      
      v3:
       - Rework coccinelle rules so that "ver>=10" turns into "ver>=11||is_cnl." (Ville)
      
      v3.1:
       - Manually re-add the ".display.version = 10" to glk_info after
         regenerating patch via Coccinelle.
      
      v4:
       - Also apply cocci rules to intel_pm.c and i915_irq.c!  (CI)
      
      Cc: Ville Syrjälä <ville.syrjala@intel.com>
      Signed-off-by: default avatarMatt Roper <matthew.d.roper@intel.com>
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210322233840.4056851-1-matthew.d.roper@intel.com
      2b5a4562
    • Matt Roper's avatar
      drm/i915: Convert INTEL_GEN() to DISPLAY_VER() as appropriate in i915_irq.c · 373abf1a
      Matt Roper authored
      
      
      Convert the display-specific usage of INTEL_GEN, while leaving the
      non-display usage as-is for now.
      
      In the near-future we'll probably want to think about moving display
      interrupt handling to its own file under the display/ directory.
      
      v2:
       - Use new IS_DISPLAY_VER() macro.
      
      Signed-off-by: default avatarMatt Roper <matthew.d.roper@intel.com>
      Reviewed-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210320044245.3920043-6-matthew.d.roper@intel.com
      373abf1a
    • Matt Roper's avatar
      drm/i915: Convert INTEL_GEN() to DISPLAY_VER() as appropriate in intel_pm.c · 7dadd286
      Matt Roper authored
      
      
      Although most of the code in this file is display-related (watermarks),
      there's some functions that are not (e.g., clock gating).  Thus we need
      to do the conversions to DISPLAY_VER() manually here rather than using
      Coccinelle.
      
      In the near-future we'll probably want to think about moving watermark
      logic out of intel_pm.c and into watermark-specific files under the
      display/ directory.
      
      v2:
       - Use new IS_DISPLAY_VER macro where appropriate.
      
      Signed-off-by: default avatarMatt Roper <matthew.d.roper@intel.com>
      Reviewed-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210320044245.3920043-5-matthew.d.roper@intel.com
      7dadd286
    • Matt Roper's avatar
      drm/i915/display: Eliminate most usage of INTEL_GEN() · 005e9537
      Matt Roper authored
      
      
      Use Coccinelle to convert most of the usage of INTEL_GEN() and IS_GEN()
      in the display code to use DISPLAY_VER() comparisons instead.  The
      following semantic patch was used:
      
              @@ expression dev_priv, E; @@
              - INTEL_GEN(dev_priv) == E
              + IS_DISPLAY_VER(dev_priv, E)
      
              @@ expression dev_priv; @@
              - INTEL_GEN(dev_priv)
              + DISPLAY_VER(dev_priv)
      
              @@ expression dev_priv; expression E; @@
              - IS_GEN(dev_priv, E)
              + IS_DISPLAY_VER(dev_priv, E)
      
              @@
              expression dev_priv;
              expression from, until;
              @@
              - IS_GEN_RANGE(dev_priv, from, until)
              + IS_DISPLAY_RANGE(dev_priv, from, until)
      
      There are still some display-related uses of INTEL_GEN() in intel_pm.c
      (watermark code) and i915_irq.c.  Those will be updated separately.
      
      v2:
       - Use new IS_DISPLAY_RANGE and IS_DISPLAY_VER helpers.  (Jani)
      
      Signed-off-by: default avatarMatt Roper <matthew.d.roper@intel.com>
      Reviewed-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210320044245.3920043-4-matthew.d.roper@intel.com
      005e9537