summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2002-07-04 23:04:27 +0000
committerEric Anholt <anholt@freebsd.org>2002-07-04 23:04:27 +0000
commit9a0d90c74eefcb13e4cfc77a4c7b8b737397e988 (patch)
tree33c7d12ff3d35260948bf4aa283d032d18acef4c
parent6df32b3a51f30e1c7774a29b238c46e82c9d8556 (diff)
-rw-r--r--shared-core/radeon_state.c30
-rw-r--r--shared/radeon_state.c30
2 files changed, 34 insertions, 26 deletions
diff --git a/shared-core/radeon_state.c b/shared-core/radeon_state.c
index 88f0605f..83fae493 100644
--- a/shared-core/radeon_state.c
+++ b/shared-core/radeon_state.c
@@ -46,10 +46,11 @@ static __inline__ void radeon_emit_clip_rect( drm_radeon_private_t *dev_priv,
DRM_DEBUG( " box: x1=%d y1=%d x2=%d y2=%d\n",
box->x1, box->y1, box->x2, box->y2 );
- BEGIN_RING( 3 );
- OUT_RING( CP_PACKET3( RADEON_CNTL_SET_SCISSORS, 1 ));
+ BEGIN_RING( 4 );
+ OUT_RING( CP_PACKET0( RADEON_RE_TOP_LEFT, 0 ) );
OUT_RING( (box->y1 << 16) | box->x1 );
-/* OUT_RING( ((box->y2 - 1) << 16) | (box->x2 - 1) );*/
+ OUT_RING( CP_PACKET0( RADEON_RE_WIDTH_HEIGHT, 0 ) );
+/* OUT_RING( ((box->y2 - 1) << 16) | (box->x2 - 1) );*/
OUT_RING( (box->y2 << 16) | box->x2 );
ADVANCE_RING();
}
@@ -1070,15 +1071,17 @@ int radeon_cp_clear( DRM_IOCTL_ARGS )
static int radeon_do_init_pageflip( drm_device_t *dev )
{
drm_radeon_private_t *dev_priv = dev->dev_private;
+ RING_LOCALS;
+
DRM_DEBUG( "\n" );
- dev_priv->crtc_offset = RADEON_READ( RADEON_CRTC_OFFSET );
dev_priv->crtc_offset_cntl = RADEON_READ( RADEON_CRTC_OFFSET_CNTL );
- RADEON_WRITE( RADEON_CRTC_OFFSET, dev_priv->front_offset );
- RADEON_WRITE( RADEON_CRTC_OFFSET_CNTL,
- dev_priv->crtc_offset_cntl |
- RADEON_CRTC_OFFSET_FLIP_CNTL );
+ BEGIN_RING( 4 );
+ RADEON_WAIT_UNTIL_3D_IDLE();
+ OUT_RING( CP_PACKET0( RADEON_CRTC_OFFSET_CNTL, 0 ) );
+ OUT_RING( dev_priv->crtc_offset_cntl | RADEON_CRTC_OFFSET_FLIP_CNTL );
+ ADVANCE_RING();
dev_priv->page_flipping = 1;
dev_priv->current_page = 0;
@@ -1092,13 +1095,14 @@ int radeon_do_cleanup_pageflip( drm_device_t *dev )
drm_radeon_private_t *dev_priv = dev->dev_private;
DRM_DEBUG( "\n" );
- RADEON_WRITE( RADEON_CRTC_OFFSET, dev_priv->crtc_offset );
- RADEON_WRITE( RADEON_CRTC_OFFSET_CNTL, dev_priv->crtc_offset_cntl );
+ if (dev_priv->current_page != 0)
+ radeon_cp_dispatch_flip( dev );
+ /* FIXME: If the X server changes screen resolution, it
+ * clobbers the value of RADEON_CRTC_OFFSET_CNTL, above,
+ * leading to a flashing efect.
+ */
dev_priv->page_flipping = 0;
- dev_priv->current_page = 0;
- dev_priv->sarea_priv->pfCurrentPage = dev_priv->current_page;
-
return 0;
}
diff --git a/shared/radeon_state.c b/shared/radeon_state.c
index 88f0605f..83fae493 100644
--- a/shared/radeon_state.c
+++ b/shared/radeon_state.c
@@ -46,10 +46,11 @@ static __inline__ void radeon_emit_clip_rect( drm_radeon_private_t *dev_priv,
DRM_DEBUG( " box: x1=%d y1=%d x2=%d y2=%d\n",
box->x1, box->y1, box->x2, box->y2 );
- BEGIN_RING( 3 );
- OUT_RING( CP_PACKET3( RADEON_CNTL_SET_SCISSORS, 1 ));
+ BEGIN_RING( 4 );
+ OUT_RING( CP_PACKET0( RADEON_RE_TOP_LEFT, 0 ) );
OUT_RING( (box->y1 << 16) | box->x1 );
-/* OUT_RING( ((box->y2 - 1) << 16) | (box->x2 - 1) );*/
+ OUT_RING( CP_PACKET0( RADEON_RE_WIDTH_HEIGHT, 0 ) );
+/* OUT_RING( ((box->y2 - 1) << 16) | (box->x2 - 1) );*/
OUT_RING( (box->y2 << 16) | box->x2 );
ADVANCE_RING();
}
@@ -1070,15 +1071,17 @@ int radeon_cp_clear( DRM_IOCTL_ARGS )
static int radeon_do_init_pageflip( drm_device_t *dev )
{
drm_radeon_private_t *dev_priv = dev->dev_private;
+ RING_LOCALS;
+
DRM_DEBUG( "\n" );
- dev_priv->crtc_offset = RADEON_READ( RADEON_CRTC_OFFSET );
dev_priv->crtc_offset_cntl = RADEON_READ( RADEON_CRTC_OFFSET_CNTL );
- RADEON_WRITE( RADEON_CRTC_OFFSET, dev_priv->front_offset );
- RADEON_WRITE( RADEON_CRTC_OFFSET_CNTL,
- dev_priv->crtc_offset_cntl |
- RADEON_CRTC_OFFSET_FLIP_CNTL );
+ BEGIN_RING( 4 );
+ RADEON_WAIT_UNTIL_3D_IDLE();
+ OUT_RING( CP_PACKET0( RADEON_CRTC_OFFSET_CNTL, 0 ) );
+ OUT_RING( dev_priv->crtc_offset_cntl | RADEON_CRTC_OFFSET_FLIP_CNTL );
+ ADVANCE_RING();
dev_priv->page_flipping = 1;
dev_priv->current_page = 0;
@@ -1092,13 +1095,14 @@ int radeon_do_cleanup_pageflip( drm_device_t *dev )
drm_radeon_private_t *dev_priv = dev->dev_private;
DRM_DEBUG( "\n" );
- RADEON_WRITE( RADEON_CRTC_OFFSET, dev_priv->crtc_offset );
- RADEON_WRITE( RADEON_CRTC_OFFSET_CNTL, dev_priv->crtc_offset_cntl );
+ if (dev_priv->current_page != 0)
+ radeon_cp_dispatch_flip( dev );
+ /* FIXME: If the X server changes screen resolution, it
+ * clobbers the value of RADEON_CRTC_OFFSET_CNTL, above,
+ * leading to a flashing efect.
+ */
dev_priv->page_flipping = 0;
- dev_priv->current_page = 0;
- dev_priv->sarea_priv->pfCurrentPage = dev_priv->current_page;
-
return 0;
}