xref: /aosp_15_r20/external/virglrenderer/src/venus/venus-protocol/vn_protocol_renderer_event.h (revision bbecb9d118dfdb95f99bd754f8fa9be01f189df3)
1 /* This file is generated by venus-protocol.  See vn_protocol_renderer.h. */
2 
3 /*
4  * Copyright 2020 Google LLC
5  * SPDX-License-Identifier: MIT
6  */
7 
8 #ifndef VN_PROTOCOL_RENDERER_EVENT_H
9 #define VN_PROTOCOL_RENDERER_EVENT_H
10 
11 #include "vn_protocol_renderer_structs.h"
12 
13 #pragma GCC diagnostic push
14 #pragma GCC diagnostic ignored "-Wpointer-arith"
15 #pragma GCC diagnostic ignored "-Wunused-parameter"
16 
17 /* struct VkEventCreateInfo chain */
18 
19 static inline void *
vn_decode_VkEventCreateInfo_pnext_temp(struct vn_cs_decoder * dec)20 vn_decode_VkEventCreateInfo_pnext_temp(struct vn_cs_decoder *dec)
21 {
22     /* no known/supported struct */
23     if (vn_decode_simple_pointer(dec))
24         vn_cs_decoder_set_fatal(dec);
25     return NULL;
26 }
27 
28 static inline void
vn_decode_VkEventCreateInfo_self_temp(struct vn_cs_decoder * dec,VkEventCreateInfo * val)29 vn_decode_VkEventCreateInfo_self_temp(struct vn_cs_decoder *dec, VkEventCreateInfo *val)
30 {
31     /* skip val->{sType,pNext} */
32     vn_decode_VkFlags(dec, &val->flags);
33 }
34 
35 static inline void
vn_decode_VkEventCreateInfo_temp(struct vn_cs_decoder * dec,VkEventCreateInfo * val)36 vn_decode_VkEventCreateInfo_temp(struct vn_cs_decoder *dec, VkEventCreateInfo *val)
37 {
38     VkStructureType stype;
39     vn_decode_VkStructureType(dec, &stype);
40     if (stype != VK_STRUCTURE_TYPE_EVENT_CREATE_INFO)
41         vn_cs_decoder_set_fatal(dec);
42 
43     val->sType = stype;
44     val->pNext = vn_decode_VkEventCreateInfo_pnext_temp(dec);
45     vn_decode_VkEventCreateInfo_self_temp(dec, val);
46 }
47 
48 static inline void
vn_replace_VkEventCreateInfo_handle_self(VkEventCreateInfo * val)49 vn_replace_VkEventCreateInfo_handle_self(VkEventCreateInfo *val)
50 {
51     /* skip val->sType */
52     /* skip val->pNext */
53     /* skip val->flags */
54 }
55 
56 static inline void
vn_replace_VkEventCreateInfo_handle(VkEventCreateInfo * val)57 vn_replace_VkEventCreateInfo_handle(VkEventCreateInfo *val)
58 {
59     struct VkBaseOutStructure *pnext = (struct VkBaseOutStructure *)val;
60 
61     do {
62         switch ((int32_t)pnext->sType) {
63         case VK_STRUCTURE_TYPE_EVENT_CREATE_INFO:
64             vn_replace_VkEventCreateInfo_handle_self((VkEventCreateInfo *)pnext);
65             break;
66         default:
67             /* ignore unknown/unsupported struct */
68             break;
69         }
70         pnext = pnext->pNext;
71     } while (pnext);
72 }
73 
vn_decode_vkCreateEvent_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkCreateEvent * args)74 static inline void vn_decode_vkCreateEvent_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkCreateEvent *args)
75 {
76     vn_decode_VkDevice_lookup(dec, &args->device);
77     if (vn_decode_simple_pointer(dec)) {
78         args->pCreateInfo = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pCreateInfo));
79         if (!args->pCreateInfo) return;
80         vn_decode_VkEventCreateInfo_temp(dec, (VkEventCreateInfo *)args->pCreateInfo);
81     } else {
82         args->pCreateInfo = NULL;
83         vn_cs_decoder_set_fatal(dec);
84     }
85     if (vn_decode_simple_pointer(dec)) {
86         vn_cs_decoder_set_fatal(dec);
87     } else {
88         args->pAllocator = NULL;
89     }
90     if (vn_decode_simple_pointer(dec)) {
91         args->pEvent = vn_cs_decoder_alloc_temp(dec, sizeof(*args->pEvent));
92         if (!args->pEvent) return;
93         vn_decode_VkEvent(dec, args->pEvent);
94     } else {
95         args->pEvent = NULL;
96         vn_cs_decoder_set_fatal(dec);
97     }
98 }
99 
vn_replace_vkCreateEvent_args_handle(struct vn_command_vkCreateEvent * args)100 static inline void vn_replace_vkCreateEvent_args_handle(struct vn_command_vkCreateEvent *args)
101 {
102     vn_replace_VkDevice_handle(&args->device);
103     if (args->pCreateInfo)
104         vn_replace_VkEventCreateInfo_handle((VkEventCreateInfo *)args->pCreateInfo);
105     /* skip args->pAllocator */
106     /* skip args->pEvent */
107 }
108 
vn_encode_vkCreateEvent_reply(struct vn_cs_encoder * enc,const struct vn_command_vkCreateEvent * args)109 static inline void vn_encode_vkCreateEvent_reply(struct vn_cs_encoder *enc, const struct vn_command_vkCreateEvent *args)
110 {
111     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkCreateEvent_EXT});
112 
113     vn_encode_VkResult(enc, &args->ret);
114     /* skip args->device */
115     /* skip args->pCreateInfo */
116     /* skip args->pAllocator */
117     if (vn_encode_simple_pointer(enc, args->pEvent))
118         vn_encode_VkEvent(enc, args->pEvent);
119 }
120 
vn_decode_vkDestroyEvent_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkDestroyEvent * args)121 static inline void vn_decode_vkDestroyEvent_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkDestroyEvent *args)
122 {
123     vn_decode_VkDevice_lookup(dec, &args->device);
124     vn_decode_VkEvent_lookup(dec, &args->event);
125     if (vn_decode_simple_pointer(dec)) {
126         vn_cs_decoder_set_fatal(dec);
127     } else {
128         args->pAllocator = NULL;
129     }
130 }
131 
vn_replace_vkDestroyEvent_args_handle(struct vn_command_vkDestroyEvent * args)132 static inline void vn_replace_vkDestroyEvent_args_handle(struct vn_command_vkDestroyEvent *args)
133 {
134     vn_replace_VkDevice_handle(&args->device);
135     vn_replace_VkEvent_handle(&args->event);
136     /* skip args->pAllocator */
137 }
138 
vn_encode_vkDestroyEvent_reply(struct vn_cs_encoder * enc,const struct vn_command_vkDestroyEvent * args)139 static inline void vn_encode_vkDestroyEvent_reply(struct vn_cs_encoder *enc, const struct vn_command_vkDestroyEvent *args)
140 {
141     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkDestroyEvent_EXT});
142 
143     /* skip args->device */
144     /* skip args->event */
145     /* skip args->pAllocator */
146 }
147 
vn_decode_vkGetEventStatus_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkGetEventStatus * args)148 static inline void vn_decode_vkGetEventStatus_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkGetEventStatus *args)
149 {
150     vn_decode_VkDevice_lookup(dec, &args->device);
151     vn_decode_VkEvent_lookup(dec, &args->event);
152 }
153 
vn_replace_vkGetEventStatus_args_handle(struct vn_command_vkGetEventStatus * args)154 static inline void vn_replace_vkGetEventStatus_args_handle(struct vn_command_vkGetEventStatus *args)
155 {
156     vn_replace_VkDevice_handle(&args->device);
157     vn_replace_VkEvent_handle(&args->event);
158 }
159 
vn_encode_vkGetEventStatus_reply(struct vn_cs_encoder * enc,const struct vn_command_vkGetEventStatus * args)160 static inline void vn_encode_vkGetEventStatus_reply(struct vn_cs_encoder *enc, const struct vn_command_vkGetEventStatus *args)
161 {
162     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkGetEventStatus_EXT});
163 
164     vn_encode_VkResult(enc, &args->ret);
165     /* skip args->device */
166     /* skip args->event */
167 }
168 
vn_decode_vkSetEvent_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkSetEvent * args)169 static inline void vn_decode_vkSetEvent_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkSetEvent *args)
170 {
171     vn_decode_VkDevice_lookup(dec, &args->device);
172     vn_decode_VkEvent_lookup(dec, &args->event);
173 }
174 
vn_replace_vkSetEvent_args_handle(struct vn_command_vkSetEvent * args)175 static inline void vn_replace_vkSetEvent_args_handle(struct vn_command_vkSetEvent *args)
176 {
177     vn_replace_VkDevice_handle(&args->device);
178     vn_replace_VkEvent_handle(&args->event);
179 }
180 
vn_encode_vkSetEvent_reply(struct vn_cs_encoder * enc,const struct vn_command_vkSetEvent * args)181 static inline void vn_encode_vkSetEvent_reply(struct vn_cs_encoder *enc, const struct vn_command_vkSetEvent *args)
182 {
183     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkSetEvent_EXT});
184 
185     vn_encode_VkResult(enc, &args->ret);
186     /* skip args->device */
187     /* skip args->event */
188 }
189 
vn_decode_vkResetEvent_args_temp(struct vn_cs_decoder * dec,struct vn_command_vkResetEvent * args)190 static inline void vn_decode_vkResetEvent_args_temp(struct vn_cs_decoder *dec, struct vn_command_vkResetEvent *args)
191 {
192     vn_decode_VkDevice_lookup(dec, &args->device);
193     vn_decode_VkEvent_lookup(dec, &args->event);
194 }
195 
vn_replace_vkResetEvent_args_handle(struct vn_command_vkResetEvent * args)196 static inline void vn_replace_vkResetEvent_args_handle(struct vn_command_vkResetEvent *args)
197 {
198     vn_replace_VkDevice_handle(&args->device);
199     vn_replace_VkEvent_handle(&args->event);
200 }
201 
vn_encode_vkResetEvent_reply(struct vn_cs_encoder * enc,const struct vn_command_vkResetEvent * args)202 static inline void vn_encode_vkResetEvent_reply(struct vn_cs_encoder *enc, const struct vn_command_vkResetEvent *args)
203 {
204     vn_encode_VkCommandTypeEXT(enc, &(VkCommandTypeEXT){VK_COMMAND_TYPE_vkResetEvent_EXT});
205 
206     vn_encode_VkResult(enc, &args->ret);
207     /* skip args->device */
208     /* skip args->event */
209 }
210 
vn_dispatch_vkCreateEvent(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)211 static inline void vn_dispatch_vkCreateEvent(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
212 {
213     struct vn_command_vkCreateEvent args;
214 
215     if (!ctx->dispatch_vkCreateEvent) {
216         vn_cs_decoder_set_fatal(ctx->decoder);
217         return;
218     }
219 
220     vn_decode_vkCreateEvent_args_temp(ctx->decoder, &args);
221     if (!args.device) {
222         vn_cs_decoder_set_fatal(ctx->decoder);
223         return;
224     }
225 
226     if (!vn_cs_decoder_get_fatal(ctx->decoder))
227         ctx->dispatch_vkCreateEvent(ctx, &args);
228 
229 #ifdef DEBUG
230     if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
231         vn_dispatch_debug_log(ctx, "vkCreateEvent returned %d", args.ret);
232 #endif
233 
234     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
235        vn_encode_vkCreateEvent_reply(ctx->encoder, &args);
236 
237     vn_cs_decoder_reset_temp_pool(ctx->decoder);
238 }
239 
vn_dispatch_vkDestroyEvent(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)240 static inline void vn_dispatch_vkDestroyEvent(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
241 {
242     struct vn_command_vkDestroyEvent args;
243 
244     if (!ctx->dispatch_vkDestroyEvent) {
245         vn_cs_decoder_set_fatal(ctx->decoder);
246         return;
247     }
248 
249     vn_decode_vkDestroyEvent_args_temp(ctx->decoder, &args);
250     if (!args.device) {
251         vn_cs_decoder_set_fatal(ctx->decoder);
252         return;
253     }
254 
255     if (!vn_cs_decoder_get_fatal(ctx->decoder))
256         ctx->dispatch_vkDestroyEvent(ctx, &args);
257 
258 
259     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
260        vn_encode_vkDestroyEvent_reply(ctx->encoder, &args);
261 
262     vn_cs_decoder_reset_temp_pool(ctx->decoder);
263 }
264 
vn_dispatch_vkGetEventStatus(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)265 static inline void vn_dispatch_vkGetEventStatus(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
266 {
267     struct vn_command_vkGetEventStatus args;
268 
269     if (!ctx->dispatch_vkGetEventStatus) {
270         vn_cs_decoder_set_fatal(ctx->decoder);
271         return;
272     }
273 
274     vn_decode_vkGetEventStatus_args_temp(ctx->decoder, &args);
275     if (!args.device) {
276         vn_cs_decoder_set_fatal(ctx->decoder);
277         return;
278     }
279 
280     if (!vn_cs_decoder_get_fatal(ctx->decoder))
281         ctx->dispatch_vkGetEventStatus(ctx, &args);
282 
283 #ifdef DEBUG
284     if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
285         vn_dispatch_debug_log(ctx, "vkGetEventStatus returned %d", args.ret);
286 #endif
287 
288     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
289        vn_encode_vkGetEventStatus_reply(ctx->encoder, &args);
290 
291     vn_cs_decoder_reset_temp_pool(ctx->decoder);
292 }
293 
vn_dispatch_vkSetEvent(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)294 static inline void vn_dispatch_vkSetEvent(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
295 {
296     struct vn_command_vkSetEvent args;
297 
298     if (!ctx->dispatch_vkSetEvent) {
299         vn_cs_decoder_set_fatal(ctx->decoder);
300         return;
301     }
302 
303     vn_decode_vkSetEvent_args_temp(ctx->decoder, &args);
304     if (!args.device) {
305         vn_cs_decoder_set_fatal(ctx->decoder);
306         return;
307     }
308 
309     if (!vn_cs_decoder_get_fatal(ctx->decoder))
310         ctx->dispatch_vkSetEvent(ctx, &args);
311 
312 #ifdef DEBUG
313     if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
314         vn_dispatch_debug_log(ctx, "vkSetEvent returned %d", args.ret);
315 #endif
316 
317     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
318        vn_encode_vkSetEvent_reply(ctx->encoder, &args);
319 
320     vn_cs_decoder_reset_temp_pool(ctx->decoder);
321 }
322 
vn_dispatch_vkResetEvent(struct vn_dispatch_context * ctx,VkCommandFlagsEXT flags)323 static inline void vn_dispatch_vkResetEvent(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags)
324 {
325     struct vn_command_vkResetEvent args;
326 
327     if (!ctx->dispatch_vkResetEvent) {
328         vn_cs_decoder_set_fatal(ctx->decoder);
329         return;
330     }
331 
332     vn_decode_vkResetEvent_args_temp(ctx->decoder, &args);
333     if (!args.device) {
334         vn_cs_decoder_set_fatal(ctx->decoder);
335         return;
336     }
337 
338     if (!vn_cs_decoder_get_fatal(ctx->decoder))
339         ctx->dispatch_vkResetEvent(ctx, &args);
340 
341 #ifdef DEBUG
342     if (!vn_cs_decoder_get_fatal(ctx->decoder) && vn_dispatch_should_log_result(args.ret))
343         vn_dispatch_debug_log(ctx, "vkResetEvent returned %d", args.ret);
344 #endif
345 
346     if (!vn_cs_decoder_get_fatal(ctx->decoder) && (flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT))
347        vn_encode_vkResetEvent_reply(ctx->encoder, &args);
348 
349     vn_cs_decoder_reset_temp_pool(ctx->decoder);
350 }
351 
352 #pragma GCC diagnostic pop
353 
354 #endif /* VN_PROTOCOL_RENDERER_EVENT_H */
355