nv50: add relocs for stack and local mem buffers
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sat, 18 Sep 2010 11:40:10 +0000 (13:40 +0200)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sat, 18 Sep 2010 13:21:59 +0000 (15:21 +0200)
src/gallium/drivers/nv50/nv50_context.h
src/gallium/drivers/nv50/nv50_pc.c
src/gallium/drivers/nv50/nv50_program.h
src/gallium/drivers/nv50/nv50_screen.c
src/gallium/drivers/nv50/nv50_shader_state.c

index 6ec9095..ac69c78 100644 (file)
@@ -157,6 +157,7 @@ struct nv50_context {
        unsigned sampler_view_nr[3];
 
        unsigned vbo_fifo;
+       unsigned req_lmem;
 };
 
 static INLINE struct nv50_context *
index 6765405..42127a1 100644 (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:
index 37b02bb..33c4c8c 100644 (file)
@@ -45,6 +45,7 @@ struct nv50_program {
 
    ubyte type;
    boolean translated;
+   boolean uses_lmem;
 
    struct nouveau_bo *bo;
    struct nouveau_stateobj *so;
index 49af9b5..a8f7721 100644 (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
index 8c1a599..8057ec9 100644 (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;