diff options
author | Dave Airlie <airlied@starflyer.(none)> | 2005-11-10 06:16:34 -0500 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2005-11-10 06:16:34 -0500 |
commit | 22eae947bf76e236ba972f2f11cfd1b083b736ad (patch) | |
tree | e18a2cdfef9ac0f606eb249df4924fef5e7daebd /drivers/char/drm/savage_bci.c | |
parent | 3b44f137b9a846c5452d9e6e1271b79b1dbcc942 (diff) |
drm: rename driver hooks more understandably
Rename the driver hooks in the DRM to something a little more understandable:
preinit -> load
postinit -> (removed)
presetup -> firstopen
postsetup -> (removed)
open_helper -> open
prerelease -> preclose
free_filp_priv -> postclose
pretakedown -> lastclose
postcleanup -> unload
release -> reclaim_buffers_locked
version -> (removed)
postinit and version were replaced with generic code in the Linux DRM (drivers
now set their version numbers and description in the driver structure, like on
BSD). postsetup wasn't used at all. Fixes the savage hooks for
initializing and tearing down mappings at the right times. Testing involved at
least starting X, running glxgears, killing glxgears, exiting X, and repeating.
Tested on: FreeBSD (g200, g400, r200, r128)
Linux (r200, savage4)
From: Eric Anholt <anholt@freebsd.org>
Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/savage_bci.c')
-rw-r--r-- | drivers/char/drm/savage_bci.c | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/drivers/char/drm/savage_bci.c b/drivers/char/drm/savage_bci.c index 6d10515795cc..c3101702a1fe 100644 --- a/drivers/char/drm/savage_bci.c +++ b/drivers/char/drm/savage_bci.c | |||
@@ -533,16 +533,32 @@ static void savage_fake_dma_flush(drm_savage_private_t * dev_priv) | |||
533 | dev_priv->first_dma_page = dev_priv->current_dma_page = 0; | 533 | dev_priv->first_dma_page = dev_priv->current_dma_page = 0; |
534 | } | 534 | } |
535 | 535 | ||
536 | int savage_driver_load(drm_device_t *dev, unsigned long chipset) | ||
537 | { | ||
538 | drm_savage_private_t *dev_priv; | ||
539 | |||
540 | dev_priv = drm_alloc(sizeof(drm_savage_private_t), DRM_MEM_DRIVER); | ||
541 | if (dev_priv == NULL) | ||
542 | return DRM_ERR(ENOMEM); | ||
543 | |||
544 | memset(dev_priv, 0, sizeof(drm_savage_private_t)); | ||
545 | dev->dev_private = (void *)dev_priv; | ||
546 | |||
547 | dev_priv->chipset = (enum savage_family)chipset; | ||
548 | |||
549 | return 0; | ||
550 | } | ||
551 | |||
552 | |||
536 | /* | 553 | /* |
537 | * Initalize mappings. On Savage4 and SavageIX the alignment | 554 | * Initalize mappings. On Savage4 and SavageIX the alignment |
538 | * and size of the aperture is not suitable for automatic MTRR setup | 555 | * and size of the aperture is not suitable for automatic MTRR setup |
539 | * in drm_addmap. Therefore we do it manually before the maps are | 556 | * in drm_addmap. Therefore we add them manually before the maps are |
540 | * initialized. We also need to take care of deleting the MTRRs in | 557 | * initialized, and tear them down on last close. |
541 | * postcleanup. | ||
542 | */ | 558 | */ |
543 | int savage_preinit(drm_device_t * dev, unsigned long chipset) | 559 | int savage_driver_firstopen(drm_device_t *dev) |
544 | { | 560 | { |
545 | drm_savage_private_t *dev_priv; | 561 | drm_savage_private_t *dev_priv = dev->dev_private; |
546 | unsigned long mmio_base, fb_base, fb_size, aperture_base; | 562 | unsigned long mmio_base, fb_base, fb_size, aperture_base; |
547 | /* fb_rsrc and aper_rsrc aren't really used currently, but still exist | 563 | /* fb_rsrc and aper_rsrc aren't really used currently, but still exist |
548 | * in case we decide we need information on the BAR for BSD in the | 564 | * in case we decide we need information on the BAR for BSD in the |
@@ -551,14 +567,6 @@ int savage_preinit(drm_device_t * dev, unsigned long chipset) | |||
551 | unsigned int fb_rsrc, aper_rsrc; | 567 | unsigned int fb_rsrc, aper_rsrc; |
552 | int ret = 0; | 568 | int ret = 0; |
553 | 569 | ||
554 | dev_priv = drm_alloc(sizeof(drm_savage_private_t), DRM_MEM_DRIVER); | ||
555 | if (dev_priv == NULL) | ||
556 | return DRM_ERR(ENOMEM); | ||
557 | |||
558 | memset(dev_priv, 0, sizeof(drm_savage_private_t)); | ||
559 | dev->dev_private = (void *)dev_priv; | ||
560 | dev_priv->chipset = (enum savage_family)chipset; | ||
561 | |||
562 | dev_priv->mtrr[0].handle = -1; | 570 | dev_priv->mtrr[0].handle = -1; |
563 | dev_priv->mtrr[1].handle = -1; | 571 | dev_priv->mtrr[1].handle = -1; |
564 | dev_priv->mtrr[2].handle = -1; | 572 | dev_priv->mtrr[2].handle = -1; |
@@ -595,7 +603,8 @@ int savage_preinit(drm_device_t * dev, unsigned long chipset) | |||
595 | DRM_ERROR("strange pci_resource_len %08lx\n", | 603 | DRM_ERROR("strange pci_resource_len %08lx\n", |
596 | drm_get_resource_len(dev, 0)); | 604 | drm_get_resource_len(dev, 0)); |
597 | } | 605 | } |
598 | } else if (chipset != S3_SUPERSAVAGE && chipset != S3_SAVAGE2000) { | 606 | } else if (dev_priv->chipset != S3_SUPERSAVAGE && |
607 | dev_priv->chipset != S3_SAVAGE2000) { | ||
599 | mmio_base = drm_get_resource_start(dev, 0); | 608 | mmio_base = drm_get_resource_start(dev, 0); |
600 | fb_rsrc = 1; | 609 | fb_rsrc = 1; |
601 | fb_base = drm_get_resource_start(dev, 1); | 610 | fb_base = drm_get_resource_start(dev, 1); |
@@ -648,7 +657,7 @@ int savage_preinit(drm_device_t * dev, unsigned long chipset) | |||
648 | /* | 657 | /* |
649 | * Delete MTRRs and free device-private data. | 658 | * Delete MTRRs and free device-private data. |
650 | */ | 659 | */ |
651 | int savage_postcleanup(drm_device_t * dev) | 660 | void savage_driver_lastclose(drm_device_t *dev) |
652 | { | 661 | { |
653 | drm_savage_private_t *dev_priv = dev->dev_private; | 662 | drm_savage_private_t *dev_priv = dev->dev_private; |
654 | int i; | 663 | int i; |
@@ -658,6 +667,11 @@ int savage_postcleanup(drm_device_t * dev) | |||
658 | mtrr_del(dev_priv->mtrr[i].handle, | 667 | mtrr_del(dev_priv->mtrr[i].handle, |
659 | dev_priv->mtrr[i].base, | 668 | dev_priv->mtrr[i].base, |
660 | dev_priv->mtrr[i].size); | 669 | dev_priv->mtrr[i].size); |
670 | } | ||
671 | |||
672 | int savage_driver_unload(drm_device_t *dev) | ||
673 | { | ||
674 | drm_savage_private_t *dev_priv = dev->dev_private; | ||
661 | 675 | ||
662 | drm_free(dev_priv, sizeof(drm_savage_private_t), DRM_MEM_DRIVER); | 676 | drm_free(dev_priv, sizeof(drm_savage_private_t), DRM_MEM_DRIVER); |
663 | 677 | ||