Commit 60fd99e3 authored by Eric Anholt's avatar Eric Anholt Committed by Dave Airlie

drm/i915: Fix stolen memory detection on G45 and GM45.

Signed-off-by: default avatarEric Anholt <eric@anholt.net>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 06d9f33c
...@@ -821,7 +821,7 @@ static int i915_set_status_page(struct drm_device *dev, void *data, ...@@ -821,7 +821,7 @@ static int i915_set_status_page(struct drm_device *dev, void *data,
* some RAM for the framebuffer at early boot. This code figures out * some RAM for the framebuffer at early boot. This code figures out
* how much was set aside so we can use it for our own purposes. * how much was set aside so we can use it for our own purposes.
*/ */
int i915_probe_agp(struct pci_dev *pdev, unsigned long *aperture_size, int i915_probe_agp(struct drm_device *dev, unsigned long *aperture_size,
unsigned long *preallocated_size) unsigned long *preallocated_size)
{ {
struct pci_dev *bridge_dev; struct pci_dev *bridge_dev;
...@@ -841,7 +841,7 @@ int i915_probe_agp(struct pci_dev *pdev, unsigned long *aperture_size, ...@@ -841,7 +841,7 @@ int i915_probe_agp(struct pci_dev *pdev, unsigned long *aperture_size,
*aperture_size = 1024 * 1024; *aperture_size = 1024 * 1024;
*preallocated_size = 1024 * 1024; *preallocated_size = 1024 * 1024;
switch (pdev->device) { switch (dev->pdev->device) {
case PCI_DEVICE_ID_INTEL_82830_CGC: case PCI_DEVICE_ID_INTEL_82830_CGC:
case PCI_DEVICE_ID_INTEL_82845G_IG: case PCI_DEVICE_ID_INTEL_82845G_IG:
case PCI_DEVICE_ID_INTEL_82855GM_IG: case PCI_DEVICE_ID_INTEL_82855GM_IG:
...@@ -853,7 +853,7 @@ int i915_probe_agp(struct pci_dev *pdev, unsigned long *aperture_size, ...@@ -853,7 +853,7 @@ int i915_probe_agp(struct pci_dev *pdev, unsigned long *aperture_size,
break; break;
default: default:
/* 9xx supports large sizes, just look at the length */ /* 9xx supports large sizes, just look at the length */
*aperture_size = pci_resource_len(pdev, 2); *aperture_size = pci_resource_len(dev->pdev, 2);
break; break;
} }
...@@ -861,7 +861,11 @@ int i915_probe_agp(struct pci_dev *pdev, unsigned long *aperture_size, ...@@ -861,7 +861,11 @@ int i915_probe_agp(struct pci_dev *pdev, unsigned long *aperture_size,
* Some of the preallocated space is taken by the GTT * Some of the preallocated space is taken by the GTT
* and popup. GTT is 1K per MB of aperture size, and popup is 4K. * and popup. GTT is 1K per MB of aperture size, and popup is 4K.
*/ */
overhead = (*aperture_size / 1024) + 4096; if (IS_G4X(dev))
overhead = 4096;
else
overhead = (*aperture_size / 1024) + 4096;
switch (tmp & INTEL_855_GMCH_GMS_MASK) { switch (tmp & INTEL_855_GMCH_GMS_MASK) {
case INTEL_855_GMCH_GMS_STOLEN_1M: case INTEL_855_GMCH_GMS_STOLEN_1M:
break; /* 1M already */ break; /* 1M already */
...@@ -913,7 +917,7 @@ static int i915_load_modeset_init(struct drm_device *dev) ...@@ -913,7 +917,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
else else
dev_priv->cursor_needs_physical = false; dev_priv->cursor_needs_physical = false;
i915_probe_agp(dev->pdev, &agp_size, &prealloc_size); i915_probe_agp(dev, &agp_size, &prealloc_size);
/* Basic memrange allocator for stolen space (aka vram) */ /* Basic memrange allocator for stolen space (aka vram) */
drm_mm_init(&dev_priv->vram, 0, prealloc_size); drm_mm_init(&dev_priv->vram, 0, prealloc_size);
......
...@@ -746,7 +746,8 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); ...@@ -746,7 +746,8 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
#define IS_G4X(dev) ((dev)->pci_device == 0x2E02 || \ #define IS_G4X(dev) ((dev)->pci_device == 0x2E02 || \
(dev)->pci_device == 0x2E12 || \ (dev)->pci_device == 0x2E12 || \
(dev)->pci_device == 0x2E22) (dev)->pci_device == 0x2E22 || \
IS_GM45(dev))
#define IS_G33(dev) ((dev)->pci_device == 0x29C2 || \ #define IS_G33(dev) ((dev)->pci_device == 0x29C2 || \
(dev)->pci_device == 0x29B2 || \ (dev)->pci_device == 0x29B2 || \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment