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 <airlied@redhat.com>
This commit is contained in:
Dave Airlie 2009-10-14 15:13:25 +10:00
parent 23c0c820e2
commit 210481ae16
4 changed files with 38 additions and 3 deletions

View file

@ -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++;

View file

@ -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... */

View file

@ -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,

View file

@ -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));