summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2010-01-06 13:52:22 +0000
committerJosé Fonseca <jfonseca@vmware.com>2010-01-06 13:52:22 +0000
commite32487b8a13a9efabb0359a9dde33e074e905e82 (patch)
treefbfdb33273371a5faec1de4ff97b803766eacf63 /src/gallium
parentaaf7ecfd816f82fef314f4f772cc53bc0ced553e (diff)
parent5b64d94390e4805e1634f0c8b5e3156e12b8b872 (diff)
Merge remote branch 'origin/mesa_7_7_branch'
Conflicts: configs/default src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c src/mesa/main/version.h
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c34
-rw-r--r--src/gallium/drivers/svga/svga_context.h2
-rw-r--r--src/gallium/drivers/svga/svga_pipe_fs.c7
-rw-r--r--src/gallium/drivers/svga/svga_pipe_vs.c7
-rw-r--r--src/gallium/drivers/svga/svga_state_fs.c13
-rw-r--r--src/gallium/drivers/svga/svga_state_vs.c13
6 files changed, 42 insertions, 34 deletions
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
index a9375abd21..ba6f7b15f9 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
@@ -80,7 +80,7 @@ struct fenced_buffer_list
*/
struct fenced_buffer
{
- /*
+ /*
* Immutable members.
*/
@@ -126,8 +126,8 @@ fenced_buffer(struct pb_buffer *buf)
/**
* Add the buffer to the fenced list.
*
- * fenced_buffer_list::mutex and fenced_buffer::mutex must be held, in this
- * order before calling this function.
+ * fenced_buffer_list::mutex and fenced_buffer::mutex must be held, in this
+ * order, before calling this function.
*
* Reference count should be incremented before calling this function.
*/
@@ -191,7 +191,7 @@ fenced_buffer_remove_locked(struct fenced_buffer_list *fenced_list,
* Wait for the fence to expire, and remove it from the fenced list.
*
* fenced_buffer::mutex must be held. fenced_buffer_list::mutex must not be
- * held -- it will
+ * held -- it will be acquired internally.
*/
static INLINE enum pipe_error
fenced_buffer_finish_locked(struct fenced_buffer_list *fenced_list,
@@ -207,7 +207,10 @@ fenced_buffer_finish_locked(struct fenced_buffer_list *fenced_list,
assert(pipe_is_referenced(&fenced_buf->base.base.reference));
assert(fenced_buf->fence);
- /* Acquire the global lock */
+ /*
+ * Acquire the global lock. Must release buffer mutex first to preserve
+ * lock order.
+ */
pipe_mutex_unlock(fenced_buf->mutex);
pipe_mutex_lock(fenced_list->mutex);
pipe_mutex_lock(fenced_buf->mutex);
@@ -217,7 +220,7 @@ fenced_buffer_finish_locked(struct fenced_buffer_list *fenced_list,
/* Remove from the fenced list */
/* TODO: remove consequents */
fenced_buffer_remove_locked(fenced_list, fenced_buf);
-
+
p_atomic_dec(&fenced_buf->base.base.reference.count);
assert(pipe_is_referenced(&fenced_buf->base.base.reference));
@@ -238,7 +241,7 @@ fenced_buffer_finish_locked(struct fenced_buffer_list *fenced_list,
*/
static void
fenced_buffer_list_check_free_locked(struct fenced_buffer_list *fenced_list,
- int wait)
+ int wait)
{
struct pb_fence_ops *ops = fenced_list->ops;
struct list_head *curr, *next;
@@ -274,7 +277,6 @@ fenced_buffer_list_check_free_locked(struct fenced_buffer_list *fenced_list,
pb_buf = &fenced_buf->base;
pb_reference(&pb_buf, NULL);
-
curr = next;
next = curr->next;
@@ -329,7 +331,7 @@ fenced_buffer_map(struct pb_buffer *buf,
if((flags & PIPE_BUFFER_USAGE_DONTBLOCK) &&
ops->fence_signalled(ops, fenced_buf->fence, 0) == 0) {
/* Don't wait for the GPU to finish writing */
- goto finish;
+ goto done;
}
/* Wait for the GPU to finish writing */
@@ -350,7 +352,7 @@ fenced_buffer_map(struct pb_buffer *buf,
fenced_buf->flags |= flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE;
}
-finish:
+done:
pipe_mutex_unlock(fenced_buf->mutex);
return map;
@@ -391,7 +393,7 @@ fenced_buffer_validate(struct pb_buffer *buf,
fenced_buf->vl = NULL;
fenced_buf->validation_flags = 0;
ret = PIPE_OK;
- goto finish;
+ goto done;
}
assert(flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE);
@@ -401,7 +403,7 @@ fenced_buffer_validate(struct pb_buffer *buf,
/* Buffer cannot be validated in two different lists */
if(fenced_buf->vl && fenced_buf->vl != vl) {
ret = PIPE_ERROR_RETRY;
- goto finish;
+ goto done;
}
#if 0
@@ -409,7 +411,7 @@ fenced_buffer_validate(struct pb_buffer *buf,
if(fenced_buf->flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE) {
/* TODO: wait for the thread that mapped the buffer to unmap it */
ret = PIPE_ERROR_RETRY;
- goto finish;
+ goto done;
}
/* Final sanity checking */
assert(!(fenced_buf->flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE));
@@ -420,17 +422,17 @@ fenced_buffer_validate(struct pb_buffer *buf,
(fenced_buf->validation_flags & flags) == flags) {
/* Nothing to do -- buffer already validated */
ret = PIPE_OK;
- goto finish;
+ goto done;
}
ret = pb_validate(fenced_buf->buffer, vl, flags);
if (ret != PIPE_OK)
- goto finish;
+ goto done;
fenced_buf->vl = vl;
fenced_buf->validation_flags |= flags;
-finish:
+done:
pipe_mutex_unlock(fenced_buf->mutex);
return ret;
diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h
index fa7f6cb3bb..66259fd010 100644
--- a/src/gallium/drivers/svga/svga_context.h
+++ b/src/gallium/drivers/svga/svga_context.h
@@ -266,8 +266,6 @@ struct svga_hw_draw_state
unsigned ts[16][TS_MAX];
float cb[PIPE_SHADER_TYPES][CB_MAX][4];
- unsigned shader_id[PIPE_SHADER_TYPES];
-
struct svga_shader_result *fs;
struct svga_shader_result *vs;
struct svga_hw_view_state views[PIPE_MAX_SAMPLERS];
diff --git a/src/gallium/drivers/svga/svga_pipe_fs.c b/src/gallium/drivers/svga/svga_pipe_fs.c
index a461a86dd3..5f1213e46a 100644
--- a/src/gallium/drivers/svga/svga_pipe_fs.c
+++ b/src/gallium/drivers/svga/svga_pipe_fs.c
@@ -111,6 +111,13 @@ void svga_delete_fs_state(struct pipe_context *pipe, void *shader)
util_bitmask_clear( svga->fs_bm, result->id );
svga_destroy_shader_result( result );
+
+ /*
+ * Remove stale references to this result to ensure a new result on the
+ * same address will be detected as a change.
+ */
+ if(result == svga->state.hw_draw.fs)
+ svga->state.hw_draw.fs = NULL;
}
FREE((void *)fs->base.tokens);
diff --git a/src/gallium/drivers/svga/svga_pipe_vs.c b/src/gallium/drivers/svga/svga_pipe_vs.c
index e82d10c259..7e6ab576ad 100644
--- a/src/gallium/drivers/svga/svga_pipe_vs.c
+++ b/src/gallium/drivers/svga/svga_pipe_vs.c
@@ -176,6 +176,13 @@ static void svga_delete_vs_state(struct pipe_context *pipe, void *shader)
util_bitmask_clear( svga->vs_bm, result->id );
svga_destroy_shader_result( result );
+
+ /*
+ * Remove stale references to this result to ensure a new result on the
+ * same address will be detected as a change.
+ */
+ if(result == svga->state.hw_draw.vs)
+ svga->state.hw_draw.vs = NULL;
}
FREE((void *)vs->base.tokens);
diff --git a/src/gallium/drivers/svga/svga_state_fs.c b/src/gallium/drivers/svga/svga_state_fs.c
index 1902b0106b..272d1dd14e 100644
--- a/src/gallium/drivers/svga/svga_state_fs.c
+++ b/src/gallium/drivers/svga/svga_state_fs.c
@@ -268,16 +268,13 @@ static int emit_hw_fs( struct svga_context *svga,
assert(id != SVGA3D_INVALID_ID);
if (result != svga->state.hw_draw.fs) {
- if (id != svga->state.hw_draw.shader_id[PIPE_SHADER_FRAGMENT]) {
- ret = SVGA3D_SetShader(svga->swc,
- SVGA3D_SHADERTYPE_PS,
- id );
- if (ret)
- return ret;
- }
+ ret = SVGA3D_SetShader(svga->swc,
+ SVGA3D_SHADERTYPE_PS,
+ id );
+ if (ret)
+ return ret;
svga->dirty |= SVGA_NEW_FS_RESULT;
- svga->state.hw_draw.shader_id[PIPE_SHADER_FRAGMENT] = id;
svga->state.hw_draw.fs = result;
}
diff --git a/src/gallium/drivers/svga/svga_state_vs.c b/src/gallium/drivers/svga/svga_state_vs.c
index 7e34c0a980..ae1e77e7d4 100644
--- a/src/gallium/drivers/svga/svga_state_vs.c
+++ b/src/gallium/drivers/svga/svga_state_vs.c
@@ -150,16 +150,13 @@ static int emit_hw_vs( struct svga_context *svga,
}
if (result != svga->state.hw_draw.vs) {
- if (id != svga->state.hw_draw.shader_id[PIPE_SHADER_VERTEX]) {
- ret = SVGA3D_SetShader(svga->swc,
- SVGA3D_SHADERTYPE_VS,
- id );
- if (ret)
- return ret;
- }
+ ret = SVGA3D_SetShader(svga->swc,
+ SVGA3D_SHADERTYPE_VS,
+ id );
+ if (ret)
+ return ret;
svga->dirty |= SVGA_NEW_VS_RESULT;
- svga->state.hw_draw.shader_id[PIPE_SHADER_VERTEX] = id;
svga->state.hw_draw.vs = result;
}