mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2026-08-20 21:02:59 +00:00
lib/drmtest: extract gem_read
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
@@ -95,20 +95,6 @@ static void *gem_mmap(int fd, uint32_t handle, int size, int prot)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static void
|
||||
gem_read(int fd, uint32_t handle, int offset, int length, void *buf)
|
||||
{
|
||||
struct drm_i915_gem_pread pread;
|
||||
int ret;
|
||||
|
||||
pread.handle = handle;
|
||||
pread.offset = offset;
|
||||
pread.size = length;
|
||||
pread.data_ptr = (uintptr_t)buf;
|
||||
ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_PREAD, &pread);
|
||||
assert(ret == 0);
|
||||
}
|
||||
|
||||
static void
|
||||
gem_get_tiling(int fd, uint32_t handle, uint32_t *tiling, uint32_t *swizzle)
|
||||
{
|
||||
@@ -175,7 +161,7 @@ main(int argc, char **argv)
|
||||
handle = create_bo_and_fill(fd);
|
||||
gem_get_tiling(fd, handle, &tiling, &swizzle);
|
||||
|
||||
gem_read(fd, handle, 0, sizeof(linear), linear);
|
||||
gem_read(fd, handle, 0, linear, sizeof(linear));
|
||||
|
||||
handle_target = create_bo(fd);
|
||||
gem_write(fd, handle_target, 0, linear, sizeof(linear));
|
||||
|
||||
Reference in New Issue
Block a user