1 /*
2  * Copyright (c) Fuzhou Rockchip Electronics Co.Ltd
3  * Authors:
4  *       Mark Yao <yzq@rock-chips.com>
5  *
6  * based on exynos_drm.h
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a
9  * copy of this software and associated documentation files (the "Software"),
10  * to deal in the Software without restriction, including without limitation
11  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12  * and/or sell copies of the Software, and to permit persons to whom the
13  * Software is furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice (including the next
16  * paragraph) shall be included in all copies or substantial portions of the
17  * Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
22  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25  * SOFTWARE.
26  *
27  */
28 
29 #ifndef _ROCKCHIP_DRM_H_
30 #define _ROCKCHIP_DRM_H_
31 
32 #include <stdint.h>
33 #include "drm.h"
34 
35 /**
36  * User-desired buffer creation information structure.
37  *
38  * @size: user-desired memory allocation size.
39  *	- this size value would be page-aligned internally.
40  * @flags: user request for setting memory type or cache attributes.
41  * @handle: returned a handle to created gem object.
42  *	- this handle will be set by gem module of kernel side.
43  */
44 struct drm_rockchip_gem_create {
45 	uint64_t size;
46 	uint32_t flags;
47 	uint32_t handle;
48 };
49 
50 /**
51  * A structure for getting buffer offset.
52  *
53  * @handle: a pointer to gem object created.
54  * @pad: just padding to be 64-bit aligned.
55  * @offset: relatived offset value of the memory region allocated.
56  *	- this value should be set by user.
57  */
58 struct drm_rockchip_gem_map_off {
59 	uint32_t handle;
60 	uint32_t pad;
61 	uint64_t offset;
62 };
63 
64 #define DRM_ROCKCHIP_GEM_CREATE	0x00
65 #define DRM_ROCKCHIP_GEM_MAP_OFFSET	0x01
66 
67 #define DRM_IOCTL_ROCKCHIP_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
68 		DRM_ROCKCHIP_GEM_CREATE, struct drm_rockchip_gem_create)
69 
70 #define DRM_IOCTL_ROCKCHIP_GEM_MAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + \
71 		DRM_ROCKCHIP_GEM_MAP_OFFSET, struct drm_rockchip_gem_map_off)
72 
73 #endif
74