summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nv20
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/nv20')
-rw-r--r--src/gallium/drivers/nv20/nv20_context.c14
-rw-r--r--src/gallium/drivers/nv20/nv20_prim_vbuf.c12
-rw-r--r--src/gallium/drivers/nv20/nv20_screen.c84
-rw-r--r--src/gallium/drivers/nv20/nv20_screen.h4
-rw-r--r--src/gallium/drivers/nv20/nv20_state.c7
-rw-r--r--src/gallium/drivers/nv20/nv20_vbo.c16
-rw-r--r--src/gallium/drivers/nv20/nv20_vertprog.c12
7 files changed, 68 insertions, 81 deletions
diff --git a/src/gallium/drivers/nv20/nv20_context.c b/src/gallium/drivers/nv20/nv20_context.c
index cbc41707d5..b32d0d83ba 100644
--- a/src/gallium/drivers/nv20/nv20_context.c
+++ b/src/gallium/drivers/nv20/nv20_context.c
@@ -30,7 +30,7 @@ nv20_destroy(struct pipe_context *pipe)
static void nv20_init_hwctx(struct nv20_context *nv20)
{
struct nv20_screen *screen = nv20->screen;
- struct nouveau_winsys *nvws = screen->nvws;
+ struct nouveau_channel *chan = screen->base.channel;
int i;
float projectionmatrix[16];
const boolean is_nv25tcl = (nv20->screen->kelvin->grclass == NV25TCL);
@@ -38,11 +38,11 @@ static void nv20_init_hwctx(struct nv20_context *nv20)
BEGIN_RING(kelvin, NV20TCL_DMA_NOTIFY, 1);
OUT_RING (screen->sync->handle);
BEGIN_RING(kelvin, NV20TCL_DMA_TEXTURE0, 2);
- OUT_RING (nvws->channel->vram->handle);
- OUT_RING (nvws->channel->gart->handle); /* TEXTURE1 */
+ OUT_RING (chan->vram->handle);
+ OUT_RING (chan->gart->handle); /* TEXTURE1 */
BEGIN_RING(kelvin, NV20TCL_DMA_COLOR, 2);
- OUT_RING (nvws->channel->vram->handle);
- OUT_RING (nvws->channel->vram->handle); /* ZETA */
+ OUT_RING (chan->vram->handle);
+ OUT_RING (chan->vram->handle); /* ZETA */
BEGIN_RING(kelvin, NV20TCL_DMA_QUERY, 1);
OUT_RING (0); /* renouveau: beef0351, unique */
@@ -99,9 +99,9 @@ static void nv20_init_hwctx(struct nv20_context *nv20)
OUT_RING (3);
BEGIN_RING(kelvin, NV25TCL_DMA_IN_MEMORY9, 1);
- OUT_RING (nvws->channel->vram->handle);
+ OUT_RING (chan->vram->handle);
BEGIN_RING(kelvin, NV25TCL_DMA_IN_MEMORY8, 1);
- OUT_RING (nvws->channel->vram->handle);
+ OUT_RING (chan->vram->handle);
}
BEGIN_RING(kelvin, NV20TCL_DMA_FENCE, 1);
OUT_RING (0); /* renouveau: beef1e10 */
diff --git a/src/gallium/drivers/nv20/nv20_prim_vbuf.c b/src/gallium/drivers/nv20/nv20_prim_vbuf.c
index 8aa342cd2d..ddfcdb8057 100644
--- a/src/gallium/drivers/nv20/nv20_prim_vbuf.c
+++ b/src/gallium/drivers/nv20/nv20_prim_vbuf.c
@@ -152,12 +152,11 @@ static void *
nv20_vbuf_render_map_vertices( struct vbuf_render *render )
{
struct nv20_vbuf_render *nv20_render = nv20_vbuf_render(render);
- struct pipe_winsys *winsys = nv20_render->nv20->pipe.winsys;
+ struct pipe_screen *pscreen = nv20_render->nv20->pipe.screen;
if (nv20_render->pbuffer) {
- return winsys->buffer_map(winsys,
- nv20_render->pbuffer,
- PIPE_BUFFER_USAGE_CPU_WRITE);
+ return pipe_buffer_map(pscreen, nv20_render->pbuffer,
+ PIPE_BUFFER_USAGE_CPU_WRITE);
} else if (nv20_render->mbuffer) {
return nv20_render->mbuffer;
} else
@@ -173,10 +172,10 @@ nv20_vbuf_render_unmap_vertices( struct vbuf_render *render,
ushort max_index )
{
struct nv20_vbuf_render *nv20_render = nv20_vbuf_render(render);
- struct pipe_winsys *winsys = nv20_render->nv20->pipe.winsys;
+ struct pipe_screen *pscreen = nv20_render->nv20->pipe.screen;
if (nv20_render->pbuffer)
- winsys->buffer_unmap(winsys, nv20_render->pbuffer);
+ pipe_buffer_unmap(pscreen, nv20_render->pbuffer);
}
static boolean
@@ -358,7 +357,6 @@ nv20_vbuf_render_release_vertices( struct vbuf_render *render )
{
struct nv20_vbuf_render *nv20_render = nv20_vbuf_render(render);
struct nv20_context *nv20 = nv20_render->nv20;
- struct pipe_screen *pscreen = &nv20->screen->pipe;
if (nv20_render->pbuffer) {
pipe_buffer_reference(&nv20_render->pbuffer, NULL);
diff --git a/src/gallium/drivers/nv20/nv20_screen.c b/src/gallium/drivers/nv20/nv20_screen.c
index 7760ae27c0..024356ca74 100644
--- a/src/gallium/drivers/nv20/nv20_screen.c
+++ b/src/gallium/drivers/nv20/nv20_screen.c
@@ -1,26 +1,8 @@
#include "pipe/p_screen.h"
-#include "util/u_simple_screen.h"
#include "nv20_context.h"
#include "nv20_screen.h"
-static const char *
-nv20_screen_get_name(struct pipe_screen *screen)
-{
- struct nv20_screen *nv20screen = nv20_screen(screen);
- struct nouveau_device *dev = nv20screen->nvws->channel->device;
- static char buffer[128];
-
- snprintf(buffer, sizeof(buffer), "NV%02X", dev->chipset);
- return buffer;
-}
-
-static const char *
-nv20_screen_get_vendor(struct pipe_screen *screen)
-{
- return "nouveau";
-}
-
static int
nv20_screen_get_param(struct pipe_screen *screen, int param)
{
@@ -120,10 +102,9 @@ static void
nv20_screen_destroy(struct pipe_screen *pscreen)
{
struct nv20_screen *screen = nv20_screen(pscreen);
- struct nouveau_winsys *nvws = screen->nvws;
- nvws->notifier_free(&screen->sync);
- nvws->grobj_free(&screen->kelvin);
+ nouveau_notifier_free(&screen->sync);
+ nouveau_grobj_free(&screen->kelvin);
FREE(pscreen);
}
@@ -137,60 +118,65 @@ nv20_surface_buffer(struct pipe_surface *surf)
}
struct pipe_screen *
-nv20_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
+nv20_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
{
struct nv20_screen *screen = CALLOC_STRUCT(nv20_screen);
+ struct nouveau_channel *chan;
+ struct pipe_screen *pscreen;
unsigned kelvin_class = 0;
- unsigned chipset = nvws->channel->device->chipset;
int ret;
if (!screen)
return NULL;
- screen->nvws = nvws;
+ pscreen = &screen->base.base;
- /* 2D engine setup */
- screen->eng2d = nv04_surface_2d_init(nvws);
- screen->eng2d->buf = nv20_surface_buffer;
+ ret = nouveau_screen_init(&screen->base, dev);
+ if (ret) {
+ nv20_screen_destroy(pscreen);
+ return NULL;
+ }
+ chan = screen->base.channel;
+
+ pscreen->winsys = ws;
+ pscreen->destroy = nv20_screen_destroy;
+ pscreen->get_param = nv20_screen_get_param;
+ pscreen->get_paramf = nv20_screen_get_paramf;
+ pscreen->is_format_supported = nv20_screen_is_format_supported;
+
+ nv20_screen_init_miptree_functions(pscreen);
+ nv20_screen_init_transfer_functions(pscreen);
/* 3D object */
- if (chipset >= 0x25)
+ if (dev->chipset >= 0x25)
kelvin_class = NV25TCL;
- else if (chipset >= 0x20)
+ else if (dev->chipset >= 0x20)
kelvin_class = NV20TCL;
- if (!kelvin_class || chipset >= 0x30) {
- NOUVEAU_ERR("Unknown nv2x chipset: nv%02x\n", chipset);
+ if (!kelvin_class || dev->chipset >= 0x30) {
+ NOUVEAU_ERR("Unknown nv2x chipset: nv%02x\n", dev->chipset);
return NULL;
}
- ret = nvws->grobj_alloc(nvws, kelvin_class, &screen->kelvin);
+ ret = nouveau_grobj_alloc(chan, 0xbeef0097, kelvin_class,
+ &screen->kelvin);
if (ret) {
NOUVEAU_ERR("Error creating 3D object: %d\n", ret);
return FALSE;
}
+ BIND_RING(chan, screen->kelvin, 7);
+
+ /* 2D engine setup */
+ screen->eng2d = nv04_surface_2d_init(&screen->base);
+ screen->eng2d->buf = nv20_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);
- nv20_screen_destroy(&screen->pipe);
+ nv20_screen_destroy(pscreen);
return NULL;
}
- screen->pipe.winsys = ws;
- screen->pipe.destroy = nv20_screen_destroy;
-
- screen->pipe.get_name = nv20_screen_get_name;
- screen->pipe.get_vendor = nv20_screen_get_vendor;
- screen->pipe.get_param = nv20_screen_get_param;
- screen->pipe.get_paramf = nv20_screen_get_paramf;
-
- screen->pipe.is_format_supported = nv20_screen_is_format_supported;
-
- nv20_screen_init_miptree_functions(&screen->pipe);
- nv20_screen_init_transfer_functions(&screen->pipe);
- u_simple_screen_init(&screen->pipe);
-
- return &screen->pipe;
+ return pscreen;
}
diff --git a/src/gallium/drivers/nv20/nv20_screen.h b/src/gallium/drivers/nv20/nv20_screen.h
index d9fce2bced..fc7bb05033 100644
--- a/src/gallium/drivers/nv20/nv20_screen.h
+++ b/src/gallium/drivers/nv20/nv20_screen.h
@@ -1,11 +1,11 @@
#ifndef __NV20_SCREEN_H__
#define __NV20_SCREEN_H__
-#include "pipe/p_screen.h"
+#include "nouveau/nouveau_screen.h"
#include "nv04/nv04_surface_2d.h"
struct nv20_screen {
- struct pipe_screen pipe;
+ struct nouveau_screen base;
struct nouveau_winsys *nvws;
diff --git a/src/gallium/drivers/nv20/nv20_state.c b/src/gallium/drivers/nv20/nv20_state.c
index ecec4f49a0..ed4084980f 100644
--- a/src/gallium/drivers/nv20/nv20_state.c
+++ b/src/gallium/drivers/nv20/nv20_state.c
@@ -2,6 +2,7 @@
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "pipe/p_shader_tokens.h"
+#include "pipe/p_inlines.h"
#include "tgsi/tgsi_parse.h"
@@ -453,7 +454,7 @@ nv20_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
const struct pipe_constant_buffer *buf )
{
struct nv20_context *nv20 = nv20_context(pipe);
- struct pipe_winsys *ws = pipe->winsys;
+ struct pipe_screen *pscreen = pipe->screen;
assert(shader < PIPE_SHADER_TYPES);
assert(index == 0);
@@ -461,12 +462,12 @@ nv20_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
if (buf) {
void *mapped;
if (buf->buffer && buf->buffer->size &&
- (mapped = ws->buffer_map(ws, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
+ (mapped = pipe_buffer_map(pscreen, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
{
memcpy(nv20->constbuf[shader], mapped, buf->buffer->size);
nv20->constbuf_nr[shader] =
buf->buffer->size / (4 * sizeof(float));
- ws->buffer_unmap(ws, buf->buffer);
+ pipe_buffer_unmap(pscreen, buf->buffer);
}
}
}
diff --git a/src/gallium/drivers/nv20/nv20_vbo.c b/src/gallium/drivers/nv20/nv20_vbo.c
index 24d8f4bef0..84d7db6c5e 100644
--- a/src/gallium/drivers/nv20/nv20_vbo.c
+++ b/src/gallium/drivers/nv20/nv20_vbo.c
@@ -1,6 +1,7 @@
#include "draw/draw_context.h"
#include "pipe/p_context.h"
#include "pipe/p_state.h"
+#include "pipe/p_inlines.h"
#include "nv20_context.h"
#include "nv20_state.h"
@@ -13,6 +14,7 @@ boolean nv20_draw_elements( struct pipe_context *pipe,
unsigned indexSize,
unsigned prim, unsigned start, unsigned count)
{
+ struct pipe_screen *pscreen = pipe->screen;
struct nv20_context *nv20 = nv20_context( pipe );
struct draw_context *draw = nv20->draw;
unsigned i;
@@ -25,17 +27,17 @@ boolean nv20_draw_elements( struct pipe_context *pipe,
for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
if (nv20->vtxbuf[i].buffer) {
void *buf
- = pipe->winsys->buffer_map(pipe->winsys,
- nv20->vtxbuf[i].buffer,
- PIPE_BUFFER_USAGE_CPU_READ);
+ = pipe_buffer_map(pscreen,
+ nv20->vtxbuf[i].buffer,
+ PIPE_BUFFER_USAGE_CPU_READ);
draw_set_mapped_vertex_buffer(draw, i, buf);
}
}
/* Map index buffer, if present */
if (indexBuffer) {
void *mapped_indexes
- = pipe->winsys->buffer_map(pipe->winsys, indexBuffer,
- PIPE_BUFFER_USAGE_CPU_READ);
+ = pipe_buffer_map(pscreen, indexBuffer,
+ PIPE_BUFFER_USAGE_CPU_READ);
draw_set_mapped_element_buffer(draw, indexSize, mapped_indexes);
}
else {
@@ -55,12 +57,12 @@ boolean nv20_draw_elements( struct pipe_context *pipe,
*/
for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
if (nv20->vtxbuf[i].buffer) {
- pipe->winsys->buffer_unmap(pipe->winsys, nv20->vtxbuf[i].buffer);
+ pipe_buffer_unmap(pscreen, nv20->vtxbuf[i].buffer);
draw_set_mapped_vertex_buffer(draw, i, NULL);
}
}
if (indexBuffer) {
- pipe->winsys->buffer_unmap(pipe->winsys, indexBuffer);
+ pipe_buffer_unmap(pscreen, indexBuffer);
draw_set_mapped_element_buffer(draw, 0, NULL);
}
diff --git a/src/gallium/drivers/nv20/nv20_vertprog.c b/src/gallium/drivers/nv20/nv20_vertprog.c
index 5db0e807ff..c1e588902b 100644
--- a/src/gallium/drivers/nv20/nv20_vertprog.c
+++ b/src/gallium/drivers/nv20/nv20_vertprog.c
@@ -1,6 +1,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
+#include "pipe/p_inlines.h"
#include "pipe/p_shader_tokens.h"
#include "tgsi/tgsi_parse.h"
@@ -645,8 +646,8 @@ out_err:
static boolean
nv20_vertprog_validate(struct nv20_context *nv20)
{
+ struct pipe_screen *pscreen = nv20->pipe.screen;
struct nouveau_winsys *nvws = nv20->nvws;
- struct pipe_winsys *ws = nv20->pipe.winsys;
struct nouveau_grobj *rankine = nv20->screen->rankine;
struct nv20_vertex_program *vp;
struct pipe_buffer *constbuf;
@@ -749,8 +750,8 @@ nv20_vertprog_validate(struct nv20_context *nv20)
float *map = NULL;
if (constbuf) {
- map = ws->buffer_map(ws, constbuf,
- PIPE_BUFFER_USAGE_CPU_READ);
+ map = pipe_buffer_map(pscreen, constbuf,
+ PIPE_BUFFER_USAGE_CPU_READ);
}
for (i = 0; i < vp->nr_consts; i++) {
@@ -770,9 +771,8 @@ nv20_vertprog_validate(struct nv20_context *nv20)
OUT_RINGp ((uint32_t *)vpd->value, 4);
}
- if (constbuf) {
- ws->buffer_unmap(ws, constbuf);
- }
+ if (constbuf)
+ pipe_buffer_unmap(pscreen, constbuf);
}
/* Upload vtxprog */