diff mbox

[1/2] tests/gem_exec_parse: fix batch_len setting for cmd-crossing-page

Message ID 1413409962-23097-1-git-send-email-bradley.d.volkin@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

bradley.d.volkin@intel.com Oct. 15, 2014, 9:52 p.m. UTC
From: Brad Volkin <bradley.d.volkin@intel.com>

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.

Signed-off-by: Brad Volkin <bradley.d.volkin@intel.com>
---
 tests/gem_exec_parse.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Daniel Vetter Oct. 21, 2014, 3:26 p.m. UTC | #1
On Wed, Oct 15, 2014 at 02:52:41PM -0700, bradley.d.volkin@intel.com wrote:
> From: Brad Volkin <bradley.d.volkin@intel.com>
> 
> 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.
> 
> Signed-off-by: Brad Volkin <bradley.d.volkin@intel.com>
> ---
>  tests/gem_exec_parse.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/gem_exec_parse.c b/tests/gem_exec_parse.c
> index 05f271c..568bd4a 100644
> --- a/tests/gem_exec_parse.c
> +++ b/tests/gem_exec_parse.c
> @@ -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;

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

> -	execbuf.batch_len = size;
> +	execbuf.batch_len = alloc_size;
>  	execbuf.cliprects_ptr = 0;
>  	execbuf.num_cliprects = 0;
>  	execbuf.DR1 = 0;
> -- 
> 1.9.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
bradley.d.volkin@intel.com Oct. 22, 2014, 3:29 p.m. UTC | #2
On Tue, Oct 21, 2014 at 08:26:05AM -0700, Daniel Vetter wrote:
> On Wed, Oct 15, 2014 at 02:52:41PM -0700, bradley.d.volkin@intel.com wrote:
> > From: Brad Volkin <bradley.d.volkin@intel.com>
> > 
> > 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.
> > 
> > Signed-off-by: Brad Volkin <bradley.d.volkin@intel.com>
> > ---
> >  tests/gem_exec_parse.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tests/gem_exec_parse.c b/tests/gem_exec_parse.c
> > index 05f271c..568bd4a 100644
> > --- a/tests/gem_exec_parse.c
> > +++ b/tests/gem_exec_parse.c
> > @@ -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;
> 
> 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

Good suggestion. I'll go with that approach instead.

Brad

> 
> > -	execbuf.batch_len = size;
> > +	execbuf.batch_len = alloc_size;
> >  	execbuf.cliprects_ptr = 0;
> >  	execbuf.num_cliprects = 0;
> >  	execbuf.DR1 = 0;
> > -- 
> > 1.9.1
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch
diff mbox

Patch

diff --git a/tests/gem_exec_parse.c b/tests/gem_exec_parse.c
index 05f271c..568bd4a 100644
--- a/tests/gem_exec_parse.c
+++ b/tests/gem_exec_parse.c
@@ -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;