Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

move away from libdrm's BEGIN_RING (and variants) macros

subchan auto-assignment is now gone.
  • Loading branch information...
commit 3d2a752ca8aafee5e1e94dabfd7deec439890e95 1 parent b6cfdc0
Ben Skeggs authored
View
1  src/nouveau_exa.c
@@ -21,7 +21,6 @@
*/
#include "nv_include.h"
-#include "nv04_pushbuf.h"
#include "exa.h"
#include "hwdefs/nv_m2mf.xml.h"
View
88 src/nouveau_local.h
@@ -26,6 +26,8 @@
#include "compiler.h"
#include "xf86_OSproc.h"
+#include "nouveau_pushbuf.h"
+
/* Debug output */
#define NOUVEAU_MSG(fmt,args...) ErrorF(fmt, ##args)
#define NOUVEAU_ERR(fmt,args...) \
@@ -83,4 +85,90 @@ static inline int round_down_pow2(int x)
(y) = __z; \
} while (0)
+static inline void
+BEGIN_NV04(struct nouveau_channel *chan, int subc, int mthd, int size)
+{
+ WAIT_RING(chan, size + 1);
+ OUT_RING (chan, 0x00000000 | (size << 18) | (subc << 13) | mthd);
+}
+
+static inline void
+BEGIN_NI04(struct nouveau_channel *chan, int subc, int mthd, int size)
+{
+ WAIT_RING(chan, size + 1);
+ OUT_RING (chan, 0x40000000 | (size << 18) | (subc << 13) | mthd);
+}
+
+static inline void
+BEGIN_NVC0(struct nouveau_channel *chan, int subc, int mthd, int size)
+{
+ WAIT_RING(chan, size + 1);
+ OUT_RING (chan, 0x20000000 | (size << 16) | (subc << 13) | (mthd >> 2));
+}
+
+static inline void
+BEGIN_NIC0(struct nouveau_channel *chan, int subc, int mthd, int size)
+{
+ WAIT_RING(chan, size + 1);
+ OUT_RING (chan, 0x60000000 | (size << 16) | (subc << 13) | (mthd >> 2));
+}
+
+static inline void
+BEGIN_IMC0(struct nouveau_channel *chan, int subc, int mthd, int data)
+{
+ WAIT_RING(chan, 1);
+ OUT_RING (chan, 0x80000000 | (data << 16) | (subc << 13) | (mthd >> 2));
+}
+
+static inline void
+BEGIN_1IC0(struct nouveau_channel *chan, int subc, int mthd, int size)
+{
+ WAIT_RING(chan, size + 1);
+ OUT_RING (chan, 0xa0000000 | (size << 16) | (subc << 13) | (mthd >> 2));
+}
+
+/* subchannel assignment */
+#define SUBC_M2MF(mthd) 0, (mthd) /* nv04: */
+#define NV03_M2MF(mthd) SUBC_M2MF(NV03_M2MF_##mthd)
+#define NV50_M2MF(mthd) SUBC_M2MF(NV50_M2MF_##mthd)
+#define NVC0_M2MF(mthd) SUBC_M2MF(NVC0_M2MF_##mthd)
+#define SUBC_NVSW(mthd) 1, (mthd)
+#define SUBC_SF2D(mthd) 2, (mthd) /* nv04:nv50 */
+#define SUBC_2D(mthd) 2, (mthd) /* nv50: */
+#define NV04_SF2D(mthd) SUBC_SF2D(NV04_SURFACE_2D_##mthd)
+#define NV10_SF2D(mthd) SUBC_SF2D(NV10_SURFACE_2D_##mthd)
+#define NV50_2D(mthd) SUBC_2D(NV50_2D_##mthd)
+#define NVC0_2D(mthd) SUBC_2D(NVC0_2D_##mthd)
+#define SUBC_RECT(mthd) 3, (mthd) /* nv04:nv50 */
+#define NV04_RECT(mthd) SUBC_RECT(NV04_GDI_##mthd)
+#define SUBC_BLIT(mthd) 4, (mthd) /* nv04:nv50 */
+#define NV01_BLIT(mthd) SUBC_BLIT(NV01_BLIT_##mthd)
+#define NV04_BLIT(mthd) SUBC_BLIT(NV04_BLIT_##mthd)
+#define NV15_BLIT(mthd) SUBC_BLIT(NV15_BLIT_##mthd)
+#define SUBC_IFC(mthd) 5, (mthd) /* nv04:nv50 */
+#define NV01_IFC(mthd) SUBC_IFC(NV01_IFC_##mthd)
+#define NV04_IFC(mthd) SUBC_IFC(NV04_IFC_##mthd)
+#define SUBC_MISC(mthd) 6, (mthd) /* nv04:nv50 */
+#define NV03_SIFM(mthd) SUBC_MISC(NV03_SIFM_##mthd)
+#define NV05_SIFM(mthd) SUBC_MISC(NV05_SIFM_##mthd)
+#define NV01_BETA(mthd) SUBC_MISC(NV01_BETA_##mthd)
+#define NV04_BETA4(mthd) SUBC_MISC(NV04_BETA4_##mthd)
+#define NV01_PATT(mthd) SUBC_MISC(NV01_PATTERN_##mthd)
+#define NV04_PATT(mthd) SUBC_MISC(NV04_PATTERN_##mthd)
+#define NV01_ROP(mthd) SUBC_MISC(NV01_ROP_##mthd)
+#define NV01_CLIP(mthd) SUBC_MISC(NV01_CLIP_##mthd)
+#define SUBC_3D(mthd) 7, (mthd) /* nv10: */
+#define NV10_3D(mthd) SUBC_3D(NV10_3D_##mthd)
+#define NV30_3D(mthd) SUBC_3D(NV30_3D_##mthd)
+#define NV40_3D(mthd) SUBC_3D(NV40_3D_##mthd)
+#define NV50_3D(mthd) SUBC_3D(NV50_3D_##mthd)
+#define NVC0_3D(mthd) SUBC_3D(NVC0_3D_##mthd)
+
+#define NV01_SUBC(subc, mthd) SUBC_##subc((NV01_SUBCHAN_##mthd))
+#define NV11_SUBC(subc, mthd) SUBC_##subc((NV11_SUBCHAN_##mthd))
+
+#define NV04_GRAPH(subc, mthd) SUBC_##subc((NV04_GRAPH_##mthd))
+#define NV50_GRAPH(subc, mthd) SUBC_##subc((NV50_GRAPH_##mthd))
+#define NVC0_GRAPH(subc, mthd) SUBC_##subc((NVC0_GRAPH_##mthd))
+
#endif
View
11 src/nouveau_xv.c
@@ -35,7 +35,6 @@
#include "nv_include.h"
#include "nv_dma.h"
-#include "nv04_pushbuf.h"
#include "vl_hwmc.h"
@@ -1122,15 +1121,15 @@ NVPutImage(ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x,
if (MARK_RING(chan, 64, 4))
return FALSE;
- BEGIN_RING(chan, m2mf, NV03_M2MF_DMA_BUFFER_IN, 2);
+ BEGIN_NV04(chan, NV03_M2MF(DMA_BUFFER_IN), 2);
OUT_RING (chan, pNv->chan->gart->handle);
OUT_RING (chan, pNv->chan->vram->handle);
if (pNv->Architecture >= NV_ARCH_50) {
- BEGIN_RING(chan, m2mf, NV50_M2MF_LINEAR_IN, 1);
+ BEGIN_NV04(chan, NV50_M2MF(LINEAR_IN), 1);
OUT_RING (chan, 1);
- BEGIN_RING(chan, m2mf, NV50_M2MF_LINEAR_OUT, 7);
+ BEGIN_NV04(chan, NV50_M2MF(LINEAR_OUT), 7);
OUT_RING (chan, 0);
OUT_RING (chan, destination_buffer->tile_mode << 4);
OUT_RING (chan, dstPitch);
@@ -1145,7 +1144,7 @@ NVPutImage(ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x,
!(action_flags & CONVERT_TO_YUY2)) {
/* we start the color plane transfer separately */
- BEGIN_RING(chan, m2mf, NV03_M2MF_OFFSET_IN, 8);
+ BEGIN_NV04(chan, NV03_M2MF(OFFSET_IN), 8);
if (OUT_RELOCl(chan, destination_buffer,
line_len * nlines,
NOUVEAU_BO_GART | NOUVEAU_BO_RD) ||
@@ -1163,7 +1162,7 @@ NVPutImage(ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x,
OUT_RING (chan, 0);
}
- BEGIN_RING(chan, m2mf, NV03_M2MF_OFFSET_IN, 8);
+ BEGIN_NV04(chan, NV03_M2MF(OFFSET_IN), 8);
if (OUT_RELOCl(chan, destination_buffer, 0,
NOUVEAU_BO_GART | NOUVEAU_BO_RD) ||
OUT_RELOCl(chan, pPriv->video_mem, offset,
View
76 src/nv04_exa.c
@@ -23,7 +23,6 @@
#include "nv_include.h"
#include "nv_rop.h"
-#include "nv04_pushbuf.h"
#include "hwdefs/nv_object.xml.h"
#include "hwdefs/nv_m2mf.xml.h"
@@ -35,9 +34,10 @@ NV04EXASetPattern(ScrnInfoPtr pScrn, CARD32 clr0, CARD32 clr1,
{
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *patt = pNv->NvImagePattern;
- BEGIN_RING(chan, patt, NV01_PATTERN_MONOCHROME_COLOR(0), 4);
+ BEGIN_NV04(chan, NV01_SUBC(MISC, OBJECT), 1);
+ OUT_RING (chan, pNv->NvImagePattern->handle);
+ BEGIN_NV04(chan, NV01_PATT(MONOCHROME_COLOR(0)), 4);
OUT_RING (chan, clr0);
OUT_RING (chan, clr1);
OUT_RING (chan, pat0);
@@ -49,12 +49,13 @@ NV04EXASetROP(ScrnInfoPtr pScrn, CARD32 alu, CARD32 planemask)
{
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *rop = pNv->NvRop;
if (planemask != ~0) {
NV04EXASetPattern(pScrn, 0, planemask, ~0, ~0);
if (pNv->currentRop != (alu + 32)) {
- BEGIN_RING(chan, rop, NV01_ROP_ROP, 1);
+ BEGIN_NV04(chan, NV01_SUBC(MISC, OBJECT), 1);
+ OUT_RING (chan, pNv->NvRop->handle);
+ BEGIN_NV04(chan, NV01_ROP(ROP), 1);
OUT_RING (chan, NVROP[alu].copy_planemask);
pNv->currentRop = alu + 32;
}
@@ -62,7 +63,9 @@ NV04EXASetROP(ScrnInfoPtr pScrn, CARD32 alu, CARD32 planemask)
if (pNv->currentRop != alu) {
if(pNv->currentRop >= 16)
NV04EXASetPattern(pScrn, ~0, ~0, ~0, ~0);
- BEGIN_RING(chan, rop, NV01_ROP_ROP, 1);
+ BEGIN_NV04(chan, NV01_SUBC(MISC, OBJECT), 1);
+ OUT_RING (chan, pNv->NvRop->handle);
+ BEGIN_NV04(chan, NV01_ROP(ROP), 1);
OUT_RING (chan, NVROP[alu].copy);
pNv->currentRop = alu;
}
@@ -83,8 +86,6 @@ NV04EXAPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *surf2d = pNv->NvContextSurfaces;
- struct nouveau_grobj *rect = pNv->NvRectangle;
struct nouveau_bo *bo = nouveau_pixmap_bo(pPixmap);
unsigned int fmt, pitch, fmt2 = NV04_GDI_COLOR_FORMAT_A8R8G8B8;
@@ -95,11 +96,11 @@ NV04EXAPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
if (planemask != ~0 || alu != GXcopy) {
if (pPixmap->drawable.bitsPerPixel == 32)
return FALSE;
- BEGIN_RING(chan, rect, NV04_GDI_OPERATION, 1);
+ BEGIN_NV04(chan, NV04_RECT(OPERATION), 1);
OUT_RING (chan, 1); /* ROP_AND */
NV04EXASetROP(pScrn, alu, planemask);
} else {
- BEGIN_RING(chan, rect, NV04_GDI_OPERATION, 1);
+ BEGIN_NV04(chan, NV04_RECT(OPERATION), 1);
OUT_RING (chan, 3); /* SRCCOPY */
}
@@ -122,7 +123,7 @@ NV04EXAPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
if (fmt == NV04_SURFACE_2D_FORMAT_A8R8G8B8)
fmt = NV04_SURFACE_2D_FORMAT_Y32;
- BEGIN_RING(chan, surf2d, NV04_SURFACE_2D_FORMAT, 4);
+ BEGIN_NV04(chan, NV04_SF2D(FORMAT), 4);
OUT_RING (chan, fmt);
OUT_RING (chan, (pitch << 16) | pitch);
if (OUT_RELOCl(chan, bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR) ||
@@ -131,9 +132,9 @@ NV04EXAPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
return FALSE;
}
- BEGIN_RING(chan, rect, NV04_GDI_COLOR_FORMAT, 1);
+ BEGIN_NV04(chan, NV04_RECT(COLOR_FORMAT), 1);
OUT_RING (chan, fmt2);
- BEGIN_RING(chan, rect, NV04_GDI_COLOR1_A, 1);
+ BEGIN_NV04(chan, NV04_RECT(COLOR1_A), 1);
OUT_RING (chan, fg);
pNv->pdpix = pPixmap;
@@ -150,11 +151,10 @@ NV04EXASolid (PixmapPtr pPixmap, int x1, int y1, int x2, int y2)
ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *rect = pNv->NvRectangle;
int width = x2-x1;
int height = y2-y1;
- BEGIN_RING(chan, rect, NV04_GDI_UNCLIPPED_RECTANGLE_POINT(0), 2);
+ BEGIN_NV04(chan, NV04_RECT(UNCLIPPED_RECTANGLE_POINT(0)), 2);
OUT_RING (chan, (x1 << 16) | y1);
OUT_RING (chan, (width << 16) | height);
@@ -188,8 +188,6 @@ NV04EXAPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int dx, int dy,
ScrnInfoPtr pScrn = xf86Screens[pSrcPixmap->drawable.pScreen->myNum];
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *surf2d = pNv->NvContextSurfaces;
- struct nouveau_grobj *blit = pNv->NvImageBlit;
struct nouveau_bo *src_bo = nouveau_pixmap_bo(pSrcPixmap);
struct nouveau_bo *dst_bo = nouveau_pixmap_bo(pDstPixmap);
int fmt;
@@ -211,16 +209,16 @@ NV04EXAPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int dx, int dy,
return FALSE;
}
- BEGIN_RING(chan, blit, NV01_BLIT_OPERATION, 1);
+ BEGIN_NV04(chan, NV01_BLIT(OPERATION), 1);
OUT_RING (chan, 1); /* ROP_AND */
NV04EXASetROP(pScrn, alu, planemask);
} else {
- BEGIN_RING(chan, blit, NV01_BLIT_OPERATION, 1);
+ BEGIN_NV04(chan, NV01_BLIT(OPERATION), 1);
OUT_RING (chan, 3); /* SRCCOPY */
}
- BEGIN_RING(chan, surf2d, NV04_SURFACE_2D_FORMAT, 4);
+ BEGIN_NV04(chan, NV04_SF2D(FORMAT), 4);
OUT_RING (chan, fmt);
OUT_RING (chan, (exaGetPixmapPitch(pDstPixmap) << 16) |
(exaGetPixmapPitch(pSrcPixmap)));
@@ -245,7 +243,6 @@ NV04EXACopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY,
ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *blit = pNv->NvImageBlit;
int split_dstY = NOUVEAU_ALIGN(dstY + 1, 64);
int split_height = split_dstY - dstY;
@@ -260,20 +257,18 @@ NV04EXACopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY,
* different (not nicer) trick to achieve the same
* effect.
*/
- struct nouveau_grobj *surf2d = pNv->NvContextSurfaces;
struct nouveau_bo *dst_bo = nouveau_pixmap_bo(pNv->pdpix);
unsigned dst_pitch = exaGetPixmapPitch(pNv->pdpix);
if (MARK_RING(chan, 10, 1))
return;
- BEGIN_RING(chan, blit, NV01_BLIT_POINT_IN, 3);
+ BEGIN_NV04(chan, NV01_BLIT(POINT_IN), 3);
OUT_RING (chan, (srcY << 16) | srcX);
OUT_RING (chan, (dstY << 16) | dstX);
OUT_RING (chan, (split_height << 16) | width);
- BEGIN_RING(chan, surf2d,
- NV04_SURFACE_2D_OFFSET_DESTIN, 1);
+ BEGIN_NV04(chan, NV04_SF2D(OFFSET_DESTIN), 1);
OUT_RELOCl(chan, dst_bo, split_dstY * dst_pitch,
NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
@@ -282,7 +277,7 @@ NV04EXACopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY,
dstY = 0;
}
- BEGIN_RING(chan, blit, NV01_BLIT_POINT_IN, 3);
+ BEGIN_NV04(chan, NV01_BLIT(POINT_IN), 3);
OUT_RING (chan, (srcY << 16) | srcX);
OUT_RING (chan, (dstY << 16) | dstX);
OUT_RING (chan, (height << 16) | width);
@@ -305,8 +300,6 @@ NV04EXAStateIFCSubmit(struct nouveau_channel *chan)
{
ScrnInfoPtr pScrn = chan->user_private;
NVPtr pNv = NVPTR(pScrn);
- struct nouveau_grobj *surf2d = pNv->NvContextSurfaces;
- struct nouveau_grobj *ifc = pNv->NvImageFromCpu;
struct nouveau_bo *bo = nouveau_pixmap_bo(pNv->pdpix);
int surf_fmt;
@@ -315,7 +308,7 @@ NV04EXAStateIFCSubmit(struct nouveau_channel *chan)
if (MARK_RING(chan, 64, 2))
return FALSE;
- BEGIN_RING(chan, surf2d, NV04_SURFACE_2D_FORMAT, 4);
+ BEGIN_NV04(chan, NV04_SF2D(FORMAT), 4);
OUT_RING (chan, surf_fmt);
OUT_RING (chan, (exaGetPixmapPitch(pNv->pdpix) << 16) |
exaGetPixmapPitch(pNv->pdpix));
@@ -324,7 +317,7 @@ NV04EXAStateIFCSubmit(struct nouveau_channel *chan)
MARK_UNDO(chan);
return FALSE;
}
- BEGIN_RING(chan, ifc, NV01_IFC_POINT, 3);
+ BEGIN_NV04(chan, NV01_IFC(POINT), 3);
OUT_RING (chan, (pNv->point_y << 16) | pNv->point_x);
OUT_RING (chan, (pNv->height_out << 16) | pNv->width_out);
OUT_RING (chan, (pNv->height_in << 16) | pNv->width_in);
@@ -345,8 +338,6 @@ NV04EXAUploadIFC(ScrnInfoPtr pScrn, const char *src, int src_pitch,
NVPtr pNv = NVPTR(pScrn);
ScreenPtr pScreen = pDst->drawable.pScreen;
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *clip = pNv->NvClipRectangle;
- struct nouveau_grobj *ifc = pNv->NvImageFromCpu;
int line_len = w * cpp;
int iw, id, surf_fmt, ifc_fmt;
int padbytes;
@@ -380,10 +371,12 @@ NV04EXAUploadIFC(ScrnInfoPtr pScrn, const char *src, int src_pitch,
if (id > 1792)
return FALSE;
- BEGIN_RING(chan, clip, NV01_CLIP_POINT, 2);
+ BEGIN_NV04(chan, NV01_SUBC(MISC, OBJECT), 1);
+ OUT_RING (chan, pNv->NvClipRectangle->handle);
+ BEGIN_NV04(chan, NV01_CLIP(POINT), 2);
OUT_RING (chan, (y << 16) | x);
OUT_RING (chan, (h << 16) | w);
- BEGIN_RING(chan, ifc, NV01_IFC_OPERATION, 2);
+ BEGIN_NV04(chan, NV01_IFC(OPERATION), 2);
OUT_RING (chan, NV01_IFC_OPERATION_SRCCOPY);
OUT_RING (chan, ifc_fmt);
@@ -401,7 +394,7 @@ NV04EXAUploadIFC(ScrnInfoPtr pScrn, const char *src, int src_pitch,
h--;
while (h--) {
/* send a line */
- BEGIN_RING(chan, ifc, NV01_IFC_COLOR(0), id);
+ BEGIN_NV04(chan, NV01_IFC(COLOR(0)), id);
OUT_RINGp (chan, src, id);
src += src_pitch;
@@ -410,7 +403,7 @@ NV04EXAUploadIFC(ScrnInfoPtr pScrn, const char *src, int src_pitch,
if (padbytes) {
char padding[8];
int aux = (padbytes + 7) >> 2;
- BEGIN_RING(chan, ifc, NV01_IFC_COLOR(0), id);
+ BEGIN_NV04(chan, NV01_IFC(COLOR(0)), id);
OUT_RINGp (chan, src, id - aux);
memcpy(padding, src + (id - aux) * 4, padbytes);
OUT_RINGp (chan, padding, aux);
@@ -429,8 +422,7 @@ NV04EXARectM2MF(NVPtr pNv, int w, int h, int cpp,
int src_h, int src_x, int src_y, struct nouveau_bo *dst,
int dst_dom, int dst_pitch, int dst_h, int dst_x, int dst_y)
{
- struct nouveau_grobj *m2mf = pNv->NvMemFormat;
- struct nouveau_channel *chan = m2mf->channel;
+ struct nouveau_channel *chan = pNv->chan;
unsigned src_off = src_y * src_pitch + src_x * cpp;
unsigned dst_off = dst_y * dst_pitch + dst_x * cpp;
@@ -443,13 +435,13 @@ NV04EXARectM2MF(NVPtr pNv, int w, int h, int cpp,
if (MARK_RING (chan, 16, 4))
return FALSE;
- BEGIN_RING(chan, m2mf, NV03_M2MF_DMA_BUFFER_IN, 2);
+ BEGIN_NV04(chan, NV03_M2MF(DMA_BUFFER_IN), 2);
if (OUT_RELOCo(chan, src, src_dom | NOUVEAU_BO_RD) ||
OUT_RELOCo(chan, dst, dst_dom | NOUVEAU_BO_WR)) {
MARK_UNDO(chan);
return FALSE;
}
- BEGIN_RING(chan, m2mf, NV03_M2MF_OFFSET_IN, 8);
+ BEGIN_NV04(chan, NV03_M2MF(OFFSET_IN), 8);
if (OUT_RELOCl(chan, src, src_off, src_dom | NOUVEAU_BO_RD) ||
OUT_RELOCl(chan, dst, dst_off, dst_dom | NOUVEAU_BO_WR)) {
MARK_UNDO(chan);
@@ -461,9 +453,9 @@ NV04EXARectM2MF(NVPtr pNv, int w, int h, int cpp,
OUT_RING (chan, line_count);
OUT_RING (chan, 0x00000101);
OUT_RING (chan, 0x00000000);
- BEGIN_RING(chan, m2mf, NV04_GRAPH_NOP, 1);
+ BEGIN_NV04(chan, NV04_GRAPH(M2MF, NOP), 1);
OUT_RING (chan, 0x00000000);
- BEGIN_RING(chan, m2mf, NV03_M2MF_OFFSET_OUT, 1);
+ BEGIN_NV04(chan, NV03_M2MF(OFFSET_OUT), 1);
OUT_RING (chan, 0x00000000);
src_off += src_pitch * line_count;
View
22 src/nv04_xv_blit.c
@@ -34,8 +34,7 @@
#include "nv_include.h"
#include "nv_dma.h"
-#include "nv04_pushbuf.h"
-
+#include "hwdefs/nv_object.xml.h"
#include "hwdefs/nv01_2d.xml.h"
#define FOURCC_RGB 0x0000003
@@ -82,9 +81,6 @@ NVPutBlitImage(ScrnInfoPtr pScrn, struct nouveau_bo *src, int src_offset,
CARD32 dst_size, dst_point;
CARD32 src_point, src_format;
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *surf2d = pNv->NvContextSurfaces;
- struct nouveau_grobj *rect = pNv->NvRectangle;
- struct nouveau_grobj *sifm = pNv->NvScaledImage;
struct nouveau_bo *bo = nouveau_pixmap_bo(ppix);
int dst_format;
@@ -94,7 +90,7 @@ NVPutBlitImage(ScrnInfoPtr pScrn, struct nouveau_bo *src, int src_offset,
if (MARK_RING(chan, 64, 4))
return BadImplementation;
- BEGIN_RING(chan, surf2d, NV04_SURFACE_2D_FORMAT, 4);
+ BEGIN_NV04(chan, NV04_SF2D(FORMAT), 4);
OUT_RING (chan, dst_format);
OUT_RING (chan, (exaGetPixmapPitch(ppix) << 16) | exaGetPixmapPitch(ppix));
if (OUT_RELOCl(chan, bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR) ||
@@ -134,24 +130,26 @@ NVPutBlitImage(ScrnInfoPtr pScrn, struct nouveau_bo *src, int src_offset,
NV11SyncToVBlank(ppix, dstBox);
}
+ BEGIN_NV04(chan, NV01_SUBC(MISC, OBJECT), 1);
+ OUT_RING (chan, pNv->NvScaledImage->handle);
if (pNv->dev->chipset >= 0x05) {
- BEGIN_RING(chan, sifm, NV03_SIFM_COLOR_FORMAT, 2);
+ BEGIN_NV04(chan, NV03_SIFM(COLOR_FORMAT), 2);
OUT_RING (chan, src_format);
OUT_RING (chan, NV03_SIFM_OPERATION_SRCCOPY);
} else {
- BEGIN_RING(chan, sifm, NV03_SIFM_COLOR_FORMAT, 1);
+ BEGIN_NV04(chan, NV03_SIFM(COLOR_FORMAT), 1);
OUT_RING (chan, src_format);
}
- BEGIN_RING(chan, sifm, NV03_SIFM_DMA_IMAGE, 1);
+ BEGIN_NV04(chan, NV03_SIFM(DMA_IMAGE), 1);
OUT_RELOCo(chan, src, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART |
NOUVEAU_BO_RD);
while (nbox--) {
- BEGIN_RING(chan, rect, NV04_GDI_COLOR1_A, 1);
+ BEGIN_NV04(chan, NV04_RECT(COLOR1_A), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, sifm, NV03_SIFM_CLIP_POINT, 6);
+ BEGIN_NV04(chan, NV03_SIFM(CLIP_POINT), 6);
OUT_RING (chan, (pbox->y1 << 16) | pbox->x1);
OUT_RING (chan, ((pbox->y2 - pbox->y1) << 16) |
(pbox->x2 - pbox->x1));
@@ -160,7 +158,7 @@ NVPutBlitImage(ScrnInfoPtr pScrn, struct nouveau_bo *src, int src_offset,
OUT_RING (chan, dsdx);
OUT_RING (chan, dtdy);
- BEGIN_RING(chan, sifm, NV03_SIFM_SIZE, 4);
+ BEGIN_NV04(chan, NV03_SIFM(SIZE), 4);
OUT_RING (chan, (height << 16) | width);
OUT_RING (chan, src_pitch);
if (OUT_RELOCl(chan, src, src_offset, NOUVEAU_BO_VRAM |
View
173 src/nv10_exa.c
@@ -28,7 +28,6 @@
#endif
#include "nv_include.h"
-#include "nv04_pushbuf.h"
#include "hwdefs/nv_object.xml.h"
#include "hwdefs/nv10_3d.xml.h"
@@ -376,7 +375,6 @@ static Bool
setup_texture(NVPtr pNv, int unit, PicturePtr pict, PixmapPtr pixmap)
{
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *celsius = pNv->Nv3D;
struct nouveau_bo *bo = nouveau_pixmap_bo(pixmap);
unsigned tex_reloc = NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD;
long w = pict->pDrawable->width,
@@ -389,7 +387,7 @@ setup_texture(NVPtr pNv, int unit, PicturePtr pict, PixmapPtr pixmap)
get_tex_format(pict) |
0x50 /* UNK */;
- BEGIN_RING(chan, celsius, NV10_3D_TEX_OFFSET(unit), 1);
+ BEGIN_NV04(chan, NV10_3D(TEX_OFFSET(unit)), 1);
if (OUT_RELOCl(chan, bo, 0, tex_reloc))
return FALSE;
@@ -402,22 +400,22 @@ setup_texture(NVPtr pNv, int unit, PicturePtr pict, PixmapPtr pixmap)
*/
w = (w + 1) &~ 1;
- BEGIN_RING(chan, celsius, NV10_3D_TEX_NPOT_PITCH(unit), 1);
+ BEGIN_NV04(chan, NV10_3D(TEX_NPOT_PITCH(unit)), 1);
OUT_RING (chan, exaGetPixmapPitch(pixmap) << 16);
- BEGIN_RING(chan, celsius, NV10_3D_TEX_NPOT_SIZE(unit), 1);
+ BEGIN_NV04(chan, NV10_3D(TEX_NPOT_SIZE(unit)), 1);
OUT_RING (chan, w << 16 | h);
}
- BEGIN_RING(chan, celsius, NV10_3D_TEX_FORMAT(unit), 1 );
+ BEGIN_NV04(chan, NV10_3D(TEX_FORMAT(unit)), 1 );
if (OUT_RELOCd(chan, bo, txfmt, tex_reloc | NOUVEAU_BO_OR,
NV10_3D_TEX_FORMAT_DMA0, NV10_3D_TEX_FORMAT_DMA1))
return FALSE;
- BEGIN_RING(chan, celsius, NV10_3D_TEX_ENABLE(unit), 1 );
+ BEGIN_NV04(chan, NV10_3D(TEX_ENABLE(unit)), 1 );
OUT_RING (chan, NV10_3D_TEX_ENABLE_ENABLE);
- BEGIN_RING(chan, celsius, NV10_3D_TEX_FILTER(unit), 1);
+ BEGIN_NV04(chan, NV10_3D(TEX_FILTER(unit)), 1);
if (pict->filter == PictFilterNearest)
OUT_RING(chan, (NV10_3D_TEX_FILTER_MAGNIFY_NEAREST |
NV10_3D_TEX_FILTER_MINIFY_NEAREST));
@@ -432,15 +430,14 @@ static Bool
setup_render_target(NVPtr pNv, PicturePtr pict, PixmapPtr pixmap)
{
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *celsius = pNv->Nv3D;
struct nouveau_bo *bo = nouveau_pixmap_bo(pixmap);
- BEGIN_RING(chan, celsius, NV10_3D_RT_FORMAT, 2);
+ BEGIN_NV04(chan, NV10_3D(RT_FORMAT), 2);
OUT_RING (chan, get_rt_format(pict));
OUT_RING (chan, (exaGetPixmapPitch(pixmap) << 16 |
exaGetPixmapPitch(pixmap)));
- BEGIN_RING(chan, celsius, NV10_3D_COLOR_OFFSET, 1);
+ BEGIN_NV04(chan, NV10_3D(COLOR_OFFSET), 1);
if (OUT_RELOCl(chan, bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR))
return FALSE;
@@ -488,7 +485,6 @@ static void
setup_combiners(NVPtr pNv, PicturePtr src, PicturePtr mask)
{
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *celsius = pNv->Nv3D;
uint32_t rc_in_alpha = 0, rc_in_rgb = 0;
if (PICT_FORMAT_A(src->format))
@@ -532,9 +528,9 @@ setup_combiners(NVPtr pNv, PicturePtr src, PicturePtr mask)
rc_in_rgb |= RC_IN_ONE(B);
}
- BEGIN_RING(chan, celsius, NV10_3D_RC_IN_ALPHA(0), 1);
+ BEGIN_NV04(chan, NV10_3D(RC_IN_ALPHA(0)), 1);
OUT_RING (chan, rc_in_alpha);
- BEGIN_RING(chan, celsius, NV10_3D_RC_IN_RGB(0), 1);
+ BEGIN_NV04(chan, NV10_3D(RC_IN_RGB(0)), 1);
OUT_RING (chan, rc_in_rgb);
}
@@ -542,7 +538,6 @@ static void
setup_blend_function(NVPtr pNv)
{
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *celsius = pNv->Nv3D;
struct pict_op *op = &nv10_pict_op[pNv->alu];
int src_factor = op->src;
int dst_factor = op->dst;
@@ -562,10 +557,10 @@ setup_blend_function(NVPtr pNv)
dst_factor = DF(ONE_MINUS_SRC_COLOR);
}
- BEGIN_RING(chan, celsius, NV10_3D_BLEND_FUNC_SRC, 2);
+ BEGIN_NV04(chan, NV10_3D(BLEND_FUNC_SRC), 2);
OUT_RING (chan, src_factor);
OUT_RING (chan, dst_factor);
- BEGIN_RING(chan, celsius, NV10_3D_BLEND_FUNC_ENABLE, 1);
+ BEGIN_NV04(chan, NV10_3D(BLEND_FUNC_ENABLE), 1);
OUT_RING (chan, 1);
}
@@ -655,19 +650,18 @@ emit_vertex(NVPtr pNv, int i, PictVector pos[],
PictVector tex0[], PictVector tex1[])
{
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *celsius = pNv->Nv3D;
- BEGIN_RING(chan, celsius, NV10_3D_VERTEX_TX0_2F_S, 2);
+ BEGIN_NV04(chan, NV10_3D(VERTEX_TX0_2F_S), 2);
OUT_RINGi (chan, tex0[i], 0);
OUT_RINGi (chan, tex0[i], 1);
if (tex1) {
- BEGIN_RING(chan, celsius, NV10_3D_VERTEX_TX1_2F_S, 2);
+ BEGIN_NV04(chan, NV10_3D(VERTEX_TX1_2F_S), 2);
OUT_RINGi (chan, tex1[i], 0);
OUT_RINGi (chan, tex1[i], 1);
}
- BEGIN_RING(chan, celsius, NV10_3D_VERTEX_POS_3F_X, 3);
+ BEGIN_NV04(chan, NV10_3D(VERTEX_POS_3F_X), 3);
OUT_RINGi (chan, pos[i], 0);
OUT_RINGi (chan, pos[i], 1);
OUT_RINGf (chan, 0);
@@ -690,7 +684,6 @@ NV10EXAComposite(PixmapPtr pix_dst,
ScrnInfoPtr pScrn = xf86Screens[pix_dst->drawable.pScreen->myNum];
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *celsius = pNv->Nv3D;
PicturePtr mask = pNv->pmpict,
src = pNv->pspict;
PictVector dstq[4] = QUAD(dstX, dstY, width, height),
@@ -702,12 +695,12 @@ NV10EXAComposite(PixmapPtr pix_dst,
MAP(transform_vertex, mask->transform, maskq);
WAIT_RING (chan, 64);
- BEGIN_RING(chan, celsius, NV10_3D_VERTEX_BEGIN_END, 1);
+ BEGIN_NV04(chan, NV10_3D(VERTEX_BEGIN_END), 1);
OUT_RING (chan, NV10_3D_VERTEX_BEGIN_END_QUADS);
MAP(emit_vertex, pNv, dstq, srcq, mask ? maskq : NULL);
- BEGIN_RING(chan, celsius, NV10_3D_VERTEX_BEGIN_END, 1);
+ BEGIN_NV04(chan, NV10_3D(VERTEX_BEGIN_END), 1);
OUT_RING (chan, NV10_3D_VERTEX_BEGIN_END_STOP);
}
@@ -726,7 +719,6 @@ NVAccelInitNV10TCL(ScrnInfoPtr pScrn)
{
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *celsius;
uint32_t class = 0;
int i;
@@ -747,112 +739,113 @@ NVAccelInitNV10TCL(ScrnInfoPtr pScrn)
if (nouveau_grobj_alloc(pNv->chan, Nv3D, class, &pNv->Nv3D))
return FALSE;
}
- celsius = pNv->Nv3D;
- BEGIN_RING(chan, celsius, NV10_3D_DMA_NOTIFY, 1);
+ BEGIN_NV04(chan, NV01_SUBC(3D, OBJECT), 1);
+ OUT_RING (chan, pNv->Nv3D->handle);
+ BEGIN_NV04(chan, NV10_3D(DMA_NOTIFY), 1);
OUT_RING (chan, chan->nullobj->handle);
- BEGIN_RING(chan, celsius, NV10_3D_DMA_TEXTURE0, 2);
+ BEGIN_NV04(chan, NV10_3D(DMA_TEXTURE0), 2);
OUT_RING (chan, pNv->chan->vram->handle);
OUT_RING (chan, pNv->chan->gart->handle);
- BEGIN_RING(chan, celsius, NV10_3D_DMA_COLOR, 2);
+ BEGIN_NV04(chan, NV10_3D(DMA_COLOR), 2);
OUT_RING (chan, pNv->chan->vram->handle);
OUT_RING (chan, pNv->chan->vram->handle);
- BEGIN_RING(chan, celsius, NV04_GRAPH_NOP, 1);
+ BEGIN_NV04(chan, NV04_GRAPH(3D, NOP), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_RT_HORIZ, 2);
+ BEGIN_NV04(chan, NV10_3D(RT_HORIZ), 2);
OUT_RING (chan, 2048 << 16 | 0);
OUT_RING (chan, 2048 << 16 | 0);
- BEGIN_RING(chan, celsius, NV10_3D_ZETA_OFFSET, 1);
+ BEGIN_NV04(chan, NV10_3D(ZETA_OFFSET), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_VIEWPORT_CLIP_MODE, 1);
+ BEGIN_NV04(chan, NV10_3D(VIEWPORT_CLIP_MODE), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_VIEWPORT_CLIP_HORIZ(0), 1);
+ BEGIN_NV04(chan, NV10_3D(VIEWPORT_CLIP_HORIZ(0)), 1);
OUT_RING (chan, 0x7ff << 16 | 0x800800);
- BEGIN_RING(chan, celsius, NV10_3D_VIEWPORT_CLIP_VERT(0), 1);
+ BEGIN_NV04(chan, NV10_3D(VIEWPORT_CLIP_VERT(0)), 1);
OUT_RING (chan, 0x7ff << 16 | 0x800800);
for (i = 1; i < 8; i++) {
- BEGIN_RING(chan, celsius, NV10_3D_VIEWPORT_CLIP_HORIZ(i), 1);
+ BEGIN_NV04(chan, NV10_3D(VIEWPORT_CLIP_HORIZ(i)), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_VIEWPORT_CLIP_VERT(i), 1);
+ BEGIN_NV04(chan, NV10_3D(VIEWPORT_CLIP_VERT(i)), 1);
OUT_RING (chan, 0);
}
- BEGIN_RING(chan, celsius, 0x290, 1);
+ BEGIN_NV04(chan, SUBC_3D(0x290), 1);
OUT_RING (chan, (0x10<<16)|1);
- BEGIN_RING(chan, celsius, 0x3f4, 1);
+ BEGIN_NV04(chan, SUBC_3D(0x3f4), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV04_GRAPH_NOP, 1);
+ BEGIN_NV04(chan, NV04_GRAPH(3D, NOP), 1);
OUT_RING (chan, 0);
if (class != NV10_3D_CLASS) {
/* For nv11, nv17 */
- BEGIN_RING(chan, celsius, 0x120, 3);
+ BEGIN_NV04(chan, SUBC_3D(0x120), 3);
OUT_RING (chan, 0);
OUT_RING (chan, 1);
OUT_RING (chan, 2);
- BEGIN_RING(chan, pNv->NvImageBlit, 0x120, 3);
+ BEGIN_NV04(chan, SUBC_BLIT(0x120), 3);
OUT_RING (chan, 0);
OUT_RING (chan, 1);
OUT_RING (chan, 2);
- BEGIN_RING(chan, celsius, NV04_GRAPH_NOP, 1);
+ BEGIN_NV04(chan, NV04_GRAPH(3D, NOP), 1);
OUT_RING (chan, 0);
}
- BEGIN_RING(chan, celsius, NV04_GRAPH_NOP, 1);
+ BEGIN_NV04(chan, NV04_GRAPH(3D, NOP), 1);
OUT_RING (chan, 0);
/* Set state */
- BEGIN_RING(chan, celsius, NV10_3D_FOG_ENABLE, 1);
+ BEGIN_NV04(chan, NV10_3D(FOG_ENABLE), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_ALPHA_FUNC_ENABLE, 1);
+ BEGIN_NV04(chan, NV10_3D(ALPHA_FUNC_ENABLE), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_ALPHA_FUNC_FUNC, 2);
+ BEGIN_NV04(chan, NV10_3D(ALPHA_FUNC_FUNC), 2);
OUT_RING (chan, 0x207);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_TEX_ENABLE(0), 2);
+ BEGIN_NV04(chan, NV10_3D(TEX_ENABLE(0)), 2);
OUT_RING (chan, 0);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_RC_IN_ALPHA(0), 6);
+ BEGIN_NV04(chan, NV10_3D(RC_IN_ALPHA(0)), 6);
OUT_RING (chan, 0);
OUT_RING (chan, 0);
OUT_RING (chan, 0);
OUT_RING (chan, 0);
OUT_RING (chan, 0);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_RC_OUT_ALPHA(0), 6);
+ BEGIN_NV04(chan, NV10_3D(RC_OUT_ALPHA(0)), 6);
OUT_RING (chan, 0x00000c00);
OUT_RING (chan, 0);
OUT_RING (chan, 0x00000c00);
OUT_RING (chan, 0x18000000);
OUT_RING (chan, 0x300c0000);
OUT_RING (chan, 0x00001c80);
- BEGIN_RING(chan, celsius, NV10_3D_BLEND_FUNC_ENABLE, 1);
+ BEGIN_NV04(chan, NV10_3D(BLEND_FUNC_ENABLE), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_DITHER_ENABLE, 2);
+ BEGIN_NV04(chan, NV10_3D(DITHER_ENABLE), 2);
OUT_RING (chan, 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_LINE_SMOOTH_ENABLE, 1);
+ BEGIN_NV04(chan, NV10_3D(LINE_SMOOTH_ENABLE), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_VERTEX_WEIGHT_ENABLE, 2);
+ BEGIN_NV04(chan, NV10_3D(VERTEX_WEIGHT_ENABLE), 2);
OUT_RING (chan, 0);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_BLEND_FUNC_SRC, 4);
+ BEGIN_NV04(chan, NV10_3D(BLEND_FUNC_SRC), 4);
OUT_RING (chan, 1);
OUT_RING (chan, 0);
OUT_RING (chan, 0);
OUT_RING (chan, 0x8006);
- BEGIN_RING(chan, celsius, NV10_3D_STENCIL_MASK, 8);
+ BEGIN_NV04(chan, NV10_3D(STENCIL_MASK), 8);
OUT_RING (chan, 0xff);
OUT_RING (chan, 0x207);
OUT_RING (chan, 0);
@@ -861,113 +854,113 @@ NVAccelInitNV10TCL(ScrnInfoPtr pScrn)
OUT_RING (chan, 0x1e00);
OUT_RING (chan, 0x1e00);
OUT_RING (chan, 0x1d01);
- BEGIN_RING(chan, celsius, NV10_3D_NORMALIZE_ENABLE, 1);
+ BEGIN_NV04(chan, NV10_3D(NORMALIZE_ENABLE), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_FOG_ENABLE, 2);
+ BEGIN_NV04(chan, NV10_3D(FOG_ENABLE), 2);
OUT_RING (chan, 0);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_LIGHT_MODEL, 1);
+ BEGIN_NV04(chan, NV10_3D(LIGHT_MODEL), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_SEPARATE_SPECULAR_ENABLE, 1);
+ BEGIN_NV04(chan, NV10_3D(SEPARATE_SPECULAR_ENABLE), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_ENABLED_LIGHTS, 1);
+ BEGIN_NV04(chan, NV10_3D(ENABLED_LIGHTS), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_POLYGON_OFFSET_POINT_ENABLE, 3);
+ BEGIN_NV04(chan, NV10_3D(POLYGON_OFFSET_POINT_ENABLE), 3);
OUT_RING (chan, 0);
OUT_RING (chan, 0);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_DEPTH_FUNC, 1);
+ BEGIN_NV04(chan, NV10_3D(DEPTH_FUNC), 1);
OUT_RING (chan, 0x201);
- BEGIN_RING(chan, celsius, NV10_3D_DEPTH_WRITE_ENABLE, 1);
+ BEGIN_NV04(chan, NV10_3D(DEPTH_WRITE_ENABLE), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_DEPTH_TEST_ENABLE, 1);
+ BEGIN_NV04(chan, NV10_3D(DEPTH_TEST_ENABLE), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_POLYGON_OFFSET_FACTOR, 2);
+ BEGIN_NV04(chan, NV10_3D(POLYGON_OFFSET_FACTOR), 2);
OUT_RING (chan, 0);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_POINT_SIZE, 1);
+ BEGIN_NV04(chan, NV10_3D(POINT_SIZE), 1);
OUT_RING (chan, 8);
- BEGIN_RING(chan, celsius, NV10_3D_POINT_PARAMETERS_ENABLE, 2);
+ BEGIN_NV04(chan, NV10_3D(POINT_PARAMETERS_ENABLE), 2);
OUT_RING (chan, 0);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_LINE_WIDTH, 1);
+ BEGIN_NV04(chan, NV10_3D(LINE_WIDTH), 1);
OUT_RING (chan, 8);
- BEGIN_RING(chan, celsius, NV10_3D_LINE_SMOOTH_ENABLE, 1);
+ BEGIN_NV04(chan, NV10_3D(LINE_SMOOTH_ENABLE), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_POLYGON_MODE_FRONT, 2);
+ BEGIN_NV04(chan, NV10_3D(POLYGON_MODE_FRONT), 2);
OUT_RING (chan, 0x1b02);
OUT_RING (chan, 0x1b02);
- BEGIN_RING(chan, celsius, NV10_3D_CULL_FACE, 2);
+ BEGIN_NV04(chan, NV10_3D(CULL_FACE), 2);
OUT_RING (chan, 0x405);
OUT_RING (chan, 0x901);
- BEGIN_RING(chan, celsius, NV10_3D_POLYGON_SMOOTH_ENABLE, 1);
+ BEGIN_NV04(chan, NV10_3D(POLYGON_SMOOTH_ENABLE), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_CULL_FACE_ENABLE, 1);
+ BEGIN_NV04(chan, NV10_3D(CULL_FACE_ENABLE), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_TEX_GEN_MODE(0, 0), 8);
+ BEGIN_NV04(chan, NV10_3D(TEX_GEN_MODE(0, 0)), 8);
for (i = 0; i < 8; i++)
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_FOG_COEFF(0), 3);
+ BEGIN_NV04(chan, NV10_3D(FOG_COEFF(0)), 3);
OUT_RING (chan, 0x3fc00000); /* -1.50 */
OUT_RING (chan, 0xbdb8aa0a); /* -0.09 */
OUT_RING (chan, 0); /* 0.00 */
- BEGIN_RING(chan, celsius, NV04_GRAPH_NOP, 1);
+ BEGIN_NV04(chan, NV04_GRAPH(3D, NOP), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_FOG_MODE, 2);
+ BEGIN_NV04(chan, NV10_3D(FOG_MODE), 2);
OUT_RING (chan, 0x802);
OUT_RING (chan, 2);
/* for some reason VIEW_MATRIX_ENABLE need to be 6 instead of 4 when
* using texturing, except when using the texture matrix
*/
- BEGIN_RING(chan, celsius, NV10_3D_VIEW_MATRIX_ENABLE, 1);
+ BEGIN_NV04(chan, NV10_3D(VIEW_MATRIX_ENABLE), 1);
OUT_RING (chan, 6);
- BEGIN_RING(chan, celsius, NV10_3D_COLOR_MASK, 1);
+ BEGIN_NV04(chan, NV10_3D(COLOR_MASK), 1);
OUT_RING (chan, 0x01010101);
- BEGIN_RING(chan, celsius, NV10_3D_PROJECTION_MATRIX(0), 16);
+ BEGIN_NV04(chan, NV10_3D(PROJECTION_MATRIX(0)), 16);
for(i = 0; i < 16; i++)
OUT_RINGf(chan, i/4 == i%4 ? 1.0 : 0.0);
- BEGIN_RING(chan, celsius, NV10_3D_DEPTH_RANGE_NEAR, 2);
+ BEGIN_NV04(chan, NV10_3D(DEPTH_RANGE_NEAR), 2);
OUT_RING (chan, 0);
OUT_RINGf (chan, 65536.0);
- BEGIN_RING(chan, celsius, NV10_3D_VIEWPORT_TRANSLATE_X, 4);
+ BEGIN_NV04(chan, NV10_3D(VIEWPORT_TRANSLATE_X), 4);
OUT_RINGf (chan, -2048.0);
OUT_RINGf (chan, -2048.0);
OUT_RINGf (chan, 0);
OUT_RING (chan, 0);
/* Set vertex component */
- BEGIN_RING(chan, celsius, NV10_3D_VERTEX_COL_4F_R, 4);
+ BEGIN_NV04(chan, NV10_3D(VERTEX_COL_4F_R), 4);
OUT_RINGf (chan, 1.0);
OUT_RINGf (chan, 1.0);
OUT_RINGf (chan, 1.0);
OUT_RINGf (chan, 1.0);
- BEGIN_RING(chan, celsius, NV10_3D_VERTEX_COL2_3F_R, 3);
+ BEGIN_NV04(chan, NV10_3D(VERTEX_COL2_3F_R), 3);
OUT_RING (chan, 0);
OUT_RING (chan, 0);
OUT_RING (chan, 0);
- BEGIN_RING(chan, celsius, NV10_3D_VERTEX_NOR_3F_X, 3);
+ BEGIN_NV04(chan, NV10_3D(VERTEX_NOR_3F_X), 3);
OUT_RING (chan, 0);
OUT_RING (chan, 0);
OUT_RINGf (chan, 1.0);
- BEGIN_RING(chan, celsius, NV10_3D_VERTEX_TX0_4F_S, 4);
+ BEGIN_NV04(chan, NV10_3D(VERTEX_TX0_4F_S), 4);
OUT_RINGf (chan, 0.0);
OUT_RINGf (chan, 0.0);
OUT_RINGf (chan, 0.0);
OUT_RINGf (chan, 1.0);
- BEGIN_RING(chan, celsius, NV10_3D_VERTEX_TX1_4F_S, 4);
+ BEGIN_NV04(chan, NV10_3D(VERTEX_TX1_4F_S), 4);
OUT_RINGf (chan, 0.0);
OUT_RINGf (chan, 0.0);
OUT_RINGf (chan, 0.0);
OUT_RINGf (chan, 1.0);
- BEGIN_RING(chan, celsius, NV10_3D_VERTEX_FOG_1F, 1);
+ BEGIN_NV04(chan, NV10_3D(VERTEX_FOG_1F), 1);
OUT_RINGf (chan, 0.0);
- BEGIN_RING(chan, celsius, NV10_3D_EDGEFLAG_ENABLE, 1);
+ BEGIN_NV04(chan, NV10_3D(EDGEFLAG_ENABLE), 1);
OUT_RING (chan, 1);
return TRUE;
View
120 src/nv30_exa.c
@@ -25,7 +25,6 @@
#include "nv_include.h"
#include "nv30_shaders.h"
-#include "nv04_pushbuf.h"
#include "hwdefs/nv_object.xml.h"
#include "hwdefs/nv30-40_3d.xml.h"
@@ -260,7 +259,6 @@ NV30_SetupBlend(ScrnInfoPtr pScrn, nv_pict_op_t *blend,
{
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *rankine = pNv->Nv3D;
uint32_t sblend, dblend;
sblend = blend->src_card_op;
@@ -291,10 +289,10 @@ NV30_SetupBlend(ScrnInfoPtr pScrn, nv_pict_op_t *blend,
}
if (sblend == BF(ONE) && dblend == BF(ZERO)) {
- BEGIN_RING(chan, rankine, NV30_3D_BLEND_FUNC_ENABLE, 1);
+ BEGIN_NV04(chan, NV30_3D(BLEND_FUNC_ENABLE), 1);
OUT_RING (chan, 0);
} else {
- BEGIN_RING(chan, rankine, NV30_3D_BLEND_FUNC_ENABLE, 3);
+ BEGIN_NV04(chan, NV30_3D(BLEND_FUNC_ENABLE), 3);
OUT_RING (chan, 1);
OUT_RING (chan, (sblend << 16) | sblend);
OUT_RING (chan, (dblend << 16) | dblend);
@@ -306,7 +304,6 @@ NV30EXATexture(ScrnInfoPtr pScrn, PixmapPtr pPix, PicturePtr pPict, int unit)
{
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *rankine = pNv->Nv3D;
struct nouveau_bo *bo = nouveau_pixmap_bo(pPix);
nv_pict_texture_format_t *fmt;
uint32_t card_filter, card_repeat;
@@ -324,7 +321,7 @@ NV30EXATexture(ScrnInfoPtr pScrn, PixmapPtr pPix, PicturePtr pPict, int unit)
else
card_filter = 1;
- BEGIN_RING(chan, rankine, NV30_3D_TEX_OFFSET(unit), 8);
+ BEGIN_NV04(chan, NV30_3D(TEX_OFFSET(unit)), 8);
if (OUT_RELOCl(chan, bo, 0, tex_reloc) ||
OUT_RELOCd(chan, bo, NV30_3D_TEX_FORMAT_DIMS_2D | (1 << 16) | 8 |
(fmt->card_fmt << NV30_3D_TEX_FORMAT_FORMAT__SHIFT) |
@@ -360,7 +357,6 @@ NV30_SetupSurface(ScrnInfoPtr pScrn, PixmapPtr pPix, PicturePtr pPict)
{
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *rankine = pNv->Nv3D;
struct nouveau_bo *bo = nouveau_pixmap_bo(pPix);
nv_pict_surface_format_t *fmt;
@@ -372,7 +368,7 @@ NV30_SetupSurface(ScrnInfoPtr pScrn, PixmapPtr pPix, PicturePtr pPict)
uint32_t pitch = (uint32_t)exaGetPixmapPitch(pPix);
- BEGIN_RING(chan, rankine, NV30_3D_RT_FORMAT, 3);
+ BEGIN_NV04(chan, NV30_3D(RT_FORMAT), 3);
OUT_RING (chan, fmt->card_fmt); /* format */
OUT_RING (chan, pitch << 16 | pitch);
if (OUT_RELOCl(chan, bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR))
@@ -474,7 +470,6 @@ NV30EXAPrepareComposite(int op, PicturePtr psPict,
ScrnInfoPtr pScrn = xf86Screens[psPix->drawable.pScreen->myNum];
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *rankine = pNv->Nv3D;
nv_pict_op_t *blend;
int fpid = NV30EXA_FPID_PASS_COL0;
NV30EXA_STATE;
@@ -536,7 +531,7 @@ NV30EXAPrepareComposite(int op, PicturePtr psPict,
return FALSE;
}
- BEGIN_RING(chan, rankine, 0x23c, 1);
+ BEGIN_NV04(chan, SUBC_3D(0x23c), 1);
OUT_RING (chan, pmPict?3:1);
pNv->alu = op;
@@ -573,16 +568,16 @@ NV30EXATransformCoord(PictTransformPtr t, int x, int y, float sx, float sy,
}
#define CV_OUTm(sx,sy,mx,my,dx,dy) do { \
- BEGIN_RING(chan, rankine, NV30_3D_VTX_ATTR_2F_X(8), 4); \
+ BEGIN_NV04(chan, NV30_3D(VTX_ATTR_2F_X(8)), 4); \
OUT_RINGf (chan, (sx)); OUT_RINGf (chan, (sy)); \
OUT_RINGf (chan, (mx)); OUT_RINGf (chan, (my)); \
- BEGIN_RING(chan, rankine, NV30_3D_VTX_ATTR_2I(0), 1); \
+ BEGIN_NV04(chan, NV30_3D(VTX_ATTR_2I(0)), 1); \
OUT_RING (chan, ((dy)<<16)|(dx)); \
} while(0)
#define CV_OUT(sx,sy,dx,dy) do { \
- BEGIN_RING(chan, rankine, NV30_3D_VTX_ATTR_2F_X(8), 2); \
+ BEGIN_NV04(chan, NV30_3D(VTX_ATTR_2F_X(8)), 2); \
OUT_RINGf (chan, (sx)); OUT_RINGf (chan, (sy)); \
- BEGIN_RING(chan, rankine, NV30_3D_VTX_ATTR_2I(0), 1); \
+ BEGIN_NV04(chan, NV30_3D(VTX_ATTR_2I(0)), 1); \
OUT_RING (chan, ((dy)<<16)|(dx)); \
} while(0)
@@ -595,7 +590,6 @@ NV30EXAComposite(PixmapPtr pdPix, int srcX , int srcY,
ScrnInfoPtr pScrn = xf86Screens[pdPix->drawable.pScreen->myNum];
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *rankine = pNv->Nv3D;
float sX0, sX1, sX2, sY0, sY1, sY2;
float mX0, mX1, mX2, mY0, mY1, mY2;
NV30EXA_STATE;
@@ -605,10 +599,10 @@ NV30EXAComposite(PixmapPtr pdPix, int srcX , int srcY,
/* We're drawing a triangle, we need to scissor it to a quad. */
/* The scissors are here for a good reason, we don't get the full image, but just a part. */
/* Handling the cliprects is done for us already. */
- BEGIN_RING(chan, rankine, NV30_3D_SCISSOR_HORIZ, 2);
+ BEGIN_NV04(chan, NV30_3D(SCISSOR_HORIZ), 2);
OUT_RING (chan, (width << 16) | dstX);
OUT_RING (chan, (height << 16) | dstY);
- BEGIN_RING(chan, rankine, NV30_3D_VERTEX_BEGIN_END, 1);
+ BEGIN_NV04(chan, NV30_3D(VERTEX_BEGIN_END), 1);
OUT_RING (chan, NV30_3D_VERTEX_BEGIN_END_TRIANGLES);
#if 0
@@ -650,7 +644,7 @@ NV30EXAComposite(PixmapPtr pdPix, int srcX , int srcY,
CV_OUT(sX2 , sY2 , dstX + 2*width , dstY + height);
}
- BEGIN_RING(chan, rankine, NV30_3D_VERTEX_BEGIN_END, 1);
+ BEGIN_NV04(chan, NV30_3D(VERTEX_BEGIN_END), 1);
OUT_RING (chan, 0);
}
@@ -669,7 +663,6 @@ NVAccelInitNV30TCL(ScrnInfoPtr pScrn)
{
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *rankine;
uint32_t class = 0, chipset;
int next_hw_offset = 0, i;
@@ -702,7 +695,6 @@ NVAccelInitNV30TCL(ScrnInfoPtr pScrn)
if (nouveau_grobj_alloc(chan, Nv3D, class, &pNv->Nv3D))
return FALSE;
}
- rankine = pNv->Nv3D;
if (!pNv->shader_mem) {
if (nouveau_bo_new(pNv->dev, NOUVEAU_BO_VRAM | NOUVEAU_BO_MAP,
@@ -714,113 +706,115 @@ NVAccelInitNV30TCL(ScrnInfoPtr pScrn)
}
}
- BEGIN_RING(chan, rankine, NV30_3D_DMA_TEXTURE0, 3);
+ BEGIN_NV04(chan, NV01_SUBC(3D, OBJECT), 1);
+ OUT_RING (chan, pNv->Nv3D->handle);
+ BEGIN_NV04(chan, NV30_3D(DMA_TEXTURE0), 3);
OUT_RING (chan, pNv->chan->vram->handle);
OUT_RING (chan, pNv->chan->gart->handle);
OUT_RING (chan, pNv->chan->vram->handle);
- BEGIN_RING(chan, rankine, NV30_3D_DMA_UNK1AC, 1);
+ BEGIN_NV04(chan, NV30_3D(DMA_UNK1AC), 1);
OUT_RING (chan, pNv->chan->vram->handle);
- BEGIN_RING(chan, rankine, NV30_3D_DMA_COLOR0, 2);
+ BEGIN_NV04(chan, NV30_3D(DMA_COLOR0), 2);
OUT_RING (chan, pNv->chan->vram->handle);
OUT_RING (chan, pNv->chan->vram->handle);
- BEGIN_RING(chan, rankine, NV30_3D_DMA_UNK1B0, 1);
+ BEGIN_NV04(chan, NV30_3D(DMA_UNK1B0), 1);
OUT_RING (chan, pNv->chan->vram->handle);
for (i=1; i<8; i++) {
- BEGIN_RING(chan, rankine, NV30_3D_VIEWPORT_CLIP_HORIZ(i), 2);
+ BEGIN_NV04(chan, NV30_3D(VIEWPORT_CLIP_HORIZ(i)), 2);
OUT_RING (chan, 0);
OUT_RING (chan, 0);
}
- BEGIN_RING(chan, rankine, 0x220, 1);
+ BEGIN_NV04(chan, SUBC_3D(0x220), 1);
OUT_RING (chan, 1);
- BEGIN_RING(chan, rankine, 0x03b0, 1);
+ BEGIN_NV04(chan, SUBC_3D(0x03b0), 1);
OUT_RING (chan, 0x00100000);
- BEGIN_RING(chan, rankine, 0x1454, 1);
+ BEGIN_NV04(chan, SUBC_3D(0x1454), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, rankine, 0x1d80, 1);
+ BEGIN_NV04(chan, SUBC_3D(0x1d80), 1);
OUT_RING (chan, 3);
- BEGIN_RING(chan, rankine, 0x1450, 1);
+ BEGIN_NV04(chan, SUBC_3D(0x1450), 1);
OUT_RING (chan, 0x00030004);
/* NEW */
- BEGIN_RING(chan, rankine, 0x1e98, 1);
+ BEGIN_NV04(chan, SUBC_3D(0x1e98), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, rankine, 0x17e0, 3);
+ BEGIN_NV04(chan, SUBC_3D(0x17e0), 3);
OUT_RING (chan, 0);
OUT_RING (chan, 0);
OUT_RING (chan, 0x3f800000);
- BEGIN_RING(chan, rankine, 0x1f80, 16);
+ BEGIN_NV04(chan, SUBC_3D(0x1f80), 16);
OUT_RING (chan, 0); OUT_RING (chan, 0); OUT_RING (chan, 0); OUT_RING (chan, 0);
OUT_RING (chan, 0); OUT_RING (chan, 0); OUT_RING (chan, 0); OUT_RING (chan, 0);
OUT_RING (chan, 0x0000ffff);
OUT_RING (chan, 0); OUT_RING (chan, 0); OUT_RING (chan, 0); OUT_RING (chan, 0);
OUT_RING (chan, 0); OUT_RING (chan, 0); OUT_RING (chan, 0);
- BEGIN_RING(chan, rankine, 0x120, 3);
+ BEGIN_NV04(chan, SUBC_3D(0x120), 3);
OUT_RING (chan, 0);
OUT_RING (chan, 1);
OUT_RING (chan, 2);
- BEGIN_RING(chan, pNv->NvImageBlit, 0x120, 3);
+ BEGIN_NV04(chan, SUBC_BLIT(0x120), 3);
OUT_RING (chan, 0);
OUT_RING (chan, 1);
OUT_RING (chan, 2);
- BEGIN_RING(chan, rankine, 0x1d88, 1);
+ BEGIN_NV04(chan, SUBC_3D(0x1d88), 1);
OUT_RING (chan, 0x00001200);
- BEGIN_RING(chan, rankine, NV30_3D_RC_ENABLE, 1);
+ BEGIN_NV04(chan, NV30_3D(RC_ENABLE), 1);
OUT_RING (chan, 0);
/* Attempt to setup a known state.. Probably missing a heap of
* stuff here..
*/
- BEGIN_RING(chan, rankine, NV30_3D_STENCIL_ENABLE(0), 1);
+ BEGIN_NV04(chan, NV30_3D(STENCIL_ENABLE(0)), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, rankine, NV30_3D_STENCIL_ENABLE(1), 1);
+ BEGIN_NV04(chan, NV30_3D(STENCIL_ENABLE(1)), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, rankine, NV30_3D_ALPHA_FUNC_ENABLE, 1);
+ BEGIN_NV04(chan, NV30_3D(ALPHA_FUNC_ENABLE), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, rankine, NV30_3D_DEPTH_WRITE_ENABLE, 2);
+ BEGIN_NV04(chan, NV30_3D(DEPTH_WRITE_ENABLE), 2);
OUT_RING (chan, 0); /* wr disable */
OUT_RING (chan, 0); /* test disable */
- BEGIN_RING(chan, rankine, NV30_3D_COLOR_MASK, 1);
+ BEGIN_NV04(chan, NV30_3D(COLOR_MASK), 1);
OUT_RING (chan, 0x01010101); /* TR,TR,TR,TR */
- BEGIN_RING(chan, rankine, NV30_3D_CULL_FACE_ENABLE, 1);
+ BEGIN_NV04(chan, NV30_3D(CULL_FACE_ENABLE), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, rankine, NV30_3D_BLEND_FUNC_ENABLE, 5);
+ BEGIN_NV04(chan, NV30_3D(BLEND_FUNC_ENABLE), 5);
OUT_RING (chan, 0); /* Blend enable */
OUT_RING (chan, 0); /* Blend src */
OUT_RING (chan, 0); /* Blend dst */
OUT_RING (chan, 0x00000000); /* Blend colour */
OUT_RING (chan, 0x8006); /* FUNC_ADD */
- BEGIN_RING(chan, rankine, NV30_3D_COLOR_LOGIC_OP_ENABLE, 2);
+ BEGIN_NV04(chan, NV30_3D(COLOR_LOGIC_OP_ENABLE), 2);
OUT_RING (chan, 0);
OUT_RING (chan, 0x1503 /*GL_COPY*/);
- BEGIN_RING(chan, rankine, NV30_3D_DITHER_ENABLE, 1);
+ BEGIN_NV04(chan, NV30_3D(DITHER_ENABLE), 1);
OUT_RING (chan, 1);
- BEGIN_RING(chan, rankine, NV30_3D_SHADE_MODEL, 1);
+ BEGIN_NV04(chan, NV30_3D(SHADE_MODEL), 1);
OUT_RING (chan, 0x1d01 /*GL_SMOOTH*/);
- BEGIN_RING(chan, rankine, NV30_3D_POLYGON_OFFSET_FACTOR,2);
+ BEGIN_NV04(chan, NV30_3D(POLYGON_OFFSET_FACTOR),2);
OUT_RINGf (chan, 0.0);
OUT_RINGf (chan, 0.0);
- BEGIN_RING(chan, rankine, NV30_3D_POLYGON_MODE_FRONT, 2);
+ BEGIN_NV04(chan, NV30_3D(POLYGON_MODE_FRONT), 2);
OUT_RING (chan, 0x1b02 /*GL_FILL*/);
OUT_RING (chan, 0x1b02 /*GL_FILL*/);
/* - Disable texture units
* - Set fragprog to MOVR result.color, fragment.color */
for (i=0;i<4;i++) {
- BEGIN_RING(chan, rankine, NV30_3D_TEX_ENABLE(i), 1);
+ BEGIN_NV04(chan, NV30_3D(TEX_ENABLE(i)), 1);
OUT_RING (chan, 0);
}
/* Polygon stipple */
- BEGIN_RING(chan, rankine, NV30_3D_POLYGON_STIPPLE_PATTERN(0), 0x20);
+ BEGIN_NV04(chan, NV30_3D(POLYGON_STIPPLE_PATTERN(0)), 0x20);
for (i=0;i<0x20;i++)
OUT_RING (chan, 0xFFFFFFFF);
- BEGIN_RING(chan, rankine, NV30_3D_DEPTH_RANGE_NEAR, 2);
+ BEGIN_NV04(chan, NV30_3D(DEPTH_RANGE_NEAR), 2);
OUT_RINGf (chan, 0.0);
OUT_RINGf (chan, 1.0);
@@ -830,34 +824,34 @@ NVAccelInitNV30TCL(ScrnInfoPtr pScrn)
* it's not needed between nouveau restarts - which suggests that
* the 3D context (wherever it's stored?) survives somehow.
*/
- //BEGIN_RING(chan, rankine, 0x1d60,1);
+ //BEGIN_NV04(chan, SUBC_3D(0x1d60),1);
//OUT_RING (chan, 0x03008000);
int w=4096;
int h=4096;
int pitch=4096*4;
- BEGIN_RING(chan, rankine, NV30_3D_RT_HORIZ, 5);
+ BEGIN_NV04(chan, NV30_3D(RT_HORIZ), 5);
OUT_RING (chan, w<<16);
OUT_RING (chan, h<<16);
OUT_RING (chan, 0x148); /* format */
OUT_RING (chan, pitch << 16 | pitch);
OUT_RING (chan, 0x0);
- BEGIN_RING(chan, rankine, NV30_3D_VIEWPORT_TX_ORIGIN, 1);
+ BEGIN_NV04(chan, NV30_3D(VIEWPORT_TX_ORIGIN), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, rankine, 0x0a00, 2);
+ BEGIN_NV04(chan, SUBC_3D(0x0a00), 2);
OUT_RING (chan, (w<<16) | 0);
OUT_RING (chan, (h<<16) | 0);
- BEGIN_RING(chan, rankine, NV30_3D_VIEWPORT_CLIP_HORIZ(0), 2);
+ BEGIN_NV04(chan, NV30_3D(VIEWPORT_CLIP_HORIZ(0)), 2);
OUT_RING (chan, (w-1)<<16);
OUT_RING (chan, (h-1)<<16);
- BEGIN_RING(chan, rankine, NV30_3D_SCISSOR_HORIZ, 2);
+ BEGIN_NV04(chan, NV30_3D(SCISSOR_HORIZ), 2);
OUT_RING (chan, w<<16);
OUT_RING (chan, h<<16);
- BEGIN_RING(chan, rankine, NV30_3D_VIEWPORT_HORIZ, 2);
+ BEGIN_NV04(chan, NV30_3D(VIEWPORT_HORIZ), 2);
OUT_RING (chan, w<<16);
OUT_RING (chan, h<<16);
- BEGIN_RING(chan, rankine, NV30_3D_VIEWPORT_TRANSLATE_X, 8);
+ BEGIN_NV04(chan, NV30_3D(VIEWPORT_TRANSLATE_X), 8);
OUT_RINGf (chan, 0.0);
OUT_RINGf (chan, 0.0);
OUT_RINGf (chan, 0.0);
@@ -867,7 +861,7 @@ NVAccelInitNV30TCL(ScrnInfoPtr pScrn)
OUT_RINGf (chan, 1.0);
OUT_RINGf (chan, 0.0);
- BEGIN_RING(chan, rankine, NV30_3D_MODELVIEW_MATRIX(0), 16);
+ BEGIN_NV04(chan, NV30_3D(MODELVIEW_MATRIX(0)), 16);
OUT_RINGf (chan, 1.0);
OUT_RINGf (chan, 0.0);
OUT_RINGf (chan, 0.0);
@@ -885,7 +879,7 @@ NVAccelInitNV30TCL(ScrnInfoPtr pScrn)
OUT_RINGf (chan, 0.0);
OUT_RINGf (chan, 1.0);
- BEGIN_RING(chan, rankine, NV30_3D_PROJECTION_MATRIX(0), 16);
+ BEGIN_NV04(chan, NV30_3D(PROJECTION_MATRIX(0)), 16);
OUT_RINGf (chan, 1.0);
OUT_RINGf (chan, 0.0);
OUT_RINGf (chan, 0.0);
@@ -903,7 +897,7 @@ NVAccelInitNV30TCL(ScrnInfoPtr pScrn)
OUT_RINGf (chan, 0.0);
OUT_RINGf (chan, 1.0);
- BEGIN_RING(chan, rankine, NV30_3D_SCISSOR_HORIZ, 2);
+ BEGIN_NV04(chan, NV30_3D(SCISSOR_HORIZ), 2);
OUT_RING (chan, 4096<<16);
OUT_RING (chan, 4096<<16);
View
25 src/nv30_shaders.c
@@ -22,7 +22,6 @@
#include "nv30_shaders.h"
-#include "nv04_pushbuf.h"
#include "hwdefs/nv30-40_3d.xml.h"
@@ -51,15 +50,14 @@ void NV30_UploadFragProg(NVPtr pNv, nv_shader_t *shader, int *hw_offset)
void NV40_UploadVtxProg(NVPtr pNv, nv_shader_t *shader, int *hw_id)
{
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *curie = pNv->Nv3D;
int i;
shader->hw_id = *hw_id;
- BEGIN_RING(chan, curie, NV30_3D_VP_UPLOAD_FROM_ID, 1);
+ BEGIN_NV04(chan, NV30_3D(VP_UPLOAD_FROM_ID), 1);
OUT_RING (chan, (shader->hw_id));
for (i=0; i<shader->size; i+=4) {
- BEGIN_RING(chan, curie, NV30_3D_VP_UPLOAD_INST(0), 4);
+ BEGIN_NV04(chan, NV30_3D(VP_UPLOAD_INST(0)), 4);
OUT_RING (chan, shader->data[i + 0]);
OUT_RING (chan, shader->data[i + 1]);
OUT_RING (chan, shader->data[i + 2]);
@@ -73,20 +71,19 @@ NV30_LoadFragProg(ScrnInfoPtr pScrn, nv_shader_t *shader)
{
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *rankine = pNv->Nv3D;
- BEGIN_RING(chan, rankine, NV30_3D_FP_ACTIVE_PROGRAM, 1);
+ BEGIN_NV04(chan, NV30_3D(FP_ACTIVE_PROGRAM), 1);
if (OUT_RELOC(chan, pNv->shader_mem, shader->hw_id, NOUVEAU_BO_VRAM |
NOUVEAU_BO_RD | NOUVEAU_BO_LOW | NOUVEAU_BO_OR,
NV30_3D_FP_ACTIVE_PROGRAM_DMA0,
NV30_3D_FP_ACTIVE_PROGRAM_DMA1))
return FALSE;
- BEGIN_RING(chan, rankine, NV30_3D_FP_REG_CONTROL, 1);
+ BEGIN_NV04(chan, NV30_3D(FP_REG_CONTROL), 1);
OUT_RING (chan, (1 << 16)| 0xf);
- BEGIN_RING(chan, rankine, NV30_3D_MULTISAMPLE_CONTROL, 1);
+ BEGIN_NV04(chan, NV30_3D(MULTISAMPLE_CONTROL), 1);
OUT_RING (chan, 0xffff0000);
- BEGIN_RING(chan, rankine, NV30_3D_FP_CONTROL,1);
+ BEGIN_NV04(chan, NV30_3D(FP_CONTROL),1);
OUT_RING (chan, (shader->card_priv.NV30FP.num_regs-1)/2);
return TRUE;
@@ -97,11 +94,10 @@ NV40_LoadVtxProg(ScrnInfoPtr pScrn, nv_shader_t *shader)
{
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *curie = pNv->Nv3D;
- BEGIN_RING(chan, curie, NV30_3D_VP_START_FROM_ID, 1);
+ BEGIN_NV04(chan, NV30_3D(VP_START_FROM_ID), 1);
OUT_RING (chan, (shader->hw_id));
- BEGIN_RING(chan, curie, NV40_3D_VP_ATTRIB_EN, 2);
+ BEGIN_NV04(chan, NV40_3D(VP_ATTRIB_EN), 2);
OUT_RING (chan, shader->card_priv.NV30VP.vp_in_reg);
OUT_RING (chan, shader->card_priv.NV30VP.vp_out_reg);
}
@@ -111,16 +107,15 @@ NV40_LoadFragProg(ScrnInfoPtr pScrn, nv_shader_t *shader)
{
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *curie = pNv->Nv3D;
- BEGIN_RING(chan, curie, NV30_3D_FP_ACTIVE_PROGRAM, 1);
+ BEGIN_NV04(chan, NV30_3D(FP_ACTIVE_PROGRAM), 1);
if (OUT_RELOC(chan, pNv->shader_mem, shader->hw_id, NOUVEAU_BO_VRAM |
NOUVEAU_BO_GART | NOUVEAU_BO_RD | NOUVEAU_BO_LOW |
NOUVEAU_BO_OR,
NV30_3D_FP_ACTIVE_PROGRAM_DMA0,
NV30_3D_FP_ACTIVE_PROGRAM_DMA1))
return FALSE;
- BEGIN_RING(chan, curie, NV30_3D_FP_CONTROL, 1);
+ BEGIN_NV04(chan, NV30_3D(FP_CONTROL), 1);
OUT_RING (chan, shader->card_priv.NV30FP.num_regs <<
NV40_3D_FP_CONTROL_TEMP_COUNT__SHIFT);
View
35 src/nv30_xv_tex.c
@@ -37,7 +37,6 @@
#include "nv_dma.h"
#include "nv30_shaders.h"
-#include "nv04_pushbuf.h"
#include "hwdefs/nv30-40_3d.xml.h"
@@ -135,7 +134,6 @@ NV30VideoTexture(ScrnInfoPtr pScrn, struct nouveau_bo *src, int offset,
{
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *rankine = pNv->Nv3D;
uint32_t tex_reloc = NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD;
uint32_t card_fmt = 0;
uint32_t card_swz = 0;
@@ -159,7 +157,7 @@ NV30VideoTexture(ScrnInfoPtr pScrn, struct nouveau_bo *src, int offset,
break;
}
- BEGIN_RING(chan, rankine, NV30_3D_TEX_OFFSET(unit), 8);
+ BEGIN_NV04(chan, NV30_3D(TEX_OFFSET(unit)), 8);
if (OUT_RELOCl(chan, src, offset, tex_reloc))
return FALSE;
@@ -239,10 +237,10 @@ NV30StopTexturedVideo(ScrnInfoPtr pScrn, pointer data, Bool Exit)
}
#define VERTEX_OUT(sx,sy,dx,dy) do { \
- BEGIN_RING(chan, rankine, NV30_3D_VTX_ATTR_2F_X(8), 4); \
+ BEGIN_NV04(chan, NV30_3D(VTX_ATTR_2F_X(8)), 4); \
OUT_RINGf (chan, (sx)); OUT_RINGf (chan, (sy)); \
OUT_RINGf (chan, (sx)/2.0); OUT_RINGf (chan, (sy)/2.0); \
- BEGIN_RING(chan, rankine, NV30_3D_VTX_ATTR_2I(0), 1); \
+ BEGIN_NV04(chan, NV30_3D(VTX_ATTR_2I(0)), 1); \
OUT_RING (chan, ((dy)<<16)|(dx)); \
} while(0)
@@ -259,7 +257,6 @@ NV30PutTextureImage(ScrnInfoPtr pScrn, struct nouveau_bo *src, int src_offset,
{
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *rankine = pNv->Nv3D;
struct nouveau_bo *bo = nouveau_pixmap_bo(ppix);
Bool bicubic = pPriv->bicubic;
float X1, X2, Y1, Y2;
@@ -285,11 +282,11 @@ NV30PutTextureImage(ScrnInfoPtr pScrn, struct nouveau_bo *src, int src_offset,
return BadImplementation;
/* Disable blending */
- BEGIN_RING(chan, rankine, NV30_3D_BLEND_FUNC_ENABLE, 1);
+ BEGIN_NV04(chan, NV30_3D(BLEND_FUNC_ENABLE), 1);
OUT_RING (chan, 0);
/* Setup surface */
- BEGIN_RING(chan, rankine, NV30_3D_RT_FORMAT, 3);
+ BEGIN_NV04(chan, NV30_3D(RT_FORMAT), 3);
OUT_RING (chan, NV30_3D_RT_FORMAT_TYPE_LINEAR |
NV30_3D_RT_FORMAT_ZETA_Z24S8 |
dst_format);
@@ -306,19 +303,19 @@ NV30PutTextureImage(ScrnInfoPtr pScrn, struct nouveau_bo *src, int src_offset,
int w = ppix->drawable.x + ppix->drawable.width;
int h = ppix->drawable.y + ppix->drawable.height;
- BEGIN_RING(chan, rankine, NV30_3D_VIEWPORT_HORIZ, 2);
+ BEGIN_NV04(chan, NV30_3D(VIEWPORT_HORIZ), 2);
OUT_RING (chan, (w<<16)|x);
OUT_RING (chan, (h<<16)|y);
- BEGIN_RING(chan, rankine, NV30_3D_VIEWPORT_CLIP_HORIZ(0), 2);
+ BEGIN_NV04(chan, NV30_3D(VIEWPORT_CLIP_HORIZ(0)), 2);
OUT_RING (chan, (w-1+x)<<16);
OUT_RING (chan, (h-1+y)<<16);
- BEGIN_RING(chan, rankine, NV30_3D_VIEWPORT_TX_ORIGIN, 1);
+ BEGIN_NV04(chan, NV30_3D(VIEWPORT_TX_ORIGIN), 1);
OUT_RING (chan, (y<<16)|x);
}
NV30_LoadFilterTable(pScrn);
- BEGIN_RING(chan, rankine, NV30_3D_TEX_UNITS_ENABLE, 1);
+ BEGIN_NV04(chan, NV30_3D(TEX_UNITS_ENABLE), 1);
OUT_RING (chan, NV30_3D_TEX_UNITS_ENABLE_TX0 |
NV30_3D_TEX_UNITS_ENABLE_TX1);
@@ -337,7 +334,7 @@ NV30PutTextureImage(ScrnInfoPtr pScrn, struct nouveau_bo *src, int src_offset,
return BadImplementation;
}
- BEGIN_RING(chan, rankine, NV30_3D_TEX_ENABLE(3), 1);
+ BEGIN_NV04(chan, NV30_3D(TEX_ENABLE(3)), 1);
OUT_RING (chan, 0x0);
if (drw_w / 2 < src_w || drw_h / 2 < src_h)
@@ -362,7 +359,7 @@ NV30PutTextureImage(ScrnInfoPtr pScrn, struct nouveau_bo *src, int src_offset,
X2 = (float)(x2>>16)+(float)(x2&0xFFFF)/(float)0x10000;
Y2 = (float)(y2>>16)+(float)(y2&0xFFFF)/(float)0x10000;
- BEGIN_RING(chan, rankine, NV30_3D_VERTEX_BEGIN_END, 1);
+ BEGIN_NV04(chan, NV30_3D(VERTEX_BEGIN_END), 1);
OUT_RING (chan, NV30_3D_VERTEX_BEGIN_END_TRIANGLES);
while(nbox--) {
@@ -375,7 +372,7 @@ NV30PutTextureImage(ScrnInfoPtr pScrn, struct nouveau_bo *src, int src_offset,
int sy1=pbox->y1;
int sy2=pbox->y2;
- BEGIN_RING(chan, rankine, NV30_3D_SCISSOR_HORIZ, 2);
+ BEGIN_NV04(chan, NV30_3D(SCISSOR_HORIZ), 2);
OUT_RING (chan, (sx2 << 16) | 0);
OUT_RING (chan, (sy2 << 16) | 0);
@@ -386,17 +383,17 @@ NV30PutTextureImage(ScrnInfoPtr pScrn, struct nouveau_bo *src, int src_offset,
pbox++;
}
- BEGIN_RING(chan, rankine, NV30_3D_VERTEX_BEGIN_END, 1);
+ BEGIN_NV04(chan, NV30_3D(VERTEX_BEGIN_END), 1);
OUT_RING (chan, NV30_3D_VERTEX_BEGIN_END_STOP);
if (pNv->dev->chipset == 0x30) {
- BEGIN_RING(chan, rankine, NV30_3D_VIEWPORT_HORIZ, 2);
+ BEGIN_NV04(chan, NV30_3D(VIEWPORT_HORIZ), 2);
OUT_RING (chan, 4096 << 16);
OUT_RING (chan, 4096 << 16);
- BEGIN_RING(chan, rankine, NV30_3D_VIEWPORT_CLIP_HORIZ(0), 2);
+ BEGIN_NV04(chan, NV30_3D(VIEWPORT_CLIP_HORIZ(0)), 2);
OUT_RING (chan, 4095 << 16);
OUT_RING (chan, 4095 << 16);
- BEGIN_RING(chan, rankine, NV30_3D_VIEWPORT_TX_ORIGIN, 1);
+ BEGIN_NV04(chan, NV30_3D(VIEWPORT_TX_ORIGIN), 1);
OUT_RING (chan, 0);
}
View
104 src/nv40_exa.c
@@ -22,7 +22,6 @@
#include "nv_include.h"
#include "nv30_shaders.h"
-#include "nv04_pushbuf.h"
#include "hwdefs/nv_object.xml.h"
#include "hwdefs/nv30-40_3d.xml.h"
@@ -192,7 +191,6 @@ NV40_SetupBlend(ScrnInfoPtr pScrn, nv_pict_op_t *blend,
{
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *curie = pNv->Nv3D;
uint32_t sblend, dblend;
sblend = blend->src_card_op;
@@ -223,10 +221,10 @@ NV40_SetupBlend(ScrnInfoPtr pScrn, nv_pict_op_t *blend,
}
if (sblend == SF(ONE) && dblend == DF(ZERO)) {
- BEGIN_RING(chan, curie, NV30_3D_BLEND_FUNC_ENABLE, 1);
+ BEGIN_NV04(chan, NV30_3D(BLEND_FUNC_ENABLE), 1);
OUT_RING (chan, 0);
} else {
- BEGIN_RING(chan, curie, NV30_3D_BLEND_FUNC_ENABLE, 5);
+ BEGIN_NV04(chan, NV30_3D(BLEND_FUNC_ENABLE), 5);
OUT_RING (chan, 1);
OUT_RING (chan, sblend);
OUT_RING (chan, dblend);
@@ -241,7 +239,6 @@ NV40EXATexture(ScrnInfoPtr pScrn, PixmapPtr pPix, PicturePtr pPict, int unit)
{
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *curie = pNv->Nv3D;
struct nouveau_bo *bo = nouveau_pixmap_bo(pPix);
unsigned tex_reloc = NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD;
nv_pict_texture_format_t *fmt;
@@ -251,7 +248,7 @@ NV40EXATexture(ScrnInfoPtr pScrn, PixmapPtr pPix, PicturePtr pPict, int unit)
if (!fmt)
return FALSE;
- BEGIN_RING(chan, curie, NV30_3D_TEX_OFFSET(unit), 8);
+ BEGIN_NV04(chan, NV30_3D(TEX_OFFSET(unit)), 8);
if (OUT_RELOCl(chan, bo, 0, tex_reloc) ||
OUT_RELOCd(chan, bo, fmt->card_fmt | NV40_3D_TEX_FORMAT_LINEAR |
NV30_3D_TEX_FORMAT_DIMS_2D | 0x8000 |
@@ -296,7 +293,7 @@ NV40EXATexture(ScrnInfoPtr pScrn, PixmapPtr pPix, PicturePtr pPict, int unit)
}
OUT_RING (chan, (pPix->drawable.width << 16) | pPix->drawable.height);
OUT_RING (chan, 0); /* border ARGB */
- BEGIN_RING(chan, curie, NV40_3D_TEX_SIZE1(unit), 1);
+ BEGIN_NV04(chan, NV40_3D(TEX_SIZE1(unit)), 1);
OUT_RING (chan, (1 << NV40_3D_TEX_SIZE1_DEPTH__SHIFT) |
(uint32_t)exaGetPixmapPitch(pPix));
@@ -311,7 +308,6 @@ NV40_SetupSurface(ScrnInfoPtr pScrn, PixmapPtr pPix, PictFormatShort format)
{
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *curie = pNv->Nv3D;
struct nouveau_bo *bo = nouveau_pixmap_bo(pPix);
nv_pict_surface_format_t *fmt;
@@ -321,7 +317,7 @@ NV40_SetupSurface(ScrnInfoPtr pScrn, PixmapPtr pPix, PictFormatShort format)
return FALSE;
}
- BEGIN_RING(chan, curie, NV30_3D_RT_FORMAT, 3);
+ BEGIN_NV04(chan, NV30_3D(RT_FORMAT), 3);
OUT_RING (chan, NV30_3D_RT_FORMAT_TYPE_LINEAR |
NV30_3D_RT_FORMAT_ZETA_Z24S8 |
fmt->card_fmt);
@@ -421,7 +417,6 @@ NV40EXAPrepareComposite(int op, PicturePtr psPict,
ScrnInfoPtr pScrn = xf86Screens[psPix->drawable.pScreen->myNum];
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *curie = pNv->Nv3D;
nv_pict_op_t *blend;
int fpid = NV40EXA_FPID_PASS_COL0;
NV40EXA_STATE;
@@ -474,9 +469,9 @@ NV40EXAPrepareComposite(int op, PicturePtr psPict,
/* Appears to be some kind of cache flush, needed here at least
* sometimes.. funky text rendering otherwise :)
*/
- BEGIN_RING(chan, curie, NV40_3D_TEX_CACHE_CTL, 1);
+ BEGIN_NV04(chan, NV40_3D(TEX_CACHE_CTL), 1);
OUT_RING (chan, 2);
- BEGIN_RING(chan, curie, NV40_3D_TEX_CACHE_CTL, 1);
+ BEGIN_NV04(chan, NV40_3D(TEX_CACHE_CTL), 1);
OUT_RING (chan, 1);
pNv->alu = op;
@@ -512,16 +507,16 @@ NV40EXATransformCoord(PictTransformPtr t, int x, int y, float sx, float sy,
}
#define CV_OUTm(sx,sy,mx,my,dx,dy) do { \
- BEGIN_RING(chan, curie, NV30_3D_VTX_ATTR_2F_X(8), 4); \
+ BEGIN_NV04(chan, NV30_3D(VTX_ATTR_2F_X(8)), 4); \
OUT_RINGf (chan, (sx)); OUT_RINGf (chan, (sy)); \
OUT_RINGf (chan, (mx)); OUT_RINGf (chan, (my)); \
- BEGIN_RING(chan, curie, NV30_3D_VTX_ATTR_2I(0), 1); \
+ BEGIN_NV04(chan, NV30_3D(VTX_ATTR_2I(0)), 1); \
OUT_RING (chan, ((dy)<<16)|(dx)); \
} while(0)
#define CV_OUT(sx,sy,dx,dy) do { \
- BEGIN_RING(chan, curie, NV30_3D_VTX_ATTR_2F_X(8), 2); \
+ BEGIN_NV04(chan, NV30_3D(VTX_ATTR_2F_X(8)), 2); \
OUT_RINGf (chan, (sx)); OUT_RINGf (chan, (sy)); \
- BEGIN_RING(chan, curie, NV30_3D_VTX_ATTR_2I(0), 1); \
+ BEGIN_NV04(chan, NV30_3D(VTX_ATTR_2I(0)), 1); \
OUT_RING (chan, ((dy)<<16)|(dx)); \
} while(0)
@@ -534,7 +529,6 @@ NV40EXAComposite(PixmapPtr pdPix, int srcX , int srcY,
ScrnInfoPtr pScrn = xf86Screens[pdPix->drawable.pScreen->myNum];
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *curie = pNv->Nv3D;
float sX0, sX1, sX2, sY0, sY1, sY2;
float mX0, mX1, mX2, mY0, mY1, mY2;
NV40EXA_STATE;
@@ -546,10 +540,10 @@ NV40EXAComposite(PixmapPtr pdPix, int srcX , int srcY,
* image, but just a part.
*/
/* Handling the cliprects is done for us already. */
- BEGIN_RING(chan, curie, NV30_3D_SCISSOR_HORIZ, 2);
+ BEGIN_NV04(chan, NV30_3D(SCISSOR_HORIZ), 2);
OUT_RING (chan, (width << 16) | dstX);
OUT_RING (chan, (height << 16) | dstY);
- BEGIN_RING(chan, curie, NV30_3D_VERTEX_BEGIN_END, 1);
+ BEGIN_NV04(chan, NV30_3D(VERTEX_BEGIN_END), 1);
OUT_RING (chan, NV30_3D_VERTEX_BEGIN_END_TRIANGLES);
NV40EXATransformCoord(state->unit[0].transform, srcX, srcY - height,
@@ -586,7 +580,7 @@ NV40EXAComposite(PixmapPtr pdPix, int srcX , int srcY,
CV_OUT(sX2, sY2, dstX + 2*width, dstY + height);
}
- BEGIN_RING(chan, curie, NV30_3D_VERTEX_BEGIN_END, 1);
+ BEGIN_NV04(chan, NV30_3D(VERTEX_BEGIN_END), 1);
OUT_RING (chan, NV30_3D_VERTEX_BEGIN_END_STOP);
}
@@ -607,7 +601,6 @@ NVAccelInitNV40TCL(ScrnInfoPtr pScrn)
{
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *curie;
uint32_t class = 0, chipset;
int next_hw_id = 0, next_hw_offset = 0, i;
@@ -635,7 +628,6 @@ NVAccelInitNV40TCL(ScrnInfoPtr pScrn)
if (nouveau_grobj_alloc(pNv->chan, Nv3D, class, &pNv->Nv3D))
return FALSE;
}
- curie = pNv->Nv3D;
if (!pNv->shader_mem) {
if (nouveau_bo_new(pNv->dev, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART |
@@ -648,43 +640,45 @@ NVAccelInitNV40TCL(ScrnInfoPtr pScrn)
}
}
- BEGIN_RING(chan, curie, NV30_3D_DMA_NOTIFY, 1);
+ BEGIN_NV04(chan, NV01_SUBC(3D, OBJECT), 1);
+ OUT_RING (chan, pNv->Nv3D->handle);
+ BEGIN_NV04(chan, NV30_3D(DMA_NOTIFY), 1);
OUT_RING (chan, pNv->notify0->handle);
- BEGIN_RING(chan, curie, NV30_3D_DMA_TEXTURE0, 2);
+ BEGIN_NV04(chan, NV30_3D(DMA_TEXTURE0), 2);
OUT_RING (chan, pNv->chan->vram->handle);
OUT_RING (chan, pNv->chan->gart->handle);
- BEGIN_RING(chan, curie, NV30_3D_DMA_COLOR0, 2);
+ BEGIN_NV04(chan, NV30_3D(DMA_COLOR0), 2);
OUT_RING (chan, pNv->chan->vram->handle);
OUT_RING (chan, pNv->chan->vram->handle);
/* voodoo */
- BEGIN_RING(chan, curie, 0x1ea4, 3);
+ BEGIN_NV04(chan, SUBC_3D(0x1ea4), 3);
OUT_RING (chan, 0x00000010);
OUT_RING (chan, 0x01000100);
OUT_RING (chan, 0xff800006);
- BEGIN_RING(chan, curie, 0x1fc4, 1);
+ BEGIN_NV04(chan, SUBC_3D(0x1fc4), 1);
OUT_RING (chan, 0x06144321);
- BEGIN_RING(chan, curie, 0x1fc8, 2);
+ BEGIN_NV04(chan, SUBC_3D(0x1fc8), 2);
OUT_RING (chan, 0xedcba987);
OUT_RING (chan, 0x00000021);
- BEGIN_RING(chan, curie, 0x1fd0, 1);
+ BEGIN_NV04(chan, SUBC_3D(0x1fd0), 1);
OUT_RING (chan, 0x00171615);
- BEGIN_RING(chan, curie, 0x1fd4, 1);
+ BEGIN_NV04(chan, SUBC_3D(0x1fd4), 1);
OUT_RING (chan, 0x001b1a19);
- BEGIN_RING(chan, curie, 0x1ef8, 1);
+ BEGIN_NV04(chan, SUBC_3D(0x1ef8), 1);
OUT_RING (chan, 0x0020ffff);
- BEGIN_RING(chan, curie, 0x1d64, 1);
+ BEGIN_NV04(chan, SUBC_3D(0x1d64), 1);
OUT_RING (chan, 0x00d30000);
- BEGIN_RING(chan, curie, 0x1e94, 1);
+ BEGIN_NV04(chan, SUBC_3D(0x1e94), 1);
OUT_RING (chan, 0x00000001);
/* This removes the the stair shaped tearing that i get. */
/* Verified on one G70 card that it doesn't cause regressions for people without the problem. */
/* The blob sets this up by default for NV43. */
- BEGIN_RING(chan, curie, 0x1450, 1);
+ BEGIN_NV04(chan, SUBC_3D(0x1450), 1);
OUT_RING (chan, 0x0000000F);
- BEGIN_RING(chan, curie, NV30_3D_VIEWPORT_TRANSLATE_X, 8);
+ BEGIN_NV04(chan, NV30_3D(VIEWPORT_TRANSLATE_X), 8);
OUT_RINGf (chan, 0.0);
OUT_RINGf (chan, 0.0);
OUT_RINGf (chan, 0.0);
@@ -696,58 +690,58 @@ NVAccelInitNV40TCL(ScrnInfoPtr pScrn)
/* default 3D state */
/*XXX: replace with the same state that the DRI emits on startup */
- BEGIN_RING(chan, curie, NV30_3D_STENCIL_ENABLE(0), 1);
+ BEGIN_NV04(chan, NV30_3D(STENCIL_ENABLE(0)), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, curie, NV30_3D_STENCIL_ENABLE(1), 1);
+ BEGIN_NV04(chan, NV30_3D(STENCIL_ENABLE(1)), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, curie, NV30_3D_ALPHA_FUNC_ENABLE, 1);
+ BEGIN_NV04(chan, NV30_3D(ALPHA_FUNC_ENABLE), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, curie, NV30_3D_DEPTH_WRITE_ENABLE, 2);
+ BEGIN_NV04(chan, NV30_3D(DEPTH_WRITE_ENABLE), 2);
OUT_RING (chan, 0);
OUT_RING (chan, 0);
- BEGIN_RING(chan, curie, NV30_3D_COLOR_MASK, 1);
+ BEGIN_NV04(chan, NV30_3D(COLOR_MASK), 1);
OUT_RING (chan, 0x01010101); /* TR,TR,TR,TR */
- BEGIN_RING(chan, curie, NV30_3D_CULL_FACE_ENABLE, 1);
+ BEGIN_NV04(chan, NV30_3D(CULL_FACE_ENABLE), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, curie, NV30_3D_BLEND_FUNC_ENABLE, 1);
+ BEGIN_NV04(chan, NV30_3D(BLEND_FUNC_ENABLE), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, curie, NV30_3D_COLOR_LOGIC_OP_ENABLE, 2);
+ BEGIN_NV04(chan, NV30_3D(COLOR_LOGIC_OP_ENABLE), 2);
OUT_RING (chan, 0);
OUT_RING (chan, NV30_3D_COLOR_LOGIC_OP_OP_COPY);
- BEGIN_RING(chan, curie, NV30_3D_DITHER_ENABLE, 1);
+ BEGIN_NV04(chan, NV30_3D(DITHER_ENABLE), 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, curie, NV30_3D_SHADE_MODEL, 1);
+ BEGIN_NV04(chan, NV30_3D(SHADE_MODEL), 1);
OUT_RING (chan, NV30_3D_SHADE_MODEL_SMOOTH);
- BEGIN_RING(chan, curie, NV30_3D_POLYGON_OFFSET_FACTOR,2);
+ BEGIN_NV04(chan, NV30_3D(POLYGON_OFFSET_FACTOR),2);
OUT_RINGf (chan, 0.0);
OUT_RINGf (chan, 0.0);
- BEGIN_RING(chan, curie, NV30_3D_POLYGON_MODE_FRONT, 2);
+ BEGIN_NV04(chan, NV30_3D(POLYGON_MODE_FRONT), 2);
OUT_RING (chan, NV30_3D_POLYGON_MODE_FRONT_FILL);
OUT_RING (chan, NV30_3D_POLYGON_MODE_BACK_FILL);
- BEGIN_RING(chan, curie, NV30_3D_POLYGON_STIPPLE_PATTERN(0), 0x20);
+ BEGIN_NV04(chan, NV30_3D(POLYGON_STIPPLE_PATTERN(0)), 0x20);
for (i=0;i<0x20;i++)
OUT_RING (chan, 0xFFFFFFFF);
for (i=0;i<16;i++) {
- BEGIN_RING(chan, curie, NV30_3D_TEX_ENABLE(i), 1);
+ BEGIN_NV04(chan, NV30_3D(TEX_ENABLE(i)), 1);
OUT_RING (chan, 0);
}
- BEGIN_RING(chan, curie, 0x1d78, 1);
+ BEGIN_NV04(chan, SUBC_3D(0x1d78), 1);
OUT_RING (chan, 0x110);
- BEGIN_RING(chan, curie, NV30_3D_RT_ENABLE, 1);
+ BEGIN_NV04(chan, NV30_3D(RT_ENABLE), 1);
OUT_RING (chan, NV30_3D_RT_ENABLE_COLOR0);
- BEGIN_RING(chan, curie, NV30_3D_RT_HORIZ, 2);
+ BEGIN_NV04(chan, NV30_3D(RT_HORIZ), 2);
OUT_RING (chan, (4096 << 16));
OUT_RING (chan, (4096 << 16));
- BEGIN_RING(chan, curie, NV30_3D_SCISSOR_HORIZ, 2);
+ BEGIN_NV04(chan, NV30_3D(SCISSOR_HORIZ), 2);
OUT_RING (chan, (4096 << 16));
OUT_RING (chan, (4096 << 16));
- BEGIN_RING(chan, curie, NV30_3D_VIEWPORT_HORIZ, 2);
+ BEGIN_NV04(chan, NV30_3D(VIEWPORT_HORIZ), 2);
OUT_RING (chan, (4096 << 16));
OUT_RING (chan, (4096 << 16));
- BEGIN_RING(chan, curie, NV30_3D_VIEWPORT_CLIP_HORIZ(0), 2);
+ BEGIN_NV04(chan, NV30_3D(VIEWPORT_CLIP_HORIZ(0)), 2);
OUT_RING (chan, (4095 << 16));
OUT_RING (chan, (4095 << 16));
View
25 src/nv40_xv_tex.c
@@ -37,7 +37,6 @@
#include "nv_dma.h"
#include "nv30_shaders.h"
-#include "nv04_pushbuf.h"
#include "hwdefs/nv30-40_3d.xml.h"
@@ -137,7 +136,6 @@ NV40VideoTexture(ScrnInfoPtr pScrn, struct nouveau_bo *src, int offset,
{
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *curie = pNv->Nv3D;
uint32_t tex_reloc = NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD;
uint32_t card_fmt = 0;
uint32_t card_swz = 0;
@@ -161,7 +159,7 @@ NV40VideoTexture(ScrnInfoPtr pScrn, struct nouveau_bo *src, int offset,
break;
}
- BEGIN_RING(chan, curie, NV30_3D_TEX_OFFSET(unit), 8);
+ BEGIN_NV04(chan, NV30_3D(TEX_OFFSET(unit)), 8);
if (OUT_RELOCl(chan, src, offset, tex_reloc))
return FALSE;
if (unit==0) {
@@ -207,7 +205,7 @@ NV40VideoTexture(ScrnInfoPtr pScrn, struct nouveau_bo *src, int offset,
OUT_RING (chan, (width << 16) | height);
OUT_RING (chan, 0); /* border ARGB */
- BEGIN_RING(chan, curie, NV40_3D_TEX_SIZE1(unit), 1);
+ BEGIN_NV04(chan, NV40_3D(TEX_SIZE1(unit)), 1);
OUT_RING (chan, (1 << NV40_3D_TEX_SIZE1_DEPTH__SHIFT) |
(uint16_t) src_pitch);
@@ -243,10 +241,10 @@ NV40StopTexturedVideo(ScrnInfoPtr pScrn, pointer data, Bool Exit)
}
#define VERTEX_OUT(sx,sy,dx,dy) do { \
- BEGIN_RING(chan, curie, NV30_3D_VTX_ATTR_2F_X(8), 4); \
+ BEGIN_NV04(chan, NV30_3D(VTX_ATTR_2F_X(8)), 4); \
OUT_RINGf (chan, (sx)); OUT_RINGf (chan, (sy)); \
OUT_RINGf (chan, (sx)/2.0); OUT_RINGf (chan, (sy)/2.0); \
- BEGIN_RING(chan, curie, NV30_3D_VTX_ATTR_2I(0), 1); \
+ BEGIN_NV04(chan, NV30_3D(VTX_ATTR_2I(0)), 1); \
OUT_RING (chan, ((dy)<<16)|(dx)); \
} while(0)
@@ -263,7 +261,6 @@ NV40PutTextureImage(ScrnInfoPtr pScrn,
{
NVPtr pNv = NVPTR(pScrn);
struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *curie = pNv->Nv3D;
struct nouveau_bo *bo = nouveau_pixmap_bo(ppix);
Bool bicubic = pPriv->bicubic;
float X1, X2, Y1, Y2;
@@ -289,11 +286,11 @@ NV40PutTextureImage(ScrnInfoPtr pScrn,
return BadImplementation;
/* Disable blending */
- BEGIN_RING(chan, curie, NV30_3D_BLEND_FUNC_ENABLE, 1);
+ BEGIN_NV04(chan, NV30_3D(BLEND_FUNC_ENABLE), 1);
OUT_RING (chan, 0);
/* Setup surface */
- BEGIN_RING(chan, curie, NV30_3D_RT_FORMAT, 3);
+ BEGIN_NV04(chan, NV30_3D(RT_FORMAT), 3);
OUT_RING (chan, NV30_3D_RT_FORMAT_TYPE_LINEAR |
NV30_3D_RT_FORMAT_ZETA_Z24S8 | dst_format);
OUT_RING (chan, exaGetPixmapPitch(ppix));
@@ -334,9 +331,9 @@ NV40PutTextureImage(ScrnInfoPtr pScrn,
/* Appears to be some kind of cache flush, needed here at least
* sometimes.. funky text rendering otherwise :)
*/
- BEGIN_RING(chan, curie, NV40_3D_TEX_CACHE_CTL, 1);
+ BEGIN_NV04(chan, NV40_3D(TEX_CACHE_CTL), 1);
OUT_RING (chan, 2);
- BEGIN_RING(chan, curie, NV40_3D_TEX_CACHE_CTL, 1);
+ BEGIN_NV04(chan, NV40_3D(TEX_CACHE_CTL), 1);
OUT_RING (chan, 1);
/* Just before rendering we wait for vblank in the non-composited case. */
@@ -351,7 +348,7 @@ NV40PutTextureImage(ScrnInfoPtr pScrn,
X2 = (float)(x2>>16)+(float)(x2&0xFFFF)/(float)0x10000;
Y2 = (float)(y2>>16)+(float)(y2&0xFFFF)/(float)0x10000;
- BEGIN_RING(chan, curie, NV30_3D_VERTEX_BEGIN_END, 1);
+ BEGIN_NV04(chan, NV30_3D(VERTEX_BEGIN_END), 1);
OUT_RING (chan, NV30_3D_VERTEX_BEGIN_END_TRIANGLES);
while(nbox--) {
@@ -364,7 +361,7 @@ NV40PutTextureImage(ScrnInfoPtr pScrn,
int sy1=pbox->y1;
int sy2=pbox->y2;
- BEGIN_RING(chan, curie, NV30_3D_SCISSOR_HORIZ, 2);
+ BEGIN_NV04(chan, NV30_3D(SCISSOR_HORIZ), 2);
OUT_RING (chan, (sx2 << 16) | 0);
OUT_RING (chan, (sy2 << 16) | 0);
@@ -375,7 +372,7 @@ NV40PutTextureImage(ScrnInfoPtr pScrn,
pbox++;
}
- BEGIN_RING(chan, curie, NV30_3D_VERTEX_BEGIN_END, 1);
+ BEGIN_NV04(chan, NV30_3D(VERTEX_BEGIN_END), 1);
OUT_RING (chan, NV30_3D_VERTEX_BEGIN_END_STOP);
FIRE_RING (chan);
View
114 src/nv50_accel.c
@@ -33,7 +33,6 @@ NV50SyncToVBlank(PixmapPtr ppix, BoxPtr box)
ScrnInfoPtr pScrn = xf86Screens[ppix->drawable.pScreen->myNum];
NVPtr pNv = NVPTR(pScrn);