From b39bccbd4ed71e9585da4cf5acf7b887b2e90899 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sat, 5 Mar 2011 21:23:54 +0100 Subject: gallium: add timeout parameter to fence_finish This is a follow-up to the ARB_sync patch for st/mesa and completes the ARB_sync implementation. --- src/gallium/drivers/rbug/rbug_screen.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/gallium/drivers/rbug') diff --git a/src/gallium/drivers/rbug/rbug_screen.c b/src/gallium/drivers/rbug/rbug_screen.c index d635ce575c0..d8d23bcb9c5 100644 --- a/src/gallium/drivers/rbug/rbug_screen.c +++ b/src/gallium/drivers/rbug/rbug_screen.c @@ -256,14 +256,16 @@ rbug_screen_fence_signalled(struct pipe_screen *_screen, static int rbug_screen_fence_finish(struct pipe_screen *_screen, struct pipe_fence_handle *fence, - unsigned flags) + unsigned flags, + uint64_t timeout) { struct rbug_screen *rb_screen = rbug_screen(_screen); struct pipe_screen *screen = rb_screen->screen; return screen->fence_finish(screen, fence, - flags); + flags, + timeout); } boolean -- cgit v1.2.3 From 25485f4b69447514ab8b595aced90c75606a99bd Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Mon, 7 Mar 2011 22:35:49 +0100 Subject: gallium: kill is_resource_referenced Only st/xorg used it and even incorrectly with regards to pipelined transfers. --- src/gallium/auxiliary/util/u_resource.c | 8 ----- src/gallium/auxiliary/util/u_transfer.c | 7 ---- src/gallium/auxiliary/util/u_transfer.h | 12 ------- src/gallium/drivers/cell/ppu/cell_context.c | 14 -------- src/gallium/drivers/failover/fo_context.c | 13 ------- src/gallium/drivers/galahad/glhd_context.c | 18 ---------- src/gallium/drivers/i915/i915_resource.c | 1 - src/gallium/drivers/i915/i915_resource_buffer.c | 1 - src/gallium/drivers/i915/i915_resource_texture.c | 1 - src/gallium/drivers/i965/brw_resource_buffer.c | 20 ----------- src/gallium/drivers/i965/brw_resource_texture.c | 43 ------------------------ src/gallium/drivers/identity/id_context.c | 18 ---------- src/gallium/drivers/llvmpipe/lp_flush.c | 6 ++-- src/gallium/drivers/llvmpipe/lp_setup.c | 8 ++--- src/gallium/drivers/llvmpipe/lp_texture.c | 5 ++- src/gallium/drivers/llvmpipe/lp_texture.h | 10 ++++++ src/gallium/drivers/noop/noop_pipe.c | 8 ----- src/gallium/drivers/nouveau/nouveau_buffer.c | 1 - src/gallium/drivers/nouveau/nouveau_screen.c | 20 ----------- src/gallium/drivers/nouveau/nouveau_screen.h | 4 --- src/gallium/drivers/nv50/nv50_miptree.c | 1 - src/gallium/drivers/nv50/nv50_resource.c | 17 ---------- src/gallium/drivers/nvc0/nvc0_miptree.c | 1 - src/gallium/drivers/nvc0/nvc0_resource.c | 20 ----------- src/gallium/drivers/nvfx/nvfx_resource.c | 9 ----- src/gallium/drivers/r300/r300_resource.c | 8 ----- src/gallium/drivers/r300/r300_screen_buffer.c | 16 --------- src/gallium/drivers/r300/r300_screen_buffer.h | 3 -- src/gallium/drivers/r300/r300_texture.c | 1 - src/gallium/drivers/r600/r600_buffer.c | 9 ----- src/gallium/drivers/r600/r600_resource.c | 1 - src/gallium/drivers/r600/r600_texture.c | 9 ----- src/gallium/drivers/rbug/rbug_context.c | 18 ---------- src/gallium/drivers/softpipe/sp_context.c | 24 ++++++------- src/gallium/drivers/softpipe/sp_context.h | 9 +++++ src/gallium/drivers/softpipe/sp_flush.c | 10 +++--- src/gallium/drivers/svga/svga_resource.c | 1 - src/gallium/drivers/svga/svga_resource_buffer.c | 37 -------------------- src/gallium/drivers/svga/svga_resource_texture.c | 26 -------------- src/gallium/drivers/trace/tr_context.c | 26 -------------- src/gallium/include/pipe/p_context.h | 15 --------- src/gallium/include/pipe/p_defines.h | 7 ---- src/gallium/state_trackers/xorg/xorg_renderer.c | 4 --- src/gallium/state_trackers/xorg/xorg_xv.c | 16 --------- 44 files changed, 44 insertions(+), 462 deletions(-) (limited to 'src/gallium/drivers/rbug') diff --git a/src/gallium/auxiliary/util/u_resource.c b/src/gallium/auxiliary/util/u_resource.c index ea6896b430f..50a7cd4d55b 100644 --- a/src/gallium/auxiliary/util/u_resource.c +++ b/src/gallium/auxiliary/util/u_resource.c @@ -24,14 +24,6 @@ void u_resource_destroy_vtbl(struct pipe_screen *screen, ur->vtbl->resource_destroy(screen, resource); } -unsigned u_is_resource_referenced_vtbl( struct pipe_context *pipe, - struct pipe_resource *resource, - unsigned level, int layer) -{ - struct u_resource *ur = u_resource(resource); - return ur->vtbl->is_resource_referenced(pipe, resource, level, layer); -} - struct pipe_transfer *u_get_transfer_vtbl(struct pipe_context *context, struct pipe_resource *resource, unsigned level, diff --git a/src/gallium/auxiliary/util/u_transfer.c b/src/gallium/auxiliary/util/u_transfer.c index b6c63d9642f..7e72a59ee00 100644 --- a/src/gallium/auxiliary/util/u_transfer.c +++ b/src/gallium/auxiliary/util/u_transfer.c @@ -73,13 +73,6 @@ void u_default_transfer_flush_region( struct pipe_context *pipe, */ } -unsigned u_default_is_resource_referenced( struct pipe_context *pipe, - struct pipe_resource *resource, - unsigned level, int layer) -{ - return 0; -} - struct pipe_transfer * u_default_get_transfer(struct pipe_context *context, struct pipe_resource *resource, unsigned level, diff --git a/src/gallium/auxiliary/util/u_transfer.h b/src/gallium/auxiliary/util/u_transfer.h index 8cf9c418b04..5b5ddeb4aba 100644 --- a/src/gallium/auxiliary/util/u_transfer.h +++ b/src/gallium/auxiliary/util/u_transfer.h @@ -27,10 +27,6 @@ void u_default_transfer_flush_region( struct pipe_context *pipe, struct pipe_transfer *transfer, const struct pipe_box *box); -unsigned u_default_is_resource_referenced( struct pipe_context *pipe, - struct pipe_resource *resource, - unsigned level, int layer); - struct pipe_transfer * u_default_get_transfer(struct pipe_context *context, struct pipe_resource *resource, unsigned level, @@ -57,10 +53,6 @@ struct u_resource_vtbl { void (*resource_destroy)(struct pipe_screen *, struct pipe_resource *pt); - unsigned (*is_resource_referenced)(struct pipe_context *pipe, - struct pipe_resource *texture, - unsigned level, int layer); - struct pipe_transfer *(*get_transfer)(struct pipe_context *, struct pipe_resource *resource, unsigned level, @@ -104,10 +96,6 @@ boolean u_resource_get_handle_vtbl(struct pipe_screen *screen, void u_resource_destroy_vtbl(struct pipe_screen *screen, struct pipe_resource *resource); -unsigned u_is_resource_referenced_vtbl( struct pipe_context *pipe, - struct pipe_resource *resource, - unsigned level, int layer); - struct pipe_transfer *u_get_transfer_vtbl(struct pipe_context *context, struct pipe_resource *resource, unsigned level, diff --git a/src/gallium/drivers/cell/ppu/cell_context.c b/src/gallium/drivers/cell/ppu/cell_context.c index f9b83c8666c..58e647a39fa 100644 --- a/src/gallium/drivers/cell/ppu/cell_context.c +++ b/src/gallium/drivers/cell/ppu/cell_context.c @@ -104,18 +104,6 @@ static const struct debug_named_value cell_debug_flags[] = { DEBUG_NAMED_VALUE_END }; -static unsigned int -cell_is_resource_referenced( struct pipe_context *pipe, - struct pipe_resource *texture, - unsigned level, int layer) -{ - /** - * FIXME: Optimize. - */ - - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; -} - struct pipe_context * cell_create_context(struct pipe_screen *screen, @@ -140,8 +128,6 @@ cell_create_context(struct pipe_screen *screen, cell->pipe.clear = cell_clear; cell->pipe.flush = cell_flush; - cell->pipe.is_resource_referenced = cell_is_resource_referenced; - #if 0 cell->pipe.begin_query = cell_begin_query; cell->pipe.end_query = cell_end_query; diff --git a/src/gallium/drivers/failover/fo_context.c b/src/gallium/drivers/failover/fo_context.c index d60718d9716..b536dc4afab 100644 --- a/src/gallium/drivers/failover/fo_context.c +++ b/src/gallium/drivers/failover/fo_context.c @@ -93,18 +93,6 @@ static void failover_draw_vbo( struct pipe_context *pipe, } } -static unsigned int -failover_is_resource_referenced( struct pipe_context *_pipe, - struct pipe_resource *resource, - unsigned level, int layer) -{ - struct failover_context *failover = failover_context( _pipe ); - struct pipe_context *pipe = (failover->mode == FO_HW) ? - failover->hw : failover->sw; - - return pipe->is_resource_referenced(pipe, resource, level, layer); -} - struct pipe_context *failover_create( struct pipe_context *hw, struct pipe_context *sw ) { @@ -150,7 +138,6 @@ struct pipe_context *failover_create( struct pipe_context *hw, #endif failover->pipe.flush = hw->flush; - failover->pipe.is_resource_referenced = failover_is_resource_referenced; failover->dirty = 0; diff --git a/src/gallium/drivers/galahad/glhd_context.c b/src/gallium/drivers/galahad/glhd_context.c index 75e4c253dd9..1dc652c6bd9 100644 --- a/src/gallium/drivers/galahad/glhd_context.c +++ b/src/gallium/drivers/galahad/glhd_context.c @@ -772,23 +772,6 @@ galahad_flush(struct pipe_context *_pipe, fence); } -static unsigned int -galahad_is_resource_referenced(struct pipe_context *_pipe, - struct pipe_resource *_resource, - unsigned level, - int layer) -{ - struct galahad_context *glhd_pipe = galahad_context(_pipe); - struct galahad_resource *glhd_resource = galahad_resource(_resource); - struct pipe_context *pipe = glhd_pipe->pipe; - struct pipe_resource *resource = glhd_resource->resource; - - return pipe->is_resource_referenced(pipe, - resource, - level, - layer); -} - static struct pipe_sampler_view * galahad_context_create_sampler_view(struct pipe_context *_pipe, struct pipe_resource *_resource, @@ -1038,7 +1021,6 @@ galahad_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) glhd_pipe->base.clear_render_target = galahad_clear_render_target; glhd_pipe->base.clear_depth_stencil = galahad_clear_depth_stencil; glhd_pipe->base.flush = galahad_flush; - glhd_pipe->base.is_resource_referenced = galahad_is_resource_referenced; glhd_pipe->base.create_sampler_view = galahad_context_create_sampler_view; glhd_pipe->base.sampler_view_destroy = galahad_context_sampler_view_destroy; glhd_pipe->base.create_surface = galahad_context_create_surface; diff --git a/src/gallium/drivers/i915/i915_resource.c b/src/gallium/drivers/i915/i915_resource.c index 499233ceb9b..7f52ba11d61 100644 --- a/src/gallium/drivers/i915/i915_resource.c +++ b/src/gallium/drivers/i915/i915_resource.c @@ -31,7 +31,6 @@ i915_resource_from_handle(struct pipe_screen * screen, void i915_init_resource_functions(struct i915_context *i915 ) { - i915->base.is_resource_referenced = u_default_is_resource_referenced; i915->base.get_transfer = u_get_transfer_vtbl; i915->base.transfer_map = u_transfer_map_vtbl; i915->base.transfer_flush_region = u_transfer_flush_region_vtbl; diff --git a/src/gallium/drivers/i915/i915_resource_buffer.c b/src/gallium/drivers/i915/i915_resource_buffer.c index 51482f54fc4..77c03450b3a 100644 --- a/src/gallium/drivers/i915/i915_resource_buffer.c +++ b/src/gallium/drivers/i915/i915_resource_buffer.c @@ -123,7 +123,6 @@ struct u_resource_vtbl i915_buffer_vtbl = { i915_buffer_get_handle, /* get_handle */ i915_buffer_destroy, /* resource_destroy */ - NULL, /* is_resource_referenced */ i915_get_transfer, /* get_transfer */ i915_transfer_destroy, /* transfer_destroy */ i915_buffer_transfer_map, /* transfer_map */ diff --git a/src/gallium/drivers/i915/i915_resource_texture.c b/src/gallium/drivers/i915/i915_resource_texture.c index aad5235a6ad..df60493b5e4 100644 --- a/src/gallium/drivers/i915/i915_resource_texture.c +++ b/src/gallium/drivers/i915/i915_resource_texture.c @@ -781,7 +781,6 @@ struct u_resource_vtbl i915_texture_vtbl = { i915_texture_get_handle, /* get_handle */ i915_texture_destroy, /* resource_destroy */ - NULL, /* is_resource_referenced */ i915_texture_get_transfer, /* get_transfer */ i915_transfer_destroy, /* transfer_destroy */ i915_texture_transfer_map, /* transfer_map */ diff --git a/src/gallium/drivers/i965/brw_resource_buffer.c b/src/gallium/drivers/i965/brw_resource_buffer.c index afb96ee3e7f..32dc54f2b26 100644 --- a/src/gallium/drivers/i965/brw_resource_buffer.c +++ b/src/gallium/drivers/i965/brw_resource_buffer.c @@ -91,30 +91,10 @@ brw_buffer_transfer_unmap( struct pipe_context *pipe, } -static unsigned brw_buffer_is_referenced( struct pipe_context *pipe, - struct pipe_resource *resource, - unsigned level, - int layer) -{ - struct brw_context *brw = brw_context(pipe); - struct brw_winsys_buffer *batch_bo = brw->batch->buf; - struct brw_buffer *buf = brw_buffer(resource); - - if (buf->bo == NULL) - return PIPE_UNREFERENCED; - - if (!brw_screen(pipe->screen)->sws->bo_references( batch_bo, buf->bo )) - return PIPE_UNREFERENCED; - - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; -} - - struct u_resource_vtbl brw_buffer_vtbl = { brw_buffer_get_handle, /* get_handle */ brw_buffer_destroy, /* resource_destroy */ - brw_buffer_is_referenced, /* is_resource_referenced */ u_default_get_transfer, /* get_transfer */ u_default_transfer_destroy, /* transfer_destroy */ brw_buffer_transfer_map, /* transfer_map */ diff --git a/src/gallium/drivers/i965/brw_resource_texture.c b/src/gallium/drivers/i965/brw_resource_texture.c index 0cb895f35de..71a18290248 100644 --- a/src/gallium/drivers/i965/brw_resource_texture.c +++ b/src/gallium/drivers/i965/brw_resource_texture.c @@ -225,48 +225,6 @@ static void brw_texture_destroy(struct pipe_screen *screen, } - - -static unsigned brw_texture_is_referenced( struct pipe_context *pipe, - struct pipe_resource *texture, - unsigned level, - int layer ) -{ - struct brw_context *brw = brw_context(pipe); - struct brw_screen *bscreen = brw_screen(pipe->screen); - struct brw_winsys_buffer *batch_bo = brw->batch->buf; - struct brw_texture *tex = brw_texture(texture); - struct brw_surface *surf; - int i; - - /* XXX: this is subject to false positives if the underlying - * texture BO is referenced, we can't tell whether the sub-region - * we care about participates in that. - */ - if (bscreen->sws->bo_references( batch_bo, tex->bo )) - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; - - /* Find any view on this texture for this level/layer and see if it - * is referenced: - */ - for (i = 0; i < 2; i++) { - foreach (surf, &tex->views[i]) { - if (surf->bo == tex->bo) - continue; - - if (!(layer == -1 || surf->id.bits.layer == layer) || - surf->id.bits.level != level) - continue; - - if (bscreen->sws->bo_references( batch_bo, surf->bo)) - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; - } - } - - return PIPE_UNREFERENCED; -} - - /* * Transfer functions */ @@ -347,7 +305,6 @@ struct u_resource_vtbl brw_texture_vtbl = { brw_texture_get_handle, /* get_handle */ brw_texture_destroy, /* resource_destroy */ - brw_texture_is_referenced, /* is_resource_referenced */ brw_texture_get_transfer, /* get_transfer */ u_default_transfer_destroy, /* transfer_destroy */ brw_texture_transfer_map, /* transfer_map */ diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c index b533abe24c6..5c865f8a22c 100644 --- a/src/gallium/drivers/identity/id_context.c +++ b/src/gallium/drivers/identity/id_context.c @@ -679,23 +679,6 @@ identity_flush(struct pipe_context *_pipe, fence); } -static unsigned int -identity_is_resource_referenced(struct pipe_context *_pipe, - struct pipe_resource *_resource, - unsigned level, - int layer) -{ - struct identity_context *id_pipe = identity_context(_pipe); - struct identity_resource *id_resource = identity_resource(_resource); - struct pipe_context *pipe = id_pipe->pipe; - struct pipe_resource *resource = id_resource->resource; - - return pipe->is_resource_referenced(pipe, - resource, - level, - layer); -} - static struct pipe_sampler_view * identity_context_create_sampler_view(struct pipe_context *_pipe, struct pipe_resource *_resource, @@ -931,7 +914,6 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) id_pipe->base.clear_render_target = identity_clear_render_target; id_pipe->base.clear_depth_stencil = identity_clear_depth_stencil; id_pipe->base.flush = identity_flush; - id_pipe->base.is_resource_referenced = identity_is_resource_referenced; id_pipe->base.create_surface = identity_context_create_surface; id_pipe->base.surface_destroy = identity_context_surface_destroy; id_pipe->base.create_sampler_view = identity_context_create_sampler_view; diff --git a/src/gallium/drivers/llvmpipe/lp_flush.c b/src/gallium/drivers/llvmpipe/lp_flush.c index 6118164b20b..343c6145e7e 100644 --- a/src/gallium/drivers/llvmpipe/lp_flush.c +++ b/src/gallium/drivers/llvmpipe/lp_flush.c @@ -118,10 +118,10 @@ llvmpipe_flush_resource(struct pipe_context *pipe, { unsigned referenced; - referenced = pipe->is_resource_referenced(pipe, resource, level, layer); + referenced = llvmpipe_is_resource_referenced(pipe, resource, level, layer); - if ((referenced & PIPE_REFERENCED_FOR_WRITE) || - ((referenced & PIPE_REFERENCED_FOR_READ) && !read_only)) { + if ((referenced & LP_REFERENCED_FOR_WRITE) || + ((referenced & LP_REFERENCED_FOR_READ) && !read_only)) { if (cpu_access) { /* diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 7b7b2721ba8..41d8fa6d124 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -753,20 +753,20 @@ lp_setup_is_resource_referenced( const struct lp_setup_context *setup, /* check the render targets */ for (i = 0; i < setup->fb.nr_cbufs; i++) { if (setup->fb.cbufs[i]->texture == texture) - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; + return LP_REFERENCED_FOR_READ | LP_REFERENCED_FOR_WRITE; } if (setup->fb.zsbuf && setup->fb.zsbuf->texture == texture) { - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; + return LP_REFERENCED_FOR_READ | LP_REFERENCED_FOR_WRITE; } /* check textures referenced by the scene */ for (i = 0; i < Elements(setup->scenes); i++) { if (lp_scene_is_resource_referenced(setup->scenes[i], texture)) { - return PIPE_REFERENCED_FOR_READ; + return LP_REFERENCED_FOR_READ; } } - return PIPE_UNREFERENCED; + return LP_UNREFERENCED; } diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index 9753da5e57e..2e6a4bd7dc8 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -695,7 +695,7 @@ llvmpipe_transfer_unmap(struct pipe_context *pipe, transfer->box.z); } -static unsigned int +unsigned int llvmpipe_is_resource_referenced( struct pipe_context *pipe, struct pipe_resource *presource, unsigned level, int layer) @@ -703,7 +703,7 @@ llvmpipe_is_resource_referenced( struct pipe_context *pipe, struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe ); if (presource->target == PIPE_BUFFER) - return PIPE_UNREFERENCED; + return LP_UNREFERENCED; return lp_setup_is_resource_referenced(llvmpipe->setup, presource); } @@ -1401,7 +1401,6 @@ llvmpipe_init_context_resource_funcs(struct pipe_context *pipe) pipe->transfer_destroy = llvmpipe_transfer_destroy; pipe->transfer_map = llvmpipe_transfer_map; pipe->transfer_unmap = llvmpipe_transfer_unmap; - pipe->is_resource_referenced = llvmpipe_is_resource_referenced; pipe->transfer_flush_region = u_default_transfer_flush_region; pipe->transfer_inline_write = u_default_transfer_inline_write; diff --git a/src/gallium/drivers/llvmpipe/lp_texture.h b/src/gallium/drivers/llvmpipe/lp_texture.h index b789c0f4090..b4a0dfd1c36 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.h +++ b/src/gallium/drivers/llvmpipe/lp_texture.h @@ -243,4 +243,14 @@ llvmpipe_init_screen_texture_funcs(struct pipe_screen *screen); extern void llvmpipe_init_context_texture_funcs(struct pipe_context *pipe); + +#define LP_UNREFERENCED 0 +#define LP_REFERENCED_FOR_READ (1 << 0) +#define LP_REFERENCED_FOR_WRITE (1 << 1) + +unsigned int +llvmpipe_is_resource_referenced( struct pipe_context *pipe, + struct pipe_resource *presource, + unsigned level, int layer); + #endif /* LP_TEXTURE_H */ diff --git a/src/gallium/drivers/noop/noop_pipe.c b/src/gallium/drivers/noop/noop_pipe.c index 3680f4622da..90b6ebf36b5 100644 --- a/src/gallium/drivers/noop/noop_pipe.c +++ b/src/gallium/drivers/noop/noop_pipe.c @@ -87,13 +87,6 @@ struct noop_resource { struct sw_displaytarget *dt; }; -static unsigned noop_is_resource_referenced(struct pipe_context *pipe, - struct pipe_resource *resource, - unsigned level, int layer) -{ - return PIPE_UNREFERENCED; -} - static struct pipe_resource *noop_resource_create(struct pipe_screen *screen, const struct pipe_resource *templ) { @@ -303,7 +296,6 @@ static struct pipe_context *noop_create_context(struct pipe_screen *screen, void ctx->transfer_unmap = noop_transfer_unmap; ctx->transfer_destroy = noop_transfer_destroy; ctx->transfer_inline_write = noop_transfer_inline_write; - ctx->is_resource_referenced = noop_is_resource_referenced; noop_init_state_functions(ctx); return ctx; diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c index d0cc29104b8..01d3aa46d0e 100644 --- a/src/gallium/drivers/nouveau/nouveau_buffer.c +++ b/src/gallium/drivers/nouveau/nouveau_buffer.c @@ -314,7 +314,6 @@ const struct u_resource_vtbl nouveau_buffer_vtbl = { u_default_resource_get_handle, /* get_handle */ nouveau_buffer_destroy, /* resource_destroy */ - NULL, /* is_resource_referenced */ nouveau_buffer_transfer_get, /* get_transfer */ nouveau_buffer_transfer_destroy, /* transfer_destroy */ nouveau_buffer_transfer_map, /* transfer_map */ diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c index 3111bef7a22..d6c2a0a199a 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.c +++ b/src/gallium/drivers/nouveau/nouveau_screen.c @@ -211,26 +211,6 @@ nouveau_screen_bo_get_handle(struct pipe_screen *pscreen, } } - -unsigned int -nouveau_reference_flags(struct nouveau_bo *bo) -{ - uint32_t bo_flags; - int flags = 0; - - bo_flags = nouveau_bo_pending(bo); - if (bo_flags & NOUVEAU_BO_RD) - flags |= PIPE_REFERENCED_FOR_READ; - if (bo_flags & NOUVEAU_BO_WR) - flags |= PIPE_REFERENCED_FOR_WRITE; - - return flags; -} - - - - - int nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev) { diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h b/src/gallium/drivers/nouveau/nouveau_screen.h index c091abf2786..186ada39677 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.h +++ b/src/gallium/drivers/nouveau/nouveau_screen.h @@ -74,10 +74,6 @@ nouveau_screen_bo_from_handle(struct pipe_screen *pscreen, struct winsys_handle *whandle, unsigned *out_stride); -unsigned int -nouveau_reference_flags(struct nouveau_bo *bo); - - int nouveau_screen_init(struct nouveau_screen *, struct nouveau_device *); void nouveau_screen_fini(struct nouveau_screen *); diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c index ae6b26af1eb..9eeca05ada3 100644 --- a/src/gallium/drivers/nv50/nv50_miptree.c +++ b/src/gallium/drivers/nv50/nv50_miptree.c @@ -106,7 +106,6 @@ const struct u_resource_vtbl nv50_miptree_vtbl = { nv50_miptree_get_handle, /* get_handle */ nv50_miptree_destroy, /* resource_destroy */ - NULL, /* is_resource_referenced */ nv50_miptree_transfer_new, /* get_transfer */ nv50_miptree_transfer_del, /* transfer_destroy */ nv50_miptree_transfer_map, /* transfer_map */ diff --git a/src/gallium/drivers/nv50/nv50_resource.c b/src/gallium/drivers/nv50/nv50_resource.c index 2a2fb0e32bc..1ae4d70a845 100644 --- a/src/gallium/drivers/nv50/nv50_resource.c +++ b/src/gallium/drivers/nv50/nv50_resource.c @@ -3,22 +3,6 @@ #include "nv50_resource.h" #include "nouveau/nouveau_screen.h" -static unsigned -nv50_resource_is_referenced(struct pipe_context *pipe, - struct pipe_resource *resource, - unsigned face, int layer) -{ - struct nv04_resource *res = nv04_resource(resource); - unsigned flags = 0; - unsigned bo_flags = nouveau_bo_pending(res->bo); - - if (bo_flags & NOUVEAU_BO_RD) - flags = PIPE_REFERENCED_FOR_READ; - if (bo_flags & NOUVEAU_BO_WR) - flags |= PIPE_REFERENCED_FOR_WRITE; - - return flags; -} static struct pipe_resource * nv50_resource_create(struct pipe_screen *screen, @@ -52,7 +36,6 @@ nv50_init_resource_functions(struct pipe_context *pcontext) pcontext->transfer_unmap = u_transfer_unmap_vtbl; pcontext->transfer_destroy = u_transfer_destroy_vtbl; pcontext->transfer_inline_write = u_transfer_inline_write_vtbl; - pcontext->is_resource_referenced = nv50_resource_is_referenced; pcontext->create_surface = nv50_miptree_surface_new; pcontext->surface_destroy = nv50_miptree_surface_del; } diff --git a/src/gallium/drivers/nvc0/nvc0_miptree.c b/src/gallium/drivers/nvc0/nvc0_miptree.c index db9117c3ff1..bced3245524 100644 --- a/src/gallium/drivers/nvc0/nvc0_miptree.c +++ b/src/gallium/drivers/nvc0/nvc0_miptree.c @@ -114,7 +114,6 @@ const struct u_resource_vtbl nvc0_miptree_vtbl = { nvc0_miptree_get_handle, /* get_handle */ nvc0_miptree_destroy, /* resource_destroy */ - NULL, /* is_resource_referenced */ nvc0_miptree_transfer_new, /* get_transfer */ nvc0_miptree_transfer_del, /* transfer_destroy */ nvc0_miptree_transfer_map, /* transfer_map */ diff --git a/src/gallium/drivers/nvc0/nvc0_resource.c b/src/gallium/drivers/nvc0/nvc0_resource.c index fb5a496b84b..44e66314e7e 100644 --- a/src/gallium/drivers/nvc0/nvc0_resource.c +++ b/src/gallium/drivers/nvc0/nvc0_resource.c @@ -3,25 +3,6 @@ #include "nvc0_resource.h" #include "nouveau/nouveau_screen.h" -static unsigned -nvc0_resource_is_referenced(struct pipe_context *pipe, - struct pipe_resource *resource, - unsigned face, int layer) -{ - struct nv04_resource *res = nv04_resource(resource); - unsigned flags = 0; - -#ifdef NOUVEAU_USERSPACE_MM - flags = res->status; -#else - unsigned bo_flags = nouveau_bo_pending(res->bo); - if (bo_flags & NOUVEAU_BO_RD) - flags = PIPE_REFERENCED_FOR_READ; - if (bo_flags & NOUVEAU_BO_WR) - flags |= PIPE_REFERENCED_FOR_WRITE; -#endif - return flags; -} static struct pipe_resource * nvc0_resource_create(struct pipe_screen *screen, @@ -55,7 +36,6 @@ nvc0_init_resource_functions(struct pipe_context *pcontext) pcontext->transfer_unmap = u_transfer_unmap_vtbl; pcontext->transfer_destroy = u_transfer_destroy_vtbl; pcontext->transfer_inline_write = u_transfer_inline_write_vtbl; - pcontext->is_resource_referenced = nvc0_resource_is_referenced; pcontext->create_surface = nvc0_miptree_surface_new; pcontext->surface_destroy = nvc0_miptree_surface_del; } diff --git a/src/gallium/drivers/nvfx/nvfx_resource.c b/src/gallium/drivers/nvfx/nvfx_resource.c index c60a7bb8b93..42e77c53621 100644 --- a/src/gallium/drivers/nvfx/nvfx_resource.c +++ b/src/gallium/drivers/nvfx/nvfx_resource.c @@ -4,13 +4,6 @@ #include "nvfx_resource.h" #include "nouveau/nouveau_screen.h" -static unsigned int -nvfx_resource_is_referenced(struct pipe_context *pipe, - struct pipe_resource *pr, - unsigned level, int layer) -{ - return !!nouveau_reference_flags(nvfx_resource(pr)->bo); -} static struct pipe_resource * nvfx_resource_create(struct pipe_screen *screen, @@ -58,8 +51,6 @@ nvfx_resource_get_handle(struct pipe_screen *pscreen, void nvfx_init_resource_functions(struct pipe_context *pipe) { - pipe->is_resource_referenced = nvfx_resource_is_referenced; - pipe->create_surface = nvfx_miptree_surface_new; pipe->surface_destroy = nvfx_miptree_surface_del; } diff --git a/src/gallium/drivers/r300/r300_resource.c b/src/gallium/drivers/r300/r300_resource.c index f3d8c5b889f..6593474b1f0 100644 --- a/src/gallium/drivers/r300/r300_resource.c +++ b/src/gallium/drivers/r300/r300_resource.c @@ -38,13 +38,6 @@ r300_resource_create(struct pipe_screen *screen, } -static unsigned r300_resource_is_referenced_by_cs(struct pipe_context *context, - struct pipe_resource *buf, - unsigned level, int layer) -{ - return r300_buffer_is_referenced(context, buf); -} - void r300_init_resource_functions(struct r300_context *r300) { r300->context.get_transfer = u_get_transfer_vtbl; @@ -53,7 +46,6 @@ void r300_init_resource_functions(struct r300_context *r300) r300->context.transfer_unmap = u_transfer_unmap_vtbl; r300->context.transfer_destroy = u_transfer_destroy_vtbl; r300->context.transfer_inline_write = u_transfer_inline_write_vtbl; - r300->context.is_resource_referenced = r300_resource_is_referenced_by_cs; r300->context.create_surface = r300_create_surface; r300->context.surface_destroy = r300_surface_destroy; } diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c index 1045911f3ae..986ae384fbf 100644 --- a/src/gallium/drivers/r300/r300_screen_buffer.c +++ b/src/gallium/drivers/r300/r300_screen_buffer.c @@ -33,21 +33,6 @@ #include "r300_screen_buffer.h" #include "r300_winsys.h" -unsigned r300_buffer_is_referenced(struct pipe_context *context, - struct pipe_resource *buf) -{ - struct r300_context *r300 = r300_context(context); - struct r300_resource *rbuf = r300_resource(buf); - - if (rbuf->b.user_ptr || rbuf->constant_buffer) - return PIPE_UNREFERENCED; - - if (r300->rws->cs_is_buffer_referenced(r300->cs, rbuf->cs_buf)) - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; - - return PIPE_UNREFERENCED; -} - void r300_upload_index_buffer(struct r300_context *r300, struct pipe_resource **index_buffer, unsigned index_size, unsigned *start, @@ -181,7 +166,6 @@ static const struct u_resource_vtbl r300_buffer_vtbl = { NULL, /* get_handle */ r300_buffer_destroy, /* resource_destroy */ - NULL, /* is_buffer_referenced */ r300_buffer_get_transfer, /* get_transfer */ r300_buffer_transfer_destroy, /* transfer_destroy */ r300_buffer_transfer_map, /* transfer_map */ diff --git a/src/gallium/drivers/r300/r300_screen_buffer.h b/src/gallium/drivers/r300/r300_screen_buffer.h index 14bee460d5b..cdbc4425fcb 100644 --- a/src/gallium/drivers/r300/r300_screen_buffer.h +++ b/src/gallium/drivers/r300/r300_screen_buffer.h @@ -49,9 +49,6 @@ struct pipe_resource *r300_user_buffer_create(struct pipe_screen *screen, void *ptr, unsigned size, unsigned bind); -unsigned r300_buffer_is_referenced(struct pipe_context *context, - struct pipe_resource *buf); - /* Inline functions. */ static INLINE struct r300_buffer *r300_buffer(struct pipe_resource *buffer) diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 70f087a4efa..c650fb7ed37 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -752,7 +752,6 @@ static const struct u_resource_vtbl r300_texture_vtbl = { NULL, /* get_handle */ r300_texture_destroy, /* resource_destroy */ - NULL, /* is_resource_referenced */ r300_texture_get_transfer, /* get_transfer */ r300_texture_transfer_destroy, /* transfer_destroy */ r300_texture_transfer_map, /* transfer_map */ diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c index 2363cd1ebc5..6ced719c8f0 100644 --- a/src/gallium/drivers/r600/r600_buffer.c +++ b/src/gallium/drivers/r600/r600_buffer.c @@ -52,14 +52,6 @@ static void r600_buffer_destroy(struct pipe_screen *screen, util_slab_free(&rscreen->pool_buffers, rbuffer); } -static unsigned r600_buffer_is_referenced_by_cs(struct pipe_context *context, - struct pipe_resource *buf, - unsigned level, int layer) -{ - /* FIXME */ - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; -} - static struct pipe_transfer *r600_get_transfer(struct pipe_context *ctx, struct pipe_resource *resource, unsigned level, @@ -160,7 +152,6 @@ static const struct u_resource_vtbl r600_buffer_vtbl = { u_default_resource_get_handle, /* get_handle */ r600_buffer_destroy, /* resource_destroy */ - r600_buffer_is_referenced_by_cs, /* is_buffer_referenced */ r600_get_transfer, /* get_transfer */ r600_transfer_destroy, /* transfer_destroy */ r600_buffer_transfer_map, /* transfer_map */ diff --git a/src/gallium/drivers/r600/r600_resource.c b/src/gallium/drivers/r600/r600_resource.c index 207642ccfa9..f3ab3613c84 100644 --- a/src/gallium/drivers/r600/r600_resource.c +++ b/src/gallium/drivers/r600/r600_resource.c @@ -61,5 +61,4 @@ void r600_init_context_resource_functions(struct r600_pipe_context *r600) r600->context.transfer_unmap = u_transfer_unmap_vtbl; r600->context.transfer_destroy = u_transfer_destroy_vtbl; r600->context.transfer_inline_write = u_transfer_inline_write_vtbl; - r600->context.is_resource_referenced = u_is_resource_referenced_vtbl; } diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index df83302b38e..10b6c0cff70 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -340,19 +340,10 @@ static void r600_texture_destroy(struct pipe_screen *screen, FREE(rtex); } -static unsigned int r600_texture_is_referenced(struct pipe_context *context, - struct pipe_resource *texture, - unsigned level, int layer) -{ - /* FIXME */ - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; -} - static const struct u_resource_vtbl r600_texture_vtbl = { r600_texture_get_handle, /* get_handle */ r600_texture_destroy, /* resource_destroy */ - r600_texture_is_referenced, /* is_resource_referenced */ r600_texture_get_transfer, /* get_transfer */ r600_texture_transfer_destroy, /* transfer_destroy */ r600_texture_transfer_map, /* transfer_map */ diff --git a/src/gallium/drivers/rbug/rbug_context.c b/src/gallium/drivers/rbug/rbug_context.c index 4a5d5413d8c..f5e2d5f4d62 100644 --- a/src/gallium/drivers/rbug/rbug_context.c +++ b/src/gallium/drivers/rbug/rbug_context.c @@ -812,23 +812,6 @@ rbug_flush(struct pipe_context *_pipe, fence); } -static unsigned int -rbug_is_resource_referenced(struct pipe_context *_pipe, - struct pipe_resource *_resource, - unsigned level, - int layer) -{ - struct rbug_context *rb_pipe = rbug_context(_pipe); - struct rbug_resource *rb_resource = rbug_resource(_resource); - struct pipe_context *pipe = rb_pipe->pipe; - struct pipe_resource *resource = rb_resource->resource; - - return pipe->is_resource_referenced(pipe, - resource, - level, - layer); -} - static struct pipe_sampler_view * rbug_context_create_sampler_view(struct pipe_context *_pipe, struct pipe_resource *_resource, @@ -1077,7 +1060,6 @@ rbug_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) rb_pipe->base.clear_render_target = rbug_clear_render_target; rb_pipe->base.clear_depth_stencil = rbug_clear_depth_stencil; rb_pipe->base.flush = rbug_flush; - rb_pipe->base.is_resource_referenced = rbug_is_resource_referenced; rb_pipe->base.create_sampler_view = rbug_context_create_sampler_view; rb_pipe->base.sampler_view_destroy = rbug_context_sampler_view_destroy; rb_pipe->base.create_surface = rbug_context_create_surface; diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 70fdfb7ddf3..5ea2ee58219 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -148,13 +148,13 @@ softpipe_destroy( struct pipe_context *pipe ) /** * if (the texture is being used as a framebuffer surface) - * return PIPE_REFERENCED_FOR_WRITE + * return SP_REFERENCED_FOR_WRITE * else if (the texture is a bound texture source) - * return PIPE_REFERENCED_FOR_READ + * return SP_REFERENCED_FOR_READ * else - * return PIPE_UNREFERENCED + * return SP_UNREFERENCED */ -static unsigned int +unsigned int softpipe_is_resource_referenced( struct pipe_context *pipe, struct pipe_resource *texture, unsigned level, int layer) @@ -163,19 +163,19 @@ softpipe_is_resource_referenced( struct pipe_context *pipe, unsigned i; if (texture->target == PIPE_BUFFER) - return PIPE_UNREFERENCED; + return SP_UNREFERENCED; /* check if any of the bound drawing surfaces are this texture */ if (softpipe->dirty_render_cache) { for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) { if (softpipe->framebuffer.cbufs[i] && softpipe->framebuffer.cbufs[i]->texture == texture) { - return PIPE_REFERENCED_FOR_WRITE; + return SP_REFERENCED_FOR_WRITE; } } if (softpipe->framebuffer.zsbuf && softpipe->framebuffer.zsbuf->texture == texture) { - return PIPE_REFERENCED_FOR_WRITE; + return SP_REFERENCED_FOR_WRITE; } } @@ -183,20 +183,20 @@ softpipe_is_resource_referenced( struct pipe_context *pipe, for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { if (softpipe->fragment_tex_cache[i] && softpipe->fragment_tex_cache[i]->texture == texture) - return PIPE_REFERENCED_FOR_READ; + return SP_REFERENCED_FOR_READ; } for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { if (softpipe->vertex_tex_cache[i] && softpipe->vertex_tex_cache[i]->texture == texture) - return PIPE_REFERENCED_FOR_READ; + return SP_REFERENCED_FOR_READ; } for (i = 0; i < PIPE_MAX_GEOMETRY_SAMPLERS; i++) { if (softpipe->geometry_tex_cache[i] && softpipe->geometry_tex_cache[i]->texture == texture) - return PIPE_REFERENCED_FOR_READ; + return SP_REFERENCED_FOR_READ; } - return PIPE_UNREFERENCED; + return SP_UNREFERENCED; } @@ -257,8 +257,6 @@ softpipe_create_context( struct pipe_screen *screen, softpipe->pipe.clear = softpipe_clear; softpipe->pipe.flush = softpipe_flush; - softpipe->pipe.is_resource_referenced = softpipe_is_resource_referenced; - softpipe->pipe.render_condition = softpipe_render_condition; /* diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h index c91709aef06..a572ee8cf00 100644 --- a/src/gallium/drivers/softpipe/sp_context.h +++ b/src/gallium/drivers/softpipe/sp_context.h @@ -198,4 +198,13 @@ struct pipe_context * softpipe_create_context( struct pipe_screen *, void *priv ); +#define SP_UNREFERENCED 0 +#define SP_REFERENCED_FOR_READ (1 << 0) +#define SP_REFERENCED_FOR_WRITE (1 << 1) + +unsigned int +softpipe_is_resource_referenced( struct pipe_context *pipe, + struct pipe_resource *texture, + unsigned level, int layer); + #endif /* SP_CONTEXT_H */ diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c index 00a2fafdfa2..f16751a2163 100644 --- a/src/gallium/drivers/softpipe/sp_flush.c +++ b/src/gallium/drivers/softpipe/sp_flush.c @@ -129,20 +129,20 @@ softpipe_flush_resource(struct pipe_context *pipe, { unsigned referenced; - referenced = pipe->is_resource_referenced(pipe, texture, level, layer); + referenced = softpipe_is_resource_referenced(pipe, texture, level, layer); - if ((referenced & PIPE_REFERENCED_FOR_WRITE) || - ((referenced & PIPE_REFERENCED_FOR_READ) && !read_only)) { + if ((referenced & SP_REFERENCED_FOR_WRITE) || + ((referenced & SP_REFERENCED_FOR_READ) && !read_only)) { /* * TODO: The semantics of these flush flags are too obtuse. They should * disappear and the pipe driver should just ensure that all visible * side-effects happen when they need to happen. */ - if (referenced & PIPE_REFERENCED_FOR_WRITE) + if (referenced & SP_REFERENCED_FOR_WRITE) flush_flags |= PIPE_FLUSH_RENDER_CACHE; - if (referenced & PIPE_REFERENCED_FOR_READ) + if (referenced & SP_REFERENCED_FOR_READ) flush_flags |= PIPE_FLUSH_TEXTURE_CACHE; if (cpu_access) { diff --git a/src/gallium/drivers/svga/svga_resource.c b/src/gallium/drivers/svga/svga_resource.c index bed15ec02e5..6e0622a312b 100644 --- a/src/gallium/drivers/svga/svga_resource.c +++ b/src/gallium/drivers/svga/svga_resource.c @@ -33,7 +33,6 @@ svga_resource_from_handle(struct pipe_screen * screen, void svga_init_resource_functions(struct svga_context *svga) { - svga->pipe.is_resource_referenced = u_is_resource_referenced_vtbl; svga->pipe.get_transfer = u_get_transfer_vtbl; svga->pipe.transfer_map = u_transfer_map_vtbl; svga->pipe.transfer_flush_region = u_transfer_flush_region_vtbl; diff --git a/src/gallium/drivers/svga/svga_resource_buffer.c b/src/gallium/drivers/svga/svga_resource_buffer.c index e1f07d655b9..b0e6d96b738 100644 --- a/src/gallium/drivers/svga/svga_resource_buffer.c +++ b/src/gallium/drivers/svga/svga_resource_buffer.c @@ -51,42 +51,6 @@ svga_buffer_needs_hw_storage(unsigned usage) } -static unsigned int -svga_buffer_is_referenced( struct pipe_context *pipe, - struct pipe_resource *buf, - unsigned level, int layer) -{ - struct svga_screen *ss = svga_screen(pipe->screen); - struct svga_buffer *sbuf = svga_buffer(buf); - - /** - * XXX: Check this. - * The screen may cache buffer writes, but when we map, we map out - * of those cached writes, so we don't need to set a - * PIPE_REFERENCED_FOR_WRITE flag for cached buffers. - */ - - if (!sbuf->handle || ss->sws->surface_is_flushed(ss->sws, sbuf->handle)) - return PIPE_UNREFERENCED; - - /** - * sws->surface_is_flushed() does not distinguish between read references - * and write references. So assume a reference is both, - * however, we make an exception for index- and vertex buffers, to avoid - * a flush in st_bufferobj_get_subdata, during display list replay. - */ - - if (sbuf->b.b.bind & (PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER)) - return PIPE_REFERENCED_FOR_READ; - - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; -} - - - - - - static void * svga_buffer_map_range( struct pipe_screen *screen, struct pipe_resource *buf, @@ -274,7 +238,6 @@ struct u_resource_vtbl svga_buffer_vtbl = { u_default_resource_get_handle, /* get_handle */ svga_buffer_destroy, /* resource_destroy */ - svga_buffer_is_referenced, /* is_resource_referenced */ u_default_get_transfer, /* get_transfer */ u_default_transfer_destroy, /* transfer_destroy */ svga_buffer_transfer_map, /* transfer_map */ diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c index f882bfef598..b61f85955a2 100644 --- a/src/gallium/drivers/svga/svga_resource_texture.c +++ b/src/gallium/drivers/svga/svga_resource_texture.c @@ -48,31 +48,6 @@ #define SVGA3D_SURFACE_HINT_SCANOUT (1 << 9) -static unsigned int -svga_texture_is_referenced( struct pipe_context *pipe, - struct pipe_resource *texture, - unsigned level, int layer) -{ - struct svga_texture *tex = svga_texture(texture); - struct svga_screen *ss = svga_screen(pipe->screen); - - /** - * The screen does not cache texture writes. - */ - - if (!tex->handle || ss->sws->surface_is_flushed(ss->sws, tex->handle)) - return PIPE_UNREFERENCED; - - /** - * sws->surface_is_flushed() does not distinguish between read references - * and write references. So assume a reference is both. - */ - - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; -} - - - /* * Helper function and arrays */ @@ -505,7 +480,6 @@ struct u_resource_vtbl svga_texture_vtbl = { svga_texture_get_handle, /* get_handle */ svga_texture_destroy, /* resource_destroy */ - svga_texture_is_referenced, /* is_resource_referenced */ svga_texture_get_transfer, /* get_transfer */ svga_texture_transfer_destroy, /* transfer_destroy */ svga_texture_transfer_map, /* transfer_map */ diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index d24cc623c2e..6123873cac6 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -1219,31 +1219,6 @@ trace_context_destroy(struct pipe_context *_pipe) FREE(tr_ctx); } -static unsigned int -trace_is_resource_referenced( struct pipe_context *_pipe, - struct pipe_resource *_resource, - unsigned level, int layer) -{ - struct trace_context *tr_ctx = trace_context(_pipe); - struct trace_resource *tr_tex = trace_resource(_resource); - struct pipe_context *pipe = tr_ctx->pipe; - struct pipe_resource *texture = tr_tex->resource; - unsigned int referenced; - - trace_dump_call_begin("pipe_context", "is_resource_referenced"); - trace_dump_arg(ptr, pipe); - trace_dump_arg(ptr, texture); - trace_dump_arg(uint, level); - trace_dump_arg(int, layer); - - referenced = pipe->is_resource_referenced(pipe, texture, level, layer); - - trace_dump_ret(uint, referenced); - trace_dump_call_end(); - - return referenced; -} - /******************************************************************** * transfer @@ -1520,7 +1495,6 @@ trace_context_create(struct trace_screen *tr_scr, tr_ctx->base.clear_render_target = trace_context_clear_render_target; tr_ctx->base.clear_depth_stencil = trace_context_clear_depth_stencil; tr_ctx->base.flush = trace_context_flush; - tr_ctx->base.is_resource_referenced = trace_is_resource_referenced; tr_ctx->base.get_transfer = trace_context_get_transfer; tr_ctx->base.transfer_destroy = trace_context_transfer_destroy; diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 24ee3fe1175..4a0fbfdd4d6 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -319,21 +319,6 @@ struct pipe_context { unsigned flags, struct pipe_fence_handle **fence ); - /** - * Check whether a texture is referenced by an unflushed hw command. - * The state-tracker uses this function to avoid unnecessary flushes. - * It is safe (but wasteful) to always return - * PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE. - * \param pipe context whose unflushed hw commands will be checked. - * \param texture texture to check. - * \param level mipmap level. - * \param layer cubemap face, 2d array or 3d slice, 0 otherwise. Use -1 for any layer. - * \return mask of PIPE_REFERENCED_FOR_READ/WRITE or PIPE_UNREFERENCED - */ - unsigned int (*is_resource_referenced)(struct pipe_context *pipe, - struct pipe_resource *texture, - unsigned level, int layer); - /** * Create a view on a texture to be used by a shader stage. */ diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 9350a755d73..200ec67834b 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -507,13 +507,6 @@ enum pipe_shader_cap PIPE_SHADER_CAP_SUBROUTINES, /* BGNSUB, ENDSUB, CAL, RET */ }; -/** - * Referenced query flags. - */ - -#define PIPE_UNREFERENCED 0 -#define PIPE_REFERENCED_FOR_READ (1 << 0) -#define PIPE_REFERENCED_FOR_WRITE (1 << 1) /** * Composite query types diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 3b3ae455c0b..3e82fa8fdc1 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -519,10 +519,6 @@ renderer_clone_texture(struct xorg_renderer *r, struct pipe_resource *pt; struct pipe_resource templ; - if (pipe->is_resource_referenced(pipe, src, 0, 0) & - PIPE_REFERENCED_FOR_WRITE) - pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); - /* the coming in texture should already have that invariance */ debug_assert(screen->is_format_supported(screen, src->format, PIPE_TEXTURE_2D, 0, diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index c72ba9ef8db..234574b968e 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -461,20 +461,6 @@ bind_shaders(struct xorg_xv_port_priv *port) cso_set_fragment_shader_handle(port->r->cso, shader.fs); } -static INLINE void -conditional_flush(struct pipe_context *pipe, struct pipe_resource **tex, - int num) -{ - int i; - for (i = 0; i < num; ++i) { - if (tex[i] && pipe->is_resource_referenced(pipe, tex[i], 0, 0) & - PIPE_REFERENCED_FOR_WRITE) { - pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); - return; - } - } -} - static void bind_samplers(struct xorg_xv_port_priv *port) { @@ -485,8 +471,6 @@ bind_samplers(struct xorg_xv_port_priv *port) memset(&sampler, 0, sizeof(struct pipe_sampler_state)); - conditional_flush(port->r->pipe, dst, 3); - sampler.wrap_s = PIPE_TEX_WRAP_CLAMP; sampler.wrap_t = PIPE_TEX_WRAP_CLAMP; sampler.min_img_filter = PIPE_TEX_FILTER_LINEAR; -- cgit v1.2.3 From bfe88e69988b3d3bdff0b9f6051d0428e1315653 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Mon, 7 Mar 2011 22:57:54 +0100 Subject: gallium: cleanup fence_signalled and fence_finish So that they don't have the driver-specific param and return type. --- src/gallium/drivers/cell/ppu/cell_fence.c | 7 +++---- src/gallium/drivers/cell/ppu/cell_fence.h | 2 +- src/gallium/drivers/galahad/glhd_screen.c | 12 ++++-------- src/gallium/drivers/i915/i915_screen.c | 12 +++++------- src/gallium/drivers/i965/brw_screen.c | 12 +++++------- src/gallium/drivers/identity/id_screen.c | 12 ++++-------- src/gallium/drivers/llvmpipe/lp_flush.c | 2 +- src/gallium/drivers/llvmpipe/lp_screen.c | 10 ++++------ src/gallium/drivers/nouveau/nouveau_screen.c | 12 +++++------- src/gallium/drivers/r300/r300_screen.c | 20 +++++++++----------- src/gallium/drivers/rbug/rbug_screen.c | 12 ++++-------- src/gallium/drivers/softpipe/sp_fence.c | 12 +++++------- src/gallium/drivers/softpipe/sp_flush.c | 2 +- src/gallium/drivers/svga/svga_context.c | 2 +- src/gallium/drivers/svga/svga_screen.c | 12 +++++------- src/gallium/drivers/trace/tr_screen.c | 18 +++++++----------- src/gallium/include/pipe/p_screen.h | 16 +++++----------- src/gallium/state_trackers/egl/common/egl_g3d_api.c | 2 +- src/gallium/state_trackers/egl/common/egl_g3d_sync.c | 2 +- .../state_trackers/egl/common/native_helper.c | 2 +- src/gallium/state_trackers/glx/xlib/xm_api.c | 2 +- src/gallium/state_trackers/vega/api_context.c | 2 +- src/gallium/state_trackers/xorg/xorg_dri2.c | 2 +- src/gallium/state_trackers/xorg/xorg_driver.c | 4 ++-- src/gallium/state_trackers/xorg/xorg_exa.c | 2 +- src/mesa/state_tracker/st_cb_flush.c | 2 +- src/mesa/state_tracker/st_cb_syncobj.c | 4 ++-- 27 files changed, 81 insertions(+), 118 deletions(-) (limited to 'src/gallium/drivers/rbug') diff --git a/src/gallium/drivers/cell/ppu/cell_fence.c b/src/gallium/drivers/cell/ppu/cell_fence.c index 3014a8a7b84..181fef44f45 100644 --- a/src/gallium/drivers/cell/ppu/cell_fence.c +++ b/src/gallium/drivers/cell/ppu/cell_fence.c @@ -47,8 +47,7 @@ cell_fence_init(struct cell_fence *fence) boolean cell_fence_signalled(const struct cell_context *cell, - const struct cell_fence *fence, - unsigned flags) + const struct cell_fence *fence) { uint i; for (i = 0; i < cell->num_spus; i++) { @@ -60,10 +59,9 @@ cell_fence_signalled(const struct cell_context *cell, } -void +boolean cell_fence_finish(const struct cell_context *cell, const struct cell_fence *fence, - unsigned flags, uint64_t timeout) { while (!cell_fence_signalled(cell, fence)) { @@ -78,6 +76,7 @@ cell_fence_finish(const struct cell_context *cell, } } #endif + return TRUE; } diff --git a/src/gallium/drivers/cell/ppu/cell_fence.h b/src/gallium/drivers/cell/ppu/cell_fence.h index 3ef6cf7bbca..3568230b1c0 100644 --- a/src/gallium/drivers/cell/ppu/cell_fence.h +++ b/src/gallium/drivers/cell/ppu/cell_fence.h @@ -40,7 +40,7 @@ cell_fence_signalled(const struct cell_context *cell, unsigned flags); -extern void +extern boolean cell_fence_finish(const struct cell_context *cell, const struct cell_fence *fence, unsigned flags, diff --git a/src/gallium/drivers/galahad/glhd_screen.c b/src/gallium/drivers/galahad/glhd_screen.c index fbe19bf324b..06b6b34b74b 100644 --- a/src/gallium/drivers/galahad/glhd_screen.c +++ b/src/gallium/drivers/galahad/glhd_screen.c @@ -276,23 +276,20 @@ galahad_screen_fence_reference(struct pipe_screen *_screen, fence); } -static int +static boolean galahad_screen_fence_signalled(struct pipe_screen *_screen, - struct pipe_fence_handle *fence, - unsigned flags) + struct pipe_fence_handle *fence) { struct galahad_screen *glhd_screen = galahad_screen(_screen); struct pipe_screen *screen = glhd_screen->screen; return screen->fence_signalled(screen, - fence, - flags); + fence); } -static int +static boolean galahad_screen_fence_finish(struct pipe_screen *_screen, struct pipe_fence_handle *fence, - unsigned flags, uint64_t timeout) { struct galahad_screen *glhd_screen = galahad_screen(_screen); @@ -300,7 +297,6 @@ galahad_screen_fence_finish(struct pipe_screen *_screen, return screen->fence_finish(screen, fence, - flags, timeout); } diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index dd679f95200..031c9680d2c 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -318,25 +318,23 @@ i915_fence_reference(struct pipe_screen *screen, is->iws->fence_reference(is->iws, ptr, fence); } -static int +static boolean i915_fence_signalled(struct pipe_screen *screen, - struct pipe_fence_handle *fence, - unsigned flags) + struct pipe_fence_handle *fence) { struct i915_screen *is = i915_screen(screen); - return is->iws->fence_signalled(is->iws, fence); + return is->iws->fence_signalled(is->iws, fence) == 0; } -static int +static boolean i915_fence_finish(struct pipe_screen *screen, struct pipe_fence_handle *fence, - unsigned flags, uint64_t timeout) { struct i915_screen *is = i915_screen(screen); - return is->iws->fence_finish(is->iws, fence); + return is->iws->fence_finish(is->iws, fence) == 0; } diff --git a/src/gallium/drivers/i965/brw_screen.c b/src/gallium/drivers/i965/brw_screen.c index 367581a6b41..b3b88c799d9 100644 --- a/src/gallium/drivers/i965/brw_screen.c +++ b/src/gallium/drivers/i965/brw_screen.c @@ -365,21 +365,19 @@ brw_fence_reference(struct pipe_screen *screen, { } -static int +static boolean brw_fence_signalled(struct pipe_screen *screen, - struct pipe_fence_handle *fence, - unsigned flags) + struct pipe_fence_handle *fence) { - return 0; /* XXX shouldn't this be a boolean? */ + return TRUE; } -static int +static boolean brw_fence_finish(struct pipe_screen *screen, struct pipe_fence_handle *fence, - unsigned flags, uint64_t timeout) { - return 0; + return TRUE; } diff --git a/src/gallium/drivers/identity/id_screen.c b/src/gallium/drivers/identity/id_screen.c index b289c1e5d17..56e8ac014cf 100644 --- a/src/gallium/drivers/identity/id_screen.c +++ b/src/gallium/drivers/identity/id_screen.c @@ -242,23 +242,20 @@ identity_screen_fence_reference(struct pipe_screen *_screen, fence); } -static int +static boolean identity_screen_fence_signalled(struct pipe_screen *_screen, - struct pipe_fence_handle *fence, - unsigned flags) + struct pipe_fence_handle *fence) { struct identity_screen *id_screen = identity_screen(_screen); struct pipe_screen *screen = id_screen->screen; return screen->fence_signalled(screen, - fence, - flags); + fence); } -static int +static boolean identity_screen_fence_finish(struct pipe_screen *_screen, struct pipe_fence_handle *fence, - unsigned flags, uint64_t timeout) { struct identity_screen *id_screen = identity_screen(_screen); @@ -266,7 +263,6 @@ identity_screen_fence_finish(struct pipe_screen *_screen, return screen->fence_finish(screen, fence, - flags, timeout); } diff --git a/src/gallium/drivers/llvmpipe/lp_flush.c b/src/gallium/drivers/llvmpipe/lp_flush.c index 343c6145e7e..2a3ba904fe4 100644 --- a/src/gallium/drivers/llvmpipe/lp_flush.c +++ b/src/gallium/drivers/llvmpipe/lp_flush.c @@ -92,7 +92,7 @@ llvmpipe_finish( struct pipe_context *pipe, struct pipe_fence_handle *fence = NULL; llvmpipe_flush(pipe, 0, &fence, reason); if (fence) { - pipe->screen->fence_finish(pipe->screen, fence, 0, PIPE_TIMEOUT_INFINITE); + pipe->screen->fence_finish(pipe->screen, fence, PIPE_TIMEOUT_INFINITE); pipe->screen->fence_reference(pipe->screen, &fence, NULL); } } diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index c600144a2da..446037c660a 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -349,10 +349,9 @@ llvmpipe_fence_reference(struct pipe_screen *screen, /** * Has the fence been executed/finished? */ -static int +static boolean llvmpipe_fence_signalled(struct pipe_screen *screen, - struct pipe_fence_handle *fence, - unsigned flag) + struct pipe_fence_handle *fence) { struct lp_fence *f = (struct lp_fence *) fence; return lp_fence_signalled(f); @@ -362,16 +361,15 @@ llvmpipe_fence_signalled(struct pipe_screen *screen, /** * Wait for the fence to finish. */ -static int +static boolean llvmpipe_fence_finish(struct pipe_screen *screen, struct pipe_fence_handle *fence_handle, - unsigned flag, uint64_t timeout) { struct lp_fence *f = (struct lp_fence *) fence_handle; lp_fence_wait(f); - return 0; + return TRUE; } diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c index d6c2a0a199a..4cd82a51c14 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.c +++ b/src/gallium/drivers/nouveau/nouveau_screen.c @@ -154,21 +154,19 @@ nouveau_screen_fence_ref(struct pipe_screen *pscreen, nouveau_fence_ref(nouveau_fence(pfence), (struct nouveau_fence **)ptr); } -static int +static boolean nouveau_screen_fence_signalled(struct pipe_screen *screen, - struct pipe_fence_handle *pfence, - unsigned flags) + struct pipe_fence_handle *pfence) { - return !nouveau_fence_signalled(nouveau_fence(pfence)); + return nouveau_fence_signalled(nouveau_fence(pfence)); } -static int +static boolean nouveau_screen_fence_finish(struct pipe_screen *screen, struct pipe_fence_handle *pfence, - unsigned flags, uint64_t timeout) { - return !nouveau_fence_wait(nouveau_fence(pfence)); + return nouveau_fence_wait(nouveau_fence(pfence)); } diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index a929a2e282b..37ca2295d0a 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -423,20 +423,18 @@ static void r300_fence_reference(struct pipe_screen *screen, (struct r300_winsys_bo*)fence); } -static int r300_fence_signalled(struct pipe_screen *screen, - struct pipe_fence_handle *fence, - unsigned flags) +static boolean r300_fence_signalled(struct pipe_screen *screen, + struct pipe_fence_handle *fence) { struct r300_winsys_screen *rws = r300_screen(screen)->rws; struct r300_winsys_bo *rfence = (struct r300_winsys_bo*)fence; - return !rws->buffer_is_busy(rfence) ? 0 : 1; /* 0 == success */ + return !rws->buffer_is_busy(rfence); } -static int r300_fence_finish(struct pipe_screen *screen, - struct pipe_fence_handle *fence, - unsigned flags, - uint64_t timeout) +static boolean r300_fence_finish(struct pipe_screen *screen, + struct pipe_fence_handle *fence, + uint64_t timeout) { struct r300_winsys_screen *rws = r300_screen(screen)->rws; struct r300_winsys_bo *rfence = (struct r300_winsys_bo*)fence; @@ -450,15 +448,15 @@ static int r300_fence_finish(struct pipe_screen *screen, /* Wait in a loop. */ while (rws->buffer_is_busy(rfence)) { if (os_time_get() - start_time >= timeout) { - return 1; + return FALSE; } os_time_sleep(10); } - return 0; + return TRUE; } rws->buffer_wait(rfence); - return 0; /* 0 == success */ + return TRUE; } struct pipe_screen* r300_screen_create(struct r300_winsys_screen *rws) diff --git a/src/gallium/drivers/rbug/rbug_screen.c b/src/gallium/drivers/rbug/rbug_screen.c index d8d23bcb9c5..4f8b1003dfc 100644 --- a/src/gallium/drivers/rbug/rbug_screen.c +++ b/src/gallium/drivers/rbug/rbug_screen.c @@ -240,23 +240,20 @@ rbug_screen_fence_reference(struct pipe_screen *_screen, fence); } -static int +static boolean rbug_screen_fence_signalled(struct pipe_screen *_screen, - struct pipe_fence_handle *fence, - unsigned flags) + struct pipe_fence_handle *fence) { struct rbug_screen *rb_screen = rbug_screen(_screen); struct pipe_screen *screen = rb_screen->screen; return screen->fence_signalled(screen, - fence, - flags); + fence); } -static int +static boolean rbug_screen_fence_finish(struct pipe_screen *_screen, struct pipe_fence_handle *fence, - unsigned flags, uint64_t timeout) { struct rbug_screen *rb_screen = rbug_screen(_screen); @@ -264,7 +261,6 @@ rbug_screen_fence_finish(struct pipe_screen *_screen, return screen->fence_finish(screen, fence, - flags, timeout); } diff --git a/src/gallium/drivers/softpipe/sp_fence.c b/src/gallium/drivers/softpipe/sp_fence.c index 40d0b5970ef..7b79a0df4ea 100644 --- a/src/gallium/drivers/softpipe/sp_fence.c +++ b/src/gallium/drivers/softpipe/sp_fence.c @@ -41,24 +41,22 @@ softpipe_fence_reference(struct pipe_screen *screen, } -static int +static boolean softpipe_fence_signalled(struct pipe_screen *screen, - struct pipe_fence_handle *fence, - unsigned flags) + struct pipe_fence_handle *fence) { assert(!fence); - return 0; + return TRUE; } -static int +static boolean softpipe_fence_finish(struct pipe_screen *screen, struct pipe_fence_handle *fence, - unsigned flags, uint64_t timeout) { assert(!fence); - return 0; + return TRUE; } diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c index f16751a2163..edbce6a297a 100644 --- a/src/gallium/drivers/softpipe/sp_flush.c +++ b/src/gallium/drivers/softpipe/sp_flush.c @@ -162,7 +162,7 @@ softpipe_flush_resource(struct pipe_context *pipe, * This is for illustrative purposes only, as softpipe does not * have fences. */ - pipe->screen->fence_finish(pipe->screen, fence, 0, + pipe->screen->fence_finish(pipe->screen, fence, PIPE_TIMEOUT_INFINITE); pipe->screen->fence_reference(pipe->screen, &fence, NULL); } diff --git a/src/gallium/drivers/svga/svga_context.c b/src/gallium/drivers/svga/svga_context.c index e64dc94b9d8..4782b4bf70e 100644 --- a/src/gallium/drivers/svga/svga_context.c +++ b/src/gallium/drivers/svga/svga_context.c @@ -241,7 +241,7 @@ void svga_context_flush( struct svga_context *svga, if (SVGA_DEBUG & DEBUG_SYNC) { if (fence) - svga->pipe.screen->fence_finish( svga->pipe.screen, fence, 0, + svga->pipe.screen->fence_finish( svga->pipe.screen, fence, PIPE_TIMEOUT_INFINITE); } diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index 0dee8b1bec1..159758ed8bb 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -412,20 +412,18 @@ svga_fence_reference(struct pipe_screen *screen, } -static int +static boolean svga_fence_signalled(struct pipe_screen *screen, - struct pipe_fence_handle *fence, - unsigned flag) + struct pipe_fence_handle *fence) { struct svga_winsys_screen *sws = svga_screen(screen)->sws; - return sws->fence_signalled(sws, fence, flag); + return sws->fence_signalled(sws, fence, 0) == 0; } -static int +static boolean svga_fence_finish(struct pipe_screen *screen, struct pipe_fence_handle *fence, - unsigned flag, uint64_t timeout) { struct svga_winsys_screen *sws = svga_screen(screen)->sws; @@ -433,7 +431,7 @@ svga_fence_finish(struct pipe_screen *screen, SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "%s fence_ptr %p\n", __FUNCTION__, fence); - return sws->fence_finish(sws, fence, flag); + return sws->fence_finish(sws, fence, 0) == 0; } diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index 17f87cb906c..282a0dcef82 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -393,10 +393,9 @@ trace_screen_fence_reference(struct pipe_screen *_screen, } -static int +static boolean trace_screen_fence_signalled(struct pipe_screen *_screen, - struct pipe_fence_handle *fence, - unsigned flags) + struct pipe_fence_handle *fence) { struct trace_screen *tr_scr = trace_screen(_screen); struct pipe_screen *screen = tr_scr->screen; @@ -406,11 +405,10 @@ trace_screen_fence_signalled(struct pipe_screen *_screen, trace_dump_arg(ptr, screen); trace_dump_arg(ptr, fence); - trace_dump_arg(uint, flags); - result = screen->fence_signalled(screen, fence, flags); + result = screen->fence_signalled(screen, fence); - trace_dump_ret(int, result); + trace_dump_ret(bool, result); trace_dump_call_end(); @@ -418,10 +416,9 @@ trace_screen_fence_signalled(struct pipe_screen *_screen, } -static int +static boolean trace_screen_fence_finish(struct pipe_screen *_screen, struct pipe_fence_handle *fence, - unsigned flags, uint64_t timeout) { struct trace_screen *tr_scr = trace_screen(_screen); @@ -432,12 +429,11 @@ trace_screen_fence_finish(struct pipe_screen *_screen, trace_dump_arg(ptr, screen); trace_dump_arg(ptr, fence); - trace_dump_arg(uint, flags); trace_dump_arg(uint, timeout); - result = screen->fence_finish(screen, fence, flags, timeout); + result = screen->fence_finish(screen, fence, timeout); - trace_dump_ret(int, result); + trace_dump_ret(bool, result); trace_dump_call_end(); diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index 8e77e77db39..9aab5895dfe 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -183,23 +183,17 @@ struct pipe_screen { /** * Checks whether the fence has been signalled. - * \param flags driver-specific meaning - * \return zero on success. */ - int (*fence_signalled)( struct pipe_screen *screen, - struct pipe_fence_handle *fence, - unsigned flags ); + boolean (*fence_signalled)( struct pipe_screen *screen, + struct pipe_fence_handle *fence ); /** * Wait for the fence to finish. - * \param flags driver-specific meaning * \param timeout in nanoseconds - * \return zero on success. */ - int (*fence_finish)( struct pipe_screen *screen, - struct pipe_fence_handle *fence, - unsigned flags, - uint64_t timeout ); + boolean (*fence_finish)( struct pipe_screen *screen, + struct pipe_fence_handle *fence, + uint64_t timeout ); }; diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c index 61619886c3d..6b409573fa3 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c @@ -689,7 +689,7 @@ egl_g3d_wait_client(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx) gctx->stctxi->flush(gctx->stctxi, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence); if (fence) { - screen->fence_finish(screen, fence, 0, PIPE_TIMEOUT_INFINITE); + screen->fence_finish(screen, fence, PIPE_TIMEOUT_INFINITE); screen->fence_reference(screen, &fence, NULL); } diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_sync.c b/src/gallium/state_trackers/egl/common/egl_g3d_sync.c index 020c696238f..7610e04fa3e 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_sync.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_sync.c @@ -109,7 +109,7 @@ egl_g3d_wait_fence_sync(struct egl_g3d_sync *gsync, EGLTimeKHR timeout) _eglUnlockMutex(&dpy->Mutex); /* no timed finish? */ - screen->fence_finish(screen, fence, 0x0, PIPE_TIMEOUT_INFINITE); + screen->fence_finish(screen, fence, PIPE_TIMEOUT_INFINITE); ret = EGL_CONDITION_SATISFIED_KHR; _eglLockMutex(&dpy->Mutex); diff --git a/src/gallium/state_trackers/egl/common/native_helper.c b/src/gallium/state_trackers/egl/common/native_helper.c index aaccee3e1d1..290c6d7076d 100644 --- a/src/gallium/state_trackers/egl/common/native_helper.c +++ b/src/gallium/state_trackers/egl/common/native_helper.c @@ -333,7 +333,7 @@ resource_surface_throttle(struct resource_surface *rsurf) struct pipe_fence_handle *fence = swap_fences_pop_front(rsurf); if (fence) { - (void) screen->fence_finish(screen, fence, 0, PIPE_TIMEOUT_INFINITE); + (void) screen->fence_finish(screen, fence, PIPE_TIMEOUT_INFINITE); screen->fence_reference(screen, &fence, NULL); return TRUE; } diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index 506d6ecda8e..aa8dbf4a4c1 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.c +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c @@ -1227,7 +1227,7 @@ void XMesaFlush( XMesaContext c ) c->st->flush(c->st, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence); if (fence) { - xmdpy->screen->fence_finish(xmdpy->screen, fence, 0, + xmdpy->screen->fence_finish(xmdpy->screen, fence, PIPE_TIMEOUT_INFINITE); xmdpy->screen->fence_reference(xmdpy->screen, &fence, NULL); } diff --git a/src/gallium/state_trackers/vega/api_context.c b/src/gallium/state_trackers/vega/api_context.c index 5fba56fd211..47e57f92858 100644 --- a/src/gallium/state_trackers/vega/api_context.c +++ b/src/gallium/state_trackers/vega/api_context.c @@ -74,7 +74,7 @@ void vegaFinish(void) pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence); if (fence) { - pipe->screen->fence_finish(pipe->screen, fence, 0, + pipe->screen->fence_finish(pipe->screen, fence, PIPE_TIMEOUT_INFINITE); pipe->screen->fence_reference(pipe->screen, &fence, NULL); } diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index 6fc3e6514cd..05237028205 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -362,7 +362,7 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion, if (extents->x1 == 0 && extents->y1 == 0 && extents->x2 == pDraw->width && extents->y2 == pDraw->height) { - ms->screen->fence_finish(ms->screen, dst_priv->fence, 0, + ms->screen->fence_finish(ms->screen, dst_priv->fence, PIPE_TIMEOUT_INFINITE); ms->screen->fence_reference(ms->screen, &dst_priv->fence, NULL); } diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 9c890ff0866..5148a0c9baa 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -334,7 +334,7 @@ drv_cleanup_fences(ScrnInfoPtr pScrn) for (i = 0; i < XORG_NR_FENCES; i++) { if (ms->fence[i]) { - ms->screen->fence_finish(ms->screen, ms->fence[i], 0, + ms->screen->fence_finish(ms->screen, ms->fence[i], PIPE_TIMEOUT_INFINITE); ms->screen->fence_reference(ms->screen, &ms->fence[i], NULL); } @@ -556,7 +556,7 @@ void xorg_flush(ScreenPtr pScreen) if (ms->dirtyThrottling) { if (ms->fence[0]) ms->ctx->screen->fence_finish(ms->ctx->screen, - ms->fence[0], 0, + ms->fence[0], PIPE_TIMEOUT_INFINITE); /* The amount of rendering generated by a block handler can be diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 38d67d1b0b8..8767ab94695 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -1084,7 +1084,7 @@ void xorg_exa_finish(struct exa_context *exa) xorg_exa_flush(exa, PIPE_FLUSH_RENDER_CACHE, &fence); - exa->pipe->screen->fence_finish(exa->pipe->screen, fence, 0, + exa->pipe->screen->fence_finish(exa->pipe->screen, fence, PIPE_TIMEOUT_INFINITE); exa->pipe->screen->fence_reference(exa->pipe->screen, &fence, NULL); } diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c index 35ab00f6d01..ce902231eff 100644 --- a/src/mesa/state_tracker/st_cb_flush.c +++ b/src/mesa/state_tracker/st_cb_flush.c @@ -103,7 +103,7 @@ void st_finish( struct st_context *st ) st_flush(st, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence); if(fence) { - st->pipe->screen->fence_finish(st->pipe->screen, fence, 0, + st->pipe->screen->fence_finish(st->pipe->screen, fence, PIPE_TIMEOUT_INFINITE); st->pipe->screen->fence_reference(st->pipe->screen, &fence, NULL); } diff --git a/src/mesa/state_tracker/st_cb_syncobj.c b/src/mesa/state_tracker/st_cb_syncobj.c index 85aad08cc70..450909cf182 100644 --- a/src/mesa/state_tracker/st_cb_syncobj.c +++ b/src/mesa/state_tracker/st_cb_syncobj.c @@ -80,7 +80,7 @@ static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj) struct pipe_screen *screen = st_context(ctx)->pipe->screen; struct st_sync_object *so = (struct st_sync_object*)obj; - if (so->fence && screen->fence_signalled(screen, so->fence, 0) == 0) { + if (so->fence && screen->fence_signalled(screen, so->fence)) { screen->fence_reference(screen, &so->fence, NULL); so->b.StatusFlag = GL_TRUE; } @@ -97,7 +97,7 @@ static void st_client_wait_sync(struct gl_context *ctx, * already called when creating a fence. */ if (so->fence && - screen->fence_finish(screen, so->fence, 0, timeout) == 0) { + screen->fence_finish(screen, so->fence, timeout)) { screen->fence_reference(screen, &so->fence, NULL); so->b.StatusFlag = GL_TRUE; } -- cgit v1.2.3 From e968975cb57eb854769292f7c6ff773c64a386c3 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Tue, 8 Mar 2011 00:01:58 +0100 Subject: gallium: remove the geom_flags param from is_format_supported --- src/gallium/auxiliary/util/u_blit.c | 7 +- src/gallium/auxiliary/util/u_blitter.c | 4 +- src/gallium/auxiliary/util/u_caps.c | 3 +- src/gallium/auxiliary/util/u_gen_mipmap.c | 2 +- src/gallium/auxiliary/util/u_surface.c | 2 +- src/gallium/auxiliary/util/u_vbuf_mgr.c | 14 +- src/gallium/drivers/cell/ppu/cell_screen.c | 3 +- src/gallium/drivers/galahad/glhd_screen.c | 6 +- src/gallium/drivers/i915/i915_screen.c | 3 +- src/gallium/drivers/i965/brw_screen.c | 3 +- src/gallium/drivers/identity/id_screen.c | 6 +- src/gallium/drivers/llvmpipe/lp_screen.c | 3 +- src/gallium/drivers/noop/noop_pipe.c | 3 +- src/gallium/drivers/nv50/nv50_screen.c | 2 +- src/gallium/drivers/nvc0/nvc0_screen.c | 2 +- src/gallium/drivers/nvfx/nvfx_miptree.c | 6 +- src/gallium/drivers/nvfx/nvfx_screen.c | 2 +- src/gallium/drivers/r300/r300_blit.c | 4 +- src/gallium/drivers/r300/r300_screen.c | 3 +- src/gallium/drivers/r600/r600_pipe.c | 3 +- src/gallium/drivers/r600/r600_texture.c | 4 +- src/gallium/drivers/rbug/rbug_screen.c | 6 +- src/gallium/drivers/softpipe/sp_screen.c | 3 +- src/gallium/drivers/svga/svga_screen.c | 3 +- src/gallium/drivers/trace/tr_screen.c | 6 +- src/gallium/include/pipe/p_defines.h | 10 - src/gallium/include/pipe/p_screen.h | 4 +- .../state_trackers/d3d1x/gd3d11/d3d11_screen.h | 20 +- src/gallium/state_trackers/dri/common/dri_screen.c | 24 +-- src/gallium/state_trackers/egl/common/egl_g3d.c | 2 +- src/gallium/state_trackers/egl/drm/native_drm.c | 2 +- .../state_trackers/egl/fbdev/native_fbdev.c | 2 +- src/gallium/state_trackers/egl/gdi/native_gdi.c | 2 +- src/gallium/state_trackers/egl/x11/native_dri2.c | 2 +- src/gallium/state_trackers/glx/xlib/xm_api.c | 4 +- src/gallium/state_trackers/vega/image.c | 2 +- src/gallium/state_trackers/vega/renderer.c | 8 +- src/gallium/state_trackers/vega/vg_context.c | 2 +- src/gallium/state_trackers/wgl/stw_pixelformat.c | 4 +- src/gallium/state_trackers/xorg/xorg_dri2.c | 4 +- src/gallium/state_trackers/xorg/xorg_exa.c | 12 +- src/gallium/state_trackers/xorg/xorg_renderer.c | 5 +- src/mesa/state_tracker/st_cb_bitmap.c | 6 +- src/mesa/state_tracker/st_cb_drawpixels.c | 2 +- src/mesa/state_tracker/st_cb_fbo.c | 2 +- src/mesa/state_tracker/st_cb_texture.c | 11 +- src/mesa/state_tracker/st_extensions.c | 44 ++--- src/mesa/state_tracker/st_format.c | 210 +++++++++------------ src/mesa/state_tracker/st_gen_mipmap.c | 2 +- src/mesa/state_tracker/st_texture.c | 2 +- 50 files changed, 208 insertions(+), 283 deletions(-) (limited to 'src/gallium/drivers/rbug') diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index 76bd7ace526..ff3baf79c26 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -464,11 +464,11 @@ util_blit_pixels_writemask(struct blit_state *ctx, assert(screen->is_format_supported(screen, sampler_view->format, ctx->internal_target, sampler_view->texture->nr_samples, - PIPE_BIND_SAMPLER_VIEW, 0)); + PIPE_BIND_SAMPLER_VIEW)); assert(screen->is_format_supported(screen, dst->format, ctx->internal_target, dst->texture->nr_samples, dst_is_depth ? PIPE_BIND_DEPTH_STENCIL : - PIPE_BIND_RENDER_TARGET, 0)); + PIPE_BIND_RENDER_TARGET)); /* save state (restored below) */ cso_save_blend(ctx->cso); cso_save_depth_stencil_alpha(ctx->cso); @@ -660,8 +660,7 @@ util_blit_pixels_tex(struct blit_state *ctx, assert(ctx->pipe->screen->is_format_supported(ctx->pipe->screen, dst->format, PIPE_TEXTURE_2D, dst->texture->nr_samples, - PIPE_BIND_RENDER_TARGET, - 0)); + PIPE_BIND_RENDER_TARGET)); /* save state (restored below) */ cso_save_blend(ctx->cso); diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index fd1c2b72d04..bdc13b547db 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -772,9 +772,9 @@ void util_blitter_copy_region(struct blitter_context *blitter, /* (assuming copying a stencil buffer is not possible) */ if ((!ignore_stencil && is_stencil) || !screen->is_format_supported(screen, dst->format, dst->target, - dst->nr_samples, bind, 0) || + dst->nr_samples, bind) || !screen->is_format_supported(screen, src->format, src->target, - src->nr_samples, PIPE_BIND_SAMPLER_VIEW, 0)) { + src->nr_samples, PIPE_BIND_SAMPLER_VIEW)) { ctx->base.running = TRUE; util_resource_copy_region(pipe, dst, dstlevel, dstx, dsty, dstz, src, srclevel, srcbox); diff --git a/src/gallium/auxiliary/util/u_caps.c b/src/gallium/auxiliary/util/u_caps.c index e209a98b706..75677b2b133 100644 --- a/src/gallium/auxiliary/util/u_caps.c +++ b/src/gallium/auxiliary/util/u_caps.c @@ -69,8 +69,7 @@ util_check_caps_out(struct pipe_screen *screen, const unsigned *list, int *out) list[i++], PIPE_TEXTURE_2D, 0, - PIPE_BIND_SAMPLER_VIEW, - 0)) { + PIPE_BIND_SAMPLER_VIEW)) { *out = i - 2; return FALSE; } diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c index 2b30d555033..5bf0f53d084 100644 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -1539,7 +1539,7 @@ util_gen_mipmap(struct gen_mipmap_state *ctx, /* check if we can render in the texture's format */ if (!screen->is_format_supported(screen, psv->format, pt->target, - pt->nr_samples, PIPE_BIND_RENDER_TARGET, 0)) { + pt->nr_samples, PIPE_BIND_RENDER_TARGET)) { fallback_gen_mipmap(ctx, pt, face, baseLevel, lastLevel); return; } diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c index 4eddd3f519e..9caf76c802b 100644 --- a/src/gallium/auxiliary/util/u_surface.c +++ b/src/gallium/auxiliary/util/u_surface.c @@ -84,7 +84,7 @@ util_create_rgba_surface(struct pipe_context *pipe, /* Choose surface format */ for (i = 0; rgbaFormats[i]; i++) { if (screen->is_format_supported(screen, rgbaFormats[i], - target, 0, bind, 0)) { + target, 0, bind)) { format = rgbaFormats[i]; break; } diff --git a/src/gallium/auxiliary/util/u_vbuf_mgr.c b/src/gallium/auxiliary/util/u_vbuf_mgr.c index 7d157c99ccc..51bb4b85850 100644 --- a/src/gallium/auxiliary/util/u_vbuf_mgr.c +++ b/src/gallium/auxiliary/util/u_vbuf_mgr.c @@ -87,27 +87,27 @@ static void u_vbuf_mgr_init_format_caps(struct u_vbuf_mgr_priv *mgr) mgr->caps.format_fixed32 = screen->is_format_supported(screen, PIPE_FORMAT_R32_FIXED, PIPE_BUFFER, - 0, PIPE_BIND_VERTEX_BUFFER, 0); + 0, PIPE_BIND_VERTEX_BUFFER); mgr->caps.format_float16 = screen->is_format_supported(screen, PIPE_FORMAT_R16_FLOAT, PIPE_BUFFER, - 0, PIPE_BIND_VERTEX_BUFFER, 0); + 0, PIPE_BIND_VERTEX_BUFFER); mgr->caps.format_float64 = screen->is_format_supported(screen, PIPE_FORMAT_R64_FLOAT, PIPE_BUFFER, - 0, PIPE_BIND_VERTEX_BUFFER, 0); + 0, PIPE_BIND_VERTEX_BUFFER); mgr->caps.format_norm32 = screen->is_format_supported(screen, PIPE_FORMAT_R32_UNORM, PIPE_BUFFER, - 0, PIPE_BIND_VERTEX_BUFFER, 0) && + 0, PIPE_BIND_VERTEX_BUFFER) && screen->is_format_supported(screen, PIPE_FORMAT_R32_SNORM, PIPE_BUFFER, - 0, PIPE_BIND_VERTEX_BUFFER, 0); + 0, PIPE_BIND_VERTEX_BUFFER); mgr->caps.format_scaled32 = screen->is_format_supported(screen, PIPE_FORMAT_R32_USCALED, PIPE_BUFFER, - 0, PIPE_BIND_VERTEX_BUFFER, 0) && + 0, PIPE_BIND_VERTEX_BUFFER) && screen->is_format_supported(screen, PIPE_FORMAT_R32_SSCALED, PIPE_BUFFER, - 0, PIPE_BIND_VERTEX_BUFFER, 0); + 0, PIPE_BIND_VERTEX_BUFFER); } struct u_vbuf_mgr * diff --git a/src/gallium/drivers/cell/ppu/cell_screen.c b/src/gallium/drivers/cell/ppu/cell_screen.c index 8d2b4b96438..0ee124a24fc 100644 --- a/src/gallium/drivers/cell/ppu/cell_screen.c +++ b/src/gallium/drivers/cell/ppu/cell_screen.c @@ -149,8 +149,7 @@ cell_is_format_supported( struct pipe_screen *screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, - unsigned tex_usage, - unsigned geom_flags ) + unsigned tex_usage) { struct sw_winsys *winsys = cell_screen(screen)->winsys; diff --git a/src/gallium/drivers/galahad/glhd_screen.c b/src/gallium/drivers/galahad/glhd_screen.c index 06b6b34b74b..b4edebe4920 100644 --- a/src/gallium/drivers/galahad/glhd_screen.c +++ b/src/gallium/drivers/galahad/glhd_screen.c @@ -106,8 +106,7 @@ galahad_screen_is_format_supported(struct pipe_screen *_screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, - unsigned tex_usage, - unsigned geom_flags) + unsigned tex_usage) { struct galahad_screen *glhd_screen = galahad_screen(_screen); struct pipe_screen *screen = glhd_screen->screen; @@ -120,8 +119,7 @@ galahad_screen_is_format_supported(struct pipe_screen *_screen, format, target, sample_count, - tex_usage, - geom_flags); + tex_usage); } static struct pipe_context * diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index 031c9680d2c..c0050bc160c 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -250,8 +250,7 @@ i915_is_format_supported(struct pipe_screen *screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, - unsigned tex_usage, - unsigned geom_flags) + unsigned tex_usage) { static const enum pipe_format tex_supported[] = { PIPE_FORMAT_B8G8R8A8_UNORM, diff --git a/src/gallium/drivers/i965/brw_screen.c b/src/gallium/drivers/i965/brw_screen.c index b3b88c799d9..25204fd088d 100644 --- a/src/gallium/drivers/i965/brw_screen.c +++ b/src/gallium/drivers/i965/brw_screen.c @@ -278,8 +278,7 @@ brw_is_format_supported(struct pipe_screen *screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, - unsigned tex_usage, - unsigned geom_flags) + unsigned tex_usage) { static const enum pipe_format tex_supported[] = { PIPE_FORMAT_L8_UNORM, diff --git a/src/gallium/drivers/identity/id_screen.c b/src/gallium/drivers/identity/id_screen.c index 56e8ac014cf..9bf7fd4c0ee 100644 --- a/src/gallium/drivers/identity/id_screen.c +++ b/src/gallium/drivers/identity/id_screen.c @@ -103,8 +103,7 @@ identity_screen_is_format_supported(struct pipe_screen *_screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, - unsigned tex_usage, - unsigned geom_flags) + unsigned tex_usage) { struct identity_screen *id_screen = identity_screen(_screen); struct pipe_screen *screen = id_screen->screen; @@ -113,8 +112,7 @@ identity_screen_is_format_supported(struct pipe_screen *_screen, format, target, sample_count, - tex_usage, - geom_flags); + tex_usage); } static struct pipe_context * diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 446037c660a..521a52ad3ae 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -225,8 +225,7 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, - unsigned bind, - unsigned geom_flags ) + unsigned bind) { struct llvmpipe_screen *screen = llvmpipe_screen(_screen); struct sw_winsys *winsys = screen->winsys; diff --git a/src/gallium/drivers/noop/noop_pipe.c b/src/gallium/drivers/noop/noop_pipe.c index 90b6ebf36b5..9bcc1e6b45a 100644 --- a/src/gallium/drivers/noop/noop_pipe.c +++ b/src/gallium/drivers/noop/noop_pipe.c @@ -445,8 +445,7 @@ static boolean noop_is_format_supported(struct pipe_screen* screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, - unsigned usage, - unsigned geom_flags) + unsigned usage) { return true; } diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index d1744a38837..7690c80eef0 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -40,7 +40,7 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, - unsigned bindings, unsigned geom_flags) + unsigned bindings) { if (sample_count > 1) return FALSE; diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c b/src/gallium/drivers/nvc0/nvc0_screen.c index 4ce827d33f8..675bbe0fe31 100644 --- a/src/gallium/drivers/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nvc0/nvc0_screen.c @@ -34,7 +34,7 @@ nvc0_screen_is_format_supported(struct pipe_screen *pscreen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, - unsigned bindings, unsigned geom_flags) + unsigned bindings) { if (sample_count > 1) return FALSE; diff --git a/src/gallium/drivers/nvfx/nvfx_miptree.c b/src/gallium/drivers/nvfx/nvfx_miptree.c index 8c043b867ba..1be84b90a90 100644 --- a/src/gallium/drivers/nvfx/nvfx_miptree.c +++ b/src/gallium/drivers/nvfx/nvfx_miptree.c @@ -138,11 +138,11 @@ nvfx_miptree_create_skeleton(struct pipe_screen *pscreen, const struct pipe_reso // on our current driver (and the driver too), format support does not depend on geometry, so don't bother computing it // TODO: may want to revisit this - if(!pscreen->is_format_supported(pscreen, pt->format, pt->target, 0, PIPE_BIND_RENDER_TARGET, 0)) + if(!pscreen->is_format_supported(pscreen, pt->format, pt->target, 0, PIPE_BIND_RENDER_TARGET)) mt->base.base.bind &=~ PIPE_BIND_RENDER_TARGET; - if(!pscreen->is_format_supported(pscreen, pt->format, pt->target, 0, PIPE_BIND_SAMPLER_VIEW, 0)) + if(!pscreen->is_format_supported(pscreen, pt->format, pt->target, 0, PIPE_BIND_SAMPLER_VIEW)) mt->base.base.bind &=~ PIPE_BIND_SAMPLER_VIEW; - if(!pscreen->is_format_supported(pscreen, pt->format, pt->target, 0, PIPE_BIND_DEPTH_STENCIL, 0)) + if(!pscreen->is_format_supported(pscreen, pt->format, pt->target, 0, PIPE_BIND_DEPTH_STENCIL)) mt->base.base.bind &=~ PIPE_BIND_DEPTH_STENCIL; return mt; diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c index aa1e9567d31..9e6b9d6ef8f 100644 --- a/src/gallium/drivers/nvfx/nvfx_screen.c +++ b/src/gallium/drivers/nvfx/nvfx_screen.c @@ -202,7 +202,7 @@ nvfx_screen_is_format_supported(struct pipe_screen *pscreen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, - unsigned bind, unsigned geom_flags) + unsigned bind) { struct nvfx_screen *screen = nvfx_screen(pscreen); diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c index 6682b2bad44..37b635fd120 100644 --- a/src/gallium/drivers/r300/r300_blit.c +++ b/src/gallium/drivers/r300/r300_blit.c @@ -447,11 +447,11 @@ static void r300_resource_copy_region(struct pipe_context *pipe, !pipe->screen->is_format_supported(pipe->screen, src->format, src->target, src->nr_samples, - PIPE_BIND_SAMPLER_VIEW, 0) || + PIPE_BIND_SAMPLER_VIEW) || !pipe->screen->is_format_supported(pipe->screen, dst->format, dst->target, dst->nr_samples, - PIPE_BIND_RENDER_TARGET, 0))) { + PIPE_BIND_RENDER_TARGET))) { switch (util_format_get_blocksize(old_dst.format)) { case 1: new_dst.format = PIPE_FORMAT_I8_UNORM; diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 37ca2295d0a..8a69628c53e 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -306,8 +306,7 @@ static boolean r300_is_format_supported(struct pipe_screen* screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, - unsigned usage, - unsigned geom_flags) + unsigned usage) { struct r300_winsys_screen *rws = r300_screen(screen)->rws; uint32_t retval = 0; diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 9964bb39102..d8e057fe5d2 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -417,8 +417,7 @@ static boolean r600_is_format_supported(struct pipe_screen* screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, - unsigned usage, - unsigned geom_flags) + unsigned usage) { unsigned retval = 0; if (target >= PIPE_MAX_TEXTURE_TYPES) { diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 10b6c0cff70..f527c07adcd 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -299,14 +299,14 @@ static boolean permit_hardware_blit(struct pipe_screen *screen, res->format, res->target, res->nr_samples, - bind, 0)) + bind)) return FALSE; if (!screen->is_format_supported(screen, res->format, res->target, res->nr_samples, - PIPE_BIND_SAMPLER_VIEW, 0)) + PIPE_BIND_SAMPLER_VIEW)) return FALSE; return TRUE; diff --git a/src/gallium/drivers/rbug/rbug_screen.c b/src/gallium/drivers/rbug/rbug_screen.c index 4f8b1003dfc..7c8dfdcc12a 100644 --- a/src/gallium/drivers/rbug/rbug_screen.c +++ b/src/gallium/drivers/rbug/rbug_screen.c @@ -106,8 +106,7 @@ rbug_screen_is_format_supported(struct pipe_screen *_screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, - unsigned tex_usage, - unsigned geom_flags) + unsigned tex_usage) { struct rbug_screen *rb_screen = rbug_screen(_screen); struct pipe_screen *screen = rb_screen->screen; @@ -116,8 +115,7 @@ rbug_screen_is_format_supported(struct pipe_screen *_screen, format, target, sample_count, - tex_usage, - geom_flags); + tex_usage); } static struct pipe_context * diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 8b693ba9198..48aabc18da3 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -180,8 +180,7 @@ softpipe_is_format_supported( struct pipe_screen *screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, - unsigned bind, - unsigned geom_flags ) + unsigned bind) { struct sw_winsys *winsys = softpipe_screen(screen)->winsys; const struct util_format_description *format_desc; diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index 159758ed8bb..6c987abe056 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -342,8 +342,7 @@ svga_is_format_supported( struct pipe_screen *screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, - unsigned tex_usage, - unsigned geom_flags ) + unsigned tex_usage) { struct svga_winsys_screen *sws = svga_screen(screen)->sws; SVGA3dDevCapIndex index; diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index 282a0dcef82..42180c4f19e 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -158,8 +158,7 @@ trace_screen_is_format_supported(struct pipe_screen *_screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, - unsigned tex_usage, - unsigned geom_flags) + unsigned tex_usage) { struct trace_screen *tr_scr = trace_screen(_screen); struct pipe_screen *screen = tr_scr->screen; @@ -172,10 +171,9 @@ trace_screen_is_format_supported(struct pipe_screen *_screen, trace_dump_arg(int, target); trace_dump_arg(uint, sample_count); trace_dump_arg(uint, tex_usage); - trace_dump_arg(uint, geom_flags); result = screen->is_format_supported(screen, format, target, sample_count, - tex_usage, geom_flags); + tex_usage); trace_dump_ret(bool, result); diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 200ec67834b..a4185f23839 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -337,16 +337,6 @@ enum pipe_transfer_usage { #define PIPE_USAGE_STAGING 5 /* supports data transfers from the GPU to the CPU */ -/* These are intended to be used in calls to is_format_supported, but - * no driver actually uses these flags, and only the glx/xlib state - * tracker issues them. - * - * Deprecate? - */ -#define PIPE_TEXTURE_GEOM_NON_SQUARE 0x1 -#define PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO 0x2 - - /** * Flush types: */ diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index 9aab5895dfe..a7845dd24d9 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -99,14 +99,12 @@ struct pipe_screen { * Check if the given pipe_format is supported as a texture or * drawing surface. * \param bindings bitmask of PIPE_BIND_* - * \param geom_flags bitmask of PIPE_TEXTURE_GEOM_* */ boolean (*is_format_supported)( struct pipe_screen *, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, - unsigned bindings, - unsigned geom_flags ); + unsigned bindings ); /** * Create a new texture object, using the given template info. diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h index 9cfdc837d8e..f678ac7f733 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h @@ -299,25 +299,25 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen sampler_view |= D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON; /* TODO: do this properly when Gallium drivers actually support index/vertex format queries */ - if(screen->is_format_supported(screen, format, PIPE_BUFFER, 0, PIPE_BIND_VERTEX_BUFFER, 0) - || (screen->is_format_supported(screen, format, PIPE_BUFFER, 0, PIPE_BIND_INDEX_BUFFER, 0) + if(screen->is_format_supported(screen, format, PIPE_BUFFER, 0, PIPE_BIND_VERTEX_BUFFER) + || (screen->is_format_supported(screen, format, PIPE_BUFFER, 0, PIPE_BIND_INDEX_BUFFER) || format == PIPE_FORMAT_R8_UNORM)) support |= buffer; - if(screen->is_format_supported(screen, format, PIPE_BUFFER, 0, PIPE_BIND_STREAM_OUTPUT, 0)) + if(screen->is_format_supported(screen, format, PIPE_BUFFER, 0, PIPE_BIND_STREAM_OUTPUT)) support |= buffer | D3D11_FORMAT_SUPPORT_SO_BUFFER; - if(screen->is_format_supported(screen, format, PIPE_TEXTURE_1D, 0, PIPE_BIND_SAMPLER_VIEW, 0)) + if(screen->is_format_supported(screen, format, PIPE_TEXTURE_1D, 0, PIPE_BIND_SAMPLER_VIEW)) support |= D3D11_FORMAT_SUPPORT_TEXTURE1D | sampler_view; - if(screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW, 0)) + if(screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW)) support |= D3D11_FORMAT_SUPPORT_TEXTURE2D | sampler_view; - if(screen->is_format_supported(screen, format, PIPE_TEXTURE_CUBE, 0, PIPE_BIND_SAMPLER_VIEW, 0)) + if(screen->is_format_supported(screen, format, PIPE_TEXTURE_CUBE, 0, PIPE_BIND_SAMPLER_VIEW)) support |= D3D11_FORMAT_SUPPORT_TEXTURE2D | sampler_view; - if(screen->is_format_supported(screen, format, PIPE_TEXTURE_3D, 0, PIPE_BIND_SAMPLER_VIEW, 0)) + if(screen->is_format_supported(screen, format, PIPE_TEXTURE_3D, 0, PIPE_BIND_SAMPLER_VIEW)) support |= D3D11_FORMAT_SUPPORT_TEXTURE3D | sampler_view; - if(screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, PIPE_BIND_RENDER_TARGET, 0)) + if(screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, PIPE_BIND_RENDER_TARGET)) support |= D3D11_FORMAT_SUPPORT_TEXTURE2D | D3D11_FORMAT_SUPPORT_RENDER_TARGET | D3D11_FORMAT_SUPPORT_BLENDABLE; - if(screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, PIPE_BIND_DEPTH_STENCIL, 0)) + if(screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, PIPE_BIND_DEPTH_STENCIL)) support |= D3D11_FORMAT_SUPPORT_TEXTURE2D | D3D11_FORMAT_SUPPORT_DEPTH_STENCIL; - if(screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, PIPE_BIND_DISPLAY_TARGET, 0)) + if(screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, PIPE_BIND_DISPLAY_TARGET)) support |= D3D11_FORMAT_SUPPORT_DISPLAY; format_support[format] = support; } diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c index 69c2e7e9ec8..5931df993b0 100644 --- a/src/gallium/state_trackers/dri/common/dri_screen.c +++ b/src/gallium/state_trackers/dri/common/dri_screen.c @@ -81,34 +81,34 @@ dri_fill_in_modes(struct dri_screen *screen, pf_x8z24 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z24X8_UNORM, PIPE_TEXTURE_2D, 0, - PIPE_BIND_DEPTH_STENCIL, 0); + PIPE_BIND_DEPTH_STENCIL); pf_z24x8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_X8Z24_UNORM, PIPE_TEXTURE_2D, 0, - PIPE_BIND_DEPTH_STENCIL, 0); + PIPE_BIND_DEPTH_STENCIL); pf_s8z24 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED, PIPE_TEXTURE_2D, 0, - PIPE_BIND_DEPTH_STENCIL, 0); + PIPE_BIND_DEPTH_STENCIL); pf_z24s8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM, PIPE_TEXTURE_2D, 0, - PIPE_BIND_DEPTH_STENCIL, 0); + PIPE_BIND_DEPTH_STENCIL); pf_a8r8g8b8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_B8G8R8A8_UNORM, PIPE_TEXTURE_2D, 0, - PIPE_BIND_RENDER_TARGET, 0); + PIPE_BIND_RENDER_TARGET); pf_x8r8g8b8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_B8G8R8X8_UNORM, PIPE_TEXTURE_2D, 0, - PIPE_BIND_RENDER_TARGET, 0); + PIPE_BIND_RENDER_TARGET); pf_r5g6b5 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_B5G6R5_UNORM, PIPE_TEXTURE_2D, 0, - PIPE_BIND_RENDER_TARGET, 0); + PIPE_BIND_RENDER_TARGET); /* We can only get a 16 or 32 bit depth buffer with getBuffersWithFormat */ if (dri_with_format(screen->sPriv)) { pf_z16 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z16_UNORM, PIPE_TEXTURE_2D, 0, - PIPE_BIND_DEPTH_STENCIL, 0); + PIPE_BIND_DEPTH_STENCIL); pf_z32 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z32_UNORM, PIPE_TEXTURE_2D, 0, - PIPE_BIND_DEPTH_STENCIL, 0); + PIPE_BIND_DEPTH_STENCIL); } else { pf_z16 = FALSE; pf_z32 = FALSE; @@ -142,7 +142,7 @@ dri_fill_in_modes(struct dri_screen *screen, for (i = 1; i < 5; i++) { if (p_screen->is_format_supported(p_screen, PIPE_FORMAT_B5G6R5_UNORM, PIPE_TEXTURE_2D, i*2, - PIPE_BIND_RENDER_TARGET, 0)) { + PIPE_BIND_RENDER_TARGET)) { msaa_samples_array[msaa_samples_factor] = i * 2; msaa_samples_factor++; } @@ -161,7 +161,7 @@ dri_fill_in_modes(struct dri_screen *screen, for (i = 1; i < 5; i++) { if (p_screen->is_format_supported(p_screen, PIPE_FORMAT_B8G8R8A8_UNORM, PIPE_TEXTURE_2D, i*2, - PIPE_BIND_RENDER_TARGET, 0)) { + PIPE_BIND_RENDER_TARGET)) { msaa_samples_array[msaa_samples_factor] = i * 2; msaa_samples_factor++; } @@ -183,7 +183,7 @@ dri_fill_in_modes(struct dri_screen *screen, for (i = 1; i < 5; i++) { if (p_screen->is_format_supported(p_screen, PIPE_FORMAT_B8G8R8X8_UNORM, PIPE_TEXTURE_2D, i*2, - PIPE_BIND_RENDER_TARGET, 0)) { + PIPE_BIND_RENDER_TARGET)) { msaa_samples_array[msaa_samples_factor] = i * 2; msaa_samples_factor++; } diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index e60a56074dd..2c7f3bde4f0 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c @@ -368,7 +368,7 @@ egl_g3d_fill_depth_stencil_formats(_EGLDisplay *dpy, /* pick the first supported format */ for (i = 0; i < n; i++) { if (screen->is_format_supported(screen, fmt[i], - PIPE_TEXTURE_2D, 0, PIPE_BIND_DEPTH_STENCIL, 0)) { + PIPE_TEXTURE_2D, 0, PIPE_BIND_DEPTH_STENCIL)) { formats[count++] = fmt[i]; break; } diff --git a/src/gallium/state_trackers/egl/drm/native_drm.c b/src/gallium/state_trackers/egl/drm/native_drm.c index cdbb304c5ee..9863329ff40 100644 --- a/src/gallium/state_trackers/egl/drm/native_drm.c +++ b/src/gallium/state_trackers/egl/drm/native_drm.c @@ -43,7 +43,7 @@ drm_display_is_format_supported(struct native_display *ndpy, return ndpy->screen->is_format_supported(ndpy->screen, fmt, PIPE_TEXTURE_2D, 0, (is_color) ? PIPE_BIND_RENDER_TARGET : - PIPE_BIND_DEPTH_STENCIL, 0); + PIPE_BIND_DEPTH_STENCIL); } static const struct native_config ** diff --git a/src/gallium/state_trackers/egl/fbdev/native_fbdev.c b/src/gallium/state_trackers/egl/fbdev/native_fbdev.c index 4a96039ac39..e2fde00e975 100644 --- a/src/gallium/state_trackers/egl/fbdev/native_fbdev.c +++ b/src/gallium/state_trackers/egl/fbdev/native_fbdev.c @@ -422,7 +422,7 @@ fbdev_display_init(struct native_display *ndpy) if (fbdpy->base.screen) { if (!fbdpy->base.screen->is_format_supported(fbdpy->base.screen, fbdpy->config.color_format, PIPE_TEXTURE_2D, 0, - PIPE_BIND_RENDER_TARGET, 0)) { + PIPE_BIND_RENDER_TARGET)) { fbdpy->base.screen->destroy(fbdpy->base.screen); fbdpy->base.screen = NULL; } diff --git a/src/gallium/state_trackers/egl/gdi/native_gdi.c b/src/gallium/state_trackers/egl/gdi/native_gdi.c index 3c2475f84d8..5d0045f92ee 100644 --- a/src/gallium/state_trackers/egl/gdi/native_gdi.c +++ b/src/gallium/state_trackers/egl/gdi/native_gdi.c @@ -285,7 +285,7 @@ fill_color_formats(struct native_display *ndpy, enum pipe_format formats[8]) for (i = 0; i < Elements(candidates); i++) { if (screen->is_format_supported(screen, candidates[i], - PIPE_TEXTURE_2D, 0, PIPE_BIND_RENDER_TARGET, 0)) + PIPE_TEXTURE_2D, 0, PIPE_BIND_RENDER_TARGET)) formats[count++] = candidates[i]; } diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c index b18c3132c57..5afca67a4d4 100644 --- a/src/gallium/state_trackers/egl/x11/native_dri2.c +++ b/src/gallium/state_trackers/egl/x11/native_dri2.c @@ -541,7 +541,7 @@ is_format_supported(struct pipe_screen *screen, { return screen->is_format_supported(screen, fmt, PIPE_TEXTURE_2D, sample_count, (is_color) ? PIPE_BIND_RENDER_TARGET : - PIPE_BIND_DEPTH_STENCIL, 0); + PIPE_BIND_DEPTH_STENCIL); } static boolean diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index aa8dbf4a4c1..7bfd2c3779d 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.c +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c @@ -376,8 +376,6 @@ choose_depth_stencil_format(XMesaDisplay xmdpy, int depth, int stencil) { const enum pipe_texture_target target = PIPE_TEXTURE_2D; const unsigned tex_usage = PIPE_BIND_DEPTH_STENCIL; - const unsigned geom_flags = (PIPE_TEXTURE_GEOM_NON_SQUARE | - PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO); const unsigned sample_count = 0; enum pipe_format formats[8], fmt; int count, i; @@ -403,7 +401,7 @@ choose_depth_stencil_format(XMesaDisplay xmdpy, int depth, int stencil) for (i = 0; i < count; i++) { if (xmdpy->screen->is_format_supported(xmdpy->screen, formats[i], target, sample_count, - tex_usage, geom_flags)) { + tex_usage)) { fmt = formats[i]; break; } diff --git a/src/gallium/state_trackers/vega/image.c b/src/gallium/state_trackers/vega/image.c index 2c6dcb146b8..44480876b6e 100644 --- a/src/gallium/state_trackers/vega/image.c +++ b/src/gallium/state_trackers/vega/image.c @@ -257,7 +257,7 @@ struct vg_image * image_create(VGImageFormat format, image->sampler.normalized_coords = 1; assert(screen->is_format_supported(screen, pformat, PIPE_TEXTURE_2D, - 0, PIPE_BIND_SAMPLER_VIEW, 0)); + 0, PIPE_BIND_SAMPLER_VIEW)); memset(&pt, 0, sizeof(pt)); pt.target = PIPE_TEXTURE_2D; diff --git a/src/gallium/state_trackers/vega/renderer.c b/src/gallium/state_trackers/vega/renderer.c index 9de2cb1014d..5715073e2d9 100644 --- a/src/gallium/state_trackers/vega/renderer.c +++ b/src/gallium/state_trackers/vega/renderer.c @@ -140,7 +140,7 @@ static VGboolean renderer_can_support(struct renderer *renderer, struct pipe_screen *screen = renderer->pipe->screen; return screen->is_format_supported(screen, - res->format, res->target, 0, bindings, 0); + res->format, res->target, 0, bindings); } /** @@ -1463,11 +1463,11 @@ void renderer_copy_surface(struct renderer *ctx, } assert(screen->is_format_supported(screen, src->format, PIPE_TEXTURE_2D, - 0, PIPE_BIND_SAMPLER_VIEW, 0)); + 0, PIPE_BIND_SAMPLER_VIEW)); assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D, - 0, PIPE_BIND_SAMPLER_VIEW, 0)); + 0, PIPE_BIND_SAMPLER_VIEW)); assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D, - 0, PIPE_BIND_RENDER_TARGET, 0)); + 0, PIPE_BIND_RENDER_TARGET)); /* * XXX for now we're always creating a temporary texture. diff --git a/src/gallium/state_trackers/vega/vg_context.c b/src/gallium/state_trackers/vega/vg_context.c index 83b42609e03..c2ab56455b1 100644 --- a/src/gallium/state_trackers/vega/vg_context.c +++ b/src/gallium/state_trackers/vega/vg_context.c @@ -69,7 +69,7 @@ choose_depth_stencil_format(struct vg_context *ctx) for (fmt = formats; *fmt != PIPE_FORMAT_NONE; fmt++) { if (screen->is_format_supported(screen, *fmt, - PIPE_TEXTURE_2D, 0, PIPE_BIND_DEPTH_STENCIL, 0)) + PIPE_TEXTURE_2D, 0, PIPE_BIND_DEPTH_STENCIL)) break; } diff --git a/src/gallium/state_trackers/wgl/stw_pixelformat.c b/src/gallium/state_trackers/wgl/stw_pixelformat.c index 5ede1d43220..333f50c25f6 100644 --- a/src/gallium/state_trackers/wgl/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/stw_pixelformat.c @@ -225,7 +225,7 @@ stw_pixelformat_init( void ) if(!screen->is_format_supported(screen, color->format, PIPE_TEXTURE_2D, 0, PIPE_BIND_RENDER_TARGET | - PIPE_BIND_DISPLAY_TARGET, 0)) + PIPE_BIND_DISPLAY_TARGET)) continue; for(k = 0; k < Elements(stw_pf_doublebuffer); ++k) { @@ -235,7 +235,7 @@ stw_pixelformat_init( void ) const struct stw_pf_depth_info *depth = &stw_pf_depth_stencil[l]; if(!screen->is_format_supported(screen, depth->format, PIPE_TEXTURE_2D, - 0, PIPE_BIND_DEPTH_STENCIL, 0)) + 0, PIPE_BIND_DEPTH_STENCIL)) continue; stw_pixelformat_add( stw_dev, color, depth, 0, doublebuffer, samples ); diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index 05237028205..edd988f4e09 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -452,12 +452,12 @@ xorg_dri2_init(ScreenPtr pScreen) ms->screen->is_format_supported(ms->screen, PIPE_FORMAT_Z24X8_UNORM, PIPE_TEXTURE_2D, 0, - PIPE_BIND_DEPTH_STENCIL, 0); + PIPE_BIND_DEPTH_STENCIL); ms->ds_depth_bits_last = ms->screen->is_format_supported(ms->screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED, PIPE_TEXTURE_2D, 0, - PIPE_BIND_DEPTH_STENCIL, 0); + PIPE_BIND_DEPTH_STENCIL); return DRI2ScreenInit(pScreen, &dri2info); } diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 8767ab94695..2accda1525e 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -349,7 +349,7 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg) if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, priv->tex->target, 0, - PIPE_BIND_RENDER_TARGET, 0)) { + PIPE_BIND_RENDER_TARGET)) { XORG_FALLBACK("format %s", util_format_name(priv->tex->format)); } @@ -430,12 +430,12 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, priv->tex->target, 0, - PIPE_BIND_RENDER_TARGET, 0)) + PIPE_BIND_RENDER_TARGET)) XORG_FALLBACK("pDst format %s", util_format_name(priv->tex->format)); if (!exa->scrn->is_format_supported(exa->scrn, src_priv->tex->format, src_priv->tex->target, 0, - PIPE_BIND_SAMPLER_VIEW, 0)) + PIPE_BIND_SAMPLER_VIEW)) XORG_FALLBACK("pSrc format %s", util_format_name(src_priv->tex->format)); exa->copy.src = src_priv; @@ -630,7 +630,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, priv->tex->target, 0, - PIPE_BIND_RENDER_TARGET, 0)) + PIPE_BIND_RENDER_TARGET)) XORG_FALLBACK("pDst format: %s", util_format_name(priv->tex->format)); if (priv->picture_format != pDstPicture->format) @@ -645,7 +645,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, priv->tex->target, 0, - PIPE_BIND_SAMPLER_VIEW, 0)) + PIPE_BIND_SAMPLER_VIEW)) XORG_FALLBACK("pSrc format: %s", util_format_name(priv->tex->format)); if (!picture_check_formats(priv, pSrcPicture)) @@ -662,7 +662,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, priv->tex->target, 0, - PIPE_BIND_SAMPLER_VIEW, 0)) + PIPE_BIND_SAMPLER_VIEW)) XORG_FALLBACK("pMask format: %s", util_format_name(priv->tex->format)); if (!picture_check_formats(priv, pMaskPicture)) diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 3e82fa8fdc1..6b799af90c8 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -450,8 +450,7 @@ void renderer_copy_prepare(struct xorg_renderer *r, assert(screen->is_format_supported(screen, dst_surface->format, PIPE_TEXTURE_2D, 0, - PIPE_BIND_RENDER_TARGET, - 0)); + PIPE_BIND_RENDER_TARGET)); (void) screen; @@ -522,7 +521,7 @@ renderer_clone_texture(struct xorg_renderer *r, /* the coming in texture should already have that invariance */ debug_assert(screen->is_format_supported(screen, src->format, PIPE_TEXTURE_2D, 0, - PIPE_BIND_SAMPLER_VIEW, 0)); + PIPE_BIND_SAMPLER_VIEW)); format = src->format; diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 149f1ca4450..49b196032b9 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -838,17 +838,17 @@ st_init_bitmap(struct st_context *st) /* find a usable texture format */ if (screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM, PIPE_TEXTURE_2D, 0, - PIPE_BIND_SAMPLER_VIEW, 0)) { + PIPE_BIND_SAMPLER_VIEW)) { st->bitmap.tex_format = PIPE_FORMAT_I8_UNORM; } else if (screen->is_format_supported(screen, PIPE_FORMAT_A8_UNORM, PIPE_TEXTURE_2D, 0, - PIPE_BIND_SAMPLER_VIEW, 0)) { + PIPE_BIND_SAMPLER_VIEW)) { st->bitmap.tex_format = PIPE_FORMAT_A8_UNORM; } else if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM, PIPE_TEXTURE_2D, 0, - PIPE_BIND_SAMPLER_VIEW, 0)) { + PIPE_BIND_SAMPLER_VIEW)) { st->bitmap.tex_format = PIPE_FORMAT_L8_UNORM; } else { diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index c2b4e1808f5..013446659a8 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -1332,7 +1332,7 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy, if (screen->is_format_supported(screen, srcFormat, st->internal_target, sample_count, - PIPE_BIND_SAMPLER_VIEW, 0)) { + PIPE_BIND_SAMPLER_VIEW)) { texFormat = srcFormat; } else { diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 27b8a06de57..0df04287ae6 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -485,7 +485,7 @@ st_validate_attachment(struct gl_context *ctx, return screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, - stObj->pt->nr_samples, bindings, 0); + stObj->pt->nr_samples, bindings); } diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 3f98ffd3d6f..9e00fcf18b0 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -217,7 +217,6 @@ default_bindings(struct st_context *st, enum pipe_format format) { struct pipe_screen *screen = st->pipe->screen; const unsigned target = PIPE_TEXTURE_2D; - const unsigned geom = 0x0; unsigned bindings; if (util_format_is_depth_or_stencil(format)) @@ -225,13 +224,13 @@ default_bindings(struct st_context *st, enum pipe_format format) else bindings = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET; - if (screen->is_format_supported(screen, format, target, 0, bindings, geom)) + if (screen->is_format_supported(screen, format, target, 0, bindings)) return bindings; else { /* Try non-sRGB. */ format = util_format_linear(format); - if (screen->is_format_supported(screen, format, target, 0, bindings, geom)) + if (screen->is_format_supported(screen, format, target, 0, bindings)) return bindings; else return PIPE_BIND_SAMPLER_VIEW; @@ -1523,12 +1522,10 @@ st_copy_texsubimage(struct gl_context *ctx, texBaseFormat != GL_DEPTH_STENCIL && screen->is_format_supported(screen, src_format, PIPE_TEXTURE_2D, sample_count, - PIPE_BIND_SAMPLER_VIEW, - 0) && + PIPE_BIND_SAMPLER_VIEW) && screen->is_format_supported(screen, dest_format, PIPE_TEXTURE_2D, 0, - PIPE_BIND_RENDER_TARGET, - 0)) { + PIPE_BIND_RENDER_TARGET)) { /* draw textured quad to do the copy */ GLint srcY0, srcY1; struct pipe_surface surf_tmpl; diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index aaa1658f4a0..e34f90f41e1 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -366,36 +366,36 @@ void st_init_extensions(struct st_context *st) */ if (screen->is_format_supported(screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM, PIPE_TEXTURE_2D, 0, - PIPE_BIND_DEPTH_STENCIL, 0) && + PIPE_BIND_DEPTH_STENCIL) && screen->is_format_supported(screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM, PIPE_TEXTURE_2D, 0, - PIPE_BIND_SAMPLER_VIEW, 0)) { + PIPE_BIND_SAMPLER_VIEW)) { ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE; } else if (screen->is_format_supported(screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED, PIPE_TEXTURE_2D, 0, - PIPE_BIND_DEPTH_STENCIL, 0) && + PIPE_BIND_DEPTH_STENCIL) && screen->is_format_supported(screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED, PIPE_TEXTURE_2D, 0, - PIPE_BIND_SAMPLER_VIEW, 0)) { + PIPE_BIND_SAMPLER_VIEW)) { ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE; } /* sRGB support */ if (screen->is_format_supported(screen, PIPE_FORMAT_A8B8G8R8_SRGB, PIPE_TEXTURE_2D, 0, - PIPE_BIND_SAMPLER_VIEW, 0) || + PIPE_BIND_SAMPLER_VIEW) || screen->is_format_supported(screen, PIPE_FORMAT_B8G8R8A8_SRGB, PIPE_TEXTURE_2D, 0, - PIPE_BIND_SAMPLER_VIEW, 0)) { + PIPE_BIND_SAMPLER_VIEW)) { ctx->Extensions.EXT_texture_sRGB = GL_TRUE; ctx->Extensions.EXT_texture_sRGB_decode = GL_TRUE; if (screen->is_format_supported(screen, PIPE_FORMAT_A8B8G8R8_SRGB, PIPE_TEXTURE_2D, 0, - PIPE_BIND_RENDER_TARGET, 0) || + PIPE_BIND_RENDER_TARGET) || screen->is_format_supported(screen, PIPE_FORMAT_B8G8R8A8_SRGB, PIPE_TEXTURE_2D, 0, - PIPE_BIND_RENDER_TARGET, 0)) { + PIPE_BIND_RENDER_TARGET)) { ctx->Extensions.EXT_framebuffer_sRGB = GL_TRUE; ctx->Const.sRGBCapable = GL_TRUE; } @@ -403,14 +403,14 @@ void st_init_extensions(struct st_context *st) if (screen->is_format_supported(screen, PIPE_FORMAT_R8G8_UNORM, PIPE_TEXTURE_2D, 0, - PIPE_BIND_SAMPLER_VIEW, 0)) { + PIPE_BIND_SAMPLER_VIEW)) { ctx->Extensions.ARB_texture_rg = GL_TRUE; } /* s3tc support */ if (screen->is_format_supported(screen, PIPE_FORMAT_DXT5_RGBA, PIPE_TEXTURE_2D, 0, - PIPE_BIND_SAMPLER_VIEW, 0) && + PIPE_BIND_SAMPLER_VIEW) && ctx->Mesa_DXTn) { ctx->Extensions.EXT_texture_compression_s3tc = GL_TRUE; ctx->Extensions.S3_s3tc = GL_TRUE; @@ -418,48 +418,48 @@ void st_init_extensions(struct st_context *st) if (screen->is_format_supported(screen, PIPE_FORMAT_RGTC1_UNORM, PIPE_TEXTURE_2D, 0, - PIPE_BIND_SAMPLER_VIEW, 0) && + PIPE_BIND_SAMPLER_VIEW) && screen->is_format_supported(screen, PIPE_FORMAT_RGTC1_SNORM, PIPE_TEXTURE_2D, 0, - PIPE_BIND_SAMPLER_VIEW, 0) && + PIPE_BIND_SAMPLER_VIEW) && screen->is_format_supported(screen, PIPE_FORMAT_RGTC2_UNORM, PIPE_TEXTURE_2D, 0, - PIPE_BIND_SAMPLER_VIEW, 0) && + PIPE_BIND_SAMPLER_VIEW) && screen->is_format_supported(screen, PIPE_FORMAT_RGTC2_SNORM, PIPE_TEXTURE_2D, 0, - PIPE_BIND_SAMPLER_VIEW, 0) + PIPE_BIND_SAMPLER_VIEW) ) { ctx->Extensions.ARB_texture_compression_rgtc = GL_TRUE; } if (screen->is_format_supported(screen, PIPE_FORMAT_LATC1_UNORM, PIPE_TEXTURE_2D, 0, - PIPE_BIND_SAMPLER_VIEW, 0) && + PIPE_BIND_SAMPLER_VIEW) && screen->is_format_supported(screen, PIPE_FORMAT_LATC1_SNORM, PIPE_TEXTURE_2D, 0, - PIPE_BIND_SAMPLER_VIEW, 0) && + PIPE_BIND_SAMPLER_VIEW) && screen->is_format_supported(screen, PIPE_FORMAT_LATC2_UNORM, PIPE_TEXTURE_2D, 0, - PIPE_BIND_SAMPLER_VIEW, 0) && + PIPE_BIND_SAMPLER_VIEW) && screen->is_format_supported(screen, PIPE_FORMAT_LATC2_SNORM, PIPE_TEXTURE_2D, 0, - PIPE_BIND_SAMPLER_VIEW, 0)) { + PIPE_BIND_SAMPLER_VIEW)) { ctx->Extensions.EXT_texture_compression_latc = GL_TRUE; } if (screen->is_format_supported(screen, PIPE_FORMAT_LATC2_UNORM, PIPE_TEXTURE_2D, 0, - PIPE_BIND_SAMPLER_VIEW, 0)) { + PIPE_BIND_SAMPLER_VIEW)) { ctx->Extensions.ATI_texture_compression_3dc = GL_TRUE; } /* ycbcr support */ if (screen->is_format_supported(screen, PIPE_FORMAT_UYVY, PIPE_TEXTURE_2D, 0, - PIPE_BIND_SAMPLER_VIEW, 0) || + PIPE_BIND_SAMPLER_VIEW) || screen->is_format_supported(screen, PIPE_FORMAT_YUYV, PIPE_TEXTURE_2D, 0, - PIPE_BIND_SAMPLER_VIEW, 0)) { + PIPE_BIND_SAMPLER_VIEW)) { ctx->Extensions.MESA_ycbcr_texture = GL_TRUE; } @@ -490,7 +490,7 @@ void st_init_extensions(struct st_context *st) /* GL_ARB_half_float_vertex */ if (screen->is_format_supported(screen, PIPE_FORMAT_R16G16B16A16_FLOAT, PIPE_BUFFER, 0, - PIPE_BIND_VERTEX_BUFFER, 0)) { + PIPE_BIND_VERTEX_BUFFER)) { ctx->Extensions.ARB_half_float_vertex = GL_TRUE; } diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 6b89bae7d16..03655ee0483 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -432,13 +432,12 @@ find_supported_format(struct pipe_screen *screen, uint num_formats, enum pipe_texture_target target, unsigned sample_count, - unsigned tex_usage, - unsigned geom_flags) + unsigned tex_usage) { uint i; for (i = 0; i < num_formats; i++) { if (screen->is_format_supported(screen, formats[i], target, - sample_count, tex_usage, geom_flags)) { + sample_count, tex_usage)) { return formats[i]; } } @@ -453,8 +452,7 @@ static enum pipe_format default_rgba_format(struct pipe_screen *screen, enum pipe_texture_target target, unsigned sample_count, - unsigned tex_usage, - unsigned geom_flags) + unsigned tex_usage) { static const enum pipe_format colorFormats[] = { PIPE_FORMAT_B8G8R8A8_UNORM, @@ -463,7 +461,7 @@ default_rgba_format(struct pipe_screen *screen, PIPE_FORMAT_B5G6R5_UNORM }; return find_supported_format(screen, colorFormats, Elements(colorFormats), - target, sample_count, tex_usage, geom_flags); + target, sample_count, tex_usage); } @@ -474,8 +472,7 @@ static enum pipe_format default_rgb_format(struct pipe_screen *screen, enum pipe_texture_target target, unsigned sample_count, - unsigned tex_usage, - unsigned geom_flags) + unsigned tex_usage) { static const enum pipe_format colorFormats[] = { PIPE_FORMAT_B8G8R8X8_UNORM, @@ -487,7 +484,7 @@ default_rgb_format(struct pipe_screen *screen, PIPE_FORMAT_B5G6R5_UNORM }; return find_supported_format(screen, colorFormats, Elements(colorFormats), - target, sample_count, tex_usage, geom_flags); + target, sample_count, tex_usage); } /** @@ -497,8 +494,7 @@ static enum pipe_format default_srgba_format(struct pipe_screen *screen, enum pipe_texture_target target, unsigned sample_count, - unsigned tex_usage, - unsigned geom_flags) + unsigned tex_usage) { static const enum pipe_format colorFormats[] = { PIPE_FORMAT_B8G8R8A8_SRGB, @@ -506,7 +502,7 @@ default_srgba_format(struct pipe_screen *screen, PIPE_FORMAT_A8B8G8R8_SRGB, }; return find_supported_format(screen, colorFormats, Elements(colorFormats), - target, sample_count, tex_usage, geom_flags); + target, sample_count, tex_usage); } @@ -528,87 +524,71 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, enum pipe_texture_target target, unsigned sample_count, unsigned bindings) { - unsigned geom_flags = 0; /* we don't care about POT vs. NPOT here, yet */ switch (internalFormat) { case GL_RGB10: case GL_RGB10_A2: if (screen->is_format_supported( screen, PIPE_FORMAT_B10G10R10A2_UNORM, - target, sample_count, bindings, - geom_flags )) + target, sample_count, bindings)) return PIPE_FORMAT_B10G10R10A2_UNORM; /* Pass through. */ case 4: case GL_RGBA: case GL_RGBA8: - return default_rgba_format( screen, target, sample_count, bindings, - geom_flags ); + return default_rgba_format( screen, target, sample_count, bindings); case GL_BGRA: if (screen->is_format_supported( screen, PIPE_FORMAT_B8G8R8A8_UNORM, - target, sample_count, bindings, - geom_flags )) + target, sample_count, bindings)) return PIPE_FORMAT_B8G8R8A8_UNORM; - return default_rgba_format( screen, target, sample_count, bindings, - geom_flags ); + return default_rgba_format( screen, target, sample_count, bindings); case 3: case GL_RGB: case GL_RGB8: - return default_rgb_format( screen, target, sample_count, bindings, - geom_flags ); + return default_rgb_format( screen, target, sample_count, bindings); case GL_RGB12: case GL_RGB16: case GL_RGBA12: case GL_RGBA16: if (screen->is_format_supported( screen, PIPE_FORMAT_R16G16B16A16_UNORM, - target, sample_count, bindings, - geom_flags )) + target, sample_count, bindings)) return PIPE_FORMAT_R16G16B16A16_UNORM; - return default_rgba_format( screen, target, sample_count, bindings, - geom_flags ); + return default_rgba_format( screen, target, sample_count, bindings); case GL_RGBA4: case GL_RGBA2: if (screen->is_format_supported( screen, PIPE_FORMAT_B4G4R4A4_UNORM, - target, sample_count, bindings, - geom_flags )) + target, sample_count, bindings)) return PIPE_FORMAT_B4G4R4A4_UNORM; - return default_rgba_format( screen, target, sample_count, bindings, - geom_flags ); + return default_rgba_format( screen, target, sample_count, bindings); case GL_RGB5_A1: if (screen->is_format_supported( screen, PIPE_FORMAT_B5G5R5A1_UNORM, - target, sample_count, bindings, - geom_flags )) + target, sample_count, bindings)) return PIPE_FORMAT_B5G5R5A1_UNORM; - return default_rgba_format( screen, target, sample_count, bindings, - geom_flags ); + return default_rgba_format( screen, target, sample_count, bindings); case GL_R3_G3_B2: if (screen->is_format_supported( screen, PIPE_FORMAT_B2G3R3_UNORM, - target, sample_count, bindings, - geom_flags )) + target, sample_count, bindings)) return PIPE_FORMAT_B2G3R3_UNORM; /* Pass through. */ case GL_RGB5: case GL_RGB4: if (screen->is_format_supported( screen, PIPE_FORMAT_B5G6R5_UNORM, - target, sample_count, bindings, - geom_flags )) + target, sample_count, bindings)) return PIPE_FORMAT_B5G6R5_UNORM; if (screen->is_format_supported( screen, PIPE_FORMAT_B5G5R5A1_UNORM, - target, sample_count, bindings, - geom_flags )) + target, sample_count, bindings)) return PIPE_FORMAT_B5G5R5A1_UNORM; - return default_rgba_format( screen, target, sample_count, bindings, - geom_flags ); + return default_rgba_format( screen, target, sample_count, bindings); case GL_ALPHA12: case GL_ALPHA16: if (screen->is_format_supported( screen, PIPE_FORMAT_A16_UNORM, target, - sample_count, bindings, geom_flags )) + sample_count, bindings)) return PIPE_FORMAT_A16_UNORM; /* Pass through. */ case GL_ALPHA: @@ -616,15 +596,14 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, case GL_ALPHA8: case GL_COMPRESSED_ALPHA: if (screen->is_format_supported( screen, PIPE_FORMAT_A8_UNORM, target, - sample_count, bindings, geom_flags )) + sample_count, bindings)) return PIPE_FORMAT_A8_UNORM; - return default_rgba_format( screen, target, sample_count, bindings, - geom_flags ); + return default_rgba_format( screen, target, sample_count, bindings); case GL_LUMINANCE12: case GL_LUMINANCE16: if (screen->is_format_supported( screen, PIPE_FORMAT_L16_UNORM, target, - sample_count, bindings, geom_flags )) + sample_count, bindings)) return PIPE_FORMAT_L16_UNORM; /* Pass through. */ case 1: @@ -632,16 +611,15 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, case GL_LUMINANCE4: case GL_LUMINANCE8: if (screen->is_format_supported( screen, PIPE_FORMAT_L8_UNORM, target, - sample_count, bindings, geom_flags )) + sample_count, bindings)) return PIPE_FORMAT_L8_UNORM; - return default_rgba_format( screen, target, sample_count, bindings, - geom_flags ); + return default_rgba_format( screen, target, sample_count, bindings); case GL_LUMINANCE12_ALPHA4: case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: if (screen->is_format_supported( screen, PIPE_FORMAT_L16A16_UNORM, target, - sample_count, bindings, geom_flags )) + sample_count, bindings)) return PIPE_FORMAT_L16A16_UNORM; /* Pass through. */ case 2: @@ -649,25 +627,23 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, case GL_LUMINANCE6_ALPHA2: case GL_LUMINANCE8_ALPHA8: if (screen->is_format_supported( screen, PIPE_FORMAT_L8A8_UNORM, target, - sample_count, bindings, geom_flags )) + sample_count, bindings)) return PIPE_FORMAT_L8A8_UNORM; - return default_rgba_format( screen, target, sample_count, bindings, - geom_flags ); + return default_rgba_format( screen, target, sample_count, bindings); case GL_LUMINANCE4_ALPHA4: if (screen->is_format_supported( screen, PIPE_FORMAT_L4A4_UNORM, target, - sample_count, bindings, geom_flags )) + sample_count, bindings)) return PIPE_FORMAT_L4A4_UNORM; if (screen->is_format_supported( screen, PIPE_FORMAT_L8A8_UNORM, target, - sample_count, bindings, geom_flags )) + sample_count, bindings)) return PIPE_FORMAT_L8A8_UNORM; - return default_rgba_format( screen, target, sample_count, bindings, - geom_flags ); + return default_rgba_format( screen, target, sample_count, bindings); case GL_INTENSITY12: case GL_INTENSITY16: if (screen->is_format_supported( screen, PIPE_FORMAT_I16_UNORM, target, - sample_count, bindings, geom_flags )) + sample_count, bindings)) return PIPE_FORMAT_I16_UNORM; /* Pass through. */ case GL_INTENSITY: @@ -675,18 +651,17 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, case GL_INTENSITY8: case GL_COMPRESSED_INTENSITY: if (screen->is_format_supported( screen, PIPE_FORMAT_I8_UNORM, target, - sample_count, bindings, geom_flags )) + sample_count, bindings)) return PIPE_FORMAT_I8_UNORM; - return default_rgba_format( screen, target, sample_count, bindings, - geom_flags ); + return default_rgba_format( screen, target, sample_count, bindings); case GL_YCBCR_MESA: if (screen->is_format_supported(screen, PIPE_FORMAT_UYVY, target, - sample_count, bindings, geom_flags)) { + sample_count, bindings)) { return PIPE_FORMAT_UYVY; } if (screen->is_format_supported(screen, PIPE_FORMAT_YUYV, target, - sample_count, bindings, geom_flags)) { + sample_count, bindings)) { return PIPE_FORMAT_YUYV; } return PIPE_FORMAT_NONE; @@ -696,39 +671,33 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, if (bindings & ~PIPE_BIND_SAMPLER_VIEW) return PIPE_FORMAT_NONE; else if (screen->is_format_supported(screen, PIPE_FORMAT_DXT1_RGB, - target, sample_count, bindings, - geom_flags)) + target, sample_count, bindings)) return PIPE_FORMAT_DXT1_RGB; else - return default_rgb_format(screen, target, sample_count, bindings, - geom_flags); + return default_rgb_format(screen, target, sample_count, bindings); case GL_COMPRESSED_RGBA: /* can only sample from compressed formats */ if (bindings & ~PIPE_BIND_SAMPLER_VIEW) return PIPE_FORMAT_NONE; else if (screen->is_format_supported(screen, PIPE_FORMAT_DXT3_RGBA, - target, sample_count, bindings, - geom_flags)) + target, sample_count, bindings)) return PIPE_FORMAT_DXT3_RGBA; else - return default_rgba_format(screen, target, sample_count, bindings, - geom_flags); + return default_rgba_format(screen, target, sample_count, bindings); case GL_RGB_S3TC: case GL_RGB4_S3TC: case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: if (screen->is_format_supported(screen, PIPE_FORMAT_DXT1_RGB, - target, sample_count, bindings, - geom_flags)) + target, sample_count, bindings)) return PIPE_FORMAT_DXT1_RGB; else return PIPE_FORMAT_NONE; case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: if (screen->is_format_supported(screen, PIPE_FORMAT_DXT1_RGBA, - target, sample_count, bindings, - geom_flags)) + target, sample_count, bindings)) return PIPE_FORMAT_DXT1_RGBA; else return PIPE_FORMAT_NONE; @@ -737,16 +706,14 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, case GL_RGBA4_S3TC: case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: if (screen->is_format_supported(screen, PIPE_FORMAT_DXT3_RGBA, - target, sample_count, bindings, - geom_flags)) + target, sample_count, bindings)) return PIPE_FORMAT_DXT3_RGBA; else return PIPE_FORMAT_NONE; case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: if (screen->is_format_supported(screen, PIPE_FORMAT_DXT5_RGBA, - target, sample_count, bindings, - geom_flags)) + target, sample_count, bindings)) return PIPE_FORMAT_DXT5_RGBA; else return PIPE_FORMAT_NONE; @@ -760,20 +727,20 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, case GL_DEPTH_COMPONENT16: if (screen->is_format_supported(screen, PIPE_FORMAT_Z16_UNORM, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_Z16_UNORM; /* fall-through */ case GL_DEPTH_COMPONENT24: if (screen->is_format_supported(screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED, - target, sample_count, bindings, geom_flags)) + target, sample_count, bindings)) return PIPE_FORMAT_Z24_UNORM_S8_USCALED; if (screen->is_format_supported(screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM, - target, sample_count, bindings, geom_flags)) + target, sample_count, bindings)) return PIPE_FORMAT_S8_USCALED_Z24_UNORM; /* fall-through */ case GL_DEPTH_COMPONENT32: if (screen->is_format_supported(screen, PIPE_FORMAT_Z32_UNORM, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_Z32_UNORM; /* fall-through */ case GL_DEPTH_COMPONENT: @@ -785,7 +752,7 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, PIPE_FORMAT_Z16_UNORM }; return find_supported_format(screen, formats, Elements(formats), - target, sample_count, bindings, geom_flags); + target, sample_count, bindings); } case GL_STENCIL_INDEX: @@ -800,7 +767,7 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, PIPE_FORMAT_S8_USCALED_Z24_UNORM }; return find_supported_format(screen, formats, Elements(formats), - target, sample_count, bindings, geom_flags); + target, sample_count, bindings); } case GL_DEPTH_STENCIL_EXT: @@ -811,23 +778,21 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, PIPE_FORMAT_S8_USCALED_Z24_UNORM }; return find_supported_format(screen, formats, Elements(formats), - target, sample_count, bindings, geom_flags); + target, sample_count, bindings); } case GL_SRGB_EXT: case GL_SRGB8_EXT: case GL_SRGB_ALPHA_EXT: case GL_SRGB8_ALPHA8_EXT: - return default_srgba_format( screen, target, sample_count, bindings, - geom_flags ); + return default_srgba_format( screen, target, sample_count, bindings); case GL_COMPRESSED_SRGB_EXT: case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: if (screen->is_format_supported(screen, PIPE_FORMAT_DXT1_SRGB, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_DXT1_SRGB; - return default_srgba_format( screen, target, sample_count, bindings, - geom_flags ); + return default_srgba_format( screen, target, sample_count, bindings); case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: return PIPE_FORMAT_DXT1_SRGBA; @@ -835,10 +800,9 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, case GL_COMPRESSED_SRGB_ALPHA_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: if (screen->is_format_supported(screen, PIPE_FORMAT_DXT3_SRGBA, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_DXT3_SRGBA; - return default_srgba_format( screen, target, sample_count, bindings, - geom_flags ); + return default_srgba_format( screen, target, sample_count, bindings); case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: return PIPE_FORMAT_DXT5_SRGBA; @@ -848,89 +812,87 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, case GL_COMPRESSED_SLUMINANCE_EXT: case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT: if (screen->is_format_supported(screen, PIPE_FORMAT_L8A8_SRGB, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_L8A8_SRGB; - return default_srgba_format( screen, target, sample_count, bindings, - geom_flags ); + return default_srgba_format( screen, target, sample_count, bindings); case GL_SLUMINANCE_EXT: case GL_SLUMINANCE8_EXT: if (screen->is_format_supported(screen, PIPE_FORMAT_L8_SRGB, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_L8_SRGB; - return default_srgba_format( screen, target, sample_count, bindings, - geom_flags ); + return default_srgba_format( screen, target, sample_count, bindings); case GL_RED: case GL_R8: if (screen->is_format_supported(screen, PIPE_FORMAT_R8_UNORM, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_R8_UNORM; return PIPE_FORMAT_NONE; case GL_RG: case GL_RG8: if (screen->is_format_supported(screen, PIPE_FORMAT_R8G8_UNORM, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_R8G8_UNORM; return PIPE_FORMAT_NONE; case GL_R16: if (screen->is_format_supported(screen, PIPE_FORMAT_R16_UNORM, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_R16_UNORM; return PIPE_FORMAT_NONE; case GL_RG16: if (screen->is_format_supported(screen, PIPE_FORMAT_R16G16_UNORM, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_R16G16_UNORM; return PIPE_FORMAT_NONE; case GL_COMPRESSED_RED: case GL_COMPRESSED_RED_RGTC1: if (screen->is_format_supported(screen, PIPE_FORMAT_RGTC1_UNORM, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_RGTC1_UNORM; if (screen->is_format_supported(screen, PIPE_FORMAT_R8_UNORM, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_R8_UNORM; return PIPE_FORMAT_NONE; case GL_COMPRESSED_SIGNED_RED_RGTC1: if (screen->is_format_supported(screen, PIPE_FORMAT_RGTC1_SNORM, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_RGTC1_SNORM; return PIPE_FORMAT_NONE; case GL_COMPRESSED_RG: case GL_COMPRESSED_RG_RGTC2: if (screen->is_format_supported(screen, PIPE_FORMAT_RGTC2_UNORM, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_RGTC2_UNORM; if (screen->is_format_supported(screen, PIPE_FORMAT_R8G8_UNORM, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_R8G8_UNORM; return PIPE_FORMAT_NONE; case GL_COMPRESSED_SIGNED_RG_RGTC2: if (screen->is_format_supported(screen, PIPE_FORMAT_RGTC2_SNORM, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_RGTC2_SNORM; return PIPE_FORMAT_NONE; case GL_COMPRESSED_LUMINANCE: case GL_COMPRESSED_LUMINANCE_LATC1_EXT: if (screen->is_format_supported(screen, PIPE_FORMAT_LATC1_UNORM, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_LATC1_UNORM; if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_L8_UNORM; return PIPE_FORMAT_NONE; case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT: if (screen->is_format_supported(screen, PIPE_FORMAT_LATC1_SNORM, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_LATC1_SNORM; return PIPE_FORMAT_NONE; @@ -938,16 +900,16 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT: case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI: if (screen->is_format_supported(screen, PIPE_FORMAT_LATC2_UNORM, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_LATC2_UNORM; if (screen->is_format_supported(screen, PIPE_FORMAT_L8A8_UNORM, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_L8A8_UNORM; return PIPE_FORMAT_NONE; case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT: if (screen->is_format_supported(screen, PIPE_FORMAT_LATC2_SNORM, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_LATC2_SNORM; return PIPE_FORMAT_NONE; @@ -974,7 +936,7 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, case GL_LUMINANCE_ALPHA8I_EXT: if (screen->is_format_supported(screen, PIPE_FORMAT_R8G8B8A8_SSCALED, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_R8G8B8A8_SSCALED; return PIPE_FORMAT_NONE; case GL_RGBA16I_EXT: @@ -985,7 +947,7 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, case GL_LUMINANCE_ALPHA16I_EXT: if (screen->is_format_supported(screen, PIPE_FORMAT_R16G16B16A16_SSCALED, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_R16G16B16A16_SSCALED; return PIPE_FORMAT_NONE; case GL_RGBA32I_EXT: @@ -997,7 +959,7 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, /* xxx */ if (screen->is_format_supported(screen, PIPE_FORMAT_R32G32B32A32_SSCALED, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_R32G32B32A32_SSCALED; return PIPE_FORMAT_NONE; @@ -1009,7 +971,7 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, case GL_LUMINANCE_ALPHA8UI_EXT: if (screen->is_format_supported(screen, PIPE_FORMAT_R8G8B8A8_USCALED, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_R8G8B8A8_USCALED; return PIPE_FORMAT_NONE; @@ -1021,7 +983,7 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, case GL_LUMINANCE_ALPHA16UI_EXT: if (screen->is_format_supported(screen, PIPE_FORMAT_R16G16B16A16_USCALED, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_R16G16B16A16_USCALED; return PIPE_FORMAT_NONE; @@ -1033,7 +995,7 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, case GL_LUMINANCE_ALPHA32UI_EXT: if (screen->is_format_supported(screen, PIPE_FORMAT_R32G32B32A32_USCALED, target, - sample_count, bindings, geom_flags)) + sample_count, bindings)) return PIPE_FORMAT_R32G32B32A32_USCALED; return PIPE_FORMAT_NONE; diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index 899161e78ff..aea69c1b434 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -87,7 +87,7 @@ st_render_mipmap(struct st_context *st, /* XXX should probably kill this and always use util_gen_mipmap since this implements a sw fallback as well */ if (!screen->is_format_supported(screen, psv->format, psv->texture->target, - 0, PIPE_BIND_RENDER_TARGET, 0)) { + 0, PIPE_BIND_RENDER_TARGET)) { return FALSE; } diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index 1e0a8323ab8..ffe7e256a56 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -78,7 +78,7 @@ st_texture_create(struct st_context *st, assert(format); assert(screen->is_format_supported(screen, format, target, 0, - PIPE_BIND_SAMPLER_VIEW, 0)); + PIPE_BIND_SAMPLER_VIEW)); memset(&pt, 0, sizeof(pt)); pt.target = target; -- cgit v1.2.3 From 7e02303497237cde958c28608477d0c355a8038b Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Tue, 8 Mar 2011 00:57:48 +0100 Subject: gallium: remove flags from the flush function The drivers have been changed so that they behave as if all of the flags were set. This is already implicit in most hardware drivers and required for multiple contexts. Some state trackers were also abusing the PIPE_FLUSH_RENDER_CACHE flag to decide whether flush_frontbuffer should be called. New flag ST_FLUSH_FRONT has been added to st_api.h as a replacement. --- src/gallium/docs/d3d11ddi.txt | 4 +- src/gallium/drivers/cell/ppu/cell_flush.c | 7 +-- src/gallium/drivers/failover/fo_context.c | 4 +- src/gallium/drivers/galahad/glhd_context.c | 2 - src/gallium/drivers/i915/i915_flush.c | 2 +- src/gallium/drivers/i965/brw_pipe_flush.c | 1 - src/gallium/drivers/identity/id_context.c | 2 - src/gallium/drivers/llvmpipe/lp_context.c | 3 +- src/gallium/drivers/llvmpipe/lp_flush.c | 39 ++++++------ src/gallium/drivers/llvmpipe/lp_flush.h | 2 - src/gallium/drivers/llvmpipe/lp_query.c | 4 +- src/gallium/drivers/llvmpipe/lp_setup.c | 8 +-- src/gallium/drivers/llvmpipe/lp_setup.h | 1 - src/gallium/drivers/llvmpipe/lp_surface.c | 2 - src/gallium/drivers/llvmpipe/lp_texture.c | 1 - src/gallium/drivers/noop/noop_pipe.c | 2 +- src/gallium/drivers/nv50/nv50_context.c | 10 ++-- src/gallium/drivers/nvc0/nvc0_context.c | 15 ++--- src/gallium/drivers/nvfx/nvfx_context.c | 7 ++- src/gallium/drivers/nvfx/nvfx_state_emit.c | 2 +- src/gallium/drivers/r300/r300_flush.c | 2 - src/gallium/drivers/r300/r300_transfer.c | 2 +- src/gallium/drivers/r600/r600_pipe.c | 2 +- src/gallium/drivers/r600/r600_query.c | 2 +- src/gallium/drivers/r600/r600_texture.c | 4 +- src/gallium/drivers/rbug/rbug_context.c | 2 - src/gallium/drivers/rbug/rbug_core.c | 2 +- src/gallium/drivers/softpipe/sp_context.c | 2 +- src/gallium/drivers/softpipe/sp_flush.c | 69 +++++++++++----------- src/gallium/drivers/softpipe/sp_flush.h | 9 ++- src/gallium/drivers/svga/svga_pipe_draw.c | 2 +- src/gallium/drivers/svga/svga_pipe_flush.c | 33 +++++------ src/gallium/drivers/trace/tr_context.c | 4 +- src/gallium/include/pipe/p_context.h | 4 +- src/gallium/include/pipe/p_defines.h | 9 --- src/gallium/include/state_tracker/st_api.h | 5 ++ .../state_trackers/d3d1x/dxgi/src/dxgi_native.cpp | 2 +- .../state_trackers/d3d1x/gd3d11/d3d11_context.h | 2 +- .../state_trackers/dri/common/dri_context.c | 4 +- src/gallium/state_trackers/dri/sw/drisw.c | 2 +- .../state_trackers/egl/common/egl_g3d_api.c | 17 ++---- .../state_trackers/egl/common/egl_g3d_sync.c | 2 +- .../state_trackers/egl/common/native_helper.c | 2 +- src/gallium/state_trackers/glx/xlib/xm_api.c | 8 +-- src/gallium/state_trackers/vega/api_context.c | 4 +- src/gallium/state_trackers/vega/vg_manager.c | 4 +- src/gallium/state_trackers/wgl/stw_context.c | 8 +-- src/gallium/state_trackers/xorg/xorg_dri2.c | 4 +- src/gallium/state_trackers/xorg/xorg_driver.c | 2 +- src/gallium/state_trackers/xorg/xorg_exa.c | 6 +- src/gallium/state_trackers/xorg/xorg_exa.h | 2 +- src/gallium/tests/graw/clear.c | 2 +- src/gallium/tests/graw/fs-test.c | 2 +- src/gallium/tests/graw/gs-test.c | 2 +- src/gallium/tests/graw/quad-sample.c | 2 +- src/gallium/tests/graw/quad-tex.c | 2 +- src/gallium/tests/graw/shader-leak.c | 2 +- src/gallium/tests/graw/tri-gs.c | 2 +- src/gallium/tests/graw/tri-instanced.c | 2 +- src/gallium/tests/graw/tri.c | 2 +- src/gallium/tests/graw/vs-test.c | 2 +- src/gallium/tests/trivial/quad-tex.c | 2 +- src/gallium/tests/trivial/tri.c | 2 +- src/gallium/winsys/r600/drm/r600_bo.c | 2 +- src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c | 2 +- src/mesa/state_tracker/st_cb_flush.c | 8 +-- src/mesa/state_tracker/st_cb_flush.h | 2 +- src/mesa/state_tracker/st_cb_syncobj.c | 2 +- src/mesa/state_tracker/st_manager.c | 4 +- 69 files changed, 169 insertions(+), 215 deletions(-) (limited to 'src/gallium/drivers/rbug') diff --git a/src/gallium/docs/d3d11ddi.txt b/src/gallium/docs/d3d11ddi.txt index 0a9e7e50f1d..b5a06b4b943 100644 --- a/src/gallium/docs/d3d11ddi.txt +++ b/src/gallium/docs/d3d11ddi.txt @@ -453,8 +453,8 @@ SetVertexPipelineOutput (D3D10.1+ only) SetViewports - Gallium lacks support for multiple geometry-shader-selectable viewports D3D11 has -ShaderResourceViewReadAfterWriteHazard -> flush(PIPE_FLUSH_RENDER_CACHE) - - Gallium does not support specifying this per-render-target/view +ShaderResourceViewReadAfterWriteHazard + - Gallium lacks support for this SoSetTargets -> set_stream_output_buffers diff --git a/src/gallium/drivers/cell/ppu/cell_flush.c b/src/gallium/drivers/cell/ppu/cell_flush.c index 8275c9dc9c7..463f4d03eb9 100644 --- a/src/gallium/drivers/cell/ppu/cell_flush.c +++ b/src/gallium/drivers/cell/ppu/cell_flush.c @@ -38,19 +38,16 @@ * Called via pipe->flush() */ void -cell_flush(struct pipe_context *pipe, unsigned flags, +cell_flush(struct pipe_context *pipe, struct pipe_fence_handle **fence) { struct cell_context *cell = cell_context(pipe); if (fence) { *fence = NULL; - /* XXX: Implement real fencing */ - flags |= CELL_FLUSH_WAIT; } - if (flags & (PIPE_FLUSH_SWAPBUFFERS | PIPE_FLUSH_RENDER_CACHE)) - flags |= CELL_FLUSH_WAIT; + flags |= CELL_FLUSH_WAIT; draw_flush( cell->draw ); cell_flush_int(cell, flags); diff --git a/src/gallium/drivers/failover/fo_context.c b/src/gallium/drivers/failover/fo_context.c index b536dc4afab..0fefec9aaea 100644 --- a/src/gallium/drivers/failover/fo_context.c +++ b/src/gallium/drivers/failover/fo_context.c @@ -79,7 +79,7 @@ static void failover_draw_vbo( struct pipe_context *pipe, if (failover->mode == FO_SW) { if (failover->dirty) { - failover->hw->flush( failover->hw, ~0, NULL ); + failover->hw->flush( failover->hw, NULL ); failover_state_emit( failover ); } @@ -89,7 +89,7 @@ static void failover_draw_vbo( struct pipe_context *pipe, * intervening flush. Unlikely to be much performance impact to * this: */ - failover->sw->flush( failover->sw, ~0, NULL ); + failover->sw->flush( failover->sw, NULL ); } } diff --git a/src/gallium/drivers/galahad/glhd_context.c b/src/gallium/drivers/galahad/glhd_context.c index 1dc652c6bd9..813a21e2ee3 100644 --- a/src/gallium/drivers/galahad/glhd_context.c +++ b/src/gallium/drivers/galahad/glhd_context.c @@ -761,14 +761,12 @@ galahad_clear_depth_stencil(struct pipe_context *_pipe, static void galahad_flush(struct pipe_context *_pipe, - unsigned flags, struct pipe_fence_handle **fence) { struct galahad_context *glhd_pipe = galahad_context(_pipe); struct pipe_context *pipe = glhd_pipe->pipe; pipe->flush(pipe, - flags, fence); } diff --git a/src/gallium/drivers/i915/i915_flush.c b/src/gallium/drivers/i915/i915_flush.c index f2044d661e3..87966d98079 100644 --- a/src/gallium/drivers/i915/i915_flush.c +++ b/src/gallium/drivers/i915/i915_flush.c @@ -39,7 +39,6 @@ static void i915_flush_pipe( struct pipe_context *pipe, - unsigned flags, struct pipe_fence_handle **fence ) { struct i915_context *i915 = i915_context(pipe); @@ -50,6 +49,7 @@ static void i915_flush_pipe( struct pipe_context *pipe, /* Do we need to emit an MI_FLUSH command to flush the hardware * caches? */ + /* XXX These flags are now implicit. All of them. */ if (flags & (PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE)) { unsigned flush = MI_FLUSH; diff --git a/src/gallium/drivers/i965/brw_pipe_flush.c b/src/gallium/drivers/i965/brw_pipe_flush.c index 0ae1a6be9e5..3b4a99beed2 100644 --- a/src/gallium/drivers/i965/brw_pipe_flush.c +++ b/src/gallium/drivers/i965/brw_pipe_flush.c @@ -38,7 +38,6 @@ void brw_context_flush( struct brw_context *brw ) static void brw_flush( struct pipe_context *pipe, - unsigned flags, struct pipe_fence_handle **fence ) { brw_context_flush( brw_context( pipe ) ); diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c index 5c865f8a22c..2a9d7360155 100644 --- a/src/gallium/drivers/identity/id_context.c +++ b/src/gallium/drivers/identity/id_context.c @@ -668,14 +668,12 @@ identity_clear_depth_stencil(struct pipe_context *_pipe, static void identity_flush(struct pipe_context *_pipe, - unsigned flags, struct pipe_fence_handle **fence) { struct identity_context *id_pipe = identity_context(_pipe); struct pipe_context *pipe = id_pipe->pipe; pipe->flush(pipe, - flags, fence); } diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c index 644201ddf7c..8a5655d4996 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.c +++ b/src/gallium/drivers/llvmpipe/lp_context.c @@ -136,10 +136,9 @@ static void llvmpipe_destroy( struct pipe_context *pipe ) static void do_flush( struct pipe_context *pipe, - unsigned flags, struct pipe_fence_handle **fence) { - llvmpipe_flush(pipe, flags, fence, __FUNCTION__); + llvmpipe_flush(pipe, fence, __FUNCTION__); } diff --git a/src/gallium/drivers/llvmpipe/lp_flush.c b/src/gallium/drivers/llvmpipe/lp_flush.c index 2a3ba904fe4..42430550ea6 100644 --- a/src/gallium/drivers/llvmpipe/lp_flush.c +++ b/src/gallium/drivers/llvmpipe/lp_flush.c @@ -40,12 +40,10 @@ /** - * \param flags bitmask of PIPE_FLUSH_x flags * \param fence if non-null, returns pointer to a fence which can be waited on */ void llvmpipe_flush( struct pipe_context *pipe, - unsigned flags, struct pipe_fence_handle **fence, const char *reason) { @@ -54,7 +52,7 @@ llvmpipe_flush( struct pipe_context *pipe, draw_flush(llvmpipe->draw); /* ask the setup module to flush */ - lp_setup_flush(llvmpipe->setup, flags, fence, reason); + lp_setup_flush(llvmpipe->setup, fence, reason); if (llvmpipe_variant_count > 1000) { @@ -65,23 +63,21 @@ llvmpipe_flush( struct pipe_context *pipe, /* Enable to dump BMPs of the color/depth buffers each frame */ if (0) { - if (flags & PIPE_FLUSH_FRAME) { - static unsigned frame_no = 1; - char filename[256]; - unsigned i; - - for (i = 0; i < llvmpipe->framebuffer.nr_cbufs; i++) { - util_snprintf(filename, sizeof(filename), "cbuf%u_%u", i, frame_no); - debug_dump_surface_bmp(&llvmpipe->pipe, filename, llvmpipe->framebuffer.cbufs[i]); - } - - if (0) { - util_snprintf(filename, sizeof(filename), "zsbuf_%u", frame_no); - debug_dump_surface_bmp(&llvmpipe->pipe, filename, llvmpipe->framebuffer.zsbuf); - } - - ++frame_no; + static unsigned frame_no = 1; + char filename[256]; + unsigned i; + + for (i = 0; i < llvmpipe->framebuffer.nr_cbufs; i++) { + util_snprintf(filename, sizeof(filename), "cbuf%u_%u", i, frame_no); + debug_dump_surface_bmp(&llvmpipe->pipe, filename, llvmpipe->framebuffer.cbufs[i]); + } + + if (0) { + util_snprintf(filename, sizeof(filename), "zsbuf_%u", frame_no); + debug_dump_surface_bmp(&llvmpipe->pipe, filename, llvmpipe->framebuffer.zsbuf); } + + ++frame_no; } } @@ -90,7 +86,7 @@ llvmpipe_finish( struct pipe_context *pipe, const char *reason ) { struct pipe_fence_handle *fence = NULL; - llvmpipe_flush(pipe, 0, &fence, reason); + llvmpipe_flush(pipe, &fence, reason); if (fence) { pipe->screen->fence_finish(pipe->screen, fence, PIPE_TIMEOUT_INFINITE); pipe->screen->fence_reference(pipe->screen, &fence, NULL); @@ -110,7 +106,6 @@ llvmpipe_flush_resource(struct pipe_context *pipe, struct pipe_resource *resource, unsigned level, int layer, - unsigned flush_flags, boolean read_only, boolean cpu_access, boolean do_not_block, @@ -136,7 +131,7 @@ llvmpipe_flush_resource(struct pipe_context *pipe, * Just flush. */ - llvmpipe_flush(pipe, flush_flags, NULL, reason); + llvmpipe_flush(pipe, NULL, reason); } } diff --git a/src/gallium/drivers/llvmpipe/lp_flush.h b/src/gallium/drivers/llvmpipe/lp_flush.h index 579d24c68ad..efff94c8c0c 100644 --- a/src/gallium/drivers/llvmpipe/lp_flush.h +++ b/src/gallium/drivers/llvmpipe/lp_flush.h @@ -36,7 +36,6 @@ struct pipe_resource; void llvmpipe_flush(struct pipe_context *pipe, - unsigned flags, struct pipe_fence_handle **fence, const char *reason); @@ -49,7 +48,6 @@ llvmpipe_flush_resource(struct pipe_context *pipe, struct pipe_resource *resource, unsigned level, int layer, - unsigned flush_flags, boolean read_only, boolean cpu_access, boolean do_not_block, diff --git a/src/gallium/drivers/llvmpipe/lp_query.c b/src/gallium/drivers/llvmpipe/lp_query.c index 84c66dd36e8..1e2401fa84d 100644 --- a/src/gallium/drivers/llvmpipe/lp_query.c +++ b/src/gallium/drivers/llvmpipe/lp_query.c @@ -69,7 +69,7 @@ llvmpipe_destroy_query(struct pipe_context *pipe, struct pipe_query *q) */ if (pq->fence) { if (!lp_fence_issued(pq->fence)) - llvmpipe_flush(pipe, 0, NULL, __FUNCTION__); + llvmpipe_flush(pipe, NULL, __FUNCTION__); if (!lp_fence_signalled(pq->fence)) lp_fence_wait(pq->fence); @@ -99,7 +99,7 @@ llvmpipe_get_query_result(struct pipe_context *pipe, if (!lp_fence_signalled(pq->fence)) { if (!lp_fence_issued(pq->fence)) - llvmpipe_flush(pipe, 0, NULL, __FUNCTION__); + llvmpipe_flush(pipe, NULL, __FUNCTION__); if (!wait) return FALSE; diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 41d8fa6d124..3813e0ed972 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -333,12 +333,8 @@ fail: } -/** - * \param flags bitmask of PIPE_FLUSH_x flags - */ void lp_setup_flush( struct lp_setup_context *setup, - unsigned flags, struct pipe_fence_handle **fence, const char *reason) { @@ -469,7 +465,7 @@ lp_setup_clear( struct lp_setup_context *setup, unsigned flags ) { if (!lp_setup_try_clear( setup, color, depth, stencil, flags )) { - lp_setup_flush(setup, 0, NULL, __FUNCTION__); + lp_setup_flush(setup, NULL, __FUNCTION__); if (!lp_setup_try_clear( setup, color, depth, stencil, flags )) assert(0); @@ -1114,7 +1110,7 @@ lp_setup_end_query(struct lp_setup_context *setup, struct llvmpipe_query *pq) if (!lp_scene_bin_everywhere(setup->scene, LP_RAST_OP_END_QUERY, dummy)) { - lp_setup_flush(setup, 0, NULL, __FUNCTION__); + lp_setup_flush(setup, NULL, __FUNCTION__); } } else { diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h index 0d6e161a218..8655259d27c 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.h +++ b/src/gallium/drivers/llvmpipe/lp_setup.h @@ -64,7 +64,6 @@ lp_setup_clear(struct lp_setup_context *setup, void lp_setup_flush( struct lp_setup_context *setup, - unsigned flags, struct pipe_fence_handle **fence, const char *reason); diff --git a/src/gallium/drivers/llvmpipe/lp_surface.c b/src/gallium/drivers/llvmpipe/lp_surface.c index e7e46a628a1..f49638acf08 100644 --- a/src/gallium/drivers/llvmpipe/lp_surface.c +++ b/src/gallium/drivers/llvmpipe/lp_surface.c @@ -69,7 +69,6 @@ lp_resource_copy(struct pipe_context *pipe, llvmpipe_flush_resource(pipe, dst, dst_level, dstz, - 0, /* flush_flags */ FALSE, /* read_only */ TRUE, /* cpu_access */ FALSE, /* do_not_block */ @@ -77,7 +76,6 @@ lp_resource_copy(struct pipe_context *pipe, llvmpipe_flush_resource(pipe, src, src_level, src_box->z, - 0, /* flush_flags */ TRUE, /* read_only */ TRUE, /* cpu_access */ FALSE, /* do_not_block */ diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index 2e6a4bd7dc8..fa4ce5bf2ac 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -575,7 +575,6 @@ llvmpipe_get_transfer(struct pipe_context *pipe, if (!llvmpipe_flush_resource(pipe, resource, level, box->depth > 1 ? -1 : box->z, - 0, /* flush_flags */ read_only, TRUE, /* cpu_access */ do_not_block, diff --git a/src/gallium/drivers/noop/noop_pipe.c b/src/gallium/drivers/noop/noop_pipe.c index 9bcc1e6b45a..496b7f5ec6d 100644 --- a/src/gallium/drivers/noop/noop_pipe.c +++ b/src/gallium/drivers/noop/noop_pipe.c @@ -260,7 +260,7 @@ static void noop_resource_copy_region(struct pipe_context *ctx, /* * context */ -static void noop_flush(struct pipe_context *ctx, unsigned flags, +static void noop_flush(struct pipe_context *ctx, struct pipe_fence_handle **fence) { } diff --git a/src/gallium/drivers/nv50/nv50_context.c b/src/gallium/drivers/nv50/nv50_context.c index 912367b8391..c6bd0b15cbc 100644 --- a/src/gallium/drivers/nv50/nv50_context.c +++ b/src/gallium/drivers/nv50/nv50_context.c @@ -30,25 +30,25 @@ #include "nouveau/nouveau_reloc.h" static void -nv50_flush(struct pipe_context *pipe, unsigned flags, +nv50_flush(struct pipe_context *pipe, struct pipe_fence_handle **fence) { struct nv50_context *nv50 = nv50_context(pipe); struct nouveau_channel *chan = nv50->screen->base.channel; - if (flags & PIPE_FLUSH_TEXTURE_CACHE) { + /* XXX This flag wasn't set by the state tracker anyway. */ + /*if (flags & PIPE_FLUSH_TEXTURE_CACHE) { BEGIN_RING(chan, RING_3D_(NV50_GRAPH_WAIT_FOR_IDLE), 1); OUT_RING (chan, 0); BEGIN_RING(chan, RING_3D(TEX_CACHE_CTL), 1); OUT_RING (chan, 0x20); - } + }*/ if (fence) nouveau_fence_ref(nv50->screen->base.fence.current, (struct nouveau_fence **)fence); - if (flags & (PIPE_FLUSH_SWAPBUFFERS | PIPE_FLUSH_FRAME)) - FIRE_RING(chan); + FIRE_RING(chan); } void diff --git a/src/gallium/drivers/nvc0/nvc0_context.c b/src/gallium/drivers/nvc0/nvc0_context.c index d6de979b132..881d102dab0 100644 --- a/src/gallium/drivers/nvc0/nvc0_context.c +++ b/src/gallium/drivers/nvc0/nvc0_context.c @@ -30,29 +30,30 @@ #include "nouveau/nouveau_reloc.h" static void -nvc0_flush(struct pipe_context *pipe, unsigned flags, +nvc0_flush(struct pipe_context *pipe, struct pipe_fence_handle **fence) { struct nvc0_context *nvc0 = nvc0_context(pipe); struct nouveau_channel *chan = nvc0->screen->base.channel; - if (flags & PIPE_FLUSH_TEXTURE_CACHE) { + /* XXX This flag wasn't set by the state tracker anyway. */ + /*if (flags & PIPE_FLUSH_TEXTURE_CACHE) { BEGIN_RING(chan, RING_3D(SERIALIZE), 1); OUT_RING (chan, 0); BEGIN_RING(chan, RING_3D(TEX_CACHE_CTL), 1); OUT_RING (chan, 0x00); - } else - if ((flags & PIPE_FLUSH_RENDER_CACHE) && !(flags & PIPE_FLUSH_FRAME)) { + } else*/ + /* XXX FLUSH_FRAME is now implicit. */ + /*if ((flags & PIPE_FLUSH_RENDER_CACHE) && !(flags & PIPE_FLUSH_FRAME)) { BEGIN_RING(chan, RING_3D(SERIALIZE), 1); OUT_RING (chan, 0); - } + }*/ if (fence) nouveau_fence_ref(nvc0->screen->base.fence.current, (struct nouveau_fence **)fence); - if (flags & (PIPE_FLUSH_SWAPBUFFERS | PIPE_FLUSH_FRAME)) - FIRE_RING(chan); + FIRE_RING(chan); } static void diff --git a/src/gallium/drivers/nvfx/nvfx_context.c b/src/gallium/drivers/nvfx/nvfx_context.c index 6c8934d3a4a..2bcb93d93e3 100644 --- a/src/gallium/drivers/nvfx/nvfx_context.c +++ b/src/gallium/drivers/nvfx/nvfx_context.c @@ -7,7 +7,7 @@ #include "nvfx_resource.h" static void -nvfx_flush(struct pipe_context *pipe, unsigned flags, +nvfx_flush(struct pipe_context *pipe, struct pipe_fence_handle **fence) { struct nvfx_context *nvfx = nvfx_context(pipe); @@ -16,12 +16,13 @@ nvfx_flush(struct pipe_context *pipe, unsigned flags, struct nouveau_grobj *eng3d = screen->eng3d; /* XXX: we need to actually be intelligent here */ - if (flags & PIPE_FLUSH_TEXTURE_CACHE) { + /* XXX This flag wasn't set by the state tracker anyway. */ + /*if (flags & PIPE_FLUSH_TEXTURE_CACHE) { BEGIN_RING(chan, eng3d, 0x1fd8, 1); OUT_RING(chan, 2); BEGIN_RING(chan, eng3d, 0x1fd8, 1); OUT_RING(chan, 1); - } + }*/ FIRE_RING(chan); if (fence) diff --git a/src/gallium/drivers/nvfx/nvfx_state_emit.c b/src/gallium/drivers/nvfx/nvfx_state_emit.c index 40ae4f5bd21..ae9c31418c3 100644 --- a/src/gallium/drivers/nvfx/nvfx_state_emit.c +++ b/src/gallium/drivers/nvfx/nvfx_state_emit.c @@ -426,7 +426,7 @@ nvfx_state_validate_swtnl(struct nvfx_context *nvfx) NOUVEAU_ERR("hw->swtnl 0x%08x\n", nvfx->fallback_swtnl); warned = TRUE; } - nvfx->pipe.flush(&nvfx->pipe, 0, NULL); + nvfx->pipe.flush(&nvfx->pipe, NULL); nvfx->dirty |= (NVFX_NEW_VIEWPORT | NVFX_NEW_VERTPROG | NVFX_NEW_ARRAYS); diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c index fa0926868be..b3d0d344ec4 100644 --- a/src/gallium/drivers/r300/r300_flush.c +++ b/src/gallium/drivers/r300/r300_flush.c @@ -94,10 +94,8 @@ void r300_flush(struct pipe_context *pipe, } static void r300_flush_wrapped(struct pipe_context *pipe, - unsigned flags, struct pipe_fence_handle **fence) { - /* don't use the flags param, it means something else */ r300_flush(pipe, 0, fence); } diff --git a/src/gallium/drivers/r300/r300_transfer.c b/src/gallium/drivers/r300/r300_transfer.c index 928c86be0c5..65c5095be6a 100644 --- a/src/gallium/drivers/r300/r300_transfer.c +++ b/src/gallium/drivers/r300/r300_transfer.c @@ -73,7 +73,7 @@ static void r300_copy_into_tiled_texture(struct pipe_context *ctx, &r300transfer->linear_texture->b.b.b, 0, &src_box); /* XXX remove this. */ - ctx->flush(ctx, 0, NULL); + r300_flush(ctx, 0, NULL); } struct pipe_transfer* diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index d8e057fe5d2..8303b7224ac 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -48,7 +48,7 @@ /* * pipe_context */ -static void r600_flush(struct pipe_context *ctx, unsigned flags, +static void r600_flush(struct pipe_context *ctx, struct pipe_fence_handle **fence) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c index 343403f92f3..181ea3f9e49 100644 --- a/src/gallium/drivers/r600/r600_query.c +++ b/src/gallium/drivers/r600/r600_query.c @@ -62,7 +62,7 @@ static boolean r600_get_query_result(struct pipe_context *ctx, struct r600_query *rquery = (struct r600_query *)query; if (rquery->num_results) { - ctx->flush(ctx, 0, NULL); + ctx->flush(ctx, NULL); } return r600_context_query_result(&rctx->ctx, (struct r600_query *)query, wait, vresult); } diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index f527c07adcd..86a9defa9af 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -68,7 +68,7 @@ static void r600_copy_from_staging_texture(struct pipe_context *ctx, struct r600 rtransfer->staging_texture, 0, &sbox); - ctx->flush(ctx, 0, NULL); + ctx->flush(ctx, NULL); } unsigned r600_texture_get_offset(struct r600_resource_texture *rtex, @@ -635,7 +635,7 @@ struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx, if (usage & PIPE_TRANSFER_READ) { r600_copy_to_staging_texture(ctx, trans); /* Always referenced in the blit. */ - ctx->flush(ctx, 0, NULL); + ctx->flush(ctx, NULL); } return &trans->transfer; } diff --git a/src/gallium/drivers/rbug/rbug_context.c b/src/gallium/drivers/rbug/rbug_context.c index f5e2d5f4d62..bd0eae9ac46 100644 --- a/src/gallium/drivers/rbug/rbug_context.c +++ b/src/gallium/drivers/rbug/rbug_context.c @@ -801,14 +801,12 @@ rbug_clear_depth_stencil(struct pipe_context *_pipe, static void rbug_flush(struct pipe_context *_pipe, - unsigned flags, struct pipe_fence_handle **fence) { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; pipe->flush(pipe, - flags, fence); } diff --git a/src/gallium/drivers/rbug/rbug_core.c b/src/gallium/drivers/rbug/rbug_core.c index eb772d19d05..b80bcd4228f 100644 --- a/src/gallium/drivers/rbug/rbug_core.c +++ b/src/gallium/drivers/rbug/rbug_core.c @@ -498,7 +498,7 @@ rbug_context_flush(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32 /* protect the pipe context */ pipe_mutex_lock(rb_context->call_mutex); - rb_context->pipe->flush(rb_context->pipe, flush->flags, NULL); + rb_context->pipe->flush(rb_context->pipe, NULL); pipe_mutex_unlock(rb_context->call_mutex); pipe_mutex_unlock(rb_screen->list_mutex); diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 5ea2ee58219..ce22f646228 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -255,7 +255,7 @@ softpipe_create_context( struct pipe_screen *screen, softpipe->pipe.draw_stream_output = softpipe_draw_stream_output; softpipe->pipe.clear = softpipe_clear; - softpipe->pipe.flush = softpipe_flush; + softpipe->pipe.flush = softpipe_flush_wrapped; softpipe->pipe.render_condition = softpipe_render_condition; diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c index edbce6a297a..720fea83cb2 100644 --- a/src/gallium/drivers/softpipe/sp_flush.c +++ b/src/gallium/drivers/softpipe/sp_flush.c @@ -42,7 +42,7 @@ void softpipe_flush( struct pipe_context *pipe, - unsigned flags, + unsigned flags, struct pipe_fence_handle **fence ) { struct softpipe_context *softpipe = softpipe_context(pipe); @@ -50,7 +50,7 @@ softpipe_flush( struct pipe_context *pipe, draw_flush(softpipe->draw); - if (flags & PIPE_FLUSH_TEXTURE_CACHE) { + if (flags & SP_FLUSH_TEXTURE_CACHE) { for (i = 0; i < softpipe->num_fragment_sampler_views; i++) { sp_flush_tex_tile_cache(softpipe->fragment_tex_cache[i]); } @@ -62,34 +62,27 @@ softpipe_flush( struct pipe_context *pipe, } } - if (flags & PIPE_FLUSH_SWAPBUFFERS) { - /* If this is a swapbuffers, just flush color buffers. - * - * The zbuffer changes are not discarded, but held in the cache - * in the hope that a later clear will wipe them out. - */ - for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) - if (softpipe->cbuf_cache[i]) - sp_flush_tile_cache(softpipe->cbuf_cache[i]); - - /* Need this call for hardware buffers before swapbuffers. - * - * there should probably be another/different flush-type function - * that's called before swapbuffers because we don't always want - * to unmap surfaces when flushing. - */ - softpipe_unmap_transfers(softpipe); - } - else if (flags & PIPE_FLUSH_RENDER_CACHE) { - for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) - if (softpipe->cbuf_cache[i]) - sp_flush_tile_cache(softpipe->cbuf_cache[i]); - - if (softpipe->zsbuf_cache) - sp_flush_tile_cache(softpipe->zsbuf_cache); - - softpipe->dirty_render_cache = FALSE; - } + /* If this is a swapbuffers, just flush color buffers. + * + * The zbuffer changes are not discarded, but held in the cache + * in the hope that a later clear will wipe them out. + */ + for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) + if (softpipe->cbuf_cache[i]) + sp_flush_tile_cache(softpipe->cbuf_cache[i]); + + if (softpipe->zsbuf_cache) + sp_flush_tile_cache(softpipe->zsbuf_cache); + + softpipe->dirty_render_cache = FALSE; + + /* Need this call for hardware buffers before swapbuffers. + * + * there should probably be another/different flush-type function + * that's called before swapbuffers because we don't always want + * to unmap surfaces when flushing. + */ + softpipe_unmap_transfers(softpipe); /* Enable to dump BMPs of the color/depth buffers each frame */ #if 0 @@ -108,6 +101,13 @@ softpipe_flush( struct pipe_context *pipe, *fence = NULL; } +void +softpipe_flush_wrapped( struct pipe_context *pipe, + struct pipe_fence_handle **fence ) +{ + softpipe_flush(pipe, SP_FLUSH_TEXTURE_CACHE, fence); +} + /** * Flush context if necessary. @@ -139,11 +139,8 @@ softpipe_flush_resource(struct pipe_context *pipe, * disappear and the pipe driver should just ensure that all visible * side-effects happen when they need to happen. */ - if (referenced & SP_REFERENCED_FOR_WRITE) - flush_flags |= PIPE_FLUSH_RENDER_CACHE; - if (referenced & SP_REFERENCED_FOR_READ) - flush_flags |= PIPE_FLUSH_TEXTURE_CACHE; + flush_flags |= SP_FLUSH_TEXTURE_CACHE; if (cpu_access) { /* @@ -155,7 +152,7 @@ softpipe_flush_resource(struct pipe_context *pipe, if (do_not_block) return FALSE; - pipe->flush(pipe, flush_flags, &fence); + softpipe_flush(pipe, flush_flags, &fence); if (fence) { /* @@ -171,7 +168,7 @@ softpipe_flush_resource(struct pipe_context *pipe, * Just flush. */ - pipe->flush(pipe, flush_flags, NULL); + softpipe_flush(pipe, flush_flags, NULL); } } diff --git a/src/gallium/drivers/softpipe/sp_flush.h b/src/gallium/drivers/softpipe/sp_flush.h index 22a5ceeb9ec..ab01c249abe 100644 --- a/src/gallium/drivers/softpipe/sp_flush.h +++ b/src/gallium/drivers/softpipe/sp_flush.h @@ -33,10 +33,17 @@ struct pipe_context; struct pipe_fence_handle; +#define SP_FLUSH_TEXTURE_CACHE 0x2 + void -softpipe_flush(struct pipe_context *pipe, unsigned flags, +softpipe_flush(struct pipe_context *pipe, + unsigned flags, struct pipe_fence_handle **fence); +void +softpipe_flush_wrapped( struct pipe_context *pipe, + struct pipe_fence_handle **fence ); + boolean softpipe_flush_resource(struct pipe_context *pipe, struct pipe_resource *texture, diff --git a/src/gallium/drivers/svga/svga_pipe_draw.c b/src/gallium/drivers/svga/svga_pipe_draw.c index d98b9b0e000..fda5c28433c 100644 --- a/src/gallium/drivers/svga/svga_pipe_draw.c +++ b/src/gallium/drivers/svga/svga_pipe_draw.c @@ -161,7 +161,7 @@ svga_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) /* We're switching between SW and HW drawing. Do a flush to avoid * mixing HW and SW rendering with the same vertex buffer. */ - pipe->flush(pipe, ~0, NULL); + pipe->flush(pipe, NULL); svga->prev_draw_swtnl = svga->state.sw.need_swtnl; } diff --git a/src/gallium/drivers/svga/svga_pipe_flush.c b/src/gallium/drivers/svga/svga_pipe_flush.c index 9357d827f28..4578c136cb8 100644 --- a/src/gallium/drivers/svga/svga_pipe_flush.c +++ b/src/gallium/drivers/svga/svga_pipe_flush.c @@ -32,7 +32,6 @@ static void svga_flush( struct pipe_context *pipe, - unsigned flags, struct pipe_fence_handle **fence ) { struct svga_context *svga = svga_context(pipe); @@ -45,29 +44,27 @@ static void svga_flush( struct pipe_context *pipe, */ svga_context_flush(svga, fence); - SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "%s flags %x fence_ptr %p\n", - __FUNCTION__, flags, fence ? *fence : 0x0); + SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "%s fence_ptr %p\n", + __FUNCTION__, fence ? *fence : 0x0); /* Enable to dump BMPs of the color/depth buffers each frame */ if (0) { - if (flags & PIPE_FLUSH_FRAME) { - struct pipe_framebuffer_state *fb = &svga->curr.framebuffer; - static unsigned frame_no = 1; - char filename[256]; - unsigned i; + struct pipe_framebuffer_state *fb = &svga->curr.framebuffer; + static unsigned frame_no = 1; + char filename[256]; + unsigned i; - for (i = 0; i < fb->nr_cbufs; i++) { - util_snprintf(filename, sizeof(filename), "cbuf%u_%04u", i, frame_no); - debug_dump_surface_bmp(&svga->pipe, filename, fb->cbufs[i]); - } - - if (0 && fb->zsbuf) { - util_snprintf(filename, sizeof(filename), "zsbuf_%04u", frame_no); - debug_dump_surface_bmp(&svga->pipe, filename, fb->zsbuf); - } + for (i = 0; i < fb->nr_cbufs; i++) { + util_snprintf(filename, sizeof(filename), "cbuf%u_%04u", i, frame_no); + debug_dump_surface_bmp(&svga->pipe, filename, fb->cbufs[i]); + } - ++frame_no; + if (0 && fb->zsbuf) { + util_snprintf(filename, sizeof(filename), "zsbuf_%04u", frame_no); + debug_dump_surface_bmp(&svga->pipe, filename, fb->zsbuf); } + + ++frame_no; } } diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 6123873cac6..4db7619c424 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -1184,7 +1184,6 @@ trace_context_clear_depth_stencil(struct pipe_context *_pipe, static INLINE void trace_context_flush(struct pipe_context *_pipe, - unsigned flags, struct pipe_fence_handle **fence) { struct trace_context *tr_ctx = trace_context(_pipe); @@ -1193,9 +1192,8 @@ trace_context_flush(struct pipe_context *_pipe, trace_dump_call_begin("pipe_context", "flush"); trace_dump_arg(ptr, pipe); - trace_dump_arg(uint, flags); - pipe->flush(pipe, flags, fence); + pipe->flush(pipe, fence); if(fence) trace_dump_ret(ptr, *fence); diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 4a0fbfdd4d6..211f99f7cef 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -312,11 +312,9 @@ struct pipe_context { unsigned dstx, unsigned dsty, unsigned width, unsigned height); - /** Flush rendering - * \param flags bitmask of PIPE_FLUSH_x tokens) + /** Flush draw commands */ void (*flush)( struct pipe_context *pipe, - unsigned flags, struct pipe_fence_handle **fence ); /** diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index a4185f23839..bac3300df3c 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -337,15 +337,6 @@ enum pipe_transfer_usage { #define PIPE_USAGE_STAGING 5 /* supports data transfers from the GPU to the CPU */ -/** - * Flush types: - */ -#define PIPE_FLUSH_RENDER_CACHE 0x1 -#define PIPE_FLUSH_TEXTURE_CACHE 0x2 -#define PIPE_FLUSH_SWAPBUFFERS 0x4 -#define PIPE_FLUSH_FRAME 0x8 /**< Mark the end of a frame */ - - /** * Shaders */ diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h index 1c2148b78f2..d4973a10cc7 100644 --- a/src/gallium/include/state_tracker/st_api.h +++ b/src/gallium/include/state_tracker/st_api.h @@ -120,6 +120,11 @@ enum st_context_resource_type { ST_CONTEXT_RESOURCE_OPENVG_PARENT_IMAGE }; +/** + * Flush flags. + */ +#define ST_FLUSH_FRONT (1 << 0) + /** * Value to st_manager->get_param function. */ diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp index 2e45f3f43e9..741a97f897d 100644 --- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp +++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp @@ -1234,7 +1234,7 @@ struct GalliumDXGISwapChain : public GalliumDXGIObjectsurface_destroy(pipe, dst_surface); - pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, 0); + pipe->flush(pipe, 0); att = (db) ? NATIVE_ATTACHMENT_BACK_LEFT : NATIVE_ATTACHMENT_FRONT_LEFT; if(!surface->present(surface, att, FALSE, 0)) diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h index 542d6591293..12f2aaddc91 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h @@ -1823,7 +1823,7 @@ changed: virtual void STDMETHODCALLTYPE Flush(void) { SYNCHRONIZED; - pipe->flush(pipe, PIPE_FLUSH_FRAME, 0); + pipe->flush(pipe, 0); } /* In Direct3D 10, if the reference count of an object drops to 0, it is automatically diff --git a/src/gallium/state_trackers/dri/common/dri_context.c b/src/gallium/state_trackers/dri/common/dri_context.c index fc68ee13eaa..e23c1bcafaf 100644 --- a/src/gallium/state_trackers/dri/common/dri_context.c +++ b/src/gallium/state_trackers/dri/common/dri_context.c @@ -149,7 +149,7 @@ dri_unbind_context(__DRIcontext * cPriv) if (--ctx->bind_count == 0) { if (ctx->st == ctx->stapi->get_current(ctx->stapi)) { - ctx->st->flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); + ctx->st->flush(ctx->st, ST_FLUSH_FRONT, NULL); stapi->make_current(stapi, NULL, NULL, NULL); draw->context = NULL; read->context = NULL; @@ -171,7 +171,7 @@ dri_make_current(__DRIcontext * cPriv, struct st_context_iface *old_st = ctx->stapi->get_current(ctx->stapi); if (old_st && old_st != ctx->st) - old_st->flush(old_st, PIPE_FLUSH_RENDER_CACHE, NULL); + old_st->flush(old_st, ST_FLUSH_FRONT, NULL); ++ctx->bind_count; diff --git a/src/gallium/state_trackers/dri/sw/drisw.c b/src/gallium/state_trackers/dri/sw/drisw.c index 0efa5ffdc69..ac11f7c47f6 100644 --- a/src/gallium/state_trackers/dri/sw/drisw.c +++ b/src/gallium/state_trackers/dri/sw/drisw.c @@ -139,7 +139,7 @@ drisw_swap_buffers(__DRIdrawable *dPriv) ptex = drawable->textures[ST_ATTACHMENT_BACK_LEFT]; if (ptex) { - ctx->st->flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); + ctx->st->flush(ctx->st, ST_FLUSH_FRONT, NULL); drisw_copy_to_front(dPriv, ptex); } diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c index 6b409573fa3..f1568329ecf 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c @@ -528,8 +528,7 @@ egl_g3d_make_current(_EGLDriver *drv, _EGLDisplay *dpy, old_gctx = egl_g3d_context(old_ctx); if (old_gctx) { /* flush old context */ - old_gctx->stctxi->flush(old_gctx->stctxi, - PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, NULL); + old_gctx->stctxi->flush(old_gctx->stctxi, ST_FLUSH_FRONT, NULL); } if (gctx) { @@ -606,8 +605,7 @@ egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf) /* flush if the surface is current */ if (gctx) { - gctx->stctxi->flush(gctx->stctxi, - PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, NULL); + gctx->stctxi->flush(gctx->stctxi, ST_FLUSH_FRONT, NULL); } return gsurf->native->present(gsurf->native, @@ -652,8 +650,7 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, /* flush if the surface is current */ if (ctx && ctx->DrawSurface == &gsurf->base) { struct egl_g3d_context *gctx = egl_g3d_context(ctx); - gctx->stctxi->flush(gctx->stctxi, - PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, NULL); + gctx->stctxi->flush(gctx->stctxi, ST_FLUSH_FRONT, NULL); } pipe = ndpy_get_copy_context(gdpy->native); @@ -667,7 +664,7 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, u_box_origin_2d(ptex->width0, ptex->height0, &src_box); pipe->resource_copy_region(pipe, ptex, 0, 0, 0, 0, gsurf->render_texture, 0, &src_box); - pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); + pipe->flush(pipe, NULL); nsurf->present(nsurf, NATIVE_ATTACHMENT_FRONT_LEFT, FALSE, 0); pipe_resource_reference(&ptex, NULL); @@ -686,8 +683,7 @@ egl_g3d_wait_client(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx) struct pipe_screen *screen = gdpy->native->screen; struct pipe_fence_handle *fence = NULL; - gctx->stctxi->flush(gctx->stctxi, - PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence); + gctx->stctxi->flush(gctx->stctxi, ST_FLUSH_FRONT, &fence); if (fence) { screen->fence_finish(screen, fence, PIPE_TIMEOUT_INFINITE); screen->fence_reference(screen, &fence, NULL); @@ -758,8 +754,7 @@ egl_g3d_bind_tex_image(_EGLDriver *drv, _EGLDisplay *dpy, /* flush properly if the surface is bound */ if (gsurf->base.CurrentContext) { gctx = egl_g3d_context(gsurf->base.CurrentContext); - gctx->stctxi->flush(gctx->stctxi, - PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, NULL); + gctx->stctxi->flush(gctx->stctxi, ST_FLUSH_FRONT, NULL); } gctx = egl_g3d_context(es1); diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_sync.c b/src/gallium/state_trackers/egl/common/egl_g3d_sync.c index 7610e04fa3e..dd07af140a7 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_sync.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_sync.c @@ -234,7 +234,7 @@ egl_g3d_client_wait_sync(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, struct egl_g3d_context *gctx = egl_g3d_context(ctx); if (gctx) - gctx->stctxi->flush(gctx->stctxi, PIPE_FLUSH_RENDER_CACHE , NULL); + gctx->stctxi->flush(gctx->stctxi, ST_FLUSH_FRONT, NULL); } if (timeout) { diff --git a/src/gallium/state_trackers/egl/common/native_helper.c b/src/gallium/state_trackers/egl/common/native_helper.c index 290c6d7076d..ee18cb2025b 100644 --- a/src/gallium/state_trackers/egl/common/native_helper.c +++ b/src/gallium/state_trackers/egl/common/native_helper.c @@ -352,7 +352,7 @@ resource_surface_flush(struct resource_surface *rsurf, if (!pipe) return FALSE; - pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, &fence); + pipe->flush(pipe, &fence); if (fence == NULL) return FALSE; diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index 7bfd2c3779d..3b35cbc890c 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.c +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c @@ -1193,11 +1193,7 @@ void XMesaSwapBuffers( XMesaBuffer b ) XMesaContext xmctx = XMesaGetCurrentContext(); if (xmctx && xmctx->xm_buffer == b) { - xmctx->st->flush( xmctx->st, - PIPE_FLUSH_RENDER_CACHE | - PIPE_FLUSH_SWAPBUFFERS | - PIPE_FLUSH_FRAME, - NULL); + xmctx->st->flush( xmctx->st, ST_FLUSH_FRONT, NULL); } xmesa_swap_st_framebuffer(b->stfb); @@ -1223,7 +1219,7 @@ void XMesaFlush( XMesaContext c ) XMesaDisplay xmdpy = xmesa_init_display(c->xm_visual->display); struct pipe_fence_handle *fence = NULL; - c->st->flush(c->st, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence); + c->st->flush(c->st, ST_FLUSH_FRONT, &fence); if (fence) { xmdpy->screen->fence_finish(xmdpy->screen, fence, PIPE_TIMEOUT_INFINITE); diff --git a/src/gallium/state_trackers/vega/api_context.c b/src/gallium/state_trackers/vega/api_context.c index 47e57f92858..19e42dd1562 100644 --- a/src/gallium/state_trackers/vega/api_context.c +++ b/src/gallium/state_trackers/vega/api_context.c @@ -56,7 +56,7 @@ void vegaFlush(void) return; pipe = ctx->pipe; - pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); + pipe->flush(pipe, NULL); vg_manager_flush_frontbuffer(ctx); } @@ -72,7 +72,7 @@ void vegaFinish(void) pipe = ctx->pipe; - pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence); + pipe->flush(pipe, &fence); if (fence) { pipe->screen->fence_finish(pipe->screen, fence, PIPE_TIMEOUT_INFINITE); diff --git a/src/gallium/state_trackers/vega/vg_manager.c b/src/gallium/state_trackers/vega/vg_manager.c index 44d2996bb45..eeea68677de 100644 --- a/src/gallium/state_trackers/vega/vg_manager.c +++ b/src/gallium/state_trackers/vega/vg_manager.c @@ -142,8 +142,8 @@ vg_context_flush(struct st_context_iface *stctxi, unsigned flags, struct pipe_fence_handle **fence) { struct vg_context *ctx = (struct vg_context *) stctxi; - ctx->pipe->flush(ctx->pipe, flags, fence); - if (flags & PIPE_FLUSH_RENDER_CACHE) + ctx->pipe->flush(ctx->pipe, fence); + if (flags & ST_FLUSH_FRONT) vg_manager_flush_frontbuffer(ctx); } diff --git a/src/gallium/state_trackers/wgl/stw_context.c b/src/gallium/state_trackers/wgl/stw_context.c index cd4f3c8b3e2..5608d4f4ce7 100644 --- a/src/gallium/state_trackers/wgl/stw_context.c +++ b/src/gallium/state_trackers/wgl/stw_context.c @@ -277,7 +277,7 @@ stw_make_current( return TRUE; } } else { - curctx->st->flush(curctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); + curctx->st->flush(curctx->st, ST_FLUSH_FRONT, NULL); } } @@ -351,11 +351,7 @@ stw_flush_current_locked( struct stw_framebuffer *fb ) struct stw_context *ctx = stw_current_context(); if (ctx && ctx->current_framebuffer == fb) { - ctx->st->flush(ctx->st, - PIPE_FLUSH_RENDER_CACHE | - PIPE_FLUSH_SWAPBUFFERS | - PIPE_FLUSH_FRAME, - NULL); + ctx->st->flush(ctx->st, ST_FLUSH_FRONT, NULL); } } diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index edd988f4e09..6f2c52eabb6 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -336,7 +336,7 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion, /* pixmap glXWaitX */ if (pSrcBuffer->attachment == DRI2BufferFrontLeft && pDestBuffer->attachment == DRI2BufferFakeFrontLeft) { - ms->ctx->flush(ms->ctx, PIPE_FLUSH_SWAPBUFFERS, NULL); + ms->ctx->flush(ms->ctx, NULL); return; } /* pixmap glXWaitGL */ @@ -389,7 +389,7 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion, FreeScratchGC(gc); - ms->ctx->flush(ms->ctx, PIPE_FLUSH_SWAPBUFFERS, + ms->ctx->flush(ms->ctx, (pDestBuffer->attachment == DRI2BufferFrontLeft && ms->swapThrottling) ? &dst_priv->fence : NULL); diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 5148a0c9baa..19e9bf84656 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -548,7 +548,7 @@ void xorg_flush(ScreenPtr pScreen) if (ms->ctx) { int j; - ms->ctx->flush(ms->ctx, PIPE_FLUSH_RENDER_CACHE, + ms->ctx->flush(ms->ctx, ms->dirtyThrottling ? &ms->fence[XORG_NR_FENCES-1] : NULL); diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 2accda1525e..e7d6a93e5ca 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -1072,17 +1072,17 @@ xorg_gpu_surface(struct pipe_context *pipe, struct exa_pixmap_priv *priv) } -void xorg_exa_flush(struct exa_context *exa, uint pipeFlushFlags, +void xorg_exa_flush(struct exa_context *exa, struct pipe_fence_handle **fence) { - exa->pipe->flush(exa->pipe, pipeFlushFlags, fence); + exa->pipe->flush(exa->pipe, fence); } void xorg_exa_finish(struct exa_context *exa) { struct pipe_fence_handle *fence = NULL; - xorg_exa_flush(exa, PIPE_FLUSH_RENDER_CACHE, &fence); + xorg_exa_flush(exa, &fence); exa->pipe->screen->fence_finish(exa->pipe->screen, fence, PIPE_TIMEOUT_INFINITE); diff --git a/src/gallium/state_trackers/xorg/xorg_exa.h b/src/gallium/state_trackers/xorg/xorg_exa.h index 1f78f60be74..30b6f0ce460 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.h +++ b/src/gallium/state_trackers/xorg/xorg_exa.h @@ -74,7 +74,7 @@ do { \ struct pipe_surface * xorg_gpu_surface(struct pipe_context *pipe, struct exa_pixmap_priv *priv); -void xorg_exa_flush(struct exa_context *exa, uint pipeFlushFlags, +void xorg_exa_flush(struct exa_context *exa, struct pipe_fence_handle **fence); void xorg_exa_finish(struct exa_context *exa); diff --git a/src/gallium/tests/graw/clear.c b/src/gallium/tests/graw/clear.c index 55cc0087a09..392d1503f19 100644 --- a/src/gallium/tests/graw/clear.c +++ b/src/gallium/tests/graw/clear.c @@ -29,7 +29,7 @@ static void draw( void ) float clear_color[4] = {1,0,1,1}; ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0); - ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL); + ctx->flush(ctx, NULL); graw_save_surface_to_file(ctx, surf, NULL); diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c index ff82b607110..fda23bd7c9f 100644 --- a/src/gallium/tests/graw/fs-test.c +++ b/src/gallium/tests/graw/fs-test.c @@ -276,7 +276,7 @@ static void draw( void ) ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0); util_draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3); - ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL); + ctx->flush(ctx, NULL); graw_save_surface_to_file(ctx, surf, NULL); diff --git a/src/gallium/tests/graw/gs-test.c b/src/gallium/tests/graw/gs-test.c index cc05889dd05..ebb26d2f3f4 100644 --- a/src/gallium/tests/graw/gs-test.c +++ b/src/gallium/tests/graw/gs-test.c @@ -339,7 +339,7 @@ static void draw( void ) else util_draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3); - ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL); + ctx->flush(ctx, NULL); graw_save_surface_to_file(ctx, surf, NULL); diff --git a/src/gallium/tests/graw/quad-sample.c b/src/gallium/tests/graw/quad-sample.c index 3c6458b434e..6903046cf0e 100644 --- a/src/gallium/tests/graw/quad-sample.c +++ b/src/gallium/tests/graw/quad-sample.c @@ -150,7 +150,7 @@ static void draw( void ) ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0); util_draw_arrays(ctx, PIPE_PRIM_QUADS, 0, 4); - ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL); + ctx->flush(ctx, NULL); graw_save_surface_to_file(ctx, surf, NULL); diff --git a/src/gallium/tests/graw/quad-tex.c b/src/gallium/tests/graw/quad-tex.c index 4e66813b301..fd01cb3f84f 100644 --- a/src/gallium/tests/graw/quad-tex.c +++ b/src/gallium/tests/graw/quad-tex.c @@ -147,7 +147,7 @@ static void draw( void ) ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0); util_draw_arrays(ctx, PIPE_PRIM_QUADS, 0, 4); - ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL); + ctx->flush(ctx, NULL); graw_save_surface_to_file(ctx, surf, NULL); diff --git a/src/gallium/tests/graw/shader-leak.c b/src/gallium/tests/graw/shader-leak.c index a23ca73ac1d..004b1691b6b 100644 --- a/src/gallium/tests/graw/shader-leak.c +++ b/src/gallium/tests/graw/shader-leak.c @@ -149,7 +149,7 @@ static void draw( void ) ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0); util_draw_arrays(ctx, PIPE_PRIM_POINTS, 0, 1); - ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL); + ctx->flush(ctx, NULL); ctx->bind_fs_state(ctx, NULL); ctx->delete_fs_state(ctx, fs); diff --git a/src/gallium/tests/graw/tri-gs.c b/src/gallium/tests/graw/tri-gs.c index 47b76530c6b..ab0116bed73 100644 --- a/src/gallium/tests/graw/tri-gs.c +++ b/src/gallium/tests/graw/tri-gs.c @@ -163,7 +163,7 @@ static void draw( void ) ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0); util_draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3); - ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL); + ctx->flush(ctx, NULL); screen->flush_frontbuffer(screen, tex, 0, 0, window); } diff --git a/src/gallium/tests/graw/tri-instanced.c b/src/gallium/tests/graw/tri-instanced.c index 259b3d9527c..bed34374666 100644 --- a/src/gallium/tests/graw/tri-instanced.c +++ b/src/gallium/tests/graw/tri-instanced.c @@ -211,7 +211,7 @@ static void draw( void ) ctx->draw_vbo(ctx, &info); - ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL); + ctx->flush(ctx, NULL); graw_save_surface_to_file(ctx, surf, NULL); diff --git a/src/gallium/tests/graw/tri.c b/src/gallium/tests/graw/tri.c index 4266c0394d8..30ead999a47 100644 --- a/src/gallium/tests/graw/tri.c +++ b/src/gallium/tests/graw/tri.c @@ -140,7 +140,7 @@ static void draw( void ) ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0); util_draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3); - ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL); + ctx->flush(ctx, NULL); graw_save_surface_to_file(ctx, surf, NULL); diff --git a/src/gallium/tests/graw/vs-test.c b/src/gallium/tests/graw/vs-test.c index dd64d8b9301..18e056dcb35 100644 --- a/src/gallium/tests/graw/vs-test.c +++ b/src/gallium/tests/graw/vs-test.c @@ -227,7 +227,7 @@ static void draw( void ) ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0); util_draw_arrays(ctx, PIPE_PRIM_POINTS, 0, Elements(vertices)); - ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL); + ctx->flush(ctx, NULL); graw_save_surface_to_file(ctx, surf, NULL); diff --git a/src/gallium/tests/trivial/quad-tex.c b/src/gallium/tests/trivial/quad-tex.c index af93e09d8d4..3a64b1c8d96 100644 --- a/src/gallium/tests/trivial/quad-tex.c +++ b/src/gallium/tests/trivial/quad-tex.c @@ -335,7 +335,7 @@ static void draw(struct program *p) 4, /* verts */ 2); /* attribs/vert */ - p->pipe->flush(p->pipe, PIPE_FLUSH_RENDER_CACHE, NULL); + p->pipe->flush(p->pipe, NULL); debug_dump_surface_bmp(p->pipe, "result.bmp", p->framebuffer.cbufs[0]); } diff --git a/src/gallium/tests/trivial/tri.c b/src/gallium/tests/trivial/tri.c index b89cfe0d989..bfd2f3ca9a3 100644 --- a/src/gallium/tests/trivial/tri.c +++ b/src/gallium/tests/trivial/tri.c @@ -264,7 +264,7 @@ static void draw(struct program *p) 3, /* verts */ 2); /* attribs/vert */ - p->pipe->flush(p->pipe, PIPE_FLUSH_RENDER_CACHE, NULL); + p->pipe->flush(p->pipe, NULL); debug_dump_surface_bmp(p->pipe, "result.bmp", p->framebuffer.cbufs[0]); } diff --git a/src/gallium/winsys/r600/drm/r600_bo.c b/src/gallium/winsys/r600/drm/r600_bo.c index edd774e0e00..122a68884b4 100644 --- a/src/gallium/winsys/r600/drm/r600_bo.c +++ b/src/gallium/winsys/r600/drm/r600_bo.c @@ -120,7 +120,7 @@ void *r600_bo_map(struct radeon *radeon, struct r600_bo *bo, unsigned usage, voi return NULL; } if (ctx) { - pctx->flush(pctx, 0, NULL); + pctx->flush(pctx, NULL); } } diff --git a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c index 4ecfdbf3915..51245766d1c 100644 --- a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c +++ b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c @@ -246,7 +246,7 @@ wsw_dt_unmap(struct sw_winsys *ws, pipe->transfer_unmap(pipe, wdt->transfer); pipe->transfer_destroy(pipe, wdt->transfer); - pipe->flush(pipe, 0, NULL); + pipe->flush(pipe, NULL); wdt->transfer = NULL; } diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c index ce902231eff..0e27cb9a3fd 100644 --- a/src/mesa/state_tracker/st_cb_flush.c +++ b/src/mesa/state_tracker/st_cb_flush.c @@ -76,7 +76,7 @@ display_front_buffer(struct st_context *st) } -void st_flush( struct st_context *st, uint pipeFlushFlags, +void st_flush( struct st_context *st, struct pipe_fence_handle **fence ) { FLUSH_CURRENT(st->ctx, 0); @@ -89,7 +89,7 @@ void st_flush( struct st_context *st, uint pipeFlushFlags, util_blit_flush(st->blit); util_gen_mipmap_flush(st->gen_mipmap); - st->pipe->flush( st->pipe, pipeFlushFlags, fence ); + st->pipe->flush( st->pipe, fence ); } @@ -100,7 +100,7 @@ void st_finish( struct st_context *st ) { struct pipe_fence_handle *fence = NULL; - st_flush(st, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence); + st_flush(st, &fence); if(fence) { st->pipe->screen->fence_finish(st->pipe->screen, fence, @@ -123,7 +123,7 @@ static void st_glFlush(struct gl_context *ctx) * synchronization issues. Calling finish() here will just hide * problems that need to be fixed elsewhere. */ - st_flush(st, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, NULL); + st_flush(st, NULL); if (is_front_buffer_dirty(st)) { display_front_buffer(st); diff --git a/src/mesa/state_tracker/st_cb_flush.h b/src/mesa/state_tracker/st_cb_flush.h index 7672b4cf1da..598536ba045 100644 --- a/src/mesa/state_tracker/st_cb_flush.h +++ b/src/mesa/state_tracker/st_cb_flush.h @@ -40,7 +40,7 @@ extern void st_init_flush_functions(struct dd_function_table *functions); extern void -st_flush(struct st_context *st, uint pipeFlushFlags, +st_flush(struct st_context *st, struct pipe_fence_handle **fence); extern void diff --git a/src/mesa/state_tracker/st_cb_syncobj.c b/src/mesa/state_tracker/st_cb_syncobj.c index 450909cf182..d575a84974b 100644 --- a/src/mesa/state_tracker/st_cb_syncobj.c +++ b/src/mesa/state_tracker/st_cb_syncobj.c @@ -72,7 +72,7 @@ static void st_fence_sync(struct gl_context *ctx, struct gl_sync_object *obj, assert(condition == GL_SYNC_GPU_COMMANDS_COMPLETE && flags == 0); assert(so->fence == NULL); - pipe->flush(pipe, 0, &so->fence); + pipe->flush(pipe, &so->fence); } static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj) diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index d85bcd4f7c3..a68544ddac7 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -502,8 +502,8 @@ st_context_flush(struct st_context_iface *stctxi, unsigned flags, struct pipe_fence_handle **fence) { struct st_context *st = (struct st_context *) stctxi; - st_flush(st, flags, fence); - if (flags & PIPE_FLUSH_RENDER_CACHE) + st_flush(st, fence); + if (flags & ST_FLUSH_FRONT) st_manager_flush_frontbuffer(st); } -- cgit v1.2.3 From f4e6061d88db87b4fc988e02055674c530caacb8 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 13 Mar 2011 13:15:34 +0100 Subject: rbug: Skip drawing on disabled shaders --- src/gallium/drivers/rbug/rbug_context.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/gallium/drivers/rbug') diff --git a/src/gallium/drivers/rbug/rbug_context.c b/src/gallium/drivers/rbug/rbug_context.c index bd0eae9ac46..2c3247e09f1 100644 --- a/src/gallium/drivers/rbug/rbug_context.c +++ b/src/gallium/drivers/rbug/rbug_context.c @@ -112,7 +112,10 @@ rbug_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *info) pipe_mutex_lock(rb_pipe->draw_mutex); rbug_draw_block_locked(rb_pipe, RBUG_BLOCK_BEFORE); - pipe->draw_vbo(pipe, info); + if (!(rb_pipe->curr.fs && rb_pipe->curr.fs->disabled) && + !(rb_pipe->curr.gs && rb_pipe->curr.gs->disabled) && + !(rb_pipe->curr.vs && rb_pipe->curr.vs->disabled)) + pipe->draw_vbo(pipe, info); rbug_draw_block_locked(rb_pipe, RBUG_BLOCK_AFTER); pipe_mutex_unlock(rb_pipe->draw_mutex); -- cgit v1.2.3 From 07838ff990a74e3acd95de7042042b49ecc51570 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 13 Mar 2011 15:52:52 +0100 Subject: rbug: Use the call mutex Fixes crashes in [soft|llvm]pipe when replacing shaders --- src/gallium/drivers/rbug/rbug_context.c | 206 +++++++++++++++++++++++++++++--- 1 file changed, 187 insertions(+), 19 deletions(-) (limited to 'src/gallium/drivers/rbug') diff --git a/src/gallium/drivers/rbug/rbug_context.c b/src/gallium/drivers/rbug/rbug_context.c index 2c3247e09f1..6e2d6ba1efa 100644 --- a/src/gallium/drivers/rbug/rbug_context.c +++ b/src/gallium/drivers/rbug/rbug_context.c @@ -44,7 +44,10 @@ rbug_destroy(struct pipe_context *_pipe) struct pipe_context *pipe = rb_pipe->pipe; remove_from_list(&rb_pipe->list); + pipe_mutex_lock(rb_pipe->call_mutex); pipe->destroy(pipe); + rb_pipe->pipe = NULL; + pipe_mutex_unlock(rb_pipe->call_mutex); FREE(rb_pipe); } @@ -112,10 +115,12 @@ rbug_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *info) pipe_mutex_lock(rb_pipe->draw_mutex); rbug_draw_block_locked(rb_pipe, RBUG_BLOCK_BEFORE); + pipe_mutex_lock(rb_pipe->call_mutex); if (!(rb_pipe->curr.fs && rb_pipe->curr.fs->disabled) && !(rb_pipe->curr.gs && rb_pipe->curr.gs->disabled) && !(rb_pipe->curr.vs && rb_pipe->curr.vs->disabled)) pipe->draw_vbo(pipe, info); + pipe_mutex_unlock(rb_pipe->call_mutex); rbug_draw_block_locked(rb_pipe, RBUG_BLOCK_AFTER); pipe_mutex_unlock(rb_pipe->draw_mutex); @@ -128,8 +133,10 @@ rbug_create_query(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + pipe_mutex_lock(rb_pipe->call_mutex); return pipe->create_query(pipe, query_type); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -139,8 +146,10 @@ rbug_destroy_query(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->destroy_query(pipe, query); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -150,8 +159,10 @@ rbug_begin_query(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->begin_query(pipe, query); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -161,8 +172,10 @@ rbug_end_query(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->end_query(pipe, query); + pipe_mutex_unlock(rb_pipe->call_mutex); } static boolean @@ -173,11 +186,16 @@ rbug_get_query_result(struct pipe_context *_pipe, { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + boolean ret; - return pipe->get_query_result(pipe, - query, - wait, - result); + pipe_mutex_lock(rb_pipe->call_mutex); + ret = pipe->get_query_result(pipe, + query, + wait, + result); + pipe_mutex_unlock(rb_pipe->call_mutex); + + return ret; } static void * @@ -186,9 +204,14 @@ rbug_create_blend_state(struct pipe_context *_pipe, { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + void *ret; + + pipe_mutex_lock(rb_pipe->call_mutex); + ret = pipe->create_blend_state(pipe, + blend); + pipe_mutex_unlock(rb_pipe->call_mutex); - return pipe->create_blend_state(pipe, - blend); + return ret; } static void @@ -198,8 +221,10 @@ rbug_bind_blend_state(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->bind_blend_state(pipe, - blend); + blend); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -209,8 +234,10 @@ rbug_delete_blend_state(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->delete_blend_state(pipe, blend); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void * @@ -219,9 +246,14 @@ rbug_create_sampler_state(struct pipe_context *_pipe, { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + void *ret; - return pipe->create_sampler_state(pipe, - sampler); + pipe_mutex_lock(rb_pipe->call_mutex); + ret = pipe->create_sampler_state(pipe, + sampler); + pipe_mutex_unlock(rb_pipe->call_mutex); + + return ret; } static void @@ -232,9 +264,11 @@ rbug_bind_fragment_sampler_states(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->bind_fragment_sampler_states(pipe, num_samplers, samplers); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -245,9 +279,11 @@ rbug_bind_vertex_sampler_states(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->bind_vertex_sampler_states(pipe, num_samplers, samplers); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -257,8 +293,10 @@ rbug_delete_sampler_state(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->delete_sampler_state(pipe, sampler); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void * @@ -267,9 +305,14 @@ rbug_create_rasterizer_state(struct pipe_context *_pipe, { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + void *ret; + + pipe_mutex_lock(rb_pipe->call_mutex); + ret = pipe->create_rasterizer_state(pipe, + rasterizer); + pipe_mutex_unlock(rb_pipe->call_mutex); - return pipe->create_rasterizer_state(pipe, - rasterizer); + return ret; } static void @@ -279,8 +322,10 @@ rbug_bind_rasterizer_state(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->bind_rasterizer_state(pipe, rasterizer); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -290,8 +335,10 @@ rbug_delete_rasterizer_state(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->delete_rasterizer_state(pipe, rasterizer); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void * @@ -300,9 +347,14 @@ rbug_create_depth_stencil_alpha_state(struct pipe_context *_pipe, { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + void *ret; - return pipe->create_depth_stencil_alpha_state(pipe, - depth_stencil_alpha); + pipe_mutex_lock(rb_pipe->call_mutex); + ret = pipe->create_depth_stencil_alpha_state(pipe, + depth_stencil_alpha); + pipe_mutex_unlock(rb_pipe->call_mutex); + + return ret; } static void @@ -312,8 +364,10 @@ rbug_bind_depth_stencil_alpha_state(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->bind_depth_stencil_alpha_state(pipe, depth_stencil_alpha); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -323,8 +377,10 @@ rbug_delete_depth_stencil_alpha_state(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->delete_depth_stencil_alpha_state(pipe, depth_stencil_alpha); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void * @@ -335,7 +391,10 @@ rbug_create_fs_state(struct pipe_context *_pipe, struct pipe_context *pipe = rb_pipe->pipe; void *result; + pipe_mutex_lock(rb_pipe->call_mutex); result = pipe->create_fs_state(pipe, state); + pipe_mutex_unlock(rb_pipe->call_mutex); + if (!result) return NULL; @@ -350,10 +409,14 @@ rbug_bind_fs_state(struct pipe_context *_pipe, struct pipe_context *pipe = rb_pipe->pipe; void *fs; + pipe_mutex_lock(rb_pipe->call_mutex); + fs = rbug_shader_unwrap(_fs); rb_pipe->curr.fs = rbug_shader(_fs); pipe->bind_fs_state(pipe, fs); + + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -363,7 +426,9 @@ rbug_delete_fs_state(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct rbug_shader *rb_shader = rbug_shader(_fs); + pipe_mutex_lock(rb_pipe->call_mutex); rbug_shader_destroy(rb_pipe, rb_shader); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void * @@ -374,7 +439,10 @@ rbug_create_vs_state(struct pipe_context *_pipe, struct pipe_context *pipe = rb_pipe->pipe; void *result; + pipe_mutex_lock(rb_pipe->call_mutex); result = pipe->create_vs_state(pipe, state); + pipe_mutex_unlock(rb_pipe->call_mutex); + if (!result) return NULL; @@ -389,10 +457,14 @@ rbug_bind_vs_state(struct pipe_context *_pipe, struct pipe_context *pipe = rb_pipe->pipe; void *vs; + pipe_mutex_lock(rb_pipe->call_mutex); + vs = rbug_shader_unwrap(_vs); rb_pipe->curr.vs = rbug_shader(_vs); pipe->bind_vs_state(pipe, vs); + + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -402,7 +474,9 @@ rbug_delete_vs_state(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct rbug_shader *rb_shader = rbug_shader(_vs); + pipe_mutex_unlock(rb_pipe->call_mutex); rbug_shader_destroy(rb_pipe, rb_shader); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void * @@ -413,7 +487,10 @@ rbug_create_gs_state(struct pipe_context *_pipe, struct pipe_context *pipe = rb_pipe->pipe; void *result; + pipe_mutex_lock(rb_pipe->call_mutex); result = pipe->create_gs_state(pipe, state); + pipe_mutex_unlock(rb_pipe->call_mutex); + if (!result) return NULL; @@ -428,10 +505,14 @@ rbug_bind_gs_state(struct pipe_context *_pipe, struct pipe_context *pipe = rb_pipe->pipe; void *gs; + pipe_mutex_lock(rb_pipe->call_mutex); + gs = rbug_shader_unwrap(_gs); rb_pipe->curr.gs = rbug_shader(_gs); pipe->bind_gs_state(pipe, gs); + + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -441,7 +522,9 @@ rbug_delete_gs_state(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct rbug_shader *rb_shader = rbug_shader(_gs); + pipe_mutex_lock(rb_pipe->call_mutex); rbug_shader_destroy(rb_pipe, rb_shader); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void * @@ -451,10 +534,15 @@ rbug_create_vertex_elements_state(struct pipe_context *_pipe, { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + void *ret; - return pipe->create_vertex_elements_state(pipe, + pipe_mutex_lock(rb_pipe->call_mutex); + ret = pipe->create_vertex_elements_state(pipe, num_elements, vertex_elements); + pipe_mutex_unlock(rb_pipe->call_mutex); + + return ret; } static void @@ -464,8 +552,10 @@ rbug_bind_vertex_elements_state(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->bind_vertex_elements_state(pipe, velems); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -475,8 +565,10 @@ rbug_delete_vertex_elements_state(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->delete_vertex_elements_state(pipe, velems); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -486,8 +578,10 @@ rbug_set_blend_color(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->set_blend_color(pipe, blend_color); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -497,8 +591,10 @@ rbug_set_stencil_ref(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->set_stencil_ref(pipe, stencil_ref); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -508,8 +604,10 @@ rbug_set_clip_state(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->set_clip_state(pipe, clip); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -529,10 +627,12 @@ rbug_set_constant_buffer(struct pipe_context *_pipe, resource = unwrapped_resource; } + pipe_mutex_lock(rb_pipe->call_mutex); pipe->set_constant_buffer(pipe, shader, index, resource); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -545,6 +645,9 @@ rbug_set_framebuffer_state(struct pipe_context *_pipe, struct pipe_framebuffer_state *state = NULL; unsigned i; + /* must protect curr status */ + pipe_mutex_lock(rb_pipe->call_mutex); + rb_pipe->curr.nr_cbufs = 0; memset(rb_pipe->curr.cbufs, 0, sizeof(rb_pipe->curr.cbufs)); rb_pipe->curr.zsbuf = NULL; @@ -567,6 +670,8 @@ rbug_set_framebuffer_state(struct pipe_context *_pipe, pipe->set_framebuffer_state(pipe, state); + + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -576,8 +681,10 @@ rbug_set_polygon_stipple(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->set_polygon_stipple(pipe, poly_stipple); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -587,8 +694,10 @@ rbug_set_scissor_state(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->set_scissor_state(pipe, scissor); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -598,8 +707,10 @@ rbug_set_viewport_state(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->set_viewport_state(pipe, viewport); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -613,6 +724,9 @@ rbug_set_fragment_sampler_views(struct pipe_context *_pipe, struct pipe_sampler_view **views = NULL; unsigned i; + /* must protect curr status */ + pipe_mutex_lock(rb_pipe->call_mutex); + rb_pipe->curr.num_fs_views = 0; memset(rb_pipe->curr.fs_views, 0, sizeof(rb_pipe->curr.fs_views)); memset(rb_pipe->curr.fs_texs, 0, sizeof(rb_pipe->curr.fs_texs)); @@ -629,6 +743,8 @@ rbug_set_fragment_sampler_views(struct pipe_context *_pipe, } pipe->set_fragment_sampler_views(pipe, num, views); + + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -642,6 +758,9 @@ rbug_set_vertex_sampler_views(struct pipe_context *_pipe, struct pipe_sampler_view **views = NULL; unsigned i; + /* must protect curr status */ + pipe_mutex_lock(rb_pipe->call_mutex); + rb_pipe->curr.num_vs_views = 0; memset(rb_pipe->curr.vs_views, 0, sizeof(rb_pipe->curr.vs_views)); memset(rb_pipe->curr.vs_texs, 0, sizeof(rb_pipe->curr.vs_texs)); @@ -658,6 +777,8 @@ rbug_set_vertex_sampler_views(struct pipe_context *_pipe, } pipe->set_vertex_sampler_views(pipe, num, views); + + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -671,6 +792,8 @@ rbug_set_vertex_buffers(struct pipe_context *_pipe, struct pipe_vertex_buffer *buffers = NULL; unsigned i; + pipe_mutex_lock(rb_pipe->call_mutex); + if (num_buffers) { memcpy(unwrapped_buffers, _buffers, num_buffers * sizeof(*_buffers)); for (i = 0; i < num_buffers; i++) @@ -681,6 +804,8 @@ rbug_set_vertex_buffers(struct pipe_context *_pipe, pipe->set_vertex_buffers(pipe, num_buffers, buffers); + + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -697,7 +822,9 @@ rbug_set_index_buffer(struct pipe_context *_pipe, ib = &unwrapped_ib; } + pipe_mutex_lock(rb_pipe->call_mutex); pipe->set_index_buffer(pipe, ib); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -707,7 +834,9 @@ rbug_set_sample_mask(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->set_sample_mask(pipe, sample_mask); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -728,6 +857,7 @@ rbug_resource_copy_region(struct pipe_context *_pipe, struct pipe_resource *dst = rb_resource_dst->resource; struct pipe_resource *src = rb_resource_src->resource; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->resource_copy_region(pipe, dst, dst_level, @@ -737,6 +867,7 @@ rbug_resource_copy_region(struct pipe_context *_pipe, src, src_level, src_box); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -749,11 +880,13 @@ rbug_clear(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->clear(pipe, buffers, rgba, depth, stencil); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -768,6 +901,7 @@ rbug_clear_render_target(struct pipe_context *_pipe, struct pipe_context *pipe = rb_pipe->pipe; struct pipe_surface *dst = rb_surface_dst->surface; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->clear_render_target(pipe, dst, rgba, @@ -775,6 +909,7 @@ rbug_clear_render_target(struct pipe_context *_pipe, dsty, width, height); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -791,6 +926,7 @@ rbug_clear_depth_stencil(struct pipe_context *_pipe, struct pipe_context *pipe = rb_pipe->pipe; struct pipe_surface *dst = rb_surface_dst->surface; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->clear_depth_stencil(pipe, dst, clear_flags, @@ -800,6 +936,7 @@ rbug_clear_depth_stencil(struct pipe_context *_pipe, dsty, width, height); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void @@ -809,8 +946,10 @@ rbug_flush(struct pipe_context *_pipe, struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; + pipe_mutex_lock(rb_pipe->call_mutex); pipe->flush(pipe, fence); + pipe_mutex_unlock(rb_pipe->call_mutex); } static struct pipe_sampler_view * @@ -824,9 +963,11 @@ rbug_context_create_sampler_view(struct pipe_context *_pipe, struct pipe_resource *resource = rb_resource->resource; struct pipe_sampler_view *result; + pipe_mutex_lock(rb_pipe->call_mutex); result = pipe->create_sampler_view(pipe, resource, templ); + pipe_mutex_unlock(rb_pipe->call_mutex); if (result) return rbug_sampler_view_create(rb_pipe, rb_resource, result); @@ -852,9 +993,11 @@ rbug_context_create_surface(struct pipe_context *_pipe, struct pipe_resource *resource = rb_resource->resource; struct pipe_surface *result; + pipe_mutex_lock(rb_pipe->call_mutex); result = pipe->create_surface(pipe, resource, surf_tmpl); + pipe_mutex_unlock(rb_pipe->call_mutex); if (result) return rbug_surface_create(rb_pipe, rb_resource, result); @@ -865,8 +1008,13 @@ static void rbug_context_surface_destroy(struct pipe_context *_pipe, struct pipe_surface *_surface) { - rbug_surface_destroy(rbug_context(_pipe), - rbug_surface(_surface)); + struct rbug_context *rb_pipe = rbug_context(_pipe); + struct rbug_surface *rb_surface = rbug_surface(_surface); + + pipe_mutex_lock(rb_pipe->call_mutex); + rbug_surface_destroy(rb_pipe, + rb_surface); + pipe_mutex_unlock(rb_pipe->call_mutex); } @@ -884,11 +1032,13 @@ rbug_context_get_transfer(struct pipe_context *_context, struct pipe_resource *resource = rb_resource->resource; struct pipe_transfer *result; + pipe_mutex_lock(rb_pipe->call_mutex); result = context->get_transfer(context, resource, level, usage, box); + pipe_mutex_unlock(rb_pipe->call_mutex); if (result) return rbug_transfer_create(rb_pipe, rb_resource, result); @@ -899,8 +1049,13 @@ static void rbug_context_transfer_destroy(struct pipe_context *_pipe, struct pipe_transfer *_transfer) { - rbug_transfer_destroy(rbug_context(_pipe), - rbug_transfer(_transfer)); + struct rbug_context *rb_pipe = rbug_context(_pipe); + struct rbug_transfer *rb_transfer =rbug_transfer(_transfer); + + pipe_mutex_lock(rb_pipe->call_mutex); + rbug_transfer_destroy(rb_pipe, + rb_transfer); + pipe_mutex_unlock(rb_pipe->call_mutex); } static void * @@ -911,9 +1066,14 @@ rbug_context_transfer_map(struct pipe_context *_context, struct rbug_transfer *rb_transfer = rbug_transfer(_transfer); struct pipe_context *context = rb_pipe->pipe; struct pipe_transfer *transfer = rb_transfer->transfer; + void *ret; - return context->transfer_map(context, + pipe_mutex_lock(rb_pipe->call_mutex); + ret = context->transfer_map(context, transfer); + pipe_mutex_unlock(rb_pipe->call_mutex); + + return ret; } @@ -928,9 +1088,11 @@ rbug_context_transfer_flush_region(struct pipe_context *_context, struct pipe_context *context = rb_pipe->pipe; struct pipe_transfer *transfer = rb_transfer->transfer; + pipe_mutex_lock(rb_pipe->call_mutex); context->transfer_flush_region(context, transfer, box); + pipe_mutex_unlock(rb_pipe->call_mutex); } @@ -943,8 +1105,10 @@ rbug_context_transfer_unmap(struct pipe_context *_context, struct pipe_context *context = rb_pipe->pipe; struct pipe_transfer *transfer = rb_transfer->transfer; + pipe_mutex_lock(rb_pipe->call_mutex); context->transfer_unmap(context, transfer); + pipe_mutex_unlock(rb_pipe->call_mutex); } @@ -963,6 +1127,7 @@ rbug_context_transfer_inline_write(struct pipe_context *_context, struct pipe_context *context = rb_pipe->pipe; struct pipe_resource *resource = rb_resource->resource; + pipe_mutex_lock(rb_pipe->call_mutex); context->transfer_inline_write(context, resource, level, @@ -971,6 +1136,7 @@ rbug_context_transfer_inline_write(struct pipe_context *_context, data, stride, layer_stride); + pipe_mutex_unlock(rb_pipe->call_mutex); } @@ -983,7 +1149,9 @@ static void rbug_redefine_user_buffer(struct pipe_context *_context, struct pipe_context *context = rb_pipe->pipe; struct pipe_resource *resource = rb_resource->resource; + pipe_mutex_lock(rb_pipe->call_mutex); context->redefine_user_buffer(context, resource, offset, size); + pipe_mutex_unlock(rb_pipe->call_mutex); } -- cgit v1.2.3