blob: 99094c1561b0270bae164f88dc8c154e26d51228 [file] [log] [blame]
Chia-I Wu82f50aa2014-08-05 10:43:03 +08001/*
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
30struct intel_mem;
31
32struct 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
43struct intel_base {
44 const struct icd_dispatch_table *dispatch;
45 struct intel_base_dbg *dbg;
46
47 XGL_MEMORY_REQUIREMENTS mem_requirements;
48};
49
50struct intel_obj {
51 struct intel_base base;
52
53 void (*destroy)(struct intel_obj *obj);
54
55 struct intel_mem *mem;
56 XGL_SIZE offset;
57};
58
59struct intel_state {
60 struct intel_obj obj;
61};
62
63static inline struct intel_base *intel_base(XGL_BASE_OBJECT base)
64{
65 return (struct intel_base *) base;
66}
67
68static inline struct intel_obj *intel_obj(XGL_OBJECT obj)
69{
70 return (struct intel_obj *) obj;
71}
72
73static inline struct intel_state *intel_state(XGL_STATE_OBJECT state)
74{
75 return (struct intel_state *) state;
76}
77
78bool intel_base_is_valid(const struct intel_base *base);
79
80struct intel_base_dbg *intel_base_dbg_create(XGL_DBG_OBJECT_TYPE type,
81 const void *create_info,
82 XGL_SIZE create_info_size);
83void intel_base_dbg_destroy(struct intel_base_dbg *dbg);
84
85bool intel_base_dbg_init(struct intel_base_dbg *dbg,
86 XGL_DBG_OBJECT_TYPE type,
87 const void *create_info,
88 XGL_SIZE create_info_size);
89void intel_base_dbg_cleanup(struct intel_base_dbg *dbg);
90
Chia-I Wu53fc6aa2014-08-06 14:22:51 +080091XGL_RESULT XGLAPI intelDestroyObject(
92 XGL_OBJECT object);
93
94XGL_RESULT XGLAPI intelGetObjectInfo(
95 XGL_BASE_OBJECT object,
96 XGL_OBJECT_INFO_TYPE infoType,
97 XGL_SIZE* pDataSize,
98 XGL_VOID* pData);
99
100XGL_RESULT XGLAPI intelBindObjectMemory(
101 XGL_OBJECT object,
102 XGL_GPU_MEMORY mem,
103 XGL_GPU_SIZE offset);
104
Chia-I Wu82f50aa2014-08-05 10:43:03 +0800105#endif /* OBJ_H */