From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org
Subject: [PATCH 11/19] drm/i915/overlay: Abstract buffer (un)pinning
Date: Wed, 18 Feb 2026 17:27:58 +0200 [thread overview]
Message-ID: <20260218152806.18885-12-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20260218152806.18885-1-ville.syrjala@linux.intel.com>
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Make the buffer (un)pinning a bit more abstract so that
the display side of the code doesn't need to know about i915
specific things (i915_ggtt_offset() and i915_vma_unpin()).
In preparation for the full parent vs. display driver split
we'll also pass in the drm_device to these functions, although
not strictly needed yet.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/i915/display/intel_overlay.c | 24 ++++++++++++++------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_overlay.c b/drivers/gpu/drm/i915/display/intel_overlay.c
index 9b5ae3f4f5bd..24579c9a7fec 100644
--- a/drivers/gpu/drm/i915/display/intel_overlay.c
+++ b/drivers/gpu/drm/i915/display/intel_overlay.c
@@ -780,7 +780,9 @@ static u32 overlay_cmd_reg(struct drm_intel_overlay_put_image *params)
return cmd;
}
-static struct i915_vma *intel_overlay_pin_fb(struct drm_gem_object *obj)
+static struct i915_vma *i915_overlay_pin_fb(struct drm_device *drm,
+ struct drm_gem_object *obj,
+ u32 *offset)
{
struct drm_i915_gem_object *new_bo = to_intel_bo(obj);
struct i915_gem_ww_ctx ww;
@@ -804,9 +806,17 @@ static struct i915_vma *intel_overlay_pin_fb(struct drm_gem_object *obj)
if (ret)
return ERR_PTR(ret);
+ *offset = i915_ggtt_offset(vma);
+
return vma;
}
+static void i915_overlay_unpin_fb(struct drm_device *drm,
+ struct i915_vma *vma)
+{
+ i915_vma_unpin(vma);
+}
+
static int intel_overlay_do_put_image(struct intel_overlay *overlay,
struct drm_gem_object *obj,
struct drm_intel_overlay_put_image *params)
@@ -818,7 +828,7 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay,
bool scale_changed = false;
struct i915_vma *vma;
int ret, tmp_width;
- u32 tmp;
+ u32 tmp, offset;
drm_WARN_ON(display->drm,
!drm_modeset_is_locked(&display->drm->mode_config.connection_mutex));
@@ -829,7 +839,7 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay,
atomic_inc(&display->restore.pending_fb_pin);
- vma = intel_overlay_pin_fb(obj);
+ vma = i915_overlay_pin_fb(display->drm, obj, &offset);
if (IS_ERR(vma)) {
ret = PTR_ERR(vma);
goto out_pin_section;
@@ -868,7 +878,7 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay,
swidth = params->src_width;
swidthsw = calc_swidthsw(display, params->offset_Y, tmp_width);
sheight = params->src_height;
- iowrite32(i915_ggtt_offset(vma) + params->offset_Y, ®s->OBUF_0Y);
+ iowrite32(offset + params->offset_Y, ®s->OBUF_0Y);
ostride = params->stride_Y;
if (params->flags & I915_OVERLAY_YUV_PLANAR) {
@@ -885,9 +895,9 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay,
params->src_width / uv_hscale);
swidthsw |= max(tmp_U, tmp_V) << 16;
- iowrite32(i915_ggtt_offset(vma) + params->offset_U,
+ iowrite32(offset + params->offset_U,
®s->OBUF_0U);
- iowrite32(i915_ggtt_offset(vma) + params->offset_V,
+ iowrite32(offset + params->offset_V,
®s->OBUF_0V);
ostride |= params->stride_UV << 16;
@@ -916,7 +926,7 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay,
return 0;
out_unpin:
- i915_vma_unpin(vma);
+ i915_overlay_unpin_fb(display->drm, vma);
out_pin_section:
atomic_dec(&display->restore.pending_fb_pin);
--
2.52.0
next prev parent reply other threads:[~2026-02-18 15:28 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-18 15:27 [PATCH 00/19] drm/i915/overlay: Convert to parent interface Ville Syrjala
2026-02-18 15:27 ` [PATCH 01/19] drm/i915/overlay: Remove GPU hang snapshot stuff Ville Syrjala
2026-02-18 15:27 ` [PATCH 02/19] drm/i915/overlay: Track current frontbuffer_bits Ville Syrjala
2026-02-25 10:38 ` Jani Nikula
2026-02-18 15:27 ` [PATCH 03/19] drm/i915/overlay: Extract i915_overlay_is_active() Ville Syrjala
2026-02-18 15:27 ` [PATCH 04/19] drm/i915/overlay: Remove redundant overlay->active Ville Syrjala
2026-02-18 15:27 ` [PATCH 05/19] drm/i915/overlay: Relocate the underrun check Ville Syrjala
2026-02-18 15:27 ` [PATCH 06/19] drm/i915/overlay: Introduce i915_overlay_obj_lookup() Ville Syrjala
2026-02-25 9:40 ` Jani Nikula
2026-02-25 10:06 ` Ville Syrjälä
2026-02-18 15:27 ` [PATCH 07/19] drm/i915/overlay: Use struct drm_gem_object as the type Ville Syrjala
2026-02-18 15:27 ` [PATCH 08/19] drm/i915/overlay: Extract i915_overlay_reset() Ville Syrjala
2026-02-18 15:27 ` [PATCH 09/19] drm/i915/overlay: Extract i915_overlay_setup() Ville Syrjala
2026-02-18 15:27 ` [PATCH 10/19] drm/i915/overlay: Extract i915_overlay_cleanup() Ville Syrjala
2026-02-18 15:27 ` Ville Syrjala [this message]
2026-02-18 15:27 ` [PATCH 12/19] drm/i915/overlay: Rename low level i915 specific functions Ville Syrjala
2026-02-18 15:28 ` [PATCH 13/19] drm/i915/overlay: Adjust i915 specific interfaces Ville Syrjala
2026-02-18 15:28 ` [PATCH 14/19] drm/i915/overlay: Make i830_overlay_clock_gating() i915 specific Ville Syrjala
2026-02-18 15:28 ` [PATCH 15/19] drm/i915/overlay: s/dev_priv/i915/ Ville Syrjala
2026-02-18 15:28 ` [PATCH 16/19] drm/i915/overlay: Split 'struct intel_overlay' Ville Syrjala
2026-02-18 15:28 ` [PATCH 17/19] drm/i915/overlay: Don't use fetch_and_zero() in display code Ville Syrjala
2026-02-25 9:47 ` Jani Nikula
2026-02-25 10:00 ` Ville Syrjälä
2026-02-18 15:28 ` [PATCH 18/19] drm/i915/overlay: Move i915 specific code into i915_overlay.c Ville Syrjala
2026-02-18 15:28 ` [PATCH 19/19] drm/i915/overlay: Convert overlay to parent interface Ville Syrjala
2026-02-18 18:09 ` ✗ CI.checkpatch: warning for drm/i915/overlay: Convert " Patchwork
2026-02-18 18:11 ` ✓ CI.KUnit: success " Patchwork
2026-02-18 18:26 ` ✗ CI.checksparse: warning " Patchwork
2026-02-18 19:12 ` ✗ Xe.CI.BAT: failure " Patchwork
2026-02-18 21:42 ` ✗ Xe.CI.FULL: " Patchwork
2026-02-25 11:19 ` [PATCH 00/19] " Jani Nikula
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260218152806.18885-12-ville.syrjala@linux.intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox