blob: b32cbb771d9088c46e175c7d4da0be8f6aa658e4 [file] [log] [blame]
David Pinedo0257fbf2015-02-02 18:02:40 -07001/*
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 NULLDRV_H
26#define NULLDRV_H
27#include <stdlib.h>
28#include <stdbool.h>
29#include <stdint.h>
30#include <string.h>
31#include <assert.h>
32
33#include <xgl.h>
34#include <xglDbg.h>
35#include <xglIcd.h>
36
37#if defined(PLATFORM_LINUX)
38#include <xglWsiX11Ext.h>
39#else
40#include <xglWsiWinExt.h>
41#endif
42
43#ifndef STATIC_INLINE
44#if defined(PLATFORM_LINUX)
45#define STATIC_INLINE static inline
46#else
47#define STATIC_INLINE static
48#endif
49#endif
50
51#include "icd.h"
52#include "icd-alloc.h"
53
54#include "icd-format.h"
55#include "icd-utils.h"
56
57struct nulldrv_base {
58 void *loader_data;
59 uint32_t magic;
60 XGL_RESULT (*get_info)(struct nulldrv_base *base, int type1,
61 size_t *size, void *data);
62};
63
64struct nulldrv_obj {
65 struct nulldrv_base base;
66};
67
68struct nulldrv_base *nulldrv_base_create(struct nulldrv_dev *dev,
69 size_t obj_size,
70 XGL_DBG_OBJECT_TYPE type1);
71
72enum nulldrv_ext_type {
73 NULLDRV_EXT_WSI_X11,
74 NULLDRV_EXT_WSI_WINDOWS,
75 NULLDRV_EXT_COUNT,
76 NULLDRV_EXT_INVALID = NULLDRV_EXT_COUNT,
77};
78
79
80struct nulldrv_instance {
81 struct nulldrv_obj obj;
82};
83
84struct nulldrv_gpu {
85 void *loader_data;
86};
87
88struct nulldrv_dev {
89 struct nulldrv_base base;
90 bool exts[NULLDRV_EXT_COUNT];
91 struct nulldrv_desc_pool *desc_pool;
92 struct nulldrv_queue *queues[1];
93};
94
95struct nulldrv_layout {
96 enum nulldrv_layout_aux_type aux;
97};
98
99struct nulldrv_desc_pool {
100 uint32_t surface_desc_size;
101 uint32_t sampler_desc_size;
102};
103
104
105struct nulldrv_queue {
106 struct nulldrv_base base;
107 struct nulldrv_dev *dev;
108};
109
110struct nulldrv_rt_view {
111 struct nulldrv_obj obj;
112};
113
114struct nulldrv_fence {
115 struct nulldrv_obj obj;
116};
117
118struct nulldrv_img {
119 struct nulldrv_obj obj;
120 XGL_IMAGE_TYPE type;
121 int32_t depth;
122 uint32_t mip_levels;
123 uint32_t array_size;
124 XGL_FLAGS usage;
125 XGL_IMAGE_FORMAT_CLASS format_class;
126 uint32_t samples;
127 size_t total_size;
128};
129
130struct nulldrv_mem {
131 struct nulldrv_base base;
132 struct nulldrv_bo *bo;
133 XGL_GPU_SIZE size;
134};
135
136struct nulldrv_ds_view {
137 struct nulldrv_obj obj;
138 struct nulldrv_img *img;
139 uint32_t array_size;
140};
141
142struct nulldrv_sampler {
143 struct nulldrv_obj obj;
144};
145
146struct nulldrv_img_view {
147 struct nulldrv_obj obj;
148 struct nulldrv_img *img;
149 float min_lod;
150 uint32_t cmd_len;
151};
152
153struct nulldrv_buf {
154 struct nulldrv_obj obj;
155 XGL_GPU_SIZE size;
156 XGL_FLAGS usage;
157};
158
159struct nulldrv_desc_layout {
160 struct nulldrv_obj obj;
161};
162
163struct nulldrv_shader {
164 struct nulldrv_obj obj;
165
166};
167
168
169struct nulldrv_pipeline {
170 struct nulldrv_obj obj;
171 struct nulldrv_dev *dev;
172};
173
174struct nulldrv_dynamic_vp {
175 struct nulldrv_obj obj;
176};
177
178struct nulldrv_dynamic_rs {
179 struct nulldrv_obj obj;
180};
181
182struct nulldrv_dynamic_cb {
183 struct nulldrv_obj obj;
184};
185
186struct nulldrv_dynamic_ds {
187 struct nulldrv_obj obj;
188};
189
190struct nulldrv_cmd {
191 struct nulldrv_obj obj;
192};
193
194struct nulldrv_desc_region {
195 struct nulldrv_obj obj;
196 struct nulldrv_dev *dev;
197};
198
199struct nulldrv_desc_set {
200 struct nulldrv_obj obj;
201 struct nulldrv_desc_pool *pool;
202 const struct nulldrv_desc_layout *layout;
203};
204
205struct nulldrv_framebuffer {
206 struct nulldrv_obj obj;
207};
208
209struct nulldrv_render_pass {
210 struct nulldrv_obj obj;
211};
212
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700213struct nulldrv_buf_view {
214 struct nulldrv_obj obj;
215
216 struct nulldrv_buf *buf;
217
218 /* SURFACE_STATE */
219 uint32_t cmd[8];
220 uint32_t fs_cmd[8];
221 uint32_t cmd_len;
222};
223
David Pinedo0257fbf2015-02-02 18:02:40 -0700224#endif /* NULLDRV_H */