drm/i915: Extract intel_plane_needs_fence()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 16 Apr 2026 17:44:44 +0000 (20:44 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 21 Apr 2026 10:11:36 +0000 (13:11 +0300)
Extract the naked DISPLAY_VER<4 checks into a descriptive little
helper (intel_plane_needs_fence()).

And while at it document the reason why the check is what it is.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patch.msgid.link/20260416174448.28264-9-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/display/intel_fb.c
drivers/gpu/drm/i915/display/intel_plane.c
drivers/gpu/drm/i915/display/intel_plane.h
drivers/gpu/drm/i915/i915_fb_pin.c

index cbeb39e..1c0859d 100644 (file)
@@ -1287,7 +1287,7 @@ bool intel_plane_uses_fence(const struct intel_plane_state *plane_state)
        struct intel_display *display = to_intel_display(plane_state);
        struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
 
-       return DISPLAY_VER(display) < 4 ||
+       return intel_plane_needs_fence(display) ||
                (plane->fbc && !plane_state->no_fbc_reason &&
                 i915_gtt_view_is_normal(&plane_state->view.gtt));
 }
index f41f4c2..c2b58d3 100644 (file)
@@ -192,6 +192,15 @@ bool intel_plane_needs_physical(struct intel_plane *plane)
                DISPLAY_INFO(display)->cursor_needs_physical;
 }
 
+bool intel_plane_needs_fence(struct intel_display *display)
+{
+       /*
+        * pre-i965 planes use the fence for tiled scanout.
+        * i965+ planes have their own tiled scanout control bit.
+        */
+       return DISPLAY_VER(display) < 4;
+}
+
 bool intel_plane_can_async_flip(struct intel_plane *plane,
                                const struct drm_format_info *info,
                                u64 modifier)
index 7fa7fbb..7b5456f 100644 (file)
@@ -82,6 +82,7 @@ void intel_plane_set_invisible(struct intel_crtc_state *crtc_state,
 void intel_plane_helper_add(struct intel_plane *plane);
 bool intel_plane_needs_low_address(struct intel_display *display);
 bool intel_plane_needs_physical(struct intel_plane *plane);
+bool intel_plane_needs_fence(struct intel_display *display);
 void intel_plane_init_cursor_vblank_work(struct intel_plane_state *old_plane_state,
                                         struct intel_plane_state *new_plane_state);
 int intel_plane_add_affected(struct intel_atomic_state *state,
index bfe9a53..a8ed888 100644 (file)
@@ -188,7 +188,7 @@ retry:
                 * mode that matches the user configuration.
                 */
                ret = i915_vma_pin_fence(vma);
-               if (ret != 0 && DISPLAY_VER(display) < 4) {
+               if (ret != 0 && intel_plane_needs_fence(display)) {
                        i915_vma_unpin(vma);
                        goto err_unpin;
                }