summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nvc0
diff options
context:
space:
mode:
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>2012-12-07 22:43:10 +0100
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>2012-12-07 22:48:54 +0100
commitcfa752cd332ff1cfac403001f3833476ba6d978d (patch)
tree6f084a5e8889168328d4feab19c2536ea494c7e3 /src/gallium/drivers/nvc0
parentf7599b2c32185535b4c215de0ba0454129fa523f (diff)
nv50,nvc0: fix shader eviction
Diffstat (limited to 'src/gallium/drivers/nvc0')
-rw-r--r--src/gallium/drivers/nvc0/nvc0_program.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/gallium/drivers/nvc0/nvc0_program.c b/src/gallium/drivers/nvc0/nvc0_program.c
index 9655e18de52..8bcb2066f17 100644
--- a/src/gallium/drivers/nvc0/nvc0_program.c
+++ b/src/gallium/drivers/nvc0/nvc0_program.c
@@ -670,8 +670,20 @@ nvc0_program_upload_code(struct nvc0_context *nvc0, struct nvc0_program *prog)
ret = nouveau_heap_alloc(screen->text_heap, size, prog, &prog->mem);
if (ret) {
- NOUVEAU_ERR("out of code space\n");
- return FALSE;
+ struct nouveau_heap *heap = screen->text_heap;
+ struct nouveau_heap *iter;
+ for (iter = heap; iter && iter->next != heap; iter = iter->next) {
+ struct nvc0_program *evict = iter->priv;
+ if (evict)
+ nouveau_heap_free(&evict->mem);
+ }
+ debug_printf("WARNING: out of code space, evicting all shaders.\n");
+ ret = nouveau_heap_alloc(heap, size, prog, &prog->mem);
+ if (ret) {
+ NOUVEAU_ERR("shader too large (0x%x) to fit in code space ?\n", size);
+ return FALSE;
+ }
+ IMMED_NVC0(nvc0->base.pushbuf, NVC0_3D(SERIALIZE), 0);
}
prog->code_base = prog->mem->start;
prog->immd_base = align(prog->mem->start + prog->immd_base, 0x100);