diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-07-02 09:16:07 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-07-02 12:55:34 +0100 |
commit | 710bb0d37c681f2ffdeaf263b6ee7d9488670bc0 (patch) | |
tree | ce3db25b0bd780fcda07313b8c329ade60139aff | |
parent | 87e659b887f4c738cfc91439efdac0d48fd294f0 (diff) |
test: Create separate SHM segments for ref/out
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | test/lowlevel-blt-bench.c | 19 | ||||
-rw-r--r-- | test/test.h | 1 | ||||
-rw-r--r-- | test/test_display.c | 2 |
3 files changed, 15 insertions, 7 deletions
diff --git a/test/lowlevel-blt-bench.c b/test/lowlevel-blt-bench.c index 63f6815e..99b96c03 100644 --- a/test/lowlevel-blt-bench.c +++ b/test/lowlevel-blt-bench.c @@ -218,10 +218,11 @@ static Picture source_radial_generic(struct test_display *t, struct test_target return XRenderCreateRadialGradient(t->dpy, &gradient, stops, colors, 2); } -static XShmSegmentInfo shm; +static XShmSegmentInfo shmref, shmout; static void setup_shm(struct test *t) { + XShmSegmentInfo shm; int size; shm.shmid = -1; @@ -244,24 +245,28 @@ static void setup_shm(struct test *t) } shm.readOnly = False; - XShmAttach(t->ref.dpy, &shm); + + shmref = shm; + XShmAttach(t->ref.dpy, &shmref); XSync(t->ref.dpy, True); - XShmAttach(t->out.dpy, &shm); + shmout = shm; + XShmAttach(t->out.dpy, &shmout); XSync(t->out.dpy, True); } static Picture source_shm(struct test_display *t, struct test_target *target) { + XShmSegmentInfo *shm = t->target == REF ? &shmref : &shmout; Pixmap pixmap; Picture picture; int size; - if (shm.shmid == -1) + if (shm->shmid == -1) return 0; pixmap = XShmCreatePixmap(t->dpy, t->root, - shm.shmaddr, &shm, + shm->shmaddr, shm, target->width, target->height, 32); picture = XRenderCreatePicture(t->dpy, pixmap, @@ -270,8 +275,8 @@ static Picture source_shm(struct test_display *t, struct test_target *target) XFreePixmap(t->dpy, pixmap); size = target->width * target->height * 4; - memset(shm.shmaddr, 0x80, size/2); - memset(shm.shmaddr+size/2, 0xff, size/2); + memset(shm->shmaddr, 0x80, size/2); + memset(shm->shmaddr+size/2, 0xff, size/2); return picture; } diff --git a/test/test.h b/test/test.h index bf0e5e68..a3ef979d 100644 --- a/test/test.h +++ b/test/test.h @@ -34,6 +34,7 @@ struct test { int has_shm_pixmaps; int width, height, depth; XRenderPictFormat *format; + enum { REF, OUT } target; } out, ref; }; diff --git a/test/test_display.c b/test/test_display.c index d5a8a028..98ee4e82 100644 --- a/test/test_display.c +++ b/test/test_display.c @@ -136,11 +136,13 @@ static void test_get_displays(int argc, char **argv, default_setup(out); shm_setup(out); out->root = get_root(out); + out->target = OUT; ref->dpy = ref_display(out->width, out->height, out->depth); default_setup(ref); shm_setup(ref); ref->root = get_root(ref); + ref->target = REF; } void test_init(struct test *test, int argc, char **argv) |