1 /************************************************************************** 2 * 3 * Copyright 2010 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 29 #include "pipe/p_context.h" 30 #include "util/u_memory.h" 31 #include "util/u_inlines.h" 32 #include "util/u_simple_list.h" 33 34 #include "rbug/rbug_context.h" 35 36 #include "rbug_context.h" 37 #include "rbug_objects.h" 38 39 40 static void 41 rbug_destroy(struct pipe_context *_pipe) 42 { 43 struct rbug_context *rb_pipe = rbug_context(_pipe); 44 struct pipe_context *pipe = rb_pipe->pipe; 45 46 remove_from_list(&rb_pipe->list); 47 pipe_mutex_lock(rb_pipe->call_mutex); 48 pipe->destroy(pipe); 49 rb_pipe->pipe = NULL; 50 pipe_mutex_unlock(rb_pipe->call_mutex); 51 52 FREE(rb_pipe); 53 } 54 55 static void 56 rbug_draw_block_locked(struct rbug_context *rb_pipe, int flag) 57 { 58 59 if (rb_pipe->draw_blocker & flag) { 60 rb_pipe->draw_blocked |= flag; 61 } else if ((rb_pipe->draw_rule.blocker & flag) && 62 (rb_pipe->draw_blocker & RBUG_BLOCK_RULE)) { 63 int k; 64 boolean block = FALSE; 65 unsigned sh; 66 67 debug_printf("%s (%p %p) (%p %p) (%p %u) (%p %u)\n", __FUNCTION__, 68 (void *) rb_pipe->draw_rule.shader[PIPE_SHADER_FRAGMENT], 69 (void *) rb_pipe->curr.shader[PIPE_SHADER_FRAGMENT], 70 (void *) rb_pipe->draw_rule.shader[PIPE_SHADER_VERTEX], 71 (void *) rb_pipe->curr.shader[PIPE_SHADER_VERTEX], 72 (void *) rb_pipe->draw_rule.surf, 0, 73 (void *) rb_pipe->draw_rule.texture, 0); 74 for (sh = 0; sh < PIPE_SHADER_TYPES; sh++) { 75 if (rb_pipe->draw_rule.shader[sh] && 76 rb_pipe->draw_rule.shader[sh] == rb_pipe->curr.shader[sh]) 77 block = TRUE; 78 } 79 80 if (rb_pipe->draw_rule.surf && 81 rb_pipe->draw_rule.surf == rb_pipe->curr.zsbuf) 82 block = TRUE; 83 if (rb_pipe->draw_rule.surf) 84 for (k = 0; k < rb_pipe->curr.nr_cbufs; k++) 85 if (rb_pipe->draw_rule.surf == rb_pipe->curr.cbufs[k]) 86 block = TRUE; 87 if (rb_pipe->draw_rule.texture) { 88 for (sh = 0; sh < Elements(rb_pipe->curr.num_views); sh++) { 89 for (k = 0; k < rb_pipe->curr.num_views[sh]; k++) { 90 if (rb_pipe->draw_rule.texture == rb_pipe->curr.texs[sh][k]) { 91 block = TRUE; 92 sh = PIPE_SHADER_TYPES; /* to break out of both loops */ 93 break; 94 } 95 } 96 } 97 } 98 99 if (block) 100 rb_pipe->draw_blocked |= (flag | RBUG_BLOCK_RULE); 101 } 102 103 if (rb_pipe->draw_blocked) 104 rbug_notify_draw_blocked(rb_pipe); 105 106 /* wait for rbug to clear the blocked flag */ 107 while (rb_pipe->draw_blocked & flag) { 108 rb_pipe->draw_blocked |= flag; 109 pipe_condvar_wait(rb_pipe->draw_cond, rb_pipe->draw_mutex); 110 } 111 112 } 113 114 static void 115 rbug_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *info) 116 { 117 struct rbug_context *rb_pipe = rbug_context(_pipe); 118 struct pipe_context *pipe = rb_pipe->pipe; 119 120 pipe_mutex_lock(rb_pipe->draw_mutex); 121 rbug_draw_block_locked(rb_pipe, RBUG_BLOCK_BEFORE); 122 123 pipe_mutex_lock(rb_pipe->call_mutex); 124 /* XXX loop over PIPE_SHADER_x here */ 125 if (!(rb_pipe->curr.shader[PIPE_SHADER_FRAGMENT] && rb_pipe->curr.shader[PIPE_SHADER_FRAGMENT]->disabled) && 126 !(rb_pipe->curr.shader[PIPE_SHADER_GEOMETRY] && rb_pipe->curr.shader[PIPE_SHADER_GEOMETRY]->disabled) && 127 !(rb_pipe->curr.shader[PIPE_SHADER_VERTEX] && rb_pipe->curr.shader[PIPE_SHADER_VERTEX]->disabled)) 128 pipe->draw_vbo(pipe, info); 129 pipe_mutex_unlock(rb_pipe->call_mutex); 130 131 rbug_draw_block_locked(rb_pipe, RBUG_BLOCK_AFTER); 132 pipe_mutex_unlock(rb_pipe->draw_mutex); 133 } 134 135 static struct pipe_query * 136 rbug_create_query(struct pipe_context *_pipe, 137 unsigned query_type) 138 { 139 struct rbug_context *rb_pipe = rbug_context(_pipe); 140 struct pipe_context *pipe = rb_pipe->pipe; 141 142 pipe_mutex_lock(rb_pipe->call_mutex); 143 return pipe->create_query(pipe, 144 query_type); 145 pipe_mutex_unlock(rb_pipe->call_mutex); 146 } 147 148 static void 149 rbug_destroy_query(struct pipe_context *_pipe, 150 struct pipe_query *query) 151 { 152 struct rbug_context *rb_pipe = rbug_context(_pipe); 153 struct pipe_context *pipe = rb_pipe->pipe; 154 155 pipe_mutex_lock(rb_pipe->call_mutex); 156 pipe->destroy_query(pipe, 157 query); 158 pipe_mutex_unlock(rb_pipe->call_mutex); 159 } 160 161 static void 162 rbug_begin_query(struct pipe_context *_pipe, 163 struct pipe_query *query) 164 { 165 struct rbug_context *rb_pipe = rbug_context(_pipe); 166 struct pipe_context *pipe = rb_pipe->pipe; 167 168 pipe_mutex_lock(rb_pipe->call_mutex); 169 pipe->begin_query(pipe, 170 query); 171 pipe_mutex_unlock(rb_pipe->call_mutex); 172 } 173 174 static void 175 rbug_end_query(struct pipe_context *_pipe, 176 struct pipe_query *query) 177 { 178 struct rbug_context *rb_pipe = rbug_context(_pipe); 179 struct pipe_context *pipe = rb_pipe->pipe; 180 181 pipe_mutex_lock(rb_pipe->call_mutex); 182 pipe->end_query(pipe, 183 query); 184 pipe_mutex_unlock(rb_pipe->call_mutex); 185 } 186 187 static boolean 188 rbug_get_query_result(struct pipe_context *_pipe, 189 struct pipe_query *query, 190 boolean wait, 191 union pipe_query_result *result) 192 { 193 struct rbug_context *rb_pipe = rbug_context(_pipe); 194 struct pipe_context *pipe = rb_pipe->pipe; 195 boolean ret; 196 197 pipe_mutex_lock(rb_pipe->call_mutex); 198 ret = pipe->get_query_result(pipe, 199 query, 200 wait, 201 result); 202 pipe_mutex_unlock(rb_pipe->call_mutex); 203 204 return ret; 205 } 206 207 static void * 208 rbug_create_blend_state(struct pipe_context *_pipe, 209 const struct pipe_blend_state *blend) 210 { 211 struct rbug_context *rb_pipe = rbug_context(_pipe); 212 struct pipe_context *pipe = rb_pipe->pipe; 213 void *ret; 214 215 pipe_mutex_lock(rb_pipe->call_mutex); 216 ret = pipe->create_blend_state(pipe, 217 blend); 218 pipe_mutex_unlock(rb_pipe->call_mutex); 219 220 return ret; 221 } 222 223 static void 224 rbug_bind_blend_state(struct pipe_context *_pipe, 225 void *blend) 226 { 227 struct rbug_context *rb_pipe = rbug_context(_pipe); 228 struct pipe_context *pipe = rb_pipe->pipe; 229 230 pipe_mutex_lock(rb_pipe->call_mutex); 231 pipe->bind_blend_state(pipe, 232 blend); 233 pipe_mutex_unlock(rb_pipe->call_mutex); 234 } 235 236 static void 237 rbug_delete_blend_state(struct pipe_context *_pipe, 238 void *blend) 239 { 240 struct rbug_context *rb_pipe = rbug_context(_pipe); 241 struct pipe_context *pipe = rb_pipe->pipe; 242 243 pipe_mutex_lock(rb_pipe->call_mutex); 244 pipe->delete_blend_state(pipe, 245 blend); 246 pipe_mutex_unlock(rb_pipe->call_mutex); 247 } 248 249 static void * 250 rbug_create_sampler_state(struct pipe_context *_pipe, 251 const struct pipe_sampler_state *sampler) 252 { 253 struct rbug_context *rb_pipe = rbug_context(_pipe); 254 struct pipe_context *pipe = rb_pipe->pipe; 255 void *ret; 256 257 pipe_mutex_lock(rb_pipe->call_mutex); 258 ret = pipe->create_sampler_state(pipe, 259 sampler); 260 pipe_mutex_unlock(rb_pipe->call_mutex); 261 262 return ret; 263 } 264 265 static void 266 rbug_bind_fragment_sampler_states(struct pipe_context *_pipe, 267 unsigned num_samplers, 268 void **samplers) 269 { 270 struct rbug_context *rb_pipe = rbug_context(_pipe); 271 struct pipe_context *pipe = rb_pipe->pipe; 272 273 pipe_mutex_lock(rb_pipe->call_mutex); 274 pipe->bind_fragment_sampler_states(pipe, 275 num_samplers, 276 samplers); 277 pipe_mutex_unlock(rb_pipe->call_mutex); 278 } 279 280 static void 281 rbug_bind_vertex_sampler_states(struct pipe_context *_pipe, 282 unsigned num_samplers, 283 void **samplers) 284 { 285 struct rbug_context *rb_pipe = rbug_context(_pipe); 286 struct pipe_context *pipe = rb_pipe->pipe; 287 288 pipe_mutex_lock(rb_pipe->call_mutex); 289 pipe->bind_vertex_sampler_states(pipe, 290 num_samplers, 291 samplers); 292 pipe_mutex_unlock(rb_pipe->call_mutex); 293 } 294 295 static void 296 rbug_delete_sampler_state(struct pipe_context *_pipe, 297 void *sampler) 298 { 299 struct rbug_context *rb_pipe = rbug_context(_pipe); 300 struct pipe_context *pipe = rb_pipe->pipe; 301 302 pipe_mutex_lock(rb_pipe->call_mutex); 303 pipe->delete_sampler_state(pipe, 304 sampler); 305 pipe_mutex_unlock(rb_pipe->call_mutex); 306 } 307 308 static void * 309 rbug_create_rasterizer_state(struct pipe_context *_pipe, 310 const struct pipe_rasterizer_state *rasterizer) 311 { 312 struct rbug_context *rb_pipe = rbug_context(_pipe); 313 struct pipe_context *pipe = rb_pipe->pipe; 314 void *ret; 315 316 pipe_mutex_lock(rb_pipe->call_mutex); 317 ret = pipe->create_rasterizer_state(pipe, 318 rasterizer); 319 pipe_mutex_unlock(rb_pipe->call_mutex); 320 321 return ret; 322 } 323 324 static void 325 rbug_bind_rasterizer_state(struct pipe_context *_pipe, 326 void *rasterizer) 327 { 328 struct rbug_context *rb_pipe = rbug_context(_pipe); 329 struct pipe_context *pipe = rb_pipe->pipe; 330 331 pipe_mutex_lock(rb_pipe->call_mutex); 332 pipe->bind_rasterizer_state(pipe, 333 rasterizer); 334 pipe_mutex_unlock(rb_pipe->call_mutex); 335 } 336 337 static void 338 rbug_delete_rasterizer_state(struct pipe_context *_pipe, 339 void *rasterizer) 340 { 341 struct rbug_context *rb_pipe = rbug_context(_pipe); 342 struct pipe_context *pipe = rb_pipe->pipe; 343 344 pipe_mutex_lock(rb_pipe->call_mutex); 345 pipe->delete_rasterizer_state(pipe, 346 rasterizer); 347 pipe_mutex_unlock(rb_pipe->call_mutex); 348 } 349 350 static void * 351 rbug_create_depth_stencil_alpha_state(struct pipe_context *_pipe, 352 const struct pipe_depth_stencil_alpha_state *depth_stencil_alpha) 353 { 354 struct rbug_context *rb_pipe = rbug_context(_pipe); 355 struct pipe_context *pipe = rb_pipe->pipe; 356 void *ret; 357 358 pipe_mutex_lock(rb_pipe->call_mutex); 359 ret = pipe->create_depth_stencil_alpha_state(pipe, 360 depth_stencil_alpha); 361 pipe_mutex_unlock(rb_pipe->call_mutex); 362 363 return ret; 364 } 365 366 static void 367 rbug_bind_depth_stencil_alpha_state(struct pipe_context *_pipe, 368 void *depth_stencil_alpha) 369 { 370 struct rbug_context *rb_pipe = rbug_context(_pipe); 371 struct pipe_context *pipe = rb_pipe->pipe; 372 373 pipe_mutex_lock(rb_pipe->call_mutex); 374 pipe->bind_depth_stencil_alpha_state(pipe, 375 depth_stencil_alpha); 376 pipe_mutex_unlock(rb_pipe->call_mutex); 377 } 378 379 static void 380 rbug_delete_depth_stencil_alpha_state(struct pipe_context *_pipe, 381 void *depth_stencil_alpha) 382 { 383 struct rbug_context *rb_pipe = rbug_context(_pipe); 384 struct pipe_context *pipe = rb_pipe->pipe; 385 386 pipe_mutex_lock(rb_pipe->call_mutex); 387 pipe->delete_depth_stencil_alpha_state(pipe, 388 depth_stencil_alpha); 389 pipe_mutex_unlock(rb_pipe->call_mutex); 390 } 391 392 static void * 393 rbug_create_fs_state(struct pipe_context *_pipe, 394 const struct pipe_shader_state *state) 395 { 396 struct rbug_context *rb_pipe = rbug_context(_pipe); 397 struct pipe_context *pipe = rb_pipe->pipe; 398 void *result; 399 400 pipe_mutex_lock(rb_pipe->call_mutex); 401 result = pipe->create_fs_state(pipe, state); 402 pipe_mutex_unlock(rb_pipe->call_mutex); 403 404 if (!result) 405 return NULL; 406 407 return rbug_shader_create(rb_pipe, state, result, RBUG_SHADER_FRAGMENT); 408 } 409 410 static void 411 rbug_bind_fs_state(struct pipe_context *_pipe, 412 void *_fs) 413 { 414 struct rbug_context *rb_pipe = rbug_context(_pipe); 415 struct pipe_context *pipe = rb_pipe->pipe; 416 void *fs; 417 418 pipe_mutex_lock(rb_pipe->call_mutex); 419 420 fs = rbug_shader_unwrap(_fs); 421 rb_pipe->curr.shader[PIPE_SHADER_FRAGMENT] = rbug_shader(_fs); 422 pipe->bind_fs_state(pipe, 423 fs); 424 425 pipe_mutex_unlock(rb_pipe->call_mutex); 426 } 427 428 static void 429 rbug_delete_fs_state(struct pipe_context *_pipe, 430 void *_fs) 431 { 432 struct rbug_context *rb_pipe = rbug_context(_pipe); 433 struct rbug_shader *rb_shader = rbug_shader(_fs); 434 435 pipe_mutex_lock(rb_pipe->call_mutex); 436 rbug_shader_destroy(rb_pipe, rb_shader); 437 pipe_mutex_unlock(rb_pipe->call_mutex); 438 } 439 440 static void * 441 rbug_create_vs_state(struct pipe_context *_pipe, 442 const struct pipe_shader_state *state) 443 { 444 struct rbug_context *rb_pipe = rbug_context(_pipe); 445 struct pipe_context *pipe = rb_pipe->pipe; 446 void *result; 447 448 pipe_mutex_lock(rb_pipe->call_mutex); 449 result = pipe->create_vs_state(pipe, state); 450 pipe_mutex_unlock(rb_pipe->call_mutex); 451 452 if (!result) 453 return NULL; 454 455 return rbug_shader_create(rb_pipe, state, result, RBUG_SHADER_VERTEX); 456 } 457 458 static void 459 rbug_bind_vs_state(struct pipe_context *_pipe, 460 void *_vs) 461 { 462 struct rbug_context *rb_pipe = rbug_context(_pipe); 463 struct pipe_context *pipe = rb_pipe->pipe; 464 void *vs; 465 466 pipe_mutex_lock(rb_pipe->call_mutex); 467 468 vs = rbug_shader_unwrap(_vs); 469 rb_pipe->curr.shader[PIPE_SHADER_VERTEX] = rbug_shader(_vs); 470 pipe->bind_vs_state(pipe, 471 vs); 472 473 pipe_mutex_unlock(rb_pipe->call_mutex); 474 } 475 476 static void 477 rbug_delete_vs_state(struct pipe_context *_pipe, 478 void *_vs) 479 { 480 struct rbug_context *rb_pipe = rbug_context(_pipe); 481 struct rbug_shader *rb_shader = rbug_shader(_vs); 482 483 pipe_mutex_unlock(rb_pipe->call_mutex); 484 rbug_shader_destroy(rb_pipe, rb_shader); 485 pipe_mutex_unlock(rb_pipe->call_mutex); 486 } 487 488 static void * 489 rbug_create_gs_state(struct pipe_context *_pipe, 490 const struct pipe_shader_state *state) 491 { 492 struct rbug_context *rb_pipe = rbug_context(_pipe); 493 struct pipe_context *pipe = rb_pipe->pipe; 494 void *result; 495 496 pipe_mutex_lock(rb_pipe->call_mutex); 497 result = pipe->create_gs_state(pipe, state); 498 pipe_mutex_unlock(rb_pipe->call_mutex); 499 500 if (!result) 501 return NULL; 502 503 return rbug_shader_create(rb_pipe, state, result, RBUG_SHADER_GEOM); 504 } 505 506 static void 507 rbug_bind_gs_state(struct pipe_context *_pipe, 508 void *_gs) 509 { 510 struct rbug_context *rb_pipe = rbug_context(_pipe); 511 struct pipe_context *pipe = rb_pipe->pipe; 512 void *gs; 513 514 pipe_mutex_lock(rb_pipe->call_mutex); 515 516 gs = rbug_shader_unwrap(_gs); 517 rb_pipe->curr.shader[PIPE_SHADER_GEOMETRY] = rbug_shader(_gs); 518 pipe->bind_gs_state(pipe, 519 gs); 520 521 pipe_mutex_unlock(rb_pipe->call_mutex); 522 } 523 524 static void 525 rbug_delete_gs_state(struct pipe_context *_pipe, 526 void *_gs) 527 { 528 struct rbug_context *rb_pipe = rbug_context(_pipe); 529 struct rbug_shader *rb_shader = rbug_shader(_gs); 530 531 pipe_mutex_lock(rb_pipe->call_mutex); 532 rbug_shader_destroy(rb_pipe, rb_shader); 533 pipe_mutex_unlock(rb_pipe->call_mutex); 534 } 535 536 static void * 537 rbug_create_vertex_elements_state(struct pipe_context *_pipe, 538 unsigned num_elements, 539 const struct pipe_vertex_element *vertex_elements) 540 { 541 struct rbug_context *rb_pipe = rbug_context(_pipe); 542 struct pipe_context *pipe = rb_pipe->pipe; 543 void *ret; 544 545 pipe_mutex_lock(rb_pipe->call_mutex); 546 ret = pipe->create_vertex_elements_state(pipe, 547 num_elements, 548 vertex_elements); 549 pipe_mutex_unlock(rb_pipe->call_mutex); 550 551 return ret; 552 } 553 554 static void 555 rbug_bind_vertex_elements_state(struct pipe_context *_pipe, 556 void *velems) 557 { 558 struct rbug_context *rb_pipe = rbug_context(_pipe); 559 struct pipe_context *pipe = rb_pipe->pipe; 560 561 pipe_mutex_lock(rb_pipe->call_mutex); 562 pipe->bind_vertex_elements_state(pipe, 563 velems); 564 pipe_mutex_unlock(rb_pipe->call_mutex); 565 } 566 567 static void 568 rbug_delete_vertex_elements_state(struct pipe_context *_pipe, 569 void *velems) 570 { 571 struct rbug_context *rb_pipe = rbug_context(_pipe); 572 struct pipe_context *pipe = rb_pipe->pipe; 573 574 pipe_mutex_lock(rb_pipe->call_mutex); 575 pipe->delete_vertex_elements_state(pipe, 576 velems); 577 pipe_mutex_unlock(rb_pipe->call_mutex); 578 } 579 580 static void 581 rbug_set_blend_color(struct pipe_context *_pipe, 582 const struct pipe_blend_color *blend_color) 583 { 584 struct rbug_context *rb_pipe = rbug_context(_pipe); 585 struct pipe_context *pipe = rb_pipe->pipe; 586 587 pipe_mutex_lock(rb_pipe->call_mutex); 588 pipe->set_blend_color(pipe, 589 blend_color); 590 pipe_mutex_unlock(rb_pipe->call_mutex); 591 } 592 593 static void 594 rbug_set_stencil_ref(struct pipe_context *_pipe, 595 const struct pipe_stencil_ref *stencil_ref) 596 { 597 struct rbug_context *rb_pipe = rbug_context(_pipe); 598 struct pipe_context *pipe = rb_pipe->pipe; 599 600 pipe_mutex_lock(rb_pipe->call_mutex); 601 pipe->set_stencil_ref(pipe, 602 stencil_ref); 603 pipe_mutex_unlock(rb_pipe->call_mutex); 604 } 605 606 static void 607 rbug_set_clip_state(struct pipe_context *_pipe, 608 const struct pipe_clip_state *clip) 609 { 610 struct rbug_context *rb_pipe = rbug_context(_pipe); 611 struct pipe_context *pipe = rb_pipe->pipe; 612 613 pipe_mutex_lock(rb_pipe->call_mutex); 614 pipe->set_clip_state(pipe, 615 clip); 616 pipe_mutex_unlock(rb_pipe->call_mutex); 617 } 618 619 static void 620 rbug_set_constant_buffer(struct pipe_context *_pipe, 621 uint shader, 622 uint index, 623 struct pipe_constant_buffer *_cb) 624 { 625 struct rbug_context *rb_pipe = rbug_context(_pipe); 626 struct pipe_context *pipe = rb_pipe->pipe; 627 struct pipe_constant_buffer cb; 628 629 /* XXX hmm? unwrap the input state */ 630 if (_cb) { 631 cb = *_cb; 632 cb.buffer = rbug_resource_unwrap(_cb->buffer); 633 } 634 635 pipe_mutex_lock(rb_pipe->call_mutex); 636 pipe->set_constant_buffer(pipe, 637 shader, 638 index, 639 _cb ? &cb : NULL); 640 pipe_mutex_unlock(rb_pipe->call_mutex); 641 } 642 643 static void 644 rbug_set_framebuffer_state(struct pipe_context *_pipe, 645 const struct pipe_framebuffer_state *_state) 646 { 647 struct rbug_context *rb_pipe = rbug_context(_pipe); 648 struct pipe_context *pipe = rb_pipe->pipe; 649 struct pipe_framebuffer_state unwrapped_state; 650 struct pipe_framebuffer_state *state = NULL; 651 unsigned i; 652 653 /* must protect curr status */ 654 pipe_mutex_lock(rb_pipe->call_mutex); 655 656 rb_pipe->curr.nr_cbufs = 0; 657 memset(rb_pipe->curr.cbufs, 0, sizeof(rb_pipe->curr.cbufs)); 658 rb_pipe->curr.zsbuf = NULL; 659 660 /* unwrap the input state */ 661 if (_state) { 662 memcpy(&unwrapped_state, _state, sizeof(unwrapped_state)); 663 664 rb_pipe->curr.nr_cbufs = _state->nr_cbufs; 665 for(i = 0; i < _state->nr_cbufs; i++) { 666 unwrapped_state.cbufs[i] = rbug_surface_unwrap(_state->cbufs[i]); 667 if (_state->cbufs[i]) 668 rb_pipe->curr.cbufs[i] = rbug_resource(_state->cbufs[i]->texture); 669 } 670 unwrapped_state.zsbuf = rbug_surface_unwrap(_state->zsbuf); 671 if (_state->zsbuf) 672 rb_pipe->curr.zsbuf = rbug_resource(_state->zsbuf->texture); 673 state = &unwrapped_state; 674 } 675 676 pipe->set_framebuffer_state(pipe, 677 state); 678 679 pipe_mutex_unlock(rb_pipe->call_mutex); 680 } 681 682 static void 683 rbug_set_polygon_stipple(struct pipe_context *_pipe, 684 const struct pipe_poly_stipple *poly_stipple) 685 { 686 struct rbug_context *rb_pipe = rbug_context(_pipe); 687 struct pipe_context *pipe = rb_pipe->pipe; 688 689 pipe_mutex_lock(rb_pipe->call_mutex); 690 pipe->set_polygon_stipple(pipe, 691 poly_stipple); 692 pipe_mutex_unlock(rb_pipe->call_mutex); 693 } 694 695 static void 696 rbug_set_scissor_state(struct pipe_context *_pipe, 697 const struct pipe_scissor_state *scissor) 698 { 699 struct rbug_context *rb_pipe = rbug_context(_pipe); 700 struct pipe_context *pipe = rb_pipe->pipe; 701 702 pipe_mutex_lock(rb_pipe->call_mutex); 703 pipe->set_scissor_state(pipe, 704 scissor); 705 pipe_mutex_unlock(rb_pipe->call_mutex); 706 } 707 708 static void 709 rbug_set_viewport_state(struct pipe_context *_pipe, 710 const struct pipe_viewport_state *viewport) 711 { 712 struct rbug_context *rb_pipe = rbug_context(_pipe); 713 struct pipe_context *pipe = rb_pipe->pipe; 714 715 pipe_mutex_lock(rb_pipe->call_mutex); 716 pipe->set_viewport_state(pipe, 717 viewport); 718 pipe_mutex_unlock(rb_pipe->call_mutex); 719 } 720 721 static void 722 rbug_set_sampler_views(struct pipe_context *_pipe, 723 unsigned shader, 724 unsigned start, 725 unsigned num, 726 struct pipe_sampler_view **_views) 727 { 728 struct rbug_context *rb_pipe = rbug_context(_pipe); 729 struct pipe_context *pipe = rb_pipe->pipe; 730 struct pipe_sampler_view *unwrapped_views[PIPE_MAX_SAMPLERS]; 731 struct pipe_sampler_view **views = NULL; 732 unsigned i; 733 734 assert(start == 0); /* XXX fix */ 735 736 /* must protect curr status */ 737 pipe_mutex_lock(rb_pipe->call_mutex); 738 739 rb_pipe->curr.num_views[shader] = 0; 740 memset(rb_pipe->curr.views[shader], 0, sizeof(rb_pipe->curr.views[shader])); 741 memset(rb_pipe->curr.texs[shader], 0, sizeof(rb_pipe->curr.texs[shader])); 742 memset(unwrapped_views, 0, sizeof(unwrapped_views)); 743 744 if (_views) { 745 rb_pipe->curr.num_views[shader] = num; 746 for (i = 0; i < num; i++) { 747 rb_pipe->curr.views[shader][i] = rbug_sampler_view(_views[i]); 748 rb_pipe->curr.texs[shader][i] = rbug_resource(_views[i] ? _views[i]->texture : NULL); 749 unwrapped_views[i] = rbug_sampler_view_unwrap(_views[i]); 750 } 751 views = unwrapped_views; 752 } 753 754 switch (shader) { 755 case PIPE_SHADER_VERTEX: 756 pipe->set_vertex_sampler_views(pipe, num, views); 757 break; 758 case PIPE_SHADER_FRAGMENT: 759 pipe->set_fragment_sampler_views(pipe, num, views); 760 break; 761 default: 762 assert(0); 763 } 764 765 pipe_mutex_unlock(rb_pipe->call_mutex); 766 } 767 768 static void 769 rbug_set_vertex_sampler_views(struct pipe_context *_pipe, 770 unsigned num, 771 struct pipe_sampler_view **_views) 772 { 773 rbug_set_sampler_views(_pipe, PIPE_SHADER_VERTEX, 0, num, _views); 774 } 775 776 static void 777 rbug_set_fragment_sampler_views(struct pipe_context *_pipe, 778 unsigned num, 779 struct pipe_sampler_view **_views) 780 { 781 rbug_set_sampler_views(_pipe, PIPE_SHADER_FRAGMENT, 0, num, _views); 782 } 783 784 static void 785 rbug_set_vertex_buffers(struct pipe_context *_pipe, 786 unsigned num_buffers, 787 const struct pipe_vertex_buffer *_buffers) 788 { 789 struct rbug_context *rb_pipe = rbug_context(_pipe); 790 struct pipe_context *pipe = rb_pipe->pipe; 791 struct pipe_vertex_buffer unwrapped_buffers[PIPE_MAX_SHADER_INPUTS]; 792 struct pipe_vertex_buffer *buffers = NULL; 793 unsigned i; 794 795 pipe_mutex_lock(rb_pipe->call_mutex); 796 797 if (num_buffers) { 798 memcpy(unwrapped_buffers, _buffers, num_buffers * sizeof(*_buffers)); 799 for (i = 0; i < num_buffers; i++) 800 unwrapped_buffers[i].buffer = rbug_resource_unwrap(_buffers[i].buffer); 801 buffers = unwrapped_buffers; 802 } 803 804 pipe->set_vertex_buffers(pipe, 805 num_buffers, 806 buffers); 807 808 pipe_mutex_unlock(rb_pipe->call_mutex); 809 } 810 811 static void 812 rbug_set_index_buffer(struct pipe_context *_pipe, 813 const struct pipe_index_buffer *_ib) 814 { 815 struct rbug_context *rb_pipe = rbug_context(_pipe); 816 struct pipe_context *pipe = rb_pipe->pipe; 817 struct pipe_index_buffer unwrapped_ib, *ib = NULL; 818 819 if (_ib) { 820 unwrapped_ib = *_ib; 821 unwrapped_ib.buffer = rbug_resource_unwrap(_ib->buffer); 822 ib = &unwrapped_ib; 823 } 824 825 pipe_mutex_lock(rb_pipe->call_mutex); 826 pipe->set_index_buffer(pipe, ib); 827 pipe_mutex_unlock(rb_pipe->call_mutex); 828 } 829 830 static void 831 rbug_set_sample_mask(struct pipe_context *_pipe, 832 unsigned sample_mask) 833 { 834 struct rbug_context *rb_pipe = rbug_context(_pipe); 835 struct pipe_context *pipe = rb_pipe->pipe; 836 837 pipe_mutex_lock(rb_pipe->call_mutex); 838 pipe->set_sample_mask(pipe, sample_mask); 839 pipe_mutex_unlock(rb_pipe->call_mutex); 840 } 841 842 static void 843 rbug_resource_copy_region(struct pipe_context *_pipe, 844 struct pipe_resource *_dst, 845 unsigned dst_level, 846 unsigned dstx, 847 unsigned dsty, 848 unsigned dstz, 849 struct pipe_resource *_src, 850 unsigned src_level, 851 const struct pipe_box *src_box) 852 { 853 struct rbug_context *rb_pipe = rbug_context(_pipe); 854 struct rbug_resource *rb_resource_dst = rbug_resource(_dst); 855 struct rbug_resource *rb_resource_src = rbug_resource(_src); 856 struct pipe_context *pipe = rb_pipe->pipe; 857 struct pipe_resource *dst = rb_resource_dst->resource; 858 struct pipe_resource *src = rb_resource_src->resource; 859 860 pipe_mutex_lock(rb_pipe->call_mutex); 861 pipe->resource_copy_region(pipe, 862 dst, 863 dst_level, 864 dstx, 865 dsty, 866 dstz, 867 src, 868 src_level, 869 src_box); 870 pipe_mutex_unlock(rb_pipe->call_mutex); 871 } 872 873 static void 874 rbug_clear(struct pipe_context *_pipe, 875 unsigned buffers, 876 const union pipe_color_union *color, 877 double depth, 878 unsigned stencil) 879 { 880 struct rbug_context *rb_pipe = rbug_context(_pipe); 881 struct pipe_context *pipe = rb_pipe->pipe; 882 883 pipe_mutex_lock(rb_pipe->call_mutex); 884 pipe->clear(pipe, 885 buffers, 886 color, 887 depth, 888 stencil); 889 pipe_mutex_unlock(rb_pipe->call_mutex); 890 } 891 892 static void 893 rbug_clear_render_target(struct pipe_context *_pipe, 894 struct pipe_surface *_dst, 895 const union pipe_color_union *color, 896 unsigned dstx, unsigned dsty, 897 unsigned width, unsigned height) 898 { 899 struct rbug_context *rb_pipe = rbug_context(_pipe); 900 struct rbug_surface *rb_surface_dst = rbug_surface(_dst); 901 struct pipe_context *pipe = rb_pipe->pipe; 902 struct pipe_surface *dst = rb_surface_dst->surface; 903 904 pipe_mutex_lock(rb_pipe->call_mutex); 905 pipe->clear_render_target(pipe, 906 dst, 907 color, 908 dstx, 909 dsty, 910 width, 911 height); 912 pipe_mutex_unlock(rb_pipe->call_mutex); 913 } 914 915 static void 916 rbug_clear_depth_stencil(struct pipe_context *_pipe, 917 struct pipe_surface *_dst, 918 unsigned clear_flags, 919 double depth, 920 unsigned stencil, 921 unsigned dstx, unsigned dsty, 922 unsigned width, unsigned height) 923 { 924 struct rbug_context *rb_pipe = rbug_context(_pipe); 925 struct rbug_surface *rb_surface_dst = rbug_surface(_dst); 926 struct pipe_context *pipe = rb_pipe->pipe; 927 struct pipe_surface *dst = rb_surface_dst->surface; 928 929 pipe_mutex_lock(rb_pipe->call_mutex); 930 pipe->clear_depth_stencil(pipe, 931 dst, 932 clear_flags, 933 depth, 934 stencil, 935 dstx, 936 dsty, 937 width, 938 height); 939 pipe_mutex_unlock(rb_pipe->call_mutex); 940 } 941 942 static void 943 rbug_flush(struct pipe_context *_pipe, 944 struct pipe_fence_handle **fence) 945 { 946 struct rbug_context *rb_pipe = rbug_context(_pipe); 947 struct pipe_context *pipe = rb_pipe->pipe; 948 949 pipe_mutex_lock(rb_pipe->call_mutex); 950 pipe->flush(pipe, 951 fence); 952 pipe_mutex_unlock(rb_pipe->call_mutex); 953 } 954 955 static struct pipe_sampler_view * 956 rbug_context_create_sampler_view(struct pipe_context *_pipe, 957 struct pipe_resource *_resource, 958 const struct pipe_sampler_view *templ) 959 { 960 struct rbug_context *rb_pipe = rbug_context(_pipe); 961 struct rbug_resource *rb_resource = rbug_resource(_resource); 962 struct pipe_context *pipe = rb_pipe->pipe; 963 struct pipe_resource *resource = rb_resource->resource; 964 struct pipe_sampler_view *result; 965 966 pipe_mutex_lock(rb_pipe->call_mutex); 967 result = pipe->create_sampler_view(pipe, 968 resource, 969 templ); 970 pipe_mutex_unlock(rb_pipe->call_mutex); 971 972 if (result) 973 return rbug_sampler_view_create(rb_pipe, rb_resource, result); 974 return NULL; 975 } 976 977 static void 978 rbug_context_sampler_view_destroy(struct pipe_context *_pipe, 979 struct pipe_sampler_view *_view) 980 { 981 rbug_sampler_view_destroy(rbug_context(_pipe), 982 rbug_sampler_view(_view)); 983 } 984 985 static struct pipe_surface * 986 rbug_context_create_surface(struct pipe_context *_pipe, 987 struct pipe_resource *_resource, 988 const struct pipe_surface *surf_tmpl) 989 { 990 struct rbug_context *rb_pipe = rbug_context(_pipe); 991 struct rbug_resource *rb_resource = rbug_resource(_resource); 992 struct pipe_context *pipe = rb_pipe->pipe; 993 struct pipe_resource *resource = rb_resource->resource; 994 struct pipe_surface *result; 995 996 pipe_mutex_lock(rb_pipe->call_mutex); 997 result = pipe->create_surface(pipe, 998 resource, 999 surf_tmpl); 1000 pipe_mutex_unlock(rb_pipe->call_mutex); 1001 1002 if (result) 1003 return rbug_surface_create(rb_pipe, rb_resource, result); 1004 return NULL; 1005 } 1006 1007 static void 1008 rbug_context_surface_destroy(struct pipe_context *_pipe, 1009 struct pipe_surface *_surface) 1010 { 1011 struct rbug_context *rb_pipe = rbug_context(_pipe); 1012 struct rbug_surface *rb_surface = rbug_surface(_surface); 1013 1014 pipe_mutex_lock(rb_pipe->call_mutex); 1015 rbug_surface_destroy(rb_pipe, 1016 rb_surface); 1017 pipe_mutex_unlock(rb_pipe->call_mutex); 1018 } 1019 1020 1021 1022 static struct pipe_transfer * 1023 rbug_context_get_transfer(struct pipe_context *_context, 1024 struct pipe_resource *_resource, 1025 unsigned level, 1026 unsigned usage, 1027 const struct pipe_box *box) 1028 { 1029 struct rbug_context *rb_pipe = rbug_context(_context); 1030 struct rbug_resource *rb_resource = rbug_resource(_resource); 1031 struct pipe_context *context = rb_pipe->pipe; 1032 struct pipe_resource *resource = rb_resource->resource; 1033 struct pipe_transfer *result; 1034 1035 pipe_mutex_lock(rb_pipe->call_mutex); 1036 result = context->get_transfer(context, 1037 resource, 1038 level, 1039 usage, 1040 box); 1041 pipe_mutex_unlock(rb_pipe->call_mutex); 1042 1043 if (result) 1044 return rbug_transfer_create(rb_pipe, rb_resource, result); 1045 return NULL; 1046 } 1047 1048 static void 1049 rbug_context_transfer_destroy(struct pipe_context *_pipe, 1050 struct pipe_transfer *_transfer) 1051 { 1052 struct rbug_context *rb_pipe = rbug_context(_pipe); 1053 struct rbug_transfer *rb_transfer =rbug_transfer(_transfer); 1054 1055 pipe_mutex_lock(rb_pipe->call_mutex); 1056 rbug_transfer_destroy(rb_pipe, 1057 rb_transfer); 1058 pipe_mutex_unlock(rb_pipe->call_mutex); 1059 } 1060 1061 static void * 1062 rbug_context_transfer_map(struct pipe_context *_context, 1063 struct pipe_transfer *_transfer) 1064 { 1065 struct rbug_context *rb_pipe = rbug_context(_context); 1066 struct rbug_transfer *rb_transfer = rbug_transfer(_transfer); 1067 struct pipe_context *context = rb_pipe->pipe; 1068 struct pipe_transfer *transfer = rb_transfer->transfer; 1069 void *ret; 1070 1071 pipe_mutex_lock(rb_pipe->call_mutex); 1072 ret = context->transfer_map(context, 1073 transfer); 1074 pipe_mutex_unlock(rb_pipe->call_mutex); 1075 1076 return ret; 1077 } 1078 1079 1080 1081 static void 1082 rbug_context_transfer_flush_region(struct pipe_context *_context, 1083 struct pipe_transfer *_transfer, 1084 const struct pipe_box *box) 1085 { 1086 struct rbug_context *rb_pipe = rbug_context(_context); 1087 struct rbug_transfer *rb_transfer = rbug_transfer(_transfer); 1088 struct pipe_context *context = rb_pipe->pipe; 1089 struct pipe_transfer *transfer = rb_transfer->transfer; 1090 1091 pipe_mutex_lock(rb_pipe->call_mutex); 1092 context->transfer_flush_region(context, 1093 transfer, 1094 box); 1095 pipe_mutex_unlock(rb_pipe->call_mutex); 1096 } 1097 1098 1099 static void 1100 rbug_context_transfer_unmap(struct pipe_context *_context, 1101 struct pipe_transfer *_transfer) 1102 { 1103 struct rbug_context *rb_pipe = rbug_context(_context); 1104 struct rbug_transfer *rb_transfer = rbug_transfer(_transfer); 1105 struct pipe_context *context = rb_pipe->pipe; 1106 struct pipe_transfer *transfer = rb_transfer->transfer; 1107 1108 pipe_mutex_lock(rb_pipe->call_mutex); 1109 context->transfer_unmap(context, 1110 transfer); 1111 pipe_mutex_unlock(rb_pipe->call_mutex); 1112 } 1113 1114 1115 static void 1116 rbug_context_transfer_inline_write(struct pipe_context *_context, 1117 struct pipe_resource *_resource, 1118 unsigned level, 1119 unsigned usage, 1120 const struct pipe_box *box, 1121 const void *data, 1122 unsigned stride, 1123 unsigned layer_stride) 1124 { 1125 struct rbug_context *rb_pipe = rbug_context(_context); 1126 struct rbug_resource *rb_resource = rbug_resource(_resource); 1127 struct pipe_context *context = rb_pipe->pipe; 1128 struct pipe_resource *resource = rb_resource->resource; 1129 1130 pipe_mutex_lock(rb_pipe->call_mutex); 1131 context->transfer_inline_write(context, 1132 resource, 1133 level, 1134 usage, 1135 box, 1136 data, 1137 stride, 1138 layer_stride); 1139 pipe_mutex_unlock(rb_pipe->call_mutex); 1140 } 1141 1142 1143 struct pipe_context * 1144 rbug_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) 1145 { 1146 struct rbug_context *rb_pipe; 1147 struct rbug_screen *rb_screen = rbug_screen(_screen); 1148 1149 if (!rb_screen) 1150 return NULL; 1151 1152 rb_pipe = CALLOC_STRUCT(rbug_context); 1153 if (!rb_pipe) 1154 return NULL; 1155 1156 pipe_mutex_init(rb_pipe->draw_mutex); 1157 pipe_condvar_init(rb_pipe->draw_cond); 1158 pipe_mutex_init(rb_pipe->call_mutex); 1159 pipe_mutex_init(rb_pipe->list_mutex); 1160 make_empty_list(&rb_pipe->shaders); 1161 1162 rb_pipe->base.screen = _screen; 1163 rb_pipe->base.priv = pipe->priv; /* expose wrapped data */ 1164 rb_pipe->base.draw = NULL; 1165 1166 rb_pipe->base.destroy = rbug_destroy; 1167 rb_pipe->base.draw_vbo = rbug_draw_vbo; 1168 rb_pipe->base.create_query = rbug_create_query; 1169 rb_pipe->base.destroy_query = rbug_destroy_query; 1170 rb_pipe->base.begin_query = rbug_begin_query; 1171 rb_pipe->base.end_query = rbug_end_query; 1172 rb_pipe->base.get_query_result = rbug_get_query_result; 1173 rb_pipe->base.create_blend_state = rbug_create_blend_state; 1174 rb_pipe->base.bind_blend_state = rbug_bind_blend_state; 1175 rb_pipe->base.delete_blend_state = rbug_delete_blend_state; 1176 rb_pipe->base.create_sampler_state = rbug_create_sampler_state; 1177 rb_pipe->base.bind_fragment_sampler_states = rbug_bind_fragment_sampler_states; 1178 rb_pipe->base.bind_vertex_sampler_states = rbug_bind_vertex_sampler_states; 1179 rb_pipe->base.delete_sampler_state = rbug_delete_sampler_state; 1180 rb_pipe->base.create_rasterizer_state = rbug_create_rasterizer_state; 1181 rb_pipe->base.bind_rasterizer_state = rbug_bind_rasterizer_state; 1182 rb_pipe->base.delete_rasterizer_state = rbug_delete_rasterizer_state; 1183 rb_pipe->base.create_depth_stencil_alpha_state = rbug_create_depth_stencil_alpha_state; 1184 rb_pipe->base.bind_depth_stencil_alpha_state = rbug_bind_depth_stencil_alpha_state; 1185 rb_pipe->base.delete_depth_stencil_alpha_state = rbug_delete_depth_stencil_alpha_state; 1186 rb_pipe->base.create_fs_state = rbug_create_fs_state; 1187 rb_pipe->base.bind_fs_state = rbug_bind_fs_state; 1188 rb_pipe->base.delete_fs_state = rbug_delete_fs_state; 1189 rb_pipe->base.create_vs_state = rbug_create_vs_state; 1190 rb_pipe->base.bind_vs_state = rbug_bind_vs_state; 1191 rb_pipe->base.delete_vs_state = rbug_delete_vs_state; 1192 rb_pipe->base.create_gs_state = rbug_create_gs_state; 1193 rb_pipe->base.bind_gs_state = rbug_bind_gs_state; 1194 rb_pipe->base.delete_gs_state = rbug_delete_gs_state; 1195 rb_pipe->base.create_vertex_elements_state = rbug_create_vertex_elements_state; 1196 rb_pipe->base.bind_vertex_elements_state = rbug_bind_vertex_elements_state; 1197 rb_pipe->base.delete_vertex_elements_state = rbug_delete_vertex_elements_state; 1198 rb_pipe->base.set_blend_color = rbug_set_blend_color; 1199 rb_pipe->base.set_stencil_ref = rbug_set_stencil_ref; 1200 rb_pipe->base.set_clip_state = rbug_set_clip_state; 1201 rb_pipe->base.set_constant_buffer = rbug_set_constant_buffer; 1202 rb_pipe->base.set_framebuffer_state = rbug_set_framebuffer_state; 1203 rb_pipe->base.set_polygon_stipple = rbug_set_polygon_stipple; 1204 rb_pipe->base.set_scissor_state = rbug_set_scissor_state; 1205 rb_pipe->base.set_viewport_state = rbug_set_viewport_state; 1206 rb_pipe->base.set_fragment_sampler_views = rbug_set_fragment_sampler_views; 1207 rb_pipe->base.set_vertex_sampler_views = rbug_set_vertex_sampler_views; 1208 rb_pipe->base.set_vertex_buffers = rbug_set_vertex_buffers; 1209 rb_pipe->base.set_index_buffer = rbug_set_index_buffer; 1210 rb_pipe->base.set_sample_mask = rbug_set_sample_mask; 1211 rb_pipe->base.resource_copy_region = rbug_resource_copy_region; 1212 rb_pipe->base.clear = rbug_clear; 1213 rb_pipe->base.clear_render_target = rbug_clear_render_target; 1214 rb_pipe->base.clear_depth_stencil = rbug_clear_depth_stencil; 1215 rb_pipe->base.flush = rbug_flush; 1216 rb_pipe->base.create_sampler_view = rbug_context_create_sampler_view; 1217 rb_pipe->base.sampler_view_destroy = rbug_context_sampler_view_destroy; 1218 rb_pipe->base.create_surface = rbug_context_create_surface; 1219 rb_pipe->base.surface_destroy = rbug_context_surface_destroy; 1220 rb_pipe->base.get_transfer = rbug_context_get_transfer; 1221 rb_pipe->base.transfer_destroy = rbug_context_transfer_destroy; 1222 rb_pipe->base.transfer_map = rbug_context_transfer_map; 1223 rb_pipe->base.transfer_unmap = rbug_context_transfer_unmap; 1224 rb_pipe->base.transfer_flush_region = rbug_context_transfer_flush_region; 1225 rb_pipe->base.transfer_inline_write = rbug_context_transfer_inline_write; 1226 1227 rb_pipe->pipe = pipe; 1228 1229 rbug_screen_add_to_list(rb_screen, contexts, rb_pipe); 1230 1231 if (debug_get_bool_option("GALLIUM_RBUG_START_BLOCKED", FALSE)) { 1232 rb_pipe->draw_blocked = RBUG_BLOCK_BEFORE; 1233 } 1234 1235 return &rb_pipe->base; 1236 } 1237