xf86-video-intel: 3 commits - src/sna/sna_dri2.c src/uxa/intel_display.c src/uxa/intel_uxa.c test/lowlevel-blt-bench.c

Chris Wilson ickle at kemper.freedesktop.org
Fri Jun 27 08:29:57 PDT 2014


 src/sna/sna_dri2.c        |    4 -
 src/uxa/intel_display.c   |    5 -
 src/uxa/intel_uxa.c       |   32 +++++---
 test/lowlevel-blt-bench.c |  181 ++++++++++++++++++++++++++++++++++++++++------
 4 files changed, 187 insertions(+), 35 deletions(-)

New commits:
commit 72c041e57b99367f327c51c50fce2a55d618fc63
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Jun 27 16:26:24 2014 +0100

    uxa: Update Screen Pixmap width/height first
    
    Since commit dd6db82680b05cde4a47116b7096c054f3837e20 [2.99.912]
    Author: Chris Wilson <chris at chris-wilson.co.uk>
    Date:   Fri May 9 20:26:19 2014 +0100
    
        uxa: Add DRI3 and miSyncShm support
    
    we verify that the attaching bo meets the constraints required for the
    Pixmap. However, when updating the ScreenPixmap following a resize, we
    did not update the Pixmap size until after we tried to update the bo,
    resulting in a validation failure when shrinking the screen.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/uxa/intel_display.c b/src/uxa/intel_display.c
index a745dc5..0b83140 100644
--- a/src/uxa/intel_display.c
+++ b/src/uxa/intel_display.c
@@ -1461,6 +1461,9 @@ intel_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 	scrn->virtualX = width;
 	scrn->virtualY = height;
 
+	if (!intel_uxa_create_screen_resources(scrn->pScreen))
+		goto fail;
+
 	for (i = 0; i < xf86_config->num_crtc; i++) {
 		xf86CrtcPtr crtc = xf86_config->crtc[i];
 
@@ -1471,8 +1474,6 @@ intel_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 			goto fail;
 	}
 
-	intel_uxa_create_screen_resources(scrn->pScreen);
-
 	if (old_fb_id)
 		drmModeRmFB(mode->fd, old_fb_id);
 	if (old_front)
diff --git a/src/uxa/intel_uxa.c b/src/uxa/intel_uxa.c
index 5b037f1..b396188 100644
--- a/src/uxa/intel_uxa.c
+++ b/src/uxa/intel_uxa.c
@@ -1260,6 +1260,7 @@ Bool intel_uxa_create_screen_resources(ScreenPtr screen)
 	PixmapPtr pixmap;
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 	dri_bo *bo = intel->front_buffer;
+	int old_width, old_height, old_pitch;
 
 	if (!uxa_resources_init(screen))
 		return FALSE;
@@ -1268,23 +1269,34 @@ Bool intel_uxa_create_screen_resources(ScreenPtr screen)
 		return FALSE;
 
 	pixmap = screen->GetScreenPixmap(screen);
+	old_width = pixmap->drawable.width;
+	old_height = pixmap->drawable.height;
+	old_pitch = pixmap->devKind;
+
+	if (!screen->ModifyPixmapHeader(pixmap,
+					scrn->virtualX,
+					scrn->virtualY,
+					-1, -1,
+					intel->front_pitch,
+					NULL))
+		return FALSE;
+
 	intel_set_pixmap_bo(pixmap, bo);
 	if (intel_get_pixmap_private(pixmap) == NULL)
-		return FALSE;
+		goto err;
+
+	if (!intel_glamor_create_screen_resources(screen))
+		goto err;
 
 	intel_get_pixmap_private(pixmap)->pinned |= PIN_SCANOUT;
-	screen->ModifyPixmapHeader(pixmap,
-				   scrn->virtualX,
-				   scrn->virtualY,
-				   -1, -1,
-				   intel->front_pitch,
-				   NULL);
 	scrn->displayWidth = intel->front_pitch / intel->cpp;
 
-	if (!intel_glamor_create_screen_resources(screen))
-		return FALSE;
-
 	return TRUE;
+
+err:
+	screen->ModifyPixmapHeader(pixmap,
+				   old_width, old_height, -1, -1, old_pitch, NULL);
+	return FALSE;
 }
 
 #ifdef CREATE_PIXMAP_USAGE_SHARED
commit 0584604b53c8676adfa1f8f4d3def22c93ea822f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Jun 27 16:12:35 2014 +0100

    test: Expand number of sources for basic benchmarking
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/test/lowlevel-blt-bench.c b/test/lowlevel-blt-bench.c
index 3593014..91af827 100644
--- a/test/lowlevel-blt-bench.c
+++ b/test/lowlevel-blt-bench.c
@@ -65,13 +65,161 @@ static const struct op {
 	[PictOpSaturate] = { "Saturate" },
 };
 
+static Picture source_pixmap(struct test_display *t, struct test_target *target, int format)
+{
+	XRenderColor render_color = { 0x8000, 0x8000, 0x8000, 0x8000 };
+	Pixmap pixmap;
+	Picture picture;
+
+	pixmap = XCreatePixmap(t->dpy, t->root,
+			       target->width, target->height,
+			       PIXMAN_FORMAT_DEPTH(formats[format].pixman_format));
+
+	picture = XRenderCreatePicture(t->dpy, pixmap,
+				       XRenderFindStandardFormat(t->dpy, format),
+				       0, NULL);
+	XFreePixmap(t->dpy, pixmap);
+
+	XRenderFillRectangle(t->dpy, PictOpSrc, picture, &render_color,
+			     0, 0, target->width, target->height);
+
+	return picture;
+}
+
+static Picture source_a8r8g8b8(struct test_display *t, struct test_target *target)
+{
+	return source_pixmap(t, target, 0);
+}
+
+static Picture source_x8r8g8b8(struct test_display *t, struct test_target *target)
+{
+	return source_pixmap(t, target, 1);
+}
+
+static Picture source_a8(struct test_display *t, struct test_target *target)
+{
+	return source_pixmap(t, target, 2);
+}
+
+static Picture source_a4(struct test_display *t, struct test_target *target)
+{
+	return source_pixmap(t, target, 3);
+}
+
+static Picture source_a1(struct test_display *t, struct test_target *target)
+{
+	return source_pixmap(t, target, 3);
+}
+
+static Picture source_1x1r(struct test_display *t, struct test_target *target)
+{
+	XRenderColor render_color = { 0x8000, 0x8000, 0x8000, 0x8000 };
+	XRenderPictureAttributes pa;
+	Pixmap pixmap;
+	Picture picture;
+
+	pa.repeat = RepeatNormal;
+
+	pixmap = XCreatePixmap(t->dpy, t->root, 1, 1, 32);
+	picture = XRenderCreatePicture(t->dpy, pixmap,
+				       XRenderFindStandardFormat(t->dpy, 0),
+				       CPRepeat, &pa);
+	XFreePixmap(t->dpy, pixmap);
+
+	XRenderFillRectangle(t->dpy, PictOpSrc, picture, &render_color,
+			     0, 0, 1, 1);
+
+	return picture;
+}
+
+static Picture source_solid(struct test_display *t, struct test_target *target)
+{
+	XRenderColor render_color = { 0x8000, 0x8000, 0x8000, 0x8000 };
+	return XRenderCreateSolidFill(t->dpy, &render_color);
+}
+
+static Picture source_linear_horizontal(struct test_display *t, struct test_target *target)
+{
+	XRenderColor colors[2] = {{0}, {0xffff, 0xffff, 0xffff, 0xffff}};
+	XFixed stops[2] = {0, 0xffff};
+	XLinearGradient gradient = { {0, 0}, {target->width << 16, 0}};
+
+	return XRenderCreateLinearGradient(t->dpy, &gradient, stops, colors, 2);
+}
+
+static Picture source_linear_vertical(struct test_display *t, struct test_target *target)
+{
+	XRenderColor colors[2] = {{0}, {0xffff, 0xffff, 0xffff, 0xffff}};
+	XFixed stops[2] = {0, 0xffff};
+	XLinearGradient gradient = { {0, 0}, {0, target->height << 16}};
+
+	return XRenderCreateLinearGradient(t->dpy, &gradient, stops, colors, 2);
+}
+
+static Picture source_linear_diagonal(struct test_display *t, struct test_target *target)
+{
+	XRenderColor colors[2] = {{0}, {0xffff, 0xffff, 0xffff, 0xffff}};
+	XFixed stops[2] = {0, 0xffff};
+	XLinearGradient gradient = { {0, 0}, {target->width << 16, target->height << 16}};
+
+	return XRenderCreateLinearGradient(t->dpy, &gradient, stops, colors, 2);
+}
+
+static Picture source_radial_concentric(struct test_display *t, struct test_target *target)
+{
+	XRenderColor colors[2] = {{0}, {0xffff, 0xffff, 0xffff, 0xffff}};
+	XFixed stops[2] = {0, 0xffff};
+	XRadialGradient gradient = {
+		{
+			((target->width << 16) + 1) / 2,
+			((target->height << 16) + 1) / 2,
+			0,
+		},
+		{
+			((target->width << 16) + 1) / 2,
+			((target->height << 16) + 1) / 2,
+			target->width << 15,
+		}
+	};
+
+	return XRenderCreateRadialGradient(t->dpy, &gradient, stops, colors, 2);
+}
+
+static Picture source_radial_generic(struct test_display *t, struct test_target *target)
+{
+	XRenderColor colors[2] = {{0}, {0xffff, 0xffff, 0xffff, 0xffff}};
+	XFixed stops[2] = {0, 0xffff};
+	XRadialGradient gradient = {
+		{ 0, 0, target->width << 14, },
+		{ target->width << 16, target->height << 16, target->width << 14, }
+	};
+
+	return XRenderCreateRadialGradient(t->dpy, &gradient, stops, colors, 2);
+}
+
+static const struct {
+	Picture (*create)(struct test_display *, struct test_target *);
+	const char *name;
+} source[] = {
+	{ source_a8r8g8b8, "a8r8g8b8 pixmap" },
+	{ source_x8r8g8b8, "x8r8g8b8 pixmap" },
+	{ source_a8, "a8 pixmap" },
+	{ source_a4, "a4 pixmap" },
+	{ source_a1, "a1 pixmap" },
+	{ source_1x1r, "a8r8g8b8 1x1R pixmap" },
+	{ source_solid, "solid" },
+	{ source_linear_horizontal, "linear (horizontal gradient)" },
+	{ source_linear_vertical, "linear (vertical gradient)" },
+	{ source_linear_diagonal, "linear (diagonal gradient)" },
+	{ source_radial_concentric, "radial (concentric)" },
+	{ source_radial_generic, "radial (generic)" },
+};
+
 static double _bench(struct test_display *t, enum target target_type,
-		     int op, int src_format,
-		     int loops)
+		     int op, int src, int loops)
 {
 	XRenderColor render_color = { 0x8000, 0x8000, 0x8000, 0x8000 };
 	struct test_target target;
-	Pixmap pixmap;
 	Picture picture;
 	struct timespec tv;
 	double elapsed;
@@ -80,15 +228,7 @@ static double _bench(struct test_display *t, enum target target_type,
 	XRenderFillRectangle(t->dpy, PictOpClear, target.picture, &render_color,
 			     0, 0, target.width, target.height);
 
-	pixmap = XCreatePixmap(t->dpy, t->root,
-			       target.width, target.height,
-			       PIXMAN_FORMAT_DEPTH(formats[src_format].pixman_format));
-
-	picture = XRenderCreatePicture(t->dpy, pixmap,
-				       XRenderFindStandardFormat(t->dpy, src_format),
-				       0, NULL);
-	XRenderFillRectangle(t->dpy, PictOpSrc, picture, &render_color,
-			     0, 0, target.width, target.height);
+	picture = source[src].create(t, &target);
 
 	test_timer_start(t, &tv);
 	while (loops--)
@@ -101,33 +241,32 @@ static double _bench(struct test_display *t, enum target target_type,
 	elapsed = test_timer_stop(t, &tv);
 
 	XRenderFreePicture(t->dpy, picture);
-	XFreePixmap(t->dpy, pixmap);
 	test_target_destroy_render(t, &target);
 
 	return elapsed;
 }
 
-static void bench(struct test *t, enum target target, int op, int sf)
+static void bench(struct test *t, enum target target, int op, int src)
 {
 	double out, ref;
 
-	ref = _bench(&t->ref, target, op, sf, 1000);
-	out = _bench(&t->out, target, op, sf, 1000);
+	ref = _bench(&t->ref, target, op, src, 1000);
+	out = _bench(&t->out, target, op, src, 1000);
 
-	fprintf (stdout, "Testing %s with %s: ref=%f, out=%f\n",
-		 formats[sf].name, ops[op].name, ref, out);
+	fprintf (stdout, "%28s with %s: ref=%f, out=%f\n",
+		 source[src].name, ops[op].name, ref, out);
 }
 
 int main(int argc, char **argv)
 {
 	struct test test;
-	unsigned op, sf;
+	unsigned op, src;
 
 	test_init(&test, argc, argv);
 
 	for (op = 0; op < sizeof(ops)/sizeof(ops[0]); op++) {
-		for (sf = 0; sf < sizeof(formats)/sizeof(formats[0]); sf++)
-			bench(&test, ROOT, op, sf);
+		for (src = 0; src < sizeof(source)/sizeof(source[0]); src++)
+			bench(&test, ROOT, op, src);
 		fprintf (stdout, "\n");
 	}
 
commit edd2b789568b14c29a004a64b6ff82bb6e4e9620
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Jun 27 16:00:03 2014 +0100

    sna/dri2: DBG compile fixes
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index c6327ee..80429eb 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -1200,7 +1200,7 @@ sna_dri2_remove_event(WindowPtr win, struct sna_dri2_event *info)
 
 	assert(win->drawable.type == DRAWABLE_WINDOW);
 	DBG(("%s: remove[%p] from window %ld, active? %d\n",
-	     __FUNCTION__, info, (long)win->drawable.id, info->darw != NULL));
+	     __FUNCTION__, info, (long)win->drawable.id, info->draw != NULL));
 
 	priv = dri2_window(win);
 	assert(priv);
@@ -1267,7 +1267,7 @@ sna_dri2_client_gone(CallbackListPtr *list, void *closure, void *data)
 	if (client->clientState != ClientStateGone)
 		return;
 
-	DBG(("%s(active?=%d)\n", __FUNCTION__
+	DBG(("%s(active?=%d)\n", __FUNCTION__,
 	     !list_is_empty(&priv->events)));
 
 	while (!list_is_empty(&priv->events)) {


More information about the xorg-commit mailing list