diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2024-04-11 02:58:51 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2024-04-11 02:58:51 +0000 |
commit | ad912f29a5c5e27bd62ff7b294134e57eedf3f07 (patch) | |
tree | 8d92804f2fe6d3973c55655df6b2de809dc30a3a /sys | |
parent | dca26aaa9fcd46d3e090d58ebbac950487c3e3cf (diff) |
drm/i915: Pre-populate the cursor physical dma address
From Ville Syrjala
cc696ce93089e3e1bc28d749aee321a37cabe4bd in linux-6.6.y/6.6.26
582dc04b0658ef3b90aeb49cbdd9747c2f1eccc3 in mainline linux
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/drm/i915/display/intel_cursor.c | 4 | ||||
-rw-r--r-- | sys/dev/pci/drm/i915/display/intel_display_types.h | 1 | ||||
-rw-r--r-- | sys/dev/pci/drm/i915/display/intel_fb_pin.c | 10 |
3 files changed, 12 insertions, 3 deletions
diff --git a/sys/dev/pci/drm/i915/display/intel_cursor.c b/sys/dev/pci/drm/i915/display/intel_cursor.c index 0d21c34f749..61df6cd3f37 100644 --- a/sys/dev/pci/drm/i915/display/intel_cursor.c +++ b/sys/dev/pci/drm/i915/display/intel_cursor.c @@ -34,12 +34,10 @@ static u32 intel_cursor_base(const struct intel_plane_state *plane_state) { struct drm_i915_private *dev_priv = to_i915(plane_state->uapi.plane->dev); - const struct drm_framebuffer *fb = plane_state->hw.fb; - struct drm_i915_gem_object *obj = intel_fb_obj(fb); u32 base; if (DISPLAY_INFO(dev_priv)->cursor_needs_physical) - base = i915_gem_object_get_dma_address(obj, 0); + base = plane_state->phys_dma_addr; else base = intel_plane_ggtt_offset(plane_state); diff --git a/sys/dev/pci/drm/i915/display/intel_display_types.h b/sys/dev/pci/drm/i915/display/intel_display_types.h index 310d718f796..50fa55381bd 100644 --- a/sys/dev/pci/drm/i915/display/intel_display_types.h +++ b/sys/dev/pci/drm/i915/display/intel_display_types.h @@ -701,6 +701,7 @@ struct intel_plane_state { #define PLANE_HAS_FENCE BIT(0) struct intel_fb_view view; + u32 phys_dma_addr; /* for cursor_needs_physical */ /* Plane pxp decryption state */ bool decrypt; diff --git a/sys/dev/pci/drm/i915/display/intel_fb_pin.c b/sys/dev/pci/drm/i915/display/intel_fb_pin.c index fffd568070d..a131656757f 100644 --- a/sys/dev/pci/drm/i915/display/intel_fb_pin.c +++ b/sys/dev/pci/drm/i915/display/intel_fb_pin.c @@ -254,6 +254,16 @@ int intel_plane_pin_fb(struct intel_plane_state *plane_state) return PTR_ERR(vma); plane_state->ggtt_vma = vma; + + /* + * Pre-populate the dma address before we enter the vblank + * evade critical section as i915_gem_object_get_dma_address() + * will trigger might_sleep() even if it won't actually sleep, + * which is the case when the fb has already been pinned. + */ + if (phys_cursor) + plane_state->phys_dma_addr = + i915_gem_object_get_dma_address(intel_fb_obj(fb), 0); } else { struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb); |