1bf215546Sopenharmony_ci/************************************************************************** 2bf215546Sopenharmony_ci * 3bf215546Sopenharmony_ci * Copyright 2010 VMware, Inc. 4bf215546Sopenharmony_ci * All Rights Reserved. 5bf215546Sopenharmony_ci * 6bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 7bf215546Sopenharmony_ci * copy of this software and associated documentation files (the 8bf215546Sopenharmony_ci * "Software"), to deal in the Software without restriction, including 9bf215546Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish, 10bf215546Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to 11bf215546Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to 12bf215546Sopenharmony_ci * the following conditions: 13bf215546Sopenharmony_ci * 14bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the 15bf215546Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions 16bf215546Sopenharmony_ci * of the Software. 17bf215546Sopenharmony_ci * 18bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19bf215546Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21bf215546Sopenharmony_ci * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22bf215546Sopenharmony_ci * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23bf215546Sopenharmony_ci * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24bf215546Sopenharmony_ci * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25bf215546Sopenharmony_ci * 26bf215546Sopenharmony_ci **************************************************************************/ 27bf215546Sopenharmony_ci 28bf215546Sopenharmony_ci 29bf215546Sopenharmony_ci#include "pipe/p_context.h" 30bf215546Sopenharmony_ci#include "util/u_memory.h" 31bf215546Sopenharmony_ci#include "util/u_inlines.h" 32bf215546Sopenharmony_ci 33bf215546Sopenharmony_ci#include "rbug/rbug_context.h" 34bf215546Sopenharmony_ci 35bf215546Sopenharmony_ci#include "rbug_context.h" 36bf215546Sopenharmony_ci#include "rbug_objects.h" 37bf215546Sopenharmony_ci 38bf215546Sopenharmony_ci 39bf215546Sopenharmony_cistatic void 40bf215546Sopenharmony_cirbug_destroy(struct pipe_context *_pipe) 41bf215546Sopenharmony_ci{ 42bf215546Sopenharmony_ci struct rbug_screen *rb_screen = rbug_screen(_pipe->screen); 43bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 44bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 45bf215546Sopenharmony_ci 46bf215546Sopenharmony_ci rbug_screen_remove_from_list(rb_screen, contexts, rb_pipe); 47bf215546Sopenharmony_ci 48bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 49bf215546Sopenharmony_ci pipe->destroy(pipe); 50bf215546Sopenharmony_ci rb_pipe->pipe = NULL; 51bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 52bf215546Sopenharmony_ci 53bf215546Sopenharmony_ci FREE(rb_pipe); 54bf215546Sopenharmony_ci} 55bf215546Sopenharmony_ci 56bf215546Sopenharmony_cistatic void 57bf215546Sopenharmony_cirbug_draw_block_locked(struct rbug_context *rb_pipe, int flag) 58bf215546Sopenharmony_ci{ 59bf215546Sopenharmony_ci 60bf215546Sopenharmony_ci if (rb_pipe->draw_blocker & flag) { 61bf215546Sopenharmony_ci rb_pipe->draw_blocked |= flag; 62bf215546Sopenharmony_ci } else if ((rb_pipe->draw_rule.blocker & flag) && 63bf215546Sopenharmony_ci (rb_pipe->draw_blocker & RBUG_BLOCK_RULE)) { 64bf215546Sopenharmony_ci unsigned k; 65bf215546Sopenharmony_ci bool block = false; 66bf215546Sopenharmony_ci unsigned sh; 67bf215546Sopenharmony_ci 68bf215546Sopenharmony_ci debug_printf("%s (%p %p) (%p %p) (%p %u) (%p %u)\n", __FUNCTION__, 69bf215546Sopenharmony_ci (void *) rb_pipe->draw_rule.shader[PIPE_SHADER_FRAGMENT], 70bf215546Sopenharmony_ci (void *) rb_pipe->curr.shader[PIPE_SHADER_FRAGMENT], 71bf215546Sopenharmony_ci (void *) rb_pipe->draw_rule.shader[PIPE_SHADER_VERTEX], 72bf215546Sopenharmony_ci (void *) rb_pipe->curr.shader[PIPE_SHADER_VERTEX], 73bf215546Sopenharmony_ci (void *) rb_pipe->draw_rule.surf, 0, 74bf215546Sopenharmony_ci (void *) rb_pipe->draw_rule.texture, 0); 75bf215546Sopenharmony_ci for (sh = 0; sh < PIPE_SHADER_TYPES; sh++) { 76bf215546Sopenharmony_ci if (rb_pipe->draw_rule.shader[sh] && 77bf215546Sopenharmony_ci rb_pipe->draw_rule.shader[sh] == rb_pipe->curr.shader[sh]) 78bf215546Sopenharmony_ci block = true; 79bf215546Sopenharmony_ci } 80bf215546Sopenharmony_ci 81bf215546Sopenharmony_ci if (rb_pipe->draw_rule.surf && 82bf215546Sopenharmony_ci rb_pipe->draw_rule.surf == rb_pipe->curr.zsbuf) 83bf215546Sopenharmony_ci block = true; 84bf215546Sopenharmony_ci if (rb_pipe->draw_rule.surf) 85bf215546Sopenharmony_ci for (k = 0; k < rb_pipe->curr.nr_cbufs; k++) 86bf215546Sopenharmony_ci if (rb_pipe->draw_rule.surf == rb_pipe->curr.cbufs[k]) 87bf215546Sopenharmony_ci block = true; 88bf215546Sopenharmony_ci if (rb_pipe->draw_rule.texture) { 89bf215546Sopenharmony_ci for (sh = 0; sh < ARRAY_SIZE(rb_pipe->curr.num_views); sh++) { 90bf215546Sopenharmony_ci for (k = 0; k < rb_pipe->curr.num_views[sh]; k++) { 91bf215546Sopenharmony_ci if (rb_pipe->draw_rule.texture == rb_pipe->curr.texs[sh][k]) { 92bf215546Sopenharmony_ci block = true; 93bf215546Sopenharmony_ci sh = PIPE_SHADER_TYPES; /* to break out of both loops */ 94bf215546Sopenharmony_ci break; 95bf215546Sopenharmony_ci } 96bf215546Sopenharmony_ci } 97bf215546Sopenharmony_ci } 98bf215546Sopenharmony_ci } 99bf215546Sopenharmony_ci 100bf215546Sopenharmony_ci if (block) 101bf215546Sopenharmony_ci rb_pipe->draw_blocked |= (flag | RBUG_BLOCK_RULE); 102bf215546Sopenharmony_ci } 103bf215546Sopenharmony_ci 104bf215546Sopenharmony_ci if (rb_pipe->draw_blocked) 105bf215546Sopenharmony_ci rbug_notify_draw_blocked(rb_pipe); 106bf215546Sopenharmony_ci 107bf215546Sopenharmony_ci /* wait for rbug to clear the blocked flag */ 108bf215546Sopenharmony_ci while (rb_pipe->draw_blocked & flag) { 109bf215546Sopenharmony_ci rb_pipe->draw_blocked |= flag; 110bf215546Sopenharmony_ci cnd_wait(&rb_pipe->draw_cond, &rb_pipe->draw_mutex); 111bf215546Sopenharmony_ci } 112bf215546Sopenharmony_ci 113bf215546Sopenharmony_ci} 114bf215546Sopenharmony_ci 115bf215546Sopenharmony_cistatic void 116bf215546Sopenharmony_cirbug_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *_info, 117bf215546Sopenharmony_ci unsigned _drawid_offset, 118bf215546Sopenharmony_ci const struct pipe_draw_indirect_info *_indirect, 119bf215546Sopenharmony_ci const struct pipe_draw_start_count_bias *draws, 120bf215546Sopenharmony_ci unsigned num_draws) 121bf215546Sopenharmony_ci{ 122bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 123bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 124bf215546Sopenharmony_ci struct pipe_draw_info info; 125bf215546Sopenharmony_ci 126bf215546Sopenharmony_ci info = *_info; 127bf215546Sopenharmony_ci if(_info->index_size && !_info->has_user_indices) 128bf215546Sopenharmony_ci info.index.resource = rbug_resource_unwrap(_info->index.resource); 129bf215546Sopenharmony_ci 130bf215546Sopenharmony_ci mtx_lock(&rb_pipe->draw_mutex); 131bf215546Sopenharmony_ci rbug_draw_block_locked(rb_pipe, RBUG_BLOCK_BEFORE); 132bf215546Sopenharmony_ci 133bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 134bf215546Sopenharmony_ci /* XXX loop over PIPE_SHADER_x here */ 135bf215546Sopenharmony_ci if (!(rb_pipe->curr.shader[PIPE_SHADER_FRAGMENT] && rb_pipe->curr.shader[PIPE_SHADER_FRAGMENT]->disabled) && 136bf215546Sopenharmony_ci !(rb_pipe->curr.shader[PIPE_SHADER_GEOMETRY] && rb_pipe->curr.shader[PIPE_SHADER_GEOMETRY]->disabled) && 137bf215546Sopenharmony_ci !(rb_pipe->curr.shader[PIPE_SHADER_VERTEX] && rb_pipe->curr.shader[PIPE_SHADER_VERTEX]->disabled)) 138bf215546Sopenharmony_ci pipe->draw_vbo(pipe, &info, _drawid_offset, _indirect, draws, num_draws); 139bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 140bf215546Sopenharmony_ci 141bf215546Sopenharmony_ci rbug_draw_block_locked(rb_pipe, RBUG_BLOCK_AFTER); 142bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->draw_mutex); 143bf215546Sopenharmony_ci} 144bf215546Sopenharmony_ci 145bf215546Sopenharmony_cistatic struct pipe_query * 146bf215546Sopenharmony_cirbug_create_query(struct pipe_context *_pipe, 147bf215546Sopenharmony_ci unsigned query_type, 148bf215546Sopenharmony_ci unsigned index) 149bf215546Sopenharmony_ci{ 150bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 151bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 152bf215546Sopenharmony_ci struct pipe_query *query; 153bf215546Sopenharmony_ci 154bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 155bf215546Sopenharmony_ci query = pipe->create_query(pipe, 156bf215546Sopenharmony_ci query_type, 157bf215546Sopenharmony_ci index); 158bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 159bf215546Sopenharmony_ci return query; 160bf215546Sopenharmony_ci} 161bf215546Sopenharmony_ci 162bf215546Sopenharmony_cistatic void 163bf215546Sopenharmony_cirbug_destroy_query(struct pipe_context *_pipe, 164bf215546Sopenharmony_ci struct pipe_query *query) 165bf215546Sopenharmony_ci{ 166bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 167bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 168bf215546Sopenharmony_ci 169bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 170bf215546Sopenharmony_ci pipe->destroy_query(pipe, 171bf215546Sopenharmony_ci query); 172bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 173bf215546Sopenharmony_ci} 174bf215546Sopenharmony_ci 175bf215546Sopenharmony_cistatic bool 176bf215546Sopenharmony_cirbug_begin_query(struct pipe_context *_pipe, 177bf215546Sopenharmony_ci struct pipe_query *query) 178bf215546Sopenharmony_ci{ 179bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 180bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 181bf215546Sopenharmony_ci bool ret; 182bf215546Sopenharmony_ci 183bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 184bf215546Sopenharmony_ci ret = pipe->begin_query(pipe, query); 185bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 186bf215546Sopenharmony_ci return ret; 187bf215546Sopenharmony_ci} 188bf215546Sopenharmony_ci 189bf215546Sopenharmony_cistatic bool 190bf215546Sopenharmony_cirbug_end_query(struct pipe_context *_pipe, 191bf215546Sopenharmony_ci struct pipe_query *query) 192bf215546Sopenharmony_ci{ 193bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 194bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 195bf215546Sopenharmony_ci bool ret; 196bf215546Sopenharmony_ci 197bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 198bf215546Sopenharmony_ci ret = pipe->end_query(pipe, 199bf215546Sopenharmony_ci query); 200bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 201bf215546Sopenharmony_ci 202bf215546Sopenharmony_ci return ret; 203bf215546Sopenharmony_ci} 204bf215546Sopenharmony_ci 205bf215546Sopenharmony_cistatic bool 206bf215546Sopenharmony_cirbug_get_query_result(struct pipe_context *_pipe, 207bf215546Sopenharmony_ci struct pipe_query *query, 208bf215546Sopenharmony_ci bool wait, 209bf215546Sopenharmony_ci union pipe_query_result *result) 210bf215546Sopenharmony_ci{ 211bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 212bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 213bf215546Sopenharmony_ci bool ret; 214bf215546Sopenharmony_ci 215bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 216bf215546Sopenharmony_ci ret = pipe->get_query_result(pipe, 217bf215546Sopenharmony_ci query, 218bf215546Sopenharmony_ci wait, 219bf215546Sopenharmony_ci result); 220bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 221bf215546Sopenharmony_ci 222bf215546Sopenharmony_ci return ret; 223bf215546Sopenharmony_ci} 224bf215546Sopenharmony_ci 225bf215546Sopenharmony_cistatic void 226bf215546Sopenharmony_cirbug_set_active_query_state(struct pipe_context *_pipe, bool enable) 227bf215546Sopenharmony_ci{ 228bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 229bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 230bf215546Sopenharmony_ci 231bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 232bf215546Sopenharmony_ci pipe->set_active_query_state(pipe, enable); 233bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 234bf215546Sopenharmony_ci} 235bf215546Sopenharmony_ci 236bf215546Sopenharmony_cistatic void * 237bf215546Sopenharmony_cirbug_create_blend_state(struct pipe_context *_pipe, 238bf215546Sopenharmony_ci const struct pipe_blend_state *blend) 239bf215546Sopenharmony_ci{ 240bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 241bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 242bf215546Sopenharmony_ci void *ret; 243bf215546Sopenharmony_ci 244bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 245bf215546Sopenharmony_ci ret = pipe->create_blend_state(pipe, 246bf215546Sopenharmony_ci blend); 247bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 248bf215546Sopenharmony_ci 249bf215546Sopenharmony_ci return ret; 250bf215546Sopenharmony_ci} 251bf215546Sopenharmony_ci 252bf215546Sopenharmony_cistatic void 253bf215546Sopenharmony_cirbug_bind_blend_state(struct pipe_context *_pipe, 254bf215546Sopenharmony_ci void *blend) 255bf215546Sopenharmony_ci{ 256bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 257bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 258bf215546Sopenharmony_ci 259bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 260bf215546Sopenharmony_ci pipe->bind_blend_state(pipe, 261bf215546Sopenharmony_ci blend); 262bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 263bf215546Sopenharmony_ci} 264bf215546Sopenharmony_ci 265bf215546Sopenharmony_cistatic void 266bf215546Sopenharmony_cirbug_delete_blend_state(struct pipe_context *_pipe, 267bf215546Sopenharmony_ci void *blend) 268bf215546Sopenharmony_ci{ 269bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 270bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 271bf215546Sopenharmony_ci 272bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 273bf215546Sopenharmony_ci pipe->delete_blend_state(pipe, 274bf215546Sopenharmony_ci blend); 275bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 276bf215546Sopenharmony_ci} 277bf215546Sopenharmony_ci 278bf215546Sopenharmony_cistatic void * 279bf215546Sopenharmony_cirbug_create_sampler_state(struct pipe_context *_pipe, 280bf215546Sopenharmony_ci const struct pipe_sampler_state *sampler) 281bf215546Sopenharmony_ci{ 282bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 283bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 284bf215546Sopenharmony_ci void *ret; 285bf215546Sopenharmony_ci 286bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 287bf215546Sopenharmony_ci ret = pipe->create_sampler_state(pipe, 288bf215546Sopenharmony_ci sampler); 289bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 290bf215546Sopenharmony_ci 291bf215546Sopenharmony_ci return ret; 292bf215546Sopenharmony_ci} 293bf215546Sopenharmony_ci 294bf215546Sopenharmony_cistatic void 295bf215546Sopenharmony_cirbug_bind_sampler_states(struct pipe_context *_pipe, 296bf215546Sopenharmony_ci enum pipe_shader_type shader, 297bf215546Sopenharmony_ci unsigned start, unsigned count, 298bf215546Sopenharmony_ci void **samplers) 299bf215546Sopenharmony_ci{ 300bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 301bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 302bf215546Sopenharmony_ci 303bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 304bf215546Sopenharmony_ci pipe->bind_sampler_states(pipe, shader, start, count, samplers); 305bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 306bf215546Sopenharmony_ci} 307bf215546Sopenharmony_ci 308bf215546Sopenharmony_cistatic void 309bf215546Sopenharmony_cirbug_delete_sampler_state(struct pipe_context *_pipe, 310bf215546Sopenharmony_ci void *sampler) 311bf215546Sopenharmony_ci{ 312bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 313bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 314bf215546Sopenharmony_ci 315bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 316bf215546Sopenharmony_ci pipe->delete_sampler_state(pipe, 317bf215546Sopenharmony_ci sampler); 318bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 319bf215546Sopenharmony_ci} 320bf215546Sopenharmony_ci 321bf215546Sopenharmony_cistatic void * 322bf215546Sopenharmony_cirbug_create_rasterizer_state(struct pipe_context *_pipe, 323bf215546Sopenharmony_ci const struct pipe_rasterizer_state *rasterizer) 324bf215546Sopenharmony_ci{ 325bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 326bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 327bf215546Sopenharmony_ci void *ret; 328bf215546Sopenharmony_ci 329bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 330bf215546Sopenharmony_ci ret = pipe->create_rasterizer_state(pipe, 331bf215546Sopenharmony_ci rasterizer); 332bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 333bf215546Sopenharmony_ci 334bf215546Sopenharmony_ci return ret; 335bf215546Sopenharmony_ci} 336bf215546Sopenharmony_ci 337bf215546Sopenharmony_cistatic void 338bf215546Sopenharmony_cirbug_bind_rasterizer_state(struct pipe_context *_pipe, 339bf215546Sopenharmony_ci void *rasterizer) 340bf215546Sopenharmony_ci{ 341bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 342bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 343bf215546Sopenharmony_ci 344bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 345bf215546Sopenharmony_ci pipe->bind_rasterizer_state(pipe, 346bf215546Sopenharmony_ci rasterizer); 347bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 348bf215546Sopenharmony_ci} 349bf215546Sopenharmony_ci 350bf215546Sopenharmony_cistatic void 351bf215546Sopenharmony_cirbug_delete_rasterizer_state(struct pipe_context *_pipe, 352bf215546Sopenharmony_ci void *rasterizer) 353bf215546Sopenharmony_ci{ 354bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 355bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 356bf215546Sopenharmony_ci 357bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 358bf215546Sopenharmony_ci pipe->delete_rasterizer_state(pipe, 359bf215546Sopenharmony_ci rasterizer); 360bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 361bf215546Sopenharmony_ci} 362bf215546Sopenharmony_ci 363bf215546Sopenharmony_cistatic void * 364bf215546Sopenharmony_cirbug_create_depth_stencil_alpha_state(struct pipe_context *_pipe, 365bf215546Sopenharmony_ci const struct pipe_depth_stencil_alpha_state *depth_stencil_alpha) 366bf215546Sopenharmony_ci{ 367bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 368bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 369bf215546Sopenharmony_ci void *ret; 370bf215546Sopenharmony_ci 371bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 372bf215546Sopenharmony_ci ret = pipe->create_depth_stencil_alpha_state(pipe, 373bf215546Sopenharmony_ci depth_stencil_alpha); 374bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 375bf215546Sopenharmony_ci 376bf215546Sopenharmony_ci return ret; 377bf215546Sopenharmony_ci} 378bf215546Sopenharmony_ci 379bf215546Sopenharmony_cistatic void 380bf215546Sopenharmony_cirbug_bind_depth_stencil_alpha_state(struct pipe_context *_pipe, 381bf215546Sopenharmony_ci void *depth_stencil_alpha) 382bf215546Sopenharmony_ci{ 383bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 384bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 385bf215546Sopenharmony_ci 386bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 387bf215546Sopenharmony_ci pipe->bind_depth_stencil_alpha_state(pipe, 388bf215546Sopenharmony_ci depth_stencil_alpha); 389bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 390bf215546Sopenharmony_ci} 391bf215546Sopenharmony_ci 392bf215546Sopenharmony_cistatic void 393bf215546Sopenharmony_cirbug_delete_depth_stencil_alpha_state(struct pipe_context *_pipe, 394bf215546Sopenharmony_ci void *depth_stencil_alpha) 395bf215546Sopenharmony_ci{ 396bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 397bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 398bf215546Sopenharmony_ci 399bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 400bf215546Sopenharmony_ci pipe->delete_depth_stencil_alpha_state(pipe, 401bf215546Sopenharmony_ci depth_stencil_alpha); 402bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 403bf215546Sopenharmony_ci} 404bf215546Sopenharmony_ci 405bf215546Sopenharmony_cistatic void * 406bf215546Sopenharmony_cirbug_create_fs_state(struct pipe_context *_pipe, 407bf215546Sopenharmony_ci const struct pipe_shader_state *state) 408bf215546Sopenharmony_ci{ 409bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 410bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 411bf215546Sopenharmony_ci void *result; 412bf215546Sopenharmony_ci 413bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 414bf215546Sopenharmony_ci result = pipe->create_fs_state(pipe, state); 415bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 416bf215546Sopenharmony_ci 417bf215546Sopenharmony_ci if (!result) 418bf215546Sopenharmony_ci return NULL; 419bf215546Sopenharmony_ci 420bf215546Sopenharmony_ci return rbug_shader_create(rb_pipe, state, result, RBUG_SHADER_FRAGMENT); 421bf215546Sopenharmony_ci} 422bf215546Sopenharmony_ci 423bf215546Sopenharmony_cistatic void 424bf215546Sopenharmony_cirbug_bind_fs_state(struct pipe_context *_pipe, 425bf215546Sopenharmony_ci void *_fs) 426bf215546Sopenharmony_ci{ 427bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 428bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 429bf215546Sopenharmony_ci void *fs; 430bf215546Sopenharmony_ci 431bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 432bf215546Sopenharmony_ci 433bf215546Sopenharmony_ci fs = rbug_shader_unwrap(_fs); 434bf215546Sopenharmony_ci rb_pipe->curr.shader[PIPE_SHADER_FRAGMENT] = rbug_shader(_fs); 435bf215546Sopenharmony_ci pipe->bind_fs_state(pipe, 436bf215546Sopenharmony_ci fs); 437bf215546Sopenharmony_ci 438bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 439bf215546Sopenharmony_ci} 440bf215546Sopenharmony_ci 441bf215546Sopenharmony_cistatic void 442bf215546Sopenharmony_cirbug_delete_fs_state(struct pipe_context *_pipe, 443bf215546Sopenharmony_ci void *_fs) 444bf215546Sopenharmony_ci{ 445bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 446bf215546Sopenharmony_ci struct rbug_shader *rb_shader = rbug_shader(_fs); 447bf215546Sopenharmony_ci 448bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 449bf215546Sopenharmony_ci rbug_shader_destroy(rb_pipe, rb_shader); 450bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 451bf215546Sopenharmony_ci} 452bf215546Sopenharmony_ci 453bf215546Sopenharmony_cistatic void * 454bf215546Sopenharmony_cirbug_create_vs_state(struct pipe_context *_pipe, 455bf215546Sopenharmony_ci const struct pipe_shader_state *state) 456bf215546Sopenharmony_ci{ 457bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 458bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 459bf215546Sopenharmony_ci void *result; 460bf215546Sopenharmony_ci 461bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 462bf215546Sopenharmony_ci result = pipe->create_vs_state(pipe, state); 463bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 464bf215546Sopenharmony_ci 465bf215546Sopenharmony_ci if (!result) 466bf215546Sopenharmony_ci return NULL; 467bf215546Sopenharmony_ci 468bf215546Sopenharmony_ci return rbug_shader_create(rb_pipe, state, result, RBUG_SHADER_VERTEX); 469bf215546Sopenharmony_ci} 470bf215546Sopenharmony_ci 471bf215546Sopenharmony_cistatic void 472bf215546Sopenharmony_cirbug_bind_vs_state(struct pipe_context *_pipe, 473bf215546Sopenharmony_ci void *_vs) 474bf215546Sopenharmony_ci{ 475bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 476bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 477bf215546Sopenharmony_ci void *vs; 478bf215546Sopenharmony_ci 479bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 480bf215546Sopenharmony_ci 481bf215546Sopenharmony_ci vs = rbug_shader_unwrap(_vs); 482bf215546Sopenharmony_ci rb_pipe->curr.shader[PIPE_SHADER_VERTEX] = rbug_shader(_vs); 483bf215546Sopenharmony_ci pipe->bind_vs_state(pipe, 484bf215546Sopenharmony_ci vs); 485bf215546Sopenharmony_ci 486bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 487bf215546Sopenharmony_ci} 488bf215546Sopenharmony_ci 489bf215546Sopenharmony_cistatic void 490bf215546Sopenharmony_cirbug_delete_vs_state(struct pipe_context *_pipe, 491bf215546Sopenharmony_ci void *_vs) 492bf215546Sopenharmony_ci{ 493bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 494bf215546Sopenharmony_ci struct rbug_shader *rb_shader = rbug_shader(_vs); 495bf215546Sopenharmony_ci 496bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 497bf215546Sopenharmony_ci rbug_shader_destroy(rb_pipe, rb_shader); 498bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 499bf215546Sopenharmony_ci} 500bf215546Sopenharmony_ci 501bf215546Sopenharmony_cistatic void * 502bf215546Sopenharmony_cirbug_create_gs_state(struct pipe_context *_pipe, 503bf215546Sopenharmony_ci const struct pipe_shader_state *state) 504bf215546Sopenharmony_ci{ 505bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 506bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 507bf215546Sopenharmony_ci void *result; 508bf215546Sopenharmony_ci 509bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 510bf215546Sopenharmony_ci result = pipe->create_gs_state(pipe, state); 511bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 512bf215546Sopenharmony_ci 513bf215546Sopenharmony_ci if (!result) 514bf215546Sopenharmony_ci return NULL; 515bf215546Sopenharmony_ci 516bf215546Sopenharmony_ci return rbug_shader_create(rb_pipe, state, result, RBUG_SHADER_GEOM); 517bf215546Sopenharmony_ci} 518bf215546Sopenharmony_ci 519bf215546Sopenharmony_cistatic void 520bf215546Sopenharmony_cirbug_bind_gs_state(struct pipe_context *_pipe, 521bf215546Sopenharmony_ci void *_gs) 522bf215546Sopenharmony_ci{ 523bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 524bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 525bf215546Sopenharmony_ci void *gs; 526bf215546Sopenharmony_ci 527bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 528bf215546Sopenharmony_ci 529bf215546Sopenharmony_ci gs = rbug_shader_unwrap(_gs); 530bf215546Sopenharmony_ci rb_pipe->curr.shader[PIPE_SHADER_GEOMETRY] = rbug_shader(_gs); 531bf215546Sopenharmony_ci pipe->bind_gs_state(pipe, 532bf215546Sopenharmony_ci gs); 533bf215546Sopenharmony_ci 534bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 535bf215546Sopenharmony_ci} 536bf215546Sopenharmony_ci 537bf215546Sopenharmony_cistatic void 538bf215546Sopenharmony_cirbug_delete_gs_state(struct pipe_context *_pipe, 539bf215546Sopenharmony_ci void *_gs) 540bf215546Sopenharmony_ci{ 541bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 542bf215546Sopenharmony_ci struct rbug_shader *rb_shader = rbug_shader(_gs); 543bf215546Sopenharmony_ci 544bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 545bf215546Sopenharmony_ci rbug_shader_destroy(rb_pipe, rb_shader); 546bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 547bf215546Sopenharmony_ci} 548bf215546Sopenharmony_ci 549bf215546Sopenharmony_cistatic void * 550bf215546Sopenharmony_cirbug_create_vertex_elements_state(struct pipe_context *_pipe, 551bf215546Sopenharmony_ci unsigned num_elements, 552bf215546Sopenharmony_ci const struct pipe_vertex_element *vertex_elements) 553bf215546Sopenharmony_ci{ 554bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 555bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 556bf215546Sopenharmony_ci void *ret; 557bf215546Sopenharmony_ci 558bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 559bf215546Sopenharmony_ci ret = pipe->create_vertex_elements_state(pipe, 560bf215546Sopenharmony_ci num_elements, 561bf215546Sopenharmony_ci vertex_elements); 562bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 563bf215546Sopenharmony_ci 564bf215546Sopenharmony_ci return ret; 565bf215546Sopenharmony_ci} 566bf215546Sopenharmony_ci 567bf215546Sopenharmony_cistatic void 568bf215546Sopenharmony_cirbug_bind_vertex_elements_state(struct pipe_context *_pipe, 569bf215546Sopenharmony_ci void *velems) 570bf215546Sopenharmony_ci{ 571bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 572bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 573bf215546Sopenharmony_ci 574bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 575bf215546Sopenharmony_ci pipe->bind_vertex_elements_state(pipe, 576bf215546Sopenharmony_ci velems); 577bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 578bf215546Sopenharmony_ci} 579bf215546Sopenharmony_ci 580bf215546Sopenharmony_cistatic void 581bf215546Sopenharmony_cirbug_delete_vertex_elements_state(struct pipe_context *_pipe, 582bf215546Sopenharmony_ci void *velems) 583bf215546Sopenharmony_ci{ 584bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 585bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 586bf215546Sopenharmony_ci 587bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 588bf215546Sopenharmony_ci pipe->delete_vertex_elements_state(pipe, 589bf215546Sopenharmony_ci velems); 590bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 591bf215546Sopenharmony_ci} 592bf215546Sopenharmony_ci 593bf215546Sopenharmony_cistatic void 594bf215546Sopenharmony_cirbug_set_blend_color(struct pipe_context *_pipe, 595bf215546Sopenharmony_ci const struct pipe_blend_color *blend_color) 596bf215546Sopenharmony_ci{ 597bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 598bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 599bf215546Sopenharmony_ci 600bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 601bf215546Sopenharmony_ci pipe->set_blend_color(pipe, 602bf215546Sopenharmony_ci blend_color); 603bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 604bf215546Sopenharmony_ci} 605bf215546Sopenharmony_ci 606bf215546Sopenharmony_cistatic void 607bf215546Sopenharmony_cirbug_set_stencil_ref(struct pipe_context *_pipe, 608bf215546Sopenharmony_ci const struct pipe_stencil_ref stencil_ref) 609bf215546Sopenharmony_ci{ 610bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 611bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 612bf215546Sopenharmony_ci 613bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 614bf215546Sopenharmony_ci pipe->set_stencil_ref(pipe, 615bf215546Sopenharmony_ci stencil_ref); 616bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 617bf215546Sopenharmony_ci} 618bf215546Sopenharmony_ci 619bf215546Sopenharmony_cistatic void 620bf215546Sopenharmony_cirbug_set_clip_state(struct pipe_context *_pipe, 621bf215546Sopenharmony_ci const struct pipe_clip_state *clip) 622bf215546Sopenharmony_ci{ 623bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 624bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 625bf215546Sopenharmony_ci 626bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 627bf215546Sopenharmony_ci pipe->set_clip_state(pipe, 628bf215546Sopenharmony_ci clip); 629bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 630bf215546Sopenharmony_ci} 631bf215546Sopenharmony_ci 632bf215546Sopenharmony_cistatic void 633bf215546Sopenharmony_cirbug_set_constant_buffer(struct pipe_context *_pipe, 634bf215546Sopenharmony_ci enum pipe_shader_type shader, 635bf215546Sopenharmony_ci uint index, bool take_ownership, 636bf215546Sopenharmony_ci const struct pipe_constant_buffer *_cb) 637bf215546Sopenharmony_ci{ 638bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 639bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 640bf215546Sopenharmony_ci struct pipe_constant_buffer cb; 641bf215546Sopenharmony_ci 642bf215546Sopenharmony_ci /* XXX hmm? unwrap the input state */ 643bf215546Sopenharmony_ci if (_cb) { 644bf215546Sopenharmony_ci cb = *_cb; 645bf215546Sopenharmony_ci cb.buffer = rbug_resource_unwrap(_cb->buffer); 646bf215546Sopenharmony_ci } 647bf215546Sopenharmony_ci 648bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 649bf215546Sopenharmony_ci pipe->set_constant_buffer(pipe, 650bf215546Sopenharmony_ci shader, 651bf215546Sopenharmony_ci index, take_ownership, 652bf215546Sopenharmony_ci _cb ? &cb : NULL); 653bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 654bf215546Sopenharmony_ci} 655bf215546Sopenharmony_ci 656bf215546Sopenharmony_cistatic void 657bf215546Sopenharmony_cirbug_set_framebuffer_state(struct pipe_context *_pipe, 658bf215546Sopenharmony_ci const struct pipe_framebuffer_state *_state) 659bf215546Sopenharmony_ci{ 660bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 661bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 662bf215546Sopenharmony_ci struct pipe_framebuffer_state unwrapped_state; 663bf215546Sopenharmony_ci struct pipe_framebuffer_state *state = NULL; 664bf215546Sopenharmony_ci unsigned i; 665bf215546Sopenharmony_ci 666bf215546Sopenharmony_ci /* must protect curr status */ 667bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 668bf215546Sopenharmony_ci 669bf215546Sopenharmony_ci rb_pipe->curr.nr_cbufs = 0; 670bf215546Sopenharmony_ci memset(rb_pipe->curr.cbufs, 0, sizeof(rb_pipe->curr.cbufs)); 671bf215546Sopenharmony_ci rb_pipe->curr.zsbuf = NULL; 672bf215546Sopenharmony_ci 673bf215546Sopenharmony_ci /* unwrap the input state */ 674bf215546Sopenharmony_ci if (_state) { 675bf215546Sopenharmony_ci memcpy(&unwrapped_state, _state, sizeof(unwrapped_state)); 676bf215546Sopenharmony_ci 677bf215546Sopenharmony_ci rb_pipe->curr.nr_cbufs = _state->nr_cbufs; 678bf215546Sopenharmony_ci for(i = 0; i < _state->nr_cbufs; i++) { 679bf215546Sopenharmony_ci unwrapped_state.cbufs[i] = rbug_surface_unwrap(_state->cbufs[i]); 680bf215546Sopenharmony_ci if (_state->cbufs[i]) 681bf215546Sopenharmony_ci rb_pipe->curr.cbufs[i] = rbug_resource(_state->cbufs[i]->texture); 682bf215546Sopenharmony_ci } 683bf215546Sopenharmony_ci unwrapped_state.zsbuf = rbug_surface_unwrap(_state->zsbuf); 684bf215546Sopenharmony_ci if (_state->zsbuf) 685bf215546Sopenharmony_ci rb_pipe->curr.zsbuf = rbug_resource(_state->zsbuf->texture); 686bf215546Sopenharmony_ci state = &unwrapped_state; 687bf215546Sopenharmony_ci } 688bf215546Sopenharmony_ci 689bf215546Sopenharmony_ci pipe->set_framebuffer_state(pipe, 690bf215546Sopenharmony_ci state); 691bf215546Sopenharmony_ci 692bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 693bf215546Sopenharmony_ci} 694bf215546Sopenharmony_ci 695bf215546Sopenharmony_cistatic void 696bf215546Sopenharmony_cirbug_set_polygon_stipple(struct pipe_context *_pipe, 697bf215546Sopenharmony_ci const struct pipe_poly_stipple *poly_stipple) 698bf215546Sopenharmony_ci{ 699bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 700bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 701bf215546Sopenharmony_ci 702bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 703bf215546Sopenharmony_ci pipe->set_polygon_stipple(pipe, 704bf215546Sopenharmony_ci poly_stipple); 705bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 706bf215546Sopenharmony_ci} 707bf215546Sopenharmony_ci 708bf215546Sopenharmony_cistatic void 709bf215546Sopenharmony_cirbug_set_scissor_states(struct pipe_context *_pipe, 710bf215546Sopenharmony_ci unsigned start_slot, 711bf215546Sopenharmony_ci unsigned num_scissors, 712bf215546Sopenharmony_ci const struct pipe_scissor_state *scissor) 713bf215546Sopenharmony_ci{ 714bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 715bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 716bf215546Sopenharmony_ci 717bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 718bf215546Sopenharmony_ci pipe->set_scissor_states(pipe, start_slot, num_scissors, scissor); 719bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 720bf215546Sopenharmony_ci} 721bf215546Sopenharmony_ci 722bf215546Sopenharmony_cistatic void 723bf215546Sopenharmony_cirbug_set_viewport_states(struct pipe_context *_pipe, 724bf215546Sopenharmony_ci unsigned start_slot, 725bf215546Sopenharmony_ci unsigned num_viewports, 726bf215546Sopenharmony_ci const struct pipe_viewport_state *viewport) 727bf215546Sopenharmony_ci{ 728bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 729bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 730bf215546Sopenharmony_ci 731bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 732bf215546Sopenharmony_ci pipe->set_viewport_states(pipe, start_slot, num_viewports, viewport); 733bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 734bf215546Sopenharmony_ci} 735bf215546Sopenharmony_ci 736bf215546Sopenharmony_cistatic void 737bf215546Sopenharmony_cirbug_set_sampler_views(struct pipe_context *_pipe, 738bf215546Sopenharmony_ci enum pipe_shader_type shader, 739bf215546Sopenharmony_ci unsigned start, 740bf215546Sopenharmony_ci unsigned num, 741bf215546Sopenharmony_ci unsigned unbind_num_trailing_slots, 742bf215546Sopenharmony_ci bool take_ownership, 743bf215546Sopenharmony_ci struct pipe_sampler_view **_views) 744bf215546Sopenharmony_ci{ 745bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 746bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 747bf215546Sopenharmony_ci struct pipe_sampler_view *unwrapped_views[PIPE_MAX_SHADER_SAMPLER_VIEWS]; 748bf215546Sopenharmony_ci struct pipe_sampler_view **views = NULL; 749bf215546Sopenharmony_ci unsigned i; 750bf215546Sopenharmony_ci 751bf215546Sopenharmony_ci assert(start == 0); /* XXX fix */ 752bf215546Sopenharmony_ci 753bf215546Sopenharmony_ci /* must protect curr status */ 754bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 755bf215546Sopenharmony_ci 756bf215546Sopenharmony_ci rb_pipe->curr.num_views[shader] = 0; 757bf215546Sopenharmony_ci memset(rb_pipe->curr.views[shader], 0, sizeof(rb_pipe->curr.views[shader])); 758bf215546Sopenharmony_ci memset(rb_pipe->curr.texs[shader], 0, sizeof(rb_pipe->curr.texs[shader])); 759bf215546Sopenharmony_ci memset(unwrapped_views, 0, sizeof(unwrapped_views)); 760bf215546Sopenharmony_ci 761bf215546Sopenharmony_ci if (_views) { 762bf215546Sopenharmony_ci rb_pipe->curr.num_views[shader] = num; 763bf215546Sopenharmony_ci for (i = 0; i < num; i++) { 764bf215546Sopenharmony_ci rb_pipe->curr.views[shader][i] = rbug_sampler_view(_views[i]); 765bf215546Sopenharmony_ci rb_pipe->curr.texs[shader][i] = rbug_resource(_views[i] ? _views[i]->texture : NULL); 766bf215546Sopenharmony_ci unwrapped_views[i] = rbug_sampler_view_unwrap(_views[i]); 767bf215546Sopenharmony_ci } 768bf215546Sopenharmony_ci views = unwrapped_views; 769bf215546Sopenharmony_ci } 770bf215546Sopenharmony_ci 771bf215546Sopenharmony_ci pipe->set_sampler_views(pipe, shader, start, num, 772bf215546Sopenharmony_ci unbind_num_trailing_slots, take_ownership, views); 773bf215546Sopenharmony_ci 774bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 775bf215546Sopenharmony_ci} 776bf215546Sopenharmony_ci 777bf215546Sopenharmony_cistatic void 778bf215546Sopenharmony_cirbug_set_vertex_buffers(struct pipe_context *_pipe, 779bf215546Sopenharmony_ci unsigned start_slot, unsigned num_buffers, 780bf215546Sopenharmony_ci unsigned unbind_num_trailing_slots, 781bf215546Sopenharmony_ci bool take_ownership, 782bf215546Sopenharmony_ci const struct pipe_vertex_buffer *_buffers) 783bf215546Sopenharmony_ci{ 784bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 785bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 786bf215546Sopenharmony_ci struct pipe_vertex_buffer unwrapped_buffers[PIPE_MAX_SHADER_INPUTS]; 787bf215546Sopenharmony_ci struct pipe_vertex_buffer *buffers = NULL; 788bf215546Sopenharmony_ci unsigned i; 789bf215546Sopenharmony_ci 790bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 791bf215546Sopenharmony_ci 792bf215546Sopenharmony_ci if (num_buffers && _buffers) { 793bf215546Sopenharmony_ci memcpy(unwrapped_buffers, _buffers, num_buffers * sizeof(*_buffers)); 794bf215546Sopenharmony_ci for (i = 0; i < num_buffers; i++) { 795bf215546Sopenharmony_ci if (!_buffers[i].is_user_buffer) 796bf215546Sopenharmony_ci unwrapped_buffers[i].buffer.resource = 797bf215546Sopenharmony_ci rbug_resource_unwrap(_buffers[i].buffer.resource); 798bf215546Sopenharmony_ci } 799bf215546Sopenharmony_ci buffers = unwrapped_buffers; 800bf215546Sopenharmony_ci } 801bf215546Sopenharmony_ci 802bf215546Sopenharmony_ci pipe->set_vertex_buffers(pipe, start_slot, 803bf215546Sopenharmony_ci num_buffers, unbind_num_trailing_slots, 804bf215546Sopenharmony_ci take_ownership, buffers); 805bf215546Sopenharmony_ci 806bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 807bf215546Sopenharmony_ci} 808bf215546Sopenharmony_ci 809bf215546Sopenharmony_cistatic void 810bf215546Sopenharmony_cirbug_set_sample_mask(struct pipe_context *_pipe, 811bf215546Sopenharmony_ci unsigned sample_mask) 812bf215546Sopenharmony_ci{ 813bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 814bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 815bf215546Sopenharmony_ci 816bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 817bf215546Sopenharmony_ci pipe->set_sample_mask(pipe, sample_mask); 818bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 819bf215546Sopenharmony_ci} 820bf215546Sopenharmony_ci 821bf215546Sopenharmony_cistatic struct pipe_stream_output_target * 822bf215546Sopenharmony_cirbug_create_stream_output_target(struct pipe_context *_pipe, 823bf215546Sopenharmony_ci struct pipe_resource *_res, 824bf215546Sopenharmony_ci unsigned buffer_offset, unsigned buffer_size) 825bf215546Sopenharmony_ci{ 826bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 827bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 828bf215546Sopenharmony_ci struct pipe_resource *res = rbug_resource_unwrap(_res); 829bf215546Sopenharmony_ci struct pipe_stream_output_target *target; 830bf215546Sopenharmony_ci 831bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 832bf215546Sopenharmony_ci target = pipe->create_stream_output_target(pipe, res, buffer_offset, 833bf215546Sopenharmony_ci buffer_size); 834bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 835bf215546Sopenharmony_ci return target; 836bf215546Sopenharmony_ci} 837bf215546Sopenharmony_ci 838bf215546Sopenharmony_cistatic void 839bf215546Sopenharmony_cirbug_stream_output_target_destroy(struct pipe_context *_pipe, 840bf215546Sopenharmony_ci struct pipe_stream_output_target *target) 841bf215546Sopenharmony_ci{ 842bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 843bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 844bf215546Sopenharmony_ci 845bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 846bf215546Sopenharmony_ci pipe->stream_output_target_destroy(pipe, target); 847bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 848bf215546Sopenharmony_ci} 849bf215546Sopenharmony_ci 850bf215546Sopenharmony_cistatic void 851bf215546Sopenharmony_cirbug_set_stream_output_targets(struct pipe_context *_pipe, 852bf215546Sopenharmony_ci unsigned num_targets, 853bf215546Sopenharmony_ci struct pipe_stream_output_target **targets, 854bf215546Sopenharmony_ci const unsigned *offsets) 855bf215546Sopenharmony_ci{ 856bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 857bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 858bf215546Sopenharmony_ci 859bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 860bf215546Sopenharmony_ci pipe->set_stream_output_targets(pipe, num_targets, targets, offsets); 861bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 862bf215546Sopenharmony_ci} 863bf215546Sopenharmony_ci 864bf215546Sopenharmony_cistatic void 865bf215546Sopenharmony_cirbug_resource_copy_region(struct pipe_context *_pipe, 866bf215546Sopenharmony_ci struct pipe_resource *_dst, 867bf215546Sopenharmony_ci unsigned dst_level, 868bf215546Sopenharmony_ci unsigned dstx, 869bf215546Sopenharmony_ci unsigned dsty, 870bf215546Sopenharmony_ci unsigned dstz, 871bf215546Sopenharmony_ci struct pipe_resource *_src, 872bf215546Sopenharmony_ci unsigned src_level, 873bf215546Sopenharmony_ci const struct pipe_box *src_box) 874bf215546Sopenharmony_ci{ 875bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 876bf215546Sopenharmony_ci struct rbug_resource *rb_resource_dst = rbug_resource(_dst); 877bf215546Sopenharmony_ci struct rbug_resource *rb_resource_src = rbug_resource(_src); 878bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 879bf215546Sopenharmony_ci struct pipe_resource *dst = rb_resource_dst->resource; 880bf215546Sopenharmony_ci struct pipe_resource *src = rb_resource_src->resource; 881bf215546Sopenharmony_ci 882bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 883bf215546Sopenharmony_ci pipe->resource_copy_region(pipe, 884bf215546Sopenharmony_ci dst, 885bf215546Sopenharmony_ci dst_level, 886bf215546Sopenharmony_ci dstx, 887bf215546Sopenharmony_ci dsty, 888bf215546Sopenharmony_ci dstz, 889bf215546Sopenharmony_ci src, 890bf215546Sopenharmony_ci src_level, 891bf215546Sopenharmony_ci src_box); 892bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 893bf215546Sopenharmony_ci} 894bf215546Sopenharmony_ci 895bf215546Sopenharmony_cistatic void 896bf215546Sopenharmony_cirbug_blit(struct pipe_context *_pipe, const struct pipe_blit_info *_blit_info) 897bf215546Sopenharmony_ci{ 898bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 899bf215546Sopenharmony_ci struct rbug_resource *rb_resource_dst = rbug_resource(_blit_info->dst.resource); 900bf215546Sopenharmony_ci struct rbug_resource *rb_resource_src = rbug_resource(_blit_info->src.resource); 901bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 902bf215546Sopenharmony_ci struct pipe_resource *dst = rb_resource_dst->resource; 903bf215546Sopenharmony_ci struct pipe_resource *src = rb_resource_src->resource; 904bf215546Sopenharmony_ci struct pipe_blit_info blit_info; 905bf215546Sopenharmony_ci 906bf215546Sopenharmony_ci blit_info = *_blit_info; 907bf215546Sopenharmony_ci blit_info.dst.resource = dst; 908bf215546Sopenharmony_ci blit_info.src.resource = src; 909bf215546Sopenharmony_ci 910bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 911bf215546Sopenharmony_ci pipe->blit(pipe, &blit_info); 912bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 913bf215546Sopenharmony_ci} 914bf215546Sopenharmony_ci 915bf215546Sopenharmony_cistatic void 916bf215546Sopenharmony_cirbug_flush_resource(struct pipe_context *_pipe, 917bf215546Sopenharmony_ci struct pipe_resource *_res) 918bf215546Sopenharmony_ci{ 919bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 920bf215546Sopenharmony_ci struct rbug_resource *rb_resource_res = rbug_resource(_res); 921bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 922bf215546Sopenharmony_ci struct pipe_resource *res = rb_resource_res->resource; 923bf215546Sopenharmony_ci 924bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 925bf215546Sopenharmony_ci pipe->flush_resource(pipe, res); 926bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 927bf215546Sopenharmony_ci} 928bf215546Sopenharmony_ci 929bf215546Sopenharmony_cistatic void 930bf215546Sopenharmony_cirbug_clear(struct pipe_context *_pipe, 931bf215546Sopenharmony_ci unsigned buffers, 932bf215546Sopenharmony_ci const struct pipe_scissor_state *scissor_state, 933bf215546Sopenharmony_ci const union pipe_color_union *color, 934bf215546Sopenharmony_ci double depth, 935bf215546Sopenharmony_ci unsigned stencil) 936bf215546Sopenharmony_ci{ 937bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 938bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 939bf215546Sopenharmony_ci 940bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 941bf215546Sopenharmony_ci pipe->clear(pipe, 942bf215546Sopenharmony_ci buffers, 943bf215546Sopenharmony_ci scissor_state, 944bf215546Sopenharmony_ci color, 945bf215546Sopenharmony_ci depth, 946bf215546Sopenharmony_ci stencil); 947bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 948bf215546Sopenharmony_ci} 949bf215546Sopenharmony_ci 950bf215546Sopenharmony_cistatic void 951bf215546Sopenharmony_cirbug_clear_render_target(struct pipe_context *_pipe, 952bf215546Sopenharmony_ci struct pipe_surface *_dst, 953bf215546Sopenharmony_ci const union pipe_color_union *color, 954bf215546Sopenharmony_ci unsigned dstx, unsigned dsty, 955bf215546Sopenharmony_ci unsigned width, unsigned height, 956bf215546Sopenharmony_ci bool render_condition_enabled) 957bf215546Sopenharmony_ci{ 958bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 959bf215546Sopenharmony_ci struct rbug_surface *rb_surface_dst = rbug_surface(_dst); 960bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 961bf215546Sopenharmony_ci struct pipe_surface *dst = rb_surface_dst->surface; 962bf215546Sopenharmony_ci 963bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 964bf215546Sopenharmony_ci pipe->clear_render_target(pipe, 965bf215546Sopenharmony_ci dst, 966bf215546Sopenharmony_ci color, 967bf215546Sopenharmony_ci dstx, 968bf215546Sopenharmony_ci dsty, 969bf215546Sopenharmony_ci width, 970bf215546Sopenharmony_ci height, 971bf215546Sopenharmony_ci render_condition_enabled); 972bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 973bf215546Sopenharmony_ci} 974bf215546Sopenharmony_ci 975bf215546Sopenharmony_cistatic void 976bf215546Sopenharmony_cirbug_clear_depth_stencil(struct pipe_context *_pipe, 977bf215546Sopenharmony_ci struct pipe_surface *_dst, 978bf215546Sopenharmony_ci unsigned clear_flags, 979bf215546Sopenharmony_ci double depth, 980bf215546Sopenharmony_ci unsigned stencil, 981bf215546Sopenharmony_ci unsigned dstx, unsigned dsty, 982bf215546Sopenharmony_ci unsigned width, unsigned height, 983bf215546Sopenharmony_ci bool render_condition_enabled) 984bf215546Sopenharmony_ci{ 985bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 986bf215546Sopenharmony_ci struct rbug_surface *rb_surface_dst = rbug_surface(_dst); 987bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 988bf215546Sopenharmony_ci struct pipe_surface *dst = rb_surface_dst->surface; 989bf215546Sopenharmony_ci 990bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 991bf215546Sopenharmony_ci pipe->clear_depth_stencil(pipe, 992bf215546Sopenharmony_ci dst, 993bf215546Sopenharmony_ci clear_flags, 994bf215546Sopenharmony_ci depth, 995bf215546Sopenharmony_ci stencil, 996bf215546Sopenharmony_ci dstx, 997bf215546Sopenharmony_ci dsty, 998bf215546Sopenharmony_ci width, 999bf215546Sopenharmony_ci height, 1000bf215546Sopenharmony_ci render_condition_enabled); 1001bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 1002bf215546Sopenharmony_ci} 1003bf215546Sopenharmony_ci 1004bf215546Sopenharmony_cistatic void 1005bf215546Sopenharmony_cirbug_flush(struct pipe_context *_pipe, 1006bf215546Sopenharmony_ci struct pipe_fence_handle **fence, 1007bf215546Sopenharmony_ci unsigned flags) 1008bf215546Sopenharmony_ci{ 1009bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 1010bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 1011bf215546Sopenharmony_ci 1012bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 1013bf215546Sopenharmony_ci pipe->flush(pipe, fence, flags); 1014bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 1015bf215546Sopenharmony_ci} 1016bf215546Sopenharmony_ci 1017bf215546Sopenharmony_cistatic void 1018bf215546Sopenharmony_cirbug_create_fence_fd(struct pipe_context *_pipe, 1019bf215546Sopenharmony_ci struct pipe_fence_handle **fence, int fd, 1020bf215546Sopenharmony_ci enum pipe_fd_type type) 1021bf215546Sopenharmony_ci{ 1022bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 1023bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 1024bf215546Sopenharmony_ci 1025bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 1026bf215546Sopenharmony_ci pipe->create_fence_fd(pipe, fence, fd, type); 1027bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 1028bf215546Sopenharmony_ci} 1029bf215546Sopenharmony_ci 1030bf215546Sopenharmony_cistatic void 1031bf215546Sopenharmony_cirbug_fence_server_sync(struct pipe_context *_pipe, 1032bf215546Sopenharmony_ci struct pipe_fence_handle *fence) 1033bf215546Sopenharmony_ci{ 1034bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 1035bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 1036bf215546Sopenharmony_ci 1037bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 1038bf215546Sopenharmony_ci pipe->fence_server_sync(pipe, fence); 1039bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 1040bf215546Sopenharmony_ci} 1041bf215546Sopenharmony_ci 1042bf215546Sopenharmony_cistatic struct pipe_sampler_view * 1043bf215546Sopenharmony_cirbug_context_create_sampler_view(struct pipe_context *_pipe, 1044bf215546Sopenharmony_ci struct pipe_resource *_resource, 1045bf215546Sopenharmony_ci const struct pipe_sampler_view *templ) 1046bf215546Sopenharmony_ci{ 1047bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 1048bf215546Sopenharmony_ci struct rbug_resource *rb_resource = rbug_resource(_resource); 1049bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 1050bf215546Sopenharmony_ci struct pipe_resource *resource = rb_resource->resource; 1051bf215546Sopenharmony_ci struct pipe_sampler_view *result; 1052bf215546Sopenharmony_ci 1053bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 1054bf215546Sopenharmony_ci result = pipe->create_sampler_view(pipe, 1055bf215546Sopenharmony_ci resource, 1056bf215546Sopenharmony_ci templ); 1057bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 1058bf215546Sopenharmony_ci 1059bf215546Sopenharmony_ci if (result) 1060bf215546Sopenharmony_ci return rbug_sampler_view_create(rb_pipe, rb_resource, result); 1061bf215546Sopenharmony_ci return NULL; 1062bf215546Sopenharmony_ci} 1063bf215546Sopenharmony_ci 1064bf215546Sopenharmony_cistatic void 1065bf215546Sopenharmony_cirbug_context_sampler_view_destroy(struct pipe_context *_pipe, 1066bf215546Sopenharmony_ci struct pipe_sampler_view *_view) 1067bf215546Sopenharmony_ci{ 1068bf215546Sopenharmony_ci rbug_sampler_view_destroy(rbug_context(_pipe), 1069bf215546Sopenharmony_ci rbug_sampler_view(_view)); 1070bf215546Sopenharmony_ci} 1071bf215546Sopenharmony_ci 1072bf215546Sopenharmony_cistatic struct pipe_surface * 1073bf215546Sopenharmony_cirbug_context_create_surface(struct pipe_context *_pipe, 1074bf215546Sopenharmony_ci struct pipe_resource *_resource, 1075bf215546Sopenharmony_ci const struct pipe_surface *surf_tmpl) 1076bf215546Sopenharmony_ci{ 1077bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 1078bf215546Sopenharmony_ci struct rbug_resource *rb_resource = rbug_resource(_resource); 1079bf215546Sopenharmony_ci struct pipe_context *pipe = rb_pipe->pipe; 1080bf215546Sopenharmony_ci struct pipe_resource *resource = rb_resource->resource; 1081bf215546Sopenharmony_ci struct pipe_surface *result; 1082bf215546Sopenharmony_ci 1083bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 1084bf215546Sopenharmony_ci result = pipe->create_surface(pipe, 1085bf215546Sopenharmony_ci resource, 1086bf215546Sopenharmony_ci surf_tmpl); 1087bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 1088bf215546Sopenharmony_ci 1089bf215546Sopenharmony_ci if (result) 1090bf215546Sopenharmony_ci return rbug_surface_create(rb_pipe, rb_resource, result); 1091bf215546Sopenharmony_ci return NULL; 1092bf215546Sopenharmony_ci} 1093bf215546Sopenharmony_ci 1094bf215546Sopenharmony_cistatic void 1095bf215546Sopenharmony_cirbug_context_surface_destroy(struct pipe_context *_pipe, 1096bf215546Sopenharmony_ci struct pipe_surface *_surface) 1097bf215546Sopenharmony_ci{ 1098bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_pipe); 1099bf215546Sopenharmony_ci struct rbug_surface *rb_surface = rbug_surface(_surface); 1100bf215546Sopenharmony_ci 1101bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 1102bf215546Sopenharmony_ci rbug_surface_destroy(rb_pipe, 1103bf215546Sopenharmony_ci rb_surface); 1104bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 1105bf215546Sopenharmony_ci} 1106bf215546Sopenharmony_ci 1107bf215546Sopenharmony_ci 1108bf215546Sopenharmony_ci 1109bf215546Sopenharmony_cistatic void * 1110bf215546Sopenharmony_cirbug_context_buffer_map(struct pipe_context *_context, 1111bf215546Sopenharmony_ci struct pipe_resource *_resource, 1112bf215546Sopenharmony_ci unsigned level, 1113bf215546Sopenharmony_ci unsigned usage, 1114bf215546Sopenharmony_ci const struct pipe_box *box, 1115bf215546Sopenharmony_ci struct pipe_transfer **transfer) 1116bf215546Sopenharmony_ci{ 1117bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_context); 1118bf215546Sopenharmony_ci struct rbug_resource *rb_resource = rbug_resource(_resource); 1119bf215546Sopenharmony_ci struct pipe_context *context = rb_pipe->pipe; 1120bf215546Sopenharmony_ci struct pipe_resource *resource = rb_resource->resource; 1121bf215546Sopenharmony_ci struct pipe_transfer *result; 1122bf215546Sopenharmony_ci void *map; 1123bf215546Sopenharmony_ci 1124bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 1125bf215546Sopenharmony_ci map = context->buffer_map(context, 1126bf215546Sopenharmony_ci resource, 1127bf215546Sopenharmony_ci level, 1128bf215546Sopenharmony_ci usage, 1129bf215546Sopenharmony_ci box, &result); 1130bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 1131bf215546Sopenharmony_ci 1132bf215546Sopenharmony_ci *transfer = rbug_transfer_create(rb_pipe, rb_resource, result); 1133bf215546Sopenharmony_ci return *transfer ? map : NULL; 1134bf215546Sopenharmony_ci} 1135bf215546Sopenharmony_ci 1136bf215546Sopenharmony_cistatic void * 1137bf215546Sopenharmony_cirbug_context_texture_map(struct pipe_context *_context, 1138bf215546Sopenharmony_ci struct pipe_resource *_resource, 1139bf215546Sopenharmony_ci unsigned level, 1140bf215546Sopenharmony_ci unsigned usage, 1141bf215546Sopenharmony_ci const struct pipe_box *box, 1142bf215546Sopenharmony_ci struct pipe_transfer **transfer) 1143bf215546Sopenharmony_ci{ 1144bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_context); 1145bf215546Sopenharmony_ci struct rbug_resource *rb_resource = rbug_resource(_resource); 1146bf215546Sopenharmony_ci struct pipe_context *context = rb_pipe->pipe; 1147bf215546Sopenharmony_ci struct pipe_resource *resource = rb_resource->resource; 1148bf215546Sopenharmony_ci struct pipe_transfer *result; 1149bf215546Sopenharmony_ci void *map; 1150bf215546Sopenharmony_ci 1151bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 1152bf215546Sopenharmony_ci map = context->texture_map(context, 1153bf215546Sopenharmony_ci resource, 1154bf215546Sopenharmony_ci level, 1155bf215546Sopenharmony_ci usage, 1156bf215546Sopenharmony_ci box, &result); 1157bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 1158bf215546Sopenharmony_ci 1159bf215546Sopenharmony_ci *transfer = rbug_transfer_create(rb_pipe, rb_resource, result); 1160bf215546Sopenharmony_ci return *transfer ? map : NULL; 1161bf215546Sopenharmony_ci} 1162bf215546Sopenharmony_ci 1163bf215546Sopenharmony_cistatic void 1164bf215546Sopenharmony_cirbug_context_transfer_flush_region(struct pipe_context *_context, 1165bf215546Sopenharmony_ci struct pipe_transfer *_transfer, 1166bf215546Sopenharmony_ci const struct pipe_box *box) 1167bf215546Sopenharmony_ci{ 1168bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_context); 1169bf215546Sopenharmony_ci struct rbug_transfer *rb_transfer = rbug_transfer(_transfer); 1170bf215546Sopenharmony_ci struct pipe_context *context = rb_pipe->pipe; 1171bf215546Sopenharmony_ci struct pipe_transfer *transfer = rb_transfer->transfer; 1172bf215546Sopenharmony_ci 1173bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 1174bf215546Sopenharmony_ci context->transfer_flush_region(context, 1175bf215546Sopenharmony_ci transfer, 1176bf215546Sopenharmony_ci box); 1177bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 1178bf215546Sopenharmony_ci} 1179bf215546Sopenharmony_ci 1180bf215546Sopenharmony_ci 1181bf215546Sopenharmony_cistatic void 1182bf215546Sopenharmony_cirbug_context_buffer_unmap(struct pipe_context *_context, 1183bf215546Sopenharmony_ci struct pipe_transfer *_transfer) 1184bf215546Sopenharmony_ci{ 1185bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_context); 1186bf215546Sopenharmony_ci struct rbug_transfer *rb_transfer = rbug_transfer(_transfer); 1187bf215546Sopenharmony_ci struct pipe_context *context = rb_pipe->pipe; 1188bf215546Sopenharmony_ci struct pipe_transfer *transfer = rb_transfer->transfer; 1189bf215546Sopenharmony_ci 1190bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 1191bf215546Sopenharmony_ci context->buffer_unmap(context, 1192bf215546Sopenharmony_ci transfer); 1193bf215546Sopenharmony_ci rbug_transfer_destroy(rb_pipe, 1194bf215546Sopenharmony_ci rb_transfer); 1195bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 1196bf215546Sopenharmony_ci} 1197bf215546Sopenharmony_ci 1198bf215546Sopenharmony_cistatic void 1199bf215546Sopenharmony_cirbug_context_texture_unmap(struct pipe_context *_context, 1200bf215546Sopenharmony_ci struct pipe_transfer *_transfer) 1201bf215546Sopenharmony_ci{ 1202bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_context); 1203bf215546Sopenharmony_ci struct rbug_transfer *rb_transfer = rbug_transfer(_transfer); 1204bf215546Sopenharmony_ci struct pipe_context *context = rb_pipe->pipe; 1205bf215546Sopenharmony_ci struct pipe_transfer *transfer = rb_transfer->transfer; 1206bf215546Sopenharmony_ci 1207bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 1208bf215546Sopenharmony_ci context->texture_unmap(context, 1209bf215546Sopenharmony_ci transfer); 1210bf215546Sopenharmony_ci rbug_transfer_destroy(rb_pipe, 1211bf215546Sopenharmony_ci rb_transfer); 1212bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 1213bf215546Sopenharmony_ci} 1214bf215546Sopenharmony_ci 1215bf215546Sopenharmony_ci 1216bf215546Sopenharmony_cistatic void 1217bf215546Sopenharmony_cirbug_context_buffer_subdata(struct pipe_context *_context, 1218bf215546Sopenharmony_ci struct pipe_resource *_resource, 1219bf215546Sopenharmony_ci unsigned usage, unsigned offset, 1220bf215546Sopenharmony_ci unsigned size, const void *data) 1221bf215546Sopenharmony_ci{ 1222bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_context); 1223bf215546Sopenharmony_ci struct rbug_resource *rb_resource = rbug_resource(_resource); 1224bf215546Sopenharmony_ci struct pipe_context *context = rb_pipe->pipe; 1225bf215546Sopenharmony_ci struct pipe_resource *resource = rb_resource->resource; 1226bf215546Sopenharmony_ci 1227bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 1228bf215546Sopenharmony_ci context->buffer_subdata(context, resource, usage, offset, size, data); 1229bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 1230bf215546Sopenharmony_ci} 1231bf215546Sopenharmony_ci 1232bf215546Sopenharmony_ci 1233bf215546Sopenharmony_cistatic void 1234bf215546Sopenharmony_cirbug_context_texture_subdata(struct pipe_context *_context, 1235bf215546Sopenharmony_ci struct pipe_resource *_resource, 1236bf215546Sopenharmony_ci unsigned level, 1237bf215546Sopenharmony_ci unsigned usage, 1238bf215546Sopenharmony_ci const struct pipe_box *box, 1239bf215546Sopenharmony_ci const void *data, 1240bf215546Sopenharmony_ci unsigned stride, 1241bf215546Sopenharmony_ci unsigned layer_stride) 1242bf215546Sopenharmony_ci{ 1243bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_context); 1244bf215546Sopenharmony_ci struct rbug_resource *rb_resource = rbug_resource(_resource); 1245bf215546Sopenharmony_ci struct pipe_context *context = rb_pipe->pipe; 1246bf215546Sopenharmony_ci struct pipe_resource *resource = rb_resource->resource; 1247bf215546Sopenharmony_ci 1248bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 1249bf215546Sopenharmony_ci context->texture_subdata(context, 1250bf215546Sopenharmony_ci resource, 1251bf215546Sopenharmony_ci level, 1252bf215546Sopenharmony_ci usage, 1253bf215546Sopenharmony_ci box, 1254bf215546Sopenharmony_ci data, 1255bf215546Sopenharmony_ci stride, 1256bf215546Sopenharmony_ci layer_stride); 1257bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 1258bf215546Sopenharmony_ci} 1259bf215546Sopenharmony_ci 1260bf215546Sopenharmony_cistatic void 1261bf215546Sopenharmony_cirbug_context_texture_barrier(struct pipe_context *_context, unsigned flags) 1262bf215546Sopenharmony_ci{ 1263bf215546Sopenharmony_ci struct rbug_context *rb_pipe = rbug_context(_context); 1264bf215546Sopenharmony_ci struct pipe_context *context = rb_pipe->pipe; 1265bf215546Sopenharmony_ci 1266bf215546Sopenharmony_ci mtx_lock(&rb_pipe->call_mutex); 1267bf215546Sopenharmony_ci context->texture_barrier(context, 1268bf215546Sopenharmony_ci flags); 1269bf215546Sopenharmony_ci mtx_unlock(&rb_pipe->call_mutex); 1270bf215546Sopenharmony_ci} 1271bf215546Sopenharmony_ci 1272bf215546Sopenharmony_cistruct pipe_context * 1273bf215546Sopenharmony_cirbug_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) 1274bf215546Sopenharmony_ci{ 1275bf215546Sopenharmony_ci struct rbug_context *rb_pipe; 1276bf215546Sopenharmony_ci struct rbug_screen *rb_screen = rbug_screen(_screen); 1277bf215546Sopenharmony_ci 1278bf215546Sopenharmony_ci if (!rb_screen) 1279bf215546Sopenharmony_ci return NULL; 1280bf215546Sopenharmony_ci 1281bf215546Sopenharmony_ci rb_pipe = CALLOC_STRUCT(rbug_context); 1282bf215546Sopenharmony_ci if (!rb_pipe) 1283bf215546Sopenharmony_ci return NULL; 1284bf215546Sopenharmony_ci 1285bf215546Sopenharmony_ci (void) mtx_init(&rb_pipe->draw_mutex, mtx_plain); 1286bf215546Sopenharmony_ci cnd_init(&rb_pipe->draw_cond); 1287bf215546Sopenharmony_ci (void) mtx_init(&rb_pipe->call_mutex, mtx_plain); 1288bf215546Sopenharmony_ci (void) mtx_init(&rb_pipe->list_mutex, mtx_plain); 1289bf215546Sopenharmony_ci list_inithead(&rb_pipe->shaders); 1290bf215546Sopenharmony_ci 1291bf215546Sopenharmony_ci rb_pipe->base.screen = _screen; 1292bf215546Sopenharmony_ci rb_pipe->base.priv = pipe->priv; /* expose wrapped data */ 1293bf215546Sopenharmony_ci rb_pipe->base.draw = NULL; 1294bf215546Sopenharmony_ci rb_pipe->base.stream_uploader = pipe->stream_uploader; 1295bf215546Sopenharmony_ci rb_pipe->base.const_uploader = pipe->const_uploader; 1296bf215546Sopenharmony_ci 1297bf215546Sopenharmony_ci rb_pipe->base.destroy = rbug_destroy; 1298bf215546Sopenharmony_ci rb_pipe->base.draw_vbo = rbug_draw_vbo; 1299bf215546Sopenharmony_ci rb_pipe->base.create_query = rbug_create_query; 1300bf215546Sopenharmony_ci rb_pipe->base.destroy_query = rbug_destroy_query; 1301bf215546Sopenharmony_ci rb_pipe->base.begin_query = rbug_begin_query; 1302bf215546Sopenharmony_ci rb_pipe->base.end_query = rbug_end_query; 1303bf215546Sopenharmony_ci rb_pipe->base.get_query_result = rbug_get_query_result; 1304bf215546Sopenharmony_ci rb_pipe->base.set_active_query_state = rbug_set_active_query_state; 1305bf215546Sopenharmony_ci rb_pipe->base.create_blend_state = rbug_create_blend_state; 1306bf215546Sopenharmony_ci rb_pipe->base.bind_blend_state = rbug_bind_blend_state; 1307bf215546Sopenharmony_ci rb_pipe->base.delete_blend_state = rbug_delete_blend_state; 1308bf215546Sopenharmony_ci rb_pipe->base.create_sampler_state = rbug_create_sampler_state; 1309bf215546Sopenharmony_ci rb_pipe->base.bind_sampler_states = rbug_bind_sampler_states; 1310bf215546Sopenharmony_ci rb_pipe->base.delete_sampler_state = rbug_delete_sampler_state; 1311bf215546Sopenharmony_ci rb_pipe->base.create_rasterizer_state = rbug_create_rasterizer_state; 1312bf215546Sopenharmony_ci rb_pipe->base.bind_rasterizer_state = rbug_bind_rasterizer_state; 1313bf215546Sopenharmony_ci rb_pipe->base.delete_rasterizer_state = rbug_delete_rasterizer_state; 1314bf215546Sopenharmony_ci rb_pipe->base.create_depth_stencil_alpha_state = rbug_create_depth_stencil_alpha_state; 1315bf215546Sopenharmony_ci rb_pipe->base.bind_depth_stencil_alpha_state = rbug_bind_depth_stencil_alpha_state; 1316bf215546Sopenharmony_ci rb_pipe->base.delete_depth_stencil_alpha_state = rbug_delete_depth_stencil_alpha_state; 1317bf215546Sopenharmony_ci rb_pipe->base.create_fs_state = rbug_create_fs_state; 1318bf215546Sopenharmony_ci rb_pipe->base.bind_fs_state = rbug_bind_fs_state; 1319bf215546Sopenharmony_ci rb_pipe->base.delete_fs_state = rbug_delete_fs_state; 1320bf215546Sopenharmony_ci rb_pipe->base.create_vs_state = rbug_create_vs_state; 1321bf215546Sopenharmony_ci rb_pipe->base.bind_vs_state = rbug_bind_vs_state; 1322bf215546Sopenharmony_ci rb_pipe->base.delete_vs_state = rbug_delete_vs_state; 1323bf215546Sopenharmony_ci rb_pipe->base.create_gs_state = rbug_create_gs_state; 1324bf215546Sopenharmony_ci rb_pipe->base.bind_gs_state = rbug_bind_gs_state; 1325bf215546Sopenharmony_ci rb_pipe->base.delete_gs_state = rbug_delete_gs_state; 1326bf215546Sopenharmony_ci rb_pipe->base.create_vertex_elements_state = rbug_create_vertex_elements_state; 1327bf215546Sopenharmony_ci rb_pipe->base.bind_vertex_elements_state = rbug_bind_vertex_elements_state; 1328bf215546Sopenharmony_ci rb_pipe->base.delete_vertex_elements_state = rbug_delete_vertex_elements_state; 1329bf215546Sopenharmony_ci rb_pipe->base.set_blend_color = rbug_set_blend_color; 1330bf215546Sopenharmony_ci rb_pipe->base.set_stencil_ref = rbug_set_stencil_ref; 1331bf215546Sopenharmony_ci rb_pipe->base.set_clip_state = rbug_set_clip_state; 1332bf215546Sopenharmony_ci rb_pipe->base.set_constant_buffer = rbug_set_constant_buffer; 1333bf215546Sopenharmony_ci rb_pipe->base.set_framebuffer_state = rbug_set_framebuffer_state; 1334bf215546Sopenharmony_ci rb_pipe->base.set_polygon_stipple = rbug_set_polygon_stipple; 1335bf215546Sopenharmony_ci rb_pipe->base.set_scissor_states = rbug_set_scissor_states; 1336bf215546Sopenharmony_ci rb_pipe->base.set_viewport_states = rbug_set_viewport_states; 1337bf215546Sopenharmony_ci rb_pipe->base.set_sampler_views = rbug_set_sampler_views; 1338bf215546Sopenharmony_ci rb_pipe->base.set_vertex_buffers = rbug_set_vertex_buffers; 1339bf215546Sopenharmony_ci rb_pipe->base.set_sample_mask = rbug_set_sample_mask; 1340bf215546Sopenharmony_ci rb_pipe->base.create_stream_output_target = rbug_create_stream_output_target; 1341bf215546Sopenharmony_ci rb_pipe->base.stream_output_target_destroy = rbug_stream_output_target_destroy; 1342bf215546Sopenharmony_ci rb_pipe->base.set_stream_output_targets = rbug_set_stream_output_targets; 1343bf215546Sopenharmony_ci rb_pipe->base.resource_copy_region = rbug_resource_copy_region; 1344bf215546Sopenharmony_ci rb_pipe->base.blit = rbug_blit; 1345bf215546Sopenharmony_ci rb_pipe->base.clear = rbug_clear; 1346bf215546Sopenharmony_ci rb_pipe->base.clear_render_target = rbug_clear_render_target; 1347bf215546Sopenharmony_ci rb_pipe->base.clear_depth_stencil = rbug_clear_depth_stencil; 1348bf215546Sopenharmony_ci rb_pipe->base.flush = rbug_flush; 1349bf215546Sopenharmony_ci rb_pipe->base.create_fence_fd = rbug_create_fence_fd; 1350bf215546Sopenharmony_ci rb_pipe->base.fence_server_sync = rbug_fence_server_sync; 1351bf215546Sopenharmony_ci rb_pipe->base.create_sampler_view = rbug_context_create_sampler_view; 1352bf215546Sopenharmony_ci rb_pipe->base.sampler_view_destroy = rbug_context_sampler_view_destroy; 1353bf215546Sopenharmony_ci rb_pipe->base.create_surface = rbug_context_create_surface; 1354bf215546Sopenharmony_ci rb_pipe->base.surface_destroy = rbug_context_surface_destroy; 1355bf215546Sopenharmony_ci rb_pipe->base.buffer_map = rbug_context_buffer_map; 1356bf215546Sopenharmony_ci rb_pipe->base.buffer_unmap = rbug_context_buffer_unmap; 1357bf215546Sopenharmony_ci rb_pipe->base.texture_map = rbug_context_texture_map; 1358bf215546Sopenharmony_ci rb_pipe->base.texture_unmap = rbug_context_texture_unmap; 1359bf215546Sopenharmony_ci rb_pipe->base.transfer_flush_region = rbug_context_transfer_flush_region; 1360bf215546Sopenharmony_ci rb_pipe->base.buffer_subdata = rbug_context_buffer_subdata; 1361bf215546Sopenharmony_ci rb_pipe->base.texture_subdata = rbug_context_texture_subdata; 1362bf215546Sopenharmony_ci rb_pipe->base.texture_barrier = rbug_context_texture_barrier; 1363bf215546Sopenharmony_ci rb_pipe->base.flush_resource = rbug_flush_resource; 1364bf215546Sopenharmony_ci 1365bf215546Sopenharmony_ci rb_pipe->pipe = pipe; 1366bf215546Sopenharmony_ci 1367bf215546Sopenharmony_ci rbug_screen_add_to_list(rb_screen, contexts, rb_pipe); 1368bf215546Sopenharmony_ci 1369bf215546Sopenharmony_ci if (debug_get_bool_option("GALLIUM_RBUG_START_BLOCKED", false)) { 1370bf215546Sopenharmony_ci rb_pipe->draw_blocked = RBUG_BLOCK_BEFORE; 1371bf215546Sopenharmony_ci } 1372bf215546Sopenharmony_ci 1373bf215546Sopenharmony_ci return &rb_pipe->base; 1374bf215546Sopenharmony_ci} 1375