nv50: add relocs for stack and local mem buffers

This commit is contained in:
Christoph Bumiller 2010-09-18 13:40:10 +02:00
parent ca92ae2699
commit 275a81af13
5 changed files with 31 additions and 3 deletions

View file

@ -157,6 +157,7 @@ struct nv50_context {
unsigned sampler_view_nr[3];
unsigned vbo_fifo;
unsigned req_lmem;
};
static INLINE struct nv50_context *

View file

@ -547,6 +547,8 @@ nv50_generate_code(struct nv50_translation_info *ti)
ti->p->fixups = pc->fixups;
ti->p->num_fixups = pc->num_fixups;
ti->p->uses_lmem = ti->store_to_memory;
NV50_DBGMSG("SHADER TRANSLATION - %s\n", ret ? "failure" : "success");
out:

View file

@ -45,6 +45,7 @@ struct nv50_program {
ubyte type;
boolean translated;
boolean uses_lmem;
struct nouveau_bo *bo;
struct nouveau_stateobj *so;

View file

@ -265,6 +265,19 @@ nv50_screen_relocs(struct nv50_screen *screen)
OUT_RELOC (chan, screen->constbuf_parm[i],
((NV50_CB_PVP + i) << 16) | 0x0000, rl, 0, 0);
}
BGN_RELOC (chan, screen->stack_bo,
tesla, NV50TCL_STACK_ADDRESS_HIGH, 2, rl);
OUT_RELOCh(chan, screen->stack_bo, 0, rl);
OUT_RELOCl(chan, screen->stack_bo, 0, rl);
if (!screen->cur_ctx->req_lmem)
return;
BGN_RELOC (chan, screen->local_bo,
tesla, NV50TCL_LOCAL_ADDRESS_HIGH, 2, rl);
OUT_RELOCh(chan, screen->local_bo, 0, rl);
OUT_RELOCl(chan, screen->local_bo, 0, rl);
}
#ifndef NOUVEAU_GETPARAM_GRAPH_UNITS

View file

@ -281,6 +281,17 @@ nv50_program_validate(struct nv50_program *p)
return p->translated;
}
static INLINE void
nv50_program_validate_common(struct nv50_context *nv50, struct nv50_program *p)
{
nv50_program_validate_code(nv50, p);
if (p->uses_lmem)
nv50->req_lmem |= 1 << p->type;
else
nv50->req_lmem &= ~(1 << p->type);
}
struct nouveau_stateobj *
nv50_vertprog_validate(struct nv50_context *nv50)
{
@ -300,7 +311,7 @@ nv50_vertprog_validate(struct nv50_context *nv50)
if (!(nv50->dirty & NV50_NEW_VERTPROG))
return NULL;
nv50_program_validate_code(nv50, p);
nv50_program_validate_common(nv50, p);
so_ref(p->so, &so);
return so;
@ -325,7 +336,7 @@ nv50_fragprog_validate(struct nv50_context *nv50)
if (!(nv50->dirty & NV50_NEW_FRAGPROG))
return NULL;
nv50_program_validate_code(nv50, p);
nv50_program_validate_common(nv50, p);
so_ref(p->so, &so);
return so;
@ -350,7 +361,7 @@ nv50_geomprog_validate(struct nv50_context *nv50)
if (!(nv50->dirty & NV50_NEW_GEOMPROG))
return NULL;
nv50_program_validate_code(nv50, p);
nv50_program_validate_common(nv50, p);
so_ref(p->so, &so);
return so;