]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Split ivb+ sprite plane update into noarm+arm pair
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 18 Oct 2021 11:50:29 +0000 (14:50 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 4 Nov 2021 15:59:25 +0000 (17:59 +0200)
Chop ivb_sprite_update() into two halves. Fist half becomes
the _noarm() variant, second part the _arm() variant.

Fortunately I have already previously grouped the register
writes into roughtly the correct order, so the split looks
surprisingly clean.

Didn't bother with i915_update_info numbers for this one.
I expect the results to be pretty much identical to the snb
numbers from the corresponding g4x+ sprite modification.

Cc: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211018115030.3547-9-ville.syrjala@linux.intel.com
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
drivers/gpu/drm/i915/display/intel_sprite.c

index fe779b5dd6f60b123b3c41620fb3f6a48c4e0d11..51ffecaa1e20e19c7f4f70df5db7a4411c330f9e 100644 (file)
@@ -836,30 +836,22 @@ static void ivb_sprite_update_gamma(const struct intel_plane_state *plane_state)
        i++;
 }
 
-/* TODO: split into noarm+arm pair */
 static void
-ivb_sprite_update_arm(struct intel_plane *plane,
-                     const struct intel_crtc_state *crtc_state,
-                     const struct intel_plane_state *plane_state)
+ivb_sprite_update_noarm(struct intel_plane *plane,
+                       const struct intel_crtc_state *crtc_state,
+                       const struct intel_plane_state *plane_state)
 {
        struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
        enum pipe pipe = plane->pipe;
-       u32 sprsurf_offset = plane_state->view.color_plane[0].offset;
-       u32 linear_offset;
-       const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
        int crtc_x = plane_state->uapi.dst.x1;
        int crtc_y = plane_state->uapi.dst.y1;
        u32 crtc_w = drm_rect_width(&plane_state->uapi.dst);
        u32 crtc_h = drm_rect_height(&plane_state->uapi.dst);
-       u32 x = plane_state->view.color_plane[0].x;
-       u32 y = plane_state->view.color_plane[0].y;
        u32 src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
        u32 src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
-       u32 sprctl, sprscale = 0;
+       u32 sprscale = 0;
        unsigned long irqflags;
 
-       sprctl = plane_state->ctl | ivb_sprite_ctl_crtc(crtc_state);
-
        /* Sizes are 0 based */
        src_w--;
        src_h--;
@@ -869,8 +861,6 @@ ivb_sprite_update_arm(struct intel_plane *plane,
        if (crtc_w != src_w || crtc_h != src_h)
                sprscale = SPRITE_SCALE_ENABLE | (src_w << 16) | src_h;
 
-       linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
-
        spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
 
        intel_de_write_fw(dev_priv, SPRSTRIDE(pipe),
@@ -880,6 +870,29 @@ ivb_sprite_update_arm(struct intel_plane *plane,
        if (IS_IVYBRIDGE(dev_priv))
                intel_de_write_fw(dev_priv, SPRSCALE(pipe), sprscale);
 
+       spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
+}
+
+static void
+ivb_sprite_update_arm(struct intel_plane *plane,
+                     const struct intel_crtc_state *crtc_state,
+                     const struct intel_plane_state *plane_state)
+{
+       struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
+       enum pipe pipe = plane->pipe;
+       const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
+       u32 sprsurf_offset = plane_state->view.color_plane[0].offset;
+       u32 x = plane_state->view.color_plane[0].x;
+       u32 y = plane_state->view.color_plane[0].y;
+       u32 sprctl, linear_offset;
+       unsigned long irqflags;
+
+       sprctl = plane_state->ctl | ivb_sprite_ctl_crtc(crtc_state);
+
+       linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
+
+       spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
+
        if (key->flags) {
                intel_de_write_fw(dev_priv, SPRKEYVAL(pipe), key->min_value);
                intel_de_write_fw(dev_priv, SPRKEYMSK(pipe),
@@ -1775,6 +1788,7 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv,
 
                plane_funcs = &vlv_sprite_funcs;
        } else if (DISPLAY_VER(dev_priv) >= 7) {
+               plane->update_noarm = ivb_sprite_update_noarm;
                plane->update_arm = ivb_sprite_update_arm;
                plane->disable_arm = ivb_sprite_disable_arm;
                plane->get_hw_state = ivb_sprite_get_hw_state;