Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] lib/intel_batchbuffer: Use safe alignment in fast-copy raw
@ 2022-02-21  8:41 Zbigniew Kempczyński
  2022-02-21  9:28 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Zbigniew Kempczyński @ 2022-02-21  8:41 UTC (permalink / raw)
  To: igt-dev; +Cc: Lucas De Marchi

On discrete new class of problems with softpinning is encountered.
Size of created object can be larger than requested so passing
such requested size to allocator will result of object overlapping.
Additionally objects alignment can vary regarding region placement.

This change is not perfect (it is not aware of object size), but
it places blitting objects with safe alignment. As blitcopy() uses
separate context for blit it won't overlap other objects.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
---
 lib/intel_batchbuffer.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index e5666cd4f..23055855b 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -990,13 +990,14 @@ void igt_blitter_fast_copy__raw(int fd,
 	uint32_t dword0, dword1;
 	uint32_t src_pitch, dst_pitch;
 	uint64_t batch_offset, src_offset, dst_offset;
+	uint64_t align = gem_detect_safe_alignment(fd);
 	int i = 0;
 
 	batch_handle = gem_create(fd, 4096);
 	if (ahnd) {
-		src_offset = get_offset(ahnd, src_handle, src_size, 0);
-		dst_offset = get_offset(ahnd, dst_handle, dst_size, 0);
-		batch_offset = get_offset(ahnd, batch_handle, 4096, 0);
+		src_offset = get_offset(ahnd, src_handle, src_size, align);
+		dst_offset = get_offset(ahnd, dst_handle, dst_size, align);
+		batch_offset = get_offset(ahnd, batch_handle, 4096, align);
 	} else {
 		src_offset = 16 << 20;
 		dst_offset = ALIGN(src_offset + src_size, 1 << 20);
-- 
2.32.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-02-23 10:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-21  8:41 [igt-dev] [PATCH i-g-t] lib/intel_batchbuffer: Use safe alignment in fast-copy raw Zbigniew Kempczyński
2022-02-21  9:28 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2022-02-21 10:26 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2022-02-22 21:33 ` [igt-dev] [PATCH i-g-t] " Dixit, Ashutosh
2022-02-23 10:34   ` Zbigniew Kempczyński

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox