diff options
Diffstat (limited to 'src/gallium/drivers')
31 files changed, 60 insertions, 23 deletions
diff --git a/src/gallium/drivers/galahad/glhd_context.c b/src/gallium/drivers/galahad/glhd_context.c index 7e8af565c13..ee9de058bb0 100644 --- a/src/gallium/drivers/galahad/glhd_context.c +++ b/src/gallium/drivers/galahad/glhd_context.c @@ -1011,12 +1011,13 @@ galahad_context_transfer_inline_write(struct pipe_context *_context, static void galahad_context_render_condition(struct pipe_context *_context, struct pipe_query *query, + boolean condition, uint mode) { struct galahad_context *glhd_context = galahad_context(_context); struct pipe_context *context = glhd_context->pipe; - context->render_condition(context, query, mode); + context->render_condition(context, query, condition, mode); } diff --git a/src/gallium/drivers/ilo/ilo_3d.c b/src/gallium/drivers/ilo/ilo_3d.c index b2cbcf04e0c..17dd5b125e9 100644 --- a/src/gallium/drivers/ilo/ilo_3d.c +++ b/src/gallium/drivers/ilo/ilo_3d.c @@ -445,7 +445,7 @@ pass_render_condition(struct ilo_3d *hw3d, struct pipe_context *pipe) if (pipe->get_query_result(pipe, hw3d->render_condition.query, wait, (union pipe_query_result *) &result)) { - return (result > 0); + return (!result == hw3d->render_condition.cond); } else { return true; @@ -679,6 +679,7 @@ ilo_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) static void ilo_render_condition(struct pipe_context *pipe, struct pipe_query *query, + boolean condition, uint mode) { struct ilo_context *ilo = ilo_context(pipe); @@ -687,6 +688,7 @@ ilo_render_condition(struct pipe_context *pipe, /* reference count? */ hw3d->render_condition.query = query; hw3d->render_condition.mode = mode; + hw3d->render_condition.cond = condition; } static void diff --git a/src/gallium/drivers/ilo/ilo_3d.h b/src/gallium/drivers/ilo/ilo_3d.h index 3e67c8521d6..a1a0efc5e96 100644 --- a/src/gallium/drivers/ilo/ilo_3d.h +++ b/src/gallium/drivers/ilo/ilo_3d.h @@ -49,6 +49,7 @@ struct ilo_3d { struct { struct pipe_query *query; unsigned mode; + boolean cond; } render_condition; struct list_head occlusion_queries; diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c index a6d7e594cd6..9a6d13b5bf0 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.c +++ b/src/gallium/drivers/llvmpipe/lp_context.c @@ -112,12 +112,14 @@ do_flush( struct pipe_context *pipe, static void llvmpipe_render_condition ( struct pipe_context *pipe, struct pipe_query *query, + boolean condition, uint mode ) { struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe ); llvmpipe->render_cond_query = query; llvmpipe->render_cond_mode = mode; + llvmpipe->render_cond_cond = condition; } struct pipe_context * diff --git a/src/gallium/drivers/llvmpipe/lp_context.h b/src/gallium/drivers/llvmpipe/lp_context.h index 051596878d9..27e8b0134d0 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.h +++ b/src/gallium/drivers/llvmpipe/lp_context.h @@ -149,6 +149,7 @@ struct llvmpipe_context { /** Conditional query object and mode */ struct pipe_query *render_cond_query; uint render_cond_mode; + boolean render_cond_cond; }; diff --git a/src/gallium/drivers/llvmpipe/lp_query.c b/src/gallium/drivers/llvmpipe/lp_query.c index 0fd91c044a8..973c6898dd6 100644 --- a/src/gallium/drivers/llvmpipe/lp_query.c +++ b/src/gallium/drivers/llvmpipe/lp_query.c @@ -284,12 +284,13 @@ llvmpipe_check_render_cond(struct llvmpipe_context *lp) if (!lp->render_cond_query) return TRUE; /* no query predicate, draw normally */ + wait = (lp->render_cond_mode == PIPE_RENDER_COND_WAIT || lp->render_cond_mode == PIPE_RENDER_COND_BY_REGION_WAIT); b = pipe->get_query_result(pipe, lp->render_cond_query, wait, (void*)&result); if (b) - return result > 0; + return (!result == lp->render_cond_cond); else return TRUE; } diff --git a/src/gallium/drivers/llvmpipe/lp_surface.c b/src/gallium/drivers/llvmpipe/lp_surface.c index a40fe1be99a..7b1f9391b7e 100644 --- a/src/gallium/drivers/llvmpipe/lp_surface.c +++ b/src/gallium/drivers/llvmpipe/lp_surface.c @@ -227,7 +227,7 @@ static void lp_blit(struct pipe_context *pipe, lp->num_sampler_views[PIPE_SHADER_FRAGMENT], lp->sampler_views[PIPE_SHADER_FRAGMENT]); util_blitter_save_render_condition(lp->blitter, lp->render_cond_query, - lp->render_cond_mode); + lp->render_cond_cond, lp->render_cond_mode); util_blitter_blit(lp->blitter, &info); } diff --git a/src/gallium/drivers/nv30/nv30_context.h b/src/gallium/drivers/nv30/nv30_context.h index c90dd3c1061..3009a0c901a 100644 --- a/src/gallium/drivers/nv30/nv30_context.h +++ b/src/gallium/drivers/nv30/nv30_context.h @@ -129,6 +129,7 @@ struct nv30_context { struct pipe_query *render_cond_query; unsigned render_cond_mode; + boolean render_cond_cond; }; static INLINE struct nv30_context * diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c index 4f5c445879a..c038d708a5f 100644 --- a/src/gallium/drivers/nv30/nv30_miptree.c +++ b/src/gallium/drivers/nv30/nv30_miptree.c @@ -213,7 +213,7 @@ nv30_blit(struct pipe_context *pipe, util_blitter_save_fragment_sampler_views(nv30->blitter, nv30->fragprog.num_textures, nv30->fragprog.textures); util_blitter_save_render_condition(nv30->blitter, nv30->render_cond_query, - nv30->render_cond_mode); + nv30->render_cond_cond, nv30->render_cond_mode); util_blitter_blit(nv30->blitter, &info); } diff --git a/src/gallium/drivers/nv30/nv30_query.c b/src/gallium/drivers/nv30/nv30_query.c index 877408648e0..a0a4c67a3d4 100644 --- a/src/gallium/drivers/nv30/nv30_query.c +++ b/src/gallium/drivers/nv30/nv30_query.c @@ -232,7 +232,8 @@ nv30_query_result(struct pipe_context *pipe, struct pipe_query *pq, static void nv40_query_render_condition(struct pipe_context *pipe, - struct pipe_query *pq, uint mode) + struct pipe_query *pq, + boolean condition, uint mode) { struct nv30_context *nv30 = nv30_context(pipe); struct nv30_query *q = nv30_query(pq); @@ -240,6 +241,7 @@ nv40_query_render_condition(struct pipe_context *pipe, nv30->render_cond_query = pq; nv30->render_cond_mode = mode; + nv30->render_cond_cond = condition; if (!pq) { BEGIN_NV04(push, SUBC_3D(0x1e98), 1); diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h index 043ed898913..0a83131fefd 100644 --- a/src/gallium/drivers/nv50/nv50_context.h +++ b/src/gallium/drivers/nv50/nv50_context.h @@ -156,6 +156,7 @@ struct nv50_context { boolean vbo_push_hint; struct pipe_query *cond_query; + boolean cond_cond; uint cond_mode; struct nv50_blitctx *blit; diff --git a/src/gallium/drivers/nv50/nv50_query.c b/src/gallium/drivers/nv50/nv50_query.c index f434f5f7939..656ff9daa43 100644 --- a/src/gallium/drivers/nv50/nv50_query.c +++ b/src/gallium/drivers/nv50/nv50_query.c @@ -321,13 +321,15 @@ nv84_query_fifo_wait(struct nouveau_pushbuf *push, struct pipe_query *pq) static void nv50_render_condition(struct pipe_context *pipe, - struct pipe_query *pq, uint mode) + struct pipe_query *pq, + boolean condition, uint mode) { struct nv50_context *nv50 = nv50_context(pipe); struct nouveau_pushbuf *push = nv50->base.pushbuf; struct nv50_query *q; nv50->cond_query = pq; + nv50->cond_cond = condition; nv50->cond_mode = mode; PUSH_SPACE(push, 6); diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c index 2bfd8556c66..d6066f2ae96 100644 --- a/src/gallium/drivers/nv50/nv50_surface.c +++ b/src/gallium/drivers/nv50/nv50_surface.c @@ -902,7 +902,7 @@ nv50_blitctx_post_blit(struct nv50_blitctx *blit) if (nv50->cond_query) nv50->base.pipe.render_condition(&nv50->base.pipe, nv50->cond_query, - nv50->cond_mode); + nv50->cond_cond, nv50->cond_mode); nouveau_bufctx_reset(nv50->bufctx_3d, NV50_BIND_FB); nouveau_bufctx_reset(nv50->bufctx_3d, NV50_BIND_TEXTURES); diff --git a/src/gallium/drivers/nvc0/nvc0_context.h b/src/gallium/drivers/nvc0/nvc0_context.h index 799d9b9460a..0431b89e151 100644 --- a/src/gallium/drivers/nvc0/nvc0_context.h +++ b/src/gallium/drivers/nvc0/nvc0_context.h @@ -189,6 +189,7 @@ struct nvc0_context { unsigned num_tfbbufs; struct pipe_query *cond_query; + boolean cond_cond; uint cond_mode; struct nvc0_blitctx *blit; diff --git a/src/gallium/drivers/nvc0/nvc0_query.c b/src/gallium/drivers/nvc0/nvc0_query.c index d905f1a8115..8e584c900a6 100644 --- a/src/gallium/drivers/nvc0/nvc0_query.c +++ b/src/gallium/drivers/nvc0/nvc0_query.c @@ -518,7 +518,8 @@ nvc0_query_fifo_wait(struct nouveau_pushbuf *push, struct pipe_query *pq) static void nvc0_render_condition(struct pipe_context *pipe, - struct pipe_query *pq, uint mode) + struct pipe_query *pq, + boolean condition, uint mode) { struct nvc0_context *nvc0 = nvc0_context(pipe); struct nouveau_pushbuf *push = nvc0->base.pushbuf; @@ -530,6 +531,7 @@ nvc0_render_condition(struct pipe_context *pipe, mode != PIPE_RENDER_COND_BY_REGION_NO_WAIT; nvc0->cond_query = pq; + nvc0->cond_cond = condition; nvc0->cond_mode = mode; if (!pq) { diff --git a/src/gallium/drivers/nvc0/nvc0_surface.c b/src/gallium/drivers/nvc0/nvc0_surface.c index e02cf22f506..c8d26f5a124 100644 --- a/src/gallium/drivers/nvc0/nvc0_surface.c +++ b/src/gallium/drivers/nvc0/nvc0_surface.c @@ -801,7 +801,7 @@ nvc0_blitctx_post_blit(struct nvc0_blitctx *blit) if (nvc0->cond_query) nvc0->base.pipe.render_condition(&nvc0->base.pipe, nvc0->cond_query, - nvc0->cond_mode); + nvc0->cond_cond, nvc0->cond_mode); nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_FB); nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_TEX(4, 0)); diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c index e338c57ed80..fbf44c68419 100644 --- a/src/gallium/drivers/r300/r300_query.c +++ b/src/gallium/drivers/r300/r300_query.c @@ -178,6 +178,7 @@ static boolean r300_get_query_result(struct pipe_context* pipe, static void r300_render_condition(struct pipe_context *pipe, struct pipe_query *query, + boolean condition, uint mode) { struct r300_context *r300 = r300_context(pipe); @@ -192,10 +193,10 @@ static void r300_render_condition(struct pipe_context *pipe, if (r300_get_query_result(pipe, query, wait, &result)) { if (r300_query(query)->type == PIPE_QUERY_OCCLUSION_PREDICATE) { - r300->skip_rendering = !result.b; + r300->skip_rendering = condition == result.b; } else { - r300->skip_rendering = !result.u64; - } + r300->skip_rendering = condition == !!result.u64; + } } } } diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 660f4f9aa96..dcc397851fc 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -88,6 +88,7 @@ static void r600_blitter_begin(struct pipe_context *ctx, enum r600_blitter_op op if ((op & R600_DISABLE_RENDER_COND) && rctx->current_render_cond) { util_blitter_save_render_condition(rctx->blitter, rctx->current_render_cond, + rctx->current_render_cond_cond, rctx->current_render_cond_mode); } } diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 71f555b0eab..74a650a01e7 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -162,13 +162,15 @@ static void r600_flush(struct pipe_context *ctx, unsigned flags) struct r600_context *rctx = (struct r600_context *)ctx; struct pipe_query *render_cond = NULL; unsigned render_cond_mode = 0; + boolean render_cond_cond = FALSE; rctx->rings.gfx.flushing = true; /* Disable render condition. */ if (rctx->current_render_cond) { render_cond = rctx->current_render_cond; + render_cond_cond = rctx->current_render_cond_cond; render_cond_mode = rctx->current_render_cond_mode; - ctx->render_condition(ctx, NULL, 0); + ctx->render_condition(ctx, NULL, FALSE, 0); } r600_context_flush(rctx, flags); @@ -177,7 +179,7 @@ static void r600_flush(struct pipe_context *ctx, unsigned flags) /* Re-enable render condition. */ if (render_cond) { - ctx->render_condition(ctx, render_cond, render_cond_mode); + ctx->render_condition(ctx, render_cond, render_cond_cond, render_cond_mode); } } diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 2a81434155e..1dc346f049f 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -629,6 +629,7 @@ struct r600_context { /* Render condition. */ struct pipe_query *current_render_cond; unsigned current_render_cond_mode; + boolean current_render_cond_cond; boolean predicate_drawing; void *sb_context; diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c index d264b7f3970..f77e1a8f52d 100644 --- a/src/gallium/drivers/r600/r600_query.c +++ b/src/gallium/drivers/r600/r600_query.c @@ -669,6 +669,7 @@ static boolean r600_get_query_result(struct pipe_context *ctx, static void r600_render_condition(struct pipe_context *ctx, struct pipe_query *query, + boolean condition, uint mode) { struct r600_context *rctx = (struct r600_context *)ctx; @@ -676,6 +677,7 @@ static void r600_render_condition(struct pipe_context *ctx, bool wait_flag = false; rctx->current_render_cond = query; + rctx->current_render_cond_cond = condition; rctx->current_render_cond_mode = mode; if (query == NULL) { diff --git a/src/gallium/drivers/radeonsi/r600_blit.c b/src/gallium/drivers/radeonsi/r600_blit.c index 724d481daad..34f14bae034 100644 --- a/src/gallium/drivers/radeonsi/r600_blit.c +++ b/src/gallium/drivers/radeonsi/r600_blit.c @@ -80,8 +80,9 @@ static void r600_blitter_begin(struct pipe_context *ctx, enum r600_blitter_op op if ((op & R600_DISABLE_RENDER_COND) && rctx->current_render_cond) { rctx->saved_render_cond = rctx->current_render_cond; + rctx->saved_render_cond_cond = rctx->current_render_cond_cond; rctx->saved_render_cond_mode = rctx->current_render_cond_mode; - rctx->context.render_condition(&rctx->context, NULL, 0); + rctx->context.render_condition(&rctx->context, NULL, FALSE, 0); } } @@ -92,6 +93,7 @@ static void r600_blitter_end(struct pipe_context *ctx) if (rctx->saved_render_cond) { rctx->context.render_condition(&rctx->context, rctx->saved_render_cond, + rctx->saved_render_cond_cond, rctx->saved_render_cond_mode); rctx->saved_render_cond = NULL; } diff --git a/src/gallium/drivers/radeonsi/r600_query.c b/src/gallium/drivers/radeonsi/r600_query.c index bbf7c046f57..0162cce894a 100644 --- a/src/gallium/drivers/radeonsi/r600_query.c +++ b/src/gallium/drivers/radeonsi/r600_query.c @@ -69,6 +69,7 @@ static boolean r600_get_query_result(struct pipe_context *ctx, static void r600_render_condition(struct pipe_context *ctx, struct pipe_query *query, + boolean condition, uint mode) { struct r600_context *rctx = (struct r600_context *)ctx; @@ -78,12 +79,13 @@ static void r600_render_condition(struct pipe_context *ctx, /* If we already have nonzero result, render unconditionally */ if (query != NULL && rquery->result.u64 != 0) { if (rctx->current_render_cond) { - r600_render_condition(ctx, NULL, 0); + r600_render_condition(ctx, NULL, FALSE, 0); } return; } rctx->current_render_cond = query; + rctx->current_render_cond_cond = condition; rctx->current_render_cond_mode = mode; if (query == NULL) { diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.c b/src/gallium/drivers/radeonsi/radeonsi_pipe.c index 382311f39bd..3f4cd78cd57 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_pipe.c +++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.c @@ -139,6 +139,7 @@ void radeonsi_flush(struct pipe_context *ctx, struct pipe_fence_handle **fence, struct r600_context *rctx = (struct r600_context *)ctx; struct r600_fence **rfence = (struct r600_fence**)fence; struct pipe_query *render_cond = NULL; + boolean render_cond_cond = FALSE; unsigned render_cond_mode = 0; if (rfence) @@ -147,15 +148,16 @@ void radeonsi_flush(struct pipe_context *ctx, struct pipe_fence_handle **fence, /* Disable render condition. */ if (rctx->current_render_cond) { render_cond = rctx->current_render_cond; + render_cond_cond = rctx->current_render_cond_cond; render_cond_mode = rctx->current_render_cond_mode; - ctx->render_condition(ctx, NULL, 0); + ctx->render_condition(ctx, NULL, FALSE, 0); } si_context_flush(rctx, flags); /* Re-enable render condition. */ if (render_cond) { - ctx->render_condition(ctx, render_cond, render_cond_mode); + ctx->render_condition(ctx, render_cond, render_cond_cond, render_cond_mode); } } diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.h b/src/gallium/drivers/radeonsi/radeonsi_pipe.h index 67cb14b7cc0..90d67e28d21 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_pipe.h +++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.h @@ -153,8 +153,10 @@ struct r600_context { struct si_cs_shader_state cs_shader_state; struct pipe_query *current_render_cond; unsigned current_render_cond_mode; + boolean current_render_cond_cond; struct pipe_query *saved_render_cond; unsigned saved_render_cond_mode; + boolean saved_render_cond_cond; /* shader information */ unsigned sprite_coord_enable; unsigned export_16bpc; diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 141b7a8b185..14cfdc8c23b 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -175,12 +175,14 @@ softpipe_is_resource_referenced( struct pipe_context *pipe, static void softpipe_render_condition( struct pipe_context *pipe, struct pipe_query *query, + boolean condition, uint mode ) { struct softpipe_context *softpipe = softpipe_context( pipe ); softpipe->render_cond_query = query; softpipe->render_cond_mode = mode; + softpipe->render_cond_cond = condition; } diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h index ea6c0f929c5..d7a00b95b25 100644 --- a/src/gallium/drivers/softpipe/sp_context.h +++ b/src/gallium/drivers/softpipe/sp_context.h @@ -144,6 +144,7 @@ struct softpipe_context { /** Conditional query object and mode */ struct pipe_query *render_cond_query; uint render_cond_mode; + boolean render_cond_cond; /** Polygon stipple items */ struct { diff --git a/src/gallium/drivers/softpipe/sp_query.c b/src/gallium/drivers/softpipe/sp_query.c index b444e378085..b5bc0db4490 100644 --- a/src/gallium/drivers/softpipe/sp_query.c +++ b/src/gallium/drivers/softpipe/sp_query.c @@ -261,7 +261,7 @@ softpipe_check_render_cond(struct softpipe_context *sp) b = pipe->get_query_result(pipe, sp->render_cond_query, wait, (void*)&result); if (b) - return result > 0; + return (!result == sp->render_cond_cond); else return TRUE; } diff --git a/src/gallium/drivers/softpipe/sp_surface.c b/src/gallium/drivers/softpipe/sp_surface.c index 911c34df1b8..52c85be2e3f 100644 --- a/src/gallium/drivers/softpipe/sp_surface.c +++ b/src/gallium/drivers/softpipe/sp_surface.c @@ -78,7 +78,7 @@ static void sp_blit(struct pipe_context *pipe, sp->num_sampler_views[PIPE_SHADER_FRAGMENT], sp->sampler_views[PIPE_SHADER_FRAGMENT]); util_blitter_save_render_condition(sp->blitter, sp->render_cond_query, - sp->render_cond_mode); + sp->render_cond_cond, sp->render_cond_mode); util_blitter_blit(sp->blitter, info); } diff --git a/src/gallium/drivers/svga/svga_pipe_blit.c b/src/gallium/drivers/svga/svga_pipe_blit.c index a44ed12adf7..05930d0ec51 100644 --- a/src/gallium/drivers/svga/svga_pipe_blit.c +++ b/src/gallium/drivers/svga/svga_pipe_blit.c @@ -206,7 +206,7 @@ static void svga_blit(struct pipe_context *pipe, svga->curr.num_sampler_views, svga->curr.sampler_views); /*util_blitter_save_render_condition(svga->blitter, svga->render_cond_query, - svga->render_cond_mode);*/ + svga->render_cond_cond, svga->render_cond_mode);*/ util_blitter_blit(svga->blitter, &info); } diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index ee23077d960..d78dd3ed347 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -1482,6 +1482,7 @@ trace_context_transfer_inline_write(struct pipe_context *_context, static void trace_context_render_condition(struct pipe_context *_context, struct pipe_query *query, + boolean condition, uint mode) { struct trace_context *tr_context = trace_context(_context); @@ -1491,11 +1492,12 @@ static void trace_context_render_condition(struct pipe_context *_context, trace_dump_arg(ptr, context); trace_dump_arg(ptr, query); + trace_dump_arg(bool, condition); trace_dump_arg(uint, mode); trace_dump_call_end(); - context->render_condition(context, query, mode); + context->render_condition(context, query, condition, mode); } |