Skip to content
  1. Mar 24, 2021
    • 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
    • Matt Roper's avatar
      drm/i915: Add DISPLAY_VER() and related macros · 01eb15c9
      Matt Roper authored
      
      
      Although we've long referred to platforms by a single "GEN" number, the
      hardware teams have recommended that we stop doing this since the
      various component IP blocks are going to start using independent number
      schemes with varying cadence.  To support this, hardware platforms a bit
      down the road are going to start providing MMIO registers that the
      driver can read to obtain the "graphics version," "media version," and
      "display version" without needing to do a PCI ID -> platform -> version
      translation.
      
      Although our current platforms don't yet expose these registers (and the
      next couple we release probably won't have them yet either), the
      hardware teams would still like to see us move to this independent
      numbering scheme now in preparation.  For i915 that means we should try
      to eliminate all usage of INTEL_GEN() throughout our code and instead
      replace it with separate GRAPHICS_VER(), MEDIA_VER(), and DISPLAY_VER()
      constructs in the code.  For old platforms, these will all usually give
      the same value for each IP block (aside from a few special cases like
      GLK which we can no more accurately represent as graphics=9 +
      display=10), but future platforms will have more flexibility to bump IP
      version numbers independently.
      
      The upcoming ADL-P platform will have a display version of 13 and a
      graphics version of 12, so let's just the first step of breaking out
      DISPLAY_VER(), but leaving the rest of INTEL_GEN() untouched for now.
      For now we'll automatically derive the display version from the
      platform's INTEL_GEN() value except in cases where an alternative
      display version is explicitly provided in the device info structure.
      
      We also add some helper macros IS_DISPLAY_VER(i915, ver) and
      IS_DISPLAY_RANGE(i915, from, until) that match the behavior of the
      existing gen-based macros.  However unlike IS_GEN(), we will implement
      those macros with direct comparisons rather than trying to maintain a
      mask to help compiler optimization.  In practice the optimization winds
      up not being used in very many places (since the vast majority of our
      platform checks are of the form "gen >= x") so there is pretty minimal
      size reduction in the final driver binary[1].  We're also likely going
      to need to extend these version numbers to non-integer major.minor
      values at some point in the future, so the mask approach won't work at
      all once we get to platforms like that.
      
       [1] The results before/after the next patch in this series, which
           switches our code over to the new display macros:
      
              $ size i915.ko.{orig,new}
                 text    data     bss     dec     hex filename
              2940291  102944    5384 3048619  2e84ab i915.ko.orig
              2940723  102956    5384 3049063  2e8667 i915.ko.new
      
      v2:
       - Move version into device info's display sub-struct. (Jani)
       - Add extra parentheses to macros.  (Jani)
       - Note the lack of genmask optimization in the display-based macros and
         give size data.  (Lucas)
      
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Lucas De Marchi <lucas.demarchi@intel.com>
      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-3-matthew.d.roper@intel.com
      01eb15c9
    • Matt Roper's avatar
      drm/i915/display: Convert gen5/gen6 tests to IS_IRONLAKE/IS_SANDYBRIDGE · d47d29a6
      Matt Roper authored
      
      
      ILK is the only platform that we consider "gen5" and SNB is the only
      platform we consider "gen6."  Add an IS_SANDYBRIDGE() macro and then
      replace numeric platform tests for these two generations with direct
      platform tests with the following Coccinelle semantic patch:
      
              @@ expression dev_priv; @@
              - IS_GEN(dev_priv, 5)
              + IS_IRONLAKE(dev_priv)
      
              @@ expression dev_priv; @@
              - IS_GEN(dev_priv, 6)
              + IS_SANDYBRIDGE(dev_priv)
      
              @@ expression dev_priv; @@
              - IS_GEN_RANGE(dev_priv, 5, 6)
              + IS_IRONLAKE(dev_priv) || IS_SANDYBRIDGE(dev_priv)
      
      This will simplify our upcoming patches which eliminate INTEL_GEN()
      usage in the display code.
      
      v2:
       - Reverse ilk/snb order for IS_GEN_RANGE conversion.  (Ville)
       - Rebase + regenerate from semantic patch
      
      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/20210320044245.3920043-2-matthew.d.roper@intel.com
      d47d29a6
  2. Mar 23, 2021
  3. Mar 22, 2021
  4. Mar 20, 2021
  5. Mar 19, 2021
  6. Mar 18, 2021
  7. Mar 16, 2021