提交 53984635 编写于 作者: D Daniel Vetter 提交者: Chris Wilson

drm/i915: use the complete gtt

At least the part that's currently enabled by the BIOS.
Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
上级 16e809ac
...@@ -1195,13 +1195,17 @@ static bool i915_switcheroo_can_switch(struct pci_dev *pdev) ...@@ -1195,13 +1195,17 @@ static bool i915_switcheroo_can_switch(struct pci_dev *pdev)
return can_switch; return can_switch;
} }
static int i915_load_modeset_init(struct drm_device *dev, static int i915_load_modeset_init(struct drm_device *dev)
unsigned long prealloc_size,
unsigned long agp_size)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long prealloc_size, gtt_size, mappable_size;
int ret = 0; int ret = 0;
prealloc_size = dev_priv->mm.gtt->gtt_stolen_entries << PAGE_SHIFT;
gtt_size = dev_priv->mm.gtt->gtt_total_entries << PAGE_SHIFT;
mappable_size = dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT;
gtt_size -= PAGE_SIZE;
/* Basic memrange allocator for stolen space (aka mm.vram) */ /* Basic memrange allocator for stolen space (aka mm.vram) */
drm_mm_init(&dev_priv->mm.vram, 0, prealloc_size); drm_mm_init(&dev_priv->mm.vram, 0, prealloc_size);
...@@ -1214,7 +1218,7 @@ static int i915_load_modeset_init(struct drm_device *dev, ...@@ -1214,7 +1218,7 @@ static int i915_load_modeset_init(struct drm_device *dev,
* at the last page of the aperture. One page should be enough to * at the last page of the aperture. One page should be enough to
* keep any prefetching inside of the aperture. * keep any prefetching inside of the aperture.
*/ */
i915_gem_do_init(dev, prealloc_size, agp_size - 4096); i915_gem_do_init(dev, prealloc_size, mappable_size, gtt_size);
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
ret = i915_gem_init_ringbuffer(dev); ret = i915_gem_init_ringbuffer(dev);
...@@ -2056,7 +2060,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) ...@@ -2056,7 +2060,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
intel_detect_pch(dev); intel_detect_pch(dev);
if (drm_core_check_feature(dev, DRIVER_MODESET)) { if (drm_core_check_feature(dev, DRIVER_MODESET)) {
ret = i915_load_modeset_init(dev, prealloc_size, agp_size); ret = i915_load_modeset_init(dev);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("failed to init modeset\n"); DRM_ERROR("failed to init modeset\n");
goto out_workqueue_free; goto out_workqueue_free;
......
...@@ -1041,7 +1041,7 @@ int i915_gem_object_set_domain(struct drm_gem_object *obj, ...@@ -1041,7 +1041,7 @@ int i915_gem_object_set_domain(struct drm_gem_object *obj,
int i915_gem_init_ringbuffer(struct drm_device *dev); int i915_gem_init_ringbuffer(struct drm_device *dev);
void i915_gem_cleanup_ringbuffer(struct drm_device *dev); void i915_gem_cleanup_ringbuffer(struct drm_device *dev);
int i915_gem_do_init(struct drm_device *dev, unsigned long start, int i915_gem_do_init(struct drm_device *dev, unsigned long start,
unsigned long end); unsigned long mappable_end, unsigned long end);
int i915_gpu_idle(struct drm_device *dev); int i915_gpu_idle(struct drm_device *dev);
int i915_gem_idle(struct drm_device *dev); int i915_gem_idle(struct drm_device *dev);
int i915_add_request(struct drm_device *dev, int i915_add_request(struct drm_device *dev,
......
...@@ -173,6 +173,7 @@ i915_gem_object_is_inactive(struct drm_i915_gem_object *obj_priv) ...@@ -173,6 +173,7 @@ i915_gem_object_is_inactive(struct drm_i915_gem_object *obj_priv)
int i915_gem_do_init(struct drm_device *dev, int i915_gem_do_init(struct drm_device *dev,
unsigned long start, unsigned long start,
unsigned long mappable_end,
unsigned long end) unsigned long end)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
...@@ -187,7 +188,7 @@ int i915_gem_do_init(struct drm_device *dev, ...@@ -187,7 +188,7 @@ int i915_gem_do_init(struct drm_device *dev,
end - start); end - start);
dev_priv->mm.gtt_total = end - start; dev_priv->mm.gtt_total = end - start;
dev_priv->mm.gtt_mappable_end = end; dev_priv->mm.gtt_mappable_end = mappable_end;
return 0; return 0;
} }
...@@ -200,7 +201,7 @@ i915_gem_init_ioctl(struct drm_device *dev, void *data, ...@@ -200,7 +201,7 @@ i915_gem_init_ioctl(struct drm_device *dev, void *data,
int ret; int ret;
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
ret = i915_gem_do_init(dev, args->gtt_start, args->gtt_end); ret = i915_gem_do_init(dev, args->gtt_start, args->gtt_end, args->gtt_end);
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册