summaryrefslogtreecommitdiff
path: root/shared-core/radeon_state.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2004-08-17 13:10:05 +0000
committerDave Airlie <airlied@linux.ie>2004-08-17 13:10:05 +0000
commit5c9ed8309493acb099463d25b32fabb5b7c004af (patch)
treeeec5be6f9374b5a2f61d52bd02ba0a44ba7e636d /shared-core/radeon_state.c
parent93e8c201afac565942f9d3523ac808d3220d6d0e (diff)
Merged drmfntbl-0-0-1drmfntbl-0-0-1-20040817-merge
Diffstat (limited to 'shared-core/radeon_state.c')
-rw-r--r--shared-core/radeon_state.c49
1 files changed, 46 insertions, 3 deletions
diff --git a/shared-core/radeon_state.c b/shared-core/radeon_state.c
index 10a6629a..4a7bfd2d 100644
--- a/shared-core/radeon_state.c
+++ b/shared-core/radeon_state.c
@@ -1247,7 +1247,7 @@ static void radeon_cp_dispatch_indirect( drm_device_t *dev,
*/
if ( dwords & 1 ) {
u32 *data = (u32 *)
- ((char *)dev_priv->buffers->handle
+ ((char *)dev->agp_buffer_map->handle
+ buf->offset + start);
data[dwords++] = RADEON_CP_PACKET2;
}
@@ -1301,7 +1301,7 @@ static void radeon_cp_dispatch_indices( drm_device_t *dev,
dwords = (prim->finish - prim->start + 3) / sizeof(u32);
- data = (u32 *)((char *)dev_priv->buffers->handle +
+ data = (u32 *)((char *)dev->agp_buffer_map->handle +
elt_buf->offset + prim->start);
data[0] = CP_PACKET3( RADEON_3D_RNDR_GEN_INDX_PRIM, dwords-2 );
@@ -1445,7 +1445,7 @@ static int radeon_cp_dispatch_texture( DRMFILE filp,
/* Dispatch the indirect buffer.
*/
- buffer = (u32*)((char*)dev_priv->buffers->handle + buf->offset);
+ buffer = (u32*)((char*)dev->agp_buffer_map->handle + buf->offset);
dwords = size / 4;
buffer[0] = CP_PACKET3( RADEON_CNTL_HOSTDATA_BLT, dwords + 6 );
buffer[1] = (RADEON_GMC_DST_PITCH_OFFSET_CNTL |
@@ -2547,3 +2547,46 @@ int radeon_cp_setparam( DRM_IOCTL_ARGS ) {
return 0;
}
+
+/* When a client dies:
+ * - Check for and clean up flipped page state
+ * - Free any alloced GART memory.
+ *
+ * DRM infrastructure takes care of reclaiming dma buffers.
+ */
+static void radeon_driver_prerelease(drm_device_t *dev, DRMFILE filp)
+{
+ if ( dev->dev_private ) {
+ drm_radeon_private_t *dev_priv = dev->dev_private;
+ if ( dev_priv->page_flipping ) {
+ radeon_do_cleanup_pageflip( dev );
+ }
+ radeon_mem_release( filp, dev_priv->gart_heap );
+ radeon_mem_release( filp, dev_priv->fb_heap );
+ }
+}
+
+static void radeon_driver_pretakedown(drm_device_t *dev)
+{
+ radeon_do_release(dev);
+}
+
+static void radeon_driver_open_helper(drm_device_t *dev, drm_file_t *filp_priv)
+{
+ drm_radeon_private_t *dev_priv = dev->dev_private;
+ if ( dev_priv )
+ filp_priv->radeon_fb_delta = dev_priv->fb_location;
+ else
+ filp_priv->radeon_fb_delta = 0;
+}
+
+void radeon_driver_register_fns(struct drm_device *dev)
+{
+ dev->dev_priv_size = sizeof(drm_radeon_buf_priv_t);
+ dev->fn_tbl.preinit = radeon_preinit;
+ dev->fn_tbl.postinit = radeon_postinit;
+ dev->fn_tbl.postcleanup = radeon_postcleanup;
+ dev->fn_tbl.prerelease = radeon_driver_prerelease;
+ dev->fn_tbl.pretakedown = radeon_driver_pretakedown;
+ dev->fn_tbl.open_helper = radeon_driver_open_helper;
+}