summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephane Marchesin <[email protected]>2007-01-27 03:03:25 +0100
committerStephane Marchesin <[email protected]>2007-01-27 03:08:01 +0100
commit0931e21eb62af217564f450e9e56bc7b6f0e15c7 (patch)
tree065445dc7354aedd7a2603f5eb1358e5f7b0a4e9
parent99c9bc386f54964eea0ed93f6b036477076dae57 (diff)
nouveau: more work on nv04, this time buffer format/pitches/...
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_object.c2
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_object.h2
-rw-r--r--src/mesa/drivers/dri/nouveau/nv04_state.c45
3 files changed, 47 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_object.c b/src/mesa/drivers/dri/nouveau/nouveau_object.c
index 26086e16e43..302009c8b17 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_object.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_object.c
@@ -70,6 +70,8 @@ void nouveauObjectInit(nouveauContextPtr nmesa)
} else {
nouveauCreateContextObject(nmesa, NvCtxSurf2D, NV04_CONTEXT_SURFACES_2D,
0, 0, 0, 0);
+ nouveauCreateContextObject(nmesa, NvCtxSurf3D, NV04_CONTEXT_SURFACES_3D,
+ 0, 0, 0, 0);
nouveauCreateContextObject(nmesa, NvImageBlit, NV_IMAGE_BLIT,
NV_DMA_CONTEXT_FLAGS_PATCH_SRCCOPY, 0, 0, 0);
}
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_object.h b/src/mesa/drivers/dri/nouveau/nouveau_object.h
index b1ff5a5d0dc..e154e0acff0 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_object.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_object.h
@@ -12,6 +12,7 @@ enum DMAObjects {
NvCtxSurf2D = 0x80000020,
NvImageBlit = 0x80000021,
NvMemFormat = 0x80000022,
+ NvCtxSurf3D = 0x80000023,
NvDmaFB = 0xD0FB0001,
NvDmaAGP = 0xD0AA0001,
NvSyncNotify = 0xD0000001
@@ -21,6 +22,7 @@ enum DMASubchannel {
NvSubCtxSurf2D = 0,
NvSubImageBlit = 1,
NvSubMemFormat = 2,
+ NvSubCtxSurf3D = 3,
NvSub3D = 7,
};
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state.c b/src/mesa/drivers/dri/nouveau/nv04_state.c
index 83ad8ae4327..ec4cd40d877 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state.c
@@ -267,6 +267,7 @@ static void nv04Enable(GLcontext *ctx, GLenum cap, GLboolean state)
break;
case GL_FOG:
nv04_emit_blend(ctx);
+ nv04_emit_fog_color(ctx);
break;
// case GL_HISTOGRAM:
// case GL_INDEX_LOGIC_OP:
@@ -436,14 +437,54 @@ static void nv04WindowMoved(nouveauContextPtr nmesa)
/* Initialise any card-specific non-GL related state */
static GLboolean nv04InitCard(nouveauContextPtr nmesa)
{
+ nouveauObjectOnSubchannel(nmesa, NvSub3D, Nv3D);
+ nouveauObjectOnSubchannel(nmesa, NvSubCtxSurf3D, NvCtxSurf3D);
+
+ BEGIN_RING_SIZE(NvSubCtxSurf3D, NV04_CONTEXT_SURFACES_3D_DMA_NOTIFY, 3);
+ OUT_RING(NvDmaFB);
+ OUT_RING(NvDmaFB);
+ OUT_RING(NvDmaFB);
+ BEGIN_RING_SIZE(NvSub3D, NV04_DX5_TEXTURED_TRIANGLE_SURFACE, 1);
+ OUT_RING(NvCtxSurf3D);
return GL_TRUE;
}
/* Update buffer offset/pitch/format */
static GLboolean nv04BindBuffers(nouveauContextPtr nmesa, int num_color,
- nouveau_renderbuffer **color,
- nouveau_renderbuffer *depth)
+ nouveau_renderbuffer **color,
+ nouveau_renderbuffer *depth)
{
+ GLuint x, y, w, h;
+
+ w = color[0]->mesa.Width;
+ h = color[0]->mesa.Height;
+ x = nmesa->drawX;
+ y = nmesa->drawY;
+
+ /* FIXME pitches have to be aligned ! */
+ BEGIN_RING_SIZE(NvSubCtxSurf3D, NV04_CONTEXT_SURFACES_3D_PITCH, 2);
+ OUT_RING(color[0]->pitch|(depth->pitch<<16));
+ OUT_RING(color[0]->offset);
+
+ if (depth) {
+ BEGIN_RING_SIZE(NvSubCtxSurf3D, NV04_CONTEXT_SURFACES_3D_OFFSET_ZETA, 1);
+ OUT_RING(depth->offset);
+ }
+
+ BEGIN_RING_SIZE(NvSubCtxSurf3D, NV04_CONTEXT_SURFACES_3D_CLIP_HORIZONTAL, 2);
+ OUT_RING((w<<16)|x);
+ OUT_RING((h<<16)|y);
+
+ /* FIXME not sure... */
+ BEGIN_RING_SIZE(NvSubCtxSurf3D, NV04_CONTEXT_SURFACES_3D_CLIP_SIZE, 1);
+ OUT_RING((h<<16)|w);
+
+ BEGIN_RING_SIZE(NvSubCtxSurf3D, NV04_CONTEXT_SURFACES_3D_FORMAT, 1);
+ if (color[0]->mesa._ActualFormat == GL_RGBA8)
+ OUT_RING(108/*A8R8G8B8*/);
+ else
+ OUT_RING(103/*R5G6B5*/);
+
return GL_TRUE;
}