]> www.infradead.org Git - nvme.git/commitdiff
drm/i915: Polish the skl+ plane keyval/msk/max register setup
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 7 Nov 2018 18:41:38 +0000 (20:41 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 9 Nov 2018 17:10:37 +0000 (19:10 +0200)
Due to the constant alpha we're going to have to program two of
the the tree keying registers anyway, so might as well always
program all three.

And parametrize the plane constant alpha define while at it.

v2: Rebase due to input CSC

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181107184138.31359-1-ville.syrjala@linux.intel.com
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/i915/i915_reg.h
drivers/gpu/drm/i915/intel_sprite.c

index 158cf4716d03be6ac5333801a14894cfdf7c8de5..fe4b913e46ac2f4f219a1134dd6662b1abc9a6b0 100644 (file)
@@ -6559,7 +6559,7 @@ enum {
 #define  PLANE_KEYMSK_ALPHA_ENABLE             (1 << 31)
 #define _PLANE_KEYMAX_1_A                      0x701a0
 #define _PLANE_KEYMAX_2_A                      0x702a0
-#define  PLANE_KEYMAX_ALPHA_SHIFT              24
+#define  PLANE_KEYMAX_ALPHA(a)                 ((a) << 24)
 #define _PLANE_AUX_DIST_1_A                    0x701c0
 #define _PLANE_AUX_DIST_2_A                    0x702c0
 #define _PLANE_AUX_OFFSET_1_A                  0x701c4
index 287a435245647886330e6ca9aec7f4b4921b3685..6d9f321cdf7b844f89b09f0c8c63e73cec628fef 100644 (file)
@@ -478,13 +478,20 @@ skl_program_plane(struct intel_plane *plane,
        uint32_t src_h = drm_rect_height(&plane_state->base.src) >> 16;
        struct intel_plane *linked = plane_state->linked_plane;
        const struct drm_framebuffer *fb = plane_state->base.fb;
+       u8 alpha = plane_state->base.alpha >> 8;
        unsigned long irqflags;
-       u32 keymsk = 0, keymax = 0;
+       u32 keymsk, keymax;
 
        /* Sizes are 0 based */
        src_w--;
        src_h--;
 
+       keymax = (key->max_value & 0xffffff) | PLANE_KEYMAX_ALPHA(alpha);
+
+       keymsk = key->channel_mask & 0x3ffffff;
+       if (alpha < 0xff)
+               keymsk |= PLANE_KEYMSK_ALPHA_ENABLE;
+
        spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
 
        if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
@@ -494,18 +501,7 @@ skl_program_plane(struct intel_plane *plane,
        if (fb->format->is_yuv && icl_is_hdr_plane(plane))
                icl_program_input_csc_coeff(crtc_state, plane_state);
 
-       if (key->flags) {
-               I915_WRITE_FW(PLANE_KEYVAL(pipe, plane_id), key->min_value);
-
-               keymax |= key->max_value & 0xffffff;
-               keymsk |= key->channel_mask & 0x3ffffff;
-       }
-
-       keymax |= (plane_state->base.alpha >> 8) << PLANE_KEYMAX_ALPHA_SHIFT;
-
-       if (plane_state->base.alpha < 0xff00)
-               keymsk |= PLANE_KEYMSK_ALPHA_ENABLE;
-
+       I915_WRITE_FW(PLANE_KEYVAL(pipe, plane_id), key->min_value);
        I915_WRITE_FW(PLANE_KEYMAX(pipe, plane_id), keymax);
        I915_WRITE_FW(PLANE_KEYMSK(pipe, plane_id), keymsk);