diff options
author | Eric Anholt <eric@anholt.net> | 2009-01-02 21:05:51 -0500 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2009-01-06 20:50:02 -0500 |
commit | 241fa85b2bb655224357d713c251077dee3585ce (patch) | |
tree | e123a21d974a8737a47835a077396630718bdf65 /drivers/gpu | |
parent | 1fc45d84d616cec00566152c1080903c461eb537 (diff) |
drm/i915: Respect the other stolen memory sizes we know of.
fd.o bug #19336.
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/i915/i915_dma.c | 46 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_reg.h | 8 |
2 files changed, 40 insertions, 14 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 3d7082af5b72..62a4bf7b49df 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -827,6 +827,7 @@ static int i915_probe_agp(struct drm_device *dev, unsigned long *aperture_size, | |||
827 | struct pci_dev *bridge_dev; | 827 | struct pci_dev *bridge_dev; |
828 | u16 tmp = 0; | 828 | u16 tmp = 0; |
829 | unsigned long overhead; | 829 | unsigned long overhead; |
830 | unsigned long stolen; | ||
830 | 831 | ||
831 | bridge_dev = pci_get_bus_and_slot(0, PCI_DEVFN(0,0)); | 832 | bridge_dev = pci_get_bus_and_slot(0, PCI_DEVFN(0,0)); |
832 | if (!bridge_dev) { | 833 | if (!bridge_dev) { |
@@ -866,36 +867,55 @@ static int i915_probe_agp(struct drm_device *dev, unsigned long *aperture_size, | |||
866 | else | 867 | else |
867 | overhead = (*aperture_size / 1024) + 4096; | 868 | overhead = (*aperture_size / 1024) + 4096; |
868 | 869 | ||
869 | switch (tmp & INTEL_855_GMCH_GMS_MASK) { | 870 | switch (tmp & INTEL_GMCH_GMS_MASK) { |
871 | case INTEL_855_GMCH_GMS_DISABLED: | ||
872 | DRM_ERROR("video memory is disabled\n"); | ||
873 | return -1; | ||
870 | case INTEL_855_GMCH_GMS_STOLEN_1M: | 874 | case INTEL_855_GMCH_GMS_STOLEN_1M: |
871 | break; /* 1M already */ | 875 | stolen = 1 * 1024 * 1024; |
876 | break; | ||
872 | case INTEL_855_GMCH_GMS_STOLEN_4M: | 877 | case INTEL_855_GMCH_GMS_STOLEN_4M: |
873 | *preallocated_size *= 4; | 878 | stolen = 4 * 1024 * 1024; |
874 | break; | 879 | break; |
875 | case INTEL_855_GMCH_GMS_STOLEN_8M: | 880 | case INTEL_855_GMCH_GMS_STOLEN_8M: |
876 | *preallocated_size *= 8; | 881 | stolen = 8 * 1024 * 1024; |
877 | break; | 882 | break; |
878 | case INTEL_855_GMCH_GMS_STOLEN_16M: | 883 | case INTEL_855_GMCH_GMS_STOLEN_16M: |
879 | *preallocated_size *= 16; | 884 | stolen = 16 * 1024 * 1024; |
880 | break; | 885 | break; |
881 | case INTEL_855_GMCH_GMS_STOLEN_32M: | 886 | case INTEL_855_GMCH_GMS_STOLEN_32M: |
882 | *preallocated_size *= 32; | 887 | stolen = 32 * 1024 * 1024; |
883 | break; | 888 | break; |
884 | case INTEL_915G_GMCH_GMS_STOLEN_48M: | 889 | case INTEL_915G_GMCH_GMS_STOLEN_48M: |
885 | *preallocated_size *= 48; | 890 | stolen = 48 * 1024 * 1024; |
886 | break; | 891 | break; |
887 | case INTEL_915G_GMCH_GMS_STOLEN_64M: | 892 | case INTEL_915G_GMCH_GMS_STOLEN_64M: |
888 | *preallocated_size *= 64; | 893 | stolen = 64 * 1024 * 1024; |
894 | break; | ||
895 | case INTEL_GMCH_GMS_STOLEN_128M: | ||
896 | stolen = 128 * 1024 * 1024; | ||
897 | break; | ||
898 | case INTEL_GMCH_GMS_STOLEN_256M: | ||
899 | stolen = 256 * 1024 * 1024; | ||
900 | break; | ||
901 | case INTEL_GMCH_GMS_STOLEN_96M: | ||
902 | stolen = 96 * 1024 * 1024; | ||
903 | break; | ||
904 | case INTEL_GMCH_GMS_STOLEN_160M: | ||
905 | stolen = 160 * 1024 * 1024; | ||
906 | break; | ||
907 | case INTEL_GMCH_GMS_STOLEN_224M: | ||
908 | stolen = 224 * 1024 * 1024; | ||
909 | break; | ||
910 | case INTEL_GMCH_GMS_STOLEN_352M: | ||
911 | stolen = 352 * 1024 * 1024; | ||
889 | break; | 912 | break; |
890 | case INTEL_855_GMCH_GMS_DISABLED: | ||
891 | DRM_ERROR("video memory is disabled\n"); | ||
892 | return -1; | ||
893 | default: | 913 | default: |
894 | DRM_ERROR("unexpected GMCH_GMS value: 0x%02x\n", | 914 | DRM_ERROR("unexpected GMCH_GMS value: 0x%02x\n", |
895 | tmp & INTEL_855_GMCH_GMS_MASK); | 915 | tmp & INTEL_GMCH_GMS_MASK); |
896 | return -1; | 916 | return -1; |
897 | } | 917 | } |
898 | *preallocated_size -= overhead; | 918 | *preallocated_size = stolen - overhead; |
899 | 919 | ||
900 | return 0; | 920 | return 0; |
901 | } | 921 | } |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 102431577dbb..273162579e1b 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -35,7 +35,7 @@ | |||
35 | #define INTEL_GMCH_MEM_64M 0x1 | 35 | #define INTEL_GMCH_MEM_64M 0x1 |
36 | #define INTEL_GMCH_MEM_128M 0 | 36 | #define INTEL_GMCH_MEM_128M 0 |
37 | 37 | ||
38 | #define INTEL_855_GMCH_GMS_MASK (0x7 << 4) | 38 | #define INTEL_GMCH_GMS_MASK (0xf << 4) |
39 | #define INTEL_855_GMCH_GMS_DISABLED (0x0 << 4) | 39 | #define INTEL_855_GMCH_GMS_DISABLED (0x0 << 4) |
40 | #define INTEL_855_GMCH_GMS_STOLEN_1M (0x1 << 4) | 40 | #define INTEL_855_GMCH_GMS_STOLEN_1M (0x1 << 4) |
41 | #define INTEL_855_GMCH_GMS_STOLEN_4M (0x2 << 4) | 41 | #define INTEL_855_GMCH_GMS_STOLEN_4M (0x2 << 4) |
@@ -45,6 +45,12 @@ | |||
45 | 45 | ||
46 | #define INTEL_915G_GMCH_GMS_STOLEN_48M (0x6 << 4) | 46 | #define INTEL_915G_GMCH_GMS_STOLEN_48M (0x6 << 4) |
47 | #define INTEL_915G_GMCH_GMS_STOLEN_64M (0x7 << 4) | 47 | #define INTEL_915G_GMCH_GMS_STOLEN_64M (0x7 << 4) |
48 | #define INTEL_GMCH_GMS_STOLEN_128M (0x8 << 4) | ||
49 | #define INTEL_GMCH_GMS_STOLEN_256M (0x9 << 4) | ||
50 | #define INTEL_GMCH_GMS_STOLEN_96M (0xa << 4) | ||
51 | #define INTEL_GMCH_GMS_STOLEN_160M (0xb << 4) | ||
52 | #define INTEL_GMCH_GMS_STOLEN_224M (0xc << 4) | ||
53 | #define INTEL_GMCH_GMS_STOLEN_352M (0xd << 4) | ||
48 | 54 | ||
49 | /* PCI config space */ | 55 | /* PCI config space */ |
50 | 56 | ||