From 95c7881ac8240fa369e33db411bbd165d0f61948 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sat, 5 Mar 2011 16:06:10 +0100 Subject: gallium: split CAP_INSTANCE_DRAWING into INSTANCEID and INSTANCE_DIVISOR ARB_instanced_arrays is a subset of D3D9. ARB_draw_instanced is a subset of D3D10. The point of this change is to allow D3D9-level drivers to enable ARB_instanced_arrays without ARB_draw_instanced. --- src/gallium/drivers/nv50/nv50_screen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gallium/drivers/nv50') diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index ae0365eb5c5..d1744a38837 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -127,7 +127,8 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_SHADER_STENCIL_EXPORT: return 0; case PIPE_CAP_PRIMITIVE_RESTART: - case PIPE_CAP_INSTANCED_DRAWING: + case PIPE_CAP_TGSI_INSTANCEID: + case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR: return 1; default: NOUVEAU_ERR("unknown PIPE_CAP %d\n", param); -- cgit v1.2.3 From caaa7fdd6f8bb6f38bf555de79bd3cfd7ac9c715 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Wed, 9 Mar 2011 17:25:08 +0100 Subject: nv50: add back initialization of redefine_user_buffer Got lost in f80c03e1875fe96ff2f4c022e3cb76357828140d. --- src/gallium/drivers/nv50/nv50_state.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gallium/drivers/nv50') diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c index 980bc369293..3c497451d8b 100644 --- a/src/gallium/drivers/nv50/nv50_state.c +++ b/src/gallium/drivers/nv50/nv50_state.c @@ -866,5 +866,7 @@ nv50_init_state_functions(struct nv50_context *nv50) pipe->set_vertex_buffers = nv50_set_vertex_buffers; pipe->set_index_buffer = nv50_set_index_buffer; + + pipe->redefine_user_buffer = u_default_redefine_user_buffer; } -- 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/nv50') 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 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/nv50') 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/nv50') 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 26a199efac43cc0509f174ca47ad0d2b0044eee0 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sun, 13 Mar 2011 13:06:42 +0100 Subject: nv50,nvc0: add some missing resource referencing --- src/gallium/drivers/nv50/nv50_context.c | 24 ++++++++++++++++++++++++ src/gallium/drivers/nv50/nv50_state.c | 9 ++++++--- src/gallium/drivers/nvc0/nvc0_context.c | 27 +++++++++++++++++++++++++++ src/gallium/drivers/nvc0/nvc0_state.c | 11 +++++++---- 4 files changed, 64 insertions(+), 7 deletions(-) (limited to 'src/gallium/drivers/nv50') diff --git a/src/gallium/drivers/nv50/nv50_context.c b/src/gallium/drivers/nv50/nv50_context.c index c6bd0b15cbc..204e9bef113 100644 --- a/src/gallium/drivers/nv50/nv50_context.c +++ b/src/gallium/drivers/nv50/nv50_context.c @@ -63,11 +63,35 @@ nv50_default_flush_notify(struct nouveau_channel *chan) nouveau_fence_next(&nv50->screen->base); } +static void +nv50_context_unreference_resources(struct nv50_context *nv50) +{ + unsigned s, i; + + for (i = 0; i < NV50_BUFCTX_COUNT; ++i) + nv50_bufctx_reset(nv50, i); + + for (i = 0; i < nv50->num_vtxbufs; ++i) + pipe_resource_reference(&nv50->vtxbuf[i].buffer, NULL); + + pipe_resource_reference(&nv50->idxbuf.buffer, NULL); + + for (s = 0; s < 3; ++s) { + for (i = 0; i < nv50->num_textures[s]; ++i) + pipe_sampler_view_reference(&nv50->textures[s][i], NULL); + + for (i = 0; i < 16; ++i) + pipe_resource_reference(&nv50->constbuf[s][i], NULL); + } +} + static void nv50_destroy(struct pipe_context *pipe) { struct nv50_context *nv50 = nv50_context(pipe); + nv50_context_unreference_resources(nv50); + draw_destroy(nv50->draw); if (nv50->screen->cur_ctx == nv50) { diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c index 3c497451d8b..db257159698 100644 --- a/src/gallium/drivers/nv50/nv50_state.c +++ b/src/gallium/drivers/nv50/nv50_state.c @@ -796,10 +796,13 @@ nv50_set_index_buffer(struct pipe_context *pipe, { struct nv50_context *nv50 = nv50_context(pipe); - if (ib) + if (ib) { + pipe_resource_reference(&nv50->idxbuf.buffer, ib->buffer); + memcpy(&nv50->idxbuf, ib, sizeof(nv50->idxbuf)); - else - nv50->idxbuf.buffer = NULL; + } else { + pipe_resource_reference(&nv50->idxbuf.buffer, NULL); + } } static void diff --git a/src/gallium/drivers/nvc0/nvc0_context.c b/src/gallium/drivers/nvc0/nvc0_context.c index 881d102dab0..e4014b0d7ce 100644 --- a/src/gallium/drivers/nvc0/nvc0_context.c +++ b/src/gallium/drivers/nvc0/nvc0_context.c @@ -56,11 +56,38 @@ nvc0_flush(struct pipe_context *pipe, FIRE_RING(chan); } +static void +nvc0_context_unreference_resources(struct nvc0_context *nvc0) +{ + unsigned s, i; + + for (i = 0; i < NVC0_BUFCTX_COUNT; ++i) + nvc0_bufctx_reset(nvc0, i); + + for (i = 0; i < nvc0->num_vtxbufs; ++i) + pipe_resource_reference(&nvc0->vtxbuf[i].buffer, NULL); + + pipe_resource_reference(&nvc0->idxbuf.buffer, NULL); + + for (s = 0; s < 5; ++s) { + for (i = 0; i < nvc0->num_textures[s]; ++i) + pipe_sampler_view_reference(&nvc0->textures[s][i], NULL); + + for (i = 0; i < 16; ++i) + pipe_resource_reference(&nvc0->constbuf[s][i], NULL); + } + + for (i = 0; i < nvc0->num_tfbbufs; ++i) + pipe_resource_reference(&nvc0->tfbbuf[i], NULL); +} + static void nvc0_destroy(struct pipe_context *pipe) { struct nvc0_context *nvc0 = nvc0_context(pipe); + nvc0_context_unreference_resources(nvc0); + draw_destroy(nvc0->draw); if (nvc0->screen->cur_ctx == nvc0) { diff --git a/src/gallium/drivers/nvc0/nvc0_state.c b/src/gallium/drivers/nvc0/nvc0_state.c index 1815fe88a9b..ab68abcfb5a 100644 --- a/src/gallium/drivers/nvc0/nvc0_state.c +++ b/src/gallium/drivers/nvc0/nvc0_state.c @@ -708,10 +708,13 @@ nvc0_set_index_buffer(struct pipe_context *pipe, { struct nvc0_context *nvc0 = nvc0_context(pipe); - if (ib) - memcpy(&nvc0->idxbuf, ib, sizeof(nvc0->idxbuf)); - else - nvc0->idxbuf.buffer = NULL; + if (ib) { + pipe_resource_reference(&nvc0->idxbuf.buffer, ib->buffer); + + memcpy(&nvc0->idxbuf, ib, sizeof(nvc0->idxbuf)); + } else { + pipe_resource_reference(&nvc0->idxbuf.buffer, NULL); + } } static void -- cgit v1.2.3 From 4388817a678431146744a030bc7c0b8c01da9f72 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sun, 13 Mar 2011 13:07:54 +0100 Subject: nv50,nvc0: clean up flushes --- src/gallium/drivers/nouveau/nouveau_fence.c | 9 ++++++--- src/gallium/drivers/nv50/nv50_context.c | 21 ++++++++------------- src/gallium/drivers/nv50/nv50_state_validate.c | 5 +++-- src/gallium/drivers/nvc0/nvc0_context.c | 26 ++++++++------------------ src/gallium/drivers/nvc0/nvc0_state_validate.c | 5 +++-- 5 files changed, 28 insertions(+), 38 deletions(-) (limited to 'src/gallium/drivers/nv50') diff --git a/src/gallium/drivers/nouveau/nouveau_fence.c b/src/gallium/drivers/nouveau/nouveau_fence.c index 18bdb18ad41..d8f59dce9ed 100644 --- a/src/gallium/drivers/nouveau/nouveau_fence.c +++ b/src/gallium/drivers/nouveau/nouveau_fence.c @@ -90,6 +90,9 @@ nouveau_fence_emit(struct nouveau_fence *fence) assert(fence->state == NOUVEAU_FENCE_STATE_AVAILABLE); + /* set this now, so that if fence.emit triggers a flush we don't recurse */ + fence->state = NOUVEAU_FENCE_STATE_EMITTED; + screen->fence.emit(&screen->base, fence->sequence); ++fence->ref; @@ -100,8 +103,6 @@ nouveau_fence_emit(struct nouveau_fence *fence) screen->fence.head = fence; screen->fence.tail = fence; - - fence->state = NOUVEAU_FENCE_STATE_EMITTED; } void @@ -215,6 +216,8 @@ nouveau_fence_wait(struct nouveau_fence *fence) void nouveau_fence_next(struct nouveau_screen *screen) { - nouveau_fence_emit(screen->fence.current); + if (screen->fence.current->state < NOUVEAU_FENCE_STATE_EMITTED) + nouveau_fence_emit(screen->fence.current); + nouveau_fence_new(screen, &screen->fence.current, FALSE); } diff --git a/src/gallium/drivers/nv50/nv50_context.c b/src/gallium/drivers/nv50/nv50_context.c index 204e9bef113..930cee7c1e7 100644 --- a/src/gallium/drivers/nv50/nv50_context.c +++ b/src/gallium/drivers/nv50/nv50_context.c @@ -33,22 +33,17 @@ static void 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; - - /* 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); - }*/ + struct nouveau_screen *screen = &nv50_context(pipe)->screen->base; if (fence) - nouveau_fence_ref(nv50->screen->base.fence.current, - (struct nouveau_fence **)fence); + nouveau_fence_ref(screen->fence.current, (struct nouveau_fence **)fence); + + /* Try to emit before firing to avoid having to flush again right after + * in case we have to wait on this fence. + */ + nouveau_fence_emit(screen->fence.current); - FIRE_RING(chan); + FIRE_RING(screen->channel); } void diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index bf46296e7ef..4ae58b156b6 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -43,8 +43,9 @@ nv50_validate_fb(struct nv50_context *nv50) mt->base.status |= NOUVEAU_BUFFER_STATUS_GPU_WRITING; mt->base.status &= NOUVEAU_BUFFER_STATUS_GPU_READING; + /* only register for writing, otherwise we'd always serialize here */ nv50_bufctx_add_resident(nv50, NV50_BUFCTX_FRAME, &mt->base, - NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR); + NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); } if (fb->zsbuf) { @@ -74,7 +75,7 @@ nv50_validate_fb(struct nv50_context *nv50) mt->base.status &= NOUVEAU_BUFFER_STATUS_GPU_READING; nv50_bufctx_add_resident(nv50, NV50_BUFCTX_FRAME, &mt->base, - NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR); + NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); } else { BEGIN_RING(chan, RING_3D(ZETA_ENABLE), 1); OUT_RING (chan, 0); diff --git a/src/gallium/drivers/nvc0/nvc0_context.c b/src/gallium/drivers/nvc0/nvc0_context.c index e4014b0d7ce..5d2168e600b 100644 --- a/src/gallium/drivers/nvc0/nvc0_context.c +++ b/src/gallium/drivers/nvc0/nvc0_context.c @@ -33,27 +33,17 @@ static void 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; - - /* 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*/ - /* 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); - }*/ + struct nouveau_screen *screen = &nvc0_context(pipe)->screen->base; if (fence) - nouveau_fence_ref(nvc0->screen->base.fence.current, - (struct nouveau_fence **)fence); + nouveau_fence_ref(screen->fence.current, (struct nouveau_fence **)fence); + + /* Try to emit before firing to avoid having to flush again right after + * in case we have to wait on this fence. + */ + nouveau_fence_emit(screen->fence.current); - FIRE_RING(chan); + FIRE_RING(screen->channel); } static void diff --git a/src/gallium/drivers/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nvc0/nvc0_state_validate.c index 4daa968de5a..b38d2d9dcc6 100644 --- a/src/gallium/drivers/nvc0/nvc0_state_validate.c +++ b/src/gallium/drivers/nvc0/nvc0_state_validate.c @@ -93,8 +93,9 @@ nvc0_validate_fb(struct nvc0_context *nvc0) mt->base.status |= NOUVEAU_BUFFER_STATUS_GPU_WRITING; mt->base.status &= ~NOUVEAU_BUFFER_STATUS_GPU_READING; + /* only register for writing, otherwise we'd always serialize here */ nvc0_bufctx_add_resident(nvc0, NVC0_BUFCTX_FRAME, &mt->base, - NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR); + NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); } if (fb->zsbuf) { @@ -127,7 +128,7 @@ nvc0_validate_fb(struct nvc0_context *nvc0) mt->base.status &= ~NOUVEAU_BUFFER_STATUS_GPU_READING; nvc0_bufctx_add_resident(nvc0, NVC0_BUFCTX_FRAME, &mt->base, - NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR); + NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); } else { BEGIN_RING(chan, RING_3D(ZETA_ENABLE), 1); OUT_RING (chan, 0); -- cgit v1.2.3 From e864ccb3f20e58acb31572708ea6fcc696cf6ace Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 12 Mar 2011 17:11:44 +0100 Subject: nv50,nvc0: fix pipe context switch --- src/gallium/drivers/nv50/nv50_state_validate.c | 37 ++++++++++++++++++++++---- src/gallium/drivers/nvc0/nvc0_state_validate.c | 37 ++++++++++++++++++++++---- 2 files changed, 64 insertions(+), 10 deletions(-) (limited to 'src/gallium/drivers/nv50') diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index 4ae58b156b6..f3d45eb95e0 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -254,6 +254,35 @@ nv50_validate_rasterizer(struct nv50_context *nv50) OUT_RINGp(chan, nv50->rast->state, nv50->rast->size); } +static void +nv50_switch_pipe_context(struct nv50_context *ctx_to) +{ + struct nv50_context *ctx_from = ctx_to->screen->cur_ctx; + + if (ctx_from) + ctx_to->state = ctx_from->state; + + ctx_to->dirty = ~0; + + if (!ctx_to->vertex) + ctx_to->dirty &= ~(NV50_NEW_VERTEX | NV50_NEW_ARRAYS); + + if (!ctx_to->vertprog) + ctx_to->dirty &= ~NV50_NEW_VERTPROG; + if (!ctx_to->fragprog) + ctx_to->dirty &= ~NV50_NEW_FRAGPROG; + + if (!ctx_to->blend) + ctx_to->dirty &= ~NV50_NEW_BLEND; + if (!ctx_to->rast) + ctx_to->dirty &= ~NV50_NEW_RASTERIZER; + if (!ctx_to->zsa) + ctx_to->dirty &= ~NV50_NEW_ZSA; + + ctx_to->screen->base.channel->user_private = ctx_to->screen->cur_ctx = + ctx_to; +} + static struct state_validate { void (*func)(struct nv50_context *); uint32_t states; @@ -293,11 +322,9 @@ boolean nv50_state_validate(struct nv50_context *nv50) { unsigned i; -#if 0 - if (nv50->screen->cur_ctx != nv50) /* FIXME: not everything is valid */ - nv50->dirty = 0xffffffff; -#endif - nv50->screen->cur_ctx = nv50; + + if (nv50->screen->cur_ctx != nv50) + nv50_switch_pipe_context(nv50); if (nv50->dirty) { for (i = 0; i < validate_list_len; ++i) { diff --git a/src/gallium/drivers/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nvc0/nvc0_state_validate.c index b38d2d9dcc6..bb81480bab9 100644 --- a/src/gallium/drivers/nvc0/nvc0_state_validate.c +++ b/src/gallium/drivers/nvc0/nvc0_state_validate.c @@ -402,6 +402,35 @@ nvc0_validate_derived_1(struct nvc0_context *nvc0) } } +static void +nvc0_switch_pipe_context(struct nvc0_context *ctx_to) +{ + struct nvc0_context *ctx_from = ctx_to->screen->cur_ctx; + + if (ctx_from) + ctx_to->state = ctx_from->state; + + ctx_to->dirty = ~0; + + if (!ctx_to->vertex) + ctx_to->dirty &= ~(NVC0_NEW_VERTEX | NVC0_NEW_ARRAYS); + + if (!ctx_to->vertprog) + ctx_to->dirty &= ~NVC0_NEW_VERTPROG; + if (!ctx_to->fragprog) + ctx_to->dirty &= ~NVC0_NEW_FRAGPROG; + + if (!ctx_to->blend) + ctx_to->dirty &= ~NVC0_NEW_BLEND; + if (!ctx_to->rast) + ctx_to->dirty &= ~NVC0_NEW_RASTERIZER; + if (!ctx_to->zsa) + ctx_to->dirty &= ~NVC0_NEW_ZSA; + + ctx_to->screen->base.channel->user_private = ctx_to->screen->cur_ctx = + ctx_to; +} + static struct state_validate { void (*func)(struct nvc0_context *); uint32_t states; @@ -434,11 +463,9 @@ boolean nvc0_state_validate(struct nvc0_context *nvc0) { unsigned i; -#if 0 - if (nvc0->screen->cur_ctx != nvc0) /* FIXME: not everything is valid */ - nvc0->dirty = 0xffffffff; -#endif - nvc0->screen->cur_ctx = nvc0; + + if (nvc0->screen->cur_ctx != nvc0) + nvc0_switch_pipe_context(nvc0); if (nvc0->dirty) { for (i = 0; i < validate_list_len; ++i) { -- cgit v1.2.3 From c448a556e9f97dd059de99048b75ebf6d51e1d7c Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sun, 13 Mar 2011 18:18:17 +0100 Subject: nv50,nvc0: don't assert on cso with 0 vertex elements --- src/gallium/drivers/nv50/nv50_stateobj.h | 2 +- src/gallium/drivers/nv50/nv50_vbo.c | 4 +--- src/gallium/drivers/nvc0/nvc0_vbo.c | 2 -- 3 files changed, 2 insertions(+), 6 deletions(-) (limited to 'src/gallium/drivers/nv50') diff --git a/src/gallium/drivers/nv50/nv50_stateobj.h b/src/gallium/drivers/nv50/nv50_stateobj.h index cf5b92ef1a8..515e3e78d42 100644 --- a/src/gallium/drivers/nv50/nv50_stateobj.h +++ b/src/gallium/drivers/nv50/nv50_stateobj.h @@ -49,7 +49,7 @@ struct nv50_vertex_stateobj { boolean need_conversion; unsigned vertex_size; unsigned packet_vertex_limit; - struct nv50_vertex_element element[1]; + struct nv50_vertex_element element[0]; }; #endif diff --git a/src/gallium/drivers/nv50/nv50_vbo.c b/src/gallium/drivers/nv50/nv50_vbo.c index 4f0a5018459..abdb9ce2f93 100644 --- a/src/gallium/drivers/nv50/nv50_vbo.c +++ b/src/gallium/drivers/nv50/nv50_vbo.c @@ -51,10 +51,8 @@ nv50_vertex_state_create(struct pipe_context *pipe, struct translate_key transkey; unsigned i; - assert(num_elements); - so = MALLOC(sizeof(*so) + - (num_elements - 1) * sizeof(struct nv50_vertex_element)); + num_elements * sizeof(struct nv50_vertex_element)); if (!so) return NULL; so->num_elements = num_elements; diff --git a/src/gallium/drivers/nvc0/nvc0_vbo.c b/src/gallium/drivers/nvc0/nvc0_vbo.c index 3698043029c..6bbcf2447ec 100644 --- a/src/gallium/drivers/nvc0/nvc0_vbo.c +++ b/src/gallium/drivers/nvc0/nvc0_vbo.c @@ -51,8 +51,6 @@ nvc0_vertex_state_create(struct pipe_context *pipe, struct translate_key transkey; unsigned i; - assert(num_elements); - so = MALLOC(sizeof(*so) + num_elements * sizeof(struct nvc0_vertex_element)); if (!so) -- cgit v1.2.3