r300g: add get_cs_info winsys entrypoint, abandon check_cs
This commit is contained in:
@@ -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;
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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); \
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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,
|
||||
|
@@ -183,12 +183,15 @@ static boolean radeon_validate(struct r300_winsys_screen *rws)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static boolean radeon_check_cs(struct r300_winsys_screen *rws, int size)
|
||||
static void radeon_get_cs_info(struct r300_winsys_screen *rws,
|
||||
struct r300_cs_info *info)
|
||||
{
|
||||
struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws);
|
||||
struct radeon_cs *cs = ws->cs;
|
||||
|
||||
return cs->cdw + size <= cs->ndw;
|
||||
info->capacity = cs->ndw;
|
||||
info->used = cs->cdw;
|
||||
info->free = cs->ndw - cs->cdw;
|
||||
}
|
||||
|
||||
static void radeon_begin_cs(struct r300_winsys_screen *rws,
|
||||
@@ -333,7 +336,7 @@ radeon_setup_winsys(int fd, struct radeon_libdrm_winsys* ws)
|
||||
ws->base.add_buffer = radeon_add_buffer;
|
||||
ws->base.validate = radeon_validate;
|
||||
ws->base.destroy = radeon_winsys_destroy;
|
||||
ws->base.check_cs = radeon_check_cs;
|
||||
ws->base.get_cs_info = radeon_get_cs_info;
|
||||
ws->base.begin_cs = radeon_begin_cs;
|
||||
ws->base.write_cs_dword = radeon_write_cs_dword;
|
||||
ws->base.write_cs_table = radeon_write_cs_table;
|
||||
|
Reference in New Issue
Block a user