summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZbigniew Kempczyński <zbigniew.kempczynski@intel.com>2024-06-18 07:23:26 +0200
committerZbigniew Kempczyński <zbigniew.kempczynski@intel.com>2024-06-19 14:30:40 +0200
commite22d823eb6ed026af3475999fbb05cf097210d66 (patch)
treee04fbf10b4ecf58a3e705495c7a8e944a40ba32c /lib
parentd180e76f23960dbca124291fb7d6fc7f43a5d7b1 (diff)
lib/intel_bufops: Add linear-to-none copy path
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. Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Link: https://lore.kernel.org/r/20240618052335.152588-4-zbigniew.kempczynski@intel.com Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/intel_bufops.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/lib/intel_bufops.c b/lib/intel_bufops.c
index b4ccf4c09..30ba2547d 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);