summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2010-10-13 18:22:22 +0200
committerFrancisco Jerez <currojerez@riseup.net>2010-10-21 22:41:29 +0200
commit21ed642d3f76f286f23cd64ca817038ec94a1bf6 (patch)
treee79c0411343b6d30312de26abf4aac63fc412a97
parent258e483d47f0f63155be18981c1118261f7675a8 (diff)
downloadxorg-driver-xf86-video-nouveau-21ed642d3f76f286f23cd64ca817038ec94a1bf6.tar.gz
Make the sync-to-vblank helpers more consistent.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
-rw-r--r--src/nouveau_xv.c17
-rw-r--r--src/nv04_xv_blit.c12
-rw-r--r--src/nv30_xv_tex.c20
-rw-r--r--src/nv40_xv_tex.c20
-rw-r--r--src/nv50_accel.c28
-rw-r--r--src/nv50_xv.c33
-rw-r--r--src/nv_accel_common.c26
-rw-r--r--src/nv_proto.h3
8 files changed, 71 insertions, 88 deletions
diff --git a/src/nouveau_xv.c b/src/nouveau_xv.c
index b531f10..695c620 100644
--- a/src/nouveau_xv.c
+++ b/src/nouveau_xv.c
@@ -193,23 +193,6 @@ nv_window_belongs_to_crtc(ScrnInfoPtr pScrn, int x, int y, int w, int h)
return mask;
}
-void
-NVWaitVSync(ScrnInfoPtr pScrn, int crtc)
-{
- NVPtr pNv = NVPTR(pScrn);
- struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *blit = pNv->NvImageBlit;
-
- BEGIN_RING(chan, blit, 0x0000012C, 1);
- OUT_RING (chan, 0);
- BEGIN_RING(chan, blit, 0x00000134, 1);
- OUT_RING (chan, crtc);
- BEGIN_RING(chan, blit, 0x00000100, 1);
- OUT_RING (chan, 0);
- BEGIN_RING(chan, blit, 0x00000130, 1);
- OUT_RING (chan, 0);
-}
-
/**
* NVSetPortDefaults
* set attributes of port "pPriv" to compiled-in (except for colorKey) defaults
diff --git a/src/nv04_xv_blit.c b/src/nv04_xv_blit.c
index 3828fa4..55d82c4 100644
--- a/src/nv04_xv_blit.c
+++ b/src/nv04_xv_blit.c
@@ -82,7 +82,6 @@ NVPutBlitImage(ScrnInfoPtr pScrn, struct nouveau_bo *src, int src_offset,
struct nouveau_grobj *rect = pNv->NvRectangle;
struct nouveau_grobj *sifm = pNv->NvScaledImage;
struct nouveau_bo *bo = nouveau_pixmap_bo(ppix);
- unsigned int crtcs;
int dst_format;
if (!NVAccelGetCtxSurf2DFormatFromPixmap(ppix, &dst_format))
@@ -130,14 +129,9 @@ NVPutBlitImage(ScrnInfoPtr pScrn, struct nouveau_bo *src, int src_offset,
}
if(pPriv->SyncToVBlank) {
- crtcs = nv_window_belongs_to_crtc(pScrn, dstBox->x1, dstBox->y1,
- dstBox->x2, dstBox->y2);
-
- FIRE_RING (chan);
- if (crtcs & 0x1)
- NVWaitVSync(pScrn, 0);
- else if (crtcs & 0x2)
- NVWaitVSync(pScrn, 1);
+ FIRE_RING(chan);
+ NV11SyncToVBlank(ppix, dstBox->x1, dstBox->y1,
+ dstBox->x2, dstBox->y2);
}
if (pNv->dev->chipset >= 0x05) {
diff --git a/src/nv30_xv_tex.c b/src/nv30_xv_tex.c
index f4bc1da..61558e9 100644
--- a/src/nv30_xv_tex.c
+++ b/src/nv30_xv_tex.c
@@ -258,7 +258,7 @@ NV30PutTextureImage(ScrnInfoPtr pScrn, struct nouveau_bo *src, int src_offset,
struct nouveau_channel *chan = pNv->chan;
struct nouveau_grobj *rankine = pNv->Nv3D;
struct nouveau_bo *bo = nouveau_pixmap_bo(ppix);
- Bool redirected = FALSE, bicubic = pPriv->bicubic;
+ Bool bicubic = pPriv->bicubic;
float X1, X2, Y1, Y2;
BoxPtr pbox;
int nbox;
@@ -275,11 +275,6 @@ NV30PutTextureImage(ScrnInfoPtr pScrn, struct nouveau_bo *src, int src_offset,
return BadImplementation;
}
-#ifdef COMPOSITE
- if (!nouveau_exa_pixmap_is_onscreen(ppix))
- redirected = TRUE;
-#endif
-
pbox = REGION_RECTS(clipBoxes);
nbox = REGION_NUM_RECTS(clipBoxes);
@@ -353,15 +348,10 @@ NV30PutTextureImage(ScrnInfoPtr pScrn, struct nouveau_bo *src, int src_offset,
}
/* Just before rendering we wait for vblank in the non-composited case. */
- if (pPriv->SyncToVBlank && !redirected) {
- uint8_t crtcs = nv_window_belongs_to_crtc(pScrn, dstBox->x1, dstBox->y1,
- dstBox->x2 - dstBox->x1, dstBox->y2 - dstBox->y1);
-
- FIRE_RING (chan);
- if (crtcs & 0x1)
- NVWaitVSync(pScrn, 0);
- else if (crtcs & 0x2)
- NVWaitVSync(pScrn, 1);
+ if (pPriv->SyncToVBlank) {
+ FIRE_RING(chan);
+ NV11SyncToVBlank(ppix, dstBox->x1, dstBox->y1,
+ dstBox->x2, dstBox->y2);
}
/* These are fixed point values in the 16.16 format. */
diff --git a/src/nv40_xv_tex.c b/src/nv40_xv_tex.c
index a46f1e3..602bb7a 100644
--- a/src/nv40_xv_tex.c
+++ b/src/nv40_xv_tex.c
@@ -262,7 +262,7 @@ NV40PutTextureImage(ScrnInfoPtr pScrn,
struct nouveau_channel *chan = pNv->chan;
struct nouveau_grobj *curie = pNv->Nv3D;
struct nouveau_bo *bo = nouveau_pixmap_bo(ppix);
- Bool redirected = FALSE, bicubic = pPriv->bicubic;
+ Bool bicubic = pPriv->bicubic;
float X1, X2, Y1, Y2;
BoxPtr pbox;
int nbox;
@@ -279,11 +279,6 @@ NV40PutTextureImage(ScrnInfoPtr pScrn,
return BadImplementation;
}
-#ifdef COMPOSITE
- if (!nouveau_exa_pixmap_is_onscreen(ppix))
- redirected = TRUE;
-#endif
-
pbox = REGION_RECTS(clipBoxes);
nbox = REGION_NUM_RECTS(clipBoxes);
@@ -342,15 +337,10 @@ NV40PutTextureImage(ScrnInfoPtr pScrn,
OUT_RING (chan, 1);
/* Just before rendering we wait for vblank in the non-composited case. */
- if (pPriv->SyncToVBlank && !redirected) {
- uint8_t crtcs = nv_window_belongs_to_crtc(pScrn, dstBox->x1, dstBox->y1,
- dstBox->x2 - dstBox->x1, dstBox->y2 - dstBox->y1);
-
- FIRE_RING (chan);
- if (crtcs & 0x1)
- NVWaitVSync(pScrn, 0);
- else if (crtcs & 0x2)
- NVWaitVSync(pScrn, 1);
+ if (pPriv->SyncToVBlank) {
+ FIRE_RING(chan);
+ NV11SyncToVBlank(ppix, dstBox->x1, dstBox->y1,
+ dstBox->x2, dstBox->y2);
}
/* These are fixed point values in the 16.16 format. */
diff --git a/src/nv50_accel.c b/src/nv50_accel.c
index f5d2bc3..d0def57 100644
--- a/src/nv50_accel.c
+++ b/src/nv50_accel.c
@@ -23,6 +23,34 @@
#include "nv_include.h"
#include "nv50_accel.h"
+void
+NV50SyncToVBlank(PixmapPtr ppix, int x1, int y1, int x2, int y2)
+{
+ ScrnInfoPtr pScrn = xf86Screens[ppix->drawable.pScreen->myNum];
+ NVPtr pNv = NVPTR(pScrn);
+ struct nouveau_channel *chan = pNv->chan;
+ struct nouveau_grobj *nvsw = pNv->NvSW;
+ int crtcs;
+
+ if (!nouveau_exa_pixmap_is_onscreen(ppix))
+ return;
+
+ crtcs = nv_window_belongs_to_crtc(pScrn, x1, y1, x2 - x1, y2 - y1);
+ if (!crtcs)
+ return;
+
+ BEGIN_RING(chan, nvsw, 0x0060, 2);
+ OUT_RING (chan, pNv->vblank_sem->handle);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, nvsw, 0x006c, 1);
+ OUT_RING (chan, 0x22222222);
+ BEGIN_RING(chan, nvsw, 0x0404, 2);
+ OUT_RING (chan, 0x11111111);
+ OUT_RING (chan, ffs(crtcs) - 1);
+ BEGIN_RING(chan, nvsw, 0x0068, 1);
+ OUT_RING (chan, 0x11111111);
+}
+
Bool
NVAccelInitNV50TCL(ScrnInfoPtr pScrn)
{
diff --git a/src/nv50_xv.c b/src/nv50_xv.c
index b9349a2..87e22b5 100644
--- a/src/nv50_xv.c
+++ b/src/nv50_xv.c
@@ -265,34 +265,6 @@ nv50_xv_state_emit(PixmapPtr ppix, int id, struct nouveau_bo *src,
return TRUE;
}
-static void
-NV50EmitWaitForVBlank(PixmapPtr ppix, int x, int y, int w, int h)
-{
- ScrnInfoPtr pScrn = xf86Screens[ppix->drawable.pScreen->myNum];
- NVPtr pNv = NVPTR(pScrn);
- struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *nvsw = pNv->NvSW;
- int crtcs;
-
- if (!nouveau_exa_pixmap_is_onscreen(ppix))
- return;
-
- crtcs = nv_window_belongs_to_crtc(pScrn, x, y, w, h);
- if (!crtcs)
- return;
-
- BEGIN_RING(chan, nvsw, 0x0060, 2);
- OUT_RING (chan, pNv->vblank_sem->handle);
- OUT_RING (chan, 0);
- BEGIN_RING(chan, nvsw, 0x006c, 1);
- OUT_RING (chan, 0x22222222);
- BEGIN_RING(chan, nvsw, 0x0404, 2);
- OUT_RING (chan, 0x11111111);
- OUT_RING (chan, ffs(crtcs) - 1);
- BEGIN_RING(chan, nvsw, 0x0068, 1);
- OUT_RING (chan, 0x11111111);
-}
-
int
nv50_xv_image_put(ScrnInfoPtr pScrn,
struct nouveau_bo *src, int packed_y, int uv,
@@ -317,9 +289,8 @@ nv50_xv_image_put(ScrnInfoPtr pScrn,
return BadAlloc;
if (pPriv->SyncToVBlank) {
- NV50EmitWaitForVBlank(ppix, dstBox->x1, dstBox->y1,
- dstBox->x2 - dstBox->x1,
- dstBox->y2 - dstBox->y1);
+ NV50SyncToVBlank(ppix, dstBox->x1, dstBox->y1,
+ dstBox->x2, dstBox->y2);
}
/* These are fixed point values in the 16.16 format. */
diff --git a/src/nv_accel_common.c b/src/nv_accel_common.c
index 869a6d6..891615c 100644
--- a/src/nv_accel_common.c
+++ b/src/nv_accel_common.c
@@ -22,6 +22,32 @@
#include "nv_include.h"
+void
+NV11SyncToVBlank(PixmapPtr ppix, int x1, int y1, int x2, int y2)
+{
+ ScrnInfoPtr pScrn = xf86Screens[ppix->drawable.pScreen->myNum];
+ NVPtr pNv = NVPTR(pScrn);
+ struct nouveau_channel *chan = pNv->chan;
+ struct nouveau_grobj *blit = pNv->NvImageBlit;
+ int crtcs;
+
+ if (!nouveau_exa_pixmap_is_onscreen(ppix))
+ return;
+
+ crtcs = nv_window_belongs_to_crtc(pScrn, x1, y1, x2 - x1, y2 - y1);
+ if (!crtcs)
+ return;
+
+ BEGIN_RING(chan, blit, 0x0000012C, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, blit, 0x00000134, 1);
+ OUT_RING (chan, ffs(crtcs) - 1);
+ BEGIN_RING(chan, blit, 0x00000100, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, blit, 0x00000130, 1);
+ OUT_RING (chan, 0);
+}
+
static Bool
NVAccelInitDmaNotifier0(ScrnInfoPtr pScrn)
{
diff --git a/src/nv_proto.h b/src/nv_proto.h
index 7c836b2..50f67f5 100644
--- a/src/nv_proto.h
+++ b/src/nv_proto.h
@@ -16,6 +16,7 @@ Bool NVAccelGetCtxSurf2DFormatFromPixmap(PixmapPtr pPix, int *fmt_ret);
Bool NVAccelGetCtxSurf2DFormatFromPicture(PicturePtr pPix, int *fmt_ret);
PixmapPtr NVGetDrawablePixmap(DrawablePtr pDraw);
void NVAccelFree(ScrnInfoPtr pScrn);
+void NV11SyncToVBlank(PixmapPtr ppix, int x1, int y1, int x2, int y2);
/* in nouveau_dri2.c */
Bool nouveau_dri2_init(ScreenPtr pScreen);
@@ -24,7 +25,6 @@ void nouveau_dri2_fini(ScreenPtr pScreen);
/* in nouveau_xv.c */
void NVInitVideo(ScreenPtr);
void NVTakedownVideo(ScrnInfoPtr);
-void NVWaitVSync(ScrnInfoPtr pScrn, int crtc);
void NVSetPortDefaults (ScrnInfoPtr pScrn, NVPortPrivPtr pPriv);
unsigned int nv_window_belongs_to_crtc(ScrnInfoPtr, int, int, int, int);
@@ -125,6 +125,7 @@ int NV40GetTexturePortAttribute(ScrnInfoPtr, Atom, INT32 *, pointer);
int NV40SetTexturePortAttribute(ScrnInfoPtr, Atom, INT32, pointer);
/* in nv50_accel.c */
+void NV50SyncToVBlank(PixmapPtr ppix, int x1, int y1, int x2, int y2);
Bool NVAccelInitNV50TCL(ScrnInfoPtr pScrn);
/* in nv50_exa.c */