aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2008-12-04 01:50:02 -0500
committerDave Airlie <airlied@linux.ie>2008-12-29 02:47:23 -0500
commit60fd99e3682c5acc74d58ed61dac93526d6976f7 (patch)
tree4e22a666f014aa38f33bc45f7f41b51605bc1a42 /drivers/gpu
parent06d9f33ceb6be29c453915505a2fc88d80c36417 (diff)
drm/i915: Fix stolen memory detection on G45 and GM45.
Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c14
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h3
2 files changed, 11 insertions, 6 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index b5d0809eecb1..0dee776b91fb 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -821,7 +821,7 @@ static int i915_set_status_page(struct drm_device *dev, void *data,
821 * some RAM for the framebuffer at early boot. This code figures out 821 * some RAM for the framebuffer at early boot. This code figures out
822 * how much was set aside so we can use it for our own purposes. 822 * how much was set aside so we can use it for our own purposes.
823 */ 823 */
824int i915_probe_agp(struct pci_dev *pdev, unsigned long *aperture_size, 824int i915_probe_agp(struct drm_device *dev, unsigned long *aperture_size,
825 unsigned long *preallocated_size) 825 unsigned long *preallocated_size)
826{ 826{
827 struct pci_dev *bridge_dev; 827 struct pci_dev *bridge_dev;
@@ -841,7 +841,7 @@ int i915_probe_agp(struct pci_dev *pdev, unsigned long *aperture_size,
841 *aperture_size = 1024 * 1024; 841 *aperture_size = 1024 * 1024;
842 *preallocated_size = 1024 * 1024; 842 *preallocated_size = 1024 * 1024;
843 843
844 switch (pdev->device) { 844 switch (dev->pdev->device) {
845 case PCI_DEVICE_ID_INTEL_82830_CGC: 845 case PCI_DEVICE_ID_INTEL_82830_CGC:
846 case PCI_DEVICE_ID_INTEL_82845G_IG: 846 case PCI_DEVICE_ID_INTEL_82845G_IG:
847 case PCI_DEVICE_ID_INTEL_82855GM_IG: 847 case PCI_DEVICE_ID_INTEL_82855GM_IG:
@@ -853,7 +853,7 @@ int i915_probe_agp(struct pci_dev *pdev, unsigned long *aperture_size,
853 break; 853 break;
854 default: 854 default:
855 /* 9xx supports large sizes, just look at the length */ 855 /* 9xx supports large sizes, just look at the length */
856 *aperture_size = pci_resource_len(pdev, 2); 856 *aperture_size = pci_resource_len(dev->pdev, 2);
857 break; 857 break;
858 } 858 }
859 859
@@ -861,7 +861,11 @@ int i915_probe_agp(struct pci_dev *pdev, unsigned long *aperture_size,
861 * Some of the preallocated space is taken by the GTT 861 * Some of the preallocated space is taken by the GTT
862 * and popup. GTT is 1K per MB of aperture size, and popup is 4K. 862 * and popup. GTT is 1K per MB of aperture size, and popup is 4K.
863 */ 863 */
864 overhead = (*aperture_size / 1024) + 4096; 864 if (IS_G4X(dev))
865 overhead = 4096;
866 else
867 overhead = (*aperture_size / 1024) + 4096;
868
865 switch (tmp & INTEL_855_GMCH_GMS_MASK) { 869 switch (tmp & INTEL_855_GMCH_GMS_MASK) {
866 case INTEL_855_GMCH_GMS_STOLEN_1M: 870 case INTEL_855_GMCH_GMS_STOLEN_1M:
867 break; /* 1M already */ 871 break; /* 1M already */
@@ -913,7 +917,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
913 else 917 else
914 dev_priv->cursor_needs_physical = false; 918 dev_priv->cursor_needs_physical = false;
915 919
916 i915_probe_agp(dev->pdev, &agp_size, &prealloc_size); 920 i915_probe_agp(dev, &agp_size, &prealloc_size);
917 921
918 /* Basic memrange allocator for stolen space (aka vram) */ 922 /* Basic memrange allocator for stolen space (aka vram) */
919 drm_mm_init(&dev_priv->vram, 0, prealloc_size); 923 drm_mm_init(&dev_priv->vram, 0, prealloc_size);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 6f18ee68d06a..cc2660580553 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -746,7 +746,8 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
746 746
747#define IS_G4X(dev) ((dev)->pci_device == 0x2E02 || \ 747#define IS_G4X(dev) ((dev)->pci_device == 0x2E02 || \
748 (dev)->pci_device == 0x2E12 || \ 748 (dev)->pci_device == 0x2E12 || \
749 (dev)->pci_device == 0x2E22) 749 (dev)->pci_device == 0x2E22 || \
750 IS_GM45(dev))
750 751
751#define IS_G33(dev) ((dev)->pci_device == 0x29C2 || \ 752#define IS_G33(dev) ((dev)->pci_device == 0x29C2 || \
752 (dev)->pci_device == 0x29B2 || \ 753 (dev)->pci_device == 0x29B2 || \