1 /**************************************************************************
2 *
3 * Copyright 2008 VMware, Inc.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28 #include "util/format/u_format.h"
29 #include "util/u_memory.h"
30 #include "util/simple_list.h"
31
32 #include "tr_dump.h"
33 #include "tr_dump_defines.h"
34 #include "tr_dump_state.h"
35 #include "tr_texture.h"
36 #include "tr_context.h"
37 #include "tr_screen.h"
38 #include "tr_public.h"
39
40
41 static bool trace = false;
42
43 static const char *
trace_screen_get_name(struct pipe_screen * _screen)44 trace_screen_get_name(struct pipe_screen *_screen)
45 {
46 struct trace_screen *tr_scr = trace_screen(_screen);
47 struct pipe_screen *screen = tr_scr->screen;
48 const char *result;
49
50 trace_dump_call_begin("pipe_screen", "get_name");
51
52 trace_dump_arg(ptr, screen);
53
54 result = screen->get_name(screen);
55
56 trace_dump_ret(string, result);
57
58 trace_dump_call_end();
59
60 return result;
61 }
62
63
64 static const char *
trace_screen_get_vendor(struct pipe_screen * _screen)65 trace_screen_get_vendor(struct pipe_screen *_screen)
66 {
67 struct trace_screen *tr_scr = trace_screen(_screen);
68 struct pipe_screen *screen = tr_scr->screen;
69 const char *result;
70
71 trace_dump_call_begin("pipe_screen", "get_vendor");
72
73 trace_dump_arg(ptr, screen);
74
75 result = screen->get_vendor(screen);
76
77 trace_dump_ret(string, result);
78
79 trace_dump_call_end();
80
81 return result;
82 }
83
84
85 static const char *
trace_screen_get_device_vendor(struct pipe_screen * _screen)86 trace_screen_get_device_vendor(struct pipe_screen *_screen)
87 {
88 struct trace_screen *tr_scr = trace_screen(_screen);
89 struct pipe_screen *screen = tr_scr->screen;
90 const char *result;
91
92 trace_dump_call_begin("pipe_screen", "get_device_vendor");
93
94 trace_dump_arg(ptr, screen);
95
96 result = screen->get_device_vendor(screen);
97
98 trace_dump_ret(string, result);
99
100 trace_dump_call_end();
101
102 return result;
103 }
104
105
106 static struct disk_cache *
trace_screen_get_disk_shader_cache(struct pipe_screen * _screen)107 trace_screen_get_disk_shader_cache(struct pipe_screen *_screen)
108 {
109 struct trace_screen *tr_scr = trace_screen(_screen);
110 struct pipe_screen *screen = tr_scr->screen;
111
112 trace_dump_call_begin("pipe_screen", "get_disk_shader_cache");
113
114 trace_dump_arg(ptr, screen);
115
116 struct disk_cache *result = screen->get_disk_shader_cache(screen);
117
118 trace_dump_ret(ptr, result);
119
120 trace_dump_call_end();
121
122 return result;
123 }
124
125
126 static int
trace_screen_get_param(struct pipe_screen * _screen,enum pipe_cap param)127 trace_screen_get_param(struct pipe_screen *_screen,
128 enum pipe_cap param)
129 {
130 struct trace_screen *tr_scr = trace_screen(_screen);
131 struct pipe_screen *screen = tr_scr->screen;
132 int result;
133
134 trace_dump_call_begin("pipe_screen", "get_param");
135
136 trace_dump_arg(ptr, screen);
137 trace_dump_arg(int, param);
138
139 result = screen->get_param(screen, param);
140
141 trace_dump_ret(int, result);
142
143 trace_dump_call_end();
144
145 return result;
146 }
147
148
149 static int
trace_screen_get_shader_param(struct pipe_screen * _screen,enum pipe_shader_type shader,enum pipe_shader_cap param)150 trace_screen_get_shader_param(struct pipe_screen *_screen,
151 enum pipe_shader_type shader,
152 enum pipe_shader_cap param)
153 {
154 struct trace_screen *tr_scr = trace_screen(_screen);
155 struct pipe_screen *screen = tr_scr->screen;
156 int result;
157
158 trace_dump_call_begin("pipe_screen", "get_shader_param");
159
160 trace_dump_arg(ptr, screen);
161 trace_dump_arg(uint, shader);
162 trace_dump_arg(int, param);
163
164 result = screen->get_shader_param(screen, shader, param);
165
166 trace_dump_ret(int, result);
167
168 trace_dump_call_end();
169
170 return result;
171 }
172
173
174 static float
trace_screen_get_paramf(struct pipe_screen * _screen,enum pipe_capf param)175 trace_screen_get_paramf(struct pipe_screen *_screen,
176 enum pipe_capf param)
177 {
178 struct trace_screen *tr_scr = trace_screen(_screen);
179 struct pipe_screen *screen = tr_scr->screen;
180 float result;
181
182 trace_dump_call_begin("pipe_screen", "get_paramf");
183
184 trace_dump_arg(ptr, screen);
185 trace_dump_arg(int, param);
186
187 result = screen->get_paramf(screen, param);
188
189 trace_dump_ret(float, result);
190
191 trace_dump_call_end();
192
193 return result;
194 }
195
196
197 static int
trace_screen_get_compute_param(struct pipe_screen * _screen,enum pipe_shader_ir ir_type,enum pipe_compute_cap param,void * data)198 trace_screen_get_compute_param(struct pipe_screen *_screen,
199 enum pipe_shader_ir ir_type,
200 enum pipe_compute_cap param, void *data)
201 {
202 struct trace_screen *tr_scr = trace_screen(_screen);
203 struct pipe_screen *screen = tr_scr->screen;
204 int result;
205
206 trace_dump_call_begin("pipe_screen", "get_compute_param");
207
208 trace_dump_arg(ptr, screen);
209 trace_dump_arg(int, ir_type);
210 trace_dump_arg(int, param);
211 trace_dump_arg(ptr, data);
212
213 result = screen->get_compute_param(screen, ir_type, param, data);
214
215 trace_dump_ret(int, result);
216
217 trace_dump_call_end();
218
219 return result;
220 }
221
222
223 static bool
trace_screen_is_format_supported(struct pipe_screen * _screen,enum pipe_format format,enum pipe_texture_target target,unsigned sample_count,unsigned storage_sample_count,unsigned tex_usage)224 trace_screen_is_format_supported(struct pipe_screen *_screen,
225 enum pipe_format format,
226 enum pipe_texture_target target,
227 unsigned sample_count,
228 unsigned storage_sample_count,
229 unsigned tex_usage)
230 {
231 struct trace_screen *tr_scr = trace_screen(_screen);
232 struct pipe_screen *screen = tr_scr->screen;
233 bool result;
234
235 trace_dump_call_begin("pipe_screen", "is_format_supported");
236
237 trace_dump_arg(ptr, screen);
238 trace_dump_arg(format, format);
239 trace_dump_arg(int, target);
240 trace_dump_arg(uint, sample_count);
241 trace_dump_arg(uint, tex_usage);
242
243 result = screen->is_format_supported(screen, format, target, sample_count,
244 storage_sample_count, tex_usage);
245
246 trace_dump_ret(bool, result);
247
248 trace_dump_call_end();
249
250 return result;
251 }
252
253
254 static struct pipe_context *
trace_screen_context_create(struct pipe_screen * _screen,void * priv,unsigned flags)255 trace_screen_context_create(struct pipe_screen *_screen, void *priv,
256 unsigned flags)
257 {
258 struct trace_screen *tr_scr = trace_screen(_screen);
259 struct pipe_screen *screen = tr_scr->screen;
260 struct pipe_context *result;
261
262 trace_dump_call_begin("pipe_screen", "context_create");
263
264 trace_dump_arg(ptr, screen);
265 trace_dump_arg(ptr, priv);
266 trace_dump_arg(uint, flags);
267
268 result = screen->context_create(screen, priv, flags);
269
270 trace_dump_ret(ptr, result);
271
272 trace_dump_call_end();
273
274 result = trace_context_create(tr_scr, result);
275
276 return result;
277 }
278
279
280 static void
trace_screen_flush_frontbuffer(struct pipe_screen * _screen,struct pipe_resource * resource,unsigned level,unsigned layer,void * context_private,struct pipe_box * sub_box)281 trace_screen_flush_frontbuffer(struct pipe_screen *_screen,
282 struct pipe_resource *resource,
283 unsigned level, unsigned layer,
284 void *context_private,
285 struct pipe_box *sub_box)
286 {
287 struct trace_screen *tr_scr = trace_screen(_screen);
288 struct pipe_screen *screen = tr_scr->screen;
289
290 trace_dump_call_begin("pipe_screen", "flush_frontbuffer");
291
292 trace_dump_arg(ptr, screen);
293 trace_dump_arg(ptr, resource);
294 trace_dump_arg(uint, level);
295 trace_dump_arg(uint, layer);
296 /* XXX: hide, as there is nothing we can do with this
297 trace_dump_arg(ptr, context_private);
298 */
299
300 screen->flush_frontbuffer(screen, resource, level, layer, context_private, sub_box);
301
302 trace_dump_call_end();
303 }
304
305
306 static void
trace_screen_get_driver_uuid(struct pipe_screen * _screen,char * uuid)307 trace_screen_get_driver_uuid(struct pipe_screen *_screen, char *uuid)
308 {
309 struct pipe_screen *screen = trace_screen(_screen)->screen;
310
311 trace_dump_call_begin("pipe_screen", "get_driver_uuid");
312 trace_dump_arg(ptr, screen);
313
314 screen->get_driver_uuid(screen, uuid);
315
316 trace_dump_ret(string, uuid);
317 trace_dump_call_end();
318 }
319
320 static void
trace_screen_get_device_uuid(struct pipe_screen * _screen,char * uuid)321 trace_screen_get_device_uuid(struct pipe_screen *_screen, char *uuid)
322 {
323 struct pipe_screen *screen = trace_screen(_screen)->screen;
324
325 trace_dump_call_begin("pipe_screen", "get_device_uuid");
326 trace_dump_arg(ptr, screen);
327
328 screen->get_device_uuid(screen, uuid);
329
330 trace_dump_ret(string, uuid);
331 trace_dump_call_end();
332 }
333
334
335 /********************************************************************
336 * texture
337 */
338
339
340 static struct pipe_resource *
trace_screen_resource_create(struct pipe_screen * _screen,const struct pipe_resource * templat)341 trace_screen_resource_create(struct pipe_screen *_screen,
342 const struct pipe_resource *templat)
343 {
344 struct trace_screen *tr_scr = trace_screen(_screen);
345 struct pipe_screen *screen = tr_scr->screen;
346 struct pipe_resource *result;
347
348 trace_dump_call_begin("pipe_screen", "resource_create");
349
350 trace_dump_arg(ptr, screen);
351 trace_dump_arg(resource_template, templat);
352
353 result = screen->resource_create(screen, templat);
354
355 trace_dump_ret(ptr, result);
356
357 trace_dump_call_end();
358
359 if (result)
360 result->screen = _screen;
361 return result;
362 }
363
364 static struct pipe_resource *
trace_screen_resource_from_handle(struct pipe_screen * _screen,const struct pipe_resource * templ,struct winsys_handle * handle,unsigned usage)365 trace_screen_resource_from_handle(struct pipe_screen *_screen,
366 const struct pipe_resource *templ,
367 struct winsys_handle *handle,
368 unsigned usage)
369 {
370 struct trace_screen *tr_screen = trace_screen(_screen);
371 struct pipe_screen *screen = tr_screen->screen;
372 struct pipe_resource *result;
373
374 /* TODO trace call */
375
376 result = screen->resource_from_handle(screen, templ, handle, usage);
377
378 if (result)
379 result->screen = _screen;
380 return result;
381 }
382
383 static bool
trace_screen_check_resource_capability(struct pipe_screen * _screen,struct pipe_resource * resource,unsigned bind)384 trace_screen_check_resource_capability(struct pipe_screen *_screen,
385 struct pipe_resource *resource,
386 unsigned bind)
387 {
388 struct pipe_screen *screen = trace_screen(_screen)->screen;
389
390 return screen->check_resource_capability(screen, resource, bind);
391 }
392
393 static bool
trace_screen_resource_get_handle(struct pipe_screen * _screen,struct pipe_context * _pipe,struct pipe_resource * resource,struct winsys_handle * handle,unsigned usage)394 trace_screen_resource_get_handle(struct pipe_screen *_screen,
395 struct pipe_context *_pipe,
396 struct pipe_resource *resource,
397 struct winsys_handle *handle,
398 unsigned usage)
399 {
400 struct trace_screen *tr_screen = trace_screen(_screen);
401 struct trace_context *tr_pipe = _pipe ? trace_context(_pipe) : NULL;
402 struct pipe_screen *screen = tr_screen->screen;
403
404 /* TODO trace call */
405
406 return screen->resource_get_handle(screen, tr_pipe ? tr_pipe->pipe : NULL,
407 resource, handle, usage);
408 }
409
410 static bool
trace_screen_resource_get_param(struct pipe_screen * _screen,struct pipe_context * _pipe,struct pipe_resource * resource,unsigned plane,unsigned layer,unsigned level,enum pipe_resource_param param,unsigned handle_usage,uint64_t * value)411 trace_screen_resource_get_param(struct pipe_screen *_screen,
412 struct pipe_context *_pipe,
413 struct pipe_resource *resource,
414 unsigned plane,
415 unsigned layer,
416 unsigned level,
417 enum pipe_resource_param param,
418 unsigned handle_usage,
419 uint64_t *value)
420 {
421 struct trace_screen *tr_screen = trace_screen(_screen);
422 struct trace_context *tr_pipe = _pipe ? trace_context(_pipe) : NULL;
423 struct pipe_screen *screen = tr_screen->screen;
424
425 /* TODO trace call */
426
427 return screen->resource_get_param(screen, tr_pipe ? tr_pipe->pipe : NULL,
428 resource, plane, layer, level, param,
429 handle_usage, value);
430 }
431
432 static void
trace_screen_resource_get_info(struct pipe_screen * _screen,struct pipe_resource * resource,unsigned * stride,unsigned * offset)433 trace_screen_resource_get_info(struct pipe_screen *_screen,
434 struct pipe_resource *resource,
435 unsigned *stride,
436 unsigned *offset)
437 {
438 struct trace_screen *tr_screen = trace_screen(_screen);
439 struct pipe_screen *screen = tr_screen->screen;
440
441 /* TODO trace call */
442
443 screen->resource_get_info(screen, resource, stride, offset);
444 }
445
446 static struct pipe_resource *
trace_screen_resource_from_memobj(struct pipe_screen * _screen,const struct pipe_resource * templ,struct pipe_memory_object * memobj,uint64_t offset)447 trace_screen_resource_from_memobj(struct pipe_screen *_screen,
448 const struct pipe_resource *templ,
449 struct pipe_memory_object *memobj,
450 uint64_t offset)
451 {
452 struct pipe_screen *screen = trace_screen(_screen)->screen;
453
454 trace_dump_call_begin("pipe_screen", "resource_from_memobj");
455 trace_dump_arg(ptr, screen);
456 trace_dump_arg(resource_template, templ);
457 trace_dump_arg(ptr, memobj);
458 trace_dump_arg(uint, offset);
459
460 struct pipe_resource *res =
461 screen->resource_from_memobj(screen, templ, memobj, offset);
462
463 if (!res)
464 return NULL;
465 res->screen = _screen;
466
467 trace_dump_ret(ptr, res);
468 trace_dump_call_end();
469 return res;
470 }
471
472 static void
trace_screen_resource_changed(struct pipe_screen * _screen,struct pipe_resource * resource)473 trace_screen_resource_changed(struct pipe_screen *_screen,
474 struct pipe_resource *resource)
475 {
476 struct trace_screen *tr_scr = trace_screen(_screen);
477 struct pipe_screen *screen = tr_scr->screen;
478
479 trace_dump_call_begin("pipe_screen", "resource_changed");
480
481 trace_dump_arg(ptr, screen);
482 trace_dump_arg(ptr, resource);
483
484 if (screen->resource_changed)
485 screen->resource_changed(screen, resource);
486
487 trace_dump_call_end();
488 }
489
490 static void
trace_screen_resource_destroy(struct pipe_screen * _screen,struct pipe_resource * resource)491 trace_screen_resource_destroy(struct pipe_screen *_screen,
492 struct pipe_resource *resource)
493 {
494 struct trace_screen *tr_scr = trace_screen(_screen);
495 struct pipe_screen *screen = tr_scr->screen;
496
497 /* Don't trace this, because due to the lack of pipe_resource wrapping,
498 * we can get this call from inside of driver calls, which would try
499 * to lock an already-locked mutex.
500 */
501 screen->resource_destroy(screen, resource);
502 }
503
504
505 /********************************************************************
506 * fence
507 */
508
509
510 static void
trace_screen_fence_reference(struct pipe_screen * _screen,struct pipe_fence_handle ** pdst,struct pipe_fence_handle * src)511 trace_screen_fence_reference(struct pipe_screen *_screen,
512 struct pipe_fence_handle **pdst,
513 struct pipe_fence_handle *src)
514 {
515 struct trace_screen *tr_scr = trace_screen(_screen);
516 struct pipe_screen *screen = tr_scr->screen;
517 struct pipe_fence_handle *dst;
518
519 assert(pdst);
520 dst = *pdst;
521
522 trace_dump_call_begin("pipe_screen", "fence_reference");
523
524 trace_dump_arg(ptr, screen);
525 trace_dump_arg(ptr, dst);
526 trace_dump_arg(ptr, src);
527
528 screen->fence_reference(screen, pdst, src);
529
530 trace_dump_call_end();
531 }
532
533
534 static int
trace_screen_fence_get_fd(struct pipe_screen * _screen,struct pipe_fence_handle * fence)535 trace_screen_fence_get_fd(struct pipe_screen *_screen,
536 struct pipe_fence_handle *fence)
537 {
538 struct trace_screen *tr_scr = trace_screen(_screen);
539 struct pipe_screen *screen = tr_scr->screen;
540 int result;
541
542 trace_dump_call_begin("pipe_screen", "fence_get_fd");
543
544 trace_dump_arg(ptr, screen);
545 trace_dump_arg(ptr, fence);
546
547 result = screen->fence_get_fd(screen, fence);
548
549 trace_dump_ret(int, result);
550
551 trace_dump_call_end();
552
553 return result;
554 }
555
556
557 static bool
trace_screen_fence_finish(struct pipe_screen * _screen,struct pipe_context * _ctx,struct pipe_fence_handle * fence,uint64_t timeout)558 trace_screen_fence_finish(struct pipe_screen *_screen,
559 struct pipe_context *_ctx,
560 struct pipe_fence_handle *fence,
561 uint64_t timeout)
562 {
563 struct trace_screen *tr_scr = trace_screen(_screen);
564 struct pipe_screen *screen = tr_scr->screen;
565 struct pipe_context *ctx = _ctx ? trace_context(_ctx)->pipe : NULL;
566 int result;
567
568 trace_dump_call_begin("pipe_screen", "fence_finish");
569
570 trace_dump_arg(ptr, screen);
571 trace_dump_arg(ptr, ctx);
572 trace_dump_arg(ptr, fence);
573 trace_dump_arg(uint, timeout);
574
575 result = screen->fence_finish(screen, ctx, fence, timeout);
576
577 trace_dump_ret(bool, result);
578
579 trace_dump_call_end();
580
581 return result;
582 }
583
584
585 /********************************************************************
586 * memobj
587 */
588
589 static struct pipe_memory_object *
trace_screen_memobj_create_from_handle(struct pipe_screen * _screen,struct winsys_handle * handle,bool dedicated)590 trace_screen_memobj_create_from_handle(struct pipe_screen *_screen,
591 struct winsys_handle *handle,
592 bool dedicated)
593 {
594 struct pipe_screen *screen = trace_screen(_screen)->screen;
595
596 trace_dump_call_begin("pipe_screen", "memobj_create_from_handle");
597 trace_dump_arg(ptr, screen);
598 trace_dump_arg(ptr, handle);
599 trace_dump_arg(bool, dedicated);
600
601 struct pipe_memory_object *res =
602 screen->memobj_create_from_handle(screen, handle, dedicated);
603
604 trace_dump_ret(ptr, res);
605 trace_dump_call_end();
606
607 return res;
608 }
609
610 static void
trace_screen_memobj_destroy(struct pipe_screen * _screen,struct pipe_memory_object * memobj)611 trace_screen_memobj_destroy(struct pipe_screen *_screen,
612 struct pipe_memory_object *memobj)
613 {
614 struct pipe_screen *screen = trace_screen(_screen)->screen;
615
616 trace_dump_call_begin("pipe_screen", "memobj_destroy");
617 trace_dump_arg(ptr, screen);
618 trace_dump_arg(ptr, memobj);
619 trace_dump_call_end();
620
621 screen->memobj_destroy(screen, memobj);
622 }
623
624
625 /********************************************************************
626 * screen
627 */
628
629 static uint64_t
trace_screen_get_timestamp(struct pipe_screen * _screen)630 trace_screen_get_timestamp(struct pipe_screen *_screen)
631 {
632 struct trace_screen *tr_scr = trace_screen(_screen);
633 struct pipe_screen *screen = tr_scr->screen;
634 uint64_t result;
635
636 trace_dump_call_begin("pipe_screen", "get_timestamp");
637 trace_dump_arg(ptr, screen);
638
639 result = screen->get_timestamp(screen);
640
641 trace_dump_ret(uint, result);
642 trace_dump_call_end();
643
644 return result;
645 }
646
647 static void
trace_screen_finalize_nir(struct pipe_screen * _screen,void * nir,bool optimize)648 trace_screen_finalize_nir(struct pipe_screen *_screen, void *nir, bool optimize)
649 {
650 struct pipe_screen *screen = trace_screen(_screen)->screen;
651
652 screen->finalize_nir(screen, nir, optimize);
653 }
654
655 static void
trace_screen_destroy(struct pipe_screen * _screen)656 trace_screen_destroy(struct pipe_screen *_screen)
657 {
658 struct trace_screen *tr_scr = trace_screen(_screen);
659 struct pipe_screen *screen = tr_scr->screen;
660
661 trace_dump_call_begin("pipe_screen", "destroy");
662 trace_dump_arg(ptr, screen);
663 trace_dump_call_end();
664
665 screen->destroy(screen);
666
667 FREE(tr_scr);
668 }
669
670 bool
trace_enabled(void)671 trace_enabled(void)
672 {
673 static bool firstrun = true;
674
675 if (!firstrun)
676 return trace;
677 firstrun = false;
678
679 if(trace_dump_trace_begin()) {
680 trace_dumping_start();
681 trace = true;
682 }
683
684 return trace;
685 }
686
687 struct pipe_screen *
trace_screen_create(struct pipe_screen * screen)688 trace_screen_create(struct pipe_screen *screen)
689 {
690 struct trace_screen *tr_scr;
691
692 if (!trace_enabled())
693 goto error1;
694
695 trace_dump_call_begin("", "pipe_screen_create");
696
697 tr_scr = CALLOC_STRUCT(trace_screen);
698 if (!tr_scr)
699 goto error2;
700
701 #define SCR_INIT(_member) \
702 tr_scr->base._member = screen->_member ? trace_screen_##_member : NULL
703
704 tr_scr->base.destroy = trace_screen_destroy;
705 tr_scr->base.get_name = trace_screen_get_name;
706 tr_scr->base.get_vendor = trace_screen_get_vendor;
707 tr_scr->base.get_device_vendor = trace_screen_get_device_vendor;
708 SCR_INIT(get_disk_shader_cache);
709 tr_scr->base.get_param = trace_screen_get_param;
710 tr_scr->base.get_shader_param = trace_screen_get_shader_param;
711 tr_scr->base.get_paramf = trace_screen_get_paramf;
712 tr_scr->base.get_compute_param = trace_screen_get_compute_param;
713 tr_scr->base.is_format_supported = trace_screen_is_format_supported;
714 assert(screen->context_create);
715 tr_scr->base.context_create = trace_screen_context_create;
716 tr_scr->base.resource_create = trace_screen_resource_create;
717 tr_scr->base.resource_from_handle = trace_screen_resource_from_handle;
718 SCR_INIT(check_resource_capability);
719 tr_scr->base.resource_get_handle = trace_screen_resource_get_handle;
720 SCR_INIT(resource_get_param);
721 SCR_INIT(resource_get_info);
722 SCR_INIT(resource_from_memobj);
723 SCR_INIT(resource_changed);
724 tr_scr->base.resource_destroy = trace_screen_resource_destroy;
725 tr_scr->base.fence_reference = trace_screen_fence_reference;
726 SCR_INIT(fence_get_fd);
727 tr_scr->base.fence_finish = trace_screen_fence_finish;
728 SCR_INIT(memobj_create_from_handle);
729 SCR_INIT(memobj_destroy);
730 tr_scr->base.flush_frontbuffer = trace_screen_flush_frontbuffer;
731 tr_scr->base.get_timestamp = trace_screen_get_timestamp;
732 SCR_INIT(get_driver_uuid);
733 SCR_INIT(get_device_uuid);
734 SCR_INIT(finalize_nir);
735
736 tr_scr->screen = screen;
737
738 trace_dump_ret(ptr, screen);
739 trace_dump_call_end();
740
741 return &tr_scr->base;
742
743 error2:
744 trace_dump_ret(ptr, screen);
745 trace_dump_call_end();
746 error1:
747 return screen;
748 }
749
750
751 struct trace_screen *
trace_screen(struct pipe_screen * screen)752 trace_screen(struct pipe_screen *screen)
753 {
754 assert(screen);
755 assert(screen->destroy == trace_screen_destroy);
756 return (struct trace_screen *)screen;
757 }
758