* [Intel-xe] [PATCH 0/9] Clean-up Xe FBC additions
@ 2023-05-30 10:34 Jouni Högander
2023-05-30 10:34 ` [Intel-xe] [PATCH 1/9] fixup! drm/i915/display: Implement FBC support Jouni Högander
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: Jouni Högander @ 2023-05-30 10:34 UTC (permalink / raw)
To: intel-xe; +Cc: Jouni Högander, Jani Nikula, Rodrigo Vivi
This patch set cleans up Xe FBC additions. All stolen memory details are
moved to i915_gem_stolen header and source files. Also some fence handling
details are move away from FBC code. This allows removing all ifdefs added
into fbc code.
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Jouni Högander (9):
fixup! drm/i915/display: Implement FBC support
drivers/xe: Add new type for compressed fb
drm/i915/fbc: Add common type for compressed fb to avoid ifdefs
drm/xe: Add i915_gem.h compatibility header
drivers/xe: Move Xe stolen memory handling away form fbc code
drm/i915: Move stolen memory handling into i915_gem_stolen
drm/i915/fbc: Stolen initialize can be checked in plane check for i915
as well
drm/i915/fbc: Add function to get number of fences for gt
Add new fence_id and fence count functions
drivers/gpu/drm/i915/display/intel_fbc.c | 134 ++++--------------
drivers/gpu/drm/i915/gem/i915_gem_stolen.c | 37 +++++
drivers/gpu/drm/i915/gem/i915_gem_stolen.h | 13 ++
drivers/gpu/drm/i915/gt/intel_gt_types.h | 2 +
drivers/gpu/drm/i915/i915_vma.h | 5 +
.../gpu/drm/xe/compat-i915-headers/i915_drv.h | 5 +
.../gpu/drm/xe/compat-i915-headers/i915_gem.h | 9 ++
.../xe/compat-i915-headers/i915_gem_stolen.h | 76 ++++++++++
.../gpu/drm/xe/compat-i915-headers/i915_vma.h | 2 +
drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c | 8 ++
drivers/gpu/drm/xe/xe_ttm_stolen_mgr.h | 1 +
11 files changed, 183 insertions(+), 109 deletions(-)
create mode 100644 drivers/gpu/drm/xe/compat-i915-headers/i915_gem.h
create mode 100644 drivers/gpu/drm/xe/compat-i915-headers/i915_gem_stolen.h
--
2.34.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Intel-xe] [PATCH 1/9] fixup! drm/i915/display: Implement FBC support
2023-05-30 10:34 [Intel-xe] [PATCH 0/9] Clean-up Xe FBC additions Jouni Högander
@ 2023-05-30 10:34 ` Jouni Högander
2023-05-30 10:34 ` [Intel-xe] [PATCH 2/9] drivers/xe: Add new type for compressed fb Jouni Högander
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Jouni Högander @ 2023-05-30 10:34 UTC (permalink / raw)
To: intel-xe; +Cc: Jouni Högander
Unify naming convention. Now all functions to query information on stolen
node are using prefix i915_gem_stolen_node.
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
drivers/gpu/drm/i915/display/intel_fbc.c | 30 ++++++++++++------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c
index 9dc7083fe974..913db2ea5650 100644
--- a/drivers/gpu/drm/i915/display/intel_fbc.c
+++ b/drivers/gpu/drm/i915/display/intel_fbc.c
@@ -57,9 +57,9 @@
#ifdef I915
#define i915_gem_stolen_initialized(i915) (drm_mm_initialized(&(i915)->mm.stolen))
-#define i915_gem_stolen_allocated(node) drm_mm_node_allocated(&(node))
-#define i915_gem_stolen_compressed_offset(node) ((node).start)
-#define i915_gem_stolen_compressed_size(node) ((node).size)
+#define i915_gem_stolen_node_allocated(node) drm_mm_node_allocated(&(node))
+#define i915_gem_stolen_node_offset(node) ((node).start)
+#define i915_gem_stolen_node_size(node) ((node).size)
#else
@@ -103,9 +103,9 @@ static void i915_gem_stolen_remove_node(struct xe_device *xe, struct xe_bo **bo)
}
#define i915_gem_stolen_initialized(xe) (!!ttm_manager_type(&(xe)->ttm, XE_PL_STOLEN))
-#define i915_gem_stolen_allocated(bo) (!!(bo))
+#define i915_gem_stolen_node_allocated(bo) (!!(bo))
-static u32 i915_gem_stolen_compressed_offset(struct xe_bo *bo)
+static u32 i915_gem_stolen_node_offset(struct xe_bo *bo)
{
struct xe_res_cursor res;
@@ -113,7 +113,7 @@ static u32 i915_gem_stolen_compressed_offset(struct xe_bo *bo)
return res.start;
}
-#define i915_gem_stolen_compressed_size(fb) ((u64)((fb)->ttm.base.size))
+#define i915_gem_stolen_node_size(fb) ((u64)((fb)->ttm.base.size))
#endif
#define for_each_fbc_id(__dev_priv, __fbc_id) \
@@ -515,7 +515,7 @@ static void g4x_fbc_program_cfb(struct intel_fbc *fbc)
struct drm_i915_private *i915 = fbc->i915;
intel_de_write(i915, DPFC_CB_BASE,
- i915_gem_stolen_compressed_offset(fbc->compressed_fb));
+ i915_gem_stolen_node_offset(fbc->compressed_fb));
}
static const struct intel_fbc_funcs g4x_fbc_funcs = {
@@ -567,7 +567,7 @@ static void ilk_fbc_program_cfb(struct intel_fbc *fbc)
struct drm_i915_private *i915 = fbc->i915;
intel_de_write(i915, ILK_DPFC_CB_BASE(fbc->id),
- i915_gem_stolen_compressed_offset(fbc->compressed_fb));
+ i915_gem_stolen_node_offset(fbc->compressed_fb));
}
static const struct intel_fbc_funcs ilk_fbc_funcs = {
@@ -843,9 +843,9 @@ static int intel_fbc_alloc_cfb(struct intel_fbc *fbc,
int ret;
drm_WARN_ON(&i915->drm,
- i915_gem_stolen_allocated(fbc->compressed_fb));
+ i915_gem_stolen_node_allocated(fbc->compressed_fb));
drm_WARN_ON(&i915->drm,
- i915_gem_stolen_allocated(fbc->compressed_llb));
+ i915_gem_stolen_node_allocated(fbc->compressed_llb));
if (DISPLAY_VER(i915) < 5 && !IS_G4X(i915)) {
ret = i915_gem_stolen_insert_node(i915, &fbc->compressed_llb,
@@ -865,12 +865,12 @@ static int intel_fbc_alloc_cfb(struct intel_fbc *fbc,
drm_dbg_kms(&i915->drm,
"reserved %llu bytes of contiguous stolen space for FBC, limit: %d\n",
- i915_gem_stolen_compressed_size(fbc->compressed_fb), fbc->limit);
+ i915_gem_stolen_node_size(fbc->compressed_fb), fbc->limit);
return 0;
err_llb:
- if (i915_gem_stolen_allocated(fbc->compressed_llb))
+ if (i915_gem_stolen_node_allocated(fbc->compressed_llb))
i915_gem_stolen_remove_node(i915, &fbc->compressed_llb);
err:
if (i915_gem_stolen_initialized(i915))
@@ -898,9 +898,9 @@ static void __intel_fbc_cleanup_cfb(struct intel_fbc *fbc)
if (WARN_ON(intel_fbc_hw_is_active(fbc)))
return;
- if (i915_gem_stolen_allocated(fbc->compressed_llb))
+ if (i915_gem_stolen_node_allocated(fbc->compressed_llb))
i915_gem_stolen_remove_node(i915, &fbc->compressed_llb);
- if (i915_gem_stolen_allocated(fbc->compressed_fb))
+ if (i915_gem_stolen_node_allocated(fbc->compressed_fb))
i915_gem_stolen_remove_node(i915, &fbc->compressed_fb);
}
@@ -1109,7 +1109,7 @@ static bool intel_fbc_is_cfb_ok(const struct intel_plane_state *plane_state)
return intel_fbc_min_limit(plane_state) <= fbc->limit &&
intel_fbc_cfb_size(plane_state) <= fbc->limit *
- i915_gem_stolen_compressed_size(fbc->compressed_fb);
+ i915_gem_stolen_node_size(fbc->compressed_fb);
}
static bool intel_fbc_is_ok(const struct intel_plane_state *plane_state)
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Intel-xe] [PATCH 2/9] drivers/xe: Add new type for compressed fb
2023-05-30 10:34 [Intel-xe] [PATCH 0/9] Clean-up Xe FBC additions Jouni Högander
2023-05-30 10:34 ` [Intel-xe] [PATCH 1/9] fixup! drm/i915/display: Implement FBC support Jouni Högander
@ 2023-05-30 10:34 ` Jouni Högander
2023-05-30 10:34 ` [Intel-xe] [PATCH 3/9] drm/i915/fbc: Add common type for compressed fb to avoid ifdefs Jouni Högander
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Jouni Högander @ 2023-05-30 10:34 UTC (permalink / raw)
To: intel-xe; +Cc: Jouni Högander
We want to remove details of stolen memory handling from intel_fbc
code. Add new type for compressed fb which will be the only common thing
with i915 and Xe stolen memory handling.
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h | 1 +
.../gpu/drm/xe/compat-i915-headers/i915_gem_stolen.h | 10 ++++++++++
2 files changed, 11 insertions(+)
create mode 100644 drivers/gpu/drm/xe/compat-i915-headers/i915_gem_stolen.h
diff --git a/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h b/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h
index 74e6f063f741..89c718de0eab 100644
--- a/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h
+++ b/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h
@@ -14,6 +14,7 @@
#include "xe_bo.h"
#include "xe_pm.h"
#include "xe_step.h"
+#include "i915_gem_stolen.h"
#include "i915_reg_defs.h"
#include "intel_pch.h"
#include "i915_utils.h"
diff --git a/drivers/gpu/drm/xe/compat-i915-headers/i915_gem_stolen.h b/drivers/gpu/drm/xe/compat-i915-headers/i915_gem_stolen.h
new file mode 100644
index 000000000000..b6eeeba1087b
--- /dev/null
+++ b/drivers/gpu/drm/xe/compat-i915-headers/i915_gem_stolen.h
@@ -0,0 +1,10 @@
+#ifndef _I915_GEM_OBJECT_H_
+#define _I915_GEM_OBJECT_H_
+
+struct xe_bo;
+
+struct i915_stolen_fb {
+ struct xe_bo *bo;
+};
+
+#endif
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Intel-xe] [PATCH 3/9] drm/i915/fbc: Add common type for compressed fb to avoid ifdefs
2023-05-30 10:34 [Intel-xe] [PATCH 0/9] Clean-up Xe FBC additions Jouni Högander
2023-05-30 10:34 ` [Intel-xe] [PATCH 1/9] fixup! drm/i915/display: Implement FBC support Jouni Högander
2023-05-30 10:34 ` [Intel-xe] [PATCH 2/9] drivers/xe: Add new type for compressed fb Jouni Högander
@ 2023-05-30 10:34 ` Jouni Högander
2023-05-30 10:34 ` [Intel-xe] [PATCH 4/9] drm/xe: Add i915_gem.h compatibility header Jouni Högander
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Jouni Högander @ 2023-05-30 10:34 UTC (permalink / raw)
To: intel-xe; +Cc: Jouni Högander
Ass a preparation for Xe add a common type for fbc compressed fb and use it
from fbc code instead of underlying type directly. This way we can have
common type i915_stolen_fb which can be used for both i915 and Xe and we
can remove related ifdefs.
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
drivers/gpu/drm/i915/display/intel_fbc.c | 61 ++++++++++++----------
drivers/gpu/drm/i915/gem/i915_gem_stolen.h | 2 +
2 files changed, 35 insertions(+), 28 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c
index 913db2ea5650..90c48ccce1a7 100644
--- a/drivers/gpu/drm/i915/display/intel_fbc.c
+++ b/drivers/gpu/drm/i915/display/intel_fbc.c
@@ -58,62 +58,71 @@
#define i915_gem_stolen_initialized(i915) (drm_mm_initialized(&(i915)->mm.stolen))
#define i915_gem_stolen_node_allocated(node) drm_mm_node_allocated(&(node))
-#define i915_gem_stolen_node_offset(node) ((node).start)
-#define i915_gem_stolen_node_size(node) ((node).size)
+#define i915_gem_stolen_node_offset(node) ((node)->start)
+#define i915_gem_stolen_node_size(node) ((node)->size)
#else
#include "xe_ttm_stolen_mgr.h"
#include "xe_res_cursor.h"
-static int i915_gem_stolen_insert_node_in_range(struct xe_device *xe, struct xe_bo **bo, u32 size, u32 align, u32 start, u32 end)
+static inline int i915_gem_stolen_insert_node_in_range(struct xe_device *xe,
+ struct i915_stolen_fb *fb,
+ u32 size, u32 align,
+ u32 start, u32 end)
{
+ struct xe_bo *bo;
int err;
u32 flags = XE_BO_CREATE_PINNED_BIT | XE_BO_CREATE_STOLEN_BIT;
- *bo = xe_bo_create_locked_range(xe, to_gt(xe), NULL, size, start, end,
+ bo = xe_bo_create_locked_range(xe, to_gt(xe), NULL, size, start, end,
ttm_bo_type_kernel, flags);
- if (IS_ERR(*bo)) {
- err = PTR_ERR(*bo);
- *bo = NULL;
+ if (IS_ERR(bo)) {
+ err = PTR_ERR(bo);
+ bo = NULL;
return err;
}
- err = xe_bo_pin(*bo);
- xe_bo_unlock_vm_held(*bo);
+ err = xe_bo_pin(bo);
+ xe_bo_unlock_vm_held(bo);
if (err) {
- xe_bo_put(*bo);
- *bo = NULL;
+ xe_bo_put(bo);
+ bo = NULL;
}
+ fb->bo = bo;
+
return err;
}
-static int i915_gem_stolen_insert_node(struct xe_device *xe, struct xe_bo **bo, u32 size, u32 align)
+static int i915_gem_stolen_insert_node(struct xe_device *xe,
+ struct i915_stolen_fb *fb, u32 size,
+ u32 align)
{
/* Not used on xe */
BUG_ON(1);
return -ENODEV;
}
-static void i915_gem_stolen_remove_node(struct xe_device *xe, struct xe_bo **bo)
+static void i915_gem_stolen_remove_node(struct xe_device *xe,
+ struct i915_stolen_fb *fb)
{
- xe_bo_unpin_map_no_vm(*bo);
- *bo = NULL;
+ xe_bo_unpin_map_no_vm(fb->bo);
+ fb->bo = NULL;
}
#define i915_gem_stolen_initialized(xe) (!!ttm_manager_type(&(xe)->ttm, XE_PL_STOLEN))
-#define i915_gem_stolen_node_allocated(bo) (!!(bo))
+#define i915_gem_stolen_node_allocated(fb) (!!(fb.bo))
-static u32 i915_gem_stolen_node_offset(struct xe_bo *bo)
+static inline u32 i915_gem_stolen_node_offset(struct i915_stolen_fb *fb)
{
struct xe_res_cursor res;
- xe_res_first(bo->ttm.resource, 0, 4096, &res);
+ xe_res_first(fb->bo->ttm.resource, 0, 4096, &res);
return res.start;
}
-#define i915_gem_stolen_node_size(fb) ((u64)((fb)->ttm.base.size))
+#define i915_gem_stolen_node_size(fb) ((u64)((fb)->bo->ttm.base.size))
#endif
#define for_each_fbc_id(__dev_priv, __fbc_id) \
@@ -156,11 +165,7 @@ struct intel_fbc {
struct mutex lock;
unsigned int busy_bits;
-#ifdef I915
- struct drm_mm_node compressed_fb, compressed_llb;
-#else
- struct xe_bo *compressed_fb, *compressed_llb;
-#endif
+ struct i915_stolen_fb compressed_fb, compressed_llb;
enum intel_fbc_id id;
@@ -515,7 +520,7 @@ static void g4x_fbc_program_cfb(struct intel_fbc *fbc)
struct drm_i915_private *i915 = fbc->i915;
intel_de_write(i915, DPFC_CB_BASE,
- i915_gem_stolen_node_offset(fbc->compressed_fb));
+ i915_gem_stolen_node_offset(&fbc->compressed_fb));
}
static const struct intel_fbc_funcs g4x_fbc_funcs = {
@@ -567,7 +572,7 @@ static void ilk_fbc_program_cfb(struct intel_fbc *fbc)
struct drm_i915_private *i915 = fbc->i915;
intel_de_write(i915, ILK_DPFC_CB_BASE(fbc->id),
- i915_gem_stolen_node_offset(fbc->compressed_fb));
+ i915_gem_stolen_node_offset(&fbc->compressed_fb));
}
static const struct intel_fbc_funcs ilk_fbc_funcs = {
@@ -865,7 +870,7 @@ static int intel_fbc_alloc_cfb(struct intel_fbc *fbc,
drm_dbg_kms(&i915->drm,
"reserved %llu bytes of contiguous stolen space for FBC, limit: %d\n",
- i915_gem_stolen_node_size(fbc->compressed_fb), fbc->limit);
+ i915_gem_stolen_node_size(&fbc->compressed_fb), fbc->limit);
return 0;
@@ -1109,7 +1114,7 @@ static bool intel_fbc_is_cfb_ok(const struct intel_plane_state *plane_state)
return intel_fbc_min_limit(plane_state) <= fbc->limit &&
intel_fbc_cfb_size(plane_state) <= fbc->limit *
- i915_gem_stolen_node_size(fbc->compressed_fb);
+ i915_gem_stolen_node_size(&fbc->compressed_fb);
}
static bool intel_fbc_is_ok(const struct intel_plane_state *plane_state)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_stolen.h b/drivers/gpu/drm/i915/gem/i915_gem_stolen.h
index d5005a39d130..3c084a1fcc73 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_stolen.h
+++ b/drivers/gpu/drm/i915/gem/i915_gem_stolen.h
@@ -12,6 +12,8 @@ struct drm_i915_private;
struct drm_mm_node;
struct drm_i915_gem_object;
+#define i915_stolen_fb drm_mm_node
+
int i915_gem_stolen_insert_node(struct drm_i915_private *dev_priv,
struct drm_mm_node *node, u64 size,
unsigned alignment);
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Intel-xe] [PATCH 4/9] drm/xe: Add i915_gem.h compatibility header
2023-05-30 10:34 [Intel-xe] [PATCH 0/9] Clean-up Xe FBC additions Jouni Högander
` (2 preceding siblings ...)
2023-05-30 10:34 ` [Intel-xe] [PATCH 3/9] drm/i915/fbc: Add common type for compressed fb to avoid ifdefs Jouni Högander
@ 2023-05-30 10:34 ` Jouni Högander
2023-05-30 10:34 ` [Intel-xe] [PATCH 5/9] drivers/xe: Move Xe stolen memory handling away form fbc code Jouni Högander
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Jouni Högander @ 2023-05-30 10:34 UTC (permalink / raw)
To: intel-xe; +Cc: Jouni Högander
Add i915_gem.h compatibility header and include it in i915_drv.h. Add
GEM_BUG_ON definition for fbc code.
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h | 1 +
drivers/gpu/drm/xe/compat-i915-headers/i915_gem.h | 9 +++++++++
2 files changed, 10 insertions(+)
create mode 100644 drivers/gpu/drm/xe/compat-i915-headers/i915_gem.h
diff --git a/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h b/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h
index 89c718de0eab..0ccc97fb9e90 100644
--- a/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h
+++ b/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h
@@ -14,6 +14,7 @@
#include "xe_bo.h"
#include "xe_pm.h"
#include "xe_step.h"
+#include "i915_gem.h"
#include "i915_gem_stolen.h"
#include "i915_reg_defs.h"
#include "intel_pch.h"
diff --git a/drivers/gpu/drm/xe/compat-i915-headers/i915_gem.h b/drivers/gpu/drm/xe/compat-i915-headers/i915_gem.h
new file mode 100644
index 000000000000..4f1f5e175625
--- /dev/null
+++ b/drivers/gpu/drm/xe/compat-i915-headers/i915_gem.h
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+#ifndef __I915_GEM_H__
+#define __I915_GEM_H__
+#define GEM_BUG_ON XE_BUG_ON
+#endif
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Intel-xe] [PATCH 5/9] drivers/xe: Move Xe stolen memory handling away form fbc code
2023-05-30 10:34 [Intel-xe] [PATCH 0/9] Clean-up Xe FBC additions Jouni Högander
` (3 preceding siblings ...)
2023-05-30 10:34 ` [Intel-xe] [PATCH 4/9] drm/xe: Add i915_gem.h compatibility header Jouni Högander
@ 2023-05-30 10:34 ` Jouni Högander
2023-05-30 10:34 ` [Intel-xe] [PATCH 6/9] drm/i915: Move stolen memory handling into i915_gem_stolen Jouni Högander
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Jouni Högander @ 2023-05-30 10:34 UTC (permalink / raw)
To: intel-xe; +Cc: Jouni Högander
More correct place for Xe stolen memory handling details is in
xe_ttm_stolen_mgr. Move it there and add necessary defines into
i915_gem_stolen.h to satisfy fbc code.
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
drivers/gpu/drm/i915/display/intel_fbc.c | 62 -----------------
.../xe/compat-i915-headers/i915_gem_stolen.h | 66 +++++++++++++++++++
drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c | 8 +++
drivers/gpu/drm/xe/xe_ttm_stolen_mgr.h | 1 +
4 files changed, 75 insertions(+), 62 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c
index 90c48ccce1a7..19698ab117a1 100644
--- a/drivers/gpu/drm/i915/display/intel_fbc.c
+++ b/drivers/gpu/drm/i915/display/intel_fbc.c
@@ -61,68 +61,6 @@
#define i915_gem_stolen_node_offset(node) ((node)->start)
#define i915_gem_stolen_node_size(node) ((node)->size)
-#else
-
-#include "xe_ttm_stolen_mgr.h"
-#include "xe_res_cursor.h"
-
-static inline int i915_gem_stolen_insert_node_in_range(struct xe_device *xe,
- struct i915_stolen_fb *fb,
- u32 size, u32 align,
- u32 start, u32 end)
-{
- struct xe_bo *bo;
- int err;
- u32 flags = XE_BO_CREATE_PINNED_BIT | XE_BO_CREATE_STOLEN_BIT;
-
- bo = xe_bo_create_locked_range(xe, to_gt(xe), NULL, size, start, end,
- ttm_bo_type_kernel, flags);
- if (IS_ERR(bo)) {
- err = PTR_ERR(bo);
- bo = NULL;
- return err;
- }
- err = xe_bo_pin(bo);
- xe_bo_unlock_vm_held(bo);
-
- if (err) {
- xe_bo_put(bo);
- bo = NULL;
- }
-
- fb->bo = bo;
-
- return err;
-}
-
-static int i915_gem_stolen_insert_node(struct xe_device *xe,
- struct i915_stolen_fb *fb, u32 size,
- u32 align)
-{
- /* Not used on xe */
- BUG_ON(1);
- return -ENODEV;
-}
-
-static void i915_gem_stolen_remove_node(struct xe_device *xe,
- struct i915_stolen_fb *fb)
-{
- xe_bo_unpin_map_no_vm(fb->bo);
- fb->bo = NULL;
-}
-
-#define i915_gem_stolen_initialized(xe) (!!ttm_manager_type(&(xe)->ttm, XE_PL_STOLEN))
-#define i915_gem_stolen_node_allocated(fb) (!!(fb.bo))
-
-static inline u32 i915_gem_stolen_node_offset(struct i915_stolen_fb *fb)
-{
- struct xe_res_cursor res;
-
- xe_res_first(fb->bo->ttm.resource, 0, 4096, &res);
- return res.start;
-}
-
-#define i915_gem_stolen_node_size(fb) ((u64)((fb)->bo->ttm.base.size))
#endif
#define for_each_fbc_id(__dev_priv, __fbc_id) \
diff --git a/drivers/gpu/drm/xe/compat-i915-headers/i915_gem_stolen.h b/drivers/gpu/drm/xe/compat-i915-headers/i915_gem_stolen.h
index b6eeeba1087b..a9020d408407 100644
--- a/drivers/gpu/drm/xe/compat-i915-headers/i915_gem_stolen.h
+++ b/drivers/gpu/drm/xe/compat-i915-headers/i915_gem_stolen.h
@@ -1,10 +1,76 @@
#ifndef _I915_GEM_OBJECT_H_
#define _I915_GEM_OBJECT_H_
+#include "xe_ttm_stolen_mgr.h"
+#include "xe_res_cursor.h"
+
struct xe_bo;
struct i915_stolen_fb {
struct xe_bo *bo;
};
+static inline int i915_gem_stolen_insert_node_in_range(struct xe_device *xe,
+ struct i915_stolen_fb *fb,
+ u32 size, u32 align,
+ u32 start, u32 end)
+{
+ struct xe_bo *bo;
+ int err;
+ u32 flags = XE_BO_CREATE_PINNED_BIT | XE_BO_CREATE_STOLEN_BIT;
+
+ bo = xe_bo_create_locked_range(xe, to_gt(xe), NULL, size, start, end,
+ ttm_bo_type_kernel, flags);
+ if (IS_ERR(bo)) {
+ err = PTR_ERR(bo);
+ bo = NULL;
+ return err;
+ }
+ err = xe_bo_pin(bo);
+ xe_bo_unlock_vm_held(bo);
+
+ if (err) {
+ xe_bo_put(fb->bo);
+ bo = NULL;
+ }
+
+ fb->bo = bo;
+
+ return err;
+}
+
+static inline int i915_gem_stolen_insert_node(struct xe_device *xe,
+ struct i915_stolen_fb *fb,
+ u32 size, u32 align)
+{
+ /* Not used on xe */
+ BUG_ON(1);
+ return -ENODEV;
+}
+
+static inline void i915_gem_stolen_remove_node(struct xe_device *xe,
+ struct i915_stolen_fb *fb)
+{
+ xe_bo_unpin_map_no_vm(fb->bo);
+ fb->bo = NULL;
+}
+
+#define i915_gem_stolen_initialized(xe) (!!ttm_manager_type(&(xe)->ttm, XE_PL_STOLEN))
+#define i915_gem_stolen_node_allocated(fb) (!!(fb.bo))
+
+static inline u32 i915_gem_stolen_node_offset(struct i915_stolen_fb *fb)
+{
+ struct xe_res_cursor res;
+
+ xe_res_first(fb->bo->ttm.resource, 0, 4096, &res);
+ return res.start;
+}
+
+#define i915_gem_stolen_area_address(xe) (xe_ttm_stolen_gpu_offset(xe))
+#define i915_gem_stolen_area_size(xe) (xe_ttm_stolen_size(xe))
+
+#define i915_gem_stolen_node_address(xe, fb) (xe_ttm_stolen_gpu_offset(xe) + \
+ i915_gem_stolen_node_offset(fb))
+#define i915_gem_stolen_node_size(fb) ((u64)((fb)->bo->ttm.base.size))
+
#endif
diff --git a/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c b/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c
index a3855870321f..2df059dd803b 100644
--- a/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c
+++ b/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c
@@ -265,3 +265,11 @@ u64 xe_ttm_stolen_gpu_offset(struct xe_device *xe)
return mgr->stolen_base;
}
+
+u64 xe_ttm_stolen_size(struct xe_device *xe)
+{
+ struct xe_ttm_stolen_mgr *mgr =
+ to_stolen_mgr(ttm_manager_type(&xe->ttm, XE_PL_STOLEN));
+
+ return mgr->base.visible_size;
+}
diff --git a/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.h b/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.h
index 1777245ff810..48fed9a1ef95 100644
--- a/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.h
+++ b/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.h
@@ -17,5 +17,6 @@ int xe_ttm_stolen_io_mem_reserve(struct xe_device *xe, struct ttm_resource *mem)
bool xe_ttm_stolen_cpu_access_needs_ggtt(struct xe_device *xe);
u64 xe_ttm_stolen_io_offset(struct xe_bo *bo, u32 offset);
u64 xe_ttm_stolen_gpu_offset(struct xe_device *xe);
+u64 xe_ttm_stolen_size(struct xe_device *xe);
#endif
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Intel-xe] [PATCH 6/9] drm/i915: Move stolen memory handling into i915_gem_stolen
2023-05-30 10:34 [Intel-xe] [PATCH 0/9] Clean-up Xe FBC additions Jouni Högander
` (4 preceding siblings ...)
2023-05-30 10:34 ` [Intel-xe] [PATCH 5/9] drivers/xe: Move Xe stolen memory handling away form fbc code Jouni Högander
@ 2023-05-30 10:34 ` Jouni Högander
2023-05-30 10:34 ` [Intel-xe] [PATCH 7/9] drm/i915/fbc: Stolen initialize can be checked in plane check for i915 as well Jouni Högander
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Jouni Högander @ 2023-05-30 10:34 UTC (permalink / raw)
To: intel-xe; +Cc: Jouni Högander
We are preparing for Xe. As Xe stolen memory handling differs from i915 we
want to move stolen memory handling details into i915_gem_stolen.
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
drivers/gpu/drm/i915/display/intel_fbc.c | 40 ++++++++--------------
drivers/gpu/drm/i915/gem/i915_gem_stolen.c | 37 ++++++++++++++++++++
drivers/gpu/drm/i915/gem/i915_gem_stolen.h | 11 ++++++
3 files changed, 62 insertions(+), 26 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c
index 19698ab117a1..b6fc993e6caf 100644
--- a/drivers/gpu/drm/i915/display/intel_fbc.c
+++ b/drivers/gpu/drm/i915/display/intel_fbc.c
@@ -54,15 +54,6 @@
#include "intel_fbc.h"
#include "intel_frontbuffer.h"
-#ifdef I915
-
-#define i915_gem_stolen_initialized(i915) (drm_mm_initialized(&(i915)->mm.stolen))
-#define i915_gem_stolen_node_allocated(node) drm_mm_node_allocated(&(node))
-#define i915_gem_stolen_node_offset(node) ((node)->start)
-#define i915_gem_stolen_node_size(node) ((node)->size)
-
-#endif
-
#define for_each_fbc_id(__dev_priv, __fbc_id) \
for ((__fbc_id) = INTEL_FBC_A; (__fbc_id) < I915_MAX_FBCS; (__fbc_id)++) \
for_each_if(RUNTIME_INFO(__dev_priv)->fbc_mask & BIT(__fbc_id))
@@ -338,19 +329,18 @@ static void i8xx_fbc_nuke(struct intel_fbc *fbc)
static void i8xx_fbc_program_cfb(struct intel_fbc *fbc)
{
-#ifdef I915
struct drm_i915_private *i915 = fbc->i915;
- GEM_BUG_ON(range_overflows_end_t(u64, i915->dsm.stolen.start,
- fbc->compressed_fb.start, U32_MAX));
- GEM_BUG_ON(range_overflows_end_t(u64, i915->dsm.stolen.start,
- fbc->compressed_llb.start, U32_MAX));
-
+ GEM_BUG_ON(range_overflows_end_t(u64, i915_gem_stolen_area_address(i915),
+ i915_gem_stolen_node_offset(&fbc->compressed_fb),
+ U32_MAX));
+ GEM_BUG_ON(range_overflows_end_t(u64, i915_gem_stolen_area_address(i915),
+ i915_gem_stolen_node_offset(&fbc->compressed_llb),
+ U32_MAX));
intel_de_write(i915, FBC_CFB_BASE,
- i915->dsm.stolen.start + fbc->compressed_fb.start);
+ i915_gem_stolen_node_address(i915, &fbc->compressed_fb));
intel_de_write(i915, FBC_LL_BASE,
- i915->dsm.stolen.start + fbc->compressed_llb.start);
-#endif
+ i915_gem_stolen_node_address(i915, &fbc->compressed_llb));
}
static const struct intel_fbc_funcs i8xx_fbc_funcs = {
@@ -725,12 +715,10 @@ static u64 intel_fbc_stolen_end(struct drm_i915_private *i915)
* reserved range size, so it always assumes the maximum (8mb) is used.
* If we enable FBC using a CFB on that memory range we'll get FIFO
* underruns, even if that range is not reserved by the BIOS. */
-#ifdef I915
if (IS_BROADWELL(i915) ||
(DISPLAY_VER(i915) == 9 && !IS_BROXTON(i915)))
- end = resource_size(&i915->dsm.stolen) - 8 * 1024 * 1024;
+ end = i915_gem_stolen_area_size(i915) - 8 * 1024 * 1024;
else
-#endif
end = U64_MAX;
return min(end, intel_fbc_cfb_base_max(i915));
@@ -786,9 +774,9 @@ static int intel_fbc_alloc_cfb(struct intel_fbc *fbc,
int ret;
drm_WARN_ON(&i915->drm,
- i915_gem_stolen_node_allocated(fbc->compressed_fb));
+ i915_gem_stolen_node_allocated(&fbc->compressed_fb));
drm_WARN_ON(&i915->drm,
- i915_gem_stolen_node_allocated(fbc->compressed_llb));
+ i915_gem_stolen_node_allocated(&fbc->compressed_llb));
if (DISPLAY_VER(i915) < 5 && !IS_G4X(i915)) {
ret = i915_gem_stolen_insert_node(i915, &fbc->compressed_llb,
@@ -813,7 +801,7 @@ static int intel_fbc_alloc_cfb(struct intel_fbc *fbc,
return 0;
err_llb:
- if (i915_gem_stolen_node_allocated(fbc->compressed_llb))
+ if (i915_gem_stolen_node_allocated(&fbc->compressed_llb))
i915_gem_stolen_remove_node(i915, &fbc->compressed_llb);
err:
if (i915_gem_stolen_initialized(i915))
@@ -841,9 +829,9 @@ static void __intel_fbc_cleanup_cfb(struct intel_fbc *fbc)
if (WARN_ON(intel_fbc_hw_is_active(fbc)))
return;
- if (i915_gem_stolen_node_allocated(fbc->compressed_llb))
+ if (i915_gem_stolen_node_allocated(&fbc->compressed_llb))
i915_gem_stolen_remove_node(i915, &fbc->compressed_llb);
- if (i915_gem_stolen_node_allocated(fbc->compressed_fb))
+ if (i915_gem_stolen_node_allocated(&fbc->compressed_fb))
i915_gem_stolen_remove_node(i915, &fbc->compressed_fb);
}
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
index ee492d823f1b..04cc6958cddf 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
@@ -972,3 +972,40 @@ bool i915_gem_object_is_stolen(const struct drm_i915_gem_object *obj)
{
return obj->ops == &i915_gem_object_stolen_ops;
}
+
+bool i915_gem_stolen_initialized(const struct drm_i915_private *i915)
+{
+ return drm_mm_initialized(&i915->mm.stolen);
+}
+
+u64 i915_gem_stolen_area_address(const struct drm_i915_private *i915)
+{
+ return i915->dsm.stolen.start;
+}
+
+u64 i915_gem_stolen_area_size(const struct drm_i915_private *i915)
+{
+ return resource_size(&i915->dsm.stolen);
+}
+
+u64 i915_gem_stolen_node_address(const struct drm_i915_private *i915,
+ const struct drm_mm_node *node)
+{
+ return i915->dsm.stolen.start + i915_gem_stolen_node_offset(node);
+}
+
+
+bool i915_gem_stolen_node_allocated(const struct drm_mm_node *node)
+{
+ return drm_mm_node_allocated(node);
+}
+
+u64 i915_gem_stolen_node_offset(const struct drm_mm_node *node)
+{
+ return node->start;
+}
+
+u64 i915_gem_stolen_node_size(const struct drm_mm_node *node)
+{
+ return node->size;
+}
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_stolen.h b/drivers/gpu/drm/i915/gem/i915_gem_stolen.h
index 3c084a1fcc73..ccebd24d65a9 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_stolen.h
+++ b/drivers/gpu/drm/i915/gem/i915_gem_stolen.h
@@ -38,4 +38,15 @@ bool i915_gem_object_is_stolen(const struct drm_i915_gem_object *obj);
#define I915_GEM_STOLEN_BIAS SZ_128K
+bool i915_gem_stolen_initialized(const struct drm_i915_private *i915);
+u64 i915_gem_stolen_area_address(const struct drm_i915_private *i915);
+u64 i915_gem_stolen_area_size(const struct drm_i915_private *i915);
+
+u64 i915_gem_stolen_node_address(const struct drm_i915_private *i915,
+ const struct drm_mm_node *node);
+
+bool i915_gem_stolen_node_allocated(const struct drm_mm_node *node);
+u64 i915_gem_stolen_node_offset(const struct drm_mm_node *node);
+u64 i915_gem_stolen_node_size(const struct drm_mm_node *node);
+
#endif /* __I915_GEM_STOLEN_H__ */
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Intel-xe] [PATCH 7/9] drm/i915/fbc: Stolen initialize can be checked in plane check for i915 as well
2023-05-30 10:34 [Intel-xe] [PATCH 0/9] Clean-up Xe FBC additions Jouni Högander
` (5 preceding siblings ...)
2023-05-30 10:34 ` [Intel-xe] [PATCH 6/9] drm/i915: Move stolen memory handling into i915_gem_stolen Jouni Högander
@ 2023-05-30 10:34 ` Jouni Högander
2023-05-30 10:34 ` [Intel-xe] [PATCH 8/9] drm/i915/fbc: Add function to get number of fences for gt Jouni Högander
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Jouni Högander @ 2023-05-30 10:34 UTC (permalink / raw)
To: intel-xe; +Cc: Jouni Högander
There is no specific reason to differentiate i915 and Xe in stolen are
initialization status. We can check it in plane check for i915 as well.
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
drivers/gpu/drm/i915/display/intel_fbc.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c
index b6fc993e6caf..109f86bb19ef 100644
--- a/drivers/gpu/drm/i915/display/intel_fbc.c
+++ b/drivers/gpu/drm/i915/display/intel_fbc.c
@@ -1064,12 +1064,10 @@ static int intel_fbc_check_plane(struct intel_atomic_state *state,
if (!fbc)
return 0;
-#ifndef I915
if (!i915_gem_stolen_initialized(i915)) {
plane_state->no_fbc_reason = "stolen memory not initialised";
return 0;
}
-#endif
if (intel_vgpu_active(i915)) {
plane_state->no_fbc_reason = "VGPU active";
@@ -1724,11 +1722,6 @@ void intel_fbc_init(struct drm_i915_private *i915)
{
enum intel_fbc_id fbc_id;
-#ifdef I915
- if (!i915_gem_stolen_initialized(i915))
- RUNTIME_INFO(i915)->fbc_mask = 0;
-#endif
-
if (need_fbc_vtd_wa(i915))
RUNTIME_INFO(i915)->fbc_mask = 0;
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Intel-xe] [PATCH 8/9] drm/i915/fbc: Add function to get number of fences for gt
2023-05-30 10:34 [Intel-xe] [PATCH 0/9] Clean-up Xe FBC additions Jouni Högander
` (6 preceding siblings ...)
2023-05-30 10:34 ` [Intel-xe] [PATCH 7/9] drm/i915/fbc: Stolen initialize can be checked in plane check for i915 as well Jouni Högander
@ 2023-05-30 10:34 ` Jouni Högander
2023-05-30 10:34 ` [Intel-xe] [PATCH 9/9] Add new fence_id and fence count functions Jouni Högander
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Jouni Högander @ 2023-05-30 10:34 UTC (permalink / raw)
To: intel-xe; +Cc: Jouni Högander
Add new function to get number of fences for gt. This allows removing
couple of ifdefs.
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
drivers/gpu/drm/i915/display/intel_fbc.c | 4 +---
drivers/gpu/drm/i915/gt/intel_gt_types.h | 2 ++
drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h | 3 +++
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c
index 109f86bb19ef..2cb537504c2f 100644
--- a/drivers/gpu/drm/i915/display/intel_fbc.c
+++ b/drivers/gpu/drm/i915/display/intel_fbc.c
@@ -607,10 +607,8 @@ static void ivb_fbc_activate(struct intel_fbc *fbc)
else if (DISPLAY_VER(i915) == 9)
skl_fbc_program_cfb_stride(fbc);
-#ifdef I915
- if (to_gt(i915)->ggtt->num_fences)
+ if (intel_gt_fence_count(to_gt(i915)))
snb_fbc_program_fence(fbc);
-#endif
intel_de_write(i915, ILK_DPFC_CONTROL(fbc->id),
DPFC_CTL_EN | ivb_dpfc_ctl(fbc));
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_types.h b/drivers/gpu/drm/i915/gt/intel_gt_types.h
index f08c2556aa25..76bc88d974b2 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_types.h
+++ b/drivers/gpu/drm/i915/gt/intel_gt_types.h
@@ -306,4 +306,6 @@ enum intel_gt_scratch_field {
INTEL_GT_SCRATCH_FIELD_COHERENTL3_WA = 256,
};
+#define intel_gt_fence_count(gt) gt->ggtt->num_fences
+
#endif /* __INTEL_GT_TYPES_H__ */
diff --git a/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h b/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h
index 0ccc97fb9e90..89ff4e984e6b 100644
--- a/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h
+++ b/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h
@@ -19,9 +19,12 @@
#include "i915_reg_defs.h"
#include "intel_pch.h"
#include "i915_utils.h"
+#include "intel_gt_types.h"
#include "intel_uncore.h"
#include <linux/pm_runtime.h>
+#define intel_gt_fence_count(gt) 0
+
static inline struct drm_i915_private *to_i915(const struct drm_device *dev)
{
return container_of(dev, struct drm_i915_private, drm);
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Intel-xe] [PATCH 9/9] Add new fence_id and fence count functions
2023-05-30 10:34 [Intel-xe] [PATCH 0/9] Clean-up Xe FBC additions Jouni Högander
` (7 preceding siblings ...)
2023-05-30 10:34 ` [Intel-xe] [PATCH 8/9] drm/i915/fbc: Add function to get number of fences for gt Jouni Högander
@ 2023-05-30 10:34 ` Jouni Högander
2023-05-30 10:37 ` [Intel-xe] ✓ CI.Patch_applied: success for Clean-up Xe FBC additions Patchwork
2023-05-30 10:38 ` [Intel-xe] ✗ CI.KUnit: failure " Patchwork
10 siblings, 0 replies; 12+ messages in thread
From: Jouni Högander @ 2023-05-30 10:34 UTC (permalink / raw)
To: intel-xe; +Cc: Jouni Högander
Add new fence id and fence count functions and use them instead of directly
accessing struct members
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
drivers/gpu/drm/i915/display/intel_fbc.c | 16 +++++-----------
drivers/gpu/drm/i915/i915_vma.h | 5 +++++
.../gpu/drm/xe/compat-i915-headers/i915_vma.h | 2 ++
3 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c
index 2cb537504c2f..7e4dcd747c02 100644
--- a/drivers/gpu/drm/i915/display/intel_fbc.c
+++ b/drivers/gpu/drm/i915/display/intel_fbc.c
@@ -47,6 +47,7 @@
#include "i915_reg.h"
#include "i915_utils.h"
#include "i915_vgpu.h"
+#include "i915_vma.h"
#include "intel_cdclk.h"
#include "intel_de.h"
#include "intel_display_trace.h"
@@ -988,17 +989,14 @@ static void intel_fbc_update_state(struct intel_atomic_state *state,
/* FBC1 compression interval: arbitrary choice of 1 second */
fbc_state->interval = drm_mode_vrefresh(&crtc_state->hw.adjusted_mode);
-#ifdef I915
fbc_state->fence_y_offset = intel_plane_fence_y_offset(plane_state);
drm_WARN_ON(&i915->drm, plane_state->flags & PLANE_HAS_FENCE &&
- !plane_state->ggtt_vma->fence);
+ !intel_gt_fence_count(to_gt(i915)));
- if (plane_state->flags & PLANE_HAS_FENCE &&
- plane_state->ggtt_vma->fence)
- fbc_state->fence_id = plane_state->ggtt_vma->fence->id;
+ if (plane_state->flags & PLANE_HAS_FENCE)
+ fbc_state->fence_id = i915_vma_fence_id(plane_state->ggtt_vma);
else
-#endif
fbc_state->fence_id = -1;
fbc_state->cfb_stride = intel_fbc_cfb_stride(plane_state);
@@ -1008,7 +1006,6 @@ static void intel_fbc_update_state(struct intel_atomic_state *state,
static bool intel_fbc_is_fence_ok(const struct intel_plane_state *plane_state)
{
-#ifdef I915
struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev);
/*
@@ -1025,10 +1022,7 @@ static bool intel_fbc_is_fence_ok(const struct intel_plane_state *plane_state)
*/
return DISPLAY_VER(i915) >= 9 ||
(plane_state->flags & PLANE_HAS_FENCE &&
- plane_state->ggtt_vma->fence);
-#else
- return true;
-#endif
+ i915_vma_fence_id(plane_state->ggtt_vma) != -1);
}
static bool intel_fbc_is_cfb_ok(const struct intel_plane_state *plane_state)
diff --git a/drivers/gpu/drm/i915/i915_vma.h b/drivers/gpu/drm/i915/i915_vma.h
index ed5c9d682a1b..06e613752c55 100644
--- a/drivers/gpu/drm/i915/i915_vma.h
+++ b/drivers/gpu/drm/i915/i915_vma.h
@@ -418,6 +418,11 @@ i915_vma_unpin_fence(struct i915_vma *vma)
__i915_vma_unpin_fence(vma);
}
+static inline int i915_vma_fence_id(const struct i915_vma *vma)
+{
+ return vma->fence ? vma->fence->id : -1;
+}
+
void i915_vma_parked(struct intel_gt *gt);
static inline bool i915_vma_is_scanout(const struct i915_vma *vma)
diff --git a/drivers/gpu/drm/xe/compat-i915-headers/i915_vma.h b/drivers/gpu/drm/xe/compat-i915-headers/i915_vma.h
index c40bb27ac72a..45ea0e44073d 100644
--- a/drivers/gpu/drm/xe/compat-i915-headers/i915_vma.h
+++ b/drivers/gpu/drm/xe/compat-i915-headers/i915_vma.h
@@ -11,4 +11,6 @@ struct i915_vma {
struct drm_mm_node node;
};
+#define i915_vma_fence_id(vma) -1
+
#endif
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Intel-xe] ✓ CI.Patch_applied: success for Clean-up Xe FBC additions
2023-05-30 10:34 [Intel-xe] [PATCH 0/9] Clean-up Xe FBC additions Jouni Högander
` (8 preceding siblings ...)
2023-05-30 10:34 ` [Intel-xe] [PATCH 9/9] Add new fence_id and fence count functions Jouni Högander
@ 2023-05-30 10:37 ` Patchwork
2023-05-30 10:38 ` [Intel-xe] ✗ CI.KUnit: failure " Patchwork
10 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2023-05-30 10:37 UTC (permalink / raw)
To: Jouni Högander; +Cc: intel-xe
== Series Details ==
Series: Clean-up Xe FBC additions
URL : https://patchwork.freedesktop.org/series/118560/
State : success
== Summary ==
=== Applying kernel patches on branch 'drm-xe-next' with base: ===
Base commit: d57bb4c83 fixup! drm/xe: Introduce a new DRM driver for Intel GPUs
=== git am output follows ===
Applying: fixup! drm/i915/display: Implement FBC support
Applying: drivers/xe: Add new type for compressed fb
Applying: drm/i915/fbc: Add common type for compressed fb to avoid ifdefs
Applying: drm/xe: Add i915_gem.h compatibility header
Applying: drivers/xe: Move Xe stolen memory handling away form fbc code
Applying: drm/i915: Move stolen memory handling into i915_gem_stolen
Applying: drm/i915/fbc: Stolen initialize can be checked in plane check for i915 as well
Applying: drm/i915/fbc: Add function to get number of fences for gt
Applying: Add new fence_id and fence count functions
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Intel-xe] ✗ CI.KUnit: failure for Clean-up Xe FBC additions
2023-05-30 10:34 [Intel-xe] [PATCH 0/9] Clean-up Xe FBC additions Jouni Högander
` (9 preceding siblings ...)
2023-05-30 10:37 ` [Intel-xe] ✓ CI.Patch_applied: success for Clean-up Xe FBC additions Patchwork
@ 2023-05-30 10:38 ` Patchwork
10 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2023-05-30 10:38 UTC (permalink / raw)
To: Jouni Högander; +Cc: intel-xe
== Series Details ==
Series: Clean-up Xe FBC additions
URL : https://patchwork.freedesktop.org/series/118560/
State : failure
== Summary ==
+ trap cleanup EXIT
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/xe/.kunitconfig
ERROR:root:In file included from ../drivers/gpu/drm/xe/display/xe_fb_pin.c:6:
../drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h:22:10: fatal error: intel_gt_types.h: No such file or directory
22 | #include "intel_gt_types.h"
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
make[6]: *** [../scripts/Makefile.build:252: drivers/gpu/drm/xe/display/xe_fb_pin.o] Error 1
make[6]: *** Waiting for unfinished jobs....
In file included from ../drivers/gpu/drm/i915/display/intel_hdcp_gsc.h:11,
from ../drivers/gpu/drm/xe/display/xe_hdcp_gsc.c:6:
../drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h:22:10: fatal error: intel_gt_types.h: No such file or directory
22 | #include "intel_gt_types.h"
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
make[6]: *** [../scripts/Makefile.build:252: drivers/gpu/drm/xe/display/xe_hdcp_gsc.o] Error 1
In file included from ../drivers/gpu/drm/xe/display/xe_plane_initial.c:11:
../drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h:22:10: fatal error: intel_gt_types.h: No such file or directory
22 | #include "intel_gt_types.h"
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
make[6]: *** [../scripts/Makefile.build:252: drivers/gpu/drm/xe/display/xe_plane_initial.o] Error 1
In file included from ../drivers/gpu/drm/xe/display/ext/i915_irq.c:37:
../drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h:22:10: fatal error: intel_gt_types.h: No such file or directory
22 | #include "intel_gt_types.h"
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
make[6]: *** [../scripts/Makefile.build:252: drivers/gpu/drm/xe/display/ext/i915_irq.o] Error 1
In file included from ../drivers/gpu/drm/i915/display/intel_de.h:9,
from ../drivers/gpu/drm/xe/display/ext/intel_device_info.c:26:
../drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h:22:10: fatal error: intel_gt_types.h: No such file or directory
22 | #include "intel_gt_types.h"
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from ../drivers/gpu/drm/i915/display/intel_de.h:9,
from ../drivers/gpu/drm/xe/display/ext/intel_clock_gating.c:28:
../drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h:22:10: fatal error: intel_gt_types.h: No such file or directory
22 | #include "intel_gt_types.h"
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
make[6]: *** [../scripts/Makefile.build:252: drivers/gpu/drm/xe/display/ext/intel_device_info.o] Error 1
make[6]: *** [../scripts/Makefile.build:252: drivers/gpu/drm/xe/display/ext/intel_clock_gating.o] Error 1
In file included from ../drivers/gpu/drm/xe/display/ext/intel_dram.c:8:
../drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h:22:10: fatal error: intel_gt_types.h: No such file or directory
22 | #include "intel_gt_types.h"
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
make[6]: *** [../scripts/Makefile.build:252: drivers/gpu/drm/xe/display/ext/intel_dram.o] Error 1
In file included from ../drivers/gpu/drm/xe/display/ext/intel_pch.c:6:
../drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h:22:10: fatal error: intel_gt_types.h: No such file or directory
22 | #include "intel_gt_types.h"
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
make[6]: *** [../scripts/Makefile.build:252: drivers/gpu/drm/xe/display/ext/intel_pch.o] Error 1
make[5]: *** [../scripts/Makefile.build:494: drivers/gpu/drm/xe] Error 2
make[5]: *** Waiting for unfinished jobs....
make[4]: *** [../scripts/Makefile.build:494: drivers/gpu/drm] Error 2
make[3]: *** [../scripts/Makefile.build:494: drivers/gpu] Error 2
make[2]: *** [../scripts/Makefile.build:494: drivers] Error 2
make[1]: *** [/kernel/Makefile:2025: .] Error 2
make: *** [Makefile:226: __sub-make] Error 2
[10:38:07] Configuring KUnit Kernel ...
Generating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
[10:38:11] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make ARCH=um O=.kunit --jobs=48
+ cleanup
++ stat -c %u:%g /kernel
+ chown -R 1003:1003 /kernel
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2023-05-30 10:38 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-30 10:34 [Intel-xe] [PATCH 0/9] Clean-up Xe FBC additions Jouni Högander
2023-05-30 10:34 ` [Intel-xe] [PATCH 1/9] fixup! drm/i915/display: Implement FBC support Jouni Högander
2023-05-30 10:34 ` [Intel-xe] [PATCH 2/9] drivers/xe: Add new type for compressed fb Jouni Högander
2023-05-30 10:34 ` [Intel-xe] [PATCH 3/9] drm/i915/fbc: Add common type for compressed fb to avoid ifdefs Jouni Högander
2023-05-30 10:34 ` [Intel-xe] [PATCH 4/9] drm/xe: Add i915_gem.h compatibility header Jouni Högander
2023-05-30 10:34 ` [Intel-xe] [PATCH 5/9] drivers/xe: Move Xe stolen memory handling away form fbc code Jouni Högander
2023-05-30 10:34 ` [Intel-xe] [PATCH 6/9] drm/i915: Move stolen memory handling into i915_gem_stolen Jouni Högander
2023-05-30 10:34 ` [Intel-xe] [PATCH 7/9] drm/i915/fbc: Stolen initialize can be checked in plane check for i915 as well Jouni Högander
2023-05-30 10:34 ` [Intel-xe] [PATCH 8/9] drm/i915/fbc: Add function to get number of fences for gt Jouni Högander
2023-05-30 10:34 ` [Intel-xe] [PATCH 9/9] Add new fence_id and fence count functions Jouni Högander
2023-05-30 10:37 ` [Intel-xe] ✓ CI.Patch_applied: success for Clean-up Xe FBC additions Patchwork
2023-05-30 10:38 ` [Intel-xe] ✗ CI.KUnit: failure " Patchwork
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.