mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 02:38:04 +02:00
nv50: increase size of shader code bo
512 KiB should be quite enough, but dynamic resize might be nicer.
This commit is contained in:
parent
6b4e3e8941
commit
7048ad62f8
4 changed files with 23 additions and 14 deletions
|
|
@ -762,7 +762,8 @@ emit_flow(struct nv_pc *pc, struct nv_instruction *i, ubyte flow_op)
|
|||
new_fixup(pc, NV50_FIXUP_CODE_RELOC, 0, pos, 0xffff << 11, 9);
|
||||
new_fixup(pc, NV50_FIXUP_CODE_RELOC, 1, pos, 0x3f << 14, -4);
|
||||
|
||||
pc->emit[0] |= (pos / 4) << 11;
|
||||
pc->emit[0] |= ((pos >> 2) & 0xffff) << 11;
|
||||
pc->emit[1] |= ((pos >> 18) & 0x003f) << 14;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
|
|||
uint32_t tesla_class;
|
||||
unsigned stack_size, max_warps, tls_space;
|
||||
int ret;
|
||||
unsigned i;
|
||||
unsigned i, base;
|
||||
|
||||
screen = CALLOC_STRUCT(nv50_screen);
|
||||
if (!screen)
|
||||
|
|
@ -425,25 +425,28 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
|
|||
BEGIN_RING(chan, RING_3D(ZCULL_REGION), 1); /* deactivate ZCULL */
|
||||
OUT_RING (chan, 0x3f);
|
||||
|
||||
ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 1 << 16, 3 << 16, &screen->code);
|
||||
ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 1 << 16,
|
||||
3 << NV50_CODE_BO_SIZE_LOG2, &screen->code);
|
||||
if (ret)
|
||||
goto fail;
|
||||
|
||||
nouveau_resource_init(&screen->vp_code_heap, 0, 1 << 16);
|
||||
nouveau_resource_init(&screen->gp_code_heap, 0, 1 << 16);
|
||||
nouveau_resource_init(&screen->fp_code_heap, 0, 1 << 16);
|
||||
nouveau_resource_init(&screen->vp_code_heap, 0, 1 << NV50_CODE_BO_SIZE_LOG2);
|
||||
nouveau_resource_init(&screen->gp_code_heap, 0, 1 << NV50_CODE_BO_SIZE_LOG2);
|
||||
nouveau_resource_init(&screen->fp_code_heap, 0, 1 << NV50_CODE_BO_SIZE_LOG2);
|
||||
|
||||
base = 1 << NV50_CODE_BO_SIZE_LOG2;
|
||||
|
||||
BEGIN_RING(chan, RING_3D(VP_ADDRESS_HIGH), 2);
|
||||
OUT_RELOCh(chan, screen->code, 0 << 16, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
|
||||
OUT_RELOCl(chan, screen->code, 0 << 16, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
|
||||
OUT_RELOCh(chan, screen->code, base * 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
|
||||
OUT_RELOCl(chan, screen->code, base * 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
|
||||
|
||||
BEGIN_RING(chan, RING_3D(FP_ADDRESS_HIGH), 2);
|
||||
OUT_RELOCh(chan, screen->code, 1 << 16, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
|
||||
OUT_RELOCl(chan, screen->code, 1 << 16, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
|
||||
OUT_RELOCh(chan, screen->code, base * 1, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
|
||||
OUT_RELOCl(chan, screen->code, base * 1, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
|
||||
|
||||
BEGIN_RING(chan, RING_3D(GP_ADDRESS_HIGH), 2);
|
||||
OUT_RELOCh(chan, screen->code, 2 << 16, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
|
||||
OUT_RELOCl(chan, screen->code, 2 << 16, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
|
||||
OUT_RELOCh(chan, screen->code, base * 2, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
|
||||
OUT_RELOCl(chan, screen->code, base * 2, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
|
||||
|
||||
nouveau_device_get_param(dev, NOUVEAU_GETPARAM_GRAPH_UNITS, &value);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
struct nv50_context;
|
||||
|
||||
#define NV50_CODE_BO_SIZE_LOG2 19
|
||||
|
||||
#define NV50_SCRATCH_SIZE (2 << 20)
|
||||
#define NV50_SCRATCH_NR_BUFFERS 2
|
||||
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@ nv50_program_validate(struct nv50_context *nv50, struct nv50_program *prog)
|
|||
return FALSE;
|
||||
|
||||
if (prog->type == PIPE_SHADER_FRAGMENT) heap = nv50->screen->fp_code_heap;
|
||||
else
|
||||
if (prog->type == PIPE_SHADER_GEOMETRY) heap = nv50->screen->gp_code_heap;
|
||||
else
|
||||
heap = nv50->screen->vp_code_heap;
|
||||
|
|
@ -145,14 +146,16 @@ nv50_program_validate(struct nv50_context *nv50, struct nv50_program *prog)
|
|||
size = align(prog->code_size, 0x100);
|
||||
|
||||
ret = nouveau_resource_alloc(heap, size, prog, &prog->res);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
NOUVEAU_ERR("out of code space for shader type %i\n", prog->type);
|
||||
return FALSE;
|
||||
}
|
||||
prog->code_base = prog->res->start;
|
||||
|
||||
nv50_relocate_program(prog, prog->code_base, 0);
|
||||
|
||||
nv50_sifc_linear_u8(&nv50->base, nv50->screen->code,
|
||||
(prog->type << 16) + prog->code_base,
|
||||
(prog->type << NV50_CODE_BO_SIZE_LOG2) + prog->code_base,
|
||||
NOUVEAU_BO_VRAM, prog->code_size, prog->code);
|
||||
|
||||
BEGIN_RING(nv50->screen->base.channel, RING_3D(CODE_CB_FLUSH), 1);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue