summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2009-10-14 15:13:25 +1000
committerDave Airlie <[email protected]>2009-10-14 15:13:25 +1000
commit210481ae16e966865dcf9f1fd5f5dfabf4dc28bc (patch)
tree98a2964441d45a93b7e80effd11fed2ed892a92a
parent23c0c820e2767324546d450d2a7aa7bf1f70c36f (diff)
r300g: attempt to make bo space check sane.
This attempts to make r300g do proper bo space checking as opposed to whatever it was doing now. Signed-off-by: Dave Airlie <[email protected]>
-rw-r--r--src/gallium/drivers/r300/r300_context.c9
-rw-r--r--src/gallium/drivers/r300/r300_emit.c3
-rw-r--r--src/gallium/drivers/r300/r300_winsys.h6
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_r300.c23
4 files changed, 38 insertions, 3 deletions
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 9cc455135db..e6bc80e48f8 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -136,6 +136,13 @@ r300_is_buffer_referenced( struct pipe_context *pipe,
return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
}
+static void r300_flush_cb(void *data)
+{
+ struct r300_context* const cs_context_copy = data;
+
+ cs_context_copy->context.flush(&cs_context_copy->context, 0, NULL);
+}
+
struct pipe_context* r300_create_context(struct pipe_screen* screen,
struct r300_winsys* r300_winsys)
{
@@ -190,6 +197,8 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
r300_init_state_functions(r300);
r300_emit_invariant_state(r300);
+
+ r300->winsys->set_flush_cb(r300->winsys, r300_flush_cb, r300);
r300->dirty_state = R300_NEW_KITCHEN_SINK;
r300->dirty_hw++;
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 99deb50400f..64748ad8f81 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -658,6 +658,9 @@ void r300_emit_dirty_state(struct r300_context* r300)
r300_update_derived_state(r300);
+ /* Clean out BOs. */
+ r300->winsys->reset_bos(r300->winsys);
+
/* XXX check size */
validate:
/* Color buffers... */
diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h
index f18ad75a47d..540f8eca92e 100644
--- a/src/gallium/drivers/r300/r300_winsys.h
+++ b/src/gallium/drivers/r300/r300_winsys.h
@@ -92,6 +92,12 @@ struct r300_winsys {
/* Flush the CS. */
void (*flush_cs)(struct r300_winsys* winsys);
+
+ /* winsys flush - callback from winsys when flush required */
+ void (*set_flush_cb)(struct r300_winsys *winsys,
+ void (*flush_cb)(void *), void *data);
+
+ void (*reset_bos)(struct r300_winsys *winsys);
};
struct pipe_context* r300_create_context(struct pipe_screen* screen,
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
index d2d84f1a8f0..3587892e003 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
@@ -22,6 +22,17 @@
#include "radeon_r300.h"
+static void radeon_r300_set_flush_cb(struct r300_winsys *winsys,
+ void (*flush_cb)(void *),
+ void *data)
+{
+ struct radeon_winsys_priv* priv =
+ (struct radeon_winsys_priv*)winsys->radeon_winsys;
+
+ radeon_cs_space_set_flush(priv->cs, flush_cb,
+ data);
+}
+
static boolean radeon_r300_add_buffer(struct r300_winsys* winsys,
struct pipe_buffer* pbuffer,
uint32_t rd,
@@ -95,6 +106,13 @@ static void radeon_r300_write_cs_reloc(struct r300_winsys* winsys,
}
}
+static void radeon_r300_reset_bos(struct r300_winsys *winsys)
+{
+ struct radeon_winsys_priv* priv =
+ (struct radeon_winsys_priv*)winsys->radeon_winsys;
+ radeon_cs_space_reset_bos(priv->cs);
+}
+
static void radeon_r300_end_cs(struct r300_winsys* winsys,
const char* file,
const char* function,
@@ -119,9 +137,6 @@ static void radeon_r300_flush_cs(struct r300_winsys* winsys)
radeon_cs_print(priv->cs, stderr);
}
- /* Clean out BOs. */
- radeon_cs_space_reset_bos(priv->cs);
-
/* Reset CS.
* Someday, when we care about performance, we should really find a way
* to rotate between two or three CS objects so that the GPU can be
@@ -203,6 +218,8 @@ radeon_create_r300_winsys(int fd, struct radeon_winsys* old_winsys)
winsys->write_cs_reloc = radeon_r300_write_cs_reloc;
winsys->end_cs = radeon_r300_end_cs;
winsys->flush_cs = radeon_r300_flush_cs;
+ winsys->reset_bos = radeon_r300_reset_bos;
+ winsys->set_flush_cb = radeon_r300_set_flush_cb;
memcpy(winsys, old_winsys, sizeof(struct radeon_winsys));