mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-30 23:00:11 +01:00
r300g, radeong: fix the CS overflow
This commit is contained in:
parent
3da8265cd3
commit
7679447b58
3 changed files with 12 additions and 4 deletions
|
|
@ -55,7 +55,7 @@
|
|||
int cs_count = 0;
|
||||
|
||||
#define CHECK_CS(size) \
|
||||
cs_winsys->check_cs(cs_winsys, (size))
|
||||
assert(cs_winsys->check_cs(cs_winsys, (size)))
|
||||
|
||||
#define BEGIN_CS(size) do { \
|
||||
CHECK_CS(size); \
|
||||
|
|
|
|||
|
|
@ -871,10 +871,17 @@ void r300_emit_dirty_state(struct r300_context* r300)
|
|||
return;
|
||||
}
|
||||
|
||||
/* Check size of CS. */
|
||||
/* Make sure we have at least 8*1024 spare dwords. */
|
||||
/* XXX It would be nice to know the number of dwords we really need to
|
||||
* XXX emit. */
|
||||
if (!r300->winsys->check_cs(r300->winsys, 8*1024)) {
|
||||
r300->context.flush(&r300->context, 0, NULL);
|
||||
}
|
||||
|
||||
/* Clean out BOs. */
|
||||
r300->winsys->reset_bos(r300->winsys);
|
||||
|
||||
/* XXX check size */
|
||||
validate:
|
||||
/* Color buffers... */
|
||||
for (i = 0; i < r300->framebuffer_state.nr_cbufs; i++) {
|
||||
|
|
|
|||
|
|
@ -52,8 +52,9 @@ static boolean radeon_validate(struct radeon_winsys* winsys)
|
|||
|
||||
static boolean radeon_check_cs(struct radeon_winsys* winsys, int size)
|
||||
{
|
||||
/* XXX check size here, lazy ass! */
|
||||
return radeon_validate(winsys);
|
||||
struct radeon_cs* cs = winsys->priv->cs;
|
||||
|
||||
return radeon_validate(winsys) && cs->cdw + size <= cs->ndw;
|
||||
}
|
||||
|
||||
static void radeon_begin_cs(struct radeon_winsys* winsys,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue