If Local memory is supported by hardware, we want framebuffer backing
gem objects from local memory.

pin_to_display is failed, if the backing obj is not from LMEM.

This is developed on top of LMEM Basics
https://patchwork.freedesktop.org/series/67350/

v2:
  memory regions are correctly assigned to obj->memory_regions [tvrtko]
  migration failure is reported as debug log [Tvrtko]
v3:
  Migration is dropped. only error is reported [Daniel]
  mem region check is move to pin_to_display [Chris]

cc: Matthew Auld <matthew.a...@intel.com>
Signed-off-by: Ramalingam C <ramalinga...@intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_domain.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_domain.c 
b/drivers/gpu/drm/i915/gem/i915_gem_domain.c
index 55c3ab59e3aa..c74d0796b142 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_domain.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_domain.c
@@ -419,11 +419,19 @@ i915_gem_object_pin_to_display_plane(struct 
drm_i915_gem_object *obj,
                                     const struct i915_ggtt_view *view,
                                     unsigned int flags)
 {
+       struct drm_i915_private *dev_priv = to_i915(obj->base.dev);
        struct i915_vma *vma;
        int ret;
 
        assert_object_held(obj);
 
+       /* GEM Obj for frame buffer is expected to be in LMEM. */
+       if (HAS_LMEM(dev_priv))
+               if (obj->mm.region->type != INTEL_LMEM) {
+                       DRM_DEBUG_KMS("OBJ is not from LMEM\n");
+                       return ERR_PTR(-EINVAL);
+               }
+
        /*
         * The display engine is not coherent with the LLC cache on gen6.  As
         * a result, we make sure that the pinning that is about to occur is
-- 
2.20.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to