summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-03-30 19:17:12 -0700
committerEric Anholt <eric@anholt.net>2009-03-31 10:01:07 -0700
commitcb5a35fe8ebe959291082a15395a619b40c562a7 (patch)
tree5366711bcd968bd43f2f1bb3a81eb669ed47ddde
parent7889abd2631b418d4bb9fb90a758f23f37d2f098 (diff)
Add a couple of other intel_upload_blit_large variants for comparison.
-rw-r--r--.gitignore2
-rw-r--r--benchmarks/Makefile.am4
-rw-r--r--benchmarks/intel_upload_blit_large.c2
-rw-r--r--benchmarks/intel_upload_blit_large_gtt.c160
-rw-r--r--benchmarks/intel_upload_blit_large_map.c163
-rw-r--r--configure.ac2
6 files changed, 332 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index d3f3d3ab7..9b7742c28 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,6 +29,8 @@ shave-libtool
stamp-h1
cscope.*
benchmarks/intel_upload_blit_large
+benchmarks/intel_upload_blit_large_gtt
+benchmarks/intel_upload_blit_large_map
benchmarks/intel_upload_blit_small
tests/getclient
tests/getstats
diff --git a/benchmarks/Makefile.am b/benchmarks/Makefile.am
index 91f907b16..3196b2c24 100644
--- a/benchmarks/Makefile.am
+++ b/benchmarks/Makefile.am
@@ -1,5 +1,7 @@
bin_PROGRAMS = \
intel_upload_blit_large \
+ intel_upload_blit_large_gtt \
+ intel_upload_blit_large_map \
intel_upload_blit_small
BENCHMARK_LIBS = \
@@ -7,6 +9,8 @@ BENCHMARK_LIBS = \
$(DRM_LIBS)
intel_upload_blit_large_LDADD = $(BENCHMARK_LIBS)
+intel_upload_blit_large_gtt_LDADD = $(BENCHMARK_LIBS)
+intel_upload_blit_large_map_LDADD = $(BENCHMARK_LIBS)
intel_upload_blit_small_LDADD = $(BENCHMARK_LIBS)
AM_CFLAGS = $(DRM_CFLAGS) $(WARN_CFLAGS) \
diff --git a/benchmarks/intel_upload_blit_large.c b/benchmarks/intel_upload_blit_large.c
index aec19c444..b3581d438 100644
--- a/benchmarks/intel_upload_blit_large.c
+++ b/benchmarks/intel_upload_blit_large.c
@@ -40,6 +40,8 @@
* Additionally, those applications should be rendering at the screen refresh
* rate, while this test has no limits, and so can get itself into the
* working set larger than aperture size performance disaster.
+ *
+ * The current workload doing this path is pixmap upload for non-KMS.
*/
#include <stdlib.h>
diff --git a/benchmarks/intel_upload_blit_large_gtt.c b/benchmarks/intel_upload_blit_large_gtt.c
new file mode 100644
index 000000000..39463019d
--- /dev/null
+++ b/benchmarks/intel_upload_blit_large_gtt.c
@@ -0,0 +1,160 @@
+/*
+ * Copyright © 2009 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:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+/**
+ * Roughly simulates repeatedly uploading frames of images, by uploading
+ * the data all at once with pwrite, and then blitting it to another buffer.
+ *
+ * You might think of this like a movie player, but that wouldn't be entirely
+ * accurate, since the access patterns of the memory would be different
+ * (generally, smaller source image, upscaled, an thus different memory access
+ * pattern in both texel fetch for the stretching and the destination writes).
+ * However, some things like swfdec would be doing something like this since
+ * they compute their data in host memory and upload the full sw rendered
+ * frame.
+ *
+ * Additionally, those applications should be rendering at the screen refresh
+ * rate, while this test has no limits, and so can get itself into the
+ * working set larger than aperture size performance disaster.
+ *
+ * The current workload doing this path is pixmap upload in 2D with KMS.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include "drm.h"
+#include "i915_drm.h"
+#include "drmtest.h"
+#include "intel_bufmgr.h"
+#include "intel_batchbuffer.h"
+
+#define OBJECT_WIDTH 1280
+#define OBJECT_HEIGHT 720
+
+static double
+get_time_in_secs(void)
+{
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
+
+ return (double)tv.tv_sec + tv.tv_usec / 1000000.0;
+}
+
+static void
+do_render(drm_intel_bufmgr *bufmgr, struct intel_batchbuffer *batch,
+ drm_intel_bo *dst_bo, int width, int height)
+{
+ uint32_t *data;
+ drm_intel_bo *src_bo;
+ int i;
+ static uint32_t seed = 1;
+
+ src_bo = drm_intel_bo_alloc(bufmgr, "src", width * height * 4, 4096);
+
+ drm_intel_gem_bo_map_gtt(src_bo);
+
+ data = src_bo->virtual;
+ for (i = 0; i < width * height; i++) {
+ data[i] = seed++;
+ }
+
+ drm_intel_gem_bo_unmap_gtt(src_bo);
+
+ /* Render the junk to the dst. */
+ BEGIN_BATCH(8);
+ OUT_BATCH(XY_SRC_COPY_BLT_CMD |
+ XY_SRC_COPY_BLT_WRITE_ALPHA |
+ XY_SRC_COPY_BLT_WRITE_RGB);
+ OUT_BATCH((3 << 24) | /* 32 bits */
+ (0xcc << 16) | /* copy ROP */
+ (width * 4) /* dst pitch */);
+ OUT_BATCH(0); /* dst x1,y1 */
+ OUT_BATCH((height << 16) | width); /* dst x2,y2 */
+ OUT_RELOC(dst_bo, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, 0);
+ OUT_BATCH(0); /* src x1,y1 */
+ OUT_BATCH(width * 4); /* src pitch */
+ OUT_RELOC(src_bo, I915_GEM_DOMAIN_RENDER, 0, 0);
+ ADVANCE_BATCH();
+
+ intel_batchbuffer_flush(batch);
+
+ drm_intel_bo_unreference(src_bo);
+}
+
+int main(int argc, char **argv)
+{
+ int fd;
+ int object_size = OBJECT_WIDTH * OBJECT_HEIGHT * 4;
+ double start_time, end_time;
+ drm_intel_bo *dst_bo;
+ drm_intel_bufmgr *bufmgr;
+ struct intel_batchbuffer *batch;
+ int i;
+
+ fd = drm_open_any();
+
+ bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
+ drm_intel_bufmgr_gem_enable_reuse(bufmgr);
+
+ batch = intel_batchbuffer_alloc(bufmgr);
+
+ dst_bo = drm_intel_bo_alloc(bufmgr, "dst", object_size, 4096);
+
+ /* Prep loop to get us warmed up. */
+ for (i = 0; i < 60; i++) {
+ do_render(bufmgr, batch, dst_bo, OBJECT_WIDTH, OBJECT_HEIGHT);
+ }
+ drm_intel_bo_wait_rendering(dst_bo);
+
+ /* Do the actual timing. */
+ start_time = get_time_in_secs();
+ for (i = 0; i < 200; i++) {
+ do_render(bufmgr, batch, dst_bo, OBJECT_WIDTH, OBJECT_HEIGHT);
+ }
+ drm_intel_bo_wait_rendering(dst_bo);
+ end_time = get_time_in_secs();
+
+ printf("%d iterations in %.03f secs: %.01f MB/sec\n", i,
+ end_time - start_time,
+ (double)i * OBJECT_WIDTH * OBJECT_HEIGHT * 4 / 1024.0 / 1024.0 /
+ (end_time - start_time));
+
+ intel_batchbuffer_free(batch);
+ drm_intel_bufmgr_destroy(bufmgr);
+
+ close(fd);
+
+ return 0;
+}
diff --git a/benchmarks/intel_upload_blit_large_map.c b/benchmarks/intel_upload_blit_large_map.c
new file mode 100644
index 000000000..8a508392b
--- /dev/null
+++ b/benchmarks/intel_upload_blit_large_map.c
@@ -0,0 +1,163 @@
+/*
+ * Copyright © 2009 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:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+/**
+ * Roughly simulates repeatedly uploading frames of images, by uploading
+ * the data all at once with pwrite, and then blitting it to another buffer.
+ *
+ * You might think of this like a movie player, but that wouldn't be entirely
+ * accurate, since the access patterns of the memory would be different
+ * (generally, smaller source image, upscaled, an thus different memory access
+ * pattern in both texel fetch for the stretching and the destination writes).
+ * However, some things like swfdec would be doing something like this since
+ * they compute their data in host memory and upload the full sw rendered
+ * frame.
+ *
+ * Additionally, those applications should be rendering at the screen refresh
+ * rate, while this test has no limits, and so can get itself into the
+ * working set larger than aperture size performance disaster.
+ *
+ * The current workload we have that does large drm_intel_bo_map()
+ * uploads is texture upload for OpenGL (as it frequently is doing
+ * reformatting as it uploads the user's data, making bo_subdata less
+ * suitable)
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include "drm.h"
+#include "i915_drm.h"
+#include "drmtest.h"
+#include "intel_bufmgr.h"
+#include "intel_batchbuffer.h"
+
+#define OBJECT_WIDTH 1280
+#define OBJECT_HEIGHT 720
+
+static double
+get_time_in_secs(void)
+{
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
+
+ return (double)tv.tv_sec + tv.tv_usec / 1000000.0;
+}
+
+static void
+do_render(drm_intel_bufmgr *bufmgr, struct intel_batchbuffer *batch,
+ drm_intel_bo *dst_bo, int width, int height)
+{
+ uint32_t *data;
+ drm_intel_bo *src_bo;
+ int i;
+ static uint32_t seed = 1;
+
+ src_bo = drm_intel_bo_alloc(bufmgr, "src", width * height * 4, 4096);
+
+ drm_intel_bo_map(src_bo, 1);
+
+ data = src_bo->virtual;
+ for (i = 0; i < width * height; i++) {
+ data[i] = seed++;
+ }
+
+ drm_intel_bo_unmap(src_bo);
+
+ /* Render the junk to the dst. */
+ BEGIN_BATCH(8);
+ OUT_BATCH(XY_SRC_COPY_BLT_CMD |
+ XY_SRC_COPY_BLT_WRITE_ALPHA |
+ XY_SRC_COPY_BLT_WRITE_RGB);
+ OUT_BATCH((3 << 24) | /* 32 bits */
+ (0xcc << 16) | /* copy ROP */
+ (width * 4) /* dst pitch */);
+ OUT_BATCH(0); /* dst x1,y1 */
+ OUT_BATCH((height << 16) | width); /* dst x2,y2 */
+ OUT_RELOC(dst_bo, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, 0);
+ OUT_BATCH(0); /* src x1,y1 */
+ OUT_BATCH(width * 4); /* src pitch */
+ OUT_RELOC(src_bo, I915_GEM_DOMAIN_RENDER, 0, 0);
+ ADVANCE_BATCH();
+
+ intel_batchbuffer_flush(batch);
+
+ drm_intel_bo_unreference(src_bo);
+}
+
+int main(int argc, char **argv)
+{
+ int fd;
+ int object_size = OBJECT_WIDTH * OBJECT_HEIGHT * 4;
+ double start_time, end_time;
+ drm_intel_bo *dst_bo;
+ drm_intel_bufmgr *bufmgr;
+ struct intel_batchbuffer *batch;
+ int i;
+
+ fd = drm_open_any();
+
+ bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
+ drm_intel_bufmgr_gem_enable_reuse(bufmgr);
+
+ batch = intel_batchbuffer_alloc(bufmgr);
+
+ dst_bo = drm_intel_bo_alloc(bufmgr, "dst", object_size, 4096);
+
+ /* Prep loop to get us warmed up. */
+ for (i = 0; i < 60; i++) {
+ do_render(bufmgr, batch, dst_bo, OBJECT_WIDTH, OBJECT_HEIGHT);
+ }
+ drm_intel_bo_wait_rendering(dst_bo);
+
+ /* Do the actual timing. */
+ start_time = get_time_in_secs();
+ for (i = 0; i < 200; i++) {
+ do_render(bufmgr, batch, dst_bo, OBJECT_WIDTH, OBJECT_HEIGHT);
+ }
+ drm_intel_bo_wait_rendering(dst_bo);
+ end_time = get_time_in_secs();
+
+ printf("%d iterations in %.03f secs: %.01f MB/sec\n", i,
+ end_time - start_time,
+ (double)i * OBJECT_WIDTH * OBJECT_HEIGHT * 4 / 1024.0 / 1024.0 /
+ (end_time - start_time));
+
+ intel_batchbuffer_free(batch);
+ drm_intel_bufmgr_destroy(bufmgr);
+
+ close(fd);
+
+ return 0;
+}
diff --git a/configure.ac b/configure.ac
index 01405ee5e..eb7466834 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,7 +46,7 @@ DOLT
AC_PROG_CC
AM_PROG_CC_C_O
-PKG_CHECK_MODULES(DRM, [libdrm_intel >= 2.4.5])
+PKG_CHECK_MODULES(DRM, [libdrm_intel >= 2.4.6])
PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
dnl Use lots of warning flags with GCC