intel-gpu-tools: Changes to 'upstream-unstable'
.gitignore | 54
Makefile.am | 15
README | 35
autogen.sh | 14
benchmarks/Makefile.am | 15
benchmarks/intel_upload_blit_large.c | 3
benchmarks/intel_upload_blit_large_gtt.c | 3
benchmarks/intel_upload_blit_large_map.c | 3
benchmarks/intel_upload_blit_small.c | 3
configure.ac | 77
debugger/Makefile.am | 19
debugger/debug_rdata.c | 141 +
debugger/eudb.c | 606 ++++++
debugger/system_routine/GNUmakefile.in | 3
debugger/system_routine/Makefile | 84
debugger/system_routine/eviction_macro.c | 48
debugger/system_routine/pre_cpp.py | 123 +
debugger/system_routine/sr.g4a | 277 ++
debugger/system_routine/test.g4a | 64
lib/Makefile.am | 22
lib/debug.h | 92
lib/drmtest.c | 30
lib/i830_reg.h | 805 ++++++++
lib/i915_3d.h | 619 ++++++
lib/i915_reg.h | 844 ++++++++
lib/instdone.c | 211 +-
lib/instdone.h | 4
lib/intel_batchbuffer.c | 124 +
lib/intel_batchbuffer.h | 60
lib/intel_chipset.h | 88
lib/intel_drm.c | 92
lib/intel_gpu_tools.c | 154 -
lib/intel_gpu_tools.h | 65
lib/intel_mmio.c | 251 ++
lib/intel_pci.c | 89
lib/intel_reg.h | 1068 ++++++++---
lib/intel_reg_map.c | 178 +
m4/.gitignore | 5
m4/dolt.m4 | 178 -
m4/shave.m4 | 73
man/Makefile.am | 9
man/intel_audio_dump.1 | 11
man/intel_bios_dumper.1 | 14
man/intel_bios_reader.1 | 15
man/intel_error_decode.1 | 20
man/intel_gpu_dump.1 | 22
man/intel_gpu_top.1 | 23
man/intel_gtt.1 | 14
man/intel_lid.1 | 12
man/intel_reg_dumper.1 | 24
man/intel_reg_read.1 | 15
man/intel_reg_snapshot.1 | 15
man/intel_reg_write.1 | 2
scripts/Makefile.am | 6
scripts/throttle.py | 67
scripts/who.sh | 13
shave-libtool.in | 69
shave.in | 76
tests/Makefile.am | 89
tests/check_drm_clients | 30
tests/debugfs_emon_crash | 34
tests/debugfs_reader | 27
tests/gem_bad_address.c | 3
tests/gem_bad_batch.c | 3
tests/gem_bad_blit.c | 7
tests/gem_bad_length.c | 158 +
tests/gem_double_irq_loop.c | 147 +
tests/gem_dummy_reloc_loop.c | 194 ++
tests/gem_exec_bad_domains.c | 145 +
tests/gem_exec_blt.c | 306 +++
tests/gem_exec_faulting_reloc.c | 289 +++
tests/gem_exec_nop.c | 162 +
tests/gem_fence_thrash.c | 10
tests/gem_fenced_exec_thrash.c | 184 +
tests/gem_flink.c | 2
tests/gem_gtt_speed.c | 311 +++
tests/gem_hang.c | 5
tests/gem_hangcheck_forcewake.c | 127 +
tests/gem_largeobject.c | 25
tests/gem_linear_blits.c | 310 +++
tests/gem_mmap.c | 2
tests/gem_mmap_gtt.c | 233 ++
tests/gem_partial_pwrite_pread.c | 284 +++
tests/gem_pipe_control_store_loop.c | 184 +
tests/gem_pread_after_blit.c | 3
tests/gem_pwrite.c | 154 +
tests/gem_readwrite.c | 4
tests/gem_reloc_vs_gpu.c | 207 ++
tests/gem_ring_sync_loop.c | 139 +
tests/gem_ringfill.c | 3
tests/gem_storedw_batches_loop.c | 168 +
tests/gem_storedw_loop_blt.c | 146 +
tests/gem_storedw_loop_bsd.c | 146 +
tests/gem_storedw_loop_render.c | 143 +
tests/gem_stress.c | 991 ++++++++++
tests/gem_stress.h | 100 +
tests/gem_stress_gen6.c | 595 ++++++
tests/gem_stress_i830.c | 354 +++
tests/gem_stress_i915.c | 190 ++
tests/gem_tiled_blits.c | 137 -
tests/gem_tiled_fence_blits.c | 213 ++
tests/gem_tiled_pread.c | 215 +-
tests/gem_tiled_pread_pwrite.c | 227 ++
tests/gem_unref_active_buffers.c | 107 +
tests/gem_vmap_blits.c | 409 ++++
tests/gen3_mixed_blits.c | 619 ++++++
tests/gen3_render_linear_blits.c | 459 ++++
tests/gen3_render_mixed_blits.c | 508 +++++
tests/gen3_render_tiledx_blits.c | 487 +++++
tests/gen3_render_tiledy_blits.c | 494 +++++
tests/gen6_render.h | 1553 ++++++++++++++++
tests/getstats.c | 2
tests/sysfs_edid_timing | 20
tests/testdisplay.c | 1287 +++++++++++++
tools/Makefile.am | 41
tools/forcewaked.c | 106 +
tools/intel_audio_dump.c | 1206 ++++++++++++
tools/intel_backlight.c | 69
tools/intel_bios.h | 731 +++++++
tools/intel_bios_dumper.c | 112 +
tools/intel_bios_reader.c | 938 +++++++++
tools/intel_decode.c | 2931 +++++++++++++++++++++++++++++++
tools/intel_decode.h | 8
tools/intel_disable_clock_gating.c | 71
tools/intel_dump_decode.c | 203 ++
tools/intel_error_decode.c | 499 +++++
tools/intel_gpu_abrt | 45
tools/intel_gpu_dump.c | 2263 -----------------------
tools/intel_gpu_time.c | 110 +
tools/intel_gpu_top.c | 545 +++++
tools/intel_gtt.c | 121 +
tools/intel_lid.c | 144 +
tools/intel_reg_checker.c | 399 ++++
tools/intel_reg_dumper.c | 1995 +++++++++++++++++++++
tools/intel_reg_read.c | 80
tools/intel_reg_snapshot.c | 48
tools/intel_reg_write.c | 2
tools/intel_stepping.c | 134 +
138 files changed, 29694 insertions(+), 3524 deletions(-)
New commits:
commit 5a3fccbb577dd8d6a0699cd58e9f39532792b866
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Sat Dec 24 01:23:59 2011 +0100
Release 1.1
diff --git a/configure.ac b/configure.ac
index 3e1218e..5d89b30 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@
AC_PREREQ([2.63])
AC_INIT([intel-gpu-tools],
- [1.0.2],
+ [1.1],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
[intel-gpu-tools])
commit 74d6545ffadf0a7f321138ae4ccd0def8f28e0d2
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Sun Dec 18 00:24:45 2011 +0100
testdisplay: shut up compiler
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index cc6153d..a5a9556 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -1095,7 +1095,7 @@ out:
static gboolean input_event(GIOChannel *source, GIOCondition condition,
gpointer data)
{
- gchar buf[1];
+ gchar buf[2];
gsize count;
count = read(g_io_channel_unix_get_fd(source), buf, sizeof(buf));
@@ -1125,7 +1125,6 @@ static gboolean input_event(GIOChannel *source, GIOCondition condition,
int main(int argc, char **argv)
{
int c;
- int encoders = 0, connectors = 0, crtcs = 0, framebuffers = 0;
char *modules[] = { "i915" };
unsigned int i;
struct udev *u;
@@ -1138,7 +1137,6 @@ int main(int argc, char **argv)
switch (c) {
case 'i':
dump_info = 1;
- encoders = connectors = crtcs = modes = framebuffers = 1;
break;
case 'a':
test_all_modes = 1;
commit 2de19c477af4f10370f1272e6578cec0d1b486bc
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Sun Dec 18 00:21:39 2011 +0100
testdisplay: move drm_fourcc.h include under the #ifdef protection
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index 308160f..cc6153d 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -65,11 +65,11 @@
#include "xf86drm.h"
#include "xf86drmMode.h"
-#include "drm_fourcc.h"
#include "i915_drm.h"
#if defined(DRM_IOCTL_MODE_ADDFB2) && defined(DRM_I915_SET_SPRITE_COLORKEY)
#define TEST_PLANES 1
+#include "drm_fourcc.h"
#endif
struct udev_monitor *uevent_monitor;
commit 1f41a30070d62e007bfda9f8ddadc24877a3324c
Author: Yi Sun <yi.sun@intel.com>
Date: Thu Dec 1 18:57:16 2011 +0800
tests/testdisplay.c: make the 3th pipe finish all the mode setting.
If test all modes rather than preferred mode, remove framebuffer and
set CRTC to zero after each connector mode setting.
Signed-off-by: Sun Yi <yi.sun@intel.com>
Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index ab5bf2c..308160f 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -376,7 +376,10 @@ static void connector_find_preferred_mode(struct connector *c)
}
c->crtc = resources->crtcs[i];
c->pipe = i;
- resources->crtcs[i] = 0;
+
+ if(test_preferred_mode)
+ resources->crtcs[i] = 0;
+
c->connector = connector;
}
@@ -970,6 +973,7 @@ set_mode(struct connector *c)
continue;
}
+ fprintf(stdout, "CRTS(%u):",c->crtc);
dump_mode(&c->mode);
if (drmModeSetCrtc(fd, c->crtc, fb_id, 0, 0,
&c->id, 1, &c->mode)) {
@@ -984,6 +988,12 @@ set_mode(struct connector *c)
if (sleep_between_modes && test_all_modes)
sleep(sleep_between_modes);
+
+ }
+
+ if(!test_preferred_mode){
+ drmModeRmFB(fd,fb_id);
+ drmModeSetCrtc(fd, c->crtc, fb_id, 0, 0, &c->id, 1, 0);
}
drmModeFreeEncoder(c->encoder);
commit 06460049f69b2769c31c51520ae07af394a0a33b
Author: Ben Widawsky <ben@bwidawsk.net>
Date: Thu Dec 15 13:54:30 2011 -0800
intel-decode: fix flush dword post sync parse
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
diff --git a/tools/intel_decode.c b/tools/intel_decode.c
index 53951d4..344578b 100644
--- a/tools/intel_decode.c
+++ b/tools/intel_decode.c
@@ -170,10 +170,10 @@ decode_mi(uint32_t *data, int count, uint32_t hw_offset, int *failures)
return len;
case 0x26:
switch (data[0] & (0x3<<14)) {
- case 0: post_sync_op = "no write"; break;
- case 1: post_sync_op = "write data"; break;
- case 2: post_sync_op = "reserved"; break;
- case 3: post_sync_op = "write TIMESTAMP"; break;
+ case (0<<14): post_sync_op = "no write"; break;
+ case (1<<14): post_sync_op = "write data"; break;
+ case (2<<14): post_sync_op = "reserved"; break;
+ case (3<<14): post_sync_op = "write TIMESTAMP"; break;
}
instr_out(data, hw_offset, 0, "MI_FLUSH_DW%s%s%s%s post_sync_op='%s' %s%s\n",
data[0] & (1<<22) ? " enable protected mem (BCS-only)," : "",
commit 7ecdb152ca30db67f23a8f31bc7e4b84ec72a4d1
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Wed Dec 14 17:43:37 2011 +0000
tests/gem_double_irq_loop: silence the compiler
gem_double_irq_loop.c: In function ‘dummy_reloc_loop’:
gem_double_irq_loop.c:62:9: warning: unused variable ‘j’ [-Wunused-variable]
diff --git a/tests/gem_double_irq_loop.c b/tests/gem_double_irq_loop.c
index f6811c9..f2f8b1a 100644
--- a/tests/gem_double_irq_loop.c
+++ b/tests/gem_double_irq_loop.c
@@ -59,7 +59,7 @@ static drm_intel_bo *target_buffer, *blt_bo;
static void
dummy_reloc_loop(void)
{
- int i, j;
+ int i;
for (i = 0; i < 0x800; i++) {
BEGIN_BATCH(8);
commit f381a8b9f08a6d0c843e7b9f7997020d6b0d1e1a
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Wed Dec 14 17:41:34 2011 +0000
tests/gem_exec_blt: silence the compiler by failing on error
gem_exec_blt.c: In function ‘gem_exec’:
gem_exec_blt.c:174:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
Propagate the failure and exit(1).
diff --git a/tests/gem_exec_blt.c b/tests/gem_exec_blt.c
index 19eb716..b2ca2d6 100644
--- a/tests/gem_exec_blt.c
+++ b/tests/gem_exec_blt.c
@@ -169,15 +169,17 @@ static void gem_sync(int fd, uint32_t handle)
drmIoctl(fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &set_domain);
}
-static void gem_exec(int fd, struct drm_i915_gem_execbuffer2 *execbuf, int loops)
+static int gem_exec(int fd, struct drm_i915_gem_execbuffer2 *execbuf, int loops)
{
- int ret;
+ int ret = 0;
- while (loops--) {
+ while (loops-- && ret == 0) {
ret = drmIoctl(fd,
DRM_IOCTL_I915_GEM_EXECBUFFER2,
execbuf);
}
+
+ return ret;
}
static double elapsed(const struct timeval *start,
@@ -272,7 +274,8 @@ static void run(int object_size)
struct timeval start, end;
gettimeofday(&start, NULL);
- gem_exec(fd, &execbuf, count);
+ if (gem_exec(fd, &execbuf, count))
+ exit(1);
gem_sync(fd, handle);
gettimeofday(&end, NULL);
printf("Time to blt %d bytes x %6d: %7.3fµs, %s\n",
commit 2a292188e764c18b76698e1698ecaf62699b2f04
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Wed Dec 14 17:41:34 2011 +0000
tests/gem_exec_nop: silence the compiler by failing on error
gem_exec_nop.c: In function ‘exec’:
gem_exec_nop.c:101:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
Propagate the failure and exit(1).
diff --git a/tests/gem_exec_nop.c b/tests/gem_exec_nop.c
index d022c2b..82076f0 100644
--- a/tests/gem_exec_nop.c
+++ b/tests/gem_exec_nop.c
@@ -94,11 +94,11 @@ static double elapsed(const struct timeval *start,
return (1e6*(end->tv_sec - start->tv_sec) + (end->tv_usec - start->tv_usec))/loop;
}
-static void exec(int fd, uint32_t handle, int loops)
+static int exec(int fd, uint32_t handle, int loops)
{
struct drm_i915_gem_execbuffer2 execbuf;
struct drm_i915_gem_exec_object2 exec[1];
- int ret;
+ int ret = 0;
exec[0].handle = handle;
exec[0].relocation_count = 0;
@@ -121,12 +121,14 @@ static void exec(int fd, uint32_t handle, int loops)
execbuf.rsvd1 = 0;
execbuf.rsvd2 = 0;
- while (loops--) {
+ while (loops-- && ret == 0) {
ret = drmIoctl(fd,
DRM_IOCTL_I915_GEM_EXECBUFFER2,
&execbuf);
}
gem_sync(fd, handle);
+
+ return ret;
}
int main(int argc, char **argv)
@@ -145,7 +147,8 @@ int main(int argc, char **argv)
struct timeval start, end;
gettimeofday(&start, NULL);
- exec(fd, handle, count);
+ if (exec(fd, handle, count))
+ exit(1);
gettimeofday(&end, NULL);
printf("Time to exec x %d: %7.3fµs\n",
count, elapsed(&start, &end, count));
commit ceb9f7d934e7efaaf0b061c3a0c5cb4b21efa156
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Wed Dec 14 17:39:42 2011 +0000
tests/gem_stress: silence the compiler by using '%zu' for size_t
gem_stress.c: In function ‘main’:
gem_stress.c:980:3: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘unsigned int’ [-Wformat]
diff --git a/tests/gem_stress.c b/tests/gem_stress.c
index df819b6..ecf3a0d 100644
--- a/tests/gem_stress.c
+++ b/tests/gem_stress.c
@@ -976,7 +976,7 @@ int main(int argc, char **argv)
fan_in_and_check();
- fprintf(stderr, "num failed tiles %u, max incoherent bytes %lu\n",
+ fprintf(stderr, "num failed tiles %u, max incoherent bytes %zd\n",
stats.num_failed, stats.max_failed_reads*sizeof(uint32_t));
intel_batchbuffer_free(batch);
commit d4bb328b78b767b98c8a60ee2c1bd0d2cc894d67
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Wed Dec 14 17:37:53 2011 +0000
tests/gem_largeobject: silence the compiler
gem_largeobject.c: In function ‘test_large_object’:
gem_largeobject.c:95:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
diff --git a/tests/gem_largeobject.c b/tests/gem_largeobject.c
index f7973bd..bf59c84 100644
--- a/tests/gem_largeobject.c
+++ b/tests/gem_largeobject.c
@@ -92,7 +92,7 @@ test_large_object(int fd)
pwrite.handle = create.handle;
pwrite.size = obj_size;
- pwrite.data_ptr = (uint64_t)data;
+ pwrite.data_ptr = (uintptr_t)data;
ret = ioctl(fd, DRM_IOCTL_I915_GEM_PWRITE, &pwrite);
if (ret) {
commit b4fb480c802c41dbb8061344a540752156113489
Author: Jesse Barnes <jbarnes@virtuousgeek.org>
Date: Wed Dec 14 08:14:45 2011 -0800
testdisplay: don't test planes if i915 color key ioctl is not available
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index d9e7e62..ab5bf2c 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -68,7 +68,7 @@
#include "drm_fourcc.h"
#include "i915_drm.h"
-#ifdef DRM_IOCTL_MODE_ADDFB2
+#if defined(DRM_IOCTL_MODE_ADDFB2) && defined(DRM_I915_SET_SPRITE_COLORKEY)
#define TEST_PLANES 1
#endif
commit 7ac492aec2c749895c863675ad5f48177daf9648
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Mon Dec 12 20:19:03 2011 +0000
scripts/who: Add the process id to the output
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
diff --git a/scripts/who.sh b/scripts/who.sh
index 9aab704..b221639 100755
--- a/scripts/who.sh
+++ b/scripts/who.sh
@@ -9,5 +9,5 @@
for i in `lsof -t /dev/dri/card0`; do
who=`readlink /proc/$i/exe`
count=`grep /dev/dri/card0 /proc/$i/maps | wc -l | cut -f1 -d\ `
- echo "$who: $count"
+ echo "$who [$i]: $count"
done
commit 61ff1309cabaa1fc879ed0c3179696ad64a79da3
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Mon Dec 12 17:44:58 2011 +0000
scripts: Add a trivial script to show which programs are using the GPU
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index e4c26c4..dad9cf7 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -1,5 +1,6 @@
noinst_SCRIPTS = \
throttle.py\
+ who.sh \
$(NULL)
EXTRA_DIST = $(noinst_SCRIPTS)
diff --git a/scripts/who.sh b/scripts/who.sh
new file mode 100755
index 0000000..9aab704
--- /dev/null
+++ b/scripts/who.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+#
+# usage: sudo who.sh
+#
+# Requires root permissions to both query who has the device open,
+# and to read the mappings of likely root-owned processes
+#
+
+for i in `lsof -t /dev/dri/card0`; do
+ who=`readlink /proc/$i/exe`
+ count=`grep /dev/dri/card0 /proc/$i/maps | wc -l | cut -f1 -d\ `
+ echo "$who: $count"
+done
commit 10e36edabe42e52f7862f66147d4433e8947ebc2
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Sat Dec 10 12:49:10 2011 +0000
decode: Fix interpretation of i915 8bit formats
2/3 are reserved with the correct values for A8/I8 being 4/5
respectively.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
diff --git a/tools/intel_decode.c b/tools/intel_decode.c
index 7162581..53951d4 100644
--- a/tools/intel_decode.c
+++ b/tools/intel_decode.c
@@ -1357,8 +1357,8 @@ decode_3d_1d(uint32_t *data, int count,
switch ((dword>>3) & 0xf) {
case 0: format = "I"; break;
case 1: format = "L"; break;
- case 2: format = "A"; break;
- case 3: format = " mono"; break; }
+ case 4: format = "A"; break;
+ case 5: format = " mono"; break; }
break;
case 2:
type = "16b";
commit 5a9d82c6d5ad6d4e9b48a74dd4a5226babee81aa
Author: Jesse Barnes <jbarnes@virtuousgeek.org>
Date: Wed Dec 7 08:22:41 2011 -0800
testdisplay: update for final plane & fb ABI
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index 3c9741c..d9e7e62 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -65,6 +65,7 @@
#include "xf86drm.h"
#include "xf86drmMode.h"
+#include "drm_fourcc.h"
#include "i915_drm.h"
#ifdef DRM_IOCTL_MODE_ADDFB2
@@ -77,7 +78,7 @@ int fd, modes;
int dump_info = 0, test_all_modes =0, test_preferred_mode = 0, force_mode = 0,
test_plane, enable_tiling;
int sleep_between_modes = 5;
-uint32_t depth = 24;
+uint32_t depth = 24, stride, bpp;
float force_clock;
int force_hdisplay;
@@ -89,11 +90,13 @@ int force_vsync_start;
int force_vsync_end;
int force_vtotal;
-int crtc_x, crtc_y, crtc_w, crtc_h;
+int crtc_x, crtc_y, crtc_w, crtc_h, width, height;
unsigned int plane_fb_id;
unsigned int plane_crtc_id;
unsigned int plane_id;
int plane_width, plane_height;
+static const uint32_t SPRITE_COLOR_KEY = 0x00aaaaaa;
+uint32_t *fb_ptr;
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
@@ -413,12 +416,12 @@ static void gem_close(int fd, uint32_t handle)
}
static cairo_surface_t *
-allocate_surface(int fd, int width, int height, uint32_t depth, uint32_t bpp,
+allocate_surface(int fd, int width, int height, uint32_t depth,
uint32_t *handle, int tiled)
{
cairo_format_t format;
struct drm_i915_gem_set_tiling set_tiling;
- int size, stride;
+ int size;
if (tiled) {
int v;
@@ -477,9 +480,11 @@ allocate_surface(int fd, int width, int height, uint32_t depth, uint32_t bpp,
}
}
- return cairo_image_surface_create_for_data
- (gem_mmap(fd, *handle, size, PROT_READ | PROT_WRITE),
- format, width, height, stride);
+ fb_ptr = gem_mmap(fd, *handle, size, PROT_READ | PROT_WRITE);
+
+ return cairo_image_surface_create_for_data((unsigned char *)fb_ptr,
+ format, width, height,
+ stride);
}
enum corner {
@@ -506,6 +511,20 @@ paint_color_gradient(cairo_t *cr, int x, int y, int width, int height,
}
static void
+paint_color_key(void)
+{
+ int i, j;
+
+ for (i = crtc_y; i < crtc_y + crtc_h; i++)
+ for (j = crtc_x; j < crtc_x + crtc_w; j++) {
+ uint32_t offset;
+
+ offset = (i * width) + j;
+ fb_ptr[offset] = SPRITE_COLOR_KEY;
+ }
+}
+
+static void
paint_test_patterns(cairo_t *cr, int width, int height, int stride)
{
double gr_height, gr_width;
@@ -732,15 +751,11 @@ enable_plane(struct connector *c)
cairo_surface_t *surface;
cairo_status_t status;
cairo_t *cr;
- uint32_t handle, x, y;
+ uint32_t handle;
int ret;
- uint32_t pitches[4], offsets[4]; /* we only use [0] */
-
- plane_width = c->mode.hdisplay * 0.50;
- plane_height = c->mode.vdisplay * 0.50;
-
- x = (c->mode.hdisplay - plane_width) / 2;
- y = (c->mode.vdisplay - plane_height) / 2;
+ uint32_t handles[4], pitches[4], offsets[4]; /* we only use [0] */
+ struct drm_intel_set_sprite_destkey set;
+ uint32_t plane_flags = 0;
plane_id = connector_find_plane(c);
if (!plane_id) {
@@ -749,7 +764,7 @@ enable_plane(struct connector *c)
}
plane_crtc_id = c->crtc;
- surface = allocate_surface(fd, plane_width, plane_height, 24, 32, &handle, 1);
+ surface = allocate_surface(fd, plane_width, plane_height, 24, &handle, 1);
if (!surface) {
fprintf(stderr, "allocation failed %dx%d\n", plane_width, plane_height);
return;
@@ -767,8 +782,10 @@ enable_plane(struct connector *c)
pitches[0] = cairo_image_surface_get_stride(surface);
memset(offsets, 0, sizeof(offsets));
- ret = drmModeAddFB2(fd, plane_width, plane_height, V4L2_PIX_FMT_RGB24,
- handle, pitches, offsets, &plane_fb_id);
+ handles[0] = handles[1] = handles[2] = handles[3] = handle;
+ ret = drmModeAddFB2(fd, plane_width, plane_height, DRM_FORMAT_XRGB8888,
+ handles, pitches, offsets, &plane_fb_id,
+ plane_flags);
cairo_surface_destroy(surface);
gem_close(fd, handle);
@@ -778,8 +795,14 @@ enable_plane(struct connector *c)
return;
}
- if (drmModeSetPlane(fd, plane_id, plane_crtc_id, plane_fb_id, crtc_x, crtc_y,
- crtc_w, crtc_h, 0, 0, plane_width, plane_height)) {
+ set.plane_id = plane_id;
+ set.value = SPRITE_COLOR_KEY;
+ ret = drmCommandWrite(fd, DRM_I915_SET_SPRITE_DESTKEY, &set,
+ sizeof(set));
+
+ if (drmModeSetPlane(fd, plane_id, plane_crtc_id, plane_fb_id,
+ plane_flags, crtc_x, crtc_y, crtc_w, crtc_h,
+ 0, 0, plane_width, plane_height)) {
fprintf(stderr, "failed to enable plane: %s\n",
strerror(errno));
return;
@@ -789,11 +812,16 @@ enable_plane(struct connector *c)
static void
adjust_plane(int fd, int xdistance, int ydistance, int wdiff, int hdiff)
{
+ uint32_t plane_flags = 0;
+
crtc_x += xdistance;
crtc_y += ydistance;
crtc_w += wdiff;
crtc_h += hdiff;
- if (drmModeSetPlane(fd, plane_id, plane_crtc_id, plane_fb_id, crtc_x, crtc_y,
+ fprintf(stderr, "setting plane %dx%d @ %d,%d (source %dx%d)\n",
+ crtc_w, crtc_h, crtc_x, crtc_y, plane_width, plane_height);
+ if (drmModeSetPlane(fd, plane_id, plane_crtc_id, plane_fb_id,
+ plane_flags, crtc_x, crtc_y,
crtc_w, crtc_h, 0, 0, plane_width, plane_height))
fprintf(stderr, "failed to adjust plane: %s\n", strerror(errno));
}
@@ -827,7 +855,7 @@ disable_planes(int fd)
return;
}
if (drmModeSetPlane(fd, plane_id, connectors[c].crtc, 0, 0, 0,
- 0, 0, 0, 0, 0, 0)) {
+ 0, 0, 0, 0, 0, 0, 0)) {
fprintf(stderr, "failed to disable plane: %s\n",
strerror(errno));
return;
@@ -848,10 +876,9 @@ static void
set_mode(struct connector *c)
{
unsigned int fb_id;
- int ret, width, height;
+ int ret;
char buf[128];
int j, test_mode_num;
- uint32_t bpp = 32;
if (depth <= 8)
bpp = 8;
@@ -896,7 +923,7 @@ set_mode(struct connector *c)
width = c->mode.hdisplay;
height = c->mode.vdisplay;
- surface = allocate_surface(fd, width, height, depth, bpp,
+ surface = allocate_surface(fd, width, height, depth,
&handle, enable_tiling);
if (!surface) {
fprintf(stderr, "allocation failed %dx%d\n", width, height);
@@ -923,6 +950,8 @@ set_mode(struct connector *c)
/* Paint output info */
paint_output_info(cr, c, width, height);
+ paint_color_key();
+
status = cairo_status(cr);
cairo_destroy(cr);
if (status)
@@ -1015,7 +1044,7 @@ static void usage(char *name)
fprintf(stderr, "\t-a\ttest all modes\n");
fprintf(stderr, "\t-s\t<duration>\tsleep between each mode test\n");
fprintf(stderr, "\t-d\t<depth>\tbit depth of scanout buffer\n");
- fprintf(stderr, "\t-p\t<crtcx,y>,<crtcw,h> test overlay plane\n");
+ fprintf(stderr, "\t-p\t<planew,h>,<crtcx,y>,<crtcw,h> test overlay plane\n");
fprintf(stderr, "\t-m\ttest the preferred mode\n");
fprintf(stderr, "\t-t\tuse a tiled framebuffer\n");
fprintf(stderr, "\t-f\t<clock MHz>,<hdisp>,<hsync-start>,<hsync-end>,<htotal>,\n");
@@ -1119,8 +1148,9 @@ int main(int argc, char **argv)
fprintf(stderr, "using depth %d\n", depth);
break;
case 'p':
- if (sscanf(optarg, "%d,%d,%d,%d", &crtc_x, &crtc_y,
- &crtc_w, &crtc_h) != 4)
+ if (sscanf(optarg, "%d,%d,%d,%d,%d,%d", &plane_width,
+ &plane_height, &crtc_x, &crtc_y,
+ &crtc_w, &crtc_h) != 6)
usage(argv[0]);
test_plane = 1;
break;
commit ff409c537f541cbaa20f0b0f8faa03ece0d8014f
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Tue Dec 6 16:57:53 2011 +0100
tests/gem_partial_pwrite_pread: don't trash gtt unnecessarily
On chips that don't have a unmappable gtt part it's utterly pointless.
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
diff --git a/lib/intel_chipset.h b/lib/intel_chipset.h
index 35edaf7..668bf59 100755
--- a/lib/intel_chipset.h
+++ b/lib/intel_chipset.h
@@ -114,7 +114,9 @@
#define IS_945(devid) (devid == PCI_CHIP_I945_G || \
devid == PCI_CHIP_I945_GM || \
devid == PCI_CHIP_I945_GME || \
- devid == PCI_CHIP_G33_G || \
+ IS_G33(devid))
+
+#define IS_G33(devid) (devid == PCI_CHIP_G33_G || \
devid == PCI_CHIP_Q33_G || \
devid == PCI_CHIP_Q35_G || IS_IGD(devid))
diff --git a/tests/gem_partial_pwrite_pread.c b/tests/gem_partial_pwrite_pread.c
index 57076cf..e00167f 100644
--- a/tests/gem_partial_pwrite_pread.c
+++ b/tests/gem_partial_pwrite_pread.c
@@ -124,7 +124,8 @@ blt_bo_fill(drm_intel_bo *tmp_bo, drm_intel_bo *bo, int val)
drm_intel_gem_bo_unmap_gtt(tmp_bo);
- if (bo->offset < num_trash_bos*1024*1024)
+ if (bo->offset < num_trash_bos*1024*1024 &&
+ (IS_G33(devid) || intel_gen(devid) >= 4))
trash_aperture();
copy_bo(tmp_bo, bo);
commit 5a851b139266063fc4e172e6ce781ebc1c75c9d9
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Sun Dec 4 21:42:31 2011 +0100
tests: add gem_partial_pwrite_pread
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
diff --git a/.gitignore b/.gitignore
index 22de4e9..26058fd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -65,6 +65,7 @@ tests/gem_tiled_blits
tests/gem_tiled_fence_blits
tests/gem_tiled_pread
tests/gem_tiled_pread_pwrite
+tests/gem_partial_pwrite_pread
tests/gem_unref_active_buffers
tests/gem_bad_address
tests/gem_bad_batch
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a0935bd..43d7db6 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -31,6 +31,7 @@ TESTS_progs = \
gem_pread_after_blit \
gem_tiled_pread \
gem_tiled_pread_pwrite \
+ gem_partial_pwrite_pread \
gem_linear_blits \
gem_vmap_blits \
gem_tiled_blits \
diff --git a/tests/gem_partial_pwrite_pread.c b/tests/gem_partial_pwrite_pread.c
new file mode 100644
index 0000000..57076cf
--- /dev/null
+++ b/tests/gem_partial_pwrite_pread.c
@@ -0,0 +1,283 @@
+/*
+ * Copyright © 2011 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:
+ * Daniel Vetter <daniel.vetter@ffwll.ch>
+ *
+ */
+
+#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"
+#include "intel_gpu_tools.h"
+
+/*
+ * Testcase: pwrite/pread consistency when touching partial cachelines
+ *
+ * Some fancy new pwrite/pread optimizations clflush in-line while
+ * reading/writing. Check whether all required clflushes happen.
+ *
+ */
+
+static drm_intel_bufmgr *bufmgr;
+struct intel_batchbuffer *batch;
+
+drm_intel_bo *scratch_bo;
+drm_intel_bo *staging_bo;
+#define BO_SIZE (4*4096)
+uint32_t devid;
+int fd;
+
+drm_intel_bo *trash_bos[10000];
+int num_trash_bos;
+
+static void
+init_aperture_trashers(void)
+{
+ int i;
+
+ if (intel_gen(devid) >= 6)
+ num_trash_bos = 512;
+ else
+ num_trash_bos = 256;
+
+ for (i = 0; i < num_trash_bos; i++)
+ trash_bos[i] = drm_intel_bo_alloc(bufmgr, "trash bo", 1024*1024, 4096);
+}
+
+static void
+trash_aperture(void)
+{
+ int i;
+ uint8_t *gtt_ptr;
+
+ for (i = 0; i < num_trash_bos; i++) {
+ drm_intel_gem_bo_map_gtt(trash_bos[i]);
+ gtt_ptr = trash_bos[i]->virtual;
+ *gtt_ptr = 0;
+ drm_intel_gem_bo_unmap_gtt(trash_bos[i]);
+ }
+}
+
+static void
+copy_bo(drm_intel_bo *src, drm_intel_bo *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 */
+ 4096);
+ OUT_BATCH(0 << 16 | 0);
+ OUT_BATCH((BO_SIZE/4096) << 16 | 1024);
+ OUT_RELOC_FENCED(dst, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, 0);
+ OUT_BATCH(0 << 16 | 0);
+ OUT_BATCH(4096);
+ OUT_RELOC_FENCED(src, I915_GEM_DOMAIN_RENDER, 0, 0);
+ ADVANCE_BATCH();
Reply to: