docs: Exclude debug.xml
PATCH 1/6 docs: Exclude debug.xml
It is all just stuff used internally by the EU debugger only. Not really generally useful, expect if someone wants to write documentation for the debugger.
Which needs a lot more than just this.
--- docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml | 1 - 1 file changed, 1 deletion(-)
docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml +0 -1
@@ -15,7 +15,6 @@ <chapter> <title>Intel GPU Tools</title> - <xi:include href="xml/debug.xml"/> <xi:include href="xml/drmtest.xml"/> <xi:include href="xml/igt_core.xml"/> <xi:include href="xml/igt_debugfs.xml"/>
Signature · 1 line
1.8.5.2
PATCH 2/6 lib: remove hw context #defines
The libdrm we require nowadays has them already.
--- lib/intel_batchbuffer.h | 7 ------- 1 file changed, 7 deletions(-)
lib/intel_batchbuffer.h +0 -7
@@ -142,11 +142,4 @@ void intel_copy_bo(struct intel_batchbuffer *batch, drm_intel_bo *dst_bo, drm_intel_bo *src_bo, int width, int height); -#define I915_EXEC_CONTEXT_ID_MASK (0xffffffff) -#define i915_execbuffer2_set_context_id (eb2, context) \ - (eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK -#define i915_execbuffer2_get_context_id (eb2) \ - ((eb2).rsvd1 & I915_EXEC_CONTEXT_ID_MASK) - -#endif
Signature · 1 line
1.8.5.2
PATCH 3/6 lib/intel_batchbuffer: Remove BATCH_LOCALS
In reply to Daniel VetterTotally unused, we have frisky implicit assumptions that the batch is called batch instead.
--- lib/intel_batchbuffer.h | 4 ---- 1 file changed, 4 deletions(-)
lib/intel_batchbuffer.h +0 -4
@@ -71,10 +71,6 @@ intel_batchbuffer_require_space(struct intel_batchbuffer *batch,intel_batchbuffer_flush (batch); } -/* Here are the crusty old macros, to be removed: -*/ -#define BATCH_LOCALS -#define BEGIN_BATCH (n) do { \ intel_batchbuffer_require_space(batch, (n)*4); \ } while (0)
Signature · 1 line
1.8.5.2
PATCH 4/6 lib: api docs for intel_batchbuffer
In reply to Daniel Vetter- I didn't bother to document the BLIT batch header macros - I'm not too happy with them and they're fairly obscure.
- intel_copy_bo could use some interface love, added a FIXME comment for now.
--- lib/intel_batchbuffer.c | 119 +++++++++++++++++++++++++++++++++++++++++++++++- lib/intel_batchbuffer.h | 57 +++++++++++++++++++++++ 2 files changed, 175 insertions(+), 1 deletion(-)
lib/intel_batchbuffer.c +118 -1
@@ -39,6 +39,28 @@#include "intel_reg.h" #include <i915_drm.h> +/** +* SECTION:intel_batchbuffer +* @short_description: Batchbuffer and blitter support +* @title: intel batchbuffer +* +* This library provides some basic support for batchbuffers and using the +* blitter engine based upon libdrm. A new batchbuffer is allocated with +* intel_batchbuffer_alloc() and for simple blitter commands submitted with +* intel_batchbuffer_flush(). +* +* It also provides some convenient macros to easily emit commands into +* batchbuffers. All those macros presume that a pointer to a #intel_batchbuffer +* structure called batch is in scope. The basic macros are #BEGIN_BATCH, +* #OUT_BATCH, #OUT_RELOC and #ADVANCE_BATCH. +*/ + +/** +* intel_batchbuffer_reset: +* @batch: batchbuffer object +* +* Resets @batch by allocating a new gem buffer object as backing storage. +*/ void intel_batchbuffer_reset (struct intel_batchbuffer *batch) {
@@ -55,6 +77,16 @@ intel_batchbuffer_reset(struct intel_batchbuffer *batch) batch->ptr = batch->buffer; } +/** +* intel_batchbuffer_reset: +* @bufmgr: libdrm buffer manager +* @devid: pci device id of the drm device +* +* Allocates a new batchbuffer object. @devid must be supplied since libdrm +* doesn't expose it directly. +* +* Returns: The allocated and initialized batchbuffer object. +*/ struct intel_batchbuffer *intel_batchbuffer_alloc (drm_intel_bufmgr *bufmgr,uint32_t devid) {
@@ -67,6 +99,12 @@ intel_batchbuffer_alloc(drm_intel_bufmgr *bufmgr, uint32_t devid)return batch; } +/** +* intel_batchbuffer_reset: +* @batch: batchbuffer object +* +* Releases all resource of the batchbuffer object @batch. +*/ void intel_batchbuffer_free (struct intel_batchbuffer *batch) {
@@ -106,6 +144,13 @@ flush_on_ring_common(struct intel_batchbuffer *batch, int ring)return batch->ptr - batch->buffer; } +/** +* intel_batchbuffer_flush_on_ring: +* @batch: batchbuffer object +* @ring: execbuf ring flag +* +* Submits the batch for execution on @ring. +*/ void intel_batchbuffer_flush_on_ring (struct intel_batchbuffer *batch,int ring) {
@@ -123,6 +168,14 @@ intel_batchbuffer_flush_on_ring(struct intel_batchbuffer *batch, int ring)intel_batchbuffer_reset (batch); } +/** +* intel_batchbuffer_flush_with_context: +* @batch: batchbuffer object +* @context: libdrm hardware context object +* +* Submits the batch for execution on the render engine with the supplied +* hardware context. +*/ void intel_batchbuffer_flush_with_context (struct intel_batchbuffer *batch,drm_intel_context *context)
@@ -145,6 +198,13 @@ intel_batchbuffer_flush_with_context(struct intel_batchbuffer *batch,intel_batchbuffer_reset (batch); } +/** +* intel_batchbuffer_flush: +* @batch: batchbuffer object +* +* Submits the batch for execution on the blitter engine, selecting the right +* ring depending upon the hardware platform. +*/ void intel_batchbuffer_flush (struct intel_batchbuffer *batch) {
@@ -155,7 +215,21 @@ intel_batchbuffer_flush(struct intel_batchbuffer *batch) } -/* This is the only way buffers get added to the validate list. +/** +* intel_batchbuffer_emit_reloc: +* @batch: batchbuffer object +* @buffer: relocation target libdrm buffer object +* @delta: delta value to add to @buffer's gpu address +* @read_domains: gem domain bits for the relocation +* @write_domain: gem domain bit for the relocation +* @fenced: whether this gpu access requires fences +* +* Emits both a libdrm relocation entry pointing at @buffer and the pre-computed +* DWORD of @batch's presumed gpu address plus the supplied @delta into @batch. +* +* Note that @fenced is only relevant if @buffer is actually tiled. +* +* This is the only way buffers get added to the validate list. */ void intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch,
@@ -183,6 +257,15 @@ intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch,assert (ret ==0 ); } +/** +* intel_batchbuffer_data: +* @batch: batchbuffer object +* @data: pointer to the data to write into the batchbuffer +* @bytes: number of bytes to write into the batchbuffer +* +* This transfers the given @data into the batchbuffer. Note that the length +* must be DWORD aligned, i.e. multiples of 32bits. +*/ void intel_batchbuffer_data (struct intel_batchbuffer *batch,const void *data,unsigned int bytes)
@@ -193,6 +276,24 @@ intel_batchbuffer_data(struct intel_batchbuffer *batch, batch->ptr += bytes; } +/** +* intel_blt_copy: +* @batch: batchbuffer object +* @src_bo: source libdrm buffer object +* @src_x1: source pixel x-coordination +* @src_y1: source pixel y-coordination +* @src_pitch: @src_bo's pitch in bytes +* @dst_bo: destination libdrm buffer object +* @dst_x1: source pixel x-coordination +* @dst_y1: source pixel y-coordination +* @dst_pitch: @dst_bo's pitch in bytes +* @width: width of the copied rectangle +* @height: height of the copied rectangle +* @bpp: bits per pixel +* +* This emits a 2D copy operation using blitter commands into the supplied batch +* buffer object. +*/ void intel_blt_copy(struct intel_batchbuffer *batch, drm_intel_bo *src_bo, int src_x1, int src_y1, int src_pitch,
@@ -260,6 +361,22 @@ intel_blt_copy(struct intel_batchbuffer *batch,intel_batchbuffer_flush (batch); } +/** +* intel_copy_bo: +* @batch: batchbuffer object +* @src_bo: source libdrm buffer object +* @dst_bo: destination libdrm buffer object +* @width: width of the copied area in 4-byte pixels +* @height: height of the copied area in lines +* +* This emits a copy operation using blitter commands into the supplied batch +* buffer object. A total of @width times @height bytes from the start of +* @src_bo is copied over to @dst_bo. +* +* FIXME: We need @width and @height to avoid hitting into platform specific +* of the blitter. It would be easier to just accept a size and do the math +* ourselves. +*/ void intel_copy_bo(struct intel_batchbuffer *batch, drm_intel_bo *dst_bo, drm_intel_bo *src_bo,
lib/intel_batchbuffer.h +57 -0
87 lines not on this page · raw message
Signature · 1 line
1.8.5.2
PATCH 5/6 tests/prime_nv_tests: fix copied buffer size
In reply to Daniel VetterDoesn't affect the test since we only check the first few bytes. But I want to switch the copy code to always copy entire pages around, so use the right buffer size.
--- tests/prime_nv_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/prime_nv_test.c +1 -1
@@ -336,7 +336,7 @@ static void test_i915_blt_fill_nv_read(void)igt_assert (nouveau_bo_prime_handle_ref (ndev, prime_fd, &nvbo) ==0 );close (prime_fd); -intel_copy_bo (intel_batch, test_intel_bo, src_bo,256 ,1 ); +intel_copy_bo (intel_batch, test_intel_bo, src_bo,256 ,1024 /4 );igt_assert (nouveau_bo_map (nvbo,NOUVEAU_BO_RDWR , nclient) ==0 );
Signature · 1 line
1.8.5.2
PATCH 6/6 lib: switch intel_copy_bo to directly take a size
In reply to Daniel VetterInstead of a width/height combination. Since I've been lazy with the math this now only accepts page-aligned copy operations, but that's all we need really.
--- lib/intel_batchbuffer.c | 21 +++++++++------------ lib/intel_batchbuffer.h | 2 +- tests/gem_concurrent_blit.c | 8 ++++---- tests/gem_pread_after_blit.c | 22 +++++++++++----------- tests/gem_ring_sync_copy.c | 4 ++-- tests/gem_seqno_wrap.c | 4 ++-- tests/gem_tiled_blits.c | 10 +++++----- tests/gem_tiled_fence_blits.c | 4 ++-- tests/prime_nv_test.c | 2 +- 9 files changed, 37 insertions(+), 40 deletions(-)
lib/intel_batchbuffer.c +9 -12
@@ -366,24 +366,21 @@ intel_blt_copy(struct intel_batchbuffer *batch,* @batch: batchbuffer object * @src_bo: source libdrm buffer object * @dst_bo: destination libdrm buffer object -* @width: width of the copied area in 4-byte pixels -* @height: height of the copied area in lines +* @size: size of the copy range in bytes * * This emits a copy operation using blitter commands into the supplied batch -* buffer object. A total of @width times @height bytes from the start of -* @src_bo is copied over to @dst_bo. -* -* FIXME: We need @width and @height to avoid hitting into platform specific -* of the blitter. It would be easier to just accept a size and do the math -* ourselves. +* buffer object. A total of @size bytes from the start of @src_bo is copied +* over to @dst_bo. Note that @size must be page-aligned. */ void intel_copy_bo (struct intel_batchbuffer *batch,drm_intel_bo *dst_bo,drm_intel_bo *src_bo, -int width,int height) +long int size) { +assert (size %4096 ==0 ); +intel_blt_copy (batch, - src_bo,0 ,0 , width *4 , - dst_bo,0 ,0 , width *4 , - width, height,32 ); + src_bo,0 ,0 ,4096 , + dst_bo,0 ,0 ,4096 , +4096 /4 , size/4096 ,32 ); }
lib/intel_batchbuffer.h +1 -1
@@ -193,6 +193,6 @@ intel_blt_copy(struct intel_batchbuffer *batch, int width, int height, int bpp);void intel_copy_bo (struct intel_batchbuffer *batch,drm_intel_bo *dst_bo,drm_intel_bo *src_bo, -int width,int height); +long int size);#endif
tests/gem_concurrent_blit.c +4 -4
@@ -204,7 +204,7 @@ static void do_overwrite_source(struct access_mode *mode, mode->set_bo (dst[i], i, width, height); }for (i =0 ; i < num_buffers; i++) -intel_copy_bo (batch, dst[i], src[i], width, height); +intel_copy_bo (batch, dst[i], src[i], width*height*4 );for (i = num_buffers; i--; ) mode->set_bo (src[i],0xdeadbeef , width, height);for (i =0 ; i < num_buffers; i++)
@@ -221,7 +221,7 @@ static void do_early_read(struct access_mode *mode,for (i = num_buffers; i--; ) mode->set_bo (src[i],0xdeadbeef , width, height);for (i =0 ; i < num_buffers; i++) -intel_copy_bo (batch, dst[i], src[i], width, height); +intel_copy_bo (batch, dst[i], src[i], width*height*4 );for (i = num_buffers; i--; ) mode->cmp_bo (dst[i],0xdeadbeef , width, height); }
@@ -236,9 +236,9 @@ static void do_gpu_read_after_write(struct access_mode *mode,for (i = num_buffers; i--; ) mode->set_bo (src[i],0xabcdabcd , width, height);for (i =0 ; i < num_buffers; i++) -intel_copy_bo (batch, dst[i], src[i], width, height); +intel_copy_bo (batch, dst[i], src[i], width*height*4 );for (i = num_buffers; i--; ) -intel_copy_bo (batch, dummy, dst[i], width, height); +intel_copy_bo (batch, dummy, dst[i], width*height*4 );for (i = num_buffers; i--; ) mode->cmp_bo (dst[i],0xabcdabcd , width, height); }
tests/gem_pread_after_blit.c +11 -11
@@ -138,31 +138,31 @@ static void do_test(int fd, int cache_level,do {/* First, do a full-buffer read after blitting */ -intel_copy_bo (batch, tmp[0 ], src[0 ], width, height); +intel_copy_bo (batch, tmp[0 ], src[0 ], width*height*4 );verify_large_read (tmp[0 ], start[0 ]); -intel_copy_bo (batch, tmp[0 ], src[1 ], width, height); +intel_copy_bo (batch, tmp[0 ], src[1 ], width*height*4 );verify_large_read (tmp[0 ], start[1 ]); -intel_copy_bo (batch, tmp[0 ], src[0 ], width, height); +intel_copy_bo (batch, tmp[0 ], src[0 ], width*height*4 );verify_small_read (tmp[0 ], start[0 ]); -intel_copy_bo (batch, tmp[0 ], src[1 ], width, height); +intel_copy_bo (batch, tmp[0 ], src[1 ], width*height*4 );verify_small_read (tmp[0 ], start[1 ]); -intel_copy_bo (batch, tmp[0 ], src[0 ], width, height); +intel_copy_bo (batch, tmp[0 ], src[0 ], width*height*4 );verify_large_read (tmp[0 ], start[0 ]); -intel_copy_bo (batch, tmp[0 ], src[0 ], width, height); -intel_copy_bo (batch, tmp[1 ], src[1 ], width, height); +intel_copy_bo (batch, tmp[0 ], src[0 ], width*height*4 ); +intel_copy_bo (batch, tmp[1 ], src[1 ], width*height*4 );verify_large_read (tmp[0 ], start[0 ]);verify_large_read (tmp[1 ], start[1 ]); -intel_copy_bo (batch, tmp[0 ], src[0 ], width, height); -intel_copy_bo (batch, tmp[1 ], src[1 ], width, height); +intel_copy_bo (batch, tmp[0 ], src[0 ], width*height*4 ); +intel_copy_bo (batch, tmp[1 ], src[1 ], width*height*4 );verify_large_read (tmp[1 ], start[1 ]);verify_large_read (tmp[0 ], start[0 ]); -intel_copy_bo (batch, tmp[1 ], src[0 ], width, height); -intel_copy_bo (batch, tmp[0 ], src[1 ], width, height); +intel_copy_bo (batch, tmp[1 ], src[0 ], width*height*4 ); +intel_copy_bo (batch, tmp[0 ], src[1 ], width*height*4 );verify_large_read (tmp[0 ], start[1 ]);verify_large_read (tmp[1 ], start[0 ]); }while (--loop);
tests/gem_ring_sync_copy.c +2 -2
@@ -241,7 +241,7 @@ static void blitter_busy(data_t *data)intel_copy_bo (data->batch, data->blitter.srcs[i], data->blitter.dsts[i], -WIDTH ,HEIGHT ); +WIDTH *HEIGHT *4 ); } }
@@ -262,7 +262,7 @@ static void blitter_busy_fini(data_t *data)static void blitter_copy (data_t *data,drm_intel_bo *src,drm_intel_bo *dst) { -intel_copy_bo (data->batch, dst, src,WIDTH ,HEIGHT ); +intel_copy_bo (data->batch, dst, src,WIDTH *HEIGHT *4 ); }struct ring_ops {
tests/gem_seqno_wrap.c +2 -2
@@ -160,7 +160,7 @@ static void render_copyfunc(struct scratch_buf *src, }igt_assert (dst->bo);igt_assert (src->bo); -intel_copy_bo (batch_blt, dst->bo, src->bo, width, height); +intel_copy_bo (batch_blt, dst->bo, src->bo, width*height*4 );intel_batchbuffer_flush (batch_blt); } }
@@ -252,7 +252,7 @@ static int run_sync_test(int num_buffers, bool verify)if (verify) {for (i =0 ; i < num_buffers; i++)intel_copy_bo (batch_blt, dst2[p_dst2[i]], dst1[p_dst1[i]], - width, height); + width*height*4 );for (i =0 ; i < num_buffers; i++) { r =cmp_bo (dst2[p_dst2[i]], i, width, height);
tests/gem_tiled_blits.c +5 -5
@@ -81,7 +81,7 @@ create_bo(uint32_t start_val) linear[i] = start_val++;drm_intel_bo_unmap (linear_bo); -intel_copy_bo (batch, bo, linear_bo, width, height); +intel_copy_bo (batch, bo, linear_bo, width*height*4 );drm_intel_bo_unreference (linear_bo);
@@ -97,7 +97,7 @@ check_bo(drm_intel_bo *bo, uint32_t start_val) linear_bo =drm_intel_bo_alloc (bufmgr,"linear dst" ,1024 *1024 ,4096 ); -intel_copy_bo (batch, linear_bo, bo, width, height); +intel_copy_bo (batch, linear_bo, bo, width*height*4 );do_or_die (drm_intel_bo_map (linear_bo,0 )); linear = linear_bo->virtual;
@@ -143,7 +143,7 @@ static void run_test(int count)if (src == dst)continue ; -intel_copy_bo (batch, bo[dst], bo[src], width, height); +intel_copy_bo (batch, bo[dst], bo[src], width*height*4 ); bo_start_val[dst] = bo_start_val[src]; }for (i =0 ; i < count; i++)
@@ -165,7 +165,7 @@ static void run_test(int count)if (src == dst)continue ; -intel_copy_bo (batch, bo[dst], bo[src], width, height); +intel_copy_bo (batch, bo[dst], bo[src], width*height*4 ); bo_start_val[dst] = bo_start_val[src]; }for (i =0 ; i < count; i++)
@@ -179,7 +179,7 @@ static void run_test(int count)if (src == dst)continue ; -intel_copy_bo (batch, bo[dst], bo[src], width, height); +intel_copy_bo (batch, bo[dst], bo[src], width*height*4 ); bo_start_val[dst] = bo_start_val[src]; }for (i =0 ; i < count; i++) {
tests/gem_tiled_fence_blits.c +2 -2
@@ -136,7 +136,7 @@ igt_simple_mainfor (i =0 ; i < count; i++) {int src = count - i -1 ; -intel_copy_bo (batch, bo[i], bo[src], width, height); +intel_copy_bo (batch, bo[i], bo[src], width*height*4 ); bo_start_val[i] = bo_start_val[src]; }
@@ -147,7 +147,7 @@ igt_simple_mainif (src == dst)continue ; -intel_copy_bo (batch, bo[dst], bo[src], width, height); +intel_copy_bo (batch, bo[dst], bo[src], width*height*4 ); bo_start_val[dst] = bo_start_val[src];/*
tests/prime_nv_test.c +1 -1
@@ -336,7 +336,7 @@ static void test_i915_blt_fill_nv_read(void)igt_assert (nouveau_bo_prime_handle_ref (ndev, prime_fd, &nvbo) ==0 );close (prime_fd); -intel_copy_bo (intel_batch, test_intel_bo, src_bo,256 ,1024 /4 ); +intel_copy_bo (intel_batch, test_intel_bo, src_bo,BO_SIZE );igt_assert (nouveau_bo_map (nvbo,NOUVEAU_BO_RDWR , nclient) ==0 );
Signature · 1 line
1.8.5.2