diff options
author | Dave Airlie <airlied@linux.ie> | 2005-10-20 00:23:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-20 02:04:31 -0400 |
commit | 11909d64389c24b409e20f0eeafdc262e0a55788 (patch) | |
tree | c3a782b6582ccc1ccf24d5de5fe170006a3a199a | |
parent | d1209d049bbc3df66650f8417637be4f7b57b604 (diff) |
[PATCH] fix MGA DRM regression before 2.6.14
I've gotten a report on lkml, of a possible regression in the MGA DRM in
2.6.14-rc4 (since -rc1), I haven't been able to reproduce it here, but I've
figured out some possible issues in the mga code that were definitely
wrong, some of these are from DRM CVS, the main fix is the agp enable bit
on the old code path still used by everyone.....
Signed-off-by: Dave Airlie <airlied@linux.ie>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/char/drm/mga_dma.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/char/drm/mga_dma.c b/drivers/char/drm/mga_dma.c index fc7d4a594bca..c8e1b6c83636 100644 --- a/drivers/char/drm/mga_dma.c +++ b/drivers/char/drm/mga_dma.c | |||
@@ -437,7 +437,7 @@ static int mga_do_agp_dma_bootstrap(drm_device_t * dev, | |||
437 | drm_mga_dma_bootstrap_t * dma_bs) | 437 | drm_mga_dma_bootstrap_t * dma_bs) |
438 | { | 438 | { |
439 | drm_mga_private_t * const dev_priv = (drm_mga_private_t *) dev->dev_private; | 439 | drm_mga_private_t * const dev_priv = (drm_mga_private_t *) dev->dev_private; |
440 | const unsigned int warp_size = mga_warp_microcode_size(dev_priv); | 440 | unsigned int warp_size = mga_warp_microcode_size(dev_priv); |
441 | int err; | 441 | int err; |
442 | unsigned offset; | 442 | unsigned offset; |
443 | const unsigned secondary_size = dma_bs->secondary_bin_count | 443 | const unsigned secondary_size = dma_bs->secondary_bin_count |
@@ -499,6 +499,12 @@ static int mga_do_agp_dma_bootstrap(drm_device_t * dev, | |||
499 | return err; | 499 | return err; |
500 | } | 500 | } |
501 | 501 | ||
502 | /* Make drm_addbufs happy by not trying to create a mapping for less | ||
503 | * than a page. | ||
504 | */ | ||
505 | if (warp_size < PAGE_SIZE) | ||
506 | warp_size = PAGE_SIZE; | ||
507 | |||
502 | offset = 0; | 508 | offset = 0; |
503 | err = drm_addmap( dev, offset, warp_size, | 509 | err = drm_addmap( dev, offset, warp_size, |
504 | _DRM_AGP, _DRM_READ_ONLY, & dev_priv->warp ); | 510 | _DRM_AGP, _DRM_READ_ONLY, & dev_priv->warp ); |
@@ -587,7 +593,7 @@ static int mga_do_pci_dma_bootstrap(drm_device_t * dev, | |||
587 | drm_mga_dma_bootstrap_t * dma_bs) | 593 | drm_mga_dma_bootstrap_t * dma_bs) |
588 | { | 594 | { |
589 | drm_mga_private_t * const dev_priv = (drm_mga_private_t *) dev->dev_private; | 595 | drm_mga_private_t * const dev_priv = (drm_mga_private_t *) dev->dev_private; |
590 | const unsigned int warp_size = mga_warp_microcode_size(dev_priv); | 596 | unsigned int warp_size = mga_warp_microcode_size(dev_priv); |
591 | unsigned int primary_size; | 597 | unsigned int primary_size; |
592 | unsigned int bin_count; | 598 | unsigned int bin_count; |
593 | int err; | 599 | int err; |
@@ -599,6 +605,12 @@ static int mga_do_pci_dma_bootstrap(drm_device_t * dev, | |||
599 | return DRM_ERR(EFAULT); | 605 | return DRM_ERR(EFAULT); |
600 | } | 606 | } |
601 | 607 | ||
608 | /* Make drm_addbufs happy by not trying to create a mapping for less | ||
609 | * than a page. | ||
610 | */ | ||
611 | if (warp_size < PAGE_SIZE) | ||
612 | warp_size = PAGE_SIZE; | ||
613 | |||
602 | /* The proper alignment is 0x100 for this mapping */ | 614 | /* The proper alignment is 0x100 for this mapping */ |
603 | err = drm_addmap(dev, 0, warp_size, _DRM_CONSISTENT, | 615 | err = drm_addmap(dev, 0, warp_size, _DRM_CONSISTENT, |
604 | _DRM_READ_ONLY, &dev_priv->warp); | 616 | _DRM_READ_ONLY, &dev_priv->warp); |
@@ -812,6 +824,10 @@ static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init ) | |||
812 | } | 824 | } |
813 | 825 | ||
814 | if (! dev_priv->used_new_dma_init) { | 826 | if (! dev_priv->used_new_dma_init) { |
827 | |||
828 | dev_priv->dma_access = MGA_PAGPXFER; | ||
829 | dev_priv->wagp_enable = MGA_WAGP_ENABLE; | ||
830 | |||
815 | dev_priv->status = drm_core_findmap(dev, init->status_offset); | 831 | dev_priv->status = drm_core_findmap(dev, init->status_offset); |
816 | if (!dev_priv->status) { | 832 | if (!dev_priv->status) { |
817 | DRM_ERROR("failed to find status page!\n"); | 833 | DRM_ERROR("failed to find status page!\n"); |
@@ -928,7 +944,7 @@ static int mga_do_cleanup_dma( drm_device_t *dev ) | |||
928 | drm_mga_private_t *dev_priv = dev->dev_private; | 944 | drm_mga_private_t *dev_priv = dev->dev_private; |
929 | 945 | ||
930 | if ((dev_priv->warp != NULL) | 946 | if ((dev_priv->warp != NULL) |
931 | && (dev_priv->mmio->type != _DRM_CONSISTENT)) | 947 | && (dev_priv->warp->type != _DRM_CONSISTENT)) |
932 | drm_core_ioremapfree(dev_priv->warp, dev); | 948 | drm_core_ioremapfree(dev_priv->warp, dev); |
933 | 949 | ||
934 | if ((dev_priv->primary != NULL) | 950 | if ((dev_priv->primary != NULL) |