summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2010-04-18 17:19:45 +0200
committerMarek Olšák <[email protected]>2010-04-18 17:49:12 +0200
commit24ceef7a6969ccb2243e7bb32f86d6429d9689b9 (patch)
tree0112f93357ae2c6ad6fc51e70e93fead87ee08a6 /src/gallium/drivers
parentcea7b9f937dd8d987dc48e636adf83a829897a28 (diff)
r300g: more solid is_buffer_referenced implementation
This fixes crash from 7a1b5c937fa32968a04a11649e456a1ef8c5b442, and also removes the unused "map" pointer.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/r300/r300_render.c6
-rw-r--r--src/gallium/drivers/r300/r300_screen_buffer.c18
-rw-r--r--src/gallium/drivers/r300/r300_screen_buffer.h6
3 files changed, 19 insertions, 11 deletions
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index 26ff71c8461..a3fd8cc67d8 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -152,9 +152,9 @@ static boolean immd_is_good_idea(struct r300_context *r300,
if (!checked[vbi]) {
vbuf = &r300->vertex_buffer[vbi];
- if (r300->rws->is_buffer_referenced(r300->rws,
- r300_buffer(vbuf->buffer)->buf,
- R300_REF_CS | R300_REF_HW)) {
+ if (r300_buffer_is_referenced(&r300->context,
+ vbuf->buffer,
+ R300_REF_CS | R300_REF_HW)) {
/* It's a very bad idea to map it... */
return FALSE;
}
diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c
index c5c10af2a4c..6d33c13ca40 100644
--- a/src/gallium/drivers/r300/r300_screen_buffer.c
+++ b/src/gallium/drivers/r300/r300_screen_buffer.c
@@ -34,9 +34,9 @@
#include "r300_screen_buffer.h"
#include "r300_winsys.h"
-static unsigned r300_buffer_is_referenced(struct pipe_context *context,
- struct pipe_resource *buf,
- unsigned face, unsigned level)
+unsigned r300_buffer_is_referenced(struct pipe_context *context,
+ struct pipe_resource *buf,
+ enum r300_reference_domain domain)
{
struct r300_context *r300 = r300_context(context);
struct r300_buffer *rbuf = r300_buffer(buf);
@@ -44,12 +44,19 @@ static unsigned r300_buffer_is_referenced(struct pipe_context *context,
if (r300_buffer_is_user_buffer(buf))
return PIPE_UNREFERENCED;
- if (r300->rws->is_buffer_referenced(r300->rws, rbuf->buf, R300_REF_CS))
+ if (r300->rws->is_buffer_referenced(r300->rws, rbuf->buf, domain))
return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
return PIPE_UNREFERENCED;
}
+static unsigned r300_buffer_is_referenced_by_cs(struct pipe_context *context,
+ struct pipe_resource *buf,
+ unsigned face, unsigned level)
+{
+ return r300_buffer_is_referenced(context, buf, R300_REF_CS);
+}
+
/* External helper, not required to implent u_resource_vtbl:
*/
int r300_upload_index_buffer(struct r300_context *r300,
@@ -174,7 +181,6 @@ r300_buffer_transfer_map( struct pipe_context *pipe,
rws->buffer_reference(rws, &rbuf->buf, NULL);
rbuf->num_ranges = 0;
- rbuf->map = NULL;
rbuf->buf = r300_winsys_buffer_create(r300screen,
16,
rbuf->b.b.bind, /* XXX */
@@ -243,7 +249,7 @@ struct u_resource_vtbl r300_buffer_vtbl =
{
u_default_resource_get_handle, /* get_handle */
r300_buffer_destroy, /* resource_destroy */
- r300_buffer_is_referenced, /* is_buffer_referenced */
+ r300_buffer_is_referenced_by_cs, /* is_buffer_referenced */
u_default_get_transfer, /* get_transfer */
u_default_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 82660d3e1a4..57f48229b2e 100644
--- a/src/gallium/drivers/r300/r300_screen_buffer.h
+++ b/src/gallium/drivers/r300/r300_screen_buffer.h
@@ -55,8 +55,6 @@ struct r300_buffer
void *user_buffer;
struct r300_buffer_range ranges[R300_BUFFER_MAX_RANGES];
unsigned num_ranges;
-
- void *map;
};
/* Functions. */
@@ -77,6 +75,10 @@ struct pipe_resource *r300_user_buffer_create(struct pipe_screen *screen,
unsigned bytes,
unsigned usage);
+unsigned r300_buffer_is_referenced(struct pipe_context *context,
+ struct pipe_resource *buf,
+ enum r300_reference_domain domain);
+
/* Inline functions. */
static INLINE struct r300_buffer *r300_buffer(struct pipe_resource *buffer)