summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2012-04-19 09:52:24 +1000
committerBen Skeggs <bskeggs@redhat.com>2012-04-24 10:57:07 +1000
commit5ac2ca8c56ec8b055878c8ac4cbc8ca74379abda (patch)
tree7e886eb41b9a52edf8668871fb7fd244876f00a0
parent6c41b3d7a8799daa9d0b34dcfbfc5c891c24fffa (diff)
nv50: implement and use PUSH_DATAu
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r--src/nv50_accel.c68
-rw-r--r--src/nv50_accel.h18
-rw-r--r--src/nv50_exa.c16
-rw-r--r--src/nv50_xv.c25
4 files changed, 33 insertions, 94 deletions
diff --git a/src/nv50_accel.c b/src/nv50_accel.c
index 443e5c4..32166ec 100644
--- a/src/nv50_accel.c
+++ b/src/nv50_accel.c
@@ -215,13 +215,7 @@ NVAccelInitNV50TCL(ScrnInfoPtr pScrn)
BEGIN_NV04(push, NV50_3D(TEX_LIMITS(2)), 1);
PUSH_DATA (push, 0x54);
- BEGIN_NV04(push, NV50_3D(CB_DEF_ADDRESS_HIGH), 3);
- PUSH_DATA (push, (pNv->scratch->offset + PVP_OFFSET) >> 32);
- PUSH_DATA (push, (pNv->scratch->offset + PVP_OFFSET));
- PUSH_DATA (push, 0x00004000);
- BEGIN_NV04(push, NV50_3D(CB_ADDR), 1);
- PUSH_DATA (push, 0);
- BEGIN_NI04(push, NV50_3D(CB_DATA(0)), (3*2*2));
+ PUSH_DATAu(push, pNv->scratch, PVP_OFFSET, 3 * 2 * 2);
PUSH_DATA (push, 0x10000001);
PUSH_DATA (push, 0x0423c788);
PUSH_DATA (push, 0x10000205);
@@ -255,26 +249,14 @@ NVAccelInitNV50TCL(ScrnInfoPtr pScrn)
BEGIN_NV04(push, NV50_3D(VP_START_ID), 1);
PUSH_DATA (push, 0);
- BEGIN_NV04(push, NV50_3D(CB_DEF_ADDRESS_HIGH), 3);
- PUSH_DATA (push, (pNv->scratch->offset + PFP_OFFSET + PFP_S) >> 32);
- PUSH_DATA (push, (pNv->scratch->offset + PFP_OFFSET + PFP_S));
- PUSH_DATA (push, (0 << NV50_3D_CB_DEF_SET_BUFFER__SHIFT) | 0x4000);
- BEGIN_NV04(push, NV50_3D(CB_ADDR), 1);
- PUSH_DATA (push, 0);
- BEGIN_NI04(push, NV50_3D(CB_DATA(0)), 6);
+ PUSH_DATAu(push, pNv->scratch, PFP_OFFSET + PFP_S, 6);
PUSH_DATA (push, 0x80000000);
PUSH_DATA (push, 0x90000004);
PUSH_DATA (push, 0x82010200);
PUSH_DATA (push, 0x82020204);
PUSH_DATA (push, 0xf6400001);
PUSH_DATA (push, 0x0000c785);
- BEGIN_NV04(push, NV50_3D(CB_DEF_ADDRESS_HIGH), 3);
- PUSH_DATA (push, (pNv->scratch->offset + PFP_OFFSET + PFP_C) >> 32);
- PUSH_DATA (push, (pNv->scratch->offset + PFP_OFFSET + PFP_C));
- PUSH_DATA (push, (0 << NV50_3D_CB_DEF_SET_BUFFER__SHIFT) | 0x4000);
- BEGIN_NV04(push, NV50_3D(CB_ADDR), 1);
- PUSH_DATA (push, 0);
- BEGIN_NI04(push, NV50_3D(CB_DATA(0)), 16);
+ PUSH_DATAu(push, pNv->scratch, PFP_OFFSET + PFP_C, 16);
PUSH_DATA (push, 0x80000000);
PUSH_DATA (push, 0x90000004);
PUSH_DATA (push, 0x82030210);
@@ -291,13 +273,7 @@ NVAccelInitNV50TCL(ScrnInfoPtr pScrn)
PUSH_DATA (push, 0x00000780);
PUSH_DATA (push, 0xc004060d);
PUSH_DATA (push, 0x00000781);
- BEGIN_NV04(push, NV50_3D(CB_DEF_ADDRESS_HIGH), 3);
- PUSH_DATA (push, (pNv->scratch->offset + PFP_OFFSET + PFP_CCA) >> 32);
- PUSH_DATA (push, (pNv->scratch->offset + PFP_OFFSET + PFP_CCA));
- PUSH_DATA (push, (0 << NV50_3D_CB_DEF_SET_BUFFER__SHIFT) | 0x4000);
- BEGIN_NV04(push, NV50_3D(CB_ADDR), 1);
- PUSH_DATA (push, 0);
- BEGIN_NI04(push, NV50_3D(CB_DATA(0)), 16);
+ PUSH_DATAu(push, pNv->scratch, PFP_OFFSET + PFP_CCA, 16);
PUSH_DATA (push, 0x80000000);
PUSH_DATA (push, 0x90000004);
PUSH_DATA (push, 0x82030210);
@@ -314,13 +290,7 @@ NVAccelInitNV50TCL(ScrnInfoPtr pScrn)
PUSH_DATA (push, 0x00000780);
PUSH_DATA (push, 0xc007060d);
PUSH_DATA (push, 0x00000781);
- BEGIN_NV04(push, NV50_3D(CB_DEF_ADDRESS_HIGH), 3);
- PUSH_DATA (push, (pNv->scratch->offset + PFP_OFFSET + PFP_CCASA) >> 32);
- PUSH_DATA (push, (pNv->scratch->offset + PFP_OFFSET + PFP_CCASA));
- PUSH_DATA (push, (0 << NV50_3D_CB_DEF_SET_BUFFER__SHIFT) | 0x4000);
- BEGIN_NV04(push, NV50_3D(CB_ADDR), 1);
- PUSH_DATA (push, 0);
- BEGIN_NI04(push, NV50_3D(CB_DATA(0)), 16);
+ PUSH_DATAu(push, pNv->scratch, PFP_OFFSET + PFP_CCASA, 16);
PUSH_DATA (push, 0x80000000);
PUSH_DATA (push, 0x90000004);
PUSH_DATA (push, 0x82030200);
@@ -337,13 +307,7 @@ NVAccelInitNV50TCL(ScrnInfoPtr pScrn)
PUSH_DATA (push, 0x00000780);
PUSH_DATA (push, 0xc004060d);
PUSH_DATA (push, 0x00000781);
- BEGIN_NV04(push, NV50_3D(CB_DEF_ADDRESS_HIGH), 3);
- PUSH_DATA (push, (pNv->scratch->offset + PFP_OFFSET + PFP_S_A8) >> 32);
- PUSH_DATA (push, (pNv->scratch->offset + PFP_OFFSET + PFP_S_A8));
- PUSH_DATA (push, (0 << NV50_3D_CB_DEF_SET_BUFFER__SHIFT) | 0x4000);
- BEGIN_NV04(push, NV50_3D(CB_ADDR), 1);
- PUSH_DATA (push, 0);
- BEGIN_NI04(push, NV50_3D(CB_DATA(0)), 10);
+ PUSH_DATAu(push, pNv->scratch, PFP_OFFSET + PFP_S_A8, 10);
PUSH_DATA (push, 0x80000000);
PUSH_DATA (push, 0x90000004);
PUSH_DATA (push, 0x82010200);
@@ -354,13 +318,7 @@ NVAccelInitNV50TCL(ScrnInfoPtr pScrn)
PUSH_DATA (push, 0x10008008);
PUSH_DATA (push, 0x1000000d);
PUSH_DATA (push, 0x0403c781);
- BEGIN_NV04(push, NV50_3D(CB_DEF_ADDRESS_HIGH), 3);
- PUSH_DATA (push, (pNv->scratch->offset + PFP_OFFSET + PFP_C_A8) >> 32);
- PUSH_DATA (push, (pNv->scratch->offset + PFP_OFFSET + PFP_C_A8));
- PUSH_DATA (push, (0 << NV50_3D_CB_DEF_SET_BUFFER__SHIFT) | 0x4000);
- BEGIN_NV04(push, NV50_3D(CB_ADDR), 1);
- PUSH_DATA (push, 0);
- BEGIN_NI04(push, NV50_3D(CB_DATA(0)), 16);
+ PUSH_DATAu(push, pNv->scratch, PFP_OFFSET + PFP_C_A8, 16);
PUSH_DATA (push, 0x80000000);
PUSH_DATA (push, 0x90000004);
PUSH_DATA (push, 0x82030208);
@@ -377,13 +335,7 @@ NVAccelInitNV50TCL(ScrnInfoPtr pScrn)
PUSH_DATA (push, 0x10008604);
PUSH_DATA (push, 0x10000609);
PUSH_DATA (push, 0x0403c781);
- BEGIN_NV04(push, NV50_3D(CB_DEF_ADDRESS_HIGH), 3);
- PUSH_DATA (push, (pNv->scratch->offset + PFP_OFFSET + PFP_NV12) >> 32);
- PUSH_DATA (push, (pNv->scratch->offset + PFP_OFFSET + PFP_NV12));
- PUSH_DATA (push, (0 << NV50_3D_CB_DEF_SET_BUFFER__SHIFT) | 0x4000);
- BEGIN_NV04(push, NV50_3D(CB_ADDR), 1);
- PUSH_DATA (push, 0);
- BEGIN_NI04(push, NV50_3D(CB_DATA(0)), 24);
+ PUSH_DATAu(push, pNv->scratch, PFP_OFFSET + PFP_NV12, 24);
PUSH_DATA (push, 0x80000008);
PUSH_DATA (push, 0x90000408);
PUSH_DATA (push, 0x82010400);
@@ -421,6 +373,10 @@ NVAccelInitNV50TCL(ScrnInfoPtr pScrn)
BEGIN_NV04(push, NV50_3D(FP_ADDRESS_HIGH), 2);
PUSH_DATA (push, (pNv->scratch->offset + PFP_OFFSET) >> 32);
PUSH_DATA (push, (pNv->scratch->offset + PFP_OFFSET));
+ BEGIN_NV04(push, NV50_3D(CB_DEF_ADDRESS_HIGH), 3);
+ PUSH_DATA (push, (pNv->scratch->offset + PFP_DATA) >> 32);
+ PUSH_DATA (push, (pNv->scratch->offset + PFP_DATA));
+ PUSH_DATA (push, (CB_PFP << NV50_3D_CB_DEF_SET_BUFFER__SHIFT) | 0x4000);
BEGIN_NV04(push, NV50_3D(SCISSOR_ENABLE(0)), 1);
PUSH_DATA (push, 1);
diff --git a/src/nv50_accel.h b/src/nv50_accel.h
index 606fe74..0f77389 100644
--- a/src/nv50_accel.h
+++ b/src/nv50_accel.h
@@ -37,8 +37,7 @@
#define PFP_NV12 0x0600 /* NV12 YUV->RGB */
/* Constant buffer assignments */
-#define CB_TSC 0
-#define CB_TIC 1
+#define CB_PSH 0
#define CB_PFP 2
static __inline__ void
@@ -68,4 +67,19 @@ VTX2s(NVPtr pNv, float s1x, float s1y, float s2x, float s2y,
PUSH_DATA (push, (dy << 16) | dx);
}
+static __inline__ void
+PUSH_DATAu(struct nouveau_pushbuf *push, struct nouveau_bo *bo,
+ unsigned delta, unsigned dwords)
+{
+ const unsigned idx = (delta & 0x000000fc) >> 2;
+ const unsigned off = (delta & 0xffffff00);
+ BEGIN_NV04(push, NV50_3D(CB_DEF_ADDRESS_HIGH), 3);
+ PUSH_DATA (push, (bo->offset + off) >> 32);
+ PUSH_DATA (push, (bo->offset + off));
+ PUSH_DATA (push, (CB_PSH << NV50_3D_CB_DEF_SET_BUFFER__SHIFT) | 0x4000);
+ BEGIN_NV04(push, NV50_3D(CB_ADDR), 1);
+ PUSH_DATA (push, CB_PSH | (idx << NV50_3D_CB_ADDR_ID__SHIFT));
+ BEGIN_NI04(push, NV50_3D(CB_DATA(0)), dwords);
+}
+
#endif
diff --git a/src/nv50_exa.c b/src/nv50_exa.c
index d75e8c0..4760319 100644
--- a/src/nv50_exa.c
+++ b/src/nv50_exa.c
@@ -545,13 +545,7 @@ NV50EXATexture(PixmapPtr ppix, PicturePtr ppict, unsigned unit)
if (!nv50_style_tiled_pixmap(ppix))
NOUVEAU_FALLBACK("pixmap is scanout buffer\n");
- BEGIN_NV04(push, NV50_3D(CB_DEF_ADDRESS_HIGH), 3);
- PUSH_DATA (push, (pNv->scratch->offset + TIC_OFFSET) >> 32);
- PUSH_DATA (push, (pNv->scratch->offset + TIC_OFFSET));
- PUSH_DATA (push, (CB_TIC << NV50_3D_CB_DEF_SET_BUFFER__SHIFT) | 0x4000);
- BEGIN_NV04(push, NV50_3D(CB_ADDR), 1);
- PUSH_DATA (push, CB_TIC | ((unit * 8) << NV50_3D_CB_ADDR_ID__SHIFT));
- BEGIN_NI04(push, NV50_3D(CB_DATA(0)), 8);
+ PUSH_DATAu(push, pNv->scratch, TIC_OFFSET + (unit * 32), 8);
switch (ppict->format) {
case PICT_a8r8g8b8:
PUSH_DATA (push, _(B_C0, G_C1, R_C2, A_C3, 8_8_8_8));
@@ -631,13 +625,7 @@ NV50EXATexture(PixmapPtr ppix, PicturePtr ppict, unsigned unit)
PUSH_DATA (push, 0x03000000);
PUSH_DATA (push, 0x00000000);
- BEGIN_NV04(push, NV50_3D(CB_DEF_ADDRESS_HIGH), 3);
- PUSH_DATA (push, (pNv->scratch->offset + TSC_OFFSET) >> 32);
- PUSH_DATA (push, (pNv->scratch->offset + TSC_OFFSET));
- PUSH_DATA (push, (CB_TSC << NV50_3D_CB_DEF_SET_BUFFER__SHIFT) | 0x4000);
- BEGIN_NV04(push, NV50_3D(CB_ADDR), 1);
- PUSH_DATA (push, CB_TSC | ((unit * 8) << NV50_3D_CB_ADDR_ID__SHIFT));
- BEGIN_NI04(push, NV50_3D(CB_DATA(0)), 8);
+ PUSH_DATAu(push, pNv->scratch, TSC_OFFSET + (unit * 32), 8);
if (ppict->repeat) {
switch (ppict->repeatType) {
case RepeatPad:
diff --git a/src/nv50_xv.c b/src/nv50_xv.c
index 3522dde..1c6e5be 100644
--- a/src/nv50_xv.c
+++ b/src/nv50_xv.c
@@ -108,13 +108,7 @@ nv50_xv_image_put(ScrnInfoPtr pScrn,
BEGIN_NV04(push, NV50_3D(BLEND_ENABLE(0)), 1);
PUSH_DATA (push, 0);
- BEGIN_NV04(push, NV50_3D(CB_DEF_ADDRESS_HIGH), 3);
- PUSH_DATA (push, (pNv->scratch->offset + TIC_OFFSET) >> 32);
- PUSH_DATA (push, (pNv->scratch->offset + TIC_OFFSET));
- PUSH_DATA (push, (CB_TIC << NV50_3D_CB_DEF_SET_BUFFER__SHIFT) | 0x4000);
- BEGIN_NV04(push, NV50_3D(CB_ADDR), 1);
- PUSH_DATA (push, CB_TIC);
- BEGIN_NI04(push, NV50_3D(CB_DATA(0)), 16);
+ PUSH_DATAu(push, pNv->scratch, TIC_OFFSET, 16);
if (id == FOURCC_YV12 || id == FOURCC_I420) {
PUSH_DATA (push, NV50TIC_0_0_MAPA_C0 | NV50TIC_0_0_TYPEA_UNORM |
NV50TIC_0_0_MAPB_ZERO | NV50TIC_0_0_TYPEB_UNORM |
@@ -183,13 +177,7 @@ nv50_xv_image_put(ScrnInfoPtr pScrn,
PUSH_DATA (push, 0x00000000);
}
- BEGIN_NV04(push, NV50_3D(CB_DEF_ADDRESS_HIGH), 3);
- PUSH_DATA (push, (pNv->scratch->offset + TSC_OFFSET) >> 32);
- PUSH_DATA (push, (pNv->scratch->offset + TSC_OFFSET));
- PUSH_DATA (push, (CB_TSC << NV50_3D_CB_DEF_SET_BUFFER__SHIFT) | 0x4000);
- BEGIN_NV04(push, NV50_3D(CB_ADDR), 1);
- PUSH_DATA (push, CB_TSC);
- BEGIN_NI04(push, NV50_3D(CB_DATA(0)), 16);
+ PUSH_DATAu(push, pNv->scratch, TSC_OFFSET, 16);
PUSH_DATA (push, NV50TSC_1_0_WRAPS_CLAMP_TO_EDGE |
NV50TSC_1_0_WRAPT_CLAMP_TO_EDGE |
NV50TSC_1_0_WRAPR_CLAMP_TO_EDGE);
@@ -342,14 +330,7 @@ nv50_xv_csc_update(ScrnInfoPtr pScrn, NVPortPrivPtr pPriv)
NOUVEAU_BO_VRAM }, 1))
return;
- BEGIN_NV04(push, NV50_3D(CB_DEF_ADDRESS_HIGH), 3);
- PUSH_DATA (push, (pNv->scratch->offset + PFP_DATA) >> 32);
- PUSH_DATA (push, (pNv->scratch->offset + PFP_DATA));
- PUSH_DATA (push, (CB_PFP << NV50_3D_CB_DEF_SET_BUFFER__SHIFT) |
- 0x00004000);
- BEGIN_NV04(push, NV50_3D(CB_ADDR), 1);
- PUSH_DATA (push, CB_PFP);
- BEGIN_NI04(push, NV50_3D(CB_DATA(0)), 10);
+ PUSH_DATAu(push, pNv->scratch, PFP_DATA, 10);
PUSH_DATAf(push, yco);
PUSH_DATAf(push, off[0]);
PUSH_DATAf(push, off[1]);