summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/drm/radeon
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2009-12-12 23:44:02 +0100
committerCorbin Simpson <[email protected]>2009-12-15 19:04:45 -0800
commit417ce06306962a9355cbb35cefcdea1951b0ce85 (patch)
treef344d823391afa3353ae5a366f848b8552251da7 /src/gallium/winsys/drm/radeon
parentbc443d841c84977abd88d3be3d78287480fbe72d (diff)
r300g: flush CS if a buffer being deleted is referenced by it
Diffstat (limited to 'src/gallium/winsys/drm/radeon')
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_buffer.c6
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_buffer.h1
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_drm.c1
3 files changed, 8 insertions, 0 deletions
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
index 2a8daed051d..76acc99ad73 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
@@ -81,6 +81,7 @@ static struct pipe_buffer *radeon_buffer_create(struct pipe_winsys *ws,
domain |= RADEON_GEM_DOMAIN_GTT;
}
+ radeon_buffer->ws = radeon_ws;
radeon_buffer->bo = radeon_bo_open(radeon_ws->priv->bom, 0, size,
alignment, domain, 0);
if (radeon_buffer->bo == NULL) {
@@ -131,6 +132,11 @@ static void radeon_buffer_del(struct pipe_buffer *buffer)
{
struct radeon_pipe_buffer *radeon_buffer =
(struct radeon_pipe_buffer*)buffer;
+ struct radeon_winsys_priv *priv = radeon_buffer->ws->priv;
+
+ if (radeon_bo_is_referenced_by_cs(radeon_buffer->bo, priv->cs)) {
+ priv->cs->space_flush_fn(priv->cs->space_flush_data);
+ }
radeon_bo_unref(radeon_buffer->bo);
free(radeon_buffer);
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h b/src/gallium/winsys/drm/radeon/core/radeon_buffer.h
index bfe2221d1ed..1e91e18927a 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h
+++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.h
@@ -50,6 +50,7 @@
struct radeon_pipe_buffer {
struct pipe_buffer base;
struct radeon_bo *bo;
+ struct radeon_winsys *ws;
boolean flinked;
uint32_t flink;
};
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.c b/src/gallium/winsys/drm/radeon/core/radeon_drm.c
index dec7c065036..2f7fbc72423 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_drm.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.c
@@ -171,6 +171,7 @@ struct pipe_buffer* radeon_buffer_from_handle(struct drm_api* api,
radeon_buffer->base.screen = screen;
radeon_buffer->base.usage = PIPE_BUFFER_USAGE_PIXEL;
radeon_buffer->bo = bo;
+ radeon_buffer->ws = (struct radeon_winsys*)screen->winsys;
return &radeon_buffer->base;
}