mirror of
https://github.com/X11Libre/xf86-video-intel.git
synced 2026-03-24 01:24:12 +00:00
test: Create separate SHM segments for ref/out
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
@@ -218,10 +218,11 @@ static Picture source_radial_generic(struct test_display *t, struct test_target
|
|||||||
return XRenderCreateRadialGradient(t->dpy, &gradient, stops, colors, 2);
|
return XRenderCreateRadialGradient(t->dpy, &gradient, stops, colors, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static XShmSegmentInfo shm;
|
static XShmSegmentInfo shmref, shmout;
|
||||||
|
|
||||||
static void setup_shm(struct test *t)
|
static void setup_shm(struct test *t)
|
||||||
{
|
{
|
||||||
|
XShmSegmentInfo shm;
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
shm.shmid = -1;
|
shm.shmid = -1;
|
||||||
@@ -244,24 +245,28 @@ static void setup_shm(struct test *t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
shm.readOnly = False;
|
shm.readOnly = False;
|
||||||
XShmAttach(t->ref.dpy, &shm);
|
|
||||||
|
shmref = shm;
|
||||||
|
XShmAttach(t->ref.dpy, &shmref);
|
||||||
XSync(t->ref.dpy, True);
|
XSync(t->ref.dpy, True);
|
||||||
|
|
||||||
XShmAttach(t->out.dpy, &shm);
|
shmout = shm;
|
||||||
|
XShmAttach(t->out.dpy, &shmout);
|
||||||
XSync(t->out.dpy, True);
|
XSync(t->out.dpy, True);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Picture source_shm(struct test_display *t, struct test_target *target)
|
static Picture source_shm(struct test_display *t, struct test_target *target)
|
||||||
{
|
{
|
||||||
|
XShmSegmentInfo *shm = t->target == REF ? &shmref : &shmout;
|
||||||
Pixmap pixmap;
|
Pixmap pixmap;
|
||||||
Picture picture;
|
Picture picture;
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
if (shm.shmid == -1)
|
if (shm->shmid == -1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pixmap = XShmCreatePixmap(t->dpy, t->root,
|
pixmap = XShmCreatePixmap(t->dpy, t->root,
|
||||||
shm.shmaddr, &shm,
|
shm->shmaddr, shm,
|
||||||
target->width, target->height, 32);
|
target->width, target->height, 32);
|
||||||
|
|
||||||
picture = XRenderCreatePicture(t->dpy, pixmap,
|
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);
|
XFreePixmap(t->dpy, pixmap);
|
||||||
|
|
||||||
size = target->width * target->height * 4;
|
size = target->width * target->height * 4;
|
||||||
memset(shm.shmaddr, 0x80, size/2);
|
memset(shm->shmaddr, 0x80, size/2);
|
||||||
memset(shm.shmaddr+size/2, 0xff, size/2);
|
memset(shm->shmaddr+size/2, 0xff, size/2);
|
||||||
|
|
||||||
return picture;
|
return picture;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ struct test {
|
|||||||
int has_shm_pixmaps;
|
int has_shm_pixmaps;
|
||||||
int width, height, depth;
|
int width, height, depth;
|
||||||
XRenderPictFormat *format;
|
XRenderPictFormat *format;
|
||||||
|
enum { REF, OUT } target;
|
||||||
} out, ref;
|
} out, ref;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -136,11 +136,13 @@ static void test_get_displays(int argc, char **argv,
|
|||||||
default_setup(out);
|
default_setup(out);
|
||||||
shm_setup(out);
|
shm_setup(out);
|
||||||
out->root = get_root(out);
|
out->root = get_root(out);
|
||||||
|
out->target = OUT;
|
||||||
|
|
||||||
ref->dpy = ref_display(out->width, out->height, out->depth);
|
ref->dpy = ref_display(out->width, out->height, out->depth);
|
||||||
default_setup(ref);
|
default_setup(ref);
|
||||||
shm_setup(ref);
|
shm_setup(ref);
|
||||||
ref->root = get_root(ref);
|
ref->root = get_root(ref);
|
||||||
|
ref->target = REF;
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_init(struct test *test, int argc, char **argv)
|
void test_init(struct test *test, int argc, char **argv)
|
||||||
|
|||||||
Reference in New Issue
Block a user