1 /**************************************************************************
2 *
3 * Copyright 2015 Advanced Micro Devices, Inc.
4 * Copyright 2008 VMware, Inc.
5 * All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * on the rights to use, copy, modify, merge, publish, distribute, sub
11 * license, and/or sell copies of the Software, and to permit persons to whom
12 * the Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the next
15 * paragraph) shall be included in all copies or substantial portions of the
16 * Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28 #include "dd_pipe.h"
29 #include "dd_public.h"
30 #include "util/u_memory.h"
31 #include <ctype.h>
32 #include <stdio.h>
33
34
35 static const char *
dd_screen_get_name(struct pipe_screen * _screen)36 dd_screen_get_name(struct pipe_screen *_screen)
37 {
38 struct pipe_screen *screen = dd_screen(_screen)->screen;
39
40 return screen->get_name(screen);
41 }
42
43 static const char *
dd_screen_get_vendor(struct pipe_screen * _screen)44 dd_screen_get_vendor(struct pipe_screen *_screen)
45 {
46 struct pipe_screen *screen = dd_screen(_screen)->screen;
47
48 return screen->get_vendor(screen);
49 }
50
51 static const char *
dd_screen_get_device_vendor(struct pipe_screen * _screen)52 dd_screen_get_device_vendor(struct pipe_screen *_screen)
53 {
54 struct pipe_screen *screen = dd_screen(_screen)->screen;
55
56 return screen->get_device_vendor(screen);
57 }
58
59 static const void *
dd_screen_get_compiler_options(struct pipe_screen * _screen,enum pipe_shader_ir ir,enum pipe_shader_type shader)60 dd_screen_get_compiler_options(struct pipe_screen *_screen,
61 enum pipe_shader_ir ir,
62 enum pipe_shader_type shader)
63 {
64 struct pipe_screen *screen = dd_screen(_screen)->screen;
65
66 return screen->get_compiler_options(screen, ir, shader);
67 }
68
69 static struct disk_cache *
dd_screen_get_disk_shader_cache(struct pipe_screen * _screen)70 dd_screen_get_disk_shader_cache(struct pipe_screen *_screen)
71 {
72 struct pipe_screen *screen = dd_screen(_screen)->screen;
73
74 return screen->get_disk_shader_cache(screen);
75 }
76
77 static int
dd_screen_get_param(struct pipe_screen * _screen,enum pipe_cap param)78 dd_screen_get_param(struct pipe_screen *_screen,
79 enum pipe_cap param)
80 {
81 struct pipe_screen *screen = dd_screen(_screen)->screen;
82
83 return screen->get_param(screen, param);
84 }
85
86 static float
dd_screen_get_paramf(struct pipe_screen * _screen,enum pipe_capf param)87 dd_screen_get_paramf(struct pipe_screen *_screen,
88 enum pipe_capf param)
89 {
90 struct pipe_screen *screen = dd_screen(_screen)->screen;
91
92 return screen->get_paramf(screen, param);
93 }
94
95 static int
dd_screen_get_compute_param(struct pipe_screen * _screen,enum pipe_shader_ir ir_type,enum pipe_compute_cap param,void * ret)96 dd_screen_get_compute_param(struct pipe_screen *_screen,
97 enum pipe_shader_ir ir_type,
98 enum pipe_compute_cap param,
99 void *ret)
100 {
101 struct pipe_screen *screen = dd_screen(_screen)->screen;
102
103 return screen->get_compute_param(screen, ir_type, param, ret);
104 }
105
106 static int
dd_screen_get_shader_param(struct pipe_screen * _screen,enum pipe_shader_type shader,enum pipe_shader_cap param)107 dd_screen_get_shader_param(struct pipe_screen *_screen,
108 enum pipe_shader_type shader,
109 enum pipe_shader_cap param)
110 {
111 struct pipe_screen *screen = dd_screen(_screen)->screen;
112
113 return screen->get_shader_param(screen, shader, param);
114 }
115
116 static uint64_t
dd_screen_get_timestamp(struct pipe_screen * _screen)117 dd_screen_get_timestamp(struct pipe_screen *_screen)
118 {
119 struct pipe_screen *screen = dd_screen(_screen)->screen;
120
121 return screen->get_timestamp(screen);
122 }
123
dd_screen_query_memory_info(struct pipe_screen * _screen,struct pipe_memory_info * info)124 static void dd_screen_query_memory_info(struct pipe_screen *_screen,
125 struct pipe_memory_info *info)
126 {
127 struct pipe_screen *screen = dd_screen(_screen)->screen;
128
129 screen->query_memory_info(screen, info);
130 }
131
132 static struct pipe_context *
dd_screen_context_create(struct pipe_screen * _screen,void * priv,unsigned flags)133 dd_screen_context_create(struct pipe_screen *_screen, void *priv,
134 unsigned flags)
135 {
136 struct dd_screen *dscreen = dd_screen(_screen);
137 struct pipe_screen *screen = dscreen->screen;
138
139 flags |= PIPE_CONTEXT_DEBUG;
140
141 return dd_context_create(dscreen,
142 screen->context_create(screen, priv, flags));
143 }
144
145 static bool
dd_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)146 dd_screen_is_format_supported(struct pipe_screen *_screen,
147 enum pipe_format format,
148 enum pipe_texture_target target,
149 unsigned sample_count,
150 unsigned storage_sample_count,
151 unsigned tex_usage)
152 {
153 struct pipe_screen *screen = dd_screen(_screen)->screen;
154
155 return screen->is_format_supported(screen, format, target, sample_count,
156 storage_sample_count, tex_usage);
157 }
158
159 static bool
dd_screen_can_create_resource(struct pipe_screen * _screen,const struct pipe_resource * templat)160 dd_screen_can_create_resource(struct pipe_screen *_screen,
161 const struct pipe_resource *templat)
162 {
163 struct pipe_screen *screen = dd_screen(_screen)->screen;
164
165 return screen->can_create_resource(screen, templat);
166 }
167
168 static void
dd_screen_flush_frontbuffer(struct pipe_screen * _screen,struct pipe_resource * resource,unsigned level,unsigned layer,void * context_private,struct pipe_box * sub_box)169 dd_screen_flush_frontbuffer(struct pipe_screen *_screen,
170 struct pipe_resource *resource,
171 unsigned level, unsigned layer,
172 void *context_private,
173 struct pipe_box *sub_box)
174 {
175 struct pipe_screen *screen = dd_screen(_screen)->screen;
176
177 screen->flush_frontbuffer(screen, resource, level, layer, context_private,
178 sub_box);
179 }
180
181 static int
dd_screen_get_driver_query_info(struct pipe_screen * _screen,unsigned index,struct pipe_driver_query_info * info)182 dd_screen_get_driver_query_info(struct pipe_screen *_screen,
183 unsigned index,
184 struct pipe_driver_query_info *info)
185 {
186 struct pipe_screen *screen = dd_screen(_screen)->screen;
187
188 return screen->get_driver_query_info(screen, index, info);
189 }
190
191 static int
dd_screen_get_driver_query_group_info(struct pipe_screen * _screen,unsigned index,struct pipe_driver_query_group_info * info)192 dd_screen_get_driver_query_group_info(struct pipe_screen *_screen,
193 unsigned index,
194 struct pipe_driver_query_group_info *info)
195 {
196 struct pipe_screen *screen = dd_screen(_screen)->screen;
197
198 return screen->get_driver_query_group_info(screen, index, info);
199 }
200
201
202 static void
dd_screen_get_driver_uuid(struct pipe_screen * _screen,char * uuid)203 dd_screen_get_driver_uuid(struct pipe_screen *_screen, char *uuid)
204 {
205 struct pipe_screen *screen = dd_screen(_screen)->screen;
206
207 screen->get_driver_uuid(screen, uuid);
208 }
209
210 static void
dd_screen_get_device_uuid(struct pipe_screen * _screen,char * uuid)211 dd_screen_get_device_uuid(struct pipe_screen *_screen, char *uuid)
212 {
213 struct pipe_screen *screen = dd_screen(_screen)->screen;
214
215 screen->get_device_uuid(screen, uuid);
216 }
217
218 /********************************************************************
219 * resource
220 */
221
222 static struct pipe_resource *
dd_screen_resource_create(struct pipe_screen * _screen,const struct pipe_resource * templat)223 dd_screen_resource_create(struct pipe_screen *_screen,
224 const struct pipe_resource *templat)
225 {
226 struct pipe_screen *screen = dd_screen(_screen)->screen;
227 struct pipe_resource *res = screen->resource_create(screen, templat);
228
229 if (!res)
230 return NULL;
231 res->screen = _screen;
232 return res;
233 }
234
235 static struct pipe_resource *
dd_screen_resource_from_handle(struct pipe_screen * _screen,const struct pipe_resource * templ,struct winsys_handle * handle,unsigned usage)236 dd_screen_resource_from_handle(struct pipe_screen *_screen,
237 const struct pipe_resource *templ,
238 struct winsys_handle *handle,
239 unsigned usage)
240 {
241 struct pipe_screen *screen = dd_screen(_screen)->screen;
242 struct pipe_resource *res =
243 screen->resource_from_handle(screen, templ, handle, usage);
244
245 if (!res)
246 return NULL;
247 res->screen = _screen;
248 return res;
249 }
250
251 static struct pipe_resource *
dd_screen_resource_from_user_memory(struct pipe_screen * _screen,const struct pipe_resource * templ,void * user_memory)252 dd_screen_resource_from_user_memory(struct pipe_screen *_screen,
253 const struct pipe_resource *templ,
254 void *user_memory)
255 {
256 struct pipe_screen *screen = dd_screen(_screen)->screen;
257 struct pipe_resource *res =
258 screen->resource_from_user_memory(screen, templ, user_memory);
259
260 if (!res)
261 return NULL;
262 res->screen = _screen;
263 return res;
264 }
265
266 static struct pipe_resource *
dd_screen_resource_from_memobj(struct pipe_screen * _screen,const struct pipe_resource * templ,struct pipe_memory_object * memobj,uint64_t offset)267 dd_screen_resource_from_memobj(struct pipe_screen *_screen,
268 const struct pipe_resource *templ,
269 struct pipe_memory_object *memobj,
270 uint64_t offset)
271 {
272 struct pipe_screen *screen = dd_screen(_screen)->screen;
273 struct pipe_resource *res =
274 screen->resource_from_memobj(screen, templ, memobj, offset);
275
276 if (!res)
277 return NULL;
278 res->screen = _screen;
279 return res;
280 }
281
282 static void
dd_screen_resource_changed(struct pipe_screen * _screen,struct pipe_resource * res)283 dd_screen_resource_changed(struct pipe_screen *_screen,
284 struct pipe_resource *res)
285 {
286 struct pipe_screen *screen = dd_screen(_screen)->screen;
287
288 if (screen->resource_changed)
289 screen->resource_changed(screen, res);
290 }
291
292 static void
dd_screen_resource_destroy(struct pipe_screen * _screen,struct pipe_resource * res)293 dd_screen_resource_destroy(struct pipe_screen *_screen,
294 struct pipe_resource *res)
295 {
296 struct pipe_screen *screen = dd_screen(_screen)->screen;
297
298 screen->resource_destroy(screen, res);
299 }
300
301 static bool
dd_screen_resource_get_handle(struct pipe_screen * _screen,struct pipe_context * _pipe,struct pipe_resource * resource,struct winsys_handle * handle,unsigned usage)302 dd_screen_resource_get_handle(struct pipe_screen *_screen,
303 struct pipe_context *_pipe,
304 struct pipe_resource *resource,
305 struct winsys_handle *handle,
306 unsigned usage)
307 {
308 struct pipe_screen *screen = dd_screen(_screen)->screen;
309 struct pipe_context *pipe = _pipe ? dd_context(_pipe)->pipe : NULL;
310
311 return screen->resource_get_handle(screen, pipe, resource, handle, usage);
312 }
313
314 static bool
dd_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)315 dd_screen_resource_get_param(struct pipe_screen *_screen,
316 struct pipe_context *_pipe,
317 struct pipe_resource *resource,
318 unsigned plane,
319 unsigned layer,
320 unsigned level,
321 enum pipe_resource_param param,
322 unsigned handle_usage,
323 uint64_t *value)
324 {
325 struct pipe_screen *screen = dd_screen(_screen)->screen;
326 struct pipe_context *pipe = _pipe ? dd_context(_pipe)->pipe : NULL;
327
328 return screen->resource_get_param(screen, pipe, resource, plane, layer,
329 level, param, handle_usage, value);
330 }
331
332 static void
dd_screen_resource_get_info(struct pipe_screen * _screen,struct pipe_resource * resource,unsigned * stride,unsigned * offset)333 dd_screen_resource_get_info(struct pipe_screen *_screen,
334 struct pipe_resource *resource,
335 unsigned *stride,
336 unsigned *offset)
337 {
338 struct pipe_screen *screen = dd_screen(_screen)->screen;
339
340 screen->resource_get_info(screen, resource, stride, offset);
341 }
342
343 static bool
dd_screen_check_resource_capability(struct pipe_screen * _screen,struct pipe_resource * resource,unsigned bind)344 dd_screen_check_resource_capability(struct pipe_screen *_screen,
345 struct pipe_resource *resource,
346 unsigned bind)
347 {
348 struct pipe_screen *screen = dd_screen(_screen)->screen;
349
350 return screen->check_resource_capability(screen, resource, bind);
351 }
352
353
354 /********************************************************************
355 * fence
356 */
357
358 static void
dd_screen_fence_reference(struct pipe_screen * _screen,struct pipe_fence_handle ** pdst,struct pipe_fence_handle * src)359 dd_screen_fence_reference(struct pipe_screen *_screen,
360 struct pipe_fence_handle **pdst,
361 struct pipe_fence_handle *src)
362 {
363 struct pipe_screen *screen = dd_screen(_screen)->screen;
364
365 screen->fence_reference(screen, pdst, src);
366 }
367
368 static bool
dd_screen_fence_finish(struct pipe_screen * _screen,struct pipe_context * _ctx,struct pipe_fence_handle * fence,uint64_t timeout)369 dd_screen_fence_finish(struct pipe_screen *_screen,
370 struct pipe_context *_ctx,
371 struct pipe_fence_handle *fence,
372 uint64_t timeout)
373 {
374 struct pipe_screen *screen = dd_screen(_screen)->screen;
375 struct pipe_context *ctx = _ctx ? dd_context(_ctx)->pipe : NULL;
376
377 return screen->fence_finish(screen, ctx, fence, timeout);
378 }
379
380 static int
dd_screen_fence_get_fd(struct pipe_screen * _screen,struct pipe_fence_handle * fence)381 dd_screen_fence_get_fd(struct pipe_screen *_screen,
382 struct pipe_fence_handle *fence)
383 {
384 struct pipe_screen *screen = dd_screen(_screen)->screen;
385
386 return screen->fence_get_fd(screen, fence);
387 }
388
389 /********************************************************************
390 * memobj
391 */
392
393 static struct pipe_memory_object *
dd_screen_memobj_create_from_handle(struct pipe_screen * _screen,struct winsys_handle * handle,bool dedicated)394 dd_screen_memobj_create_from_handle(struct pipe_screen *_screen,
395 struct winsys_handle *handle,
396 bool dedicated)
397 {
398 struct pipe_screen *screen = dd_screen(_screen)->screen;
399
400 return screen->memobj_create_from_handle(screen, handle, dedicated);
401 }
402
403 static void
dd_screen_memobj_destroy(struct pipe_screen * _screen,struct pipe_memory_object * memobj)404 dd_screen_memobj_destroy(struct pipe_screen *_screen,
405 struct pipe_memory_object *memobj)
406 {
407 struct pipe_screen *screen = dd_screen(_screen)->screen;
408
409 screen->memobj_destroy(screen, memobj);
410 }
411 /********************************************************************
412 * screen
413 */
414
415 static void
dd_screen_finalize_nir(struct pipe_screen * _screen,void * nir,bool optimize)416 dd_screen_finalize_nir(struct pipe_screen *_screen, void *nir, bool optimize)
417 {
418 struct pipe_screen *screen = dd_screen(_screen)->screen;
419
420 screen->finalize_nir(screen, nir, optimize);
421 }
422
423 static void
dd_screen_destroy(struct pipe_screen * _screen)424 dd_screen_destroy(struct pipe_screen *_screen)
425 {
426 struct dd_screen *dscreen = dd_screen(_screen);
427 struct pipe_screen *screen = dscreen->screen;
428
429 screen->destroy(screen);
430 FREE(dscreen);
431 }
432
433 static void
skip_space(const char ** p)434 skip_space(const char **p)
435 {
436 while (isspace(**p))
437 (*p)++;
438 }
439
440 static bool
match_word(const char ** cur,const char * word)441 match_word(const char **cur, const char *word)
442 {
443 size_t len = strlen(word);
444 if (strncmp(*cur, word, len) != 0)
445 return false;
446
447 const char *p = *cur + len;
448 if (*p) {
449 if (!isspace(*p))
450 return false;
451
452 *cur = p + 1;
453 } else {
454 *cur = p;
455 }
456
457 return true;
458 }
459
460 static bool
match_uint(const char ** cur,unsigned * value)461 match_uint(const char **cur, unsigned *value)
462 {
463 char *end;
464 unsigned v = strtoul(*cur, &end, 0);
465 if (end == *cur || (*end && !isspace(*end)))
466 return false;
467 *cur = end;
468 *value = v;
469 return true;
470 }
471
472 struct pipe_screen *
ddebug_screen_create(struct pipe_screen * screen)473 ddebug_screen_create(struct pipe_screen *screen)
474 {
475 struct dd_screen *dscreen;
476 const char *option;
477 bool flush = false;
478 bool verbose = false;
479 bool transfers = false;
480 unsigned timeout = 1000;
481 unsigned apitrace_dump_call = 0;
482 enum dd_dump_mode mode = DD_DUMP_ONLY_HANGS;
483
484 option = debug_get_option("GALLIUM_DDEBUG", NULL);
485 if (!option)
486 return screen;
487
488 if (!strcmp(option, "help")) {
489 puts("Gallium driver debugger");
490 puts("");
491 puts("Usage:");
492 puts("");
493 puts(" GALLIUM_DDEBUG=\"[<timeout in ms>] [(always|apitrace <call#)] [flush] [transfers] [verbose]\"");
494 puts(" GALLIUM_DDEBUG_SKIP=[count]");
495 puts("");
496 puts("Dump context and driver information of draw calls into");
497 puts("$HOME/"DD_DIR"/. By default, watch for GPU hangs and only dump information");
498 puts("about draw calls related to the hang.");
499 puts("");
500 puts("<timeout in ms>");
501 puts(" Change the default timeout for GPU hang detection (default=1000ms).");
502 puts(" Setting this to 0 will disable GPU hang detection entirely.");
503 puts("");
504 puts("always");
505 puts(" Dump information about all draw calls.");
506 puts("");
507 puts("transfers");
508 puts(" Also dump and do hang detection on transfers.");
509 puts("");
510 puts("apitrace <call#>");
511 puts(" Dump information about the draw call corresponding to the given");
512 puts(" apitrace call number and exit.");
513 puts("");
514 puts("flush");
515 puts(" Flush after every draw call.");
516 puts("");
517 puts("verbose");
518 puts(" Write additional information to stderr.");
519 puts("");
520 puts("GALLIUM_DDEBUG_SKIP=count");
521 puts(" Skip dumping on the first count draw calls (only relevant with 'always').");
522 puts("");
523 exit(0);
524 }
525
526 for (;;) {
527 skip_space(&option);
528 if (!*option)
529 break;
530
531 if (match_word(&option, "always")) {
532 if (mode == DD_DUMP_APITRACE_CALL) {
533 printf("ddebug: both 'always' and 'apitrace' specified\n");
534 exit(1);
535 }
536
537 mode = DD_DUMP_ALL_CALLS;
538 } else if (match_word(&option, "flush")) {
539 flush = true;
540 } else if (match_word(&option, "transfers")) {
541 transfers = true;
542 } else if (match_word(&option, "verbose")) {
543 verbose = true;
544 } else if (match_word(&option, "apitrace")) {
545 if (mode != DD_DUMP_ONLY_HANGS) {
546 printf("ddebug: 'apitrace' can only appear once and not mixed with 'always'\n");
547 exit(1);
548 }
549
550 if (!match_uint(&option, &apitrace_dump_call)) {
551 printf("ddebug: expected call number after 'apitrace'\n");
552 exit(1);
553 }
554
555 mode = DD_DUMP_APITRACE_CALL;
556 } else if (match_uint(&option, &timeout)) {
557 /* no-op */
558 } else {
559 printf("ddebug: bad options: %s\n", option);
560 exit(1);
561 }
562 }
563
564 dscreen = CALLOC_STRUCT(dd_screen);
565 if (!dscreen)
566 return NULL;
567
568 #define SCR_INIT(_member) \
569 dscreen->base._member = screen->_member ? dd_screen_##_member : NULL
570
571 dscreen->base.destroy = dd_screen_destroy;
572 dscreen->base.get_name = dd_screen_get_name;
573 dscreen->base.get_vendor = dd_screen_get_vendor;
574 dscreen->base.get_device_vendor = dd_screen_get_device_vendor;
575 SCR_INIT(get_disk_shader_cache);
576 dscreen->base.get_param = dd_screen_get_param;
577 dscreen->base.get_paramf = dd_screen_get_paramf;
578 dscreen->base.get_compute_param = dd_screen_get_compute_param;
579 dscreen->base.get_shader_param = dd_screen_get_shader_param;
580 dscreen->base.query_memory_info = dd_screen_query_memory_info;
581 /* get_video_param */
582 /* get_compute_param */
583 SCR_INIT(get_timestamp);
584 dscreen->base.context_create = dd_screen_context_create;
585 dscreen->base.is_format_supported = dd_screen_is_format_supported;
586 /* is_video_format_supported */
587 SCR_INIT(can_create_resource);
588 dscreen->base.resource_create = dd_screen_resource_create;
589 dscreen->base.resource_from_handle = dd_screen_resource_from_handle;
590 SCR_INIT(resource_from_memobj);
591 SCR_INIT(resource_from_user_memory);
592 SCR_INIT(check_resource_capability);
593 dscreen->base.resource_get_handle = dd_screen_resource_get_handle;
594 SCR_INIT(resource_get_param);
595 SCR_INIT(resource_get_info);
596 SCR_INIT(resource_changed);
597 dscreen->base.resource_destroy = dd_screen_resource_destroy;
598 SCR_INIT(flush_frontbuffer);
599 SCR_INIT(fence_reference);
600 SCR_INIT(fence_finish);
601 SCR_INIT(fence_get_fd);
602 SCR_INIT(memobj_create_from_handle);
603 SCR_INIT(memobj_destroy);
604 SCR_INIT(get_driver_query_info);
605 SCR_INIT(get_driver_query_group_info);
606 SCR_INIT(get_compiler_options);
607 SCR_INIT(get_driver_uuid);
608 SCR_INIT(get_device_uuid);
609 SCR_INIT(finalize_nir);
610
611 #undef SCR_INIT
612
613 dscreen->screen = screen;
614 dscreen->timeout_ms = timeout;
615 dscreen->dump_mode = mode;
616 dscreen->flush_always = flush;
617 dscreen->transfers = transfers;
618 dscreen->verbose = verbose;
619 dscreen->apitrace_dump_call = apitrace_dump_call;
620
621 switch (dscreen->dump_mode) {
622 case DD_DUMP_ALL_CALLS:
623 fprintf(stderr, "Gallium debugger active. Logging all calls.\n");
624 break;
625 case DD_DUMP_APITRACE_CALL:
626 fprintf(stderr, "Gallium debugger active. Going to dump an apitrace call.\n");
627 break;
628 default:
629 fprintf(stderr, "Gallium debugger active.\n");
630 break;
631 }
632
633 if (dscreen->timeout_ms > 0)
634 fprintf(stderr, "Hang detection timeout is %ums.\n", dscreen->timeout_ms);
635 else
636 fprintf(stderr, "Hang detection is disabled.\n");
637
638 dscreen->skip_count = debug_get_num_option("GALLIUM_DDEBUG_SKIP", 0);
639 if (dscreen->skip_count > 0) {
640 fprintf(stderr, "Gallium debugger skipping the first %u draw calls.\n",
641 dscreen->skip_count);
642 }
643
644 return &dscreen->base;
645 }
646