30 #include <drm/i915_drm.h>
45 #define PTE_ADDRESS_MASK 0xfffff000
46 #define PTE_ADDRESS_MASK_HIGH 0x000000f0
47 #define PTE_MAPPING_TYPE_UNCACHED (0 << 1)
48 #define PTE_MAPPING_TYPE_DCACHE (1 << 1)
49 #define PTE_MAPPING_TYPE_CACHED (3 << 1)
50 #define PTE_MAPPING_TYPE_MASK (3 << 1)
51 #define PTE_VALID (1 << 0)
76 pci_read_config_dword(pdev, 0xA4, &base);
79 pci_bus_read_config_dword(pdev->
bus, 2, 0x5C, &base);
84 pci_read_config_word(pdev, 0xb0, &val);
85 base = val >> 4 << 20;
88 pci_read_config_byte(pdev, 0x9c, &val);
89 base = val >> 3 << 27;
91 base -= dev_priv->
mm.gtt->stolen_size;
99 DRM_INFO(
"not enough stolen space for compressed buffer, disabling\n");
100 DRM_INFO(
"hint: you may be able to increase stolen memory size in the BIOS to avoid this\n");
107 unsigned long cfb_base;
108 unsigned long ll_base = 0;
113 compressed_fb = drm_mm_search_free(&dev_priv->
mm.stolen, size, 4096, 0);
115 compressed_fb = drm_mm_get_block(compressed_fb, size, 4096);
119 cfb_base = i915_stolen_to_phys(dev, compressed_fb->
start);
124 compressed_llb = drm_mm_search_free(&dev_priv->
mm.stolen,
127 compressed_llb = drm_mm_get_block(compressed_llb,
132 ll_base = i915_stolen_to_phys(dev, compressed_llb->start);
150 DRM_DEBUG_KMS(
"FBC base 0x%08lx, ll base 0x%08lx, size %dM\n",
151 cfb_base, ll_base, size >> 20);
160 i915_warn_stolen(dev);
163 static void i915_cleanup_compression(
struct drm_device *dev)
175 i915_cleanup_compression(dev);
181 unsigned long prealloc_size = dev_priv->
mm.gtt->stolen_size;
193 if (prealloc_size > (36*1024*1024))
194 cfb_size = 32*1024*1024;
196 cfb_size = prealloc_size * 7 / 8;
197 i915_setup_compression(dev, cfb_size);