summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Huillet <arthur.huillet@free.fr>2007-07-20 01:22:11 +0200
committerArthur Huillet <arthur.huillet@free.fr>2007-07-20 01:22:11 +0200
commita97181f95a1f5da6180b8a72f3ca307079b92079 (patch)
tree1aeb23e84feb720a60d44d8ab9d02dede6ffe45a
parent81cc744eb31343a509f9ca0d37993d462f162d80 (diff)
downloadxorg-driver-xf86-video-nouveau-a97181f95a1f5da6180b8a72f3ca307079b92079.tar.gz
now yielding in the wait for notifier for Xv only
-rw-r--r--src/nv_exa.c10
-rw-r--r--src/nv_notifier.c36
-rw-r--r--src/nv_video.c28
3 files changed, 53 insertions, 21 deletions
diff --git a/src/nv_exa.c b/src/nv_exa.c
index da73669..fde1d09 100644
--- a/src/nv_exa.c
+++ b/src/nv_exa.c
@@ -285,8 +285,6 @@ NVAccelDownloadM2MF(ScrnInfoPtr pScrn, char *dst, uint64_t src_offset,
NVPtr pNv = NVPTR(pScrn);
setM2MFDirection(pScrn, 0);
- if (!NVNotifierWaitStatus(pScrn, pNv->Notifier0, 0, 0))
- return FALSE;
while (line_count) {
char *src = pNv->GARTScratch->map;
@@ -377,9 +375,6 @@ NVAccelUploadM2MF(ScrnInfoPtr pScrn, uint64_t dst_offset, const char *src,
setM2MFDirection(pScrn, 1);
- if (!NVNotifierWaitStatus(pScrn, pNv->Notifier0, 0, 0))
- return FALSE;
-
while (line_count) {
char *dst = pNv->GARTScratch->map;
int lc, i;
@@ -425,9 +420,8 @@ NVAccelUploadM2MF(ScrnInfoPtr pScrn, uint64_t dst_offset, const char *src,
NVDmaStart(pNv, NvSubMemFormat, 0x100, 1);
NVDmaNext (pNv, 0);
NVDmaKickoff(pNv);
- if ( line_count - lc > 0 )
- if (!NVNotifierWaitStatus(pScrn, pNv->Notifier0, 0, 0))
- return FALSE;
+ if (!NVNotifierWaitStatus(pScrn, pNv->Notifier0, 0, 0))
+ return FALSE;
line_count -= lc;
}
diff --git a/src/nv_notifier.c b/src/nv_notifier.c
index 70a7fcc..866ebf8 100644
--- a/src/nv_notifier.c
+++ b/src/nv_notifier.c
@@ -130,3 +130,39 @@ NVNotifierWaitStatus(ScrnInfoPtr pScrn,
return FALSE;
}
+Bool
+NVNotifierWaitStatusSleep(ScrnInfoPtr pScrn,
+ struct drm_nouveau_notifier_alloc *notifier,
+ unsigned int status, unsigned int timeout)
+{
+ NOTIFIER(n);
+ unsigned int t_start, time = 0;
+
+ t_start = GetTimeInMillis();
+ while (time <= timeout) {
+#if 0
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "N(0x%08x)/%d = 0x%08x/0x%08x/0x%08x/0x%08x\n",
+ notifier->handle, time, n[0], n[1], n[2], n[3]);
+#endif
+ if (n[NV_NOTIFY_STATE/4] & NV_NOTIFY_STATE_ERROR_CODE_MASK) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Notifier returned error: 0x%04x\n",
+ NVNotifierErrorCode(pScrn, notifier));
+ return FALSE;
+ }
+
+ if ((n[NV_NOTIFY_STATE/4] >> NV_NOTIFY_STATE_STATUS_SHIFT)
+ == status)
+ return TRUE;
+
+ if (timeout)
+ time = GetTimeInMillis() - t_start;
+ sched_yield();
+ }
+
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Notifier (0x%08x) timeout!\n", notifier->handle);
+ return FALSE;
+}
+
diff --git a/src/nv_video.c b/src/nv_video.c
index 7a0d070..890d731 100644
--- a/src/nv_video.c
+++ b/src/nv_video.c
@@ -558,6 +558,10 @@ NVPutBlitImage(ScrnInfoPtr pScrn, int src_offset, int id,
NVDmaStart(pNv, NvSubScaledImage, STRETCH_BLIT_FORMAT, 1);
NVDmaNext (pNv, src_format);
}
+
+ NVDmaStart(pNv, NvSubScaledImage,
+ NV04_SCALED_IMAGE_FROM_MEMORY_DMA_IMAGE, 1);
+ NVDmaNext (pNv, NvDmaTT); /* source object */
while(nbox--) {
NVDmaStart(pNv, NvSubRectangle, RECT_SOLID_COLOR, 1);
@@ -1128,10 +1132,7 @@ NVPutImage(ScrnInfoPtr pScrn, short src_x, short src_y,
lc = pNv->GARTScratch->size / line_len;
}
-
- if (!NVNotifierWaitStatus(pScrn, pNv->Notifier0, 0, 0))
- //you lost
- return FALSE;
+
while (nlines > 0) { /*actually Xv doesn't like looping here much, especially for YV12*/
char *dst = pNv->GARTScratch->map;
@@ -1160,11 +1161,7 @@ NVPutImage(ScrnInfoPtr pScrn, short src_x, short src_y,
/* DMA to VRAM */
- NVNotifierReset(pScrn, pNv->Notifier0);
- NVDmaStart(pNv, NvSubMemFormat,
- NV_MEMORY_TO_MEMORY_FORMAT_NOTIFY, 1);
- NVDmaNext (pNv, 0);
-
+
NVDmaStart(pNv, NvSubMemFormat,
NV_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN, 8);
NVDmaNext (pNv, (uint32_t)pNv->GARTScratch->offset);
@@ -1176,11 +1173,16 @@ NVPutImage(ScrnInfoPtr pScrn, short src_x, short src_y,
NVDmaNext (pNv, (1<<8)|1);
NVDmaNext (pNv, 0);
+ NVNotifierReset(pScrn, pNv->Notifier0);
+ NVDmaStart(pNv, NvSubMemFormat,
+ NV_MEMORY_TO_MEMORY_FORMAT_NOTIFY, 1);
+ NVDmaNext (pNv, 0);
+ NVDmaStart(pNv, NvSubMemFormat, 0x100, 1);
+ NVDmaNext (pNv, 0);
NVDmaKickoff(pNv);
- if ( (nlines - lc ) > 0 )
- if (!NVNotifierWaitStatus(pScrn, pNv->Notifier0, 0, 0))
- //you lost
- return FALSE;
+
+ if (!NVNotifierWaitStatusSleep(pScrn, pNv->Notifier0, 0, 0))
+ return FALSE;
nlines -= lc;
}