tests/gem_wait_render_timeout: Use XY_COLOR_BLT instead of COLOR_BLT.
PATCH 1/4 tests/gem_wait_render_timeout: Use XY_COLOR_BLT instead of COLOR_BLT.
--- tests/gem_wait_render_timeout.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
tests/gem_wait_render_timeout.c +5 -5
@@ -86,13 +86,13 @@ static void blt_color_fill(struct intel_batchbuffer *batch, {const unsigned short height = pages/4 ;const unsigned short width =4096 ; -BEGIN_BATCH (5 ); -OUT_BATCH (COLOR_BLT_CMD | -COLOR_BLT_WRITE_ALPHA | -COLOR_BLT_WRITE_RGB ); +BEGIN_BATCH (6 ); +OUT_BATCH (XY_COLOR_BLT_CMD_NOLEN |4 | +COLOR_BLT_WRITE_ALPHA |XY_COLOR_BLT_WRITE_RGB );OUT_BATCH ((3 <<24 ) |/* 32 Bit Color */ -0xF0 |/* Raster OP copy background register */ + (0xF0 <<16 ) |/* Raster OP copy background register */ 0 );/* Dest pitch is 0 */ +OUT_BATCH (0 );OUT_BATCH (width <<16 | height);OUT_RELOC (buf,I915_GEM_DOMAIN_RENDER ,I915_GEM_DOMAIN_RENDER ,0 );
Signature · 1 line
1.8.3.1
PATCH 2/4 tests/gem_wait_render_timeout: Fix for BDW
Update XY_COLOR_BLT command for Broadwell.
--- tests/gem_wait_render_timeout.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
tests/gem_wait_render_timeout.c +13 -3
@@ -86,9 +86,17 @@ static void blt_color_fill(struct intel_batchbuffer *batch, {const unsigned short height = pages/4 ;const unsigned short width =4096 ; -BEGIN_BATCH (6 ); -OUT_BATCH (XY_COLOR_BLT_CMD_NOLEN |4 | -COLOR_BLT_WRITE_ALPHA |XY_COLOR_BLT_WRITE_RGB ); + +if (intel_gen (batch->devid) >=8 ) { +BEGIN_BATCH (8 ); +OUT_BATCH (MI_NOOP ); +OUT_BATCH (XY_COLOR_BLT_CMD_NOLEN |5 | +COLOR_BLT_WRITE_ALPHA |XY_COLOR_BLT_WRITE_RGB ); + }else { +BEGIN_BATCH (6 ); +OUT_BATCH (XY_COLOR_BLT_CMD_NOLEN |4 | +COLOR_BLT_WRITE_ALPHA |XY_COLOR_BLT_WRITE_RGB ); + }OUT_BATCH ((3 <<24 ) |/* 32 Bit Color */ (0xF0 <<16 ) |/* Raster OP copy background register */ 0 );/* Dest pitch is 0 */
@@ -96,6 +104,8 @@ static void blt_color_fill(struct intel_batchbuffer *batch,OUT_BATCH (width <<16 | height);OUT_RELOC (buf,I915_GEM_DOMAIN_RENDER ,I915_GEM_DOMAIN_RENDER ,0 ); +if (intel_gen (batch->devid) >=8 ) +OUT_BATCH (0 );OUT_BATCH (rand ());/* random pattern */ ADVANCE_BATCH (); }
Signature · 1 line
1.8.3.1
PATCH 3/4 tests/gem_gtt_hog: Use XY_COLOR_BLT instead of COLOR_BLT.
In reply to Rodrigo Vivi--- tests/gem_gtt_hog.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
tests/gem_gtt_hog.c +5 -6
@@ -42,9 +42,6 @@#include "i915_drm.h" #include "drmtest.h" -#define BLT_WRITE_ALPHA (1<<21) -#define BLT_WRITE_RGB (1<<20) -static const uint32_t canary =0xdeadbeef ; static double elapsed(const struct timeval *start,
@@ -60,7 +57,7 @@ static void busy(int fd, uint32_t handle, int size, int loops)struct drm_i915_gem_execbuffer2 execbuf;struct drm_i915_gem_pwrite gem_pwrite;struct drm_i915_gem_create create; -uint32_t buf[102 ], *b; +uint32_t buf[122 ], *b;int i;memset (reloc,0 ,sizeof (reloc));
@@ -69,9 +66,11 @@ static void busy(int fd, uint32_t handle, int size, int loops) b = buf;for (i =0 ; i <20 ; i++) { - *b++ =COLOR_BLT_CMD |BLT_WRITE_ALPHA |BLT_WRITE_RGB ; + *b++ =XY_COLOR_BLT_CMD_NOLEN |4 | +COLOR_BLT_WRITE_ALPHA |XY_COLOR_BLT_WRITE_RGB ; *b++ =0xf0 <<16 |1 <<25 |1 <<24 |4096 ; - *b++ = size >>12 <<16 |4096 ; + *b++ =0 ; + *b++ = size >>12 <<16 |1024 ; reloc[i].offset = (b - buf) *sizeof (uint32_t ); reloc[i].target_handle = handle; reloc[i].read_domains =I915_GEM_DOMAIN_RENDER ;
Signature · 1 line
1.8.3.1
PATCH 4/4 tests/gem_gtt_hog: Fix for BDW
In reply to Rodrigo ViviUpdate XY_COLOR_BLT command for Broadwell.
--- tests/gem_gtt_hog.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
tests/gem_gtt_hog.c +15 -4
@@ -57,17 +57,26 @@ static void busy(int fd, uint32_t handle, int size, int loops)struct drm_i915_gem_execbuffer2 execbuf;struct drm_i915_gem_pwrite gem_pwrite;struct drm_i915_gem_create create; -uint32_t buf[122 ], *b; +uint32_t buf[122 ], buf_bdw[170 ], *b;int i;memset (reloc,0 ,sizeof (reloc));memset (gem_exec,0 ,sizeof (gem_exec));memset (&execbuf,0 ,sizeof (execbuf)); - b = buf; +if (intel_get_drm_devid (fd) >=8 ) + b = buf_bdw; +else + b = buf;for (i =0 ; i <20 ; i++) { - *b++ =XY_COLOR_BLT_CMD_NOLEN |4 | -COLOR_BLT_WRITE_ALPHA |XY_COLOR_BLT_WRITE_RGB ; +if (intel_get_drm_devid (fd) >=8 ) { + *b++ =MI_NOOP ; + *b++ =XY_COLOR_BLT_CMD_NOLEN |4 | +COLOR_BLT_WRITE_ALPHA |XY_COLOR_BLT_WRITE_RGB ; + }else { + *b++ =XY_COLOR_BLT_CMD_NOLEN |5 | +COLOR_BLT_WRITE_ALPHA |XY_COLOR_BLT_WRITE_RGB ; + } *b++ =0xf0 <<16 |1 <<25 |1 <<24 |4096 ; *b++ =0 ; *b++ = size >>12 <<16 |1024 ;
@@ -76,6 +85,8 @@ static void busy(int fd, uint32_t handle, int size, int loops) reloc[i].read_domains =I915_GEM_DOMAIN_RENDER ; reloc[i].write_domain =I915_GEM_DOMAIN_RENDER ; *b++ =0 ; +if (intel_get_drm_devid (fd) >=8 ) + *b++ =0 ; *b++ = canary; } *b++ =MI_BATCH_BUFFER_END ;
Signature · 1 line
1.8.3.1
Re: [PATCH 4/4] tests/gem_gtt_hog: Fix for BDW
Quoted 1 line · Rodrigo Vivi
Update
XY_COLOR_BLTcommand for Broadwell.
Please stash the result of intel_get_drm_device(fd) >= 8; it makes a big mess if you are trying to debug using drm.debug=1 -Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [PATCH 4/4] tests/gem_gtt_hog: Fix for BDW
In reply to Rodrigo ViviQuoted 12 lines · Rodrigo Vivi
Update
XY_COLOR_BLTcommand for Broadwell.Signed-off-by Rodrigo Vivi <[email protected]>--- tests/gem_gtt_hog.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)tests/gem_gtt_hog.c +0
-0
tests/gem_gtt_hog.c static void busy(int fd, uint32_t handle, int size, int loops) · line 60
Quoted 5 lines
tests/gem_gtt_hog.c +1
-1@@ -57,17 +57,26 @@ static void busy(int fd, uint32_t handle, int size, int loops)struct drm_i915_gem_execbuffer2 execbuf;struct drm_i915_gem_pwrite gem_pwrite;struct drm_i915_gem_create create; -uint32_t buf[122 ], *b; +uint32_t buf[122 ], buf_bdw[170 ], *b;
Just allocate the one buffer large enough to take both and tweak the length use to pwrite/exec.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
PATCH 1/1 tests/gem_gtt_hog: Fix for BDW
Update XY_COLOR_BLT command for Broadwell.
v2: stash devid and remove ugly double allocation. (by Chris).
--- tests/gem_gtt_hog.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)
tests/gem_gtt_hog.c +17 -7
@@ -57,17 +57,25 @@ static void busy(int fd, uint32_t handle, int size, int loops)struct drm_i915_gem_execbuffer2 execbuf;struct drm_i915_gem_pwrite gem_pwrite;struct drm_i915_gem_create create; -uint32_t buf[122 ], *b; -int i; +uint32_t buf[170 ], *b; +int i, b_size; +int devid =intel_get_drm_devid (fd);memset (reloc,0 ,sizeof (reloc));memset (gem_exec,0 ,sizeof (gem_exec));memset (&execbuf,0 ,sizeof (execbuf)); + b_size = devid >=8 ?170 :122 ; b = buf;for (i =0 ; i <20 ; i++) { - *b++ =XY_COLOR_BLT_CMD_NOLEN |4 | -COLOR_BLT_WRITE_ALPHA |XY_COLOR_BLT_WRITE_RGB ; +if (devid >=8 ) { + *b++ =MI_NOOP ; + *b++ =XY_COLOR_BLT_CMD_NOLEN |4 | +COLOR_BLT_WRITE_ALPHA |XY_COLOR_BLT_WRITE_RGB ; + }else { + *b++ =XY_COLOR_BLT_CMD_NOLEN |5 | +COLOR_BLT_WRITE_ALPHA |XY_COLOR_BLT_WRITE_RGB ; + } *b++ =0xf0 <<16 |1 <<25 |1 <<24 |4096 ; *b++ =0 ; *b++ = size >>12 <<16 |1024 ;
@@ -76,6 +84,8 @@ static void busy(int fd, uint32_t handle, int size, int loops) reloc[i].read_domains =I915_GEM_DOMAIN_RENDER ; reloc[i].write_domain =I915_GEM_DOMAIN_RENDER ; *b++ =0 ; +if (devid >=8 ) + *b++ =0 ; *b++ = canary; } *b++ =MI_BATCH_BUFFER_END ;
@@ -93,14 +103,14 @@ static void busy(int fd, uint32_t handle, int size, int loops) execbuf.buffers_ptr = (uintptr_t )gem_exec; execbuf.buffer_count =2 ; - execbuf.batch_len =sizeof (buf); + execbuf.batch_len = b_size; execbuf.flags =1 <<11 ; -if (HAS_BLT_RING (intel_get_drm_devid (fd))) +if (HAS_BLT_RING (devid)) execbuf.flags |=I915_EXEC_BLT ; gem_pwrite.handle = gem_exec[1 ].handle; gem_pwrite.offset =0 ; - gem_pwrite.size =sizeof (buf); + gem_pwrite.size = b_size; gem_pwrite.data_ptr = (uintptr_t )buf;if (drmIoctl (fd,DRM_IOCTL_I915_GEM_PWRITE , &gem_pwrite) ==0 ) {while (loops--)
Signature · 1 line
1.8.3.1
Re: [PATCH] tests/gem_gtt_hog: Fix for BDW
Quoted 15 lines · Rodrigo Vivi
Update
XY_COLOR_BLTcommand for Broadwell.v2: stash devid and remove ugly double allocation. (by Chris).
Cc Chris Wilson [email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- tests/gem_gtt_hog.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)tests/gem_gtt_hog.c +0
-0
tests/gem_gtt_hog.c static void busy(int fd, uint32_t handle, int size, int loops) · line 62
Quoted 8 lines
tests/gem_gtt_hog.c +3
-2@@ -57,17 +57,25 @@ static void busy(int fd, uint32_t handle, int size, int loops)struct drm_i915_gem_execbuffer2 execbuf;struct drm_i915_gem_pwrite gem_pwrite;struct drm_i915_gem_create create; -uint32_t buf[122 ], *b; -int i; +uint32_t buf[170 ], *b; +int i, b_size; +int devid =intel_get_drm_devid (fd);
This function is called many times. But the value is static. -Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
PATCH 1/1 tests/gem_gtt_hog: Fix for BDW
Update XY_COLOR_BLT command for Broadwell.
v2: stash devid and remove ugly double allocation. (by Chris).
v3: fix inverted blt command size and stash fd, devid and intel_gen.
--- tests/gem_gtt_hog.c | 59 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 20 deletions(-)
tests/gem_gtt_hog.c +39 -20
@@ -44,30 +44,43 @@static const uint32_t canary =0xdeadbeef ; +typedef struct data { +int fd; +int devid; +int intel_gen; +}data_t ; +static double elapsed (const struct timeval *start,const struct timeval *end) {return 1e6 *(end->tv_sec - start->tv_sec) + (end->tv_usec - start->tv_usec); } -static void busy (int fd,uint32_t handle,int size,int loops) +static void busy (data_t *data,uint32_t handle,int size,int loops) {struct drm_i915_gem_relocation_entry reloc[20 ];struct drm_i915_gem_exec_object2 gem_exec[2 ];struct drm_i915_gem_execbuffer2 execbuf;struct drm_i915_gem_pwrite gem_pwrite;struct drm_i915_gem_create create; -uint32_t buf[122 ], *b; -int i; +uint32_t buf[170 ], *b; +int i, b_size;memset (reloc,0 ,sizeof (reloc));memset (gem_exec,0 ,sizeof (gem_exec));memset (&execbuf,0 ,sizeof (execbuf)); b = buf; + b_size =sizeof (uint32_t ) * (data->intel_gen >=8 ?170 :122 );for (i =0 ; i <20 ; i++) { - *b++ =XY_COLOR_BLT_CMD_NOLEN |4 | -COLOR_BLT_WRITE_ALPHA |XY_COLOR_BLT_WRITE_RGB ; +if (data->intel_gen >=8 ) { + *b++ =MI_NOOP ; + *b++ =XY_COLOR_BLT_CMD_NOLEN |5 | +COLOR_BLT_WRITE_ALPHA |XY_COLOR_BLT_WRITE_RGB ; + }else { + *b++ =XY_COLOR_BLT_CMD_NOLEN |4 | +COLOR_BLT_WRITE_ALPHA |XY_COLOR_BLT_WRITE_RGB ; + } *b++ =0xf0 <<16 |1 <<25 |1 <<24 |4096 ; *b++ =0 ; *b++ = size >>12 <<16 |1024 ;
@@ -76,6 +89,8 @@ static void busy(int fd, uint32_t handle, int size, int loops) reloc[i].read_domains =I915_GEM_DOMAIN_RENDER ; reloc[i].write_domain =I915_GEM_DOMAIN_RENDER ; *b++ =0 ; +if (data->intel_gen >=8 ) + *b++ =0 ; *b++ = canary; } *b++ =MI_BATCH_BUFFER_END ;
@@ -86,56 +101,55 @@ static void busy(int fd, uint32_t handle, int size, int loops) create.handle =0 ; create.size =4096 ; -drmIoctl (fd,DRM_IOCTL_I915_GEM_CREATE , &create); +drmIoctl (data->fd,DRM_IOCTL_I915_GEM_CREATE , &create); gem_exec[1 ].handle = create.handle; gem_exec[1 ].relocation_count =20 ; gem_exec[1 ].relocs_ptr = (uintptr_t )reloc; execbuf.buffers_ptr = (uintptr_t )gem_exec; execbuf.buffer_count =2 ; - execbuf.batch_len =sizeof (buf); + execbuf.batch_len = b_size; execbuf.flags =1 <<11 ; -if (HAS_BLT_RING (intel_get_drm_devid (fd))) +if (HAS_BLT_RING (data->devid)) execbuf.flags |=I915_EXEC_BLT ; gem_pwrite.handle = gem_exec[1 ].handle; gem_pwrite.offset =0 ; - gem_pwrite.size =sizeof (buf); + gem_pwrite.size = b_size; gem_pwrite.data_ptr = (uintptr_t )buf; -if (drmIoctl (fd,DRM_IOCTL_I915_GEM_PWRITE , &gem_pwrite) ==0 ) { +if (drmIoctl (data->fd,DRM_IOCTL_I915_GEM_PWRITE , &gem_pwrite) ==0 ) {while (loops--) -drmIoctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf); +drmIoctl (data->fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf); } -drmIoctl (fd,DRM_IOCTL_GEM_CLOSE , &create.handle); +drmIoctl (data->fd,DRM_IOCTL_GEM_CLOSE , &create.handle); } -static void run (int child) +static void run (data_t *data,int child) {const int size =4096 * (256 + child * child);const int tiling = child %2 ;const int write = child %2 ; -int fd =drm_open_any (); -uint32_t handle =gem_create (fd, size); +uint32_t handle =gem_create (data->fd, size);uint32_t *ptr;uint32_t x;igt_assert (handle);if (tiling !=I915_TILING_NONE ) -gem_set_tiling (fd, handle, tiling,4096 ); +gem_set_tiling (data->fd, handle, tiling,4096 );/* load up the unfaulted bo */ -busy (fd, handle, size,100 ); +busy (data, handle, size,100 );/* Note that we ignore the API and rely on the implict * set-to-gtt-domain within the fault handler. */ if (write) { - ptr =gem_mmap (fd, handle, size,PROT_READ |PROT_WRITE ); + ptr =gem_mmap (data->fd, handle, size,PROT_READ |PROT_WRITE ); ptr[rand () % (size /4 )] = canary; }else - ptr =gem_mmap (fd, handle, size,PROT_READ ); + ptr =gem_mmap (data->fd, handle, size,PROT_READ ); x = ptr[rand () % (size /4 )];munmap (ptr, size);
@@ -147,15 +161,20 @@ igt_simple_main {struct timeval start, end;pid_t children[64 ]; +data_t data = {};int n;igt_skip_on_simulation (); + data.fd =drm_open_any (); + data.devid =intel_get_drm_devid (data.fd); + data.intel_gen =intel_gen (data.devid); +gettimeofday (&start,NULL );for (n =0 ; n <ARRAY_SIZE (children); n++) {switch ((children[n] =fork ())) {case -1 :igt_assert (0 ); -case 0 :run (n);break ; +case 0 :run (&data, n);break ;default :break ; } }
Signature · 1 line
1.8.3.1
Re: [PATCH] tests/gem_gtt_hog: Fix for BDW
Quoted 45 lines · Rodrigo Vivi
Update
XY_COLOR_BLTcommand for Broadwell.v2: stash devid and remove ugly double allocation. (by Chris).
v3: fix inverted blt command size and stash fd, devid andintel_gen.Cc Chris Wilson [email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- tests/gem_gtt_hog.c | 59 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 20 deletions(-)tests/gem_gtt_hog.c +9
-3@@ -44,30 +44,43 @@static const uint32_t canary =0xdeadbeef ; +typedef struct data { +int fd; +int devid; +int intel_gen; +}data_t ; +static double elapsed (const struct timeval *start,const struct timeval *end) {return 1e6 *(end->tv_sec - start->tv_sec) + (end->tv_usec - start->tv_usec); } -static void busy (int fd,uint32_t handle,int size,int loops) +static void busy (data_t *data,uint32_t handle,int size,int loops) {struct drm_i915_gem_relocation_entry reloc[20 ];struct drm_i915_gem_exec_object2 gem_exec[2 ];struct drm_i915_gem_execbuffer2 execbuf;struct drm_i915_gem_pwrite gem_pwrite;struct drm_i915_gem_create create; -uint32_t buf[122 ], *b; -int i; +uint32_t buf[170 ], *b; +int i, b_size;memset (reloc,0 ,sizeof (reloc));
tests/gem_gtt_hog.c line 77
Quoted 10 lines
tests/gem_gtt_hog.c +3
-2memset (gem_exec,0 ,sizeof (gem_exec));memset (&execbuf,0 ,sizeof (execbuf)); b = buf; + b_size =sizeof (uint32_t ) * (data->intel_gen >=8 ?170 :122 );for (i =0 ; i <20 ; i++) { - *b++ =XY_COLOR_BLT_CMD_NOLEN |4 | -COLOR_BLT_WRITE_ALPHA |XY_COLOR_BLT_WRITE_RGB ; +if (data->intel_gen >=8 ) { + *b++ =MI_NOOP ;
Not required, instead you just round up the buf to the next qword after ending the batch.
Quoted 10 lines
tests/gem_gtt_hog.c +6
-0+ *b++ =XY_COLOR_BLT_CMD_NOLEN |5 | +COLOR_BLT_WRITE_ALPHA |XY_COLOR_BLT_WRITE_RGB ; + }else { + *b++ =XY_COLOR_BLT_CMD_NOLEN |4 | +COLOR_BLT_WRITE_ALPHA |XY_COLOR_BLT_WRITE_RGB ; + } *b++ =0xf0 <<16 |1 <<25 |1 <<24 |4096 ; *b++ =0 ; *b++ = size >>12 <<16 |1024 ;
tests/gem_gtt_hog.c static void busy(int fd, uint32_t handle, int size, int loops) · line 96
Quoted 8 lines
tests/gem_gtt_hog.c +2
-0@@ -76,6 +89,8 @@ static void busy(int fd, uint32_t handle, int size, int loops) reloc[i].read_domains =I915_GEM_DOMAIN_RENDER ; reloc[i].write_domain =I915_GEM_DOMAIN_RENDER ; *b++ =0 ; +if (data->intel_gen >=8 ) + *b++ =0 ; *b++ = canary; } *b++ =MI_BATCH_BUFFER_END ;
if ((b - buf) & 1))
*b++ = 0;
Quoted 4 lines
tests/gem_gtt_hog.c +0
-0@@ -86,56 +101,55 @@ static void busy(int fd, uint32_t handle, int size, int loops) create.handle =0 ; create.size =4096 ;
tests/gem_gtt_hog.c static void busy(int fd, uint32_t handle, int size, int loops) · line 111
Quoted 10 lines
tests/gem_gtt_hog.c +2
-2-drmIoctl (fd,DRM_IOCTL_I915_GEM_CREATE , &create); +drmIoctl (data->fd,DRM_IOCTL_I915_GEM_CREATE , &create); gem_exec[1 ].handle = create.handle; gem_exec[1 ].relocation_count =20 ; gem_exec[1 ].relocs_ptr = (uintptr_t )reloc; execbuf.buffers_ptr = (uintptr_t )gem_exec; execbuf.buffer_count =2 ; - execbuf.batch_len =sizeof (buf); + execbuf.batch_len = b_size;
I would have personally used (b - buf) * sizeof(buf[0]);
tests/gem_gtt_hog.c static void busy(int fd, uint32_t handle, int size, int loops) · line 118
Quoted 9 lines
tests/gem_gtt_hog.c +2
-2execbuf.flags =1 <<11 ; -if (HAS_BLT_RING (intel_get_drm_devid (fd))) +if (HAS_BLT_RING (data->devid)) execbuf.flags |=I915_EXEC_BLT ; gem_pwrite.handle = gem_exec[1 ].handle; gem_pwrite.offset =0 ; - gem_pwrite.size =sizeof (buf); + gem_pwrite.size = b_size;
and gem_pwrite.size = execbuf.batch_len;
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [PATCH] tests/gem_gtt_hog: Fix for BDW
Quoted 49 lines · Chris Wilson
Quoted 48 lines · Rodrigo Vivi
Update
XY_COLOR_BLTcommand for Broadwell.v2: stash devid and remove ugly double allocation. (by Chris).
v3: fix inverted blt command size and stash fd, devid andintel_gen.Cc Chris Wilson [email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- tests/gem_gtt_hog.c | 59 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 20 deletions(-)tests/gem_gtt_hog.c +9
-3@@ -44,30 +44,43 @@static const uint32_t canary =0xdeadbeef ; +typedef struct data { +int fd; +int devid; +int intel_gen; +}data_t ; +static double elapsed (const struct timeval *start,const struct timeval *end) {return 1e6 *(end->tv_sec - start->tv_sec) + (end->tv_usec - start->tv_usec); } -static void busy (int fd,uint32_t handle,int size,int loops) +static void busy (data_t *data,uint32_t handle,int size,int loops) {struct drm_i915_gem_relocation_entry reloc[20 ];struct drm_i915_gem_exec_object2 gem_exec[2 ];struct drm_i915_gem_execbuffer2 execbuf;struct drm_i915_gem_pwrite gem_pwrite;struct drm_i915_gem_create create; -uint32_t buf[122 ], *b; -int i; +uint32_t buf[170 ], *b; +int i, b_size;memset (reloc,0 ,sizeof (reloc));memset (gem_exec,0 ,sizeof (gem_exec));memset (&execbuf,0 ,sizeof (execbuf));
Quoted 10 lines
tests/gem_gtt_hog.c line 77
Quoted 7 lines
tests/gem_gtt_hog.c +3
-2b = buf; + b_size =sizeof (uint32_t ) * (data->intel_gen >=8 ?170 :122 );for (i =0 ; i <20 ; i++) { - *b++ =XY_COLOR_BLT_CMD_NOLEN |4 | -COLOR_BLT_WRITE_ALPHA |XY_COLOR_BLT_WRITE_RGB ; +if (data->intel_gen >=8 ) { + *b++ =MI_NOOP ;Not required, instead you just round up the buf to the next qword after ending the batch.
I'm afraid I didn't get here, but if possible I'd like to let it just like other bdw patches are.
Quoted 13 lines
Quoted 13 lines
tests/gem_gtt_hog.c +6
-0+ *b++ =XY_COLOR_BLT_CMD_NOLEN |5 | +COLOR_BLT_WRITE_ALPHA |XY_COLOR_BLT_WRITE_RGB ; + }else { + *b++ =XY_COLOR_BLT_CMD_NOLEN |4 | +COLOR_BLT_WRITE_ALPHA |XY_COLOR_BLT_WRITE_RGB ; + } *b++ =0xf0 <<16 |1 <<25 |1 <<24 |4096 ; *b++ =0 ; *b++ = size >>12 <<16 |1024 ;@@ -76,6 +89,8 @@ static void busy(int fd, uint32_t handle, int size, int loops) reloc[i].read_domains =I915_GEM_DOMAIN_RENDER ; reloc[i].write_domain =I915_GEM_DOMAIN_RENDER ;
Quoted 8 lines
tests/gem_gtt_hog.c static void busy(int fd, uint32_t handle, int size, int loops) · line 96
Quoted 6 lines
tests/gem_gtt_hog.c +2
-0*b++ =0 ; +if (data->intel_gen >=8 ) + *b++ =0 ; *b++ = canary; } *b++ =MI_BATCH_BUFFER_END ;if ((b - buf) & 1))
*b++ = 0;
is this related to your above's suggestion?
Quoted 11 lines
Quoted 11 lines
tests/gem_gtt_hog.c +1
-1@@ -86,56 +101,55 @@ static void busy(int fd, uint32_t handle, int size, int loops) create.handle =0 ; create.size =4096 ; -drmIoctl (fd,DRM_IOCTL_I915_GEM_CREATE , &create); +drmIoctl (data->fd,DRM_IOCTL_I915_GEM_CREATE , &create); gem_exec[1 ].handle = create.handle; gem_exec[1 ].relocation_count =20 ; gem_exec[1 ].relocs_ptr = (uintptr_t )reloc;
Quoted 6 lines
tests/gem_gtt_hog.c static void busy(int fd, uint32_t handle, int size, int loops) · line 111
Quoted 4 lines
tests/gem_gtt_hog.c +1
-1execbuf.buffers_ptr = (uintptr_t )gem_exec; execbuf.buffer_count =2 ; - execbuf.batch_len =sizeof (buf); + execbuf.batch_len = b_size;I would have personally used (b - buf) *
sizeof(buf[0]);
much better for sure. Already changed here and will send this on next version.
Quoted 10 lines
tests/gem_gtt_hog.c static void busy(int fd, uint32_t handle, int size, int loops) · line 118
Quoted 10 lines
tests/gem_gtt_hog.c +2
-2execbuf.flags =1 <<11 ; -if (HAS_BLT_RING (intel_get_drm_devid (fd))) +if (HAS_BLT_RING (data->devid)) execbuf.flags |=I915_EXEC_BLT ; gem_pwrite.handle = gem_exec[1 ].handle; gem_pwrite.offset =0 ; - gem_pwrite.size =sizeof (buf); + gem_pwrite.size = b_size;
Quoted 5 lines
and gem_pwrite.size = execbuf.batch_len;
-Chris--
Chris Wilson, Intel Open Source Technology Centre
Thanks
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
Re: [PATCH] tests/gem_gtt_hog: Fix for BDW
Quoted 11 lines · Rodrigo Vivi
Quoted 8 lines
tests/gem_gtt_hog.c line 77
Quoted 5 lines
for (i = 0; i < 20; i++) {tests/gem_gtt_hog.c +2
-2- *b++ =XY_COLOR_BLT_CMD_NOLEN |4 | -COLOR_BLT_WRITE_ALPHA |XY_COLOR_BLT_WRITE_RGB ; +if (data->intel_gen >=8 ) { + *b++ =MI_NOOP ;Not required, instead you just round up the buf to the next qword after ending the batch.
I'm afraid I didn't get here, but if possible I'd like to let it just like other bdw patches are.
This is just inserting a no-op between commands just to round each out to a even number of dwords. Which is just lazy.
Quoted 22 lines
Quoted 13 lines
Quoted 13 lines
tests/gem_gtt_hog.c +6
-0+ *b++ =XY_COLOR_BLT_CMD_NOLEN |5 | +COLOR_BLT_WRITE_ALPHA |XY_COLOR_BLT_WRITE_RGB ; + }else { + *b++ =XY_COLOR_BLT_CMD_NOLEN |4 | +COLOR_BLT_WRITE_ALPHA |XY_COLOR_BLT_WRITE_RGB ; + } *b++ =0xf0 <<16 |1 <<25 |1 <<24 |4096 ; *b++ =0 ; *b++ = size >>12 <<16 |1024 ;@@ -76,6 +89,8 @@ static void busy(int fd, uint32_t handle, int size, int loops) reloc[i].read_domains =I915_GEM_DOMAIN_RENDER ; reloc[i].write_domain =I915_GEM_DOMAIN_RENDER ;Quoted 8 lines
tests/gem_gtt_hog.c static void busy(int fd, uint32_t handle, int size, int loops) · line 96
Quoted 6 lines
tests/gem_gtt_hog.c +2
-0*b++ =0 ; +if (data->intel_gen >=8 ) + *b++ =0 ; *b++ = canary; } *b++ =MI_BATCH_BUFFER_END ;if ((b - buf) & 1))
*b++ = 0;
Quoted 1 line
is this related to your above's suggestion?
and for the (b-buf) transform later.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
PATCH 1/1 tests/gem_gtt_hog: Fix for BDW
In reply to Chris WilsonUpdate XY_COLOR_BLT command for Broadwell.
v2: stash devid and remove ugly double allocation. (by Chris).
v3: fix inverted blt command size and stash fd, devid and intel_gen.
v4: improved len calculation and noop between blt commands. (by Chris).
--- tests/gem_gtt_hog.c | 52 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 19 deletions(-)
tests/gem_gtt_hog.c +33 -19
@@ -44,20 +44,26 @@static const uint32_t canary =0xdeadbeef ; +typedef struct data { +int fd; +int devid; +int intel_gen; +}data_t ; +static double elapsed (const struct timeval *start,const struct timeval *end) {return 1e6 *(end->tv_sec - start->tv_sec) + (end->tv_usec - start->tv_usec); } -static void busy (int fd,uint32_t handle,int size,int loops) +static void busy (data_t *data,uint32_t handle,int size,int loops) {struct drm_i915_gem_relocation_entry reloc[20 ];struct drm_i915_gem_exec_object2 gem_exec[2 ];struct drm_i915_gem_execbuffer2 execbuf;struct drm_i915_gem_pwrite gem_pwrite;struct drm_i915_gem_create create; -uint32_t buf[122 ], *b; +uint32_t buf[170 ], *b;int i;memset (reloc,0 ,sizeof (reloc));
@@ -66,7 +72,8 @@ static void busy(int fd, uint32_t handle, int size, int loops) b = buf;for (i =0 ; i <20 ; i++) { - *b++ =XY_COLOR_BLT_CMD_NOLEN |4 | + *b++ =XY_COLOR_BLT_CMD_NOLEN | + ((data->intel_gen >=8 ) ?5 :4 ) |COLOR_BLT_WRITE_ALPHA |XY_COLOR_BLT_WRITE_RGB ; *b++ =0xf0 <<16 |1 <<25 |1 <<24 |4096 ; *b++ =0 ;
@@ -76,66 +83,68 @@ static void busy(int fd, uint32_t handle, int size, int loops) reloc[i].read_domains =I915_GEM_DOMAIN_RENDER ; reloc[i].write_domain =I915_GEM_DOMAIN_RENDER ; *b++ =0 ; +if (data->intel_gen >=8 ) + *b++ =0 ; *b++ = canary; } *b++ =MI_BATCH_BUFFER_END ; - *b++ =0 ; +if ((b - buf) &1 ) + *b++ =0 ; gem_exec[0 ].handle = handle; gem_exec[0 ].flags =EXEC_OBJECT_NEEDS_FENCE ; create.handle =0 ; create.size =4096 ; -drmIoctl (fd,DRM_IOCTL_I915_GEM_CREATE , &create); +drmIoctl (data->fd,DRM_IOCTL_I915_GEM_CREATE , &create); gem_exec[1 ].handle = create.handle; gem_exec[1 ].relocation_count =20 ; gem_exec[1 ].relocs_ptr = (uintptr_t )reloc; execbuf.buffers_ptr = (uintptr_t )gem_exec; execbuf.buffer_count =2 ; - execbuf.batch_len =sizeof (buf); + execbuf.batch_len = (b - buf) *sizeof (buf[0 ]); execbuf.flags =1 <<11 ; -if (HAS_BLT_RING (intel_get_drm_devid (fd))) +if (HAS_BLT_RING (data->devid)) execbuf.flags |=I915_EXEC_BLT ; gem_pwrite.handle = gem_exec[1 ].handle; gem_pwrite.offset =0 ; - gem_pwrite.size =sizeof (buf); + gem_pwrite.size = execbuf.batch_len; gem_pwrite.data_ptr = (uintptr_t )buf; -if (drmIoctl (fd,DRM_IOCTL_I915_GEM_PWRITE , &gem_pwrite) ==0 ) { +if (drmIoctl (data->fd,DRM_IOCTL_I915_GEM_PWRITE , &gem_pwrite) ==0 ) {while (loops--) -drmIoctl (fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf); +drmIoctl (data->fd,DRM_IOCTL_I915_GEM_EXECBUFFER2 , &execbuf); } -drmIoctl (fd,DRM_IOCTL_GEM_CLOSE , &create.handle); +drmIoctl (data->fd,DRM_IOCTL_GEM_CLOSE , &create.handle); } -static void run (int child) +static void run (data_t *data,int child) {const int size =4096 * (256 + child * child);const int tiling = child %2 ;const int write = child %2 ; -int fd =drm_open_any (); -uint32_t handle =gem_create (fd, size); +uint32_t handle =gem_create (data->fd, size);uint32_t *ptr;uint32_t x;igt_assert (handle);if (tiling !=I915_TILING_NONE ) -gem_set_tiling (fd, handle, tiling,4096 ); +gem_set_tiling (data->fd, handle, tiling,4096 );/* load up the unfaulted bo */ -busy (fd, handle, size,100 ); +busy (data, handle, size,100 );/* Note that we ignore the API and rely on the implict * set-to-gtt-domain within the fault handler. */ if (write) { - ptr =gem_mmap (fd, handle, size,PROT_READ |PROT_WRITE ); + ptr =gem_mmap (data->fd, handle, size,PROT_READ |PROT_WRITE ); ptr[rand () % (size /4 )] = canary; }else - ptr =gem_mmap (fd, handle, size,PROT_READ ); + ptr =gem_mmap (data->fd, handle, size,PROT_READ ); x = ptr[rand () % (size /4 )];munmap (ptr, size);
@@ -147,15 +156,20 @@ igt_simple_main {struct timeval start, end;pid_t children[64 ]; +data_t data = {};int n;igt_skip_on_simulation (); + data.fd =drm_open_any (); + data.devid =intel_get_drm_devid (data.fd); + data.intel_gen =intel_gen (data.devid); +gettimeofday (&start,NULL );for (n =0 ; n <ARRAY_SIZE (children); n++) {switch ((children[n] =fork ())) {case -1 :igt_assert (0 ); -case 0 :run (n);break ; +case 0 :run (&data, n);break ;default :break ; } }
Signature · 1 line
1.8.3.1