Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/i915/overlay: Abstract buffer (un)pinning

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.

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-12-ville.syrjala@linux.intel.com

+17 -7
+17 -7
drivers/gpu/drm/i915/display/intel_overlay.c
··· 780 780 return cmd; 781 781 } 782 782 783 - static struct i915_vma *intel_overlay_pin_fb(struct drm_gem_object *obj) 783 + static struct i915_vma *i915_overlay_pin_fb(struct drm_device *drm, 784 + struct drm_gem_object *obj, 785 + u32 *offset) 784 786 { 785 787 struct drm_i915_gem_object *new_bo = to_intel_bo(obj); 786 788 struct i915_gem_ww_ctx ww; ··· 806 804 if (ret) 807 805 return ERR_PTR(ret); 808 806 807 + *offset = i915_ggtt_offset(vma); 808 + 809 809 return vma; 810 + } 811 + 812 + static void i915_overlay_unpin_fb(struct drm_device *drm, 813 + struct i915_vma *vma) 814 + { 815 + i915_vma_unpin(vma); 810 816 } 811 817 812 818 static int intel_overlay_do_put_image(struct intel_overlay *overlay, ··· 828 818 bool scale_changed = false; 829 819 struct i915_vma *vma; 830 820 int ret, tmp_width; 831 - u32 tmp; 821 + u32 tmp, offset; 832 822 833 823 drm_WARN_ON(display->drm, 834 824 !drm_modeset_is_locked(&display->drm->mode_config.connection_mutex)); ··· 839 829 840 830 atomic_inc(&display->restore.pending_fb_pin); 841 831 842 - vma = intel_overlay_pin_fb(obj); 832 + vma = i915_overlay_pin_fb(display->drm, obj, &offset); 843 833 if (IS_ERR(vma)) { 844 834 ret = PTR_ERR(vma); 845 835 goto out_pin_section; ··· 878 868 swidth = params->src_width; 879 869 swidthsw = calc_swidthsw(display, params->offset_Y, tmp_width); 880 870 sheight = params->src_height; 881 - iowrite32(i915_ggtt_offset(vma) + params->offset_Y, &regs->OBUF_0Y); 871 + iowrite32(offset + params->offset_Y, &regs->OBUF_0Y); 882 872 ostride = params->stride_Y; 883 873 884 874 if (params->flags & I915_OVERLAY_YUV_PLANAR) { ··· 895 885 params->src_width / uv_hscale); 896 886 swidthsw |= max(tmp_U, tmp_V) << 16; 897 887 898 - iowrite32(i915_ggtt_offset(vma) + params->offset_U, 888 + iowrite32(offset + params->offset_U, 899 889 &regs->OBUF_0U); 900 - iowrite32(i915_ggtt_offset(vma) + params->offset_V, 890 + iowrite32(offset + params->offset_V, 901 891 &regs->OBUF_0V); 902 892 903 893 ostride |= params->stride_UV << 16; ··· 926 916 return 0; 927 917 928 918 out_unpin: 929 - i915_vma_unpin(vma); 919 + i915_overlay_unpin_fb(display->drm, vma); 930 920 out_pin_section: 931 921 atomic_dec(&display->restore.pending_fb_pin); 932 922