1bf215546Sopenharmony_ci/* 2bf215546Sopenharmony_ci * Copyright 2010 Red Hat Inc. 3bf215546Sopenharmony_ci * 4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 5bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 6bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation 7bf215546Sopenharmony_ci * on the rights to use, copy, modify, merge, publish, distribute, sub 8bf215546Sopenharmony_ci * license, and/or sell copies of the Software, and to permit persons to whom 9bf215546Sopenharmony_ci * the Software is furnished to do so, subject to the following conditions: 10bf215546Sopenharmony_ci * 11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next 12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 13bf215546Sopenharmony_ci * Software. 14bf215546Sopenharmony_ci * 15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18bf215546Sopenharmony_ci * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, 19bf215546Sopenharmony_ci * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 20bf215546Sopenharmony_ci * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 21bf215546Sopenharmony_ci * USE OR OTHER DEALINGS IN THE SOFTWARE. 22bf215546Sopenharmony_ci */ 23bf215546Sopenharmony_ci#include <stdio.h> 24bf215546Sopenharmony_ci#include <errno.h> 25bf215546Sopenharmony_ci#include "pipe/p_defines.h" 26bf215546Sopenharmony_ci#include "pipe/p_state.h" 27bf215546Sopenharmony_ci#include "pipe/p_context.h" 28bf215546Sopenharmony_ci#include "pipe/p_screen.h" 29bf215546Sopenharmony_ci#include "util/u_memory.h" 30bf215546Sopenharmony_ci#include "util/u_inlines.h" 31bf215546Sopenharmony_ci#include "util/format/u_format.h" 32bf215546Sopenharmony_ci#include "util/u_helpers.h" 33bf215546Sopenharmony_ci#include "util/u_upload_mgr.h" 34bf215546Sopenharmony_ci#include "util/u_threaded_context.h" 35bf215546Sopenharmony_ci#include "noop_public.h" 36bf215546Sopenharmony_ci 37bf215546Sopenharmony_ciDEBUG_GET_ONCE_BOOL_OPTION(noop, "GALLIUM_NOOP", false) 38bf215546Sopenharmony_ci 39bf215546Sopenharmony_civoid noop_init_state_functions(struct pipe_context *ctx); 40bf215546Sopenharmony_ci 41bf215546Sopenharmony_cistruct noop_pipe_screen { 42bf215546Sopenharmony_ci struct pipe_screen pscreen; 43bf215546Sopenharmony_ci struct pipe_screen *oscreen; 44bf215546Sopenharmony_ci struct slab_parent_pool pool_transfers; 45bf215546Sopenharmony_ci}; 46bf215546Sopenharmony_ci 47bf215546Sopenharmony_ci/* 48bf215546Sopenharmony_ci * query 49bf215546Sopenharmony_ci */ 50bf215546Sopenharmony_cistruct noop_query { 51bf215546Sopenharmony_ci struct threaded_query b; 52bf215546Sopenharmony_ci unsigned query; 53bf215546Sopenharmony_ci}; 54bf215546Sopenharmony_cistatic struct pipe_query *noop_create_query(struct pipe_context *ctx, unsigned query_type, unsigned index) 55bf215546Sopenharmony_ci{ 56bf215546Sopenharmony_ci struct noop_query *query = CALLOC_STRUCT(noop_query); 57bf215546Sopenharmony_ci 58bf215546Sopenharmony_ci return (struct pipe_query *)query; 59bf215546Sopenharmony_ci} 60bf215546Sopenharmony_ci 61bf215546Sopenharmony_cistatic void noop_destroy_query(struct pipe_context *ctx, struct pipe_query *query) 62bf215546Sopenharmony_ci{ 63bf215546Sopenharmony_ci FREE(query); 64bf215546Sopenharmony_ci} 65bf215546Sopenharmony_ci 66bf215546Sopenharmony_cistatic bool noop_begin_query(struct pipe_context *ctx, struct pipe_query *query) 67bf215546Sopenharmony_ci{ 68bf215546Sopenharmony_ci return true; 69bf215546Sopenharmony_ci} 70bf215546Sopenharmony_ci 71bf215546Sopenharmony_cistatic bool noop_end_query(struct pipe_context *ctx, struct pipe_query *query) 72bf215546Sopenharmony_ci{ 73bf215546Sopenharmony_ci return true; 74bf215546Sopenharmony_ci} 75bf215546Sopenharmony_ci 76bf215546Sopenharmony_cistatic bool noop_get_query_result(struct pipe_context *ctx, 77bf215546Sopenharmony_ci struct pipe_query *query, 78bf215546Sopenharmony_ci bool wait, 79bf215546Sopenharmony_ci union pipe_query_result *vresult) 80bf215546Sopenharmony_ci{ 81bf215546Sopenharmony_ci uint64_t *result = (uint64_t*)vresult; 82bf215546Sopenharmony_ci 83bf215546Sopenharmony_ci *result = 0; 84bf215546Sopenharmony_ci return true; 85bf215546Sopenharmony_ci} 86bf215546Sopenharmony_ci 87bf215546Sopenharmony_cistatic void 88bf215546Sopenharmony_cinoop_set_active_query_state(struct pipe_context *pipe, bool enable) 89bf215546Sopenharmony_ci{ 90bf215546Sopenharmony_ci} 91bf215546Sopenharmony_ci 92bf215546Sopenharmony_ci 93bf215546Sopenharmony_ci/* 94bf215546Sopenharmony_ci * resource 95bf215546Sopenharmony_ci */ 96bf215546Sopenharmony_cistruct noop_resource { 97bf215546Sopenharmony_ci struct threaded_resource b; 98bf215546Sopenharmony_ci unsigned size; 99bf215546Sopenharmony_ci char *data; 100bf215546Sopenharmony_ci struct sw_displaytarget *dt; 101bf215546Sopenharmony_ci}; 102bf215546Sopenharmony_ci 103bf215546Sopenharmony_cistatic struct pipe_resource *noop_resource_create(struct pipe_screen *screen, 104bf215546Sopenharmony_ci const struct pipe_resource *templ) 105bf215546Sopenharmony_ci{ 106bf215546Sopenharmony_ci struct noop_resource *nresource; 107bf215546Sopenharmony_ci unsigned stride; 108bf215546Sopenharmony_ci 109bf215546Sopenharmony_ci nresource = CALLOC_STRUCT(noop_resource); 110bf215546Sopenharmony_ci if (!nresource) 111bf215546Sopenharmony_ci return NULL; 112bf215546Sopenharmony_ci 113bf215546Sopenharmony_ci stride = util_format_get_stride(templ->format, templ->width0); 114bf215546Sopenharmony_ci nresource->b.b = *templ; 115bf215546Sopenharmony_ci nresource->b.b.screen = screen; 116bf215546Sopenharmony_ci nresource->size = stride * templ->height0 * templ->depth0; 117bf215546Sopenharmony_ci nresource->data = MALLOC(nresource->size); 118bf215546Sopenharmony_ci pipe_reference_init(&nresource->b.b.reference, 1); 119bf215546Sopenharmony_ci if (nresource->data == NULL) { 120bf215546Sopenharmony_ci FREE(nresource); 121bf215546Sopenharmony_ci return NULL; 122bf215546Sopenharmony_ci } 123bf215546Sopenharmony_ci threaded_resource_init(&nresource->b.b, false); 124bf215546Sopenharmony_ci return &nresource->b.b; 125bf215546Sopenharmony_ci} 126bf215546Sopenharmony_ci 127bf215546Sopenharmony_cistatic struct pipe_resource * 128bf215546Sopenharmony_cinoop_resource_create_with_modifiers(struct pipe_screen *screen, 129bf215546Sopenharmony_ci const struct pipe_resource *templ, 130bf215546Sopenharmony_ci const uint64_t *modifiers, int count) 131bf215546Sopenharmony_ci{ 132bf215546Sopenharmony_ci struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen*)screen; 133bf215546Sopenharmony_ci struct pipe_screen *oscreen = noop_screen->oscreen; 134bf215546Sopenharmony_ci struct pipe_resource *result; 135bf215546Sopenharmony_ci struct pipe_resource *noop_resource; 136bf215546Sopenharmony_ci 137bf215546Sopenharmony_ci result = oscreen->resource_create_with_modifiers(oscreen, templ, 138bf215546Sopenharmony_ci modifiers, count); 139bf215546Sopenharmony_ci noop_resource = noop_resource_create(screen, result); 140bf215546Sopenharmony_ci pipe_resource_reference(&result, NULL); 141bf215546Sopenharmony_ci return noop_resource; 142bf215546Sopenharmony_ci} 143bf215546Sopenharmony_ci 144bf215546Sopenharmony_cistatic struct pipe_resource *noop_resource_from_handle(struct pipe_screen *screen, 145bf215546Sopenharmony_ci const struct pipe_resource *templ, 146bf215546Sopenharmony_ci struct winsys_handle *handle, 147bf215546Sopenharmony_ci unsigned usage) 148bf215546Sopenharmony_ci{ 149bf215546Sopenharmony_ci struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen*)screen; 150bf215546Sopenharmony_ci struct pipe_screen *oscreen = noop_screen->oscreen; 151bf215546Sopenharmony_ci struct pipe_resource *result; 152bf215546Sopenharmony_ci struct pipe_resource *noop_resource; 153bf215546Sopenharmony_ci 154bf215546Sopenharmony_ci result = oscreen->resource_from_handle(oscreen, templ, handle, usage); 155bf215546Sopenharmony_ci noop_resource = noop_resource_create(screen, result); 156bf215546Sopenharmony_ci pipe_resource_reference(&result, NULL); 157bf215546Sopenharmony_ci return noop_resource; 158bf215546Sopenharmony_ci} 159bf215546Sopenharmony_ci 160bf215546Sopenharmony_cistatic bool noop_resource_get_handle(struct pipe_screen *pscreen, 161bf215546Sopenharmony_ci struct pipe_context *ctx, 162bf215546Sopenharmony_ci struct pipe_resource *resource, 163bf215546Sopenharmony_ci struct winsys_handle *handle, 164bf215546Sopenharmony_ci unsigned usage) 165bf215546Sopenharmony_ci{ 166bf215546Sopenharmony_ci struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen*)pscreen; 167bf215546Sopenharmony_ci struct pipe_screen *screen = noop_screen->oscreen; 168bf215546Sopenharmony_ci struct pipe_resource *tex; 169bf215546Sopenharmony_ci bool result; 170bf215546Sopenharmony_ci 171bf215546Sopenharmony_ci /* resource_get_handle musn't fail. Just create something and return it. */ 172bf215546Sopenharmony_ci tex = screen->resource_create(screen, resource); 173bf215546Sopenharmony_ci if (!tex) 174bf215546Sopenharmony_ci return false; 175bf215546Sopenharmony_ci 176bf215546Sopenharmony_ci result = screen->resource_get_handle(screen, NULL, tex, handle, usage); 177bf215546Sopenharmony_ci pipe_resource_reference(&tex, NULL); 178bf215546Sopenharmony_ci return result; 179bf215546Sopenharmony_ci} 180bf215546Sopenharmony_ci 181bf215546Sopenharmony_cistatic bool noop_resource_get_param(struct pipe_screen *pscreen, 182bf215546Sopenharmony_ci struct pipe_context *ctx, 183bf215546Sopenharmony_ci struct pipe_resource *resource, 184bf215546Sopenharmony_ci unsigned plane, 185bf215546Sopenharmony_ci unsigned layer, 186bf215546Sopenharmony_ci unsigned level, 187bf215546Sopenharmony_ci enum pipe_resource_param param, 188bf215546Sopenharmony_ci unsigned handle_usage, 189bf215546Sopenharmony_ci uint64_t *value) 190bf215546Sopenharmony_ci{ 191bf215546Sopenharmony_ci struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen*)pscreen; 192bf215546Sopenharmony_ci struct pipe_screen *screen = noop_screen->oscreen; 193bf215546Sopenharmony_ci struct pipe_resource *tex; 194bf215546Sopenharmony_ci bool result; 195bf215546Sopenharmony_ci 196bf215546Sopenharmony_ci /* resource_get_param mustn't fail. Just create something and return it. */ 197bf215546Sopenharmony_ci tex = screen->resource_create(screen, resource); 198bf215546Sopenharmony_ci if (!tex) 199bf215546Sopenharmony_ci return false; 200bf215546Sopenharmony_ci 201bf215546Sopenharmony_ci result = screen->resource_get_param(screen, NULL, tex, 0, 0, 0, param, 202bf215546Sopenharmony_ci handle_usage, value); 203bf215546Sopenharmony_ci pipe_resource_reference(&tex, NULL); 204bf215546Sopenharmony_ci return result; 205bf215546Sopenharmony_ci} 206bf215546Sopenharmony_ci 207bf215546Sopenharmony_cistatic void noop_resource_destroy(struct pipe_screen *screen, 208bf215546Sopenharmony_ci struct pipe_resource *resource) 209bf215546Sopenharmony_ci{ 210bf215546Sopenharmony_ci struct noop_resource *nresource = (struct noop_resource *)resource; 211bf215546Sopenharmony_ci 212bf215546Sopenharmony_ci threaded_resource_deinit(resource); 213bf215546Sopenharmony_ci FREE(nresource->data); 214bf215546Sopenharmony_ci FREE(resource); 215bf215546Sopenharmony_ci} 216bf215546Sopenharmony_ci 217bf215546Sopenharmony_ci 218bf215546Sopenharmony_ci/* 219bf215546Sopenharmony_ci * transfer 220bf215546Sopenharmony_ci */ 221bf215546Sopenharmony_cistatic void *noop_transfer_map(struct pipe_context *pipe, 222bf215546Sopenharmony_ci struct pipe_resource *resource, 223bf215546Sopenharmony_ci unsigned level, 224bf215546Sopenharmony_ci unsigned usage, 225bf215546Sopenharmony_ci const struct pipe_box *box, 226bf215546Sopenharmony_ci struct pipe_transfer **ptransfer) 227bf215546Sopenharmony_ci{ 228bf215546Sopenharmony_ci struct pipe_transfer *transfer; 229bf215546Sopenharmony_ci struct noop_resource *nresource = (struct noop_resource *)resource; 230bf215546Sopenharmony_ci 231bf215546Sopenharmony_ci transfer = (struct pipe_transfer*)CALLOC_STRUCT(threaded_transfer); 232bf215546Sopenharmony_ci if (!transfer) 233bf215546Sopenharmony_ci return NULL; 234bf215546Sopenharmony_ci pipe_resource_reference(&transfer->resource, resource); 235bf215546Sopenharmony_ci transfer->level = level; 236bf215546Sopenharmony_ci transfer->usage = usage; 237bf215546Sopenharmony_ci transfer->box = *box; 238bf215546Sopenharmony_ci transfer->stride = 1; 239bf215546Sopenharmony_ci transfer->layer_stride = 1; 240bf215546Sopenharmony_ci *ptransfer = transfer; 241bf215546Sopenharmony_ci 242bf215546Sopenharmony_ci return nresource->data; 243bf215546Sopenharmony_ci} 244bf215546Sopenharmony_ci 245bf215546Sopenharmony_cistatic void noop_transfer_flush_region(struct pipe_context *pipe, 246bf215546Sopenharmony_ci struct pipe_transfer *transfer, 247bf215546Sopenharmony_ci const struct pipe_box *box) 248bf215546Sopenharmony_ci{ 249bf215546Sopenharmony_ci} 250bf215546Sopenharmony_ci 251bf215546Sopenharmony_cistatic void noop_transfer_unmap(struct pipe_context *pipe, 252bf215546Sopenharmony_ci struct pipe_transfer *transfer) 253bf215546Sopenharmony_ci{ 254bf215546Sopenharmony_ci pipe_resource_reference(&transfer->resource, NULL); 255bf215546Sopenharmony_ci FREE(transfer); 256bf215546Sopenharmony_ci} 257bf215546Sopenharmony_ci 258bf215546Sopenharmony_cistatic void noop_buffer_subdata(struct pipe_context *pipe, 259bf215546Sopenharmony_ci struct pipe_resource *resource, 260bf215546Sopenharmony_ci unsigned usage, unsigned offset, 261bf215546Sopenharmony_ci unsigned size, const void *data) 262bf215546Sopenharmony_ci{ 263bf215546Sopenharmony_ci} 264bf215546Sopenharmony_ci 265bf215546Sopenharmony_cistatic void noop_texture_subdata(struct pipe_context *pipe, 266bf215546Sopenharmony_ci struct pipe_resource *resource, 267bf215546Sopenharmony_ci unsigned level, 268bf215546Sopenharmony_ci unsigned usage, 269bf215546Sopenharmony_ci const struct pipe_box *box, 270bf215546Sopenharmony_ci const void *data, 271bf215546Sopenharmony_ci unsigned stride, 272bf215546Sopenharmony_ci unsigned layer_stride) 273bf215546Sopenharmony_ci{ 274bf215546Sopenharmony_ci} 275bf215546Sopenharmony_ci 276bf215546Sopenharmony_ci 277bf215546Sopenharmony_ci/* 278bf215546Sopenharmony_ci * clear/copy 279bf215546Sopenharmony_ci */ 280bf215546Sopenharmony_cistatic void noop_clear(struct pipe_context *ctx, unsigned buffers, const struct pipe_scissor_state *scissor_state, 281bf215546Sopenharmony_ci const union pipe_color_union *color, double depth, unsigned stencil) 282bf215546Sopenharmony_ci{ 283bf215546Sopenharmony_ci} 284bf215546Sopenharmony_ci 285bf215546Sopenharmony_cistatic void noop_clear_render_target(struct pipe_context *ctx, 286bf215546Sopenharmony_ci struct pipe_surface *dst, 287bf215546Sopenharmony_ci const union pipe_color_union *color, 288bf215546Sopenharmony_ci unsigned dstx, unsigned dsty, 289bf215546Sopenharmony_ci unsigned width, unsigned height, 290bf215546Sopenharmony_ci bool render_condition_enabled) 291bf215546Sopenharmony_ci{ 292bf215546Sopenharmony_ci} 293bf215546Sopenharmony_ci 294bf215546Sopenharmony_cistatic void noop_clear_depth_stencil(struct pipe_context *ctx, 295bf215546Sopenharmony_ci struct pipe_surface *dst, 296bf215546Sopenharmony_ci unsigned clear_flags, 297bf215546Sopenharmony_ci double depth, 298bf215546Sopenharmony_ci unsigned stencil, 299bf215546Sopenharmony_ci unsigned dstx, unsigned dsty, 300bf215546Sopenharmony_ci unsigned width, unsigned height, 301bf215546Sopenharmony_ci bool render_condition_enabled) 302bf215546Sopenharmony_ci{ 303bf215546Sopenharmony_ci} 304bf215546Sopenharmony_ci 305bf215546Sopenharmony_cistatic void noop_resource_copy_region(struct pipe_context *ctx, 306bf215546Sopenharmony_ci struct pipe_resource *dst, 307bf215546Sopenharmony_ci unsigned dst_level, 308bf215546Sopenharmony_ci unsigned dstx, unsigned dsty, unsigned dstz, 309bf215546Sopenharmony_ci struct pipe_resource *src, 310bf215546Sopenharmony_ci unsigned src_level, 311bf215546Sopenharmony_ci const struct pipe_box *src_box) 312bf215546Sopenharmony_ci{ 313bf215546Sopenharmony_ci} 314bf215546Sopenharmony_ci 315bf215546Sopenharmony_ci 316bf215546Sopenharmony_cistatic void noop_blit(struct pipe_context *ctx, 317bf215546Sopenharmony_ci const struct pipe_blit_info *info) 318bf215546Sopenharmony_ci{ 319bf215546Sopenharmony_ci} 320bf215546Sopenharmony_ci 321bf215546Sopenharmony_ci 322bf215546Sopenharmony_cistatic void 323bf215546Sopenharmony_cinoop_flush_resource(struct pipe_context *ctx, 324bf215546Sopenharmony_ci struct pipe_resource *resource) 325bf215546Sopenharmony_ci{ 326bf215546Sopenharmony_ci} 327bf215546Sopenharmony_ci 328bf215546Sopenharmony_ci 329bf215546Sopenharmony_ci/* 330bf215546Sopenharmony_ci * context 331bf215546Sopenharmony_ci */ 332bf215546Sopenharmony_cistatic void noop_flush(struct pipe_context *ctx, 333bf215546Sopenharmony_ci struct pipe_fence_handle **fence, 334bf215546Sopenharmony_ci unsigned flags) 335bf215546Sopenharmony_ci{ 336bf215546Sopenharmony_ci if (fence) { 337bf215546Sopenharmony_ci struct pipe_reference *f = MALLOC_STRUCT(pipe_reference); 338bf215546Sopenharmony_ci f->count = 1; 339bf215546Sopenharmony_ci 340bf215546Sopenharmony_ci ctx->screen->fence_reference(ctx->screen, fence, NULL); 341bf215546Sopenharmony_ci *fence = (struct pipe_fence_handle*)f; 342bf215546Sopenharmony_ci } 343bf215546Sopenharmony_ci} 344bf215546Sopenharmony_ci 345bf215546Sopenharmony_cistatic void noop_destroy_context(struct pipe_context *ctx) 346bf215546Sopenharmony_ci{ 347bf215546Sopenharmony_ci if (ctx->stream_uploader) 348bf215546Sopenharmony_ci u_upload_destroy(ctx->stream_uploader); 349bf215546Sopenharmony_ci 350bf215546Sopenharmony_ci p_atomic_dec(&ctx->screen->num_contexts); 351bf215546Sopenharmony_ci FREE(ctx); 352bf215546Sopenharmony_ci} 353bf215546Sopenharmony_ci 354bf215546Sopenharmony_cistatic bool noop_generate_mipmap(struct pipe_context *ctx, 355bf215546Sopenharmony_ci struct pipe_resource *resource, 356bf215546Sopenharmony_ci enum pipe_format format, 357bf215546Sopenharmony_ci unsigned base_level, 358bf215546Sopenharmony_ci unsigned last_level, 359bf215546Sopenharmony_ci unsigned first_layer, 360bf215546Sopenharmony_ci unsigned last_layer) 361bf215546Sopenharmony_ci{ 362bf215546Sopenharmony_ci return true; 363bf215546Sopenharmony_ci} 364bf215546Sopenharmony_ci 365bf215546Sopenharmony_cistatic void noop_invalidate_resource(struct pipe_context *ctx, 366bf215546Sopenharmony_ci struct pipe_resource *resource) 367bf215546Sopenharmony_ci{ 368bf215546Sopenharmony_ci} 369bf215546Sopenharmony_ci 370bf215546Sopenharmony_cistatic void noop_set_context_param(struct pipe_context *ctx, 371bf215546Sopenharmony_ci enum pipe_context_param param, 372bf215546Sopenharmony_ci unsigned value) 373bf215546Sopenharmony_ci{ 374bf215546Sopenharmony_ci} 375bf215546Sopenharmony_ci 376bf215546Sopenharmony_cistatic void noop_set_frontend_noop(struct pipe_context *ctx, bool enable) 377bf215546Sopenharmony_ci{ 378bf215546Sopenharmony_ci} 379bf215546Sopenharmony_ci 380bf215546Sopenharmony_cistatic void noop_replace_buffer_storage(struct pipe_context *ctx, 381bf215546Sopenharmony_ci struct pipe_resource *dst, 382bf215546Sopenharmony_ci struct pipe_resource *src, 383bf215546Sopenharmony_ci unsigned num_rebinds, 384bf215546Sopenharmony_ci uint32_t rebind_mask, 385bf215546Sopenharmony_ci uint32_t delete_buffer_id) 386bf215546Sopenharmony_ci{ 387bf215546Sopenharmony_ci} 388bf215546Sopenharmony_ci 389bf215546Sopenharmony_cistatic struct pipe_fence_handle * 390bf215546Sopenharmony_cinoop_create_fence(struct pipe_context *ctx, 391bf215546Sopenharmony_ci struct tc_unflushed_batch_token *tc_token) 392bf215546Sopenharmony_ci{ 393bf215546Sopenharmony_ci struct pipe_reference *f = MALLOC_STRUCT(pipe_reference); 394bf215546Sopenharmony_ci 395bf215546Sopenharmony_ci f->count = 1; 396bf215546Sopenharmony_ci return (struct pipe_fence_handle*)f; 397bf215546Sopenharmony_ci} 398bf215546Sopenharmony_ci 399bf215546Sopenharmony_cistatic bool noop_is_resource_busy(struct pipe_screen *screen, 400bf215546Sopenharmony_ci struct pipe_resource *resource, 401bf215546Sopenharmony_ci unsigned usage) 402bf215546Sopenharmony_ci{ 403bf215546Sopenharmony_ci return false; 404bf215546Sopenharmony_ci} 405bf215546Sopenharmony_ci 406bf215546Sopenharmony_cistatic struct pipe_context *noop_create_context(struct pipe_screen *screen, 407bf215546Sopenharmony_ci void *priv, unsigned flags) 408bf215546Sopenharmony_ci{ 409bf215546Sopenharmony_ci struct pipe_context *ctx = CALLOC_STRUCT(pipe_context); 410bf215546Sopenharmony_ci 411bf215546Sopenharmony_ci if (!ctx) 412bf215546Sopenharmony_ci return NULL; 413bf215546Sopenharmony_ci 414bf215546Sopenharmony_ci ctx->screen = screen; 415bf215546Sopenharmony_ci ctx->priv = priv; 416bf215546Sopenharmony_ci 417bf215546Sopenharmony_ci ctx->stream_uploader = u_upload_create_default(ctx); 418bf215546Sopenharmony_ci if (!ctx->stream_uploader) { 419bf215546Sopenharmony_ci FREE(ctx); 420bf215546Sopenharmony_ci return NULL; 421bf215546Sopenharmony_ci } 422bf215546Sopenharmony_ci ctx->const_uploader = ctx->stream_uploader; 423bf215546Sopenharmony_ci 424bf215546Sopenharmony_ci ctx->destroy = noop_destroy_context; 425bf215546Sopenharmony_ci ctx->flush = noop_flush; 426bf215546Sopenharmony_ci ctx->clear = noop_clear; 427bf215546Sopenharmony_ci ctx->clear_render_target = noop_clear_render_target; 428bf215546Sopenharmony_ci ctx->clear_depth_stencil = noop_clear_depth_stencil; 429bf215546Sopenharmony_ci ctx->resource_copy_region = noop_resource_copy_region; 430bf215546Sopenharmony_ci ctx->generate_mipmap = noop_generate_mipmap; 431bf215546Sopenharmony_ci ctx->blit = noop_blit; 432bf215546Sopenharmony_ci ctx->flush_resource = noop_flush_resource; 433bf215546Sopenharmony_ci ctx->create_query = noop_create_query; 434bf215546Sopenharmony_ci ctx->destroy_query = noop_destroy_query; 435bf215546Sopenharmony_ci ctx->begin_query = noop_begin_query; 436bf215546Sopenharmony_ci ctx->end_query = noop_end_query; 437bf215546Sopenharmony_ci ctx->get_query_result = noop_get_query_result; 438bf215546Sopenharmony_ci ctx->set_active_query_state = noop_set_active_query_state; 439bf215546Sopenharmony_ci ctx->buffer_map = noop_transfer_map; 440bf215546Sopenharmony_ci ctx->texture_map = noop_transfer_map; 441bf215546Sopenharmony_ci ctx->transfer_flush_region = noop_transfer_flush_region; 442bf215546Sopenharmony_ci ctx->buffer_unmap = noop_transfer_unmap; 443bf215546Sopenharmony_ci ctx->texture_unmap = noop_transfer_unmap; 444bf215546Sopenharmony_ci ctx->buffer_subdata = noop_buffer_subdata; 445bf215546Sopenharmony_ci ctx->texture_subdata = noop_texture_subdata; 446bf215546Sopenharmony_ci ctx->invalidate_resource = noop_invalidate_resource; 447bf215546Sopenharmony_ci ctx->set_context_param = noop_set_context_param; 448bf215546Sopenharmony_ci ctx->set_frontend_noop = noop_set_frontend_noop; 449bf215546Sopenharmony_ci noop_init_state_functions(ctx); 450bf215546Sopenharmony_ci 451bf215546Sopenharmony_ci p_atomic_inc(&screen->num_contexts); 452bf215546Sopenharmony_ci 453bf215546Sopenharmony_ci if (!(flags & PIPE_CONTEXT_PREFER_THREADED)) 454bf215546Sopenharmony_ci return ctx; 455bf215546Sopenharmony_ci 456bf215546Sopenharmony_ci struct pipe_context *tc = 457bf215546Sopenharmony_ci threaded_context_create(ctx, 458bf215546Sopenharmony_ci &((struct noop_pipe_screen*)screen)->pool_transfers, 459bf215546Sopenharmony_ci noop_replace_buffer_storage, 460bf215546Sopenharmony_ci &(struct threaded_context_options) { 461bf215546Sopenharmony_ci .create_fence = noop_create_fence, 462bf215546Sopenharmony_ci .is_resource_busy = noop_is_resource_busy, 463bf215546Sopenharmony_ci }, 464bf215546Sopenharmony_ci NULL); 465bf215546Sopenharmony_ci 466bf215546Sopenharmony_ci if (tc && tc != ctx) 467bf215546Sopenharmony_ci threaded_context_init_bytes_mapped_limit((struct threaded_context *)tc, 4); 468bf215546Sopenharmony_ci 469bf215546Sopenharmony_ci return tc; 470bf215546Sopenharmony_ci} 471bf215546Sopenharmony_ci 472bf215546Sopenharmony_ci 473bf215546Sopenharmony_ci/* 474bf215546Sopenharmony_ci * pipe_screen 475bf215546Sopenharmony_ci */ 476bf215546Sopenharmony_cistatic void noop_flush_frontbuffer(struct pipe_screen *_screen, 477bf215546Sopenharmony_ci struct pipe_context *ctx, 478bf215546Sopenharmony_ci struct pipe_resource *resource, 479bf215546Sopenharmony_ci unsigned level, unsigned layer, 480bf215546Sopenharmony_ci void *context_private, struct pipe_box *box) 481bf215546Sopenharmony_ci{ 482bf215546Sopenharmony_ci} 483bf215546Sopenharmony_ci 484bf215546Sopenharmony_cistatic const char *noop_get_vendor(struct pipe_screen* pscreen) 485bf215546Sopenharmony_ci{ 486bf215546Sopenharmony_ci return "X.Org"; 487bf215546Sopenharmony_ci} 488bf215546Sopenharmony_ci 489bf215546Sopenharmony_cistatic const char *noop_get_device_vendor(struct pipe_screen* pscreen) 490bf215546Sopenharmony_ci{ 491bf215546Sopenharmony_ci return "NONE"; 492bf215546Sopenharmony_ci} 493bf215546Sopenharmony_ci 494bf215546Sopenharmony_cistatic const char *noop_get_name(struct pipe_screen* pscreen) 495bf215546Sopenharmony_ci{ 496bf215546Sopenharmony_ci return "NOOP"; 497bf215546Sopenharmony_ci} 498bf215546Sopenharmony_ci 499bf215546Sopenharmony_cistatic int noop_get_param(struct pipe_screen* pscreen, enum pipe_cap param) 500bf215546Sopenharmony_ci{ 501bf215546Sopenharmony_ci struct pipe_screen *screen = ((struct noop_pipe_screen*)pscreen)->oscreen; 502bf215546Sopenharmony_ci 503bf215546Sopenharmony_ci return screen->get_param(screen, param); 504bf215546Sopenharmony_ci} 505bf215546Sopenharmony_ci 506bf215546Sopenharmony_cistatic float noop_get_paramf(struct pipe_screen* pscreen, 507bf215546Sopenharmony_ci enum pipe_capf param) 508bf215546Sopenharmony_ci{ 509bf215546Sopenharmony_ci struct pipe_screen *screen = ((struct noop_pipe_screen*)pscreen)->oscreen; 510bf215546Sopenharmony_ci 511bf215546Sopenharmony_ci return screen->get_paramf(screen, param); 512bf215546Sopenharmony_ci} 513bf215546Sopenharmony_ci 514bf215546Sopenharmony_cistatic int noop_get_shader_param(struct pipe_screen* pscreen, 515bf215546Sopenharmony_ci enum pipe_shader_type shader, 516bf215546Sopenharmony_ci enum pipe_shader_cap param) 517bf215546Sopenharmony_ci{ 518bf215546Sopenharmony_ci struct pipe_screen *screen = ((struct noop_pipe_screen*)pscreen)->oscreen; 519bf215546Sopenharmony_ci 520bf215546Sopenharmony_ci return screen->get_shader_param(screen, shader, param); 521bf215546Sopenharmony_ci} 522bf215546Sopenharmony_ci 523bf215546Sopenharmony_cistatic int noop_get_compute_param(struct pipe_screen *pscreen, 524bf215546Sopenharmony_ci enum pipe_shader_ir ir_type, 525bf215546Sopenharmony_ci enum pipe_compute_cap param, 526bf215546Sopenharmony_ci void *ret) 527bf215546Sopenharmony_ci{ 528bf215546Sopenharmony_ci struct pipe_screen *screen = ((struct noop_pipe_screen*)pscreen)->oscreen; 529bf215546Sopenharmony_ci 530bf215546Sopenharmony_ci return screen->get_compute_param(screen, ir_type, param, ret); 531bf215546Sopenharmony_ci} 532bf215546Sopenharmony_ci 533bf215546Sopenharmony_cistatic bool noop_is_format_supported(struct pipe_screen* pscreen, 534bf215546Sopenharmony_ci enum pipe_format format, 535bf215546Sopenharmony_ci enum pipe_texture_target target, 536bf215546Sopenharmony_ci unsigned sample_count, 537bf215546Sopenharmony_ci unsigned storage_sample_count, 538bf215546Sopenharmony_ci unsigned usage) 539bf215546Sopenharmony_ci{ 540bf215546Sopenharmony_ci struct pipe_screen *screen = ((struct noop_pipe_screen*)pscreen)->oscreen; 541bf215546Sopenharmony_ci 542bf215546Sopenharmony_ci return screen->is_format_supported(screen, format, target, sample_count, 543bf215546Sopenharmony_ci storage_sample_count, usage); 544bf215546Sopenharmony_ci} 545bf215546Sopenharmony_ci 546bf215546Sopenharmony_cistatic uint64_t noop_get_timestamp(struct pipe_screen *pscreen) 547bf215546Sopenharmony_ci{ 548bf215546Sopenharmony_ci return 0; 549bf215546Sopenharmony_ci} 550bf215546Sopenharmony_ci 551bf215546Sopenharmony_cistatic void noop_destroy_screen(struct pipe_screen *screen) 552bf215546Sopenharmony_ci{ 553bf215546Sopenharmony_ci struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen*)screen; 554bf215546Sopenharmony_ci struct pipe_screen *oscreen = noop_screen->oscreen; 555bf215546Sopenharmony_ci 556bf215546Sopenharmony_ci oscreen->destroy(oscreen); 557bf215546Sopenharmony_ci slab_destroy_parent(&noop_screen->pool_transfers); 558bf215546Sopenharmony_ci FREE(screen); 559bf215546Sopenharmony_ci} 560bf215546Sopenharmony_ci 561bf215546Sopenharmony_cistatic void noop_fence_reference(struct pipe_screen *screen, 562bf215546Sopenharmony_ci struct pipe_fence_handle **ptr, 563bf215546Sopenharmony_ci struct pipe_fence_handle *fence) 564bf215546Sopenharmony_ci{ 565bf215546Sopenharmony_ci if (pipe_reference((struct pipe_reference*)*ptr, 566bf215546Sopenharmony_ci (struct pipe_reference*)fence)) 567bf215546Sopenharmony_ci FREE(*ptr); 568bf215546Sopenharmony_ci 569bf215546Sopenharmony_ci *ptr = fence; 570bf215546Sopenharmony_ci} 571bf215546Sopenharmony_ci 572bf215546Sopenharmony_cistatic bool noop_fence_finish(struct pipe_screen *screen, 573bf215546Sopenharmony_ci struct pipe_context *ctx, 574bf215546Sopenharmony_ci struct pipe_fence_handle *fence, 575bf215546Sopenharmony_ci uint64_t timeout) 576bf215546Sopenharmony_ci{ 577bf215546Sopenharmony_ci return true; 578bf215546Sopenharmony_ci} 579bf215546Sopenharmony_ci 580bf215546Sopenharmony_cistatic void noop_query_memory_info(struct pipe_screen *pscreen, 581bf215546Sopenharmony_ci struct pipe_memory_info *info) 582bf215546Sopenharmony_ci{ 583bf215546Sopenharmony_ci struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen*)pscreen; 584bf215546Sopenharmony_ci struct pipe_screen *screen = noop_screen->oscreen; 585bf215546Sopenharmony_ci 586bf215546Sopenharmony_ci screen->query_memory_info(screen, info); 587bf215546Sopenharmony_ci} 588bf215546Sopenharmony_ci 589bf215546Sopenharmony_cistatic struct disk_cache *noop_get_disk_shader_cache(struct pipe_screen *pscreen) 590bf215546Sopenharmony_ci{ 591bf215546Sopenharmony_ci struct pipe_screen *screen = ((struct noop_pipe_screen*)pscreen)->oscreen; 592bf215546Sopenharmony_ci 593bf215546Sopenharmony_ci return screen->get_disk_shader_cache(screen); 594bf215546Sopenharmony_ci} 595bf215546Sopenharmony_ci 596bf215546Sopenharmony_cistatic const void *noop_get_compiler_options(struct pipe_screen *pscreen, 597bf215546Sopenharmony_ci enum pipe_shader_ir ir, 598bf215546Sopenharmony_ci enum pipe_shader_type shader) 599bf215546Sopenharmony_ci{ 600bf215546Sopenharmony_ci struct pipe_screen *screen = ((struct noop_pipe_screen*)pscreen)->oscreen; 601bf215546Sopenharmony_ci 602bf215546Sopenharmony_ci return screen->get_compiler_options(screen, ir, shader); 603bf215546Sopenharmony_ci} 604bf215546Sopenharmony_ci 605bf215546Sopenharmony_cistatic char *noop_finalize_nir(struct pipe_screen *pscreen, void *nir) 606bf215546Sopenharmony_ci{ 607bf215546Sopenharmony_ci struct pipe_screen *screen = ((struct noop_pipe_screen*)pscreen)->oscreen; 608bf215546Sopenharmony_ci 609bf215546Sopenharmony_ci return screen->finalize_nir(screen, nir); 610bf215546Sopenharmony_ci} 611bf215546Sopenharmony_ci 612bf215546Sopenharmony_cistatic bool noop_check_resource_capability(struct pipe_screen *screen, 613bf215546Sopenharmony_ci struct pipe_resource *resource, 614bf215546Sopenharmony_ci unsigned bind) 615bf215546Sopenharmony_ci{ 616bf215546Sopenharmony_ci return true; 617bf215546Sopenharmony_ci} 618bf215546Sopenharmony_ci 619bf215546Sopenharmony_cistatic void noop_create_fence_win32(struct pipe_screen *screen, 620bf215546Sopenharmony_ci struct pipe_fence_handle **fence, 621bf215546Sopenharmony_ci void *handle, 622bf215546Sopenharmony_ci const void *name, 623bf215546Sopenharmony_ci enum pipe_fd_type type) 624bf215546Sopenharmony_ci{ 625bf215546Sopenharmony_ci struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen *)screen; 626bf215546Sopenharmony_ci struct pipe_screen *oscreen = noop_screen->oscreen; 627bf215546Sopenharmony_ci oscreen->create_fence_win32(oscreen, fence, handle, name, type); 628bf215546Sopenharmony_ci} 629bf215546Sopenharmony_ci 630bf215546Sopenharmony_cistatic void noop_set_max_shader_compiler_threads(struct pipe_screen *screen, 631bf215546Sopenharmony_ci unsigned max_threads) 632bf215546Sopenharmony_ci{ 633bf215546Sopenharmony_ci} 634bf215546Sopenharmony_ci 635bf215546Sopenharmony_cistatic bool noop_is_parallel_shader_compilation_finished(struct pipe_screen *screen, 636bf215546Sopenharmony_ci void *shader, 637bf215546Sopenharmony_ci unsigned shader_type) 638bf215546Sopenharmony_ci{ 639bf215546Sopenharmony_ci return true; 640bf215546Sopenharmony_ci} 641bf215546Sopenharmony_ci 642bf215546Sopenharmony_cistatic bool noop_is_dmabuf_modifier_supported(struct pipe_screen *screen, 643bf215546Sopenharmony_ci uint64_t modifier, enum pipe_format format, 644bf215546Sopenharmony_ci bool *external_only) 645bf215546Sopenharmony_ci{ 646bf215546Sopenharmony_ci struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen*)screen; 647bf215546Sopenharmony_ci struct pipe_screen *oscreen = noop_screen->oscreen; 648bf215546Sopenharmony_ci 649bf215546Sopenharmony_ci return oscreen->is_dmabuf_modifier_supported(oscreen, modifier, format, external_only); 650bf215546Sopenharmony_ci} 651bf215546Sopenharmony_ci 652bf215546Sopenharmony_cistatic unsigned int noop_get_dmabuf_modifier_planes(struct pipe_screen *screen, 653bf215546Sopenharmony_ci uint64_t modifier, 654bf215546Sopenharmony_ci enum pipe_format format) 655bf215546Sopenharmony_ci{ 656bf215546Sopenharmony_ci struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen*)screen; 657bf215546Sopenharmony_ci struct pipe_screen *oscreen = noop_screen->oscreen; 658bf215546Sopenharmony_ci 659bf215546Sopenharmony_ci return oscreen->get_dmabuf_modifier_planes(oscreen, modifier, format); 660bf215546Sopenharmony_ci} 661bf215546Sopenharmony_ci 662bf215546Sopenharmony_cistatic void noop_get_driver_uuid(struct pipe_screen *screen, char *uuid) 663bf215546Sopenharmony_ci{ 664bf215546Sopenharmony_ci struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen*)screen; 665bf215546Sopenharmony_ci struct pipe_screen *oscreen = noop_screen->oscreen; 666bf215546Sopenharmony_ci 667bf215546Sopenharmony_ci oscreen->get_driver_uuid(oscreen, uuid); 668bf215546Sopenharmony_ci} 669bf215546Sopenharmony_ci 670bf215546Sopenharmony_cistatic void noop_get_device_uuid(struct pipe_screen *screen, char *uuid) 671bf215546Sopenharmony_ci{ 672bf215546Sopenharmony_ci struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen*)screen; 673bf215546Sopenharmony_ci struct pipe_screen *oscreen = noop_screen->oscreen; 674bf215546Sopenharmony_ci 675bf215546Sopenharmony_ci oscreen->get_device_uuid(oscreen, uuid); 676bf215546Sopenharmony_ci} 677bf215546Sopenharmony_ci 678bf215546Sopenharmony_cistatic void noop_get_device_luid(struct pipe_screen *screen, char *luid) 679bf215546Sopenharmony_ci{ 680bf215546Sopenharmony_ci struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen*)screen; 681bf215546Sopenharmony_ci struct pipe_screen *oscreen = noop_screen->oscreen; 682bf215546Sopenharmony_ci 683bf215546Sopenharmony_ci oscreen->get_device_luid(oscreen, luid); 684bf215546Sopenharmony_ci} 685bf215546Sopenharmony_ci 686bf215546Sopenharmony_cistatic uint32_t noop_get_device_node_mask(struct pipe_screen *screen) 687bf215546Sopenharmony_ci{ 688bf215546Sopenharmony_ci struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen*)screen; 689bf215546Sopenharmony_ci struct pipe_screen *oscreen = noop_screen->oscreen; 690bf215546Sopenharmony_ci 691bf215546Sopenharmony_ci return oscreen->get_device_node_mask(oscreen); 692bf215546Sopenharmony_ci} 693bf215546Sopenharmony_ci 694bf215546Sopenharmony_cistatic int noop_get_sparse_texture_virtual_page_size(struct pipe_screen *screen, 695bf215546Sopenharmony_ci enum pipe_texture_target target, 696bf215546Sopenharmony_ci bool multi_sample, 697bf215546Sopenharmony_ci enum pipe_format format, 698bf215546Sopenharmony_ci unsigned offset, unsigned size, 699bf215546Sopenharmony_ci int *x, int *y, int *z) 700bf215546Sopenharmony_ci{ 701bf215546Sopenharmony_ci struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen*)screen; 702bf215546Sopenharmony_ci struct pipe_screen *oscreen = noop_screen->oscreen; 703bf215546Sopenharmony_ci 704bf215546Sopenharmony_ci return oscreen->get_sparse_texture_virtual_page_size(screen, target, multi_sample, 705bf215546Sopenharmony_ci format, offset, size, x, y, z); 706bf215546Sopenharmony_ci} 707bf215546Sopenharmony_ci 708bf215546Sopenharmony_cistatic void noop_query_dmabuf_modifiers(struct pipe_screen *screen, 709bf215546Sopenharmony_ci enum pipe_format format, int max, 710bf215546Sopenharmony_ci uint64_t *modifiers, 711bf215546Sopenharmony_ci unsigned int *external_only, int *count) 712bf215546Sopenharmony_ci{ 713bf215546Sopenharmony_ci struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen*)screen; 714bf215546Sopenharmony_ci struct pipe_screen *oscreen = noop_screen->oscreen; 715bf215546Sopenharmony_ci 716bf215546Sopenharmony_ci oscreen->query_dmabuf_modifiers(oscreen, format, max, modifiers, 717bf215546Sopenharmony_ci external_only, count); 718bf215546Sopenharmony_ci} 719bf215546Sopenharmony_ci 720bf215546Sopenharmony_cistatic struct pipe_vertex_state * 721bf215546Sopenharmony_cinoop_create_vertex_state(struct pipe_screen *screen, 722bf215546Sopenharmony_ci struct pipe_vertex_buffer *buffer, 723bf215546Sopenharmony_ci const struct pipe_vertex_element *elements, 724bf215546Sopenharmony_ci unsigned num_elements, 725bf215546Sopenharmony_ci struct pipe_resource *indexbuf, 726bf215546Sopenharmony_ci uint32_t full_velem_mask) 727bf215546Sopenharmony_ci{ 728bf215546Sopenharmony_ci struct pipe_vertex_state *state = CALLOC_STRUCT(pipe_vertex_state); 729bf215546Sopenharmony_ci 730bf215546Sopenharmony_ci if (!state) 731bf215546Sopenharmony_ci return NULL; 732bf215546Sopenharmony_ci 733bf215546Sopenharmony_ci util_init_pipe_vertex_state(screen, buffer, elements, num_elements, indexbuf, 734bf215546Sopenharmony_ci full_velem_mask, state); 735bf215546Sopenharmony_ci return state; 736bf215546Sopenharmony_ci} 737bf215546Sopenharmony_ci 738bf215546Sopenharmony_cistatic void noop_vertex_state_destroy(struct pipe_screen *screen, 739bf215546Sopenharmony_ci struct pipe_vertex_state *state) 740bf215546Sopenharmony_ci{ 741bf215546Sopenharmony_ci pipe_vertex_buffer_unreference(&state->input.vbuffer); 742bf215546Sopenharmony_ci pipe_resource_reference(&state->input.indexbuf, NULL); 743bf215546Sopenharmony_ci FREE(state); 744bf215546Sopenharmony_ci} 745bf215546Sopenharmony_ci 746bf215546Sopenharmony_cistatic void noop_set_fence_timeline_value(struct pipe_screen *screen, 747bf215546Sopenharmony_ci struct pipe_fence_handle *fence, 748bf215546Sopenharmony_ci uint64_t value) 749bf215546Sopenharmony_ci{ 750bf215546Sopenharmony_ci struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen *)screen; 751bf215546Sopenharmony_ci struct pipe_screen *oscreen = noop_screen->oscreen; 752bf215546Sopenharmony_ci oscreen->set_fence_timeline_value(oscreen, fence, value); 753bf215546Sopenharmony_ci} 754bf215546Sopenharmony_ci 755bf215546Sopenharmony_cistruct pipe_screen *noop_screen_create(struct pipe_screen *oscreen) 756bf215546Sopenharmony_ci{ 757bf215546Sopenharmony_ci struct noop_pipe_screen *noop_screen; 758bf215546Sopenharmony_ci struct pipe_screen *screen; 759bf215546Sopenharmony_ci 760bf215546Sopenharmony_ci if (!debug_get_option_noop()) { 761bf215546Sopenharmony_ci return oscreen; 762bf215546Sopenharmony_ci } 763bf215546Sopenharmony_ci 764bf215546Sopenharmony_ci noop_screen = CALLOC_STRUCT(noop_pipe_screen); 765bf215546Sopenharmony_ci if (!noop_screen) { 766bf215546Sopenharmony_ci return NULL; 767bf215546Sopenharmony_ci } 768bf215546Sopenharmony_ci noop_screen->oscreen = oscreen; 769bf215546Sopenharmony_ci screen = &noop_screen->pscreen; 770bf215546Sopenharmony_ci 771bf215546Sopenharmony_ci screen->destroy = noop_destroy_screen; 772bf215546Sopenharmony_ci screen->get_name = noop_get_name; 773bf215546Sopenharmony_ci screen->get_vendor = noop_get_vendor; 774bf215546Sopenharmony_ci screen->get_device_vendor = noop_get_device_vendor; 775bf215546Sopenharmony_ci screen->get_param = noop_get_param; 776bf215546Sopenharmony_ci screen->get_shader_param = noop_get_shader_param; 777bf215546Sopenharmony_ci screen->get_compute_param = noop_get_compute_param; 778bf215546Sopenharmony_ci screen->get_paramf = noop_get_paramf; 779bf215546Sopenharmony_ci screen->is_format_supported = noop_is_format_supported; 780bf215546Sopenharmony_ci screen->context_create = noop_create_context; 781bf215546Sopenharmony_ci screen->resource_create = noop_resource_create; 782bf215546Sopenharmony_ci screen->resource_from_handle = noop_resource_from_handle; 783bf215546Sopenharmony_ci screen->resource_get_handle = noop_resource_get_handle; 784bf215546Sopenharmony_ci if (oscreen->resource_get_param) 785bf215546Sopenharmony_ci screen->resource_get_param = noop_resource_get_param; 786bf215546Sopenharmony_ci screen->resource_destroy = noop_resource_destroy; 787bf215546Sopenharmony_ci screen->flush_frontbuffer = noop_flush_frontbuffer; 788bf215546Sopenharmony_ci screen->get_timestamp = noop_get_timestamp; 789bf215546Sopenharmony_ci screen->fence_reference = noop_fence_reference; 790bf215546Sopenharmony_ci screen->fence_finish = noop_fence_finish; 791bf215546Sopenharmony_ci screen->query_memory_info = noop_query_memory_info; 792bf215546Sopenharmony_ci screen->get_disk_shader_cache = noop_get_disk_shader_cache; 793bf215546Sopenharmony_ci screen->get_compiler_options = noop_get_compiler_options; 794bf215546Sopenharmony_ci screen->finalize_nir = noop_finalize_nir; 795bf215546Sopenharmony_ci if (screen->create_fence_win32) 796bf215546Sopenharmony_ci screen->create_fence_win32 = noop_create_fence_win32; 797bf215546Sopenharmony_ci screen->check_resource_capability = noop_check_resource_capability; 798bf215546Sopenharmony_ci screen->set_max_shader_compiler_threads = noop_set_max_shader_compiler_threads; 799bf215546Sopenharmony_ci screen->is_parallel_shader_compilation_finished = noop_is_parallel_shader_compilation_finished; 800bf215546Sopenharmony_ci screen->is_dmabuf_modifier_supported = noop_is_dmabuf_modifier_supported; 801bf215546Sopenharmony_ci screen->get_dmabuf_modifier_planes = noop_get_dmabuf_modifier_planes; 802bf215546Sopenharmony_ci screen->get_driver_uuid = noop_get_driver_uuid; 803bf215546Sopenharmony_ci screen->get_device_uuid = noop_get_device_uuid; 804bf215546Sopenharmony_ci screen->get_device_luid = noop_get_device_luid; 805bf215546Sopenharmony_ci screen->get_device_node_mask = noop_get_device_node_mask; 806bf215546Sopenharmony_ci screen->query_dmabuf_modifiers = noop_query_dmabuf_modifiers; 807bf215546Sopenharmony_ci screen->resource_create_with_modifiers = noop_resource_create_with_modifiers; 808bf215546Sopenharmony_ci screen->create_vertex_state = noop_create_vertex_state; 809bf215546Sopenharmony_ci screen->vertex_state_destroy = noop_vertex_state_destroy; 810bf215546Sopenharmony_ci if (oscreen->get_sparse_texture_virtual_page_size) 811bf215546Sopenharmony_ci screen->get_sparse_texture_virtual_page_size = noop_get_sparse_texture_virtual_page_size; 812bf215546Sopenharmony_ci if (oscreen->set_fence_timeline_value) 813bf215546Sopenharmony_ci screen->set_fence_timeline_value = noop_set_fence_timeline_value; 814bf215546Sopenharmony_ci 815bf215546Sopenharmony_ci slab_create_parent(&noop_screen->pool_transfers, 816bf215546Sopenharmony_ci sizeof(struct pipe_transfer), 64); 817bf215546Sopenharmony_ci 818bf215546Sopenharmony_ci return screen; 819bf215546Sopenharmony_ci} 820