tests/gem_exec_parse: fix batch_len setting for cmd-crossing-page
PATCH 1/2 tests/gem_exec_parse: fix batch_len setting for cmd-crossing-page
From: Brad Volkin <[email protected]>
The size of the batch buffer passed to the kernel is significantly larger than the size of the batch buffer passed to the function. A proposed optimization as part of the batch copy kernel series is to use batch_len for the copy and parse operations, which leads to a false "batch without MI_BATCH_BUFFER_END" failure for this test.
--- tests/gem_exec_parse.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tests/gem_exec_parse.c +3 -2
@@ -144,9 +144,10 @@ static void exec_split_batch(int fd, uint32_t *cmds,struct drm_i915_gem_exec_object2 objs[1 ];uint32_t cmd_bo;uint32_t noop[1024 ] = {0 }; +const int alloc_size =4096 *2 ;// Allocate and fill a 2-page batch with noops - cmd_bo =gem_create (fd,4096 *2 ); + cmd_bo =gem_create (fd, alloc_size);gem_write (fd, cmd_bo,0 , noop,sizeof (noop));gem_write (fd, cmd_bo,4096 , noop,sizeof (noop));
@@ -167,7 +168,7 @@ static void exec_split_batch(int fd, uint32_t *cmds, execbuf.buffers_ptr = (uintptr_t )objs; execbuf.buffer_count =1 ; execbuf.batch_start_offset =0 ; - execbuf.batch_len = size; + execbuf.batch_len = alloc_size; execbuf.cliprects_ptr =0 ; execbuf.num_cliprects =0 ; execbuf.DR1 =0 ;
Signature · 1 line
1.9.1
PATCH 2/2 tests/gem_exec_parse: test for chained batch buffers
From: Brad Volkin <[email protected]>
libva makes extensive use of chained batch buffers. The batch buffer copy portion of the command parser has the potential to break chained batches, so add a simple test to make sure that doesn't happen.
--- lib/intel_reg.h | 1 + tests/gem_exec_parse.c | 105 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+)
lib/intel_reg.h +1 -0
@@ -2571,6 +2571,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.#define MI_BATCH_BUFFER_END (0xA << 23)#define MI_BATCH_NON_SECURE (1)#define MI_BATCH_NON_SECURE_I965 (1 << 8) +#define MI_BATCH_NON_SECURE_HSW (1<<13)/* Additional bit for RCS */ #define MAX_DISPLAY_PIPES 2
tests/gem_exec_parse.c +105 -0
117 lines not on this page · raw message
Signature · 1 line
1.9.1
Quoted 30 lines · On Wed, Oct 15, 2014 at 02:52:41PM -0700, [email protected] wrote:
From: Brad Volkin <[email protected]>
The size of the batch buffer passed to the kernel is significantly larger than the size of the batch buffer passed to the function. A proposed optimization as part of the batch copy kernel series is to use
batch_lenfor the copy and parse operations, which leads to a false "batch withoutMI_BATCH_BUFFER_END" failure for this test.Signed-off-by Brad Volkin <[email protected]>--- tests/gem_exec_parse.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)tests/gem_exec_parse.c +2
-1@@ -144,9 +144,10 @@ static void exec_split_batch(int fd, uint32_t *cmds,struct drm_i915_gem_exec_object2 objs[1 ];uint32_t cmd_bo;uint32_t noop[1024 ] = {0 }; +const int alloc_size =4096 *2 ;// Allocate and fill a 2-page batch with noops - cmd_bo =gem_create (fd,4096 *2 ); + cmd_bo =gem_create (fd, alloc_size);gem_write (fd, cmd_bo,0 , noop,sizeof (noop));gem_write (fd, cmd_bo,4096 , noop,sizeof (noop));
tests/gem_exec_parse.c static void exec_split_batch(int fd, uint32_t *cmds, · line 170
Quoted 3 lines
tests/gem_exec_parse.c +0
-0@@ -167,7 +168,7 @@ static void exec_split_batch(int fd, uint32_t *cmds, execbuf.buffers_ptr = (uintptr_t )objs; execbuf.buffer_count =1 ; execbuf.batch_start_offset =0 ;
Shouldn't we simply adjust batch_start_offset to be 4096-4, i.e. where we've placed the batch? Would have the benifit of also testing offset batches ;-)
-Daniel
Quoted 12 lines
tests/gem_exec_parse.c +1
-1- execbuf.batch_len = size; + execbuf.batch_len = alloc_size; execbuf.cliprects_ptr =0 ; execbuf.num_cliprects =0 ; execbuf.DR1 =0 ;Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 30 lines · Daniel Vetter
Quoted 29 lines · On Wed, Oct 15, 2014 at 02:52:41PM -0700, [email protected] wrote:
From: Brad Volkin <[email protected]>
The size of the batch buffer passed to the kernel is significantly larger than the size of the batch buffer passed to the function. A proposed optimization as part of the batch copy kernel series is to use
batch_lenfor the copy and parse operations, which leads to a false "batch withoutMI_BATCH_BUFFER_END" failure for this test.Signed-off-by Brad Volkin <[email protected]>--- tests/gem_exec_parse.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)tests/gem_exec_parse.c +2
-1@@ -144,9 +144,10 @@ static void exec_split_batch(int fd, uint32_t *cmds,struct drm_i915_gem_exec_object2 objs[1 ];uint32_t cmd_bo;uint32_t noop[1024 ] = {0 }; +const int alloc_size =4096 *2 ;// Allocate and fill a 2-page batch with noops - cmd_bo =gem_create (fd,4096 *2 ); + cmd_bo =gem_create (fd, alloc_size);gem_write (fd, cmd_bo,0 , noop,sizeof (noop));gem_write (fd, cmd_bo,4096 , noop,sizeof (noop));
Quoted 9 lines
tests/gem_exec_parse.c static void exec_split_batch(int fd, uint32_t *cmds, · line 170
Quoted 4 lines
tests/gem_exec_parse.c +0
-0@@ -167,7 +168,7 @@ static void exec_split_batch(int fd, uint32_t *cmds, execbuf.buffers_ptr = (uintptr_t )objs; execbuf.buffer_count =1 ; execbuf.batch_start_offset =0 ;Shouldn't we simply adjust
batch_start_offsetto be 4096-4, i.e. where we've placed the batch? Would have the benifit of also testing offset batches ;-)
-Daniel
Good suggestion. I'll go with that approach instead.
Brad
Quoted 18 lines
Quoted 13 lines
tests/gem_exec_parse.c +1
-1- execbuf.batch_len = size; + execbuf.batch_len = alloc_size; execbuf.cliprects_ptr =0 ; execbuf.num_cliprects =0 ; execbuf.DR1 =0 ;Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch