Mailinglist Archive: radeonhd (307 mails)
| < Previous | Next > |
[radeonhd] [PATCH] r6xx/r7xx Q&D implementation of wait_vblank
- From: Christian König <deathsimple@xxxxxxxxxxx>
- Date: Sun, 08 Feb 2009 15:22:12 +0100
- Message-id: <1234102932.6477.28.camel@zweiundvierzig>
Hi Alex,
the attached patch implements a simple wait_vblank function, and utilize
those in R600DisplayTexturedVideo just before draw_auto as Matthias
suggested.
I am assuming that the Xv output goes to CRTC1 and redefining the
DxCRTC_STATUS registers in r6xx_accel is very ugly, but it's at least a
start and seems to work quite fine for me, reducing tearing in the
output under a (for me) noticeable level.
Can i start cleaning up this mess a little bit? For example removing
"#define uint32_t CARD32" or the double register definition in rhd_reg.h
and r600_reg*.h.
Bye, Christian.
Date: Sun, 8 Feb 2009 14:46:00 +0100
Subject: [PATCH] Q&D implementation of wait_vblank.
Add the wait_vblank function and used it in R600DisplayTexturedVideo.
Not sure if 100% right, but this reduces tearing allot.
---
src/r600_state.h | 2 ++
src/r600_textured_videofuncs.c | 2 ++
src/r6xx_accel.c | 26 ++++++++++++++++++++++++++
3 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/src/r600_state.h b/src/r600_state.h
index bf9cdb5..7ee9651 100644
--- a/src/r600_state.h
+++ b/src/r600_state.h
@@ -188,6 +188,8 @@ wait_3d_idle_clean(ScrnInfoPtr pScrn, drmBufPtr ib);
void
wait_3d_idle(ScrnInfoPtr pScrn, drmBufPtr ib);
void
+wait_vblank(ScrnInfoPtr pScrn, drmBufPtr ib, int crtc);
+void
start_3d(ScrnInfoPtr pScrn, drmBufPtr ib);
void
set_render_target(ScrnInfoPtr pScrn, drmBufPtr ib, cb_config_t *cb_conf);
diff --git a/src/r600_textured_videofuncs.c b/src/r600_textured_videofuncs.c
index edc6f9e..a79a2bf 100644
--- a/src/r600_textured_videofuncs.c
+++ b/src/r600_textured_videofuncs.c
@@ -369,6 +369,8 @@ R600DisplayTexturedVideo(ScrnInfoPtr pScrn, struct
RHDPortPriv *pPriv)
ereg (accel_state->ib, VGT_MIN_VTX_INDX, 0);
ereg (accel_state->ib, VGT_INDX_OFFSET, 0);
+ wait_vblank(pScrn, accel_state->ib, 0 /* TODO */);
+
draw_auto(pScrn, accel_state->ib, &draw_conf);
wait_3d_idle_clean(pScrn, accel_state->ib);
diff --git a/src/r6xx_accel.c b/src/r6xx_accel.c
index a18aea6..ac69e84 100644
--- a/src/r6xx_accel.c
+++ b/src/r6xx_accel.c
@@ -183,6 +183,32 @@ wait_3d_idle(ScrnInfoPtr pScrn, drmBufPtr ib)
}
+/* TODO */
+#define D1CRTC_STATUS 0x609C
+#define D2CRTC_STATUS 0x689C
+
+void
+wait_vblank(ScrnInfoPtr pScrn, drmBufPtr ib, int crtc)
+{
+ CARD32 reg = crtc == 0 ? D1CRTC_STATUS : D2CRTC_STATUS;
+
+ pack3 (ib, IT_WAIT_REG_MEM, 6);
+ e32 (ib, 0x00000003); /* ME, Register, EqualTo */
+ e32 (ib, reg >> 2);
+ e32 (ib, 0);
+ e32 (ib, 0x0); /* Ref value */
+ e32 (ib, 0x1); /* Ref mask */
+ e32 (ib, 10); /* Wait interval */
+
+ pack3 (ib, IT_WAIT_REG_MEM, 6);
+ e32 (ib, 0x00000003); /* ME, Register, EqualTo */
+ e32 (ib, reg >> 2);
+ e32 (ib, 0);
+ e32 (ib, 0x1); /* Ref value */
+ e32 (ib, 0x1); /* Ref mask */
+ e32 (ib, 10); /* Wait interval */
+}
+
static void
reset_cb(ScrnInfoPtr pScrn, drmBufPtr ib)
{
--
1.5.6.3
the attached patch implements a simple wait_vblank function, and utilize
those in R600DisplayTexturedVideo just before draw_auto as Matthias
suggested.
I am assuming that the Xv output goes to CRTC1 and redefining the
DxCRTC_STATUS registers in r6xx_accel is very ugly, but it's at least a
start and seems to work quite fine for me, reducing tearing in the
output under a (for me) noticeable level.
Can i start cleaning up this mess a little bit? For example removing
"#define uint32_t CARD32" or the double register definition in rhd_reg.h
and r600_reg*.h.
Bye, Christian.
From 139840871d0d6fe8b83d4a00b5deeac6b7619af8 Mon Sep 17 00:00:00 2001From: Christian Koenig <deathsimple@xxxxxxxxxxx>
Date: Sun, 8 Feb 2009 14:46:00 +0100
Subject: [PATCH] Q&D implementation of wait_vblank.
Add the wait_vblank function and used it in R600DisplayTexturedVideo.
Not sure if 100% right, but this reduces tearing allot.
---
src/r600_state.h | 2 ++
src/r600_textured_videofuncs.c | 2 ++
src/r6xx_accel.c | 26 ++++++++++++++++++++++++++
3 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/src/r600_state.h b/src/r600_state.h
index bf9cdb5..7ee9651 100644
--- a/src/r600_state.h
+++ b/src/r600_state.h
@@ -188,6 +188,8 @@ wait_3d_idle_clean(ScrnInfoPtr pScrn, drmBufPtr ib);
void
wait_3d_idle(ScrnInfoPtr pScrn, drmBufPtr ib);
void
+wait_vblank(ScrnInfoPtr pScrn, drmBufPtr ib, int crtc);
+void
start_3d(ScrnInfoPtr pScrn, drmBufPtr ib);
void
set_render_target(ScrnInfoPtr pScrn, drmBufPtr ib, cb_config_t *cb_conf);
diff --git a/src/r600_textured_videofuncs.c b/src/r600_textured_videofuncs.c
index edc6f9e..a79a2bf 100644
--- a/src/r600_textured_videofuncs.c
+++ b/src/r600_textured_videofuncs.c
@@ -369,6 +369,8 @@ R600DisplayTexturedVideo(ScrnInfoPtr pScrn, struct
RHDPortPriv *pPriv)
ereg (accel_state->ib, VGT_MIN_VTX_INDX, 0);
ereg (accel_state->ib, VGT_INDX_OFFSET, 0);
+ wait_vblank(pScrn, accel_state->ib, 0 /* TODO */);
+
draw_auto(pScrn, accel_state->ib, &draw_conf);
wait_3d_idle_clean(pScrn, accel_state->ib);
diff --git a/src/r6xx_accel.c b/src/r6xx_accel.c
index a18aea6..ac69e84 100644
--- a/src/r6xx_accel.c
+++ b/src/r6xx_accel.c
@@ -183,6 +183,32 @@ wait_3d_idle(ScrnInfoPtr pScrn, drmBufPtr ib)
}
+/* TODO */
+#define D1CRTC_STATUS 0x609C
+#define D2CRTC_STATUS 0x689C
+
+void
+wait_vblank(ScrnInfoPtr pScrn, drmBufPtr ib, int crtc)
+{
+ CARD32 reg = crtc == 0 ? D1CRTC_STATUS : D2CRTC_STATUS;
+
+ pack3 (ib, IT_WAIT_REG_MEM, 6);
+ e32 (ib, 0x00000003); /* ME, Register, EqualTo */
+ e32 (ib, reg >> 2);
+ e32 (ib, 0);
+ e32 (ib, 0x0); /* Ref value */
+ e32 (ib, 0x1); /* Ref mask */
+ e32 (ib, 10); /* Wait interval */
+
+ pack3 (ib, IT_WAIT_REG_MEM, 6);
+ e32 (ib, 0x00000003); /* ME, Register, EqualTo */
+ e32 (ib, reg >> 2);
+ e32 (ib, 0);
+ e32 (ib, 0x1); /* Ref value */
+ e32 (ib, 0x1); /* Ref mask */
+ e32 (ib, 10); /* Wait interval */
+}
+
static void
reset_cb(ScrnInfoPtr pScrn, drmBufPtr ib)
{
--
1.5.6.3
| < Previous | Next > |