2 * Copyright © 2008 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 * Jesse Barnes <jbarnes@virtuousgeek.org>
35 #include <sys/ioctl.h>
37 #include "ioctl_wrappers.h"
40 /* Should take 64 pages to store the page pointers on 64 bit */
41 #define OBJ_SIZE (128 * 1024 * 1024)
43 unsigned char data[OBJ_SIZE];
46 test_large_object(int fd)
48 struct drm_i915_gem_create create;
49 struct drm_i915_gem_pin pin;
53 memset(&create, 0, sizeof(create));
54 memset(&pin, 0, sizeof(pin));
56 if (gem_aperture_size(fd)*3/4 < OBJ_SIZE/2)
57 obj_size = OBJ_SIZE / 4;
58 else if (gem_aperture_size(fd)*3/4 < OBJ_SIZE)
59 obj_size = OBJ_SIZE / 2;
62 create.size = obj_size;
63 igt_info("obj size %i\n", obj_size);
65 igt_assert(ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create) == 0);
68 ptr = gem_mmap__gtt(fd, create.handle, obj_size, PROT_WRITE | PROT_READ);
71 gem_write(fd, create.handle, 0, data, obj_size);
73 /* kernel should clean this up for us */
80 igt_skip_on_simulation();
84 test_large_object(fd);