drm/i915: Helper function to determine GGTT view from plane state
For now only default implementation defaulting to normal view. v2: Some code review cleanups. (Joonas Lahtinen) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> (v2) Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
82bc3b2daa
commit
f64b98cd2e
1 changed files with 22 additions and 3 deletions
|
@ -2288,6 +2288,15 @@ intel_fb_align_height(struct drm_device *dev, unsigned int height,
|
||||||
fb_format_modifier));
|
fb_format_modifier));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, struct drm_framebuffer *fb,
|
||||||
|
const struct drm_plane_state *plane_state)
|
||||||
|
{
|
||||||
|
*view = i915_ggtt_view_normal;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
intel_pin_and_fence_fb_obj(struct drm_plane *plane,
|
intel_pin_and_fence_fb_obj(struct drm_plane *plane,
|
||||||
struct drm_framebuffer *fb,
|
struct drm_framebuffer *fb,
|
||||||
|
@ -2297,6 +2306,7 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
|
||||||
struct drm_device *dev = fb->dev;
|
struct drm_device *dev = fb->dev;
|
||||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||||
struct drm_i915_gem_object *obj = intel_fb_obj(fb);
|
struct drm_i915_gem_object *obj = intel_fb_obj(fb);
|
||||||
|
struct i915_ggtt_view view;
|
||||||
u32 alignment;
|
u32 alignment;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -2333,6 +2343,10 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = intel_fill_fb_ggtt_view(&view, fb, plane_state);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
/* Note that the w/a also requires 64 PTE of padding following the
|
/* Note that the w/a also requires 64 PTE of padding following the
|
||||||
* bo. We currently fill all unused PTE with the shadow page and so
|
* bo. We currently fill all unused PTE with the shadow page and so
|
||||||
* we should always have valid PTE following the scanout preventing
|
* we should always have valid PTE following the scanout preventing
|
||||||
|
@ -2352,7 +2366,7 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
|
||||||
|
|
||||||
dev_priv->mm.interruptible = false;
|
dev_priv->mm.interruptible = false;
|
||||||
ret = i915_gem_object_pin_to_display_plane(obj, alignment, pipelined,
|
ret = i915_gem_object_pin_to_display_plane(obj, alignment, pipelined,
|
||||||
&i915_ggtt_view_normal);
|
&view);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_interruptible;
|
goto err_interruptible;
|
||||||
|
|
||||||
|
@ -2372,7 +2386,7 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_unpin:
|
err_unpin:
|
||||||
i915_gem_object_unpin_from_display_plane(obj, &i915_ggtt_view_normal);
|
i915_gem_object_unpin_from_display_plane(obj, &view);
|
||||||
err_interruptible:
|
err_interruptible:
|
||||||
dev_priv->mm.interruptible = true;
|
dev_priv->mm.interruptible = true;
|
||||||
intel_runtime_pm_put(dev_priv);
|
intel_runtime_pm_put(dev_priv);
|
||||||
|
@ -2383,11 +2397,16 @@ static void intel_unpin_fb_obj(struct drm_framebuffer *fb,
|
||||||
const struct drm_plane_state *plane_state)
|
const struct drm_plane_state *plane_state)
|
||||||
{
|
{
|
||||||
struct drm_i915_gem_object *obj = intel_fb_obj(fb);
|
struct drm_i915_gem_object *obj = intel_fb_obj(fb);
|
||||||
|
struct i915_ggtt_view view;
|
||||||
|
int ret;
|
||||||
|
|
||||||
WARN_ON(!mutex_is_locked(&obj->base.dev->struct_mutex));
|
WARN_ON(!mutex_is_locked(&obj->base.dev->struct_mutex));
|
||||||
|
|
||||||
|
ret = intel_fill_fb_ggtt_view(&view, fb, plane_state);
|
||||||
|
WARN_ONCE(ret, "Couldn't get view from plane state!");
|
||||||
|
|
||||||
i915_gem_object_unpin_fence(obj);
|
i915_gem_object_unpin_fence(obj);
|
||||||
i915_gem_object_unpin_from_display_plane(obj, &i915_ggtt_view_normal);
|
i915_gem_object_unpin_from_display_plane(obj, &view);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Computes the linear offset to the base tile and adjusts x, y. bytes per pixel
|
/* Computes the linear offset to the base tile and adjusts x, y. bytes per pixel
|
||||||
|
|
Loading…
Add table
Reference in a new issue