Yalong Liu | bdcf912 | 2018-01-19 18:35:02 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 Amlogic, Inc. All rights reserved. |
| 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 FROM, |
| 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 21 | * SOFTWARE. |
| 22 | * |
| 23 | */ |
| 24 | |
| 25 | #ifndef _AMLOGIC_DRM_H_ |
| 26 | #define _AMLOGIC_DRM_H_ |
| 27 | |
| 28 | #include <stdint.h> |
| 29 | #include "drm.h" |
| 30 | |
| 31 | /** |
| 32 | * User-desired buffer creation information structure. |
| 33 | * |
| 34 | * @size: user-desired memory allocation size. |
| 35 | * - this size value would be page-aligned internally. |
| 36 | * @flags: user request for setting memory type or cache attributes. |
| 37 | * @handle: returned a handle to created gem object. |
| 38 | * - this handle will be set by gem module of kernel side. |
| 39 | */ |
| 40 | struct drm_amlogic_gem_create { |
| 41 | uint64_t size; |
| 42 | uint32_t flags; |
| 43 | uint32_t handle; |
| 44 | }; |
| 45 | |
| 46 | /** |
| 47 | * A structure for getting buffer offset. |
| 48 | * |
| 49 | * @handle: a pointer to gem object created. |
| 50 | * @pad: just padding to be 64-bit aligned. |
| 51 | * @offset: relatived offset value of the memory region allocated. |
| 52 | * - this value should be set by user. |
| 53 | */ |
| 54 | struct drm_amlogic_gem_map_off { |
| 55 | uint32_t handle; |
| 56 | uint32_t pad; |
| 57 | uint64_t offset; |
| 58 | }; |
| 59 | |
| 60 | #define DRM_AMLOGIC_GEM_CREATE 0x00 |
| 61 | #define DRM_AMLOGIC_GEM_MAP_OFFSET 0x01 |
| 62 | |
| 63 | #define DRM_IOCTL_AMLOGIC_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \ |
| 64 | DRM_AMLOGIC_GEM_CREATE, struct drm_amlogic_gem_create) |
| 65 | |
| 66 | #define DRM_IOCTL_AMLOGIC_GEM_MAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + \ |
| 67 | DRM_AMLOGIC_GEM_MAP_OFFSET, struct drm_amlogic_gem_map_off) |
| 68 | |
| 69 | #endif |