drm/i915: Convert PALETTE() to _PICK_EVEN_2RANGES()
authorLucas De Marchi <lucas.demarchi@intel.com>
Fri, 20 Jan 2023 19:34:57 +0000 (11:34 -0800)
committerLucas De Marchi <lucas.demarchi@intel.com>
Fri, 27 Jan 2023 16:53:07 +0000 (08:53 -0800)
PALETTE() can use _PICK_EVEN_2RANGES instead of _PICK, which
reduces the size and is safer.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Anusha Srivatsa<anusha.srivatsa@intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230120193457.3295977-9-lucas.demarchi@intel.com
drivers/gpu/drm/i915/i915_reg.h

index 539e4b1d061a9eb8618c7ef9c0619563ef5e0034..fe0610acfa64186bb79e2917cb2a389bb1872ab3 100644 (file)
 #define   PALETTE_10BIT_BLUE_EXP_MASK  REG_GENMASK(7, 6)
 #define   PALETTE_10BIT_BLUE_MANT_MASK REG_GENMASK(5, 2)
 #define   PALETTE_10BIT_BLUE_UDW_MASK  REG_GENMASK(1, 0)
-#define PALETTE(pipe, i)       _MMIO(DISPLAY_MMIO_BASE(dev_priv) + \
-                                     _PICK((pipe), _PALETTE_A,         \
-                                           _PALETTE_B, _CHV_PALETTE_C) + \
-                                     (i) * 4)
+#define PALETTE(pipe, i) _MMIO(DISPLAY_MMIO_BASE(dev_priv) +                   \
+                              _PICK_EVEN_2RANGES(pipe, 2,                      \
+                                                 _PALETTE_A, _PALETTE_B,       \
+                                                 _CHV_PALETTE_C, _CHV_PALETTE_C) + \
+                                                 (i) * 4)
 
 #define PEG_BAND_GAP_DATA      _MMIO(0x14d68)