summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nv50/nv50_program.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/nv50/nv50_program.c')
-rw-r--r--src/gallium/drivers/nv50/nv50_program.c70
1 files changed, 34 insertions, 36 deletions
diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c
index aada285f2c..5f7d06dbec 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -2215,7 +2215,7 @@ static void
nv50_program_upload_data(struct nv50_context *nv50, float *map,
unsigned start, unsigned count, unsigned cbuf)
{
- struct nouveau_channel *chan = nv50->screen->nvws->channel;
+ struct nouveau_channel *chan = nv50->screen->base.channel;
struct nouveau_grobj *tesla = nv50->screen->tesla;
while (count) {
@@ -2235,19 +2235,19 @@ nv50_program_upload_data(struct nv50_context *nv50, float *map,
static void
nv50_program_validate_data(struct nv50_context *nv50, struct nv50_program *p)
{
- struct nouveau_winsys *nvws = nv50->screen->nvws;
- struct pipe_winsys *ws = nv50->pipe.winsys;
+ struct pipe_screen *pscreen = nv50->pipe.screen;
if (!p->data[0] && p->immd_nr) {
struct nouveau_resource *heap = nv50->screen->immd_heap[0];
- if (nvws->res_alloc(heap, p->immd_nr, p, &p->data[0])) {
+ if (nouveau_resource_alloc(heap, p->immd_nr, p, &p->data[0])) {
while (heap->next && heap->size < p->immd_nr) {
struct nv50_program *evict = heap->next->priv;
- nvws->res_free(&evict->data[0]);
+ nouveau_resource_free(&evict->data[0]);
}
- if (nvws->res_alloc(heap, p->immd_nr, p, &p->data[0]))
+ if (nouveau_resource_alloc(heap, p->immd_nr, p,
+ &p->data[0]))
assert(0);
}
@@ -2260,43 +2260,44 @@ nv50_program_validate_data(struct nv50_context *nv50, struct nv50_program *p)
struct nouveau_resource *heap =
nv50->screen->parm_heap[p->type];
- if (nvws->res_alloc(heap, p->param_nr, p, &p->data[1])) {
+ if (nouveau_resource_alloc(heap, p->param_nr, p, &p->data[1])) {
while (heap->next && heap->size < p->param_nr) {
struct nv50_program *evict = heap->next->priv;
- nvws->res_free(&evict->data[1]);
+ nouveau_resource_free(&evict->data[1]);
}
- if (nvws->res_alloc(heap, p->param_nr, p, &p->data[1]))
+ if (nouveau_resource_alloc(heap, p->param_nr, p,
+ &p->data[1]))
assert(0);
}
}
if (p->param_nr) {
unsigned cbuf = NV50_CB_PVP;
- float *map = ws->buffer_map(ws, nv50->constbuf[p->type],
- PIPE_BUFFER_USAGE_CPU_READ);
+ float *map = pipe_buffer_map(pscreen, nv50->constbuf[p->type],
+ PIPE_BUFFER_USAGE_CPU_READ);
if (p->type == PIPE_SHADER_FRAGMENT)
cbuf = NV50_CB_PFP;
nv50_program_upload_data(nv50, map, p->data[1]->start,
p->param_nr, cbuf);
- ws->buffer_unmap(ws, nv50->constbuf[p->type]);
+ pipe_buffer_unmap(pscreen, nv50->constbuf[p->type]);
}
}
static void
nv50_program_validate_code(struct nv50_context *nv50, struct nv50_program *p)
{
- struct nouveau_channel *chan = nv50->screen->nvws->channel;
+ struct nouveau_channel *chan = nv50->screen->base.channel;
struct nouveau_grobj *tesla = nv50->screen->tesla;
- struct pipe_screen *screen = nv50->pipe.screen;
struct nv50_program_exec *e;
struct nouveau_stateobj *so;
const unsigned flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_WR;
unsigned start, count, *up, *ptr;
boolean upload = FALSE;
- if (!p->buffer) {
- p->buffer = screen->buffer_create(screen, 0x100, 0, p->exec_size * 4);
+ if (!p->bo) {
+ nouveau_bo_new(chan->device, NOUVEAU_BO_VRAM, 0x100,
+ p->exec_size * 4, &p->bo);
upload = TRUE;
}
@@ -2345,20 +2346,20 @@ nv50_program_validate_code(struct nv50_context *nv50, struct nv50_program *p)
so = so_new(4,2);
so_method(so, nv50->screen->tesla, 0x1280, 3);
- so_reloc (so, p->buffer, 0, flags | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, p->buffer, 0, flags | NOUVEAU_BO_LOW, 0, 0);
+ so_reloc (so, p->bo, 0, flags | NOUVEAU_BO_HIGH, 0, 0);
+ so_reloc (so, p->bo, 0, flags | NOUVEAU_BO_LOW, 0, 0);
so_data (so, (NV50_CB_PUPLOAD << 16) | 0x0800); //(p->exec_size * 4));
start = 0; count = p->exec_size;
while (count) {
- struct nouveau_winsys *nvws = nv50->screen->nvws;
+ struct nouveau_channel *chan = nv50->screen->base.channel;
unsigned nr;
- so_emit(nvws, so);
+ so_emit(chan, so);
nr = MIN2(count, 2047);
- nr = MIN2(nvws->channel->pushbuf->remaining, nr);
- if (nvws->channel->pushbuf->remaining < (nr + 3)) {
+ nr = MIN2(chan->pushbuf->remaining, nr);
+ if (chan->pushbuf->remaining < (nr + 3)) {
FIRE_RING(chan);
continue;
}
@@ -2394,10 +2395,10 @@ nv50_vertprog_validate(struct nv50_context *nv50)
so = so_new(13, 2);
so_method(so, tesla, NV50TCL_VP_ADDRESS_HIGH, 2);
- so_reloc (so, p->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD |
- NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, p->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD |
- NOUVEAU_BO_LOW, 0, 0);
+ so_reloc (so, p->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD |
+ NOUVEAU_BO_HIGH, 0, 0);
+ so_reloc (so, p->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD |
+ NOUVEAU_BO_LOW, 0, 0);
so_method(so, tesla, 0x1650, 2);
so_data (so, p->cfg.vp.attr[0]);
so_data (so, p->cfg.vp.attr[1]);
@@ -2431,10 +2432,10 @@ nv50_fragprog_validate(struct nv50_context *nv50)
so = so_new(64, 2);
so_method(so, tesla, NV50TCL_FP_ADDRESS_HIGH, 2);
- so_reloc (so, p->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD |
- NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, p->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD |
- NOUVEAU_BO_LOW, 0, 0);
+ so_reloc (so, p->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD |
+ NOUVEAU_BO_HIGH, 0, 0);
+ so_reloc (so, p->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD |
+ NOUVEAU_BO_LOW, 0, 0);
so_method(so, tesla, 0x1904, 4);
so_data (so, p->cfg.fp.regs[0]); /* 0x01000404 / 0x00040404 */
so_data (so, 0x00000004);
@@ -2461,8 +2462,6 @@ nv50_fragprog_validate(struct nv50_context *nv50)
void
nv50_program_destroy(struct nv50_context *nv50, struct nv50_program *p)
{
- struct pipe_screen *pscreen = nv50->pipe.screen;
-
while (p->exec_head) {
struct nv50_program_exec *e = p->exec_head;
@@ -2472,11 +2471,10 @@ nv50_program_destroy(struct nv50_context *nv50, struct nv50_program *p)
p->exec_tail = NULL;
p->exec_size = 0;
- if (p->buffer)
- pipe_buffer_reference(&p->buffer, NULL);
+ nouveau_bo_ref(NULL, &p->bo);
- nv50->screen->nvws->res_free(&p->data[0]);
- nv50->screen->nvws->res_free(&p->data[1]);
+ nouveau_resource_free(&p->data[0]);
+ nouveau_resource_free(&p->data[1]);
p->translated = 0;
}