2 * Copyright © 2009 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 * Daniel Vetter <daniel.vetter@ffwll.ch>
28 /** @file gem_gtt_cpu_tlb.c
30 * This test checks whether gtt tlbs for cpu access are correctly invalidated.
41 #include <sys/ioctl.h>
43 #include "ioctl_wrappers.h"
45 #include "intel_gpu_tools.h"
47 #define OBJ_SIZE (1024*1024)
49 #define PAGE_SIZE 4096
58 handle = gem_create(fd, OBJ_SIZE);
60 /* Fill the BO with dwords starting at start_val */
61 data = gem_mmap(fd, handle, OBJ_SIZE, PROT_READ | PROT_WRITE);
62 for (i = 0; i < OBJ_SIZE/4; i++)
64 munmap(data, OBJ_SIZE);
77 igt_skip_on_simulation();
81 handle = gem_create(fd, OBJ_SIZE);
84 ptr = gem_mmap(fd, handle, OBJ_SIZE, PROT_READ | PROT_WRITE);
86 munmap(ptr, OBJ_SIZE);
88 gem_close(fd, handle);
90 /* stirr up the page allocator a bit. */
91 ptr = malloc(OBJ_SIZE);
93 memset(ptr, 0x1, OBJ_SIZE);
95 handle = create_bo(fd);
97 /* Read a bunch of random subsets of the data and check that they come
100 gem_read(fd, handle, 0, ptr, OBJ_SIZE);
101 for (i = 0; i < OBJ_SIZE/4; i++)
102 igt_assert(ptr[i] == i);