summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nv30
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2009-06-05 08:47:42 +1000
committerBen Skeggs <bskeggs@redhat.com>2009-06-05 14:37:03 +1000
commit1b207d9bb81ae3385e5658a81c71fbf2fe15c18f (patch)
tree12ffe51167ca2d0e5ee41ac09230f14a3610f82b /src/gallium/drivers/nv30
parentd4d584b16e21b24a473d3a31d361432b8fa0b945 (diff)
nouveau: call notifier/grobj etc funcs directly
libdrm_nouveau is linked with the winsys, there's no good reason to do all this through yet another layer.
Diffstat (limited to 'src/gallium/drivers/nv30')
-rw-r--r--src/gallium/drivers/nv30/nv30_query.c25
-rw-r--r--src/gallium/drivers/nv30/nv30_screen.c64
-rw-r--r--src/gallium/drivers/nv30/nv30_vertprog.c20
3 files changed, 57 insertions, 52 deletions
diff --git a/src/gallium/drivers/nv30/nv30_query.c b/src/gallium/drivers/nv30/nv30_query.c
index 2f974cf5c4..1d1c8a484e 100644
--- a/src/gallium/drivers/nv30/nv30_query.c
+++ b/src/gallium/drivers/nv30/nv30_query.c
@@ -29,11 +29,10 @@ nv30_query_create(struct pipe_context *pipe, unsigned query_type)
static void
nv30_query_destroy(struct pipe_context *pipe, struct pipe_query *pq)
{
- struct nv30_context *nv30 = nv30_context(pipe);
struct nv30_query *q = nv30_query(pq);
if (q->object)
- nv30->nvws->res_free(&q->object);
+ nouveau_resource_free(&q->object);
FREE(q);
}
@@ -54,9 +53,9 @@ nv30_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
pipe->get_query_result(pipe, pq, 1, &tmp);
}
- if (nv30->nvws->res_alloc(nv30->screen->query_heap, 1, NULL, &q->object))
+ if (nouveau_resource_alloc(nv30->screen->query_heap, 1, NULL, &q->object))
assert(0);
- nv30->nvws->notifier_reset(nv30->screen->query, q->object->start);
+ nouveau_notifier_reset(nv30->screen->query, q->object->start);
BEGIN_RING(rankine, NV34TCL_QUERY_RESET, 1);
OUT_RING (1);
@@ -84,27 +83,27 @@ nv30_query_result(struct pipe_context *pipe, struct pipe_query *pq,
{
struct nv30_context *nv30 = nv30_context(pipe);
struct nv30_query *q = nv30_query(pq);
- struct nouveau_winsys *nvws = nv30->nvws;
assert(q->object && q->type == PIPE_QUERY_OCCLUSION_COUNTER);
if (!q->ready) {
unsigned status;
- status = nvws->notifier_status(nv30->screen->query,
- q->object->start);
+ status = nouveau_notifier_status(nv30->screen->query,
+ q->object->start);
if (status != NV_NOTIFY_STATE_STATUS_COMPLETED) {
if (wait == FALSE)
return FALSE;
- nvws->notifier_wait(nv30->screen->query, q->object->start,
- NV_NOTIFY_STATE_STATUS_COMPLETED,
- 0);
+
+ nouveau_notifier_wait_status(nv30->screen->query,
+ q->object->start,
+ NV_NOTIFY_STATE_STATUS_COMPLETED, 0);
}
- q->result = nvws->notifier_retval(nv30->screen->query,
- q->object->start);
+ q->result = nouveau_notifier_return_val(nv30->screen->query,
+ q->object->start);
q->ready = TRUE;
- nvws->res_free(&q->object);
+ nouveau_resource_free(&q->object);
}
*result = q->result;
diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c
index f516038b9c..60e2f0855d 100644
--- a/src/gallium/drivers/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nv30/nv30_screen.c
@@ -124,14 +124,13 @@ static void
nv30_screen_destroy(struct pipe_screen *pscreen)
{
struct nv30_screen *screen = nv30_screen(pscreen);
- struct nouveau_winsys *nvws = screen->nvws;
- nvws->res_free(&screen->vp_exec_heap);
- nvws->res_free(&screen->vp_data_heap);
- nvws->res_free(&screen->query_heap);
- nvws->notifier_free(&screen->query);
- nvws->notifier_free(&screen->sync);
- nvws->grobj_free(&screen->rankine);
+ nouveau_resource_free(&screen->vp_exec_heap);
+ nouveau_resource_free(&screen->vp_data_heap);
+ nouveau_resource_free(&screen->query_heap);
+ nouveau_notifier_free(&screen->query);
+ nouveau_notifier_free(&screen->sync);
+ nouveau_grobj_free(&screen->rankine);
FREE(pscreen);
}
@@ -141,6 +140,7 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
{
struct nv30_screen *screen = CALLOC_STRUCT(nv30_screen);
struct nouveau_device *dev = nvws->channel->device;
+ struct nouveau_channel *chan;
struct pipe_screen *pscreen;
struct nouveau_stateobj *so;
unsigned rankine_class = 0;
@@ -150,6 +150,13 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
return NULL;
pscreen = &screen->base.base;
+ ret = nouveau_screen_init(&screen->base, dev);
+ if (ret) {
+ nv30_screen_destroy(pscreen);
+ return NULL;
+ }
+ screen->base.channel = chan = nvws->channel;
+
screen->nvws = nvws;
pscreen->winsys = ws;
@@ -160,11 +167,6 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
nv30_screen_init_miptree_functions(pscreen);
nv30_screen_init_transfer_functions(pscreen);
- nouveau_screen_init(&screen->base, dev);
-
- /* 2D engine setup */
- screen->eng2d = nv04_surface_2d_init(nvws);
- screen->eng2d->buf = nv30_surface_buffer;
/* 3D object */
switch (dev->chipset & 0xf0) {
@@ -187,14 +189,20 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
return NULL;
}
- ret = nvws->grobj_alloc(nvws, rankine_class, &screen->rankine);
+ ret = nouveau_grobj_alloc(chan, 0xbeef3097, rankine_class,
+ &screen->rankine);
if (ret) {
NOUVEAU_ERR("Error creating 3D object: %d\n", ret);
return FALSE;
}
+ BIND_RING(chan, screen->rankine, 7);
+
+ /* 2D engine setup */
+ screen->eng2d = nv04_surface_2d_init(nvws);
+ screen->eng2d->buf = nv30_surface_buffer;
/* Notifier for sync purposes */
- ret = nvws->notifier_alloc(nvws, 1, &screen->sync);
+ ret = nouveau_notifier_alloc(chan, 0xbeef0301, 1, &screen->sync);
if (ret) {
NOUVEAU_ERR("Error creating notifier object: %d\n", ret);
nv30_screen_destroy(pscreen);
@@ -202,14 +210,14 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
}
/* Query objects */
- ret = nvws->notifier_alloc(nvws, 32, &screen->query);
+ ret = nouveau_notifier_alloc(chan, 0xbeef0302, 32, &screen->query);
if (ret) {
NOUVEAU_ERR("Error initialising query objects: %d\n", ret);
nv30_screen_destroy(pscreen);
return NULL;
}
- ret = nvws->res_init(&screen->query_heap, 0, 32);
+ ret = nouveau_resource_init(&screen->query_heap, 0, 32);
if (ret) {
NOUVEAU_ERR("Error initialising query object heap: %d\n", ret);
nv30_screen_destroy(pscreen);
@@ -217,8 +225,8 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
}
/* Vtxprog resources */
- if (nvws->res_init(&screen->vp_exec_heap, 0, 256) ||
- nvws->res_init(&screen->vp_data_heap, 0, 256)) {
+ if (nouveau_resource_init(&screen->vp_exec_heap, 0, 256) ||
+ nouveau_resource_init(&screen->vp_data_heap, 0, 256)) {
nv30_screen_destroy(pscreen);
return NULL;
}
@@ -228,23 +236,23 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
so_method(so, screen->rankine, NV34TCL_DMA_NOTIFY, 1);
so_data (so, screen->sync->handle);
so_method(so, screen->rankine, NV34TCL_DMA_TEXTURE0, 2);
- so_data (so, nvws->channel->vram->handle);
- so_data (so, nvws->channel->gart->handle);
+ so_data (so, chan->vram->handle);
+ so_data (so, chan->gart->handle);
so_method(so, screen->rankine, NV34TCL_DMA_COLOR1, 1);
- so_data (so, nvws->channel->vram->handle);
+ so_data (so, chan->vram->handle);
so_method(so, screen->rankine, NV34TCL_DMA_COLOR0, 2);
- so_data (so, nvws->channel->vram->handle);
- so_data (so, nvws->channel->vram->handle);
+ so_data (so, chan->vram->handle);
+ so_data (so, chan->vram->handle);
so_method(so, screen->rankine, NV34TCL_DMA_VTXBUF0, 2);
- so_data (so, nvws->channel->vram->handle);
- so_data (so, nvws->channel->gart->handle);
+ so_data (so, chan->vram->handle);
+ so_data (so, chan->gart->handle);
/* so_method(so, screen->rankine, NV34TCL_DMA_FENCE, 2);
so_data (so, 0);
so_data (so, screen->query->handle);*/
so_method(so, screen->rankine, NV34TCL_DMA_IN_MEMORY7, 1);
- so_data (so, nvws->channel->vram->handle);
+ so_data (so, chan->vram->handle);
so_method(so, screen->rankine, NV34TCL_DMA_IN_MEMORY8, 1);
- so_data (so, nvws->channel->vram->handle);
+ so_data (so, chan->vram->handle);
for (i=1; i<8; i++) {
so_method(so, screen->rankine, NV34TCL_VIEWPORT_CLIP_HORIZ(i), 1);
@@ -301,7 +309,7 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
so_emit(nvws, so);
so_ref(NULL, &so);
- nouveau_pushbuf_flush(nvws->channel, 0);
+ nouveau_pushbuf_flush(chan, 0);
return pscreen;
}
diff --git a/src/gallium/drivers/nv30/nv30_vertprog.c b/src/gallium/drivers/nv30/nv30_vertprog.c
index eaf543b8f7..aec39aae9c 100644
--- a/src/gallium/drivers/nv30/nv30_vertprog.c
+++ b/src/gallium/drivers/nv30/nv30_vertprog.c
@@ -645,7 +645,6 @@ out_err:
static boolean
nv30_vertprog_validate(struct nv30_context *nv30)
{
- struct nouveau_winsys *nvws = nv30->nvws;
struct pipe_winsys *ws = nv30->pipe.winsys;
struct nouveau_grobj *rankine = nv30->screen->rankine;
struct nv30_vertex_program *vp;
@@ -669,15 +668,15 @@ nv30_vertprog_validate(struct nv30_context *nv30)
struct nouveau_stateobj *so;
uint vplen = vp->nr_insns;
- if (nvws->res_alloc(heap, vplen, vp, &vp->exec)) {
+ if (nouveau_resource_alloc(heap, vplen, vp, &vp->exec)) {
while (heap->next && heap->size < vplen) {
struct nv30_vertex_program *evict;
evict = heap->next->priv;
- nvws->res_free(&evict->exec);
+ nouveau_resource_free(&evict->exec);
}
- if (nvws->res_alloc(heap, vplen, vp, &vp->exec))
+ if (nouveau_resource_alloc(heap, vplen, vp, &vp->exec))
assert(0);
}
@@ -694,15 +693,16 @@ nv30_vertprog_validate(struct nv30_context *nv30)
if (vp->nr_consts && !vp->data) {
struct nouveau_resource *heap = nv30->screen->vp_data_heap;
- if (nvws->res_alloc(heap, vp->nr_consts, vp, &vp->data)) {
+ if (nouveau_resource_alloc(heap, vp->nr_consts, vp, &vp->data)) {
while (heap->next && heap->size < vp->nr_consts) {
struct nv30_vertex_program *evict;
evict = heap->next->priv;
- nvws->res_free(&evict->data);
+ nouveau_resource_free(&evict->data);
}
- if (nvws->res_alloc(heap, vp->nr_consts, vp, &vp->data))
+ if (nouveau_resource_alloc(heap, vp->nr_consts, vp,
+ &vp->data))
assert(0);
}
@@ -804,8 +804,6 @@ nv30_vertprog_validate(struct nv30_context *nv30)
void
nv30_vertprog_destroy(struct nv30_context *nv30, struct nv30_vertex_program *vp)
{
- struct nouveau_winsys *nvws = nv30->screen->nvws;
-
vp->translated = FALSE;
if (vp->nr_insns) {
@@ -820,9 +818,9 @@ nv30_vertprog_destroy(struct nv30_context *nv30, struct nv30_vertex_program *vp)
vp->nr_consts = 0;
}
- nvws->res_free(&vp->exec);
+ nouveau_resource_free(&vp->exec);
vp->exec_start = 0;
- nvws->res_free(&vp->data);
+ nouveau_resource_free(&vp->data);
vp->data_start = 0;
vp->data_start_min = 0;