blob: b398ba34dce1689b1afcac86078369c119f1bdae [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
David Pinedo0257fbf2015-02-02 18:02:40 -070043#include "icd.h"
David Pinedo0257fbf2015-02-02 18:02:40 -070044
45#include "icd-format.h"
46#include "icd-utils.h"
47
48struct nulldrv_base {
49 void *loader_data;
50 uint32_t magic;
51 XGL_RESULT (*get_info)(struct nulldrv_base *base, int type1,
52 size_t *size, void *data);
53};
54
55struct nulldrv_obj {
56 struct nulldrv_base base;
57};
58
David Pinedo0257fbf2015-02-02 18:02:40 -070059enum nulldrv_ext_type {
60 NULLDRV_EXT_WSI_X11,
61 NULLDRV_EXT_WSI_WINDOWS,
62 NULLDRV_EXT_COUNT,
63 NULLDRV_EXT_INVALID = NULLDRV_EXT_COUNT,
64};
65
66
67struct nulldrv_instance {
68 struct nulldrv_obj obj;
69};
70
71struct nulldrv_gpu {
72 void *loader_data;
73};
74
75struct nulldrv_dev {
76 struct nulldrv_base base;
77 bool exts[NULLDRV_EXT_COUNT];
Chia-I Wu8d24b3b2015-03-26 13:14:16 +080078 struct nulldrv_desc_ooxx *desc_ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -070079 struct nulldrv_queue *queues[1];
80};
81
Chia-I Wu8d24b3b2015-03-26 13:14:16 +080082struct nulldrv_desc_ooxx {
David Pinedo0257fbf2015-02-02 18:02:40 -070083 uint32_t surface_desc_size;
84 uint32_t sampler_desc_size;
85};
86
87
88struct nulldrv_queue {
89 struct nulldrv_base base;
90 struct nulldrv_dev *dev;
91};
92
93struct nulldrv_rt_view {
94 struct nulldrv_obj obj;
95};
96
97struct nulldrv_fence {
98 struct nulldrv_obj obj;
99};
100
101struct nulldrv_img {
102 struct nulldrv_obj obj;
103 XGL_IMAGE_TYPE type;
104 int32_t depth;
105 uint32_t mip_levels;
106 uint32_t array_size;
107 XGL_FLAGS usage;
108 XGL_IMAGE_FORMAT_CLASS format_class;
109 uint32_t samples;
110 size_t total_size;
111};
112
113struct nulldrv_mem {
114 struct nulldrv_base base;
115 struct nulldrv_bo *bo;
116 XGL_GPU_SIZE size;
117};
118
119struct nulldrv_ds_view {
120 struct nulldrv_obj obj;
121 struct nulldrv_img *img;
122 uint32_t array_size;
123};
124
125struct nulldrv_sampler {
126 struct nulldrv_obj obj;
127};
128
129struct nulldrv_img_view {
130 struct nulldrv_obj obj;
131 struct nulldrv_img *img;
132 float min_lod;
133 uint32_t cmd_len;
134};
135
136struct nulldrv_buf {
137 struct nulldrv_obj obj;
138 XGL_GPU_SIZE size;
139 XGL_FLAGS usage;
140};
141
142struct nulldrv_desc_layout {
143 struct nulldrv_obj obj;
144};
145
146struct nulldrv_shader {
147 struct nulldrv_obj obj;
148
149};
150
151
152struct nulldrv_pipeline {
153 struct nulldrv_obj obj;
154 struct nulldrv_dev *dev;
155};
156
157struct nulldrv_dynamic_vp {
158 struct nulldrv_obj obj;
159};
160
161struct nulldrv_dynamic_rs {
162 struct nulldrv_obj obj;
163};
164
165struct nulldrv_dynamic_cb {
166 struct nulldrv_obj obj;
167};
168
169struct nulldrv_dynamic_ds {
170 struct nulldrv_obj obj;
171};
172
173struct nulldrv_cmd {
174 struct nulldrv_obj obj;
175};
176
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800177struct nulldrv_desc_pool {
David Pinedo0257fbf2015-02-02 18:02:40 -0700178 struct nulldrv_obj obj;
179 struct nulldrv_dev *dev;
180};
181
182struct nulldrv_desc_set {
183 struct nulldrv_obj obj;
Chia-I Wu8d24b3b2015-03-26 13:14:16 +0800184 struct nulldrv_desc_ooxx *ooxx;
David Pinedo0257fbf2015-02-02 18:02:40 -0700185 const struct nulldrv_desc_layout *layout;
186};
187
188struct nulldrv_framebuffer {
189 struct nulldrv_obj obj;
190};
191
192struct nulldrv_render_pass {
193 struct nulldrv_obj obj;
194};
195
David Pinedo8e9cb3b2015-02-10 15:02:08 -0700196struct nulldrv_buf_view {
197 struct nulldrv_obj obj;
198
199 struct nulldrv_buf *buf;
200
201 /* SURFACE_STATE */
202 uint32_t cmd[8];
203 uint32_t fs_cmd[8];
204 uint32_t cmd_len;
205};
206
David Pinedo0257fbf2015-02-02 18:02:40 -0700207#endif /* NULLDRV_H */