aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/radeon_gem_basic.c')
-rw-r--r--tests/radeon_gem_basic.c114
1 files changed, 0 insertions, 114 deletions
diff --git a/tests/radeon_gem_basic.c b/tests/radeon_gem_basic.c
deleted file mode 100644
index d8231879..00000000
--- a/tests/radeon_gem_basic.c
+++ /dev/null
@@ -1,114 +0,0 @@
1/*
2 * Copyright © 2008 Intel Corporation
3 *
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:
10 *
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
13 * Software.
14 *
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
21 * IN THE SOFTWARE.
22 *
23 * Authors:
24 * Eric Anholt <eric@anholt.net>
25 *
26 */
27
28#include <stdlib.h>
29#include <stdio.h>
30#include <string.h>
31#include <assert.h>
32#include <fcntl.h>
33#include <inttypes.h>
34#include <errno.h>
35#include <sys/stat.h>
36#include "drm.h"
37#include "radeon_drm.h"
38
39static void
40test_bad_close(int fd)
41{
42 struct drm_gem_close close;
43 int ret;
44
45 printf("Testing error return on bad close ioctl.\n");
46
47 close.handle = 0x10101010;
48 ret = ioctl(fd, DRM_IOCTL_GEM_CLOSE, &close);
49
50 assert(ret == -1 && errno == EINVAL);
51}
52
53static void
54test_create_close(int fd)
55{
56 struct drm_radeon_gem_create create;
57 struct drm_gem_close close;
58 int ret;
59
60 printf("Testing creating and closing an object.\n");
61
62 memset(&create, 0, sizeof(create));
63 create.size = 16 * 1024;
64 ret = ioctl(fd, DRM_IOCTL_RADEON_GEM_CREATE, &create);
65 assert(ret == 0);
66
67 close.handle = create.handle;
68 ret = ioctl(fd, DRM_IOCTL_GEM_CLOSE, &close);
69}
70
71static void
72test_create_fd_close(int fd)
73{
74 struct drm_radeon_gem_create create;
75 int ret;
76
77 printf("Testing closing with an object allocated.\n");
78
79 memset(&create, 0, sizeof(create));
80 create.size = 16 * 1024;
81 ret = ioctl(fd, DRM_IOCTL_RADEON_GEM_CREATE, &create);
82 assert(ret == 0);
83
84 close(fd);
85}
86
87int test_gem_info(int fd)
88{
89 struct drm_radeon_gem_info info;
90 int ret;
91
92 ret = ioctl(fd, DRM_IOCTL_RADEON_GEM_INFO, &info);
93 assert(ret == 0);
94
95 fprintf(stderr,"%lld %lld %lld %lld %lld\n",
96 info.gtt_start, info.gtt_size,
97 info.vram_start, info.vram_size,
98 info.vram_visible);
99
100}
101
102int main(int argc, char **argv)
103{
104 int fd;
105
106 fd = drm_open_any();
107
108 test_gem_info(fd);
109 test_bad_close(fd);
110 test_create_close(fd);
111 test_create_fd_close(fd);
112
113 return 0;
114}