summaryrefslogtreecommitdiff
path: root/new.c
diff options
context:
space:
mode:
authorJérôme Glisse <jglisse@redhat.com>2017-09-05 14:55:09 -0400
committerJérôme Glisse <jglisse@redhat.com>2017-09-05 14:55:09 -0400
commite6a27ea4768202292070ab9495fd086aad9e3380 (patch)
treeb4784d7c0d6137d0af29e7fad9845cc50f9193c1 /new.c
parentca39394948c9f78f330c35cc4ba30acd6df8c2ed (diff)
compote: add simple test shader to trigger page faultHEADmaster
Simple shader that write the thread x id to buffer[threadid.x] ie pseudo code: buffer[threadid.x] = threadid.x; In the old way the buffer is allocated with regular GPU memory allocation and everything is pin while in the new way this is simply malloc memory and the GPU might trigger a page fault if there is no page backing the buffer addresses yet. Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
Diffstat (limited to 'new.c')
-rw-r--r--new.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/new.c b/new.c
index f066ad9..cee2f20 100644
--- a/new.c
+++ b/new.c
@@ -32,6 +32,7 @@ int main(int argc, char *argv[])
{
compote_context_t *ctx;
compote_mo_t *mo;
+ void *dst;
int ret;
ret = compote_context_new(&ctx);
@@ -39,11 +40,18 @@ int main(int argc, char *argv[])
return ret;
}
- ret = compote_mo_new(ctx, &mo, 64 << 10);
+ ret = compote_mo_new(ctx, &mo, 32 << 20);
if (ret) {
goto out;
}
+ dst = malloc_below40(4 << 20);
+ if (dst == NULL) {
+ ret = -ENOMEM;
+ goto out;
+ }
+ printf("dst addr %p\n", dst);
+
{
uint32_t *ptr = mo->ptr;
uint32_t *sem = &ptr[128 >> 2];
@@ -67,6 +75,10 @@ int main(int argc, char *argv[])
printf("[%4d] = 0x%08x 0x%08x 0x%08x\n", 128 >> 2, sem[0], sem[1], sem[2]);
}
+ ret = test_compute(ctx, mo->ptr, dst, 1024);
+ if (ret)
+ goto out;
+
printf("La compote c'est bon !\n");
out: