1 /*
2  * Copyright © 2016 Broadcom
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 
24 #ifndef IGT_V3D_H
25 #define IGT_V3D_H
26 
27 #include "v3d_drm.h"
28 
29 struct v3d_bo {
30 	int handle;
31 	uint32_t offset;
32 	uint32_t size;
33 	void *map;
34 };
35 
36 struct v3d_bo *igt_v3d_create_bo(int fd, size_t size);
37 void igt_v3d_free_bo(int fd, struct v3d_bo *bo);
38 
39 /* IOCTL wrappers */
40 uint32_t igt_v3d_get_bo_offset(int fd, uint32_t handle);
41 uint32_t igt_v3d_get_param(int fd, enum drm_v3d_param param);
42 void *igt_v3d_mmap_bo(int fd, uint32_t handle, uint32_t size, unsigned prot);
43 
44 void igt_v3d_bo_mmap(int fd, struct v3d_bo *bo);
45 
46 #endif /* IGT_V3D_H */
47