]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/i915/overlay: Extract i915_overlay_setup()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 26 Feb 2026 10:07:28 +0000 (12:07 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 27 Feb 2026 08:41:35 +0000 (10:41 +0200)
Pull the gem/gt related bits of the overlay setup into
a separate function (i915_overlay_setup()) that will eventually
move to the i915 side of the parent vs. display driver split.

For now we'll also have to pass in the overlay struct, but
that will disappear once the i915 vs. display split is completed.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patch.msgid.link/20260226100738.29997-10-ville.syrjala@linux.intel.com
drivers/gpu/drm/i915/display/intel_overlay.c

index 9070d88d25b5fc47d4d70f2686a33a281441c5d5..1b84790a63b2d05e844f5594b46f5b6ccbca0bd7 100644 (file)
@@ -1430,39 +1430,49 @@ err_put_bo:
        return err;
 }
 
+static int i915_overlay_setup(struct drm_device *drm,
+                             struct intel_overlay *overlay,
+                             bool needs_physical)
+{
+       struct drm_i915_private *dev_priv = to_i915(drm);
+       struct intel_engine_cs *engine;
+
+       engine = to_gt(dev_priv)->engine[RCS0];
+       if (!engine || !engine->kernel_context)
+               return -ENOENT;
+
+       overlay->context = engine->kernel_context;
+
+       i915_active_init(&overlay->last_flip,
+                        NULL, intel_overlay_last_flip_retire, 0);
+
+       return get_registers(overlay, needs_physical);
+}
+
 void intel_overlay_setup(struct intel_display *display)
 {
-       struct drm_i915_private *dev_priv = to_i915(display->drm);
        struct intel_overlay *overlay;
-       struct intel_engine_cs *engine;
        int ret;
 
        if (!HAS_OVERLAY(display))
                return;
 
-       engine = to_gt(dev_priv)->engine[RCS0];
-       if (!engine || !engine->kernel_context)
-               return;
-
        overlay = kzalloc_obj(*overlay);
        if (!overlay)
                return;
 
+       ret = i915_overlay_setup(display->drm, overlay,
+                                OVERLAY_NEEDS_PHYSICAL(display));
+       if (ret)
+               goto out_free;
+
        overlay->display = display;
-       overlay->context = engine->kernel_context;
        overlay->color_key = 0x0101fe;
        overlay->color_key_enabled = true;
        overlay->brightness = -19;
        overlay->contrast = 75;
        overlay->saturation = 146;
 
-       i915_active_init(&overlay->last_flip,
-                        NULL, intel_overlay_last_flip_retire, 0);
-
-       ret = get_registers(overlay, OVERLAY_NEEDS_PHYSICAL(display));
-       if (ret)
-               goto out_free;
-
        memset_io(overlay->regs, 0, sizeof(struct overlay_registers));
        update_polyphase_filter(overlay->regs);
        update_reg_attrs(overlay, overlay->regs);