Chia-I Wu | 82f50aa | 2014-08-05 10:43:03 +0800 | [diff] [blame] | 1 | /* |
| 2 | * XGL |
| 3 | * |
| 4 | * Copyright (C) 2014 LunarG, Inc. |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 7 | * copy of this software and associated documentation files (the "Software"), |
| 8 | * to deal in the Software without restriction, including without limitation |
| 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 10 | * and/or sell copies of the Software, and to permit persons to whom the |
| 11 | * Software is furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included |
| 14 | * in all copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 22 | * DEALINGS IN THE SOFTWARE. |
| 23 | */ |
| 24 | |
| 25 | #ifndef OBJ_H |
| 26 | #define OBJ_H |
| 27 | |
| 28 | #include "intel.h" |
| 29 | |
| 30 | struct intel_mem; |
| 31 | |
| 32 | struct intel_base_dbg { |
| 33 | int alloc_id; |
| 34 | XGL_DBG_OBJECT_TYPE type; |
| 35 | |
| 36 | void *create_info; |
| 37 | XGL_SIZE create_info_size; |
| 38 | |
| 39 | void *tag; |
| 40 | XGL_SIZE tag_size; |
| 41 | }; |
| 42 | |
| 43 | struct intel_base { |
| 44 | const struct icd_dispatch_table *dispatch; |
Chia-I Wu | 26f0bd0 | 2014-08-07 10:38:40 +0800 | [diff] [blame^] | 45 | |
Chia-I Wu | 82f50aa | 2014-08-05 10:43:03 +0800 | [diff] [blame] | 46 | struct intel_base_dbg *dbg; |
| 47 | |
Chia-I Wu | 26f0bd0 | 2014-08-07 10:38:40 +0800 | [diff] [blame^] | 48 | XGL_RESULT (*get_info)(struct intel_base *base, int type, |
| 49 | XGL_SIZE *size, XGL_VOID *data); |
Chia-I Wu | 82f50aa | 2014-08-05 10:43:03 +0800 | [diff] [blame] | 50 | }; |
| 51 | |
| 52 | struct intel_obj { |
| 53 | struct intel_base base; |
| 54 | |
| 55 | void (*destroy)(struct intel_obj *obj); |
| 56 | |
Chia-I Wu | 26f0bd0 | 2014-08-07 10:38:40 +0800 | [diff] [blame^] | 57 | /* for memory binding */ |
Chia-I Wu | 82f50aa | 2014-08-05 10:43:03 +0800 | [diff] [blame] | 58 | struct intel_mem *mem; |
| 59 | XGL_SIZE offset; |
| 60 | }; |
| 61 | |
| 62 | struct intel_state { |
| 63 | struct intel_obj obj; |
| 64 | }; |
| 65 | |
| 66 | static inline struct intel_base *intel_base(XGL_BASE_OBJECT base) |
| 67 | { |
| 68 | return (struct intel_base *) base; |
| 69 | } |
| 70 | |
| 71 | static inline struct intel_obj *intel_obj(XGL_OBJECT obj) |
| 72 | { |
| 73 | return (struct intel_obj *) obj; |
| 74 | } |
| 75 | |
| 76 | static inline struct intel_state *intel_state(XGL_STATE_OBJECT state) |
| 77 | { |
| 78 | return (struct intel_state *) state; |
| 79 | } |
| 80 | |
| 81 | bool intel_base_is_valid(const struct intel_base *base); |
| 82 | |
Chia-I Wu | 26f0bd0 | 2014-08-07 10:38:40 +0800 | [diff] [blame^] | 83 | XGL_RESULT intel_base_get_info(struct intel_base *base, int type, |
| 84 | XGL_SIZE *size, XGL_VOID *data); |
| 85 | |
Chia-I Wu | 82f50aa | 2014-08-05 10:43:03 +0800 | [diff] [blame] | 86 | struct intel_base_dbg *intel_base_dbg_create(XGL_DBG_OBJECT_TYPE type, |
| 87 | const void *create_info, |
| 88 | XGL_SIZE create_info_size); |
| 89 | void intel_base_dbg_destroy(struct intel_base_dbg *dbg); |
| 90 | |
| 91 | bool intel_base_dbg_init(struct intel_base_dbg *dbg, |
| 92 | XGL_DBG_OBJECT_TYPE type, |
| 93 | const void *create_info, |
| 94 | XGL_SIZE create_info_size); |
| 95 | void intel_base_dbg_cleanup(struct intel_base_dbg *dbg); |
| 96 | |
Chia-I Wu | 53fc6aa | 2014-08-06 14:22:51 +0800 | [diff] [blame] | 97 | XGL_RESULT XGLAPI intelDestroyObject( |
| 98 | XGL_OBJECT object); |
| 99 | |
| 100 | XGL_RESULT XGLAPI intelGetObjectInfo( |
| 101 | XGL_BASE_OBJECT object, |
| 102 | XGL_OBJECT_INFO_TYPE infoType, |
| 103 | XGL_SIZE* pDataSize, |
| 104 | XGL_VOID* pData); |
| 105 | |
| 106 | XGL_RESULT XGLAPI intelBindObjectMemory( |
| 107 | XGL_OBJECT object, |
| 108 | XGL_GPU_MEMORY mem, |
| 109 | XGL_GPU_SIZE offset); |
| 110 | |
Chia-I Wu | 82f50aa | 2014-08-05 10:43:03 +0800 | [diff] [blame] | 111 | #endif /* OBJ_H */ |