mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-04 00:08:16 +02:00
radeon_cs: move to inline cs_write_dword
this gets back some of the CPU this was wasting
This commit is contained in:
parent
4c078cfbad
commit
e8f575d657
2 changed files with 31 additions and 38 deletions
|
|
@ -214,34 +214,32 @@ static void r300_vtbl_emit_state(radeonContextPtr rmesa)
|
|||
r300EmitState((r300ContextPtr)rmesa);
|
||||
}
|
||||
|
||||
extern int cs_write_dword(struct radeon_cs *cs, uint32_t dword);
|
||||
|
||||
static void r300_vtbl_emit_cs_header(struct radeon_cs *cs, radeonContextPtr rmesa)
|
||||
{
|
||||
/* please flush pipe do all pending work */
|
||||
cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
|
||||
radeon_cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
|
||||
R300_SC_SCREENDOOR, 1));
|
||||
cs_write_dword(cs, 0x0);
|
||||
cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
|
||||
radeon_cs_write_dword(cs, 0x0);
|
||||
radeon_cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
|
||||
R300_SC_SCREENDOOR, 1));
|
||||
cs_write_dword(cs, 0x00FFFFFF);
|
||||
cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
|
||||
radeon_cs_write_dword(cs, 0x00FFFFFF);
|
||||
radeon_cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
|
||||
R300_SC_HYPERZ, 1));
|
||||
cs_write_dword(cs, 0x0);
|
||||
cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
|
||||
radeon_cs_write_dword(cs, 0x0);
|
||||
radeon_cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
|
||||
R300_US_CONFIG, 1));
|
||||
cs_write_dword(cs, 0x0);
|
||||
cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
|
||||
radeon_cs_write_dword(cs, 0x0);
|
||||
radeon_cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
|
||||
R300_ZB_CNTL, 1));
|
||||
cs_write_dword(cs, 0x0);
|
||||
cs_write_dword(cs, cmdwait(rmesa->radeonScreen, R300_WAIT_3D));
|
||||
cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
|
||||
radeon_cs_write_dword(cs, 0x0);
|
||||
radeon_cs_write_dword(cs, cmdwait(rmesa->radeonScreen, R300_WAIT_3D));
|
||||
radeon_cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
|
||||
R300_RB3D_DSTCACHE_CTLSTAT, 1));
|
||||
cs_write_dword(cs, R300_RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D);
|
||||
cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
|
||||
radeon_cs_write_dword(cs, R300_RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D);
|
||||
radeon_cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
|
||||
R300_ZB_ZCACHE_CTLSTAT, 1));
|
||||
cs_write_dword(cs, R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE);
|
||||
cs_write_dword(cs, cmdwait(rmesa->radeonScreen,
|
||||
radeon_cs_write_dword(cs, R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE);
|
||||
radeon_cs_write_dword(cs, cmdwait(rmesa->radeonScreen,
|
||||
R300_WAIT_3D | R300_WAIT_3D_CLEAN));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,25 +75,6 @@ static struct radeon_cs *cs_create(struct radeon_cs_manager *csm,
|
|||
return cs;
|
||||
}
|
||||
|
||||
int cs_write_dword(struct radeon_cs *cs, uint32_t dword)
|
||||
{
|
||||
if (cs->cdw >= cs->ndw) {
|
||||
uint32_t tmp, *ptr;
|
||||
tmp = (cs->cdw + 1 + 0x3FF) & (~0x3FF);
|
||||
ptr = (uint32_t*)realloc(cs->packets, 4 * tmp);
|
||||
if (ptr == NULL) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
cs->packets = ptr;
|
||||
cs->ndw = tmp;
|
||||
}
|
||||
cs->packets[cs->cdw++] = dword;
|
||||
if (cs->section) {
|
||||
cs->section_cdw++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cs_write_reloc(struct radeon_cs *cs,
|
||||
struct radeon_bo *bo,
|
||||
uint32_t read_domain,
|
||||
|
|
@ -192,6 +173,21 @@ static int cs_begin(struct radeon_cs *cs,
|
|||
cs->section_file = file;
|
||||
cs->section_func = func;
|
||||
cs->section_line = line;
|
||||
|
||||
|
||||
if (cs->cdw + ndw > cs->ndw) {
|
||||
uint32_t tmp, *ptr;
|
||||
int num = (ndw > 0x3FF) ? ndw : 0x3FF;
|
||||
|
||||
tmp = (cs->cdw + 1 + num) & (~num);
|
||||
ptr = (uint32_t*)realloc(cs->packets, 4 * tmp);
|
||||
if (ptr == NULL) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
cs->packets = ptr;
|
||||
cs->ndw = tmp;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -477,7 +473,6 @@ static int cs_check_space(struct radeon_cs *cs, struct radeon_cs_space_check *bo
|
|||
|
||||
static struct radeon_cs_funcs radeon_cs_legacy_funcs = {
|
||||
cs_create,
|
||||
cs_write_dword,
|
||||
cs_write_reloc,
|
||||
cs_begin,
|
||||
cs_end,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue