summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/r300/r300_context.c8
-rw-r--r--src/gallium/drivers/r300/r300_context.h1
-rw-r--r--src/gallium/drivers/r300/r300_cs.h2
-rw-r--r--src/gallium/drivers/r300/r300_render.c2
-rw-r--r--src/gallium/drivers/r300/r300_winsys.h12
5 files changed, 21 insertions, 4 deletions
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 85e45d8647d..88ce1867982 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -236,6 +236,14 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
return NULL;
}
+boolean r300_check_cs(struct r300_context *r300, unsigned size)
+{
+ struct r300_cs_info cs_info;
+
+ r300->rws->get_cs_info(r300->rws, &cs_info);
+ return size <= cs_info.free;
+}
+
void r300_finish(struct r300_context *r300)
{
struct pipe_framebuffer_state *fb;
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index efc6df3fabf..97b69e76527 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -490,6 +490,7 @@ void r300_init_render_functions(struct r300_context *r300);
void r300_init_state_functions(struct r300_context* r300);
void r300_init_resource_functions(struct r300_context* r300);
+boolean r300_check_cs(struct r300_context *r300, unsigned size);
void r300_finish(struct r300_context *r300);
void r500_dump_rs_block(struct r300_rs_block *rs);
diff --git a/src/gallium/drivers/r300/r300_cs.h b/src/gallium/drivers/r300/r300_cs.h
index 996a4f491e7..6739f6703ac 100644
--- a/src/gallium/drivers/r300/r300_cs.h
+++ b/src/gallium/drivers/r300/r300_cs.h
@@ -54,7 +54,7 @@
int cs_count = 0; (void) cs_count;
#define CHECK_CS(size) \
- assert(cs_winsys->check_cs(cs_winsys, (size)))
+ assert(r300_check_cs(cs_context_copy, (size)))
#define BEGIN_CS(size) do { \
CHECK_CS(size); \
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index 42716552c7f..3f66f75943e 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -173,7 +173,7 @@ static void r300_prepare_for_rendering(struct r300_context *r300,
cs_dwords += 26; /* emit_query_end */
/* Reserve requested CS space. */
- if (!r300->rws->check_cs(r300->rws, cs_dwords)) {
+ if (!r300_check_cs(r300, cs_dwords)) {
r300->context.flush(&r300->context, 0, NULL);
flushed = TRUE;
}
diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h
index 3d0413f90af..f7cbbde410a 100644
--- a/src/gallium/drivers/r300/r300_winsys.h
+++ b/src/gallium/drivers/r300/r300_winsys.h
@@ -47,6 +47,13 @@ enum r300_reference_domain { /* bitfield */
R300_REF_HW = 2
};
+struct r300_cs_info {
+ /* In DWORDs. */
+ unsigned used;
+ unsigned free;
+ unsigned capacity;
+};
+
struct r300_winsys_screen {
void (*destroy)(struct r300_winsys_screen *ws);
@@ -101,8 +108,9 @@ struct r300_winsys_screen {
* Returns TRUE if a flush is required. */
boolean (*validate)(struct r300_winsys_screen* winsys);
- /* Check to see if there's room for commands. */
- boolean (*check_cs)(struct r300_winsys_screen* winsys, int size);
+ /* Return current CS info. */
+ void (*get_cs_info)(struct r300_winsys_screen *winsys,
+ struct r300_cs_info *info);
/* Start a command emit. */
void (*begin_cs)(struct r300_winsys_screen* winsys,