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]>
Reviewed-by: Jani Nikula <[email protected]>
Link: 
https://patch.msgid.link/[email protected]
Signed-off-by: Maarten Lankhorst <[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 a62e5394c3f7d..1e1962c955890 100644
--- a/drivers/gpu/drm/xe/display/xe_initial_plane.c
+++ b/drivers/gpu/drm/xe/display/xe_initial_plane.c
@@ -19,8 +19,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)
@@ -44,13 +55,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.53.0

Reply via email to