summaryrefslogtreecommitdiff
path: root/shared-core/radeon_state.c
diff options
context:
space:
mode:
Diffstat (limited to 'shared-core/radeon_state.c')
-rw-r--r--shared-core/radeon_state.c41
1 files changed, 35 insertions, 6 deletions
diff --git a/shared-core/radeon_state.c b/shared-core/radeon_state.c
index 4a7bfd2d..cdbd7a8e 100644
--- a/shared-core/radeon_state.c
+++ b/shared-core/radeon_state.c
@@ -43,12 +43,15 @@ static __inline__ int radeon_check_and_fixup_offset( drm_radeon_private_t *dev_p
drm_file_t *filp_priv,
u32 *offset ) {
u32 off = *offset;
+ struct drm_radeon_driver_file_fields *radeon_priv;
if ( off >= dev_priv->fb_location &&
off < ( dev_priv->gart_vm_start + dev_priv->gart_size ) )
return 0;
- off += filp_priv->radeon_fb_delta;
+ radeon_priv = filp_priv->driver_priv;
+
+ off += radeon_priv->radeon_fb_delta;
DRM_DEBUG( "offset fixed up to 0x%x\n", off );
@@ -2525,7 +2528,8 @@ int radeon_cp_setparam( DRM_IOCTL_ARGS ) {
drm_radeon_private_t *dev_priv = dev->dev_private;
drm_file_t *filp_priv;
drm_radeon_setparam_t sp;
-
+ struct drm_radeon_driver_file_fields *radeon_priv;
+
if ( !dev_priv ) {
DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ );
return DRM_ERR( EINVAL );
@@ -2538,7 +2542,8 @@ int radeon_cp_setparam( DRM_IOCTL_ARGS ) {
switch( sp.param ) {
case RADEON_SETPARAM_FB_LOCATION:
- filp_priv->radeon_fb_delta = dev_priv->fb_location - sp.value;
+ radeon_priv = filp_priv->driver_priv;
+ radeon_priv->radeon_fb_delta = dev_priv->fb_location - sp.value;
break;
default:
DRM_DEBUG( "Invalid parameter %d\n", sp.param );
@@ -2571,17 +2576,35 @@ 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)
+static int radeon_driver_open_helper(drm_device_t *dev, drm_file_t *filp_priv)
{
drm_radeon_private_t *dev_priv = dev->dev_private;
+ struct drm_radeon_driver_file_fields *radeon_priv;
+
+ radeon_priv = (struct drm_radeon_driver_file_fields *)DRM(alloc)(sizeof(*radeon_priv), DRM_MEM_FILES);
+
+ if (!radeon_priv)
+ return -ENOMEM;
+
+ filp_priv->driver_priv = radeon_priv;
+
if ( dev_priv )
- filp_priv->radeon_fb_delta = dev_priv->fb_location;
+ radeon_priv->radeon_fb_delta = dev_priv->fb_location;
else
- filp_priv->radeon_fb_delta = 0;
+ radeon_priv->radeon_fb_delta = 0;
+ return 0;
+}
+
+static void radeon_driver_free_filp_private(drm_device_t *dev, drm_file_t *filp_priv)
+{
+ struct drm_radeon_driver_file_fields *radeon_priv = filp_priv->driver_priv;
+
+ DRM(free)(radeon_priv, sizeof(*radeon_priv), DRM_MEM_FILES);
}
void radeon_driver_register_fns(struct drm_device *dev)
{
+ dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL;
dev->dev_priv_size = sizeof(drm_radeon_buf_priv_t);
dev->fn_tbl.preinit = radeon_preinit;
dev->fn_tbl.postinit = radeon_postinit;
@@ -2589,4 +2612,10 @@ void radeon_driver_register_fns(struct drm_device *dev)
dev->fn_tbl.prerelease = radeon_driver_prerelease;
dev->fn_tbl.pretakedown = radeon_driver_pretakedown;
dev->fn_tbl.open_helper = radeon_driver_open_helper;
+ dev->fn_tbl.vblank_wait = radeon_driver_vblank_wait;
+ dev->fn_tbl.irq_preinstall = radeon_driver_irq_preinstall;
+ dev->fn_tbl.irq_postinstall = radeon_driver_irq_postinstall;
+ dev->fn_tbl.irq_uninstall = radeon_driver_irq_uninstall;
+ dev->fn_tbl.irq_handler = radeon_driver_irq_handler;
+ dev->fn_tbl.free_filp_private = radeon_driver_free_filp_private;
}