Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: intel-xe@lists.freedesktop.org
Subject: [Intel-xe] [PATCH v2 1/6] drm/xe: add XE_BO_CREATE_VRAM_MASK
Date: Thu, 23 Mar 2023 11:59:21 +0000	[thread overview]
Message-ID: <20230323115926.391900-2-matthew.auld@intel.com> (raw)
In-Reply-To: <20230323115926.391900-1-matthew.auld@intel.com>

So we don't have to keep repeating VRAM0 | VRAM1. Also if there are ever
more instances, then we have less places to update.

Suggested-by: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
---
 drivers/gpu/drm/xe/xe_bo.c | 8 +++-----
 drivers/gpu/drm/xe/xe_bo.h | 2 ++
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
index ab9cd9286f77..af4200aa949f 100644
--- a/drivers/gpu/drm/xe/xe_bo.c
+++ b/drivers/gpu/drm/xe/xe_bo.c
@@ -987,8 +987,7 @@ struct xe_bo *__xe_bo_create_locked(struct xe_device *xe, struct xe_bo *bo,
 	}
 
 	bo->requested_size = size;
-	if (flags & (XE_BO_CREATE_VRAM0_BIT | XE_BO_CREATE_VRAM1_BIT |
-		     XE_BO_CREATE_STOLEN_BIT) &&
+	if (flags & (XE_BO_CREATE_VRAM_MASK | XE_BO_CREATE_STOLEN_BIT) &&
 	    !(flags & XE_BO_CREATE_IGNORE_MIN_PAGE_SIZE_BIT) &&
 	    xe->info.vram_flags & XE_VRAM_FLAGS_NEED64K) {
 		size = ALIGN(size, SZ_64K);
@@ -1052,8 +1051,7 @@ static int __xe_bo_fixed_placement(struct xe_device *xe,
 	place->fpfn = start >> PAGE_SHIFT;
 	place->lpfn = end >> PAGE_SHIFT;
 
-	switch (flags & (XE_BO_CREATE_STOLEN_BIT |
-		XE_BO_CREATE_VRAM0_BIT |XE_BO_CREATE_VRAM1_BIT)) {
+	switch (flags & (XE_BO_CREATE_STOLEN_BIT | XE_BO_CREATE_VRAM_MASK)) {
 	case XE_BO_CREATE_VRAM0_BIT:
 		place->mem_type = XE_PL_VRAM0;
 		break;
@@ -1759,7 +1757,7 @@ bool xe_bo_needs_ccs_pages(struct xe_bo *bo)
 {
 	return bo->ttm.type == ttm_bo_type_device &&
 		!(bo->flags & XE_BO_CREATE_SYSTEM_BIT) &&
-		(bo->flags & (XE_BO_CREATE_VRAM0_BIT | XE_BO_CREATE_VRAM1_BIT));
+		(bo->flags & XE_BO_CREATE_VRAM_MASK);
 }
 
 /**
diff --git a/drivers/gpu/drm/xe/xe_bo.h b/drivers/gpu/drm/xe/xe_bo.h
index f841e74cd417..3c3a09f47fb4 100644
--- a/drivers/gpu/drm/xe/xe_bo.h
+++ b/drivers/gpu/drm/xe/xe_bo.h
@@ -17,6 +17,8 @@
 #define XE_BO_CREATE_SYSTEM_BIT		BIT(1)
 #define XE_BO_CREATE_VRAM0_BIT		BIT(2)
 #define XE_BO_CREATE_VRAM1_BIT		BIT(3)
+#define XE_BO_CREATE_VRAM_MASK		(XE_BO_CREATE_VRAM0_BIT | \
+					 XE_BO_CREATE_VRAM1_BIT)
 /* -- */
 #define XE_BO_CREATE_STOLEN_BIT		BIT(4)
 #define XE_BO_CREATE_VRAM_IF_DGFX(gt) \
-- 
2.39.2


  reply	other threads:[~2023-03-23 12:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23 11:59 [Intel-xe] [PATCH v2 0/6] uAPI bits for small-bar Matthew Auld
2023-03-23 11:59 ` Matthew Auld [this message]
2023-03-24 15:13   ` [Intel-xe] [PATCH v2 1/6] drm/xe: add XE_BO_CREATE_VRAM_MASK Souza, Jose
2023-03-24 15:40   ` Gwan-gyeong Mun
2023-03-23 11:59 ` [Intel-xe] [PATCH v2 2/6] drm/xe/bo: refactor try_add_vram Matthew Auld
2023-03-24 15:19   ` Souza, Jose
2023-03-24 15:53   ` Gwan-gyeong Mun
2023-03-23 11:59 ` [Intel-xe] [PATCH v2 3/6] drm/xe/query: restrict system wide accounting Matthew Auld
2023-03-24 15:20   ` Souza, Jose
2023-03-24 16:52   ` Gwan-gyeong Mun
2023-03-27 10:09     ` Matthew Auld
2023-03-23 11:59 ` [Intel-xe] [PATCH v2 4/6] drm/xe/bo: support tiered vram allocation for small-bar Matthew Auld
2023-03-25 23:30   ` Gwan-gyeong Mun
2023-03-23 11:59 ` [Intel-xe] [PATCH v2 5/6] drm/xe/uapi: add the userspace bits " Matthew Auld
2023-03-24 15:22   ` Souza, Jose
2023-03-27  4:37   ` Gwan-gyeong Mun
2023-03-27 10:00     ` Matthew Auld
2023-03-27 10:04       ` Gwan-gyeong Mun
2023-03-23 11:59 ` [Intel-xe] [PATCH v2 6/6] drm/xe: fully turn on small-bar support Matthew Auld
2023-03-27  4:42   ` Gwan-gyeong Mun
2023-03-23 12:02 ` [Intel-xe] ✓ CI.Patch_applied: success for uAPI bits for small-bar (rev2) Patchwork
2023-03-23 12:03 ` [Intel-xe] ✓ CI.KUnit: " Patchwork
2023-03-23 12:07 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-03-23 12:24 ` [Intel-xe] ○ CI.BAT: info " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230323115926.391900-2-matthew.auld@intel.com \
    --to=matthew.auld@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox