blob: e913aa6566b29d520d781649c92f66fad5373544 [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;
Chia-I Wu26f0bd02014-08-07 10:38:40 +080045
Chia-I Wu82f50aa2014-08-05 10:43:03 +080046 struct intel_base_dbg *dbg;
47
Chia-I Wu26f0bd02014-08-07 10:38:40 +080048 XGL_RESULT (*get_info)(struct intel_base *base, int type,
49 XGL_SIZE *size, XGL_VOID *data);
Chia-I Wu82f50aa2014-08-05 10:43:03 +080050};
51
52struct intel_obj {
53 struct intel_base base;
54
55 void (*destroy)(struct intel_obj *obj);
56
Chia-I Wu26f0bd02014-08-07 10:38:40 +080057 /* for memory binding */
Chia-I Wu82f50aa2014-08-05 10:43:03 +080058 struct intel_mem *mem;
59 XGL_SIZE offset;
60};
61
62struct intel_state {
63 struct intel_obj obj;
64};
65
66static inline struct intel_base *intel_base(XGL_BASE_OBJECT base)
67{
68 return (struct intel_base *) base;
69}
70
71static inline struct intel_obj *intel_obj(XGL_OBJECT obj)
72{
73 return (struct intel_obj *) obj;
74}
75
76static inline struct intel_state *intel_state(XGL_STATE_OBJECT state)
77{
78 return (struct intel_state *) state;
79}
80
81bool intel_base_is_valid(const struct intel_base *base);
82
Chia-I Wu26f0bd02014-08-07 10:38:40 +080083XGL_RESULT intel_base_get_info(struct intel_base *base, int type,
84 XGL_SIZE *size, XGL_VOID *data);
85
Chia-I Wu82f50aa2014-08-05 10:43:03 +080086struct intel_base_dbg *intel_base_dbg_create(XGL_DBG_OBJECT_TYPE type,
87 const void *create_info,
88 XGL_SIZE create_info_size);
89void intel_base_dbg_destroy(struct intel_base_dbg *dbg);
90
91bool 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);
95void intel_base_dbg_cleanup(struct intel_base_dbg *dbg);
96
Chia-I Wu53fc6aa2014-08-06 14:22:51 +080097XGL_RESULT XGLAPI intelDestroyObject(
98 XGL_OBJECT object);
99
100XGL_RESULT XGLAPI intelGetObjectInfo(
101 XGL_BASE_OBJECT object,
102 XGL_OBJECT_INFO_TYPE infoType,
103 XGL_SIZE* pDataSize,
104 XGL_VOID* pData);
105
106XGL_RESULT XGLAPI intelBindObjectMemory(
107 XGL_OBJECT object,
108 XGL_GPU_MEMORY mem,
109 XGL_GPU_SIZE offset);
110
Chia-I Wu82f50aa2014-08-05 10:43:03 +0800111#endif /* OBJ_H */