summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellström <thomas@shipmail.org>2008-10-29 10:59:01 +0000
committerThomas Hellström <thomas@shipmail.org>2008-10-29 10:59:01 +0000
commit2300622f57cab56c7da9ffc3d5765ff8b43b5fe9 (patch)
tree6c8bf41b077128a2d05b6287f25b689307014b8d
parent6cceb82e310687f3e20cba729cdedcec9985f94e (diff)
Rework to support new kernel interface
-rw-r--r--src/ochr_ioctl.c29
-rw-r--r--src/via_3d.c14
-rw-r--r--src/via_accel.c53
-rw-r--r--src/via_cursor.c6
-rw-r--r--src/via_dmabuffer.h5
-rw-r--r--src/via_driver.c44
-rw-r--r--src/via_memcpy.c9
-rw-r--r--src/via_swov.c25
-rw-r--r--src/via_video.c35
9 files changed, 118 insertions, 102 deletions
diff --git a/src/ochr_ioctl.c b/src/ochr_ioctl.c
index ce1324f..87f2694 100644
--- a/src/ochr_ioctl.c
+++ b/src/ochr_ioctl.c
@@ -399,9 +399,9 @@ ochr_apply_texture_reloc(uint32_t ** cmdbuf,
reg_tex_fm = reloc->reg_tex_fm & ~HC_HTXnLoc_MASK;
- if (flags & DRM_BO_FLAG_MEM_VRAM) {
+ if (flags & WSBM_PL_FLAG_VRAM) {
reg_tex_fm |= HC_HTXnLoc_Local;
- } else if (flags & (DRM_BO_FLAG_MEM_TT | VIA_BO_FLAG_MEM_AGP)) {
+ } else if (flags & (WSBM_PL_FLAG_TT | VIA_PL_FLAG_AGP)) {
reg_tex_fm |= HC_HTXnLoc_AGP;
} else
abort();
@@ -446,8 +446,8 @@ ochr_tex_relocation(struct _ViaCommandBuffer *cBuf,
val_req->presumed_flags = VIA_USE_PRESUMED;
val_req->presumed_gpu_offset =
(uint64_t) driBOOffset(addr[i].buf);
- if (driBOFlags(addr[i].buf) &
- (DRM_BO_FLAG_MEM_TT | VIA_BO_FLAG_MEM_AGP))
+ if (driBOPlacement(addr[i].buf) &
+ (WSBM_PL_FLAG_TT | VIA_PL_FLAG_AGP))
val_req->presumed_flags |= VIA_PRESUMED_AGP;
}
@@ -455,7 +455,7 @@ ochr_tex_relocation(struct _ViaCommandBuffer *cBuf,
fake[count].offset = val_req->presumed_gpu_offset;
fake[count].flags =
fake[count].flags = (val_req->presumed_flags & VIA_PRESUMED_AGP) ?
- DRM_BO_FLAG_MEM_TT : DRM_BO_FLAG_MEM_VRAM;
+ WSBM_PL_FLAG_TT : WSBM_PL_FLAG_VRAM;
real_addr[count].index = itemLoc;
real_addr[count].delta = addr[i].delta;
fake_addr[count].index = count;
@@ -620,8 +620,17 @@ ochr_execbuf(int fd, struct _ViaCommandBuffer *cBuf)
exec_req->cmd_buffer = (uint64_t) (unsigned long)
cBuf->buf;
exec_req->cmd_buffer_size = cBuf->pos << 2;
- exec_req->engine = VIA_ENGINE_PCI;
- exec_req->exec_flags = DRM_VIA_FENCE_NO_USER;
+
+ /*
+ * FIXME: Use AGP when we've resolved the locks that happen
+ * when we run 3D DRI clients and X server AGP command submission.
+ */
+
+ /* exec_req->mechanism = (cBuf->needsPCI) ?
+ _VIA_MECHANISM_PCI : _VIA_MECHANISM_AGP; */
+ exec_req->mechanism = (cBuf->needsPCI) ? _VIA_MECHANISM_PCI :
+ _VIA_MECHANISM_AGP;
+ exec_req->exec_flags = DRM_VIA_FENCE_NO_USER | cBuf->execFlags;
exec_req->cliprect_offset = 0;
exec_req->num_cliprects = 0;
@@ -629,6 +638,10 @@ ochr_execbuf(int fd, struct _ViaCommandBuffer *cBuf)
ret = drmCommandWriteRead(fd, DRM_VIA_TTM_EXECBUF, &arg, sizeof(arg));
} while (ret == -EAGAIN || ret == -EINTR);
+
+ if (ret)
+ ErrorF("Execbuf error %d: \"%s\".\n", ret, strerror(-ret));
+
iterator = validateListIterator(valList);
/*
@@ -655,7 +668,7 @@ ochr_execbuf(int fd, struct _ViaCommandBuffer *cBuf)
rep = &val_arg->d.rep;
wsDriUpdateKbuf((struct _DriKernelBuf *)node->buf,
- rep->gpu_offset, rep->flags);
+ rep->gpu_offset, rep->placement, rep->fence_type_mask);
iterator = validateListNext(valList, iterator);
}
diff --git a/src/via_3d.c b/src/via_3d.c
index c532ee0..4052a7c 100644
--- a/src/via_3d.c
+++ b/src/via_3d.c
@@ -320,7 +320,7 @@ via3DEmitQuad(Via3DState * v3d, ViaCommandBuffer * cb, int dstX, int dstY,
}
}
- wf = 0.05;
+ wf = 1.;
/*
* Vertex buffer. Emit two 3-point triangles. The W or Z coordinate
@@ -411,8 +411,8 @@ via3DEmitState(Via3DState * v3d, ViaCommandBuffer * cb, Bool forceUpload)
BEGIN_H2(HC_ParaType_NotTex, 3);
ret = ochr_dest_relocation(cb, v3d->destBuf,
v3d->destDelta,
- DRM_BO_FLAG_MEM_VRAM,
- DRM_BO_MASK_MEM);
+ WSBM_PL_FLAG_VRAM,
+ WSBM_PL_MASK_MEM);
OUT_RING_SubA(HC_SubA_HDBFM, v3d->destFormat |
(v3d->destPitch & HC_HDBPit_MASK) | HC_HDBLoc_Local);
ADVANCE_RING;
@@ -511,10 +511,10 @@ via3DEmitState(Via3DState * v3d, ViaCommandBuffer * cb, Bool forceUpload)
vTex->textureFormat;
ret = ochr_tex_relocation(cb, &vTex->list, 0, 0, regTexFM,
- DRM_BO_FLAG_MEM_VRAM |
- DRM_BO_FLAG_MEM_TT |
- VIA_BO_FLAG_MEM_AGP,
- DRM_BO_MASK_MEM);
+ WSBM_PL_FLAG_VRAM |
+ WSBM_PL_FLAG_TT |
+ VIA_PL_FLAG_AGP,
+ WSBM_PL_MASK_MEM);
if (vTex->npot) {
OUT_RING_SubA(HC_SubA_HTXnL0Pit,
diff --git a/src/via_accel.c b/src/via_accel.c
index 0fd82ae..ca77d30 100644
--- a/src/via_accel.c
+++ b/src/via_accel.c
@@ -86,7 +86,7 @@ viaFlushDRIEnabled(ViaCommandBuffer * cb)
ScrnInfoPtr pScrn = cb->pScrn;
VIAPtr pVia = VIAPTR(pScrn);
int tmpSize;
- int ret;
+ int ret = 0;
Via3DState *v3d = &pVia->v3d;
/* Align end of command buffer for AGP DMA. */
@@ -98,7 +98,12 @@ viaFlushDRIEnabled(ViaCommandBuffer * cb)
tmpSize = cb->pos * sizeof(CARD32);
cb->mode = 0;
cb->has3dState = FALSE;
- ret = ochr_execbuf(pVia->drmFD, cb);
+
+ if (cb->pos > 0)
+ ret = ochr_execbuf(pVia->drmFD, cb);
+
+ cb->needsPCI = FALSE;
+ cb->execFlags = 0x0;
if (ret) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -146,7 +151,6 @@ viaSetupCBuffer(ScrnInfoPtr pScrn, ViaCommandBuffer * buf, unsigned size)
buf->buf = (CARD32 *) xcalloc(buf->bufSize, sizeof(CARD32));
if (!buf->buf)
return BadAlloc;
- buf->waitFlags = 0;
buf->pos = 0;
buf->mode = 0;
buf->header_start = 0;
@@ -154,6 +158,8 @@ viaSetupCBuffer(ScrnInfoPtr pScrn, ViaCommandBuffer * buf, unsigned size)
buf->has3dState = FALSE;
buf->flushFunc = NULL;
buf->inComposite = FALSE;
+ buf->needsPCI = FALSE;
+ buf->execFlags = 0x0;
#ifdef XF86DRI
if (pVia->directRenderingEnabled) {
buf->flushFunc = viaFlushDRIEnabled;
@@ -302,7 +308,7 @@ viaEmitPixmap(ViaCommandBuffer *cb,
OUT_RING_H1(VIA_REG_DSTBASE, 0);
OUT_RING_H1(VIA_REG_DSTPOS, 0);
ret = ochr_2d_relocation(cb, buf, delta, 32, 0,
- DRM_BO_FLAG_MEM_VRAM, DRM_BO_MASK_MEM);
+ WSBM_PL_FLAG_VRAM, WSBM_PL_MASK_MEM);
if (ret)
goto out_err;
cb->dstPixmap = pDstPix;
@@ -313,7 +319,7 @@ viaEmitPixmap(ViaCommandBuffer *cb,
OUT_RING_H1(VIA_REG_SRCBASE, 0);
OUT_RING_H1(VIA_REG_SRCPOS, 0);
ret = ochr_2d_relocation(cb, buf, delta, 32, 0,
- DRM_BO_FLAG_MEM_VRAM, DRM_BO_MASK_MEM);
+ WSBM_PL_FLAG_VRAM, WSBM_PL_MASK_MEM);
if (ret)
goto out_err;
cb->srcPixmap = pSrcPix;
@@ -342,7 +348,7 @@ viaAccelSolidHelper(ViaCommandBuffer * cb, int x, int y, int w, int h,
OUT_RING_H1(VIA_REG_DSTBASE, 0);
OUT_RING_H1(VIA_REG_DSTPOS, 0);
ret = ochr_2d_relocation(cb, buf, delta, bpp, pos,
- DRM_BO_FLAG_MEM_VRAM, DRM_BO_MASK_MEM);
+ WSBM_PL_FLAG_VRAM, WSBM_PL_MASK_MEM);
OUT_RING_H1(VIA_REG_DIMENSION, ((h - 1) << 16) | (w - 1));
OUT_RING_H1(VIA_REG_FGCOLOR, fg);
OUT_RING_H1(VIA_REG_GECMD, cmd);
@@ -495,11 +501,11 @@ viaAccelCopyHelper(ViaCommandBuffer * cb, int xs, int ys, int xd, int yd,
OUT_RING_H1(VIA_REG_SRCBASE, 0);
OUT_RING_H1(VIA_REG_SRCPOS, 0);
ret = ochr_2d_relocation(cb, buf, delta, bpp, srcPos,
- DRM_BO_FLAG_MEM_VRAM, DRM_BO_MASK_MEM);
+ WSBM_PL_FLAG_VRAM, WSBM_PL_MASK_MEM);
OUT_RING_H1(VIA_REG_DSTBASE, 0);
OUT_RING_H1(VIA_REG_DSTPOS, 0);
ret = ochr_2d_relocation(cb, buf, delta, bpp, dstPos,
- DRM_BO_FLAG_MEM_VRAM, DRM_BO_MASK_MEM);
+ WSBM_PL_FLAG_VRAM, WSBM_PL_MASK_MEM);
OUT_RING_H1(VIA_REG_PITCH, VIA_PITCH_ENABLE |
((dstPitch >> 3) << 16) | (srcPitch >> 3));
OUT_RING_H1(VIA_REG_DIMENSION, ((h - 1) << 16) | (w - 1));
@@ -601,8 +607,6 @@ viaExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg)
VIAPtr pVia = VIAPTR(pScrn);
ViaTwodContext *tdc = &pVia->td;
- RING_VARS;
-
if (exaGetPixmapPitch(pPixmap) & 7)
return FALSE;
@@ -611,7 +615,6 @@ viaExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg)
if (!viaAccelPlaneMaskHelper(tdc, planeMask))
return FALSE;
- viaAccelTransparentHelper(tdc, cb, 0x0, 0x0, TRUE);
tdc->cmd = VIA_GEC_BLT | VIA_GEC_FIXCOLOR_PAT | VIAACCELPATTERNROP(alu);
@@ -634,6 +637,7 @@ viaExaSolid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2)
dstPitch = exaGetPixmapPitch(pPixmap);
dstOffset = viaExaSuperPixmapOffset(pPixmap, &buf);
+ viaAccelTransparentHelper(tdc, cb, 0x0, 0x0, TRUE);
viaAccelSolidPixmapHelper(cb, x1, y1, w, h, pPixmap,
tdc->mode, dstPitch, tdc->fgColor, tdc->cmd);
}
@@ -690,8 +694,6 @@ viaExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
VIAPtr pVia = VIAPTR(pScrn);
ViaTwodContext *tdc = &pVia->td;
- RING_VARS;
-
if (pSrcPixmap->drawable.bitsPerPixel != pDstPixmap->drawable.bitsPerPixel)
return FALSE;
@@ -712,7 +714,7 @@ viaExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
if (!viaAccelPlaneMaskHelper(tdc, planeMask))
return FALSE;
- viaAccelTransparentHelper(tdc, cb, 0x0, 0x0, TRUE);
+
tdc->pSrcPixmap = pSrcPixmap;
return TRUE;
@@ -730,6 +732,7 @@ viaExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY,
if (!width || !height)
return;
+ viaAccelTransparentHelper(tdc, cb, 0x0, 0x0, TRUE);
viaAccelCopyPixmapHelper(cb, srcX, srcY, dstX, dstY, width, height,
tdc->pSrcPixmap, pDstPixmap, tdc->mode, tdc->srcPitch,
exaGetPixmapPitch(pDstPixmap), tdc->cmd);
@@ -1059,11 +1062,10 @@ viaExaUploadToScratch(PixmapPtr pSrc, PixmapPtr pDst)
if (!entry)
return FALSE;
- ret = driGenBuffers(pVia->mainPool, "Scratch buffer", 1,
+ ret = driGenBuffers(pVia->mainPool, 1,
&entry->buf, 0,
- VIA_BO_FLAG_MEM_AGP |
- DRM_BO_FLAG_MEM_VRAM |
- DRM_BO_FLAG_READ, 0);
+ VIA_PL_FLAG_AGP |
+ WSBM_PL_FLAG_VRAM);
if (ret)
goto out_err0;
@@ -1077,7 +1079,7 @@ viaExaUploadToScratch(PixmapPtr pSrc, PixmapPtr pDst)
if (ret)
goto out_err1;
- dst = driBOMap(entry->buf, WS_DRI_MAP_WRITE);
+ dst = driBOMap(entry->buf, 1, WSBM_SYNCCPU_WRITE);
if (dst == NULL)
goto out_err1;
@@ -1349,8 +1351,8 @@ viaExaPrepareAccess(PixmapPtr pPix, int index)
buf = viaInBuffer(&pVia->offscreen, ptr);
if (buf) {
flags = (index == EXA_PREPARE_DEST) ?
- DRM_BO_FLAG_WRITE : DRM_BO_FLAG_READ;
- virtual = driBOMap(buf->buf, flags);
+ WSBM_SYNCCPU_WRITE : WSBM_SYNCCPU_READ;
+ virtual = driBOMap(buf->buf, 1, flags);
}
return TRUE;
}
@@ -1476,11 +1478,9 @@ viaInitAccel(ScreenPtr pScreen)
* Pixmap cache.
*/
- ret = driGenBuffers(pVia->mainPool, "Pixmap cache", 1,
+ ret = driGenBuffers(pVia->mainPool, 1,
&pVia->exaMem.buf, 0,
- DRM_BO_FLAG_MEM_VRAM |
- DRM_BO_FLAG_READ |
- DRM_BO_FLAG_WRITE, 0);
+ WSBM_PL_FLAG_VRAM);
if (ret) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"[Accel] Failed allocating offscreen pixmap space.\n");
@@ -1494,7 +1494,8 @@ viaInitAccel(ScreenPtr pScreen)
goto out_err0;
}
- pVia->exaMem.virtual = driBOMap(pVia->exaMem.buf, WS_DRI_MAP_READ | WS_DRI_MAP_WRITE);
+ pVia->exaMem.virtual = driBOMap(pVia->exaMem.buf, 1,
+ WSBM_SYNCCPU_READ | WSBM_SYNCCPU_WRITE);
if (pVia->exaMem.virtual == NULL) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"[Accel] Failed mapping offscreen pixmap space.\n");
diff --git a/src/via_cursor.c b/src/via_cursor.c
index 1abef1c..6784223 100644
--- a/src/via_cursor.c
+++ b/src/via_cursor.c
@@ -71,9 +71,9 @@ VIAHWCursorInit(ScreenPtr pScreen)
if (ret)
return FALSE;
- pVia->cursorMap = driBOMap(pVia->scanout.bufs[VIA_SCANOUT_CURSOR],
- WS_DRI_MAP_READ |
- WS_DRI_MAP_WRITE);
+ pVia->cursorMap = driBOMap(pVia->scanout.bufs[VIA_SCANOUT_CURSOR], 1,
+ WSBM_SYNCCPU_READ |
+ WSBM_SYNCCPU_WRITE);
if (pVia->cursorMap == NULL)
return FALSE;
diff --git a/src/via_dmabuffer.h b/src/via_dmabuffer.h
index 478b259..a669373 100644
--- a/src/via_dmabuffer.h
+++ b/src/via_dmabuffer.h
@@ -32,7 +32,6 @@ typedef struct _ViaCommandBuffer
{
ScrnInfoPtr pScrn;
CARD32 *buf;
- CARD32 waitFlags;
unsigned pos;
unsigned reserved;
unsigned bufSize;
@@ -50,6 +49,10 @@ typedef struct _ViaCommandBuffer
Bool inComposite;
unsigned int compWidth;
unsigned int compHeight;
+
+ Bool needsPCI;
+ CARD32 execFlags;
+
} ViaCommandBuffer;
#define VIA_DMASIZE 16384
diff --git a/src/via_driver.c b/src/via_driver.c
index 2e97444..82ef52d 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -1797,18 +1797,16 @@ VIAEnterVT(int scrnIndex, int flags)
retVal = driBOData(pVia->scanout.bufs[VIA_SCANOUT_DISPLAY],
pVia->Bpl * pScrn->virtualY , NULL, NULL,
- DRM_BO_FLAG_MEM_VRAM |
- DRM_BO_FLAG_READ |
- DRM_BO_FLAG_WRITE |
- DRM_BO_FLAG_NO_EVICT |
- DRM_BO_FLAG_SHAREABLE);
+ WSBM_PL_FLAG_VRAM |
+ WSBM_PL_FLAG_NO_EVICT |
+ WSBM_PL_FLAG_SHARED);
if (retVal) {
xf86DrvMsg(scrnIndex, X_ERROR,
"Failed reallocating the display buffer.");
return FALSE;
}
- pVia->displayMap = driBOMap(pVia->scanout.bufs[VIA_SCANOUT_DISPLAY],
- WS_DRI_MAP_READ | WS_DRI_MAP_WRITE);
+ pVia->displayMap = driBOMap(pVia->scanout.bufs[VIA_SCANOUT_DISPLAY], 1,
+ WSBM_SYNCCPU_READ | WSBM_SYNCCPU_WRITE);
if (!pVia->displayMap) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Failed mapping display video RAM: \"%s\".\n",
@@ -1822,8 +1820,8 @@ VIAEnterVT(int scrnIndex, int flags)
viaNewRootPixmap(pScrn);
retVal = driBOSetStatus(pVia->scanout.bufs[VIA_SCANOUT_DISPLAY],
- DRM_BO_FLAG_MEM_VRAM | DRM_BO_FLAG_NO_EVICT,
- DRM_BO_FLAG_MEM_LOCAL);
+ WSBM_PL_FLAG_VRAM | WSBM_PL_FLAG_NO_EVICT,
+ WSBM_PL_FLAG_SYSTEM);
if (retVal) {
xf86DrvMsg(scrnIndex, X_ERROR,
"Failed moving in the display buffer.");
@@ -1834,8 +1832,8 @@ VIAEnterVT(int scrnIndex, int flags)
pScrn->AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
retVal = driBOSetStatus(pVia->scanout.bufs[VIA_SCANOUT_CURSOR],
- DRM_BO_FLAG_MEM_VRAM | DRM_BO_FLAG_NO_EVICT,
- DRM_BO_FLAG_MEM_LOCAL);
+ WSBM_PL_FLAG_VRAM | WSBM_PL_FLAG_NO_EVICT,
+ WSBM_PL_FLAG_SYSTEM);
if (retVal) {
xf86DrvMsg(scrnIndex, X_ERROR,
@@ -1923,11 +1921,11 @@ VIALeaveVT(int scrnIndex, int flags)
*/
(void) driBOSetStatus(pVia->scanout.bufs[VIA_SCANOUT_DISPLAY],
0,
- DRM_BO_FLAG_NO_EVICT);
+ WSBM_PL_FLAG_NO_EVICT);
(void) driBOSetStatus(pVia->scanout.bufs[VIA_SCANOUT_CURSOR],
0,
- DRM_BO_FLAG_NO_EVICT);
+ WSBM_PL_FLAG_NO_EVICT);
(void) driBOData(pVia->scanout.bufs[VIA_SCANOUT_DISPLAY],
0, NULL, NULL, 0);
@@ -2520,12 +2518,10 @@ VIAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
"This driver currently requires DRM to operate.\n");
goto out_err1;
}
- ret = driGenBuffers(pVia->mainPool, "Scanouts", VIA_SCANOUT_NUM,
+ ret = driGenBuffers(pVia->mainPool, VIA_SCANOUT_NUM,
pVia->scanout.bufs, 0,
- DRM_BO_FLAG_MEM_VRAM |
- DRM_BO_FLAG_READ |
- DRM_BO_FLAG_WRITE |
- DRM_BO_FLAG_NO_EVICT, 0);
+ WSBM_PL_FLAG_VRAM |
+ WSBM_PL_FLAG_NO_EVICT);
if (ret) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Failed allocating scanout buffers.\n");
@@ -2547,11 +2543,9 @@ VIAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
displaySize = pVia->Bpl*pScrn->virtualY;
ret = driBOData(pVia->scanout.bufs[VIA_SCANOUT_DISPLAY],
displaySize, NULL, NULL,
- DRM_BO_FLAG_MEM_VRAM |
- DRM_BO_FLAG_WRITE |
- DRM_BO_FLAG_READ |
- DRM_BO_FLAG_NO_EVICT |
- DRM_BO_FLAG_SHAREABLE);
+ WSBM_PL_FLAG_VRAM |
+ WSBM_PL_FLAG_NO_EVICT |
+ WSBM_PL_FLAG_SHARED);
if (ret) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Failed allocating display video RAM: \"%s\".\n",
@@ -2561,8 +2555,8 @@ VIAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pVia->front.buf = driBOReference(pVia->scanout.bufs[VIA_SCANOUT_DISPLAY]);
pVia->displayMap = NULL;
- pVia->displayMap = driBOMap(pVia->scanout.bufs[VIA_SCANOUT_DISPLAY],
- WS_DRI_MAP_READ | WS_DRI_MAP_WRITE);
+ pVia->displayMap = driBOMap(pVia->scanout.bufs[VIA_SCANOUT_DISPLAY], 1,
+ WSBM_SYNCCPU_READ | WSBM_SYNCCPU_WRITE);
if (!pVia->displayMap) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Failed mapping display video RAM: \"%s\".\n",
diff --git a/src/via_memcpy.c b/src/via_memcpy.c
index 5bb3b00..3728aa9 100644
--- a/src/via_memcpy.c
+++ b/src/via_memcpy.c
@@ -580,11 +580,10 @@ viaVidCopyInit(char *copyType, ScreenPtr pScreen)
* player buffer (buf2) and a pool of uninitialized "video" data (buf3).
*/
- ret = driGenBuffers(pVia->mainPool, "video test buffer", 1,
+ ret = driGenBuffers(pVia->mainPool, 1,
&tmpFbBuffer, 0,
- DRM_BO_FLAG_MEM_VRAM |
- DRM_BO_FLAG_READ |
- DRM_BO_FLAG_NO_EVICT, 0);
+ WSBM_PL_FLAG_VRAM |
+ WSBM_PL_FLAG_NO_EVICT);
if (ret)
return libc_YUV42X;
@@ -595,7 +594,7 @@ viaVidCopyInit(char *copyType, ScreenPtr pScreen)
return libc_YUV42X;
}
- buf1 = driBOMap(tmpFbBuffer, WS_DRI_MAP_WRITE);
+ buf1 = driBOMap(tmpFbBuffer, 1, WSBM_SYNCCPU_WRITE);
if (!buf1) {
driDeleteBuffers(1, &tmpFbBuffer);
diff --git a/src/via_swov.c b/src/via_swov.c
index e35c273..6fbb92f 100644
--- a/src/via_swov.c
+++ b/src/via_swov.c
@@ -34,16 +34,10 @@
#include "xf86fbman.h"
#include "via.h"
-#ifdef XF86DRI
-#include "xf86drm.h"
-#endif
#include "via_driver.h"
#include "via_priv.h"
#include "via_swov.h"
-#ifdef XF86DRI
-#include "via_drm.h"
-#endif
#include "via_vgahw.h"
#include "via_id.h"
@@ -962,7 +956,7 @@ AddHQVSurface(ScrnInfoPtr pScrn, unsigned int numbuf, CARD32 fourcc)
if (retCode)
return BadAlloc;
- hqvMap = driBOMap(pVia->scanout.bufs[VIA_SCANOUT_OVERLAY], WS_DRI_MAP_WRITE);
+ hqvMap = driBOMap(pVia->scanout.bufs[VIA_SCANOUT_OVERLAY], 1, WSBM_SYNCCPU_WRITE);
if (hqvMap == NULL)
return BadAlloc;
@@ -1016,22 +1010,21 @@ CreateSurface(ScrnInfoPtr pScrn, CARD32 FourCC, CARD16 Width,
}
if (doalloc) {
- uint64_t hqvFlag = VIA_BO_FLAG_HQV0;
+ uint64_t hqvFlag = VIA_VAL_FLAG_HQV0;
if (pVia->ChipId == PCI_CHIP_VT3259
&& !(pVia->swov.gdwVideoFlagSW & VIDEO_1_INUSE))
- hqvFlag = VIA_BO_FLAG_HQV1;
+ hqvFlag = VIA_VAL_FLAG_HQV1;
for (i=0; i<2; ++i) {
struct _HQVBuffer *hqvBuf = &pVia->swov.SWDevice.hqvBuf[i];
if (!hqvBuf->buf) {
- retCode = driGenBuffers(pVia->mainPool, "HQV source", 1,
+ retCode = driGenBuffers(pVia->mainPool, 1,
&hqvBuf->buf, 0,
- DRM_BO_FLAG_MEM_VRAM |
- DRM_BO_FLAG_READ |
- hqvFlag, 0);
+ WSBM_PL_FLAG_VRAM |
+ hqvFlag);
if (retCode) {
hqvBuf->buf = NULL;
goto out_err;
@@ -1042,7 +1035,7 @@ CreateSurface(ScrnInfoPtr pScrn, CARD32 FourCC, CARD16 Width,
if (retCode)
goto out_err;
- hqvBuf->virtual = driBOMap(hqvBuf->buf, WS_DRI_MAP_WRITE);
+ hqvBuf->virtual = driBOMap(hqvBuf->buf, 1, WSBM_SYNCCPU_WRITE);
if (hqvBuf->virtual == NULL)
goto out_err;
@@ -1877,7 +1870,7 @@ Upd_Video(ScrnInfoPtr pScrn, unsigned long videoFlag,
* initialization done.
*/
- ret = driBOSetStatus(hqvBuf->buf, DRM_BO_FLAG_NO_EVICT, 0);
+ ret = driBOSetStatus(hqvBuf->buf, WSBM_PL_FLAG_NO_EVICT, 0);
hqvBuf->pinnedOffset = driBOOffset(hqvBuf->buf);
viaSetHqvSrc(pScrn, pVia->swov.SrcFourCC, hqvBuf);
@@ -1930,7 +1923,7 @@ Upd_Video(ScrnInfoPtr pScrn, unsigned long videoFlag,
DBG_DD(ErrorF(" Wait flips6"));
}
- ret = driBOSetStatus(hqvBuf->buf, 0, DRM_BO_FLAG_NO_EVICT);
+ ret = driBOSetStatus(hqvBuf->buf, 0, WSBM_PL_FLAG_NO_EVICT);
if (videoFlag & VIDEO_1_INUSE) {
VIDOutD(V1_CONTROL, vidCtl);
diff --git a/src/via_video.c b/src/via_video.c
index 18384b9..869b055 100644
--- a/src/via_video.c
+++ b/src/via_video.c
@@ -1061,7 +1061,7 @@ viaVideoFlip(VIAPtr pVia, int fourcc,
unsigned long DisplayBufferIndex)
{
unsigned long proReg = 0x200;
- uint64_t hqvFlag = VIA_BO_FLAG_HQV0;
+ uint64_t hqvFlag = VIA_VAL_FLAG_HQV0;
struct _HQVBuffer *hqvBuf = &pVia->swov.SWDevice.hqvBuf[DisplayBufferIndex];
int ret;
RING_VARS;
@@ -1070,7 +1070,7 @@ viaVideoFlip(VIAPtr pVia, int fourcc,
if (pVia->ChipId == PCI_CHIP_VT3259
&& !(pVia->swov.gdwVideoFlagSW & VIDEO_1_INUSE)) {
proReg += PRO_HQV1_OFFSET;
- hqvFlag = VIA_BO_FLAG_HQV1;
+ hqvFlag = VIA_VAL_FLAG_HQV1;
}
switch (fourcc) {
@@ -1082,9 +1082,9 @@ viaVideoFlip(VIAPtr pVia, int fourcc,
OUT_RING_QW(HQV_SRC_STARTADDR_Y + proReg, 0);
ret = ochr_yuv_relocation(cb, hqvBuf->buf, 0, 1,
hqvBuf->deltaY, 0, 0,
- DRM_BO_FLAG_MEM_VRAM |
+ WSBM_PL_FLAG_VRAM |
hqvFlag,
- DRM_BO_MASK_MEM |
+ WSBM_PL_MASK_MEM |
hqvFlag);
break;
case FOURCC_YV12:
@@ -1094,9 +1094,9 @@ viaVideoFlip(VIAPtr pVia, int fourcc,
OUT_RING_QW(HQV_SRC_STARTADDR_U + proReg, 0);
ret = ochr_yuv_relocation(cb, hqvBuf->buf, 0, 2,
hqvBuf->deltaY, hqvBuf->deltaU, 0,
- DRM_BO_FLAG_MEM_VRAM |
+ WSBM_PL_FLAG_VRAM |
hqvFlag,
- DRM_BO_MASK_MEM |
+ WSBM_PL_MASK_MEM |
hqvFlag);
} else {
OUT_RING_QW(HQV_SRC_STARTADDR_U + proReg, 0);
@@ -1104,18 +1104,31 @@ viaVideoFlip(VIAPtr pVia, int fourcc,
ret = ochr_yuv_relocation(cb, hqvBuf->buf, 0, 3,
hqvBuf->deltaY, hqvBuf->deltaV,
hqvBuf->deltaU,
- DRM_BO_FLAG_MEM_VRAM |
+ WSBM_PL_FLAG_VRAM |
hqvFlag,
- DRM_BO_MASK_MEM |
+ WSBM_PL_MASK_MEM |
hqvFlag);
}
break;
}
- if (pVia->VideoEngine == VIDEO_ENGINE_CME)
+ if (pVia->VideoEngine == VIDEO_ENGINE_CME) {
pVia->swov.hqvCtl |= HQV_GEN_IRQ;
-
+ } else {
+ /*
+ * Only CME supports the Header 6 (H6) commands
+ * with the AGP command reader.
+ */
+ cb->needsPCI = TRUE;
+ }
+
+ /*
+ * Tell DRM to wait on HQV idle before submitting this.
+ */
+
+ cb->execFlags = DRM_VIA_WAIT_BARRIER;
+
OUT_RING_QW(HQV_CONTROL + proReg,
(pVia->swov.hqvCtl & ~HQV_FLIP_ODD) |
HQV_SW_FLIP | HQV_FLIP_STATUS);
@@ -1339,7 +1352,7 @@ viaPutImage(ScrnInfoPtr pScrn,
}
hqvBuf = &pVia->swov.SWDevice.hqvBuf[pVia->dwFrameNum & 1];
- virtual = driBOMap(hqvBuf->buf, WS_DRI_MAP_WRITE);
+ virtual = driBOMap(hqvBuf->buf, 1, WSBM_SYNCCPU_WRITE);
if (virtual == NULL) {
viaXvError(pScrn, pPriv, xve_mem);