drm/i915: Rename the fb pinning functions to indicate the address space
Rename the fb pinning functions such that their name directly informs us what gets pinned into which address space. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240506125718.26001-10-ville.syrjala@linux.intel.com Reviewed-by: Jani Nikula <jani.nikula@intel.com> Acked-by: Lucas De Marchi <lucas.demarchi@intel.com>
This commit is contained in:
@@ -121,8 +121,8 @@ static void dpt_cleanup(struct i915_address_space *vm)
|
||||
i915_gem_object_put(dpt->obj);
|
||||
}
|
||||
|
||||
struct i915_vma *intel_dpt_pin(struct i915_address_space *vm,
|
||||
unsigned int alignment)
|
||||
struct i915_vma *intel_dpt_pin_to_ggtt(struct i915_address_space *vm,
|
||||
unsigned int alignment)
|
||||
{
|
||||
struct drm_i915_private *i915 = vm->i915;
|
||||
struct i915_dpt *dpt = i915_vm_to_dpt(vm);
|
||||
@@ -173,7 +173,7 @@ struct i915_vma *intel_dpt_pin(struct i915_address_space *vm,
|
||||
return err ? ERR_PTR(err) : vma;
|
||||
}
|
||||
|
||||
void intel_dpt_unpin(struct i915_address_space *vm)
|
||||
void intel_dpt_unpin_from_ggtt(struct i915_address_space *vm)
|
||||
{
|
||||
struct i915_dpt *dpt = i915_vm_to_dpt(vm);
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ struct i915_vma;
|
||||
struct intel_framebuffer;
|
||||
|
||||
void intel_dpt_destroy(struct i915_address_space *vm);
|
||||
struct i915_vma *intel_dpt_pin(struct i915_address_space *vm,
|
||||
unsigned int alignment);
|
||||
void intel_dpt_unpin(struct i915_address_space *vm);
|
||||
struct i915_vma *intel_dpt_pin_to_ggtt(struct i915_address_space *vm,
|
||||
unsigned int alignment);
|
||||
void intel_dpt_unpin_from_ggtt(struct i915_address_space *vm);
|
||||
void intel_dpt_suspend(struct drm_i915_private *i915);
|
||||
void intel_dpt_resume(struct drm_i915_private *i915);
|
||||
struct i915_address_space *
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
#include "intel_fb_pin.h"
|
||||
|
||||
static struct i915_vma *
|
||||
intel_pin_fb_obj_dpt(const struct drm_framebuffer *fb,
|
||||
const struct i915_gtt_view *view,
|
||||
unsigned int alignment,
|
||||
unsigned long *out_flags,
|
||||
struct i915_address_space *vm)
|
||||
intel_fb_pin_to_dpt(const struct drm_framebuffer *fb,
|
||||
const struct i915_gtt_view *view,
|
||||
unsigned int alignment,
|
||||
unsigned long *out_flags,
|
||||
struct i915_address_space *vm)
|
||||
{
|
||||
struct drm_device *dev = fb->dev;
|
||||
struct drm_i915_private *dev_priv = to_i915(dev);
|
||||
@@ -102,11 +102,11 @@ err:
|
||||
}
|
||||
|
||||
struct i915_vma *
|
||||
intel_pin_and_fence_fb_obj(const struct drm_framebuffer *fb,
|
||||
bool phys_cursor,
|
||||
const struct i915_gtt_view *view,
|
||||
bool uses_fence,
|
||||
unsigned long *out_flags)
|
||||
intel_fb_pin_to_ggtt(const struct drm_framebuffer *fb,
|
||||
bool phys_cursor,
|
||||
const struct i915_gtt_view *view,
|
||||
bool uses_fence,
|
||||
unsigned long *out_flags)
|
||||
{
|
||||
struct drm_device *dev = fb->dev;
|
||||
struct drm_i915_private *dev_priv = to_i915(dev);
|
||||
@@ -226,7 +226,7 @@ err:
|
||||
return vma;
|
||||
}
|
||||
|
||||
void intel_unpin_fb_vma(struct i915_vma *vma, unsigned long flags)
|
||||
void intel_fb_unpin_vma(struct i915_vma *vma, unsigned long flags)
|
||||
{
|
||||
if (flags & PLANE_HAS_FENCE)
|
||||
i915_vma_unpin_fence(vma);
|
||||
@@ -242,10 +242,10 @@ int intel_plane_pin_fb(struct intel_plane_state *plane_state)
|
||||
struct i915_vma *vma;
|
||||
|
||||
if (!intel_fb_uses_dpt(&fb->base)) {
|
||||
vma = intel_pin_and_fence_fb_obj(&fb->base, intel_plane_needs_physical(plane),
|
||||
&plane_state->view.gtt,
|
||||
intel_plane_uses_fence(plane_state),
|
||||
&plane_state->flags);
|
||||
vma = intel_fb_pin_to_ggtt(&fb->base, intel_plane_needs_physical(plane),
|
||||
&plane_state->view.gtt,
|
||||
intel_plane_uses_fence(plane_state),
|
||||
&plane_state->flags);
|
||||
if (IS_ERR(vma))
|
||||
return PTR_ERR(vma);
|
||||
|
||||
@@ -263,17 +263,17 @@ int intel_plane_pin_fb(struct intel_plane_state *plane_state)
|
||||
} else {
|
||||
unsigned int alignment = intel_surf_alignment(&fb->base, 0);
|
||||
|
||||
vma = intel_dpt_pin(fb->dpt_vm, alignment / 512);
|
||||
vma = intel_dpt_pin_to_ggtt(fb->dpt_vm, alignment / 512);
|
||||
if (IS_ERR(vma))
|
||||
return PTR_ERR(vma);
|
||||
|
||||
plane_state->ggtt_vma = vma;
|
||||
|
||||
vma = intel_pin_fb_obj_dpt(&fb->base, &plane_state->view.gtt,
|
||||
alignment, &plane_state->flags,
|
||||
fb->dpt_vm);
|
||||
vma = intel_fb_pin_to_dpt(&fb->base, &plane_state->view.gtt,
|
||||
alignment, &plane_state->flags,
|
||||
fb->dpt_vm);
|
||||
if (IS_ERR(vma)) {
|
||||
intel_dpt_unpin(fb->dpt_vm);
|
||||
intel_dpt_unpin_from_ggtt(fb->dpt_vm);
|
||||
plane_state->ggtt_vma = NULL;
|
||||
return PTR_ERR(vma);
|
||||
}
|
||||
@@ -295,14 +295,14 @@ void intel_plane_unpin_fb(struct intel_plane_state *old_plane_state)
|
||||
if (!intel_fb_uses_dpt(&fb->base)) {
|
||||
vma = fetch_and_zero(&old_plane_state->ggtt_vma);
|
||||
if (vma)
|
||||
intel_unpin_fb_vma(vma, old_plane_state->flags);
|
||||
intel_fb_unpin_vma(vma, old_plane_state->flags);
|
||||
} else {
|
||||
vma = fetch_and_zero(&old_plane_state->dpt_vma);
|
||||
if (vma)
|
||||
intel_unpin_fb_vma(vma, old_plane_state->flags);
|
||||
intel_fb_unpin_vma(vma, old_plane_state->flags);
|
||||
|
||||
vma = fetch_and_zero(&old_plane_state->ggtt_vma);
|
||||
if (vma)
|
||||
intel_dpt_unpin(fb->dpt_vm);
|
||||
intel_dpt_unpin_from_ggtt(fb->dpt_vm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,13 +14,13 @@ struct intel_plane_state;
|
||||
struct i915_gtt_view;
|
||||
|
||||
struct i915_vma *
|
||||
intel_pin_and_fence_fb_obj(const struct drm_framebuffer *fb,
|
||||
bool phys_cursor,
|
||||
const struct i915_gtt_view *view,
|
||||
bool uses_fence,
|
||||
unsigned long *out_flags);
|
||||
intel_fb_pin_to_ggtt(const struct drm_framebuffer *fb,
|
||||
bool phys_cursor,
|
||||
const struct i915_gtt_view *view,
|
||||
bool uses_fence,
|
||||
unsigned long *out_flags);
|
||||
|
||||
void intel_unpin_fb_vma(struct i915_vma *vma, unsigned long flags);
|
||||
void intel_fb_unpin_vma(struct i915_vma *vma, unsigned long flags);
|
||||
|
||||
int intel_plane_pin_fb(struct intel_plane_state *plane_state);
|
||||
void intel_plane_unpin_fb(struct intel_plane_state *old_plane_state);
|
||||
|
||||
@@ -146,7 +146,7 @@ static void intel_fbdev_fb_destroy(struct fb_info *info)
|
||||
* the info->screen_base mmaping. Leaking the VMA is simpler than
|
||||
* trying to rectify all the possible error paths leading here.
|
||||
*/
|
||||
intel_unpin_fb_vma(ifbdev->vma, ifbdev->vma_flags);
|
||||
intel_fb_unpin_vma(ifbdev->vma, ifbdev->vma_flags);
|
||||
drm_framebuffer_remove(&ifbdev->fb->base);
|
||||
|
||||
drm_client_release(&fb_helper->client);
|
||||
@@ -227,8 +227,8 @@ static int intelfb_create(struct drm_fb_helper *helper,
|
||||
* This also validates that any existing fb inherited from the
|
||||
* BIOS is suitable for own access.
|
||||
*/
|
||||
vma = intel_pin_and_fence_fb_obj(&fb->base, false,
|
||||
&view, false, &flags);
|
||||
vma = intel_fb_pin_to_ggtt(&fb->base, false,
|
||||
&view, false, &flags);
|
||||
if (IS_ERR(vma)) {
|
||||
ret = PTR_ERR(vma);
|
||||
goto out_unlock;
|
||||
@@ -274,7 +274,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
|
||||
return 0;
|
||||
|
||||
out_unpin:
|
||||
intel_unpin_fb_vma(vma, flags);
|
||||
intel_fb_unpin_vma(vma, flags);
|
||||
out_unlock:
|
||||
intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref);
|
||||
return ret;
|
||||
|
||||
@@ -333,18 +333,18 @@ static void __xe_unpin_fb_vma(struct i915_vma *vma)
|
||||
}
|
||||
|
||||
struct i915_vma *
|
||||
intel_pin_and_fence_fb_obj(const struct drm_framebuffer *fb,
|
||||
bool phys_cursor,
|
||||
const struct i915_gtt_view *view,
|
||||
bool uses_fence,
|
||||
unsigned long *out_flags)
|
||||
intel_fb_pin_to_ggtt(const struct drm_framebuffer *fb,
|
||||
bool phys_cursor,
|
||||
const struct i915_gtt_view *view,
|
||||
bool uses_fence,
|
||||
unsigned long *out_flags)
|
||||
{
|
||||
*out_flags = 0;
|
||||
|
||||
return __xe_pin_fb_vma(to_intel_framebuffer(fb), view);
|
||||
}
|
||||
|
||||
void intel_unpin_fb_vma(struct i915_vma *vma, unsigned long flags)
|
||||
void intel_fb_unpin_vma(struct i915_vma *vma, unsigned long flags)
|
||||
{
|
||||
__xe_unpin_fb_vma(vma);
|
||||
}
|
||||
|
||||
@@ -211,8 +211,8 @@ intel_find_initial_plane_obj(struct intel_crtc *crtc,
|
||||
intel_fb_fill_view(to_intel_framebuffer(fb),
|
||||
plane_state->uapi.rotation, &plane_state->view);
|
||||
|
||||
vma = intel_pin_and_fence_fb_obj(fb, false, &plane_state->view.gtt,
|
||||
false, &plane_state->flags);
|
||||
vma = intel_fb_pin_to_ggtt(fb, false, &plane_state->view.gtt,
|
||||
false, &plane_state->flags);
|
||||
if (IS_ERR(vma))
|
||||
goto nofb;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user