Re: [Intel-gfx] [PATCH I-g-t 2/2] tests: Add dummy_reloc test case based on multi drm_fd to test CPU-GPU sync under multi BSD rings
On Mon, Apr 14, 2014 at 12:19:58PM +0800, Zhao Yakui wrote: The Broadwell GT3 machine has two independent BSD rings in kernel driver while it is transparent to the user-space driver. In such case it needs to check the CPU-GPU sync for the second BSD ring. Multi drm_fd can assure that the second BSD ring has the opportunity to dispatch the GPU command. Signed-off-by: Zhao Yakui yakui.z...@intel.com --- tests/Makefile.sources|1 + tests/gem_dummy_reloc_multi_bsd.c | 258 + I've meant that you add a new subtest to the existing gem_dummy_reloc test. With your patch here we essentially duplicate all the tests for the other rings. 2 files changed, 259 insertions(+) create mode 100644 tests/gem_dummy_reloc_multi_bsd.c diff --git a/tests/Makefile.sources b/tests/Makefile.sources index 254a5c5..98f277f 100644 --- a/tests/Makefile.sources +++ b/tests/Makefile.sources @@ -105,6 +105,7 @@ TESTS_progs = \ gem_ring_sync_copy \ gem_ring_sync_loop \ gem_multi_bsd_sync_loop \ + gem_dummy_reloc_multi_bsd \ Tests with subtests must be added to the TESTS_progs_M variable, otherwise piglit won't be able to enumerate the subtests. That's just an fyi for the next testcase, like I've said here it's imo better to just add a new subtest. Also you've forgotten to update .gitignore, when building with your patch git status shows some not-added binaries. -Daniel gem_seqno_wrap \ gem_set_tiling_vs_gtt \ gem_set_tiling_vs_pwrite \ diff --git a/tests/gem_dummy_reloc_multi_bsd.c b/tests/gem_dummy_reloc_multi_bsd.c new file mode 100644 index 000..ef8213e --- /dev/null +++ b/tests/gem_dummy_reloc_multi_bsd.c @@ -0,0 +1,258 @@ +/* + * Copyright © 2014 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the Software), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + *Daniel Vetter daniel.vet...@ffwll.ch (based on gem_dummy_reloc_loop*.c) + *Zhao Yakui yakui.z...@intel.com + * + */ + +#include stdlib.h +#include stdio.h +#include string.h +#include fcntl.h +#include inttypes.h +#include errno.h +#include sys/stat.h +#include sys/time.h +#include drm.h +#include ioctl_wrappers.h +#include drmtest.h +#include intel_bufmgr.h +#include intel_batchbuffer.h +#include intel_io.h +#include i830_reg.h +#include intel_chipset.h + +#define LOCAL_I915_EXEC_VEBOX (40) + +static drm_intel_bufmgr *bufmgr; +struct intel_batchbuffer *batch; +static drm_intel_bo *target_buffer; + +#define NUM_FD 50 + +static int mfd[NUM_FD]; +static drm_intel_bufmgr *mbufmgr[NUM_FD]; +static struct intel_batchbuffer *mbatch[NUM_FD]; +static drm_intel_bo *mbuffer[NUM_FD]; + + +/* + * Testcase: Basic check of ring-cpu sync using a dummy reloc under multi-fd + * + * The last test (that randomly switches the ring) seems to be pretty effective + * at hitting the missed irq bug that's worked around with the HWSTAM irq write. + */ + + +#define MI_COND_BATCH_BUFFER_END (0x3623 | 1) +#define MI_DO_COMPARE(121) +static void +dummy_reloc_loop(int ring) +{ + int i; + srandom(0xdeadbeef); + + for (i = 0; i 0x10; i++) { + int mindex = random() % NUM_FD; + + batch = mbatch[mindex]; + if (ring == I915_EXEC_RENDER) { + BEGIN_BATCH(4); + OUT_BATCH(MI_COND_BATCH_BUFFER_END | MI_DO_COMPARE); + OUT_BATCH(0x); /* compare dword */ + OUT_RELOC(mbuffer[mindex], I915_GEM_DOMAIN_RENDER, + I915_GEM_DOMAIN_RENDER, 0); + OUT_BATCH(MI_NOOP); + ADVANCE_BATCH(); + } else { + BEGIN_BATCH(4); + OUT_BATCH(MI_FLUSH_DW | 1); +
Re: [Intel-gfx] [PATCH I-g-t 2/2] tests: Add dummy_reloc test case based on multi drm_fd to test CPU-GPU sync under multi BSD rings
On Mon, 2014-04-14 at 01:06 -0600, Daniel Vetter wrote: On Mon, Apr 14, 2014 at 12:19:58PM +0800, Zhao Yakui wrote: The Broadwell GT3 machine has two independent BSD rings in kernel driver while it is transparent to the user-space driver. In such case it needs to check the CPU-GPU sync for the second BSD ring. Multi drm_fd can assure that the second BSD ring has the opportunity to dispatch the GPU command. Signed-off-by: Zhao Yakui yakui.z...@intel.com --- tests/Makefile.sources|1 + tests/gem_dummy_reloc_multi_bsd.c | 258 + I've meant that you add a new subtest to the existing gem_dummy_reloc test. With your patch here we essentially duplicate all the tests for the other rings. 2 files changed, 259 insertions(+) create mode 100644 tests/gem_dummy_reloc_multi_bsd.c diff --git a/tests/Makefile.sources b/tests/Makefile.sources index 254a5c5..98f277f 100644 --- a/tests/Makefile.sources +++ b/tests/Makefile.sources @@ -105,6 +105,7 @@ TESTS_progs = \ gem_ring_sync_copy \ gem_ring_sync_loop \ gem_multi_bsd_sync_loop \ + gem_dummy_reloc_multi_bsd \ Tests with subtests must be added to the TESTS_progs_M variable, otherwise piglit won't be able to enumerate the subtests. That's just an fyi for the next testcase, like I've said here it's imo better to just add a new subtest. Thanks for the rules about how to add the test with subtests.(Sorry that I don't know this rule) OK. I will follow your comment to add it as subtests. Thanks. Yakui Also you've forgotten to update .gitignore, when building with your patch git status shows some not-added binaries. -Daniel gem_seqno_wrap \ gem_set_tiling_vs_gtt \ gem_set_tiling_vs_pwrite \ diff --git a/tests/gem_dummy_reloc_multi_bsd.c b/tests/gem_dummy_reloc_multi_bsd.c new file mode 100644 index 000..ef8213e --- /dev/null +++ b/tests/gem_dummy_reloc_multi_bsd.c @@ -0,0 +1,258 @@ +/* + * Copyright © 2014 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the Software), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + *Daniel Vetter daniel.vet...@ffwll.ch (based on gem_dummy_reloc_loop*.c) + *Zhao Yakui yakui.z...@intel.com + * + */ + +#include stdlib.h +#include stdio.h +#include string.h +#include fcntl.h +#include inttypes.h +#include errno.h +#include sys/stat.h +#include sys/time.h +#include drm.h +#include ioctl_wrappers.h +#include drmtest.h +#include intel_bufmgr.h +#include intel_batchbuffer.h +#include intel_io.h +#include i830_reg.h +#include intel_chipset.h + +#define LOCAL_I915_EXEC_VEBOX (40) + +static drm_intel_bufmgr *bufmgr; +struct intel_batchbuffer *batch; +static drm_intel_bo *target_buffer; + +#define NUM_FD 50 + +static int mfd[NUM_FD]; +static drm_intel_bufmgr *mbufmgr[NUM_FD]; +static struct intel_batchbuffer *mbatch[NUM_FD]; +static drm_intel_bo *mbuffer[NUM_FD]; + + +/* + * Testcase: Basic check of ring-cpu sync using a dummy reloc under multi-fd + * + * The last test (that randomly switches the ring) seems to be pretty effective + * at hitting the missed irq bug that's worked around with the HWSTAM irq write. + */ + + +#define MI_COND_BATCH_BUFFER_END (0x3623 | 1) +#define MI_DO_COMPARE (121) +static void +dummy_reloc_loop(int ring) +{ + int i; + srandom(0xdeadbeef); + + for (i = 0; i 0x10; i++) { + int mindex = random() % NUM_FD; + + batch = mbatch[mindex]; + if (ring == I915_EXEC_RENDER) { + BEGIN_BATCH(4); + OUT_BATCH(MI_COND_BATCH_BUFFER_END | MI_DO_COMPARE); + OUT_BATCH(0x); /* compare dword */ +
Re: [Intel-gfx] [PATCH I-g-t 2/2] tests: Add dummy_reloc test case based on multi drm_fd to test CPU-GPU sync under multi BSD rings
On Mon, 2014-04-14 at 01:06 -0600, Daniel Vetter wrote: On Mon, Apr 14, 2014 at 12:19:58PM +0800, Zhao Yakui wrote: The Broadwell GT3 machine has two independent BSD rings in kernel driver while it is transparent to the user-space driver. In such case it needs to check the CPU-GPU sync for the second BSD ring. Multi drm_fd can assure that the second BSD ring has the opportunity to dispatch the GPU command. Signed-off-by: Zhao Yakui yakui.z...@intel.com --- tests/Makefile.sources|1 + tests/gem_dummy_reloc_multi_bsd.c | 258 + I've meant that you add a new subtest to the existing gem_dummy_reloc test. With your patch here we essentially duplicate all the tests for the other rings. 2 files changed, 259 insertions(+) create mode 100644 tests/gem_dummy_reloc_multi_bsd.c diff --git a/tests/Makefile.sources b/tests/Makefile.sources index 254a5c5..98f277f 100644 --- a/tests/Makefile.sources +++ b/tests/Makefile.sources @@ -105,6 +105,7 @@ TESTS_progs = \ gem_ring_sync_copy \ gem_ring_sync_loop \ gem_multi_bsd_sync_loop \ + gem_dummy_reloc_multi_bsd \ Tests with subtests must be added to the TESTS_progs_M variable, otherwise piglit won't be able to enumerate the subtests. That's just an fyi for the next testcase, like I've said here it's imo better to just add a new subtest. Thanks for the rules about how to add the test with subtests.(Sorry that I don't know this rule) OK. I will follow your comment to add it as subtests. Also you've forgotten to update .gitignore, when building with your patch git status shows some not-added binaries. BTW: How do I update the .gitigonre? In my test I usually use the following step to create the corresponding patches before sending and never update the .gitignore. a. use quilt tool to create it b. use git am to apply the corresponding patch on the working tree c. use git format-patch to get the corresponding patches that can be sent by using git-send-email Appreciate your helps. Thanks. Yakui -Daniel gem_seqno_wrap \ gem_set_tiling_vs_gtt \ gem_set_tiling_vs_pwrite \ diff --git a/tests/gem_dummy_reloc_multi_bsd.c b/tests/gem_dummy_reloc_multi_bsd.c new file mode 100644 index 000..ef8213e --- /dev/null +++ b/tests/gem_dummy_reloc_multi_bsd.c @@ -0,0 +1,258 @@ +/* + * Copyright © 2014 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the Software), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + *Daniel Vetter daniel.vet...@ffwll.ch (based on gem_dummy_reloc_loop*.c) + *Zhao Yakui yakui.z...@intel.com + * + */ + +#include stdlib.h +#include stdio.h +#include string.h +#include fcntl.h +#include inttypes.h +#include errno.h +#include sys/stat.h +#include sys/time.h +#include drm.h +#include ioctl_wrappers.h +#include drmtest.h +#include intel_bufmgr.h +#include intel_batchbuffer.h +#include intel_io.h +#include i830_reg.h +#include intel_chipset.h + +#define LOCAL_I915_EXEC_VEBOX (40) + +static drm_intel_bufmgr *bufmgr; +struct intel_batchbuffer *batch; +static drm_intel_bo *target_buffer; + +#define NUM_FD 50 + +static int mfd[NUM_FD]; +static drm_intel_bufmgr *mbufmgr[NUM_FD]; +static struct intel_batchbuffer *mbatch[NUM_FD]; +static drm_intel_bo *mbuffer[NUM_FD]; + + +/* + * Testcase: Basic check of ring-cpu sync using a dummy reloc under multi-fd + * + * The last test (that randomly switches the ring) seems to be pretty effective + * at hitting the missed irq bug that's worked around with the HWSTAM irq write. + */ + + +#define MI_COND_BATCH_BUFFER_END (0x3623 | 1) +#define MI_DO_COMPARE (121) +static void +dummy_reloc_loop(int ring) +{ +
Re: [Intel-gfx] [PATCH I-g-t 2/2] tests: Add dummy_reloc test case based on multi drm_fd to test CPU-GPU sync under multi BSD rings
On Mon, Apr 14, 2014 at 9:32 AM, Zhao Yakui yakui.z...@intel.com wrote: BTW: How do I update the .gitigonre? In my test I usually use the following step to create the corresponding patches before sending and never update the .gitignore. a. use quilt tool to create it b. use git am to apply the corresponding patch on the working tree c. use git format-patch to get the corresponding patches that can be sent by using git-send-email It's a normal file in the corresponding directory. You can just edit it and add it to the patch. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH I-g-t 2/2] tests: Add dummy_reloc test case based on multi drm_fd to test CPU-GPU sync under multi BSD rings
On Mon, 2014-04-14 at 01:55 -0600, Daniel Vetter wrote: On Mon, Apr 14, 2014 at 9:32 AM, Zhao Yakui yakui.z...@intel.com wrote: BTW: How do I update the .gitigonre? In my test I usually use the following step to create the corresponding patches before sending and never update the .gitignore. a. use quilt tool to create it b. use git am to apply the corresponding patch on the working tree c. use git format-patch to get the corresponding patches that can be sent by using git-send-email It's a normal file in the corresponding directory. You can just edit it and add it to the patch. Thanks. Yakui -Daniel ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH I-g-t 2/2] tests: Add dummy_reloc test case based on multi drm_fd to test CPU-GPU sync under multi BSD rings
The Broadwell GT3 machine has two independent BSD rings in kernel driver while it is transparent to the user-space driver. In such case it needs to check the CPU-GPU sync for the second BSD ring. Multi drm_fd can assure that the second BSD ring has the opportunity to dispatch the GPU command. Signed-off-by: Zhao Yakui yakui.z...@intel.com --- tests/Makefile.sources|1 + tests/gem_dummy_reloc_multi_bsd.c | 258 + 2 files changed, 259 insertions(+) create mode 100644 tests/gem_dummy_reloc_multi_bsd.c diff --git a/tests/Makefile.sources b/tests/Makefile.sources index 254a5c5..98f277f 100644 --- a/tests/Makefile.sources +++ b/tests/Makefile.sources @@ -105,6 +105,7 @@ TESTS_progs = \ gem_ring_sync_copy \ gem_ring_sync_loop \ gem_multi_bsd_sync_loop \ + gem_dummy_reloc_multi_bsd \ gem_seqno_wrap \ gem_set_tiling_vs_gtt \ gem_set_tiling_vs_pwrite \ diff --git a/tests/gem_dummy_reloc_multi_bsd.c b/tests/gem_dummy_reloc_multi_bsd.c new file mode 100644 index 000..ef8213e --- /dev/null +++ b/tests/gem_dummy_reloc_multi_bsd.c @@ -0,0 +1,258 @@ +/* + * Copyright © 2014 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the Software), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + *Daniel Vetter daniel.vet...@ffwll.ch (based on gem_dummy_reloc_loop*.c) + *Zhao Yakui yakui.z...@intel.com + * + */ + +#include stdlib.h +#include stdio.h +#include string.h +#include fcntl.h +#include inttypes.h +#include errno.h +#include sys/stat.h +#include sys/time.h +#include drm.h +#include ioctl_wrappers.h +#include drmtest.h +#include intel_bufmgr.h +#include intel_batchbuffer.h +#include intel_io.h +#include i830_reg.h +#include intel_chipset.h + +#define LOCAL_I915_EXEC_VEBOX (40) + +static drm_intel_bufmgr *bufmgr; +struct intel_batchbuffer *batch; +static drm_intel_bo *target_buffer; + +#define NUM_FD 50 + +static int mfd[NUM_FD]; +static drm_intel_bufmgr *mbufmgr[NUM_FD]; +static struct intel_batchbuffer *mbatch[NUM_FD]; +static drm_intel_bo *mbuffer[NUM_FD]; + + +/* + * Testcase: Basic check of ring-cpu sync using a dummy reloc under multi-fd + * + * The last test (that randomly switches the ring) seems to be pretty effective + * at hitting the missed irq bug that's worked around with the HWSTAM irq write. + */ + + +#define MI_COND_BATCH_BUFFER_END (0x3623 | 1) +#define MI_DO_COMPARE (121) +static void +dummy_reloc_loop(int ring) +{ + int i; + srandom(0xdeadbeef); + + for (i = 0; i 0x10; i++) { + int mindex = random() % NUM_FD; + + batch = mbatch[mindex]; + if (ring == I915_EXEC_RENDER) { + BEGIN_BATCH(4); + OUT_BATCH(MI_COND_BATCH_BUFFER_END | MI_DO_COMPARE); + OUT_BATCH(0x); /* compare dword */ + OUT_RELOC(mbuffer[mindex], I915_GEM_DOMAIN_RENDER, + I915_GEM_DOMAIN_RENDER, 0); + OUT_BATCH(MI_NOOP); + ADVANCE_BATCH(); + } else { + BEGIN_BATCH(4); + OUT_BATCH(MI_FLUSH_DW | 1); + OUT_RELOC(mbuffer[mindex], I915_GEM_DOMAIN_RENDER, + I915_GEM_DOMAIN_RENDER, 0); + OUT_BATCH(0); /* reserved */ + OUT_BATCH(MI_NOOP | (122) | (0xf)); + ADVANCE_BATCH(); + } + intel_batchbuffer_flush_on_ring(batch, ring); + + drm_intel_bo_map(target_buffer, 0); + // map to force completion + drm_intel_bo_unmap(target_buffer); + } +} + +static void +dummy_reloc_loop_random_ring(int num_rings) +{ + int i; + + srandom(0xdeadbeef); + + for (i = 0; i 0x10; i++) { +