From: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>,
"Juha-Pekka Heikkila" <juhapekka.heikkila@gmail.com>
Subject: [PATCH i-g-t 03/12] lib/intel_bufops: Add linear-to-none copy path
Date: Mon, 27 May 2024 09:33:36 +0200 [thread overview]
Message-ID: <20240527073345.54729-4-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20240527073345.54729-1-zbigniew.kempczynski@intel.com>
At first glance copying linear to linear (none) is not necessary
as ordinary memcpy() may be used. But adding this makes iterating
over all possible tilings much easier.
In the upcoming patch I'm going to introduce tiling detection tool
which iterates over all tilings where linear copy is also exercised.
Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
---
lib/intel_bufops.c | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/lib/intel_bufops.c b/lib/intel_bufops.c
index b4ccf4c093..30ba2547dc 100644
--- a/lib/intel_bufops.c
+++ b/lib/intel_bufops.c
@@ -292,6 +292,17 @@ static unsigned long swizzle_addr(void *ptr, uint32_t swizzle)
}
}
+static void *linear_ptr(void *ptr,
+ unsigned int x, unsigned int y,
+ unsigned int stride, unsigned int cpp)
+{
+ int pos;
+
+ pos = (stride/cpp * y + x) * cpp;
+
+ return ptr + pos;
+}
+
static void *x_ptr(void *ptr,
unsigned int x, unsigned int y,
unsigned int stride, unsigned int cpp)
@@ -418,6 +429,9 @@ static tile_fn __get_tile_fn_ptr(int tiling)
tile_fn fn = NULL;
switch (tiling) {
+ case I915_TILING_NONE:
+ fn = linear_ptr;
+ break;
case I915_TILING_X:
fn = x_ptr;
break;
@@ -598,6 +612,13 @@ static void __copy_linear_to(int fd, struct intel_buf *buf,
munmap(map, buf->surface[0].size);
}
+static void copy_linear_to_none(struct buf_ops *bops, struct intel_buf *buf,
+ uint32_t *linear)
+{
+ DEBUGFN();
+ __copy_linear_to(bops->fd, buf, linear, I915_TILING_NONE, 0);
+}
+
static void copy_linear_to_x(struct buf_ops *bops, struct intel_buf *buf,
uint32_t *linear)
{
@@ -655,6 +676,13 @@ static void __copy_to_linear(int fd, struct intel_buf *buf,
munmap(map, buf->surface[0].size);
}
+static void copy_none_to_linear(struct buf_ops *bops, struct intel_buf *buf,
+ uint32_t *linear)
+{
+ DEBUGFN();
+ __copy_to_linear(bops->fd, buf, linear, I915_TILING_NONE, 0);
+}
+
static void copy_x_to_linear(struct buf_ops *bops, struct intel_buf *buf,
uint32_t *linear)
{
@@ -1653,13 +1681,14 @@ static struct buf_ops *__buf_ops_create(int fd, bool check_idempotency)
bops->driver == INTEL_DRIVER_I915 ? "i915" : "xe");
if (bops->driver == INTEL_DRIVER_XE) {
+ bops->linear_to = copy_linear_to_none;
+ bops->to_linear = copy_none_to_linear;
bops->linear_to_x = copy_linear_to_x;
bops->x_to_linear = copy_x_to_linear;
bops->linear_to_y = copy_linear_to_y;
bops->y_to_linear = copy_y_to_linear;
bops->linear_to_tile4 = copy_linear_to_tile4;
bops->tile4_to_linear = copy_tile4_to_linear;
-
bops->linear_to_yf = NULL;
bops->yf_to_linear = NULL;
bops->linear_to_ys = NULL;
@@ -1869,6 +1898,10 @@ bool buf_ops_set_software_tiling(struct buf_ops *bops,
}
switch (tiling) {
+ case I915_TILING_NONE:
+ igt_debug("-> use SW on tiling NONE\n");
+ break;
+
case I915_TILING_X:
if (use_software_tiling) {
bool supported = buf_ops_has_tiling_support(bops, tiling);
--
2.34.1
next prev parent reply other threads:[~2024-05-27 7:34 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-27 7:33 [PATCH i-g-t 00/12] Introduce intel_tiling_detect tool Zbigniew Kempczyński
2024-05-27 7:33 ` [PATCH i-g-t 01/12] lib/intel_bufops: Fix offset returned for Tile4 Zbigniew Kempczyński
2024-06-03 7:26 ` Juha-Pekka Heikkila
2024-05-27 7:33 ` [PATCH i-g-t 02/12] lib/intel_bufops: Fix mapping/unmapping for i915 and xe Zbigniew Kempczyński
2024-06-03 7:31 ` Juha-Pekka Heikkila
2024-05-27 7:33 ` Zbigniew Kempczyński [this message]
2024-06-17 11:16 ` [PATCH i-g-t 03/12] lib/intel_bufops: Add linear-to-none copy path Juha-Pekka Heikkila
2024-05-27 7:33 ` [PATCH i-g-t 04/12] lib/intel_bufops: Add Tile4 in linear_to and to_linear helpers Zbigniew Kempczyński
2024-06-17 11:16 ` Juha-Pekka Heikkila
2024-05-27 7:33 ` [PATCH i-g-t 05/12] lib/intel_bufops: Add Yf tiling Zbigniew Kempczyński
2024-06-17 11:16 ` Juha-Pekka Heikkila
2024-05-27 7:33 ` [PATCH i-g-t 06/12] lib/intel_blt: Add Yf tiling in block-copy Zbigniew Kempczyński
2024-06-17 11:16 ` Juha-Pekka Heikkila
2024-05-27 7:33 ` [PATCH i-g-t 07/12] lib/intel_bufops: Add Ys tiling in linear_to and to_linear path Zbigniew Kempczyński
2024-06-17 11:16 ` Juha-Pekka Heikkila
2024-05-27 7:33 ` [PATCH i-g-t 08/12] lib/intel_bufops: Drop unnecessary Tile4 function assignment Zbigniew Kempczyński
2024-06-17 11:16 ` Juha-Pekka Heikkila
2024-05-27 7:33 ` [PATCH i-g-t 09/12] lib/intel_bufops: Preparation for adding software tiling for Tile64 Zbigniew Kempczyński
2024-06-17 11:17 ` Juha-Pekka Heikkila
2024-05-27 7:33 ` [PATCH i-g-t 10/12] lib/intel_bufops: Drop Tile4 swizzling Zbigniew Kempczyński
2024-06-17 11:17 ` Juha-Pekka Heikkila
2024-05-27 7:33 ` [PATCH i-g-t 11/12] lib/intel_bufops: Don't disable x and y on platforms without swizzling Zbigniew Kempczyński
2024-06-17 16:43 ` Juha-Pekka Heikkila
2024-05-27 7:33 ` [PATCH i-g-t 12/12] tools/intel_tiling_detect: Introduce tiling detection tool Zbigniew Kempczyński
2024-06-17 19:21 ` Juha-Pekka Heikkila
2024-06-18 4:51 ` Zbigniew Kempczyński
2024-06-17 19:46 ` Kamil Konieczny
2024-06-18 5:15 ` Zbigniew Kempczyński
2024-05-27 18:40 ` ✓ Fi.CI.BAT: success for Introduce intel_tiling_detect tool Patchwork
2024-05-27 18:45 ` ✓ CI.xeBAT: " Patchwork
2024-05-28 7:29 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-05-28 7:46 ` Zbigniew Kempczyński
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=20240527073345.54729-4-zbigniew.kempczynski@intel.com \
--to=zbigniew.kempczynski@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=juhapekka.heikkila@gmail.com \
/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