nouveau: pass nvws to nvws->push_* functions, rather than nouveau_channel*

This commit is contained in:
Ben Skeggs
2008-03-19 00:06:15 +11:00
parent 75e714d476
commit 9575e35807
7 changed files with 23 additions and 83 deletions
+3 -4
View File
@@ -27,7 +27,7 @@
#define BEGIN_RING(obj,mthd,size) do { \
NOUVEAU_PUSH_CONTEXT(pc); \
if (pc->nvws->channel->pushbuf->remaining < ((size) + 1)) \
pc->nvws->push_flush(pc->nvws->channel, ((size) + 1)); \
pc->nvws->push_flush(pc->nvws, ((size) + 1)); \
OUT_RING((pc->obj->subc << 13) | ((size) << 18) | (mthd)); \
pc->nvws->channel->pushbuf->remaining -= ((size) + 1); \
} while(0)
@@ -38,13 +38,12 @@
#define FIRE_RING() do { \
NOUVEAU_PUSH_CONTEXT(pc); \
pc->nvws->push_flush(pc->nvws->channel, 0); \
pc->nvws->push_flush(pc->nvws, 0); \
} while(0)
#define OUT_RELOC(bo,data,flags,vor,tor) do { \
NOUVEAU_PUSH_CONTEXT(pc); \
pc->nvws->push_reloc(pc->nvws->channel, \
pc->nvws->channel->pushbuf->cur++, \
pc->nvws->push_reloc(pc->nvws, pc->nvws->channel->pushbuf->cur++, \
(bo), (data), (flags), (vor), (tor)); \
} while(0)
@@ -99,14 +99,14 @@ so_emit(struct nouveau_winsys *nvws, struct nouveau_stateobj *so)
nr = so->cur - so->push;
if (pb->remaining < nr)
nvws->push_flush(nvws->channel, nr);
nvws->push_flush(nvws, nr);
pb->remaining -= nr;
memcpy(pb->cur, so->push, nr * 4);
for (i = 0; i < so->cur_reloc; i++) {
struct nouveau_stateobj_reloc *r = &so->reloc[i];
nvws->push_reloc(nvws->channel, pb->cur + r->offset, r->bo,
nvws->push_reloc(nvws, pb->cur + r->offset, r->bo,
r->data, r->flags, r->vor, r->tor);
}
pb->cur += nr;
@@ -120,17 +120,17 @@ so_emit_reloc_markers(struct nouveau_winsys *nvws, struct nouveau_stateobj *so)
i = so->cur_reloc << 1;
if (nvws->channel->pushbuf->remaining < i)
nvws->push_flush(nvws->channel, i);
nvws->push_flush(nvws, i);
nvws->channel->pushbuf->remaining -= i;
for (i = 0; i < so->cur_reloc; i++) {
struct nouveau_stateobj_reloc *r = &so->reloc[i];
nvws->push_reloc(nvws->channel, pb->cur++, r->bo, r->packet,
nvws->push_reloc(nvws, pb->cur++, r->bo, r->packet,
(r->flags &
(NOUVEAU_BO_VRAM | NOUVEAU_BO_GART)) |
NOUVEAU_BO_DUMMY, 0, 0);
nvws->push_reloc(nvws->channel, pb->cur++, r->bo, r->data,
nvws->push_reloc(nvws, pb->cur++, r->bo, r->data,
r->flags | NOUVEAU_BO_DUMMY, r->vor, r->tor);
}
}
+2 -2
View File
@@ -24,10 +24,10 @@ struct nouveau_winsys {
struct nouveau_resource **);
void (*res_free)(struct nouveau_resource **);
int (*push_reloc)(struct nouveau_channel *, void *ptr,
int (*push_reloc)(struct nouveau_winsys *, void *ptr,
struct pipe_buffer *, uint32_t data,
uint32_t flags, uint32_t vor, uint32_t tor);
int (*push_flush)(struct nouveau_channel *, unsigned size);
int (*push_flush)(struct nouveau_winsys *, unsigned size);
int (*grobj_alloc)(struct nouveau_winsys *, int grclass,
struct nouveau_grobj **);
-66
View File
@@ -1,66 +0,0 @@
#ifndef __NV40_DMA_H__
#define __NV40_DMA_H__
#include "pipe/nouveau/nouveau_winsys.h"
#define OUT_RING(data) do { \
(*nv40->nvws->channel->pushbuf->cur++) = (data); \
} while(0)
#define OUT_RINGp(src,size) do { \
memcpy(nv40->nvws->channel->pushbuf->cur, (src), (size) * 4); \
nv40->nvws->channel->pushbuf->cur += (size); \
} while(0)
#define OUT_RINGf(data) do { \
union { float v; uint32_t u; } c; \
c.v = (data); \
OUT_RING(c.u); \
} while(0)
#define BEGIN_RING(obj,mthd,size) do { \
if (nv40->nvws->channel->pushbuf->remaining < ((size) + 1)) \
nv40->nvws->push_flush(nv40->nvws->channel, ((size) + 1)); \
OUT_RING((nv40->obj->subc << 13) | ((size) << 18) | (mthd)); \
nv40->nvws->channel->pushbuf->remaining -= ((size) + 1); \
} while(0)
#define BEGIN_RING_NI(obj,mthd,size) do { \
BEGIN_RING(obj, (mthd) | 0x40000000, (size)); \
} while(0)
#define FIRE_RING() do { \
nv40->nvws->push_flush(nv40->nvws->channel, 0); \
} while(0)
#define OUT_RELOC(bo,data,flags,vor,tor) do { \
nv40->nvws->push_reloc(nv40->nvws->channel, \
nv40->nvws->channel->pushbuf->cur, \
(struct nouveau_bo *)(bo), \
(data), (flags), (vor), (tor)); \
OUT_RING(0); \
} while(0)
/* Raw data + flags depending on FB/TT buffer */
#define OUT_RELOCd(bo,data,flags,vor,tor) do { \
OUT_RELOC((bo), (data), (flags) | NOUVEAU_BO_OR, (vor), (tor)); \
} while(0)
/* FB/TT object handle */
#define OUT_RELOCo(bo,flags) do { \
OUT_RELOC((bo), 0, (flags) | NOUVEAU_BO_OR, \
nv40->nvws->channel->vram->handle, \
nv40->nvws->channel->gart->handle); \
} while(0)
/* Low 32-bits of offset */
#define OUT_RELOCl(bo,delta,flags) do { \
OUT_RELOC((bo), (delta), (flags) | NOUVEAU_BO_LOW, 0, 0); \
} while(0)
/* High 32-bits of offset */
#define OUT_RELOCh(bo,delta,flags) do { \
OUT_RELOC((bo), (delta), (flags) | NOUVEAU_BO_HIGH, 0, 0); \
} while(0)
#endif
+1 -1
View File
@@ -260,7 +260,7 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws,
so_emit(nvws, so);
so_ref(NULL, &so);
nvws->push_flush(nvws->channel, 0);
nvws->push_flush(nvws, 0);
screen->pipe.winsys = ws;
screen->pipe.destroy = nv40_screen_destroy;
+1 -1
View File
@@ -171,7 +171,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws,
so_emit(nvws, so);
so_ref(NULL, &so);
nvws->push_flush(nvws->channel, 0);
nvws->push_flush(nvws, 0);
screen->pipe.winsys = ws;
@@ -59,14 +59,21 @@ nouveau_pipe_surface_fill(struct nouveau_winsys *nvws, struct pipe_surface *dst,
}
static int
nouveau_pipe_emit_reloc(struct nouveau_channel *chan, void *ptr,
nouveau_pipe_push_reloc(struct nouveau_winsys *nvws, void *ptr,
struct pipe_buffer *buf, uint32_t data,
uint32_t flags, uint32_t vor, uint32_t tor)
{
return nouveau_pushbuf_emit_reloc(chan, ptr, nouveau_buffer(buf)->bo,
return nouveau_pushbuf_emit_reloc(nvws->channel, ptr,
nouveau_buffer(buf)->bo,
data, flags, vor, tor);
}
static int
nouveau_pipe_push_flush(struct nouveau_winsys *nvws, unsigned size)
{
return nouveau_pushbuf_flush(nvws->channel, size);
}
struct pipe_context *
nouveau_pipe_create(struct nouveau_context *nv)
{
@@ -114,8 +121,8 @@ nouveau_pipe_create(struct nouveau_context *nv)
nvws->res_alloc = nouveau_resource_alloc;
nvws->res_free = nouveau_resource_free;
nvws->push_reloc = nouveau_pipe_emit_reloc;
nvws->push_flush = nouveau_pushbuf_flush;
nvws->push_reloc = nouveau_pipe_push_reloc;
nvws->push_flush = nouveau_pipe_push_flush;
nvws->grobj_alloc = nouveau_pipe_grobj_alloc;
nvws->grobj_free = nouveau_grobj_free;