lib/drmtest: extract gem_read

Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Daniel Vetter
2012-01-10 15:37:53 +01:00
parent 319638ba6d
commit bd5cf9a07d
10 changed files with 20 additions and 105 deletions
+1 -15
View File
@@ -76,20 +76,6 @@ gem_aperture_size(int fd)
return aperture.aper_size;
}
static void
gem_read(int fd, uint32_t handle, int offset, int size, void *buf)
{
struct drm_i915_gem_pread pread;
int ret;
pread.handle = handle;
pread.offset = offset;
pread.size = size;
pread.data_ptr = (uintptr_t)buf;
ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_PREAD, &pread);
assert(ret == 0);
}
static void
copy(int fd, uint32_t dst, uint32_t src)
{
@@ -199,7 +185,7 @@ check_bo(int fd, uint32_t handle, uint32_t val)
{
int i;
gem_read(fd, handle, 0, sizeof(linear), linear);
gem_read(fd, handle, 0, linear, sizeof(linear));
for (i = 0; i < WIDTH*HEIGHT; i++) {
if (linear[i] != val) {
fprintf(stderr, "Expected 0x%08x, found 0x%08x "