diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-10-09 20:50:50 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-10-09 20:50:50 +0200 |
commit | 590f6101402b51bca54f69c002380bda967484ea (patch) | |
tree | 9ae3e85c2405fe316e76a608ddb55cfcaf5ea4e1 /lib | |
parent | 40599b077972e1a721fdfcc93455e60b5b564a13 (diff) |
lib/drmtest: extract rawer __gem_set_tiling
For tests that expect failures. Also apply the existing gem_set_tiling
helper a bit wider.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/drmtest.c | 25 | ||||
-rw-r--r-- | lib/drmtest.h | 1 |
2 files changed, 13 insertions, 13 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c index 4fa3c42d..3cec956e 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -249,7 +249,7 @@ int drm_open_any(void) return fd; } -void gem_set_tiling(int fd, uint32_t handle, int tiling, int stride) +int __gem_set_tiling(int fd, uint32_t handle, int tiling, int stride) { struct drm_i915_gem_set_tiling st; int ret; @@ -262,8 +262,16 @@ void gem_set_tiling(int fd, uint32_t handle, int tiling, int stride) ret = ioctl(fd, DRM_IOCTL_I915_GEM_SET_TILING, &st); } while (ret == -1 && (errno == EINTR || errno == EAGAIN)); - igt_assert(ret == 0); + if (ret != 0) + return -errno; + igt_assert(st.tiling_mode == tiling); + return 0; +} + +void gem_set_tiling(int fd, uint32_t handle, int tiling, int stride) +{ + igt_assert(__gem_set_tiling(fd, handle, tiling, stride) == 0); } bool gem_has_enable_ring(int fd,int param) @@ -1298,7 +1306,6 @@ static int create_bo_for_fb(int fd, int width, int height, int bpp, bool tiled, uint32_t *gem_handle_ret, unsigned *size_ret, unsigned *stride_ret) { - struct drm_i915_gem_set_tiling set_tiling; uint32_t gem_handle; int size; unsigned stride; @@ -1329,16 +1336,8 @@ static int create_bo_for_fb(int fd, int width, int height, int bpp, gem_handle = gem_create(fd, size); - if (tiled) { - set_tiling.handle = gem_handle; - set_tiling.tiling_mode = I915_TILING_X; - set_tiling.stride = stride; - if (ioctl(fd, DRM_IOCTL_I915_GEM_SET_TILING, &set_tiling)) { - fprintf(stderr, "set tiling failed: %s (stride=%d, size=%d)\n", - strerror(errno), stride, size); - return -1; - } - } + if (tiled) + gem_set_tiling(fd, gem_handle, I915_TILING_X, stride); *stride_ret = stride; *size_ret = size; diff --git a/lib/drmtest.h b/lib/drmtest.h index 6495800e..dac12fac 100644 --- a/lib/drmtest.h +++ b/lib/drmtest.h @@ -55,6 +55,7 @@ void gem_quiescent_gpu(int fd); /* ioctl wrappers and similar stuff for bare metal testing */ void gem_set_tiling(int fd, uint32_t handle, int tiling, int stride); +int __gem_set_tiling(int fd, uint32_t handle, int tiling, int stride); bool gem_has_enable_ring(int fd,int param); bool gem_has_bsd(int fd); bool gem_has_blt(int fd); |