1bf215546Sopenharmony_ci/************************************************************************** 2bf215546Sopenharmony_ci * 3bf215546Sopenharmony_ci * Copyright 2008 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#include "util/format/u_format.h" 29bf215546Sopenharmony_ci#include "util/u_memory.h" 30bf215546Sopenharmony_ci#include "util/hash_table.h" 31bf215546Sopenharmony_ci 32bf215546Sopenharmony_ci#include "tr_dump.h" 33bf215546Sopenharmony_ci#include "tr_dump_defines.h" 34bf215546Sopenharmony_ci#include "tr_dump_state.h" 35bf215546Sopenharmony_ci#include "tr_texture.h" 36bf215546Sopenharmony_ci#include "tr_context.h" 37bf215546Sopenharmony_ci#include "tr_screen.h" 38bf215546Sopenharmony_ci#include "tr_public.h" 39bf215546Sopenharmony_ci#include "tr_util.h" 40bf215546Sopenharmony_ci 41bf215546Sopenharmony_ci 42bf215546Sopenharmony_cistatic bool trace = false; 43bf215546Sopenharmony_cistatic struct hash_table *trace_screens; 44bf215546Sopenharmony_ci 45bf215546Sopenharmony_cistatic const char * 46bf215546Sopenharmony_citrace_screen_get_name(struct pipe_screen *_screen) 47bf215546Sopenharmony_ci{ 48bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 49bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 50bf215546Sopenharmony_ci const char *result; 51bf215546Sopenharmony_ci 52bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "get_name"); 53bf215546Sopenharmony_ci 54bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 55bf215546Sopenharmony_ci 56bf215546Sopenharmony_ci result = screen->get_name(screen); 57bf215546Sopenharmony_ci 58bf215546Sopenharmony_ci trace_dump_ret(string, result); 59bf215546Sopenharmony_ci 60bf215546Sopenharmony_ci trace_dump_call_end(); 61bf215546Sopenharmony_ci 62bf215546Sopenharmony_ci return result; 63bf215546Sopenharmony_ci} 64bf215546Sopenharmony_ci 65bf215546Sopenharmony_ci 66bf215546Sopenharmony_cistatic const char * 67bf215546Sopenharmony_citrace_screen_get_vendor(struct pipe_screen *_screen) 68bf215546Sopenharmony_ci{ 69bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 70bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 71bf215546Sopenharmony_ci const char *result; 72bf215546Sopenharmony_ci 73bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "get_vendor"); 74bf215546Sopenharmony_ci 75bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 76bf215546Sopenharmony_ci 77bf215546Sopenharmony_ci result = screen->get_vendor(screen); 78bf215546Sopenharmony_ci 79bf215546Sopenharmony_ci trace_dump_ret(string, result); 80bf215546Sopenharmony_ci 81bf215546Sopenharmony_ci trace_dump_call_end(); 82bf215546Sopenharmony_ci 83bf215546Sopenharmony_ci return result; 84bf215546Sopenharmony_ci} 85bf215546Sopenharmony_ci 86bf215546Sopenharmony_ci 87bf215546Sopenharmony_cistatic const char * 88bf215546Sopenharmony_citrace_screen_get_device_vendor(struct pipe_screen *_screen) 89bf215546Sopenharmony_ci{ 90bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 91bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 92bf215546Sopenharmony_ci const char *result; 93bf215546Sopenharmony_ci 94bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "get_device_vendor"); 95bf215546Sopenharmony_ci 96bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 97bf215546Sopenharmony_ci 98bf215546Sopenharmony_ci result = screen->get_device_vendor(screen); 99bf215546Sopenharmony_ci 100bf215546Sopenharmony_ci trace_dump_ret(string, result); 101bf215546Sopenharmony_ci 102bf215546Sopenharmony_ci trace_dump_call_end(); 103bf215546Sopenharmony_ci 104bf215546Sopenharmony_ci return result; 105bf215546Sopenharmony_ci} 106bf215546Sopenharmony_ci 107bf215546Sopenharmony_ci 108bf215546Sopenharmony_cistatic const void * 109bf215546Sopenharmony_citrace_screen_get_compiler_options(struct pipe_screen *_screen, 110bf215546Sopenharmony_ci enum pipe_shader_ir ir, 111bf215546Sopenharmony_ci enum pipe_shader_type shader) 112bf215546Sopenharmony_ci{ 113bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 114bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 115bf215546Sopenharmony_ci const void *result; 116bf215546Sopenharmony_ci 117bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "get_compiler_options"); 118bf215546Sopenharmony_ci 119bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 120bf215546Sopenharmony_ci trace_dump_arg_enum(ir, tr_util_pipe_shader_ir_name(ir)); 121bf215546Sopenharmony_ci trace_dump_arg_enum(shader, tr_util_pipe_shader_type_name(shader)); 122bf215546Sopenharmony_ci 123bf215546Sopenharmony_ci result = screen->get_compiler_options(screen, ir, shader); 124bf215546Sopenharmony_ci 125bf215546Sopenharmony_ci trace_dump_ret(ptr, result); 126bf215546Sopenharmony_ci 127bf215546Sopenharmony_ci trace_dump_call_end(); 128bf215546Sopenharmony_ci 129bf215546Sopenharmony_ci return result; 130bf215546Sopenharmony_ci} 131bf215546Sopenharmony_ci 132bf215546Sopenharmony_ci 133bf215546Sopenharmony_cistatic struct disk_cache * 134bf215546Sopenharmony_citrace_screen_get_disk_shader_cache(struct pipe_screen *_screen) 135bf215546Sopenharmony_ci{ 136bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 137bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 138bf215546Sopenharmony_ci 139bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "get_disk_shader_cache"); 140bf215546Sopenharmony_ci 141bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 142bf215546Sopenharmony_ci 143bf215546Sopenharmony_ci struct disk_cache *result = screen->get_disk_shader_cache(screen); 144bf215546Sopenharmony_ci 145bf215546Sopenharmony_ci trace_dump_ret(ptr, result); 146bf215546Sopenharmony_ci 147bf215546Sopenharmony_ci trace_dump_call_end(); 148bf215546Sopenharmony_ci 149bf215546Sopenharmony_ci return result; 150bf215546Sopenharmony_ci} 151bf215546Sopenharmony_ci 152bf215546Sopenharmony_ci 153bf215546Sopenharmony_cistatic int 154bf215546Sopenharmony_citrace_screen_get_param(struct pipe_screen *_screen, 155bf215546Sopenharmony_ci enum pipe_cap param) 156bf215546Sopenharmony_ci{ 157bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 158bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 159bf215546Sopenharmony_ci int result; 160bf215546Sopenharmony_ci 161bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "get_param"); 162bf215546Sopenharmony_ci 163bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 164bf215546Sopenharmony_ci trace_dump_arg_enum(param, tr_util_pipe_cap_name(param)); 165bf215546Sopenharmony_ci 166bf215546Sopenharmony_ci result = screen->get_param(screen, param); 167bf215546Sopenharmony_ci 168bf215546Sopenharmony_ci trace_dump_ret(int, result); 169bf215546Sopenharmony_ci 170bf215546Sopenharmony_ci trace_dump_call_end(); 171bf215546Sopenharmony_ci 172bf215546Sopenharmony_ci return result; 173bf215546Sopenharmony_ci} 174bf215546Sopenharmony_ci 175bf215546Sopenharmony_ci 176bf215546Sopenharmony_cistatic int 177bf215546Sopenharmony_citrace_screen_get_shader_param(struct pipe_screen *_screen, 178bf215546Sopenharmony_ci enum pipe_shader_type shader, 179bf215546Sopenharmony_ci enum pipe_shader_cap param) 180bf215546Sopenharmony_ci{ 181bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 182bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 183bf215546Sopenharmony_ci int result; 184bf215546Sopenharmony_ci 185bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "get_shader_param"); 186bf215546Sopenharmony_ci 187bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 188bf215546Sopenharmony_ci trace_dump_arg_enum(shader, tr_util_pipe_shader_type_name(shader)); 189bf215546Sopenharmony_ci trace_dump_arg_enum(param, tr_util_pipe_shader_cap_name(param)); 190bf215546Sopenharmony_ci 191bf215546Sopenharmony_ci result = screen->get_shader_param(screen, shader, param); 192bf215546Sopenharmony_ci 193bf215546Sopenharmony_ci trace_dump_ret(int, result); 194bf215546Sopenharmony_ci 195bf215546Sopenharmony_ci trace_dump_call_end(); 196bf215546Sopenharmony_ci 197bf215546Sopenharmony_ci return result; 198bf215546Sopenharmony_ci} 199bf215546Sopenharmony_ci 200bf215546Sopenharmony_ci 201bf215546Sopenharmony_cistatic float 202bf215546Sopenharmony_citrace_screen_get_paramf(struct pipe_screen *_screen, 203bf215546Sopenharmony_ci enum pipe_capf param) 204bf215546Sopenharmony_ci{ 205bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 206bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 207bf215546Sopenharmony_ci float result; 208bf215546Sopenharmony_ci 209bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "get_paramf"); 210bf215546Sopenharmony_ci 211bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 212bf215546Sopenharmony_ci trace_dump_arg_enum(param, tr_util_pipe_capf_name(param)); 213bf215546Sopenharmony_ci 214bf215546Sopenharmony_ci result = screen->get_paramf(screen, param); 215bf215546Sopenharmony_ci 216bf215546Sopenharmony_ci trace_dump_ret(float, result); 217bf215546Sopenharmony_ci 218bf215546Sopenharmony_ci trace_dump_call_end(); 219bf215546Sopenharmony_ci 220bf215546Sopenharmony_ci return result; 221bf215546Sopenharmony_ci} 222bf215546Sopenharmony_ci 223bf215546Sopenharmony_ci 224bf215546Sopenharmony_cistatic int 225bf215546Sopenharmony_citrace_screen_get_compute_param(struct pipe_screen *_screen, 226bf215546Sopenharmony_ci enum pipe_shader_ir ir_type, 227bf215546Sopenharmony_ci enum pipe_compute_cap param, 228bf215546Sopenharmony_ci void *data) 229bf215546Sopenharmony_ci{ 230bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 231bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 232bf215546Sopenharmony_ci int result; 233bf215546Sopenharmony_ci 234bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "get_compute_param"); 235bf215546Sopenharmony_ci 236bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 237bf215546Sopenharmony_ci trace_dump_arg_enum(ir_type, tr_util_pipe_shader_ir_name(ir_type)); 238bf215546Sopenharmony_ci trace_dump_arg_enum(param, tr_util_pipe_compute_cap_name(param)); 239bf215546Sopenharmony_ci trace_dump_arg(ptr, data); 240bf215546Sopenharmony_ci 241bf215546Sopenharmony_ci result = screen->get_compute_param(screen, ir_type, param, data); 242bf215546Sopenharmony_ci 243bf215546Sopenharmony_ci trace_dump_ret(int, result); 244bf215546Sopenharmony_ci 245bf215546Sopenharmony_ci trace_dump_call_end(); 246bf215546Sopenharmony_ci 247bf215546Sopenharmony_ci return result; 248bf215546Sopenharmony_ci} 249bf215546Sopenharmony_ci 250bf215546Sopenharmony_ci 251bf215546Sopenharmony_cistatic bool 252bf215546Sopenharmony_citrace_screen_is_format_supported(struct pipe_screen *_screen, 253bf215546Sopenharmony_ci enum pipe_format format, 254bf215546Sopenharmony_ci enum pipe_texture_target target, 255bf215546Sopenharmony_ci unsigned sample_count, 256bf215546Sopenharmony_ci unsigned storage_sample_count, 257bf215546Sopenharmony_ci unsigned tex_usage) 258bf215546Sopenharmony_ci{ 259bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 260bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 261bf215546Sopenharmony_ci bool result; 262bf215546Sopenharmony_ci 263bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "is_format_supported"); 264bf215546Sopenharmony_ci 265bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 266bf215546Sopenharmony_ci trace_dump_arg(format, format); 267bf215546Sopenharmony_ci trace_dump_arg_enum(target, tr_util_pipe_texture_target_name(target)); 268bf215546Sopenharmony_ci trace_dump_arg(uint, sample_count); 269bf215546Sopenharmony_ci trace_dump_arg(uint, storage_sample_count); 270bf215546Sopenharmony_ci trace_dump_arg(uint, tex_usage); 271bf215546Sopenharmony_ci 272bf215546Sopenharmony_ci result = screen->is_format_supported(screen, format, target, sample_count, 273bf215546Sopenharmony_ci storage_sample_count, tex_usage); 274bf215546Sopenharmony_ci 275bf215546Sopenharmony_ci trace_dump_ret(bool, result); 276bf215546Sopenharmony_ci 277bf215546Sopenharmony_ci trace_dump_call_end(); 278bf215546Sopenharmony_ci 279bf215546Sopenharmony_ci return result; 280bf215546Sopenharmony_ci} 281bf215546Sopenharmony_ci 282bf215546Sopenharmony_cistatic void 283bf215546Sopenharmony_citrace_context_replace_buffer_storage(struct pipe_context *_pipe, 284bf215546Sopenharmony_ci struct pipe_resource *dst, 285bf215546Sopenharmony_ci struct pipe_resource *src, 286bf215546Sopenharmony_ci unsigned num_rebinds, 287bf215546Sopenharmony_ci uint32_t rebind_mask, 288bf215546Sopenharmony_ci unsigned delete_buffer_id) 289bf215546Sopenharmony_ci{ 290bf215546Sopenharmony_ci struct trace_context *tr_ctx = trace_context(_pipe); 291bf215546Sopenharmony_ci struct pipe_context *pipe = tr_ctx->pipe; 292bf215546Sopenharmony_ci 293bf215546Sopenharmony_ci trace_dump_call_begin("pipe_context", "replace_buffer_storage"); 294bf215546Sopenharmony_ci 295bf215546Sopenharmony_ci trace_dump_arg(ptr, pipe); 296bf215546Sopenharmony_ci trace_dump_arg(ptr, dst); 297bf215546Sopenharmony_ci trace_dump_arg(ptr, src); 298bf215546Sopenharmony_ci trace_dump_arg(uint, num_rebinds); 299bf215546Sopenharmony_ci trace_dump_arg(uint, rebind_mask); 300bf215546Sopenharmony_ci trace_dump_arg(uint, delete_buffer_id); 301bf215546Sopenharmony_ci trace_dump_call_end(); 302bf215546Sopenharmony_ci 303bf215546Sopenharmony_ci tr_ctx->replace_buffer_storage(pipe, dst, src, num_rebinds, rebind_mask, delete_buffer_id); 304bf215546Sopenharmony_ci} 305bf215546Sopenharmony_ci 306bf215546Sopenharmony_cistatic struct pipe_fence_handle * 307bf215546Sopenharmony_citrace_context_create_fence(struct pipe_context *_pipe, struct tc_unflushed_batch_token *token) 308bf215546Sopenharmony_ci{ 309bf215546Sopenharmony_ci struct trace_context *tr_ctx = trace_context(_pipe); 310bf215546Sopenharmony_ci struct pipe_context *pipe = tr_ctx->pipe; 311bf215546Sopenharmony_ci 312bf215546Sopenharmony_ci trace_dump_call_begin("pipe_context", "create_fence"); 313bf215546Sopenharmony_ci 314bf215546Sopenharmony_ci trace_dump_arg(ptr, pipe); 315bf215546Sopenharmony_ci trace_dump_arg(ptr, token); 316bf215546Sopenharmony_ci 317bf215546Sopenharmony_ci struct pipe_fence_handle *ret = tr_ctx->create_fence(pipe, token); 318bf215546Sopenharmony_ci trace_dump_ret(ptr, ret); 319bf215546Sopenharmony_ci trace_dump_call_end(); 320bf215546Sopenharmony_ci 321bf215546Sopenharmony_ci return ret; 322bf215546Sopenharmony_ci} 323bf215546Sopenharmony_ci 324bf215546Sopenharmony_cistatic bool 325bf215546Sopenharmony_citrace_context_is_resource_busy(struct pipe_screen *_screen, 326bf215546Sopenharmony_ci struct pipe_resource *resource, 327bf215546Sopenharmony_ci unsigned usage) 328bf215546Sopenharmony_ci{ 329bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 330bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 331bf215546Sopenharmony_ci bool result; 332bf215546Sopenharmony_ci 333bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "is_resource_busy"); 334bf215546Sopenharmony_ci 335bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 336bf215546Sopenharmony_ci trace_dump_arg(ptr, resource); 337bf215546Sopenharmony_ci trace_dump_arg(uint, usage); 338bf215546Sopenharmony_ci 339bf215546Sopenharmony_ci result = tr_scr->is_resource_busy(screen, resource, usage); 340bf215546Sopenharmony_ci 341bf215546Sopenharmony_ci trace_dump_ret(bool, result); 342bf215546Sopenharmony_ci 343bf215546Sopenharmony_ci trace_dump_call_end(); 344bf215546Sopenharmony_ci 345bf215546Sopenharmony_ci return result; 346bf215546Sopenharmony_ci} 347bf215546Sopenharmony_ci 348bf215546Sopenharmony_cistruct pipe_context * 349bf215546Sopenharmony_citrace_context_create_threaded(struct pipe_screen *screen, struct pipe_context *pipe, 350bf215546Sopenharmony_ci tc_replace_buffer_storage_func *replace_buffer, 351bf215546Sopenharmony_ci struct threaded_context_options *options) 352bf215546Sopenharmony_ci{ 353bf215546Sopenharmony_ci if (!trace_screens) 354bf215546Sopenharmony_ci return pipe; 355bf215546Sopenharmony_ci 356bf215546Sopenharmony_ci struct hash_entry *he = _mesa_hash_table_search(trace_screens, screen); 357bf215546Sopenharmony_ci if (!he) 358bf215546Sopenharmony_ci return pipe; 359bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(he->data); 360bf215546Sopenharmony_ci 361bf215546Sopenharmony_ci if (tr_scr->trace_tc) 362bf215546Sopenharmony_ci return pipe; 363bf215546Sopenharmony_ci 364bf215546Sopenharmony_ci struct pipe_context *ctx = trace_context_create(tr_scr, pipe); 365bf215546Sopenharmony_ci if (!ctx) 366bf215546Sopenharmony_ci return pipe; 367bf215546Sopenharmony_ci 368bf215546Sopenharmony_ci struct trace_context *tr_ctx = trace_context(ctx); 369bf215546Sopenharmony_ci tr_ctx->replace_buffer_storage = *replace_buffer; 370bf215546Sopenharmony_ci tr_ctx->create_fence = options->create_fence; 371bf215546Sopenharmony_ci tr_scr->is_resource_busy = options->is_resource_busy; 372bf215546Sopenharmony_ci tr_ctx->threaded = true; 373bf215546Sopenharmony_ci *replace_buffer = trace_context_replace_buffer_storage; 374bf215546Sopenharmony_ci if (options->create_fence) 375bf215546Sopenharmony_ci options->create_fence = trace_context_create_fence; 376bf215546Sopenharmony_ci if (options->is_resource_busy) 377bf215546Sopenharmony_ci options->is_resource_busy = trace_context_is_resource_busy; 378bf215546Sopenharmony_ci return ctx; 379bf215546Sopenharmony_ci} 380bf215546Sopenharmony_ci 381bf215546Sopenharmony_cistatic struct pipe_context * 382bf215546Sopenharmony_citrace_screen_context_create(struct pipe_screen *_screen, void *priv, 383bf215546Sopenharmony_ci unsigned flags) 384bf215546Sopenharmony_ci{ 385bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 386bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 387bf215546Sopenharmony_ci struct pipe_context *result; 388bf215546Sopenharmony_ci 389bf215546Sopenharmony_ci result = screen->context_create(screen, priv, flags); 390bf215546Sopenharmony_ci 391bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "context_create"); 392bf215546Sopenharmony_ci 393bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 394bf215546Sopenharmony_ci trace_dump_arg(ptr, priv); 395bf215546Sopenharmony_ci trace_dump_arg(uint, flags); 396bf215546Sopenharmony_ci 397bf215546Sopenharmony_ci trace_dump_ret(ptr, result); 398bf215546Sopenharmony_ci 399bf215546Sopenharmony_ci trace_dump_call_end(); 400bf215546Sopenharmony_ci 401bf215546Sopenharmony_ci if (result && (tr_scr->trace_tc || result->draw_vbo != tc_draw_vbo)) 402bf215546Sopenharmony_ci result = trace_context_create(tr_scr, result); 403bf215546Sopenharmony_ci 404bf215546Sopenharmony_ci return result; 405bf215546Sopenharmony_ci} 406bf215546Sopenharmony_ci 407bf215546Sopenharmony_ci 408bf215546Sopenharmony_cistatic void 409bf215546Sopenharmony_citrace_screen_flush_frontbuffer(struct pipe_screen *_screen, 410bf215546Sopenharmony_ci struct pipe_context *_pipe, 411bf215546Sopenharmony_ci struct pipe_resource *resource, 412bf215546Sopenharmony_ci unsigned level, unsigned layer, 413bf215546Sopenharmony_ci void *context_private, 414bf215546Sopenharmony_ci struct pipe_box *sub_box) 415bf215546Sopenharmony_ci{ 416bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 417bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 418bf215546Sopenharmony_ci struct pipe_context *pipe = _pipe ? trace_get_possibly_threaded_context(_pipe) : NULL; 419bf215546Sopenharmony_ci 420bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "flush_frontbuffer"); 421bf215546Sopenharmony_ci 422bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 423bf215546Sopenharmony_ci trace_dump_arg(ptr, resource); 424bf215546Sopenharmony_ci trace_dump_arg(uint, level); 425bf215546Sopenharmony_ci trace_dump_arg(uint, layer); 426bf215546Sopenharmony_ci /* XXX: hide, as there is nothing we can do with this 427bf215546Sopenharmony_ci trace_dump_arg(ptr, context_private); 428bf215546Sopenharmony_ci */ 429bf215546Sopenharmony_ci 430bf215546Sopenharmony_ci trace_dump_call_end(); 431bf215546Sopenharmony_ci 432bf215546Sopenharmony_ci screen->flush_frontbuffer(screen, pipe, resource, level, layer, context_private, sub_box); 433bf215546Sopenharmony_ci} 434bf215546Sopenharmony_ci 435bf215546Sopenharmony_ci 436bf215546Sopenharmony_cistatic void 437bf215546Sopenharmony_citrace_screen_get_driver_uuid(struct pipe_screen *_screen, char *uuid) 438bf215546Sopenharmony_ci{ 439bf215546Sopenharmony_ci struct pipe_screen *screen = trace_screen(_screen)->screen; 440bf215546Sopenharmony_ci 441bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "get_driver_uuid"); 442bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 443bf215546Sopenharmony_ci 444bf215546Sopenharmony_ci screen->get_driver_uuid(screen, uuid); 445bf215546Sopenharmony_ci 446bf215546Sopenharmony_ci trace_dump_ret(string, uuid); 447bf215546Sopenharmony_ci trace_dump_call_end(); 448bf215546Sopenharmony_ci} 449bf215546Sopenharmony_ci 450bf215546Sopenharmony_cistatic void 451bf215546Sopenharmony_citrace_screen_get_device_uuid(struct pipe_screen *_screen, char *uuid) 452bf215546Sopenharmony_ci{ 453bf215546Sopenharmony_ci struct pipe_screen *screen = trace_screen(_screen)->screen; 454bf215546Sopenharmony_ci 455bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "get_device_uuid"); 456bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 457bf215546Sopenharmony_ci 458bf215546Sopenharmony_ci screen->get_device_uuid(screen, uuid); 459bf215546Sopenharmony_ci 460bf215546Sopenharmony_ci trace_dump_ret(string, uuid); 461bf215546Sopenharmony_ci trace_dump_call_end(); 462bf215546Sopenharmony_ci} 463bf215546Sopenharmony_ci 464bf215546Sopenharmony_cistatic void 465bf215546Sopenharmony_citrace_screen_get_device_luid(struct pipe_screen *_screen, char *luid) 466bf215546Sopenharmony_ci{ 467bf215546Sopenharmony_ci struct pipe_screen *screen = trace_screen(_screen)->screen; 468bf215546Sopenharmony_ci 469bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "get_device_luid"); 470bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 471bf215546Sopenharmony_ci 472bf215546Sopenharmony_ci screen->get_device_luid(screen, luid); 473bf215546Sopenharmony_ci 474bf215546Sopenharmony_ci trace_dump_ret(string, luid); 475bf215546Sopenharmony_ci trace_dump_call_end(); 476bf215546Sopenharmony_ci} 477bf215546Sopenharmony_ci 478bf215546Sopenharmony_cistatic uint32_t 479bf215546Sopenharmony_citrace_screen_get_device_node_mask(struct pipe_screen *_screen) 480bf215546Sopenharmony_ci{ 481bf215546Sopenharmony_ci struct pipe_screen *screen = trace_screen(_screen)->screen; 482bf215546Sopenharmony_ci uint32_t result; 483bf215546Sopenharmony_ci 484bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "get_device_node_mask"); 485bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 486bf215546Sopenharmony_ci 487bf215546Sopenharmony_ci result = screen->get_device_node_mask(screen); 488bf215546Sopenharmony_ci 489bf215546Sopenharmony_ci trace_dump_ret(uint, result); 490bf215546Sopenharmony_ci trace_dump_call_end(); 491bf215546Sopenharmony_ci 492bf215546Sopenharmony_ci return result; 493bf215546Sopenharmony_ci} 494bf215546Sopenharmony_ci 495bf215546Sopenharmony_ci 496bf215546Sopenharmony_ci/******************************************************************** 497bf215546Sopenharmony_ci * texture 498bf215546Sopenharmony_ci */ 499bf215546Sopenharmony_ci 500bf215546Sopenharmony_cistatic void * 501bf215546Sopenharmony_citrace_screen_map_memory(struct pipe_screen *_screen, 502bf215546Sopenharmony_ci struct pipe_memory_allocation *pmem) 503bf215546Sopenharmony_ci{ 504bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 505bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 506bf215546Sopenharmony_ci void *result; 507bf215546Sopenharmony_ci 508bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "map_memory"); 509bf215546Sopenharmony_ci 510bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 511bf215546Sopenharmony_ci trace_dump_arg(ptr, pmem); 512bf215546Sopenharmony_ci 513bf215546Sopenharmony_ci result = screen->map_memory(screen, pmem); 514bf215546Sopenharmony_ci 515bf215546Sopenharmony_ci trace_dump_ret(ptr, result); 516bf215546Sopenharmony_ci 517bf215546Sopenharmony_ci trace_dump_call_end(); 518bf215546Sopenharmony_ci 519bf215546Sopenharmony_ci return result; 520bf215546Sopenharmony_ci} 521bf215546Sopenharmony_ci 522bf215546Sopenharmony_cistatic void 523bf215546Sopenharmony_citrace_screen_unmap_memory(struct pipe_screen *_screen, 524bf215546Sopenharmony_ci struct pipe_memory_allocation *pmem) 525bf215546Sopenharmony_ci{ 526bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 527bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 528bf215546Sopenharmony_ci 529bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "unmap_memory"); 530bf215546Sopenharmony_ci 531bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 532bf215546Sopenharmony_ci trace_dump_arg(ptr, pmem); 533bf215546Sopenharmony_ci 534bf215546Sopenharmony_ci screen->unmap_memory(screen, pmem); 535bf215546Sopenharmony_ci 536bf215546Sopenharmony_ci 537bf215546Sopenharmony_ci trace_dump_call_end(); 538bf215546Sopenharmony_ci} 539bf215546Sopenharmony_ci 540bf215546Sopenharmony_cistatic struct pipe_memory_allocation * 541bf215546Sopenharmony_citrace_screen_allocate_memory(struct pipe_screen *_screen, 542bf215546Sopenharmony_ci uint64_t size) 543bf215546Sopenharmony_ci{ 544bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 545bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 546bf215546Sopenharmony_ci struct pipe_memory_allocation *result; 547bf215546Sopenharmony_ci 548bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "allocate_memory"); 549bf215546Sopenharmony_ci 550bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 551bf215546Sopenharmony_ci trace_dump_arg(uint, size); 552bf215546Sopenharmony_ci 553bf215546Sopenharmony_ci result = screen->allocate_memory(screen, size); 554bf215546Sopenharmony_ci 555bf215546Sopenharmony_ci trace_dump_ret(ptr, result); 556bf215546Sopenharmony_ci 557bf215546Sopenharmony_ci trace_dump_call_end(); 558bf215546Sopenharmony_ci 559bf215546Sopenharmony_ci return result; 560bf215546Sopenharmony_ci} 561bf215546Sopenharmony_ci 562bf215546Sopenharmony_cistatic struct pipe_memory_allocation * 563bf215546Sopenharmony_citrace_screen_allocate_memory_fd(struct pipe_screen *_screen, 564bf215546Sopenharmony_ci uint64_t size, 565bf215546Sopenharmony_ci int *fd) 566bf215546Sopenharmony_ci{ 567bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 568bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 569bf215546Sopenharmony_ci struct pipe_memory_allocation *result; 570bf215546Sopenharmony_ci 571bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "allocate_memory_fd"); 572bf215546Sopenharmony_ci 573bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 574bf215546Sopenharmony_ci trace_dump_arg(uint, size); 575bf215546Sopenharmony_ci trace_dump_arg(ptr, fd); 576bf215546Sopenharmony_ci 577bf215546Sopenharmony_ci result = screen->allocate_memory_fd(screen, size, fd); 578bf215546Sopenharmony_ci 579bf215546Sopenharmony_ci trace_dump_ret(ptr, result); 580bf215546Sopenharmony_ci 581bf215546Sopenharmony_ci trace_dump_call_end(); 582bf215546Sopenharmony_ci 583bf215546Sopenharmony_ci return result; 584bf215546Sopenharmony_ci} 585bf215546Sopenharmony_ci 586bf215546Sopenharmony_cistatic void 587bf215546Sopenharmony_citrace_screen_free_memory(struct pipe_screen *_screen, 588bf215546Sopenharmony_ci struct pipe_memory_allocation *pmem) 589bf215546Sopenharmony_ci{ 590bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 591bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 592bf215546Sopenharmony_ci 593bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "free_memory"); 594bf215546Sopenharmony_ci 595bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 596bf215546Sopenharmony_ci trace_dump_arg(ptr, pmem); 597bf215546Sopenharmony_ci 598bf215546Sopenharmony_ci screen->free_memory(screen, pmem); 599bf215546Sopenharmony_ci 600bf215546Sopenharmony_ci 601bf215546Sopenharmony_ci trace_dump_call_end(); 602bf215546Sopenharmony_ci} 603bf215546Sopenharmony_ci 604bf215546Sopenharmony_cistatic void 605bf215546Sopenharmony_citrace_screen_free_memory_fd(struct pipe_screen *_screen, 606bf215546Sopenharmony_ci struct pipe_memory_allocation *pmem) 607bf215546Sopenharmony_ci{ 608bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 609bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 610bf215546Sopenharmony_ci 611bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "free_memory_fd"); 612bf215546Sopenharmony_ci 613bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 614bf215546Sopenharmony_ci trace_dump_arg(ptr, pmem); 615bf215546Sopenharmony_ci 616bf215546Sopenharmony_ci screen->free_memory_fd(screen, pmem); 617bf215546Sopenharmony_ci 618bf215546Sopenharmony_ci 619bf215546Sopenharmony_ci trace_dump_call_end(); 620bf215546Sopenharmony_ci} 621bf215546Sopenharmony_ci 622bf215546Sopenharmony_cistatic bool 623bf215546Sopenharmony_citrace_screen_resource_bind_backing(struct pipe_screen *_screen, 624bf215546Sopenharmony_ci struct pipe_resource *resource, 625bf215546Sopenharmony_ci struct pipe_memory_allocation *pmem, 626bf215546Sopenharmony_ci uint64_t offset) 627bf215546Sopenharmony_ci{ 628bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 629bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 630bf215546Sopenharmony_ci bool result; 631bf215546Sopenharmony_ci 632bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "resource_bind_backing"); 633bf215546Sopenharmony_ci 634bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 635bf215546Sopenharmony_ci trace_dump_arg(ptr, resource); 636bf215546Sopenharmony_ci trace_dump_arg(ptr, pmem); 637bf215546Sopenharmony_ci trace_dump_arg(uint, offset); 638bf215546Sopenharmony_ci 639bf215546Sopenharmony_ci result = screen->resource_bind_backing(screen, resource, pmem, offset); 640bf215546Sopenharmony_ci 641bf215546Sopenharmony_ci trace_dump_ret(bool, result); 642bf215546Sopenharmony_ci 643bf215546Sopenharmony_ci trace_dump_call_end(); 644bf215546Sopenharmony_ci 645bf215546Sopenharmony_ci return result; 646bf215546Sopenharmony_ci} 647bf215546Sopenharmony_ci 648bf215546Sopenharmony_cistatic struct pipe_resource * 649bf215546Sopenharmony_citrace_screen_resource_create_unbacked(struct pipe_screen *_screen, 650bf215546Sopenharmony_ci const struct pipe_resource *templat, 651bf215546Sopenharmony_ci uint64_t *size_required) 652bf215546Sopenharmony_ci{ 653bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 654bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 655bf215546Sopenharmony_ci struct pipe_resource *result; 656bf215546Sopenharmony_ci 657bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "resource_create_unbacked"); 658bf215546Sopenharmony_ci 659bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 660bf215546Sopenharmony_ci trace_dump_arg(resource_template, templat); 661bf215546Sopenharmony_ci 662bf215546Sopenharmony_ci result = screen->resource_create_unbacked(screen, templat, size_required); 663bf215546Sopenharmony_ci 664bf215546Sopenharmony_ci trace_dump_ret_begin(); 665bf215546Sopenharmony_ci trace_dump_uint(*size_required); 666bf215546Sopenharmony_ci trace_dump_ret_end(); 667bf215546Sopenharmony_ci trace_dump_ret(ptr, result); 668bf215546Sopenharmony_ci 669bf215546Sopenharmony_ci trace_dump_call_end(); 670bf215546Sopenharmony_ci 671bf215546Sopenharmony_ci if (result) 672bf215546Sopenharmony_ci result->screen = _screen; 673bf215546Sopenharmony_ci return result; 674bf215546Sopenharmony_ci} 675bf215546Sopenharmony_ci 676bf215546Sopenharmony_cistatic struct pipe_resource * 677bf215546Sopenharmony_citrace_screen_resource_create(struct pipe_screen *_screen, 678bf215546Sopenharmony_ci const struct pipe_resource *templat) 679bf215546Sopenharmony_ci{ 680bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 681bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 682bf215546Sopenharmony_ci struct pipe_resource *result; 683bf215546Sopenharmony_ci 684bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "resource_create"); 685bf215546Sopenharmony_ci 686bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 687bf215546Sopenharmony_ci trace_dump_arg(resource_template, templat); 688bf215546Sopenharmony_ci 689bf215546Sopenharmony_ci result = screen->resource_create(screen, templat); 690bf215546Sopenharmony_ci 691bf215546Sopenharmony_ci trace_dump_ret(ptr, result); 692bf215546Sopenharmony_ci 693bf215546Sopenharmony_ci trace_dump_call_end(); 694bf215546Sopenharmony_ci 695bf215546Sopenharmony_ci if (result) 696bf215546Sopenharmony_ci result->screen = _screen; 697bf215546Sopenharmony_ci return result; 698bf215546Sopenharmony_ci} 699bf215546Sopenharmony_ci 700bf215546Sopenharmony_cistatic struct pipe_resource * 701bf215546Sopenharmony_citrace_screen_resource_create_drawable(struct pipe_screen *_screen, 702bf215546Sopenharmony_ci const struct pipe_resource *templat, 703bf215546Sopenharmony_ci const void *loader_data) 704bf215546Sopenharmony_ci{ 705bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 706bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 707bf215546Sopenharmony_ci struct pipe_resource *result; 708bf215546Sopenharmony_ci 709bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "resource_create_drawable"); 710bf215546Sopenharmony_ci 711bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 712bf215546Sopenharmony_ci trace_dump_arg(resource_template, templat); 713bf215546Sopenharmony_ci trace_dump_arg(ptr, loader_data); 714bf215546Sopenharmony_ci 715bf215546Sopenharmony_ci result = screen->resource_create_drawable(screen, templat, loader_data); 716bf215546Sopenharmony_ci 717bf215546Sopenharmony_ci trace_dump_ret(ptr, result); 718bf215546Sopenharmony_ci 719bf215546Sopenharmony_ci trace_dump_call_end(); 720bf215546Sopenharmony_ci 721bf215546Sopenharmony_ci if (result) 722bf215546Sopenharmony_ci result->screen = _screen; 723bf215546Sopenharmony_ci return result; 724bf215546Sopenharmony_ci} 725bf215546Sopenharmony_ci 726bf215546Sopenharmony_cistatic struct pipe_resource * 727bf215546Sopenharmony_citrace_screen_resource_create_with_modifiers(struct pipe_screen *_screen, const struct pipe_resource *templat, 728bf215546Sopenharmony_ci const uint64_t *modifiers, int modifiers_count) 729bf215546Sopenharmony_ci{ 730bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 731bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 732bf215546Sopenharmony_ci struct pipe_resource *result; 733bf215546Sopenharmony_ci 734bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "resource_create_with_modifiers"); 735bf215546Sopenharmony_ci 736bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 737bf215546Sopenharmony_ci trace_dump_arg(resource_template, templat); 738bf215546Sopenharmony_ci trace_dump_arg_array(uint, modifiers, modifiers_count); 739bf215546Sopenharmony_ci 740bf215546Sopenharmony_ci result = screen->resource_create_with_modifiers(screen, templat, modifiers, modifiers_count); 741bf215546Sopenharmony_ci 742bf215546Sopenharmony_ci trace_dump_ret(ptr, result); 743bf215546Sopenharmony_ci 744bf215546Sopenharmony_ci trace_dump_call_end(); 745bf215546Sopenharmony_ci 746bf215546Sopenharmony_ci if (result) 747bf215546Sopenharmony_ci result->screen = _screen; 748bf215546Sopenharmony_ci return result; 749bf215546Sopenharmony_ci} 750bf215546Sopenharmony_ci 751bf215546Sopenharmony_cistatic struct pipe_resource * 752bf215546Sopenharmony_citrace_screen_resource_from_handle(struct pipe_screen *_screen, 753bf215546Sopenharmony_ci const struct pipe_resource *templ, 754bf215546Sopenharmony_ci struct winsys_handle *handle, 755bf215546Sopenharmony_ci unsigned usage) 756bf215546Sopenharmony_ci{ 757bf215546Sopenharmony_ci struct trace_screen *tr_screen = trace_screen(_screen); 758bf215546Sopenharmony_ci struct pipe_screen *screen = tr_screen->screen; 759bf215546Sopenharmony_ci struct pipe_resource *result; 760bf215546Sopenharmony_ci 761bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "resource_from_handle"); 762bf215546Sopenharmony_ci 763bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 764bf215546Sopenharmony_ci trace_dump_arg(resource_template, templ); 765bf215546Sopenharmony_ci trace_dump_arg(ptr, handle); 766bf215546Sopenharmony_ci trace_dump_arg(uint, usage); 767bf215546Sopenharmony_ci 768bf215546Sopenharmony_ci result = screen->resource_from_handle(screen, templ, handle, usage); 769bf215546Sopenharmony_ci 770bf215546Sopenharmony_ci trace_dump_ret(ptr, result); 771bf215546Sopenharmony_ci 772bf215546Sopenharmony_ci trace_dump_call_end(); 773bf215546Sopenharmony_ci 774bf215546Sopenharmony_ci if (result) 775bf215546Sopenharmony_ci result->screen = _screen; 776bf215546Sopenharmony_ci return result; 777bf215546Sopenharmony_ci} 778bf215546Sopenharmony_ci 779bf215546Sopenharmony_cistatic bool 780bf215546Sopenharmony_citrace_screen_check_resource_capability(struct pipe_screen *_screen, 781bf215546Sopenharmony_ci struct pipe_resource *resource, 782bf215546Sopenharmony_ci unsigned bind) 783bf215546Sopenharmony_ci{ 784bf215546Sopenharmony_ci struct pipe_screen *screen = trace_screen(_screen)->screen; 785bf215546Sopenharmony_ci 786bf215546Sopenharmony_ci return screen->check_resource_capability(screen, resource, bind); 787bf215546Sopenharmony_ci} 788bf215546Sopenharmony_ci 789bf215546Sopenharmony_cistatic bool 790bf215546Sopenharmony_citrace_screen_resource_get_handle(struct pipe_screen *_screen, 791bf215546Sopenharmony_ci struct pipe_context *_pipe, 792bf215546Sopenharmony_ci struct pipe_resource *resource, 793bf215546Sopenharmony_ci struct winsys_handle *handle, 794bf215546Sopenharmony_ci unsigned usage) 795bf215546Sopenharmony_ci{ 796bf215546Sopenharmony_ci struct trace_screen *tr_screen = trace_screen(_screen); 797bf215546Sopenharmony_ci struct pipe_context *pipe = _pipe ? trace_get_possibly_threaded_context(_pipe) : NULL; 798bf215546Sopenharmony_ci struct pipe_screen *screen = tr_screen->screen; 799bf215546Sopenharmony_ci bool result; 800bf215546Sopenharmony_ci 801bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "resource_get_handle"); 802bf215546Sopenharmony_ci 803bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 804bf215546Sopenharmony_ci trace_dump_arg(ptr, resource); 805bf215546Sopenharmony_ci trace_dump_arg(ptr, handle); 806bf215546Sopenharmony_ci trace_dump_arg(uint, usage); 807bf215546Sopenharmony_ci 808bf215546Sopenharmony_ci result = screen->resource_get_handle(screen, pipe, resource, handle, usage); 809bf215546Sopenharmony_ci 810bf215546Sopenharmony_ci trace_dump_ret(bool, result); 811bf215546Sopenharmony_ci 812bf215546Sopenharmony_ci trace_dump_call_end(); 813bf215546Sopenharmony_ci 814bf215546Sopenharmony_ci return result; 815bf215546Sopenharmony_ci} 816bf215546Sopenharmony_ci 817bf215546Sopenharmony_cistatic bool 818bf215546Sopenharmony_citrace_screen_resource_get_param(struct pipe_screen *_screen, 819bf215546Sopenharmony_ci struct pipe_context *_pipe, 820bf215546Sopenharmony_ci struct pipe_resource *resource, 821bf215546Sopenharmony_ci unsigned plane, 822bf215546Sopenharmony_ci unsigned layer, 823bf215546Sopenharmony_ci unsigned level, 824bf215546Sopenharmony_ci enum pipe_resource_param param, 825bf215546Sopenharmony_ci unsigned handle_usage, 826bf215546Sopenharmony_ci uint64_t *value) 827bf215546Sopenharmony_ci{ 828bf215546Sopenharmony_ci struct trace_screen *tr_screen = trace_screen(_screen); 829bf215546Sopenharmony_ci struct pipe_context *pipe = _pipe ? trace_get_possibly_threaded_context(_pipe) : NULL; 830bf215546Sopenharmony_ci struct pipe_screen *screen = tr_screen->screen; 831bf215546Sopenharmony_ci bool result; 832bf215546Sopenharmony_ci 833bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "resource_get_param"); 834bf215546Sopenharmony_ci 835bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 836bf215546Sopenharmony_ci trace_dump_arg(ptr, resource); 837bf215546Sopenharmony_ci trace_dump_arg(uint, plane); 838bf215546Sopenharmony_ci trace_dump_arg(uint, layer); 839bf215546Sopenharmony_ci trace_dump_arg(uint, level); 840bf215546Sopenharmony_ci trace_dump_arg_enum(param, tr_util_pipe_resource_param_name(param)); 841bf215546Sopenharmony_ci trace_dump_arg(uint, handle_usage); 842bf215546Sopenharmony_ci 843bf215546Sopenharmony_ci result = screen->resource_get_param(screen, pipe, 844bf215546Sopenharmony_ci resource, plane, layer, level, param, 845bf215546Sopenharmony_ci handle_usage, value); 846bf215546Sopenharmony_ci 847bf215546Sopenharmony_ci trace_dump_arg(uint, *value); 848bf215546Sopenharmony_ci trace_dump_ret(bool, result); 849bf215546Sopenharmony_ci 850bf215546Sopenharmony_ci trace_dump_call_end(); 851bf215546Sopenharmony_ci 852bf215546Sopenharmony_ci return result; 853bf215546Sopenharmony_ci} 854bf215546Sopenharmony_ci 855bf215546Sopenharmony_cistatic void 856bf215546Sopenharmony_citrace_screen_resource_get_info(struct pipe_screen *_screen, 857bf215546Sopenharmony_ci struct pipe_resource *resource, 858bf215546Sopenharmony_ci unsigned *stride, 859bf215546Sopenharmony_ci unsigned *offset) 860bf215546Sopenharmony_ci{ 861bf215546Sopenharmony_ci struct trace_screen *tr_screen = trace_screen(_screen); 862bf215546Sopenharmony_ci struct pipe_screen *screen = tr_screen->screen; 863bf215546Sopenharmony_ci 864bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "resource_get_info"); 865bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 866bf215546Sopenharmony_ci trace_dump_arg(ptr, resource); 867bf215546Sopenharmony_ci 868bf215546Sopenharmony_ci screen->resource_get_info(screen, resource, stride, offset); 869bf215546Sopenharmony_ci 870bf215546Sopenharmony_ci trace_dump_arg(uint, *stride); 871bf215546Sopenharmony_ci trace_dump_arg(uint, *offset); 872bf215546Sopenharmony_ci 873bf215546Sopenharmony_ci trace_dump_call_end(); 874bf215546Sopenharmony_ci} 875bf215546Sopenharmony_ci 876bf215546Sopenharmony_cistatic struct pipe_resource * 877bf215546Sopenharmony_citrace_screen_resource_from_memobj(struct pipe_screen *_screen, 878bf215546Sopenharmony_ci const struct pipe_resource *templ, 879bf215546Sopenharmony_ci struct pipe_memory_object *memobj, 880bf215546Sopenharmony_ci uint64_t offset) 881bf215546Sopenharmony_ci{ 882bf215546Sopenharmony_ci struct pipe_screen *screen = trace_screen(_screen)->screen; 883bf215546Sopenharmony_ci 884bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "resource_from_memobj"); 885bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 886bf215546Sopenharmony_ci trace_dump_arg(resource_template, templ); 887bf215546Sopenharmony_ci trace_dump_arg(ptr, memobj); 888bf215546Sopenharmony_ci trace_dump_arg(uint, offset); 889bf215546Sopenharmony_ci 890bf215546Sopenharmony_ci struct pipe_resource *res = 891bf215546Sopenharmony_ci screen->resource_from_memobj(screen, templ, memobj, offset); 892bf215546Sopenharmony_ci 893bf215546Sopenharmony_ci if (!res) 894bf215546Sopenharmony_ci return NULL; 895bf215546Sopenharmony_ci res->screen = _screen; 896bf215546Sopenharmony_ci 897bf215546Sopenharmony_ci trace_dump_ret(ptr, res); 898bf215546Sopenharmony_ci trace_dump_call_end(); 899bf215546Sopenharmony_ci return res; 900bf215546Sopenharmony_ci} 901bf215546Sopenharmony_ci 902bf215546Sopenharmony_cistatic void 903bf215546Sopenharmony_citrace_screen_resource_changed(struct pipe_screen *_screen, 904bf215546Sopenharmony_ci struct pipe_resource *resource) 905bf215546Sopenharmony_ci{ 906bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 907bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 908bf215546Sopenharmony_ci 909bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "resource_changed"); 910bf215546Sopenharmony_ci 911bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 912bf215546Sopenharmony_ci trace_dump_arg(ptr, resource); 913bf215546Sopenharmony_ci 914bf215546Sopenharmony_ci if (screen->resource_changed) 915bf215546Sopenharmony_ci screen->resource_changed(screen, resource); 916bf215546Sopenharmony_ci 917bf215546Sopenharmony_ci trace_dump_call_end(); 918bf215546Sopenharmony_ci} 919bf215546Sopenharmony_ci 920bf215546Sopenharmony_cistatic void 921bf215546Sopenharmony_citrace_screen_resource_destroy(struct pipe_screen *_screen, 922bf215546Sopenharmony_ci struct pipe_resource *resource) 923bf215546Sopenharmony_ci{ 924bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 925bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 926bf215546Sopenharmony_ci 927bf215546Sopenharmony_ci /* Don't trace this, because due to the lack of pipe_resource wrapping, 928bf215546Sopenharmony_ci * we can get this call from inside of driver calls, which would try 929bf215546Sopenharmony_ci * to lock an already-locked mutex. 930bf215546Sopenharmony_ci */ 931bf215546Sopenharmony_ci screen->resource_destroy(screen, resource); 932bf215546Sopenharmony_ci} 933bf215546Sopenharmony_ci 934bf215546Sopenharmony_ci 935bf215546Sopenharmony_ci/******************************************************************** 936bf215546Sopenharmony_ci * fence 937bf215546Sopenharmony_ci */ 938bf215546Sopenharmony_ci 939bf215546Sopenharmony_ci 940bf215546Sopenharmony_cistatic void 941bf215546Sopenharmony_citrace_screen_fence_reference(struct pipe_screen *_screen, 942bf215546Sopenharmony_ci struct pipe_fence_handle **pdst, 943bf215546Sopenharmony_ci struct pipe_fence_handle *src) 944bf215546Sopenharmony_ci{ 945bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 946bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 947bf215546Sopenharmony_ci struct pipe_fence_handle *dst; 948bf215546Sopenharmony_ci 949bf215546Sopenharmony_ci assert(pdst); 950bf215546Sopenharmony_ci dst = *pdst; 951bf215546Sopenharmony_ci 952bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "fence_reference"); 953bf215546Sopenharmony_ci 954bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 955bf215546Sopenharmony_ci trace_dump_arg(ptr, dst); 956bf215546Sopenharmony_ci trace_dump_arg(ptr, src); 957bf215546Sopenharmony_ci 958bf215546Sopenharmony_ci screen->fence_reference(screen, pdst, src); 959bf215546Sopenharmony_ci 960bf215546Sopenharmony_ci trace_dump_call_end(); 961bf215546Sopenharmony_ci} 962bf215546Sopenharmony_ci 963bf215546Sopenharmony_ci 964bf215546Sopenharmony_cistatic int 965bf215546Sopenharmony_citrace_screen_fence_get_fd(struct pipe_screen *_screen, 966bf215546Sopenharmony_ci struct pipe_fence_handle *fence) 967bf215546Sopenharmony_ci{ 968bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 969bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 970bf215546Sopenharmony_ci int result; 971bf215546Sopenharmony_ci 972bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "fence_get_fd"); 973bf215546Sopenharmony_ci 974bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 975bf215546Sopenharmony_ci trace_dump_arg(ptr, fence); 976bf215546Sopenharmony_ci 977bf215546Sopenharmony_ci result = screen->fence_get_fd(screen, fence); 978bf215546Sopenharmony_ci 979bf215546Sopenharmony_ci trace_dump_ret(int, result); 980bf215546Sopenharmony_ci 981bf215546Sopenharmony_ci trace_dump_call_end(); 982bf215546Sopenharmony_ci 983bf215546Sopenharmony_ci return result; 984bf215546Sopenharmony_ci} 985bf215546Sopenharmony_ci 986bf215546Sopenharmony_cistatic void 987bf215546Sopenharmony_citrace_screen_create_fence_win32(struct pipe_screen *_screen, 988bf215546Sopenharmony_ci struct pipe_fence_handle **fence, 989bf215546Sopenharmony_ci void *handle, 990bf215546Sopenharmony_ci const void *name, 991bf215546Sopenharmony_ci enum pipe_fd_type type) 992bf215546Sopenharmony_ci{ 993bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 994bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 995bf215546Sopenharmony_ci 996bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "create_fence_win32"); 997bf215546Sopenharmony_ci 998bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 999bf215546Sopenharmony_ci if (fence) 1000bf215546Sopenharmony_ci trace_dump_arg(ptr, *fence); 1001bf215546Sopenharmony_ci trace_dump_arg(ptr, handle); 1002bf215546Sopenharmony_ci trace_dump_arg(ptr, name); 1003bf215546Sopenharmony_ci trace_dump_arg_enum(type, tr_util_pipe_fd_type_name(type)); 1004bf215546Sopenharmony_ci 1005bf215546Sopenharmony_ci trace_dump_call_end(); 1006bf215546Sopenharmony_ci 1007bf215546Sopenharmony_ci screen->create_fence_win32(screen, fence, handle, name, type); 1008bf215546Sopenharmony_ci} 1009bf215546Sopenharmony_ci 1010bf215546Sopenharmony_ci 1011bf215546Sopenharmony_cistatic bool 1012bf215546Sopenharmony_citrace_screen_fence_finish(struct pipe_screen *_screen, 1013bf215546Sopenharmony_ci struct pipe_context *_ctx, 1014bf215546Sopenharmony_ci struct pipe_fence_handle *fence, 1015bf215546Sopenharmony_ci uint64_t timeout) 1016bf215546Sopenharmony_ci{ 1017bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 1018bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 1019bf215546Sopenharmony_ci struct pipe_context *ctx = _ctx ? trace_get_possibly_threaded_context(_ctx) : NULL; 1020bf215546Sopenharmony_ci int result; 1021bf215546Sopenharmony_ci 1022bf215546Sopenharmony_ci result = screen->fence_finish(screen, ctx, fence, timeout); 1023bf215546Sopenharmony_ci 1024bf215546Sopenharmony_ci 1025bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "fence_finish"); 1026bf215546Sopenharmony_ci 1027bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 1028bf215546Sopenharmony_ci trace_dump_arg(ptr, ctx); 1029bf215546Sopenharmony_ci trace_dump_arg(ptr, fence); 1030bf215546Sopenharmony_ci trace_dump_arg(uint, timeout); 1031bf215546Sopenharmony_ci 1032bf215546Sopenharmony_ci trace_dump_ret(bool, result); 1033bf215546Sopenharmony_ci 1034bf215546Sopenharmony_ci trace_dump_call_end(); 1035bf215546Sopenharmony_ci 1036bf215546Sopenharmony_ci return result; 1037bf215546Sopenharmony_ci} 1038bf215546Sopenharmony_ci 1039bf215546Sopenharmony_ci 1040bf215546Sopenharmony_ci/******************************************************************** 1041bf215546Sopenharmony_ci * memobj 1042bf215546Sopenharmony_ci */ 1043bf215546Sopenharmony_ci 1044bf215546Sopenharmony_cistatic struct pipe_memory_object * 1045bf215546Sopenharmony_citrace_screen_memobj_create_from_handle(struct pipe_screen *_screen, 1046bf215546Sopenharmony_ci struct winsys_handle *handle, 1047bf215546Sopenharmony_ci bool dedicated) 1048bf215546Sopenharmony_ci{ 1049bf215546Sopenharmony_ci struct pipe_screen *screen = trace_screen(_screen)->screen; 1050bf215546Sopenharmony_ci 1051bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "memobj_create_from_handle"); 1052bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 1053bf215546Sopenharmony_ci trace_dump_arg(ptr, handle); 1054bf215546Sopenharmony_ci trace_dump_arg(bool, dedicated); 1055bf215546Sopenharmony_ci 1056bf215546Sopenharmony_ci struct pipe_memory_object *res = 1057bf215546Sopenharmony_ci screen->memobj_create_from_handle(screen, handle, dedicated); 1058bf215546Sopenharmony_ci 1059bf215546Sopenharmony_ci trace_dump_ret(ptr, res); 1060bf215546Sopenharmony_ci trace_dump_call_end(); 1061bf215546Sopenharmony_ci 1062bf215546Sopenharmony_ci return res; 1063bf215546Sopenharmony_ci} 1064bf215546Sopenharmony_ci 1065bf215546Sopenharmony_cistatic void 1066bf215546Sopenharmony_citrace_screen_memobj_destroy(struct pipe_screen *_screen, 1067bf215546Sopenharmony_ci struct pipe_memory_object *memobj) 1068bf215546Sopenharmony_ci{ 1069bf215546Sopenharmony_ci struct pipe_screen *screen = trace_screen(_screen)->screen; 1070bf215546Sopenharmony_ci 1071bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "memobj_destroy"); 1072bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 1073bf215546Sopenharmony_ci trace_dump_arg(ptr, memobj); 1074bf215546Sopenharmony_ci trace_dump_call_end(); 1075bf215546Sopenharmony_ci 1076bf215546Sopenharmony_ci screen->memobj_destroy(screen, memobj); 1077bf215546Sopenharmony_ci} 1078bf215546Sopenharmony_ci 1079bf215546Sopenharmony_ci 1080bf215546Sopenharmony_ci/******************************************************************** 1081bf215546Sopenharmony_ci * screen 1082bf215546Sopenharmony_ci */ 1083bf215546Sopenharmony_ci 1084bf215546Sopenharmony_cistatic uint64_t 1085bf215546Sopenharmony_citrace_screen_get_timestamp(struct pipe_screen *_screen) 1086bf215546Sopenharmony_ci{ 1087bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 1088bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 1089bf215546Sopenharmony_ci uint64_t result; 1090bf215546Sopenharmony_ci 1091bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "get_timestamp"); 1092bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 1093bf215546Sopenharmony_ci 1094bf215546Sopenharmony_ci result = screen->get_timestamp(screen); 1095bf215546Sopenharmony_ci 1096bf215546Sopenharmony_ci trace_dump_ret(uint, result); 1097bf215546Sopenharmony_ci trace_dump_call_end(); 1098bf215546Sopenharmony_ci 1099bf215546Sopenharmony_ci return result; 1100bf215546Sopenharmony_ci} 1101bf215546Sopenharmony_ci 1102bf215546Sopenharmony_cistatic char * 1103bf215546Sopenharmony_citrace_screen_finalize_nir(struct pipe_screen *_screen, void *nir) 1104bf215546Sopenharmony_ci{ 1105bf215546Sopenharmony_ci struct pipe_screen *screen = trace_screen(_screen)->screen; 1106bf215546Sopenharmony_ci 1107bf215546Sopenharmony_ci return screen->finalize_nir(screen, nir); 1108bf215546Sopenharmony_ci} 1109bf215546Sopenharmony_ci 1110bf215546Sopenharmony_cistatic void 1111bf215546Sopenharmony_citrace_screen_destroy(struct pipe_screen *_screen) 1112bf215546Sopenharmony_ci{ 1113bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 1114bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 1115bf215546Sopenharmony_ci 1116bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "destroy"); 1117bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 1118bf215546Sopenharmony_ci trace_dump_call_end(); 1119bf215546Sopenharmony_ci 1120bf215546Sopenharmony_ci if (trace_screens) { 1121bf215546Sopenharmony_ci struct hash_entry *he = _mesa_hash_table_search(trace_screens, screen); 1122bf215546Sopenharmony_ci if (he) { 1123bf215546Sopenharmony_ci _mesa_hash_table_remove(trace_screens, he); 1124bf215546Sopenharmony_ci if (!_mesa_hash_table_num_entries(trace_screens)) { 1125bf215546Sopenharmony_ci _mesa_hash_table_destroy(trace_screens, NULL); 1126bf215546Sopenharmony_ci trace_screens = NULL; 1127bf215546Sopenharmony_ci } 1128bf215546Sopenharmony_ci } 1129bf215546Sopenharmony_ci } 1130bf215546Sopenharmony_ci 1131bf215546Sopenharmony_ci screen->destroy(screen); 1132bf215546Sopenharmony_ci 1133bf215546Sopenharmony_ci FREE(tr_scr); 1134bf215546Sopenharmony_ci} 1135bf215546Sopenharmony_ci 1136bf215546Sopenharmony_cistatic void 1137bf215546Sopenharmony_citrace_screen_query_memory_info(struct pipe_screen *_screen, struct pipe_memory_info *info) 1138bf215546Sopenharmony_ci{ 1139bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 1140bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 1141bf215546Sopenharmony_ci 1142bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "query_memory_info"); 1143bf215546Sopenharmony_ci 1144bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 1145bf215546Sopenharmony_ci 1146bf215546Sopenharmony_ci screen->query_memory_info(screen, info); 1147bf215546Sopenharmony_ci 1148bf215546Sopenharmony_ci trace_dump_ret(memory_info, info); 1149bf215546Sopenharmony_ci 1150bf215546Sopenharmony_ci trace_dump_call_end(); 1151bf215546Sopenharmony_ci} 1152bf215546Sopenharmony_ci 1153bf215546Sopenharmony_cistatic void 1154bf215546Sopenharmony_citrace_screen_query_dmabuf_modifiers(struct pipe_screen *_screen, enum pipe_format format, int max, uint64_t *modifiers, unsigned int *external_only, int *count) 1155bf215546Sopenharmony_ci{ 1156bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 1157bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 1158bf215546Sopenharmony_ci 1159bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "query_dmabuf_modifiers"); 1160bf215546Sopenharmony_ci 1161bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 1162bf215546Sopenharmony_ci trace_dump_arg(format, format); 1163bf215546Sopenharmony_ci trace_dump_arg(int, max); 1164bf215546Sopenharmony_ci 1165bf215546Sopenharmony_ci screen->query_dmabuf_modifiers(screen, format, max, modifiers, external_only, count); 1166bf215546Sopenharmony_ci 1167bf215546Sopenharmony_ci if (max) 1168bf215546Sopenharmony_ci trace_dump_arg_array(uint, modifiers, *count); 1169bf215546Sopenharmony_ci else 1170bf215546Sopenharmony_ci trace_dump_arg_array(uint, modifiers, max); 1171bf215546Sopenharmony_ci trace_dump_arg_array(uint, external_only, max); 1172bf215546Sopenharmony_ci trace_dump_ret_begin(); 1173bf215546Sopenharmony_ci trace_dump_uint(*count); 1174bf215546Sopenharmony_ci trace_dump_ret_end(); 1175bf215546Sopenharmony_ci 1176bf215546Sopenharmony_ci trace_dump_call_end(); 1177bf215546Sopenharmony_ci} 1178bf215546Sopenharmony_ci 1179bf215546Sopenharmony_cistatic bool 1180bf215546Sopenharmony_citrace_screen_is_compute_copy_faster(struct pipe_screen *_screen, enum pipe_format src_format, 1181bf215546Sopenharmony_ci enum pipe_format dst_format, unsigned width, unsigned height, 1182bf215546Sopenharmony_ci unsigned depth, bool cpu) 1183bf215546Sopenharmony_ci{ 1184bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 1185bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 1186bf215546Sopenharmony_ci 1187bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "is_compute_copy_faster"); 1188bf215546Sopenharmony_ci 1189bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 1190bf215546Sopenharmony_ci trace_dump_arg(format, src_format); 1191bf215546Sopenharmony_ci trace_dump_arg(format, dst_format); 1192bf215546Sopenharmony_ci trace_dump_arg(uint, width); 1193bf215546Sopenharmony_ci trace_dump_arg(uint, height); 1194bf215546Sopenharmony_ci trace_dump_arg(uint, depth); 1195bf215546Sopenharmony_ci trace_dump_arg(bool, cpu); 1196bf215546Sopenharmony_ci 1197bf215546Sopenharmony_ci bool ret = screen->is_compute_copy_faster(screen, src_format, dst_format, width, height, depth, cpu); 1198bf215546Sopenharmony_ci 1199bf215546Sopenharmony_ci trace_dump_ret(bool, ret); 1200bf215546Sopenharmony_ci 1201bf215546Sopenharmony_ci trace_dump_call_end(); 1202bf215546Sopenharmony_ci return ret; 1203bf215546Sopenharmony_ci} 1204bf215546Sopenharmony_ci 1205bf215546Sopenharmony_cistatic bool 1206bf215546Sopenharmony_citrace_screen_is_dmabuf_modifier_supported(struct pipe_screen *_screen, uint64_t modifier, enum pipe_format format, bool *external_only) 1207bf215546Sopenharmony_ci{ 1208bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 1209bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 1210bf215546Sopenharmony_ci 1211bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "is_dmabuf_modifier_supported"); 1212bf215546Sopenharmony_ci 1213bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 1214bf215546Sopenharmony_ci trace_dump_arg(uint, modifier); 1215bf215546Sopenharmony_ci trace_dump_arg(format, format); 1216bf215546Sopenharmony_ci 1217bf215546Sopenharmony_ci bool ret = screen->is_dmabuf_modifier_supported(screen, modifier, format, external_only); 1218bf215546Sopenharmony_ci 1219bf215546Sopenharmony_ci trace_dump_arg_begin("external_only"); 1220bf215546Sopenharmony_ci trace_dump_bool(external_only ? *external_only : false); 1221bf215546Sopenharmony_ci trace_dump_arg_end(); 1222bf215546Sopenharmony_ci 1223bf215546Sopenharmony_ci trace_dump_ret(bool, ret); 1224bf215546Sopenharmony_ci 1225bf215546Sopenharmony_ci trace_dump_call_end(); 1226bf215546Sopenharmony_ci return ret; 1227bf215546Sopenharmony_ci} 1228bf215546Sopenharmony_ci 1229bf215546Sopenharmony_cistatic unsigned int 1230bf215546Sopenharmony_citrace_screen_get_dmabuf_modifier_planes(struct pipe_screen *_screen, uint64_t modifier, enum pipe_format format) 1231bf215546Sopenharmony_ci{ 1232bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 1233bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 1234bf215546Sopenharmony_ci 1235bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "get_dmabuf_modifier_planes"); 1236bf215546Sopenharmony_ci 1237bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 1238bf215546Sopenharmony_ci trace_dump_arg(uint, modifier); 1239bf215546Sopenharmony_ci trace_dump_arg(format, format); 1240bf215546Sopenharmony_ci 1241bf215546Sopenharmony_ci unsigned ret = screen->get_dmabuf_modifier_planes(screen, modifier, format); 1242bf215546Sopenharmony_ci 1243bf215546Sopenharmony_ci trace_dump_ret(uint, ret); 1244bf215546Sopenharmony_ci 1245bf215546Sopenharmony_ci trace_dump_call_end(); 1246bf215546Sopenharmony_ci return ret; 1247bf215546Sopenharmony_ci} 1248bf215546Sopenharmony_ci 1249bf215546Sopenharmony_cistatic int 1250bf215546Sopenharmony_citrace_screen_get_sparse_texture_virtual_page_size(struct pipe_screen *_screen, 1251bf215546Sopenharmony_ci enum pipe_texture_target target, 1252bf215546Sopenharmony_ci bool multi_sample, 1253bf215546Sopenharmony_ci enum pipe_format format, 1254bf215546Sopenharmony_ci unsigned offset, unsigned size, 1255bf215546Sopenharmony_ci int *x, int *y, int *z) 1256bf215546Sopenharmony_ci{ 1257bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 1258bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 1259bf215546Sopenharmony_ci 1260bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "get_sparse_texture_virtual_page_size"); 1261bf215546Sopenharmony_ci 1262bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 1263bf215546Sopenharmony_ci trace_dump_arg_enum(target, tr_util_pipe_texture_target_name(target)); 1264bf215546Sopenharmony_ci trace_dump_arg(format, format); 1265bf215546Sopenharmony_ci trace_dump_arg(uint, offset); 1266bf215546Sopenharmony_ci trace_dump_arg(uint, size); 1267bf215546Sopenharmony_ci 1268bf215546Sopenharmony_ci int ret = screen->get_sparse_texture_virtual_page_size(screen, target, multi_sample, 1269bf215546Sopenharmony_ci format, offset, size, x, y, z); 1270bf215546Sopenharmony_ci 1271bf215546Sopenharmony_ci if (x) 1272bf215546Sopenharmony_ci trace_dump_arg(uint, *x); 1273bf215546Sopenharmony_ci else 1274bf215546Sopenharmony_ci trace_dump_arg(ptr, x); 1275bf215546Sopenharmony_ci if (y) 1276bf215546Sopenharmony_ci trace_dump_arg(uint, *y); 1277bf215546Sopenharmony_ci else 1278bf215546Sopenharmony_ci trace_dump_arg(ptr, y); 1279bf215546Sopenharmony_ci if (z) 1280bf215546Sopenharmony_ci trace_dump_arg(uint, *z); 1281bf215546Sopenharmony_ci else 1282bf215546Sopenharmony_ci trace_dump_arg(ptr, z); 1283bf215546Sopenharmony_ci 1284bf215546Sopenharmony_ci trace_dump_ret(int, ret); 1285bf215546Sopenharmony_ci 1286bf215546Sopenharmony_ci trace_dump_call_end(); 1287bf215546Sopenharmony_ci return ret; 1288bf215546Sopenharmony_ci} 1289bf215546Sopenharmony_ci 1290bf215546Sopenharmony_cistatic struct pipe_vertex_state * 1291bf215546Sopenharmony_citrace_screen_create_vertex_state(struct pipe_screen *_screen, 1292bf215546Sopenharmony_ci struct pipe_vertex_buffer *buffer, 1293bf215546Sopenharmony_ci const struct pipe_vertex_element *elements, 1294bf215546Sopenharmony_ci unsigned num_elements, 1295bf215546Sopenharmony_ci struct pipe_resource *indexbuf, 1296bf215546Sopenharmony_ci uint32_t full_velem_mask) 1297bf215546Sopenharmony_ci{ 1298bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 1299bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 1300bf215546Sopenharmony_ci 1301bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "create_vertex_state"); 1302bf215546Sopenharmony_ci 1303bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 1304bf215546Sopenharmony_ci trace_dump_arg(ptr, buffer->buffer.resource); 1305bf215546Sopenharmony_ci trace_dump_arg(vertex_buffer, buffer); 1306bf215546Sopenharmony_ci trace_dump_arg_begin("elements"); 1307bf215546Sopenharmony_ci trace_dump_struct_array(vertex_element, elements, num_elements); 1308bf215546Sopenharmony_ci trace_dump_arg_end(); 1309bf215546Sopenharmony_ci trace_dump_arg(uint, num_elements); 1310bf215546Sopenharmony_ci trace_dump_arg(ptr, indexbuf); 1311bf215546Sopenharmony_ci trace_dump_arg(uint, full_velem_mask); 1312bf215546Sopenharmony_ci 1313bf215546Sopenharmony_ci struct pipe_vertex_state *vstate = 1314bf215546Sopenharmony_ci screen->create_vertex_state(screen, buffer, elements, num_elements, 1315bf215546Sopenharmony_ci indexbuf, full_velem_mask); 1316bf215546Sopenharmony_ci trace_dump_ret(ptr, vstate); 1317bf215546Sopenharmony_ci trace_dump_call_end(); 1318bf215546Sopenharmony_ci return vstate; 1319bf215546Sopenharmony_ci} 1320bf215546Sopenharmony_ci 1321bf215546Sopenharmony_cistatic void trace_screen_vertex_state_destroy(struct pipe_screen *_screen, 1322bf215546Sopenharmony_ci struct pipe_vertex_state *state) 1323bf215546Sopenharmony_ci{ 1324bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 1325bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 1326bf215546Sopenharmony_ci 1327bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "vertex_state_destroy"); 1328bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 1329bf215546Sopenharmony_ci trace_dump_arg(ptr, state); 1330bf215546Sopenharmony_ci trace_dump_call_end(); 1331bf215546Sopenharmony_ci 1332bf215546Sopenharmony_ci screen->vertex_state_destroy(screen, state); 1333bf215546Sopenharmony_ci} 1334bf215546Sopenharmony_ci 1335bf215546Sopenharmony_cistatic void trace_screen_set_fence_timeline_value(struct pipe_screen *_screen, 1336bf215546Sopenharmony_ci struct pipe_fence_handle *fence, 1337bf215546Sopenharmony_ci uint64_t value) 1338bf215546Sopenharmony_ci{ 1339bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 1340bf215546Sopenharmony_ci struct pipe_screen *screen = tr_scr->screen; 1341bf215546Sopenharmony_ci 1342bf215546Sopenharmony_ci trace_dump_call_begin("pipe_screen", "set_fence_timeline_value"); 1343bf215546Sopenharmony_ci trace_dump_arg(ptr, screen); 1344bf215546Sopenharmony_ci trace_dump_arg(ptr, fence); 1345bf215546Sopenharmony_ci trace_dump_arg(uint, value); 1346bf215546Sopenharmony_ci trace_dump_call_end(); 1347bf215546Sopenharmony_ci 1348bf215546Sopenharmony_ci screen->set_fence_timeline_value(screen, fence, value); 1349bf215546Sopenharmony_ci} 1350bf215546Sopenharmony_ci 1351bf215546Sopenharmony_cibool 1352bf215546Sopenharmony_citrace_enabled(void) 1353bf215546Sopenharmony_ci{ 1354bf215546Sopenharmony_ci static bool firstrun = true; 1355bf215546Sopenharmony_ci 1356bf215546Sopenharmony_ci if (!firstrun) 1357bf215546Sopenharmony_ci return trace; 1358bf215546Sopenharmony_ci firstrun = false; 1359bf215546Sopenharmony_ci 1360bf215546Sopenharmony_ci if(trace_dump_trace_begin()) { 1361bf215546Sopenharmony_ci trace_dumping_start(); 1362bf215546Sopenharmony_ci trace = true; 1363bf215546Sopenharmony_ci } 1364bf215546Sopenharmony_ci 1365bf215546Sopenharmony_ci return trace; 1366bf215546Sopenharmony_ci} 1367bf215546Sopenharmony_ci 1368bf215546Sopenharmony_cistruct pipe_screen * 1369bf215546Sopenharmony_citrace_screen_create(struct pipe_screen *screen) 1370bf215546Sopenharmony_ci{ 1371bf215546Sopenharmony_ci struct trace_screen *tr_scr; 1372bf215546Sopenharmony_ci 1373bf215546Sopenharmony_ci /* if zink+lavapipe is enabled, ensure that only one driver is traced */ 1374bf215546Sopenharmony_ci const char *driver = debug_get_option("MESA_LOADER_DRIVER_OVERRIDE", NULL); 1375bf215546Sopenharmony_ci if (driver && !strcmp(driver, "zink")) { 1376bf215546Sopenharmony_ci /* the user wants zink: check whether they want to trace zink or lavapipe */ 1377bf215546Sopenharmony_ci bool trace_lavapipe = debug_get_bool_option("ZINK_TRACE_LAVAPIPE", false); 1378bf215546Sopenharmony_ci if (!strncmp(screen->get_name(screen), "zink", 4)) { 1379bf215546Sopenharmony_ci /* this is the zink screen: only trace if lavapipe tracing is disabled */ 1380bf215546Sopenharmony_ci if (trace_lavapipe) 1381bf215546Sopenharmony_ci return screen; 1382bf215546Sopenharmony_ci } else { 1383bf215546Sopenharmony_ci /* this is the llvmpipe screen: only trace if lavapipe tracing is enabled */ 1384bf215546Sopenharmony_ci if (!trace_lavapipe) 1385bf215546Sopenharmony_ci return screen; 1386bf215546Sopenharmony_ci } 1387bf215546Sopenharmony_ci } 1388bf215546Sopenharmony_ci 1389bf215546Sopenharmony_ci if (!trace_enabled()) 1390bf215546Sopenharmony_ci goto error1; 1391bf215546Sopenharmony_ci 1392bf215546Sopenharmony_ci trace_dump_call_begin("", "pipe_screen_create"); 1393bf215546Sopenharmony_ci 1394bf215546Sopenharmony_ci tr_scr = CALLOC_STRUCT(trace_screen); 1395bf215546Sopenharmony_ci if (!tr_scr) 1396bf215546Sopenharmony_ci goto error2; 1397bf215546Sopenharmony_ci 1398bf215546Sopenharmony_ci#define SCR_INIT(_member) \ 1399bf215546Sopenharmony_ci tr_scr->base._member = screen->_member ? trace_screen_##_member : NULL 1400bf215546Sopenharmony_ci 1401bf215546Sopenharmony_ci tr_scr->base.destroy = trace_screen_destroy; 1402bf215546Sopenharmony_ci tr_scr->base.get_name = trace_screen_get_name; 1403bf215546Sopenharmony_ci tr_scr->base.get_vendor = trace_screen_get_vendor; 1404bf215546Sopenharmony_ci tr_scr->base.get_device_vendor = trace_screen_get_device_vendor; 1405bf215546Sopenharmony_ci SCR_INIT(get_compiler_options); 1406bf215546Sopenharmony_ci SCR_INIT(get_disk_shader_cache); 1407bf215546Sopenharmony_ci tr_scr->base.get_param = trace_screen_get_param; 1408bf215546Sopenharmony_ci tr_scr->base.get_shader_param = trace_screen_get_shader_param; 1409bf215546Sopenharmony_ci tr_scr->base.get_paramf = trace_screen_get_paramf; 1410bf215546Sopenharmony_ci tr_scr->base.get_compute_param = trace_screen_get_compute_param; 1411bf215546Sopenharmony_ci tr_scr->base.is_format_supported = trace_screen_is_format_supported; 1412bf215546Sopenharmony_ci assert(screen->context_create); 1413bf215546Sopenharmony_ci tr_scr->base.context_create = trace_screen_context_create; 1414bf215546Sopenharmony_ci tr_scr->base.resource_create = trace_screen_resource_create; 1415bf215546Sopenharmony_ci SCR_INIT(resource_create_with_modifiers); 1416bf215546Sopenharmony_ci tr_scr->base.resource_create_unbacked = trace_screen_resource_create_unbacked; 1417bf215546Sopenharmony_ci SCR_INIT(resource_create_drawable); 1418bf215546Sopenharmony_ci tr_scr->base.resource_bind_backing = trace_screen_resource_bind_backing; 1419bf215546Sopenharmony_ci tr_scr->base.resource_from_handle = trace_screen_resource_from_handle; 1420bf215546Sopenharmony_ci tr_scr->base.allocate_memory = trace_screen_allocate_memory; 1421bf215546Sopenharmony_ci SCR_INIT(allocate_memory_fd); 1422bf215546Sopenharmony_ci tr_scr->base.free_memory = trace_screen_free_memory; 1423bf215546Sopenharmony_ci SCR_INIT(free_memory_fd); 1424bf215546Sopenharmony_ci tr_scr->base.map_memory = trace_screen_map_memory; 1425bf215546Sopenharmony_ci tr_scr->base.unmap_memory = trace_screen_unmap_memory; 1426bf215546Sopenharmony_ci SCR_INIT(query_memory_info); 1427bf215546Sopenharmony_ci SCR_INIT(query_dmabuf_modifiers); 1428bf215546Sopenharmony_ci SCR_INIT(is_compute_copy_faster); 1429bf215546Sopenharmony_ci SCR_INIT(is_dmabuf_modifier_supported); 1430bf215546Sopenharmony_ci SCR_INIT(get_dmabuf_modifier_planes); 1431bf215546Sopenharmony_ci SCR_INIT(check_resource_capability); 1432bf215546Sopenharmony_ci tr_scr->base.resource_get_handle = trace_screen_resource_get_handle; 1433bf215546Sopenharmony_ci SCR_INIT(resource_get_param); 1434bf215546Sopenharmony_ci SCR_INIT(resource_get_info); 1435bf215546Sopenharmony_ci SCR_INIT(resource_from_memobj); 1436bf215546Sopenharmony_ci SCR_INIT(resource_changed); 1437bf215546Sopenharmony_ci tr_scr->base.resource_destroy = trace_screen_resource_destroy; 1438bf215546Sopenharmony_ci tr_scr->base.fence_reference = trace_screen_fence_reference; 1439bf215546Sopenharmony_ci SCR_INIT(fence_get_fd); 1440bf215546Sopenharmony_ci SCR_INIT(create_fence_win32); 1441bf215546Sopenharmony_ci tr_scr->base.fence_finish = trace_screen_fence_finish; 1442bf215546Sopenharmony_ci SCR_INIT(memobj_create_from_handle); 1443bf215546Sopenharmony_ci SCR_INIT(memobj_destroy); 1444bf215546Sopenharmony_ci tr_scr->base.flush_frontbuffer = trace_screen_flush_frontbuffer; 1445bf215546Sopenharmony_ci tr_scr->base.get_timestamp = trace_screen_get_timestamp; 1446bf215546Sopenharmony_ci SCR_INIT(get_driver_uuid); 1447bf215546Sopenharmony_ci SCR_INIT(get_device_uuid); 1448bf215546Sopenharmony_ci SCR_INIT(get_device_luid); 1449bf215546Sopenharmony_ci SCR_INIT(get_device_node_mask); 1450bf215546Sopenharmony_ci SCR_INIT(finalize_nir); 1451bf215546Sopenharmony_ci SCR_INIT(create_vertex_state); 1452bf215546Sopenharmony_ci SCR_INIT(vertex_state_destroy); 1453bf215546Sopenharmony_ci tr_scr->base.transfer_helper = screen->transfer_helper; 1454bf215546Sopenharmony_ci SCR_INIT(get_sparse_texture_virtual_page_size); 1455bf215546Sopenharmony_ci SCR_INIT(set_fence_timeline_value); 1456bf215546Sopenharmony_ci 1457bf215546Sopenharmony_ci tr_scr->screen = screen; 1458bf215546Sopenharmony_ci 1459bf215546Sopenharmony_ci trace_dump_ret(ptr, screen); 1460bf215546Sopenharmony_ci trace_dump_call_end(); 1461bf215546Sopenharmony_ci 1462bf215546Sopenharmony_ci if (!trace_screens) 1463bf215546Sopenharmony_ci trace_screens = _mesa_hash_table_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal); 1464bf215546Sopenharmony_ci _mesa_hash_table_insert(trace_screens, screen, tr_scr); 1465bf215546Sopenharmony_ci 1466bf215546Sopenharmony_ci tr_scr->trace_tc = debug_get_bool_option("GALLIUM_TRACE_TC", false); 1467bf215546Sopenharmony_ci 1468bf215546Sopenharmony_ci return &tr_scr->base; 1469bf215546Sopenharmony_ci 1470bf215546Sopenharmony_cierror2: 1471bf215546Sopenharmony_ci trace_dump_ret(ptr, screen); 1472bf215546Sopenharmony_ci trace_dump_call_end(); 1473bf215546Sopenharmony_cierror1: 1474bf215546Sopenharmony_ci return screen; 1475bf215546Sopenharmony_ci} 1476bf215546Sopenharmony_ci 1477bf215546Sopenharmony_ci 1478bf215546Sopenharmony_cistruct trace_screen * 1479bf215546Sopenharmony_citrace_screen(struct pipe_screen *screen) 1480bf215546Sopenharmony_ci{ 1481bf215546Sopenharmony_ci assert(screen); 1482bf215546Sopenharmony_ci assert(screen->destroy == trace_screen_destroy); 1483bf215546Sopenharmony_ci return (struct trace_screen *)screen; 1484bf215546Sopenharmony_ci} 1485bf215546Sopenharmony_ci 1486bf215546Sopenharmony_cistruct pipe_screen * 1487bf215546Sopenharmony_citrace_screen_unwrap(struct pipe_screen *_screen) 1488bf215546Sopenharmony_ci{ 1489bf215546Sopenharmony_ci if (_screen->destroy != trace_screen_destroy) 1490bf215546Sopenharmony_ci return _screen; 1491bf215546Sopenharmony_ci struct trace_screen *tr_scr = trace_screen(_screen); 1492bf215546Sopenharmony_ci return tr_scr->screen; 1493bf215546Sopenharmony_ci} 1494