From: Brian Paul Date: Sat, 12 Dec 2009 00:59:26 +0000 (-0700) Subject: llvmpipe: checkpoint: plug in the new fencing code X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6cbb1219a3f6b83ee4d24aecb61f5b5943e3cac3;p=mesa.git llvmpipe: checkpoint: plug in the new fencing code This has only been very lightly tested. More work to come. --- diff --git a/src/gallium/drivers/llvmpipe/lp_flush.c b/src/gallium/drivers/llvmpipe/lp_flush.c index f7a1d897019..e6519cb216b 100644 --- a/src/gallium/drivers/llvmpipe/lp_flush.c +++ b/src/gallium/drivers/llvmpipe/lp_flush.c @@ -49,6 +49,23 @@ llvmpipe_flush( struct pipe_context *pipe, draw_flush(llvmpipe->draw); + if (fence) { + if ((flags & (PIPE_FLUSH_SWAPBUFFERS | + PIPE_FLUSH_RENDER_CACHE))) { + /* if we're going to flush the setup/rasterization modules, emit + * a fence. + * XXX this (and the code below) may need fine tuning... + */ + *fence = lp_setup_fence( llvmpipe->setup ); + } + else { + *fence = NULL; + } + } + + /* XXX the lp_setup_flush(flags) param is not a bool, and it's ignored + * at this time! + */ if (flags & PIPE_FLUSH_SWAPBUFFERS) { lp_setup_flush( llvmpipe->setup, FALSE ); } @@ -68,8 +85,5 @@ llvmpipe_flush( struct pipe_context *pipe, ++frame_no; } #endif - - if (fence) - *fence = NULL; } diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index d976934a5dd..3967b4f21ed 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -39,6 +39,7 @@ #include "lp_bin.h" #include "lp_bin_queue.h" #include "lp_debug.h" +#include "lp_fence.h" #include "lp_state.h" #include "lp_buffer.h" #include "lp_texture.h" @@ -308,6 +309,28 @@ lp_setup_clear( struct setup_context *setup, } +/** + * Emit a fence. + */ +struct pipe_fence_handle * +lp_setup_fence( struct setup_context *setup ) +{ + struct lp_bins *bins = lp_setup_get_current_bins(setup); + const unsigned rank = lp_bin_get_num_bins( bins ); + struct lp_fence *fence = lp_fence_create(rank); + + LP_DBG(DEBUG_SETUP, "%s rank %u\n", __FUNCTION__, rank); + + set_state( setup, SETUP_ACTIVE ); + + /* insert the fence into all command bins */ + lp_bin_everywhere( bins, + lp_rast_fence, + lp_rast_arg_fence(fence) ); + + return (struct pipe_fence_handle *) fence; +} + void lp_setup_set_triangle_state( struct setup_context *setup, diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h index 66a7f29f1e7..5c606e86afc 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.h +++ b/src/gallium/drivers/llvmpipe/lp_setup.h @@ -67,6 +67,10 @@ lp_setup_clear(struct setup_context *setup, unsigned clear_stencil, unsigned flags); +struct pipe_fence_handle * +lp_setup_fence( struct setup_context *setup ); + + void lp_setup_tri(struct setup_context *setup, const float (*v0)[4],