llvmpipe: Stop relying on PIPE_FLUSH_TEXTURE_CACHE/PIPE_FLUSH_RENDER_CACHE magic.

Flush means flush, i.e., all previous operations should be visible from
other contexts.

This does not imply unswizzling tiles, since unswizzling should be done on
a needed basis for any context.
This commit is contained in:
José Fonseca 2010-05-25 14:39:25 +01:00
parent ba404c8f2a
commit 378796fe11
2 changed files with 11 additions and 32 deletions

View File

@ -52,24 +52,15 @@ llvmpipe_flush( struct pipe_context *pipe,
draw_flush(llvmpipe->draw); draw_flush(llvmpipe->draw);
if (fence) { if (fence) {
if ((flags & (PIPE_FLUSH_SWAPBUFFERS | /* if we're going to flush the setup/rasterization modules, emit
PIPE_FLUSH_RENDER_CACHE))) { * a fence.
/* if we're going to flush the setup/rasterization modules, emit * XXX this (and the code below) may need fine tuning...
* a fence. */
* XXX this (and the code below) may need fine tuning... *fence = lp_setup_fence( llvmpipe->setup );
*/
*fence = lp_setup_fence( llvmpipe->setup );
}
else {
*fence = NULL;
}
} }
/* ask the setup module to flush */ /* ask the setup module to flush */
if (flags & (PIPE_FLUSH_SWAPBUFFERS | PIPE_FLUSH_RENDER_CACHE | lp_setup_flush(llvmpipe->setup, flags);
PIPE_FLUSH_TEXTURE_CACHE)) {
lp_setup_flush(llvmpipe->setup, flags);
}
/* Enable to dump BMPs of the color/depth buffers each frame */ /* Enable to dump BMPs of the color/depth buffers each frame */
if (0) { if (0) {
@ -119,19 +110,6 @@ llvmpipe_flush_resource(struct pipe_context *pipe,
if ((referenced & PIPE_REFERENCED_FOR_WRITE) || if ((referenced & PIPE_REFERENCED_FOR_WRITE) ||
((referenced & PIPE_REFERENCED_FOR_READ) && !read_only)) { ((referenced & PIPE_REFERENCED_FOR_READ) && !read_only)) {
if (resource->target != PIPE_BUFFER) {
/*
* 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)
flush_flags |= PIPE_FLUSH_RENDER_CACHE;
if (referenced & PIPE_REFERENCED_FOR_READ)
flush_flags |= PIPE_FLUSH_TEXTURE_CACHE;
}
if (cpu_access) { if (cpu_access) {
/* /*
* Flush and wait. * Flush and wait.
@ -142,7 +120,7 @@ llvmpipe_flush_resource(struct pipe_context *pipe,
if (do_not_block) if (do_not_block)
return FALSE; return FALSE;
pipe->flush(pipe, flush_flags, &fence); llvmpipe_flush(pipe, flush_flags, &fence);
if (fence) { if (fence) {
pipe->screen->fence_finish(pipe->screen, fence, 0); pipe->screen->fence_finish(pipe->screen, fence, 0);
@ -153,7 +131,7 @@ llvmpipe_flush_resource(struct pipe_context *pipe,
* Just flush. * Just flush.
*/ */
pipe->flush(pipe, flush_flags, NULL); llvmpipe_flush(pipe, flush_flags, NULL);
} }
} }

View File

@ -34,6 +34,7 @@
#include "pipe/p_defines.h" #include "pipe/p_defines.h"
#include "util/u_memory.h" #include "util/u_memory.h"
#include "lp_context.h" #include "lp_context.h"
#include "lp_flush.h"
#include "lp_query.h" #include "lp_query.h"
#include "lp_rast.h" #include "lp_rast.h"
#include "lp_rast_priv.h" #include "lp_rast_priv.h"
@ -82,7 +83,7 @@ llvmpipe_get_query_result(struct pipe_context *pipe,
struct llvmpipe_query *pq = llvmpipe_query(q); struct llvmpipe_query *pq = llvmpipe_query(q);
if (!pq->done) { if (!pq->done) {
lp_setup_flush(llvmpipe->setup, TRUE); lp_setup_flush(llvmpipe->setup, 0);
} }
if (pq->done) { if (pq->done) {
@ -105,7 +106,7 @@ llvmpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q)
*/ */
if (pq->binned) { if (pq->binned) {
struct pipe_fence_handle *fence; struct pipe_fence_handle *fence;
pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, &fence); llvmpipe_flush(pipe, 0, &fence);
if (fence) { if (fence) {
pipe->screen->fence_finish(pipe->screen, fence, 0); pipe->screen->fence_finish(pipe->screen, fence, 0);
pipe->screen->fence_reference(pipe->screen, &fence, NULL); pipe->screen->fence_reference(pipe->screen, &fence, NULL);