From: Ville Syrjälä <[email protected]>

Add a few helpers that allow us to abstract the xe initial FB PTE
check a bit. Still very ad-hoc compared to the nicely abstracted
i915 counterpart, but whatever.

Signed-off-by: Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/xe/display/xe_initial_plane.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/xe/display/xe_initial_plane.c 
b/drivers/gpu/drm/xe/display/xe_initial_plane.c
index b7e0685351bb..0dabc5709d01 100644
--- a/drivers/gpu/drm/xe/display/xe_initial_plane.c
+++ b/drivers/gpu/drm/xe/display/xe_initial_plane.c
@@ -18,8 +18,19 @@
 #include "xe_fb_pin.h"
 #include "xe_ggtt.h"
 #include "xe_mmio.h"
+#include "xe_ttm_stolen_mgr.h"
 #include "xe_vram_types.h"
 
+static bool is_pte_local(u64 pte)
+{
+       return pte & XE_GGTT_PTE_DM;
+}
+
+static bool need_pte_local(struct xe_device *xe)
+{
+       return IS_DGFX(xe);
+}
+
 static struct xe_bo *
 initial_plane_bo(struct xe_device *xe,
                 struct intel_initial_plane_config *plane_config)
@@ -43,13 +54,13 @@ initial_plane_bo(struct xe_device *xe,
        if (IS_DGFX(xe)) {
                u64 pte = xe_ggtt_read_pte(tile0->mem.ggtt, base);
 
-               if (!(pte & XE_GGTT_PTE_DM)) {
-                       drm_err(&xe->drm,
-                               "Initial plane programming missing DM bit\n");
+               if (is_pte_local(pte) != need_pte_local(xe)) {
+                       drm_err(&xe->drm, "Initial plane PTE has bad local 
memory bit\n");
                        return NULL;
                }
 
                phys_base = pte & ~(page_size - 1);
+
                flags |= XE_BO_FLAG_VRAM0;
 
                /*
-- 
2.52.0

Reply via email to