diff options
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index fba37e9f775d..368d726853d1 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include "i915_drv.h" | 31 | #include "i915_drv.h" |
32 | #include "i915_trace.h" | 32 | #include "i915_trace.h" |
33 | #include "intel_drv.h" | 33 | #include "intel_drv.h" |
34 | #include <linux/slab.h> | ||
34 | #include <linux/swap.h> | 35 | #include <linux/swap.h> |
35 | #include <linux/pci.h> | 36 | #include <linux/pci.h> |
36 | 37 | ||
@@ -1466,9 +1467,6 @@ i915_gem_object_put_pages(struct drm_gem_object *obj) | |||
1466 | obj_priv->dirty = 0; | 1467 | obj_priv->dirty = 0; |
1467 | 1468 | ||
1468 | for (i = 0; i < page_count; i++) { | 1469 | for (i = 0; i < page_count; i++) { |
1469 | if (obj_priv->pages[i] == NULL) | ||
1470 | break; | ||
1471 | |||
1472 | if (obj_priv->dirty) | 1470 | if (obj_priv->dirty) |
1473 | set_page_dirty(obj_priv->pages[i]); | 1471 | set_page_dirty(obj_priv->pages[i]); |
1474 | 1472 | ||
@@ -2227,11 +2225,6 @@ i915_gem_evict_something(struct drm_device *dev, int min_size) | |||
2227 | seqno = i915_add_request(dev, NULL, obj->write_domain); | 2225 | seqno = i915_add_request(dev, NULL, obj->write_domain); |
2228 | if (seqno == 0) | 2226 | if (seqno == 0) |
2229 | return -ENOMEM; | 2227 | return -ENOMEM; |
2230 | |||
2231 | ret = i915_wait_request(dev, seqno); | ||
2232 | if (ret) | ||
2233 | return ret; | ||
2234 | |||
2235 | continue; | 2228 | continue; |
2236 | } | 2229 | } |
2237 | } | 2230 | } |
@@ -2256,7 +2249,6 @@ i915_gem_object_get_pages(struct drm_gem_object *obj, | |||
2256 | struct address_space *mapping; | 2249 | struct address_space *mapping; |
2257 | struct inode *inode; | 2250 | struct inode *inode; |
2258 | struct page *page; | 2251 | struct page *page; |
2259 | int ret; | ||
2260 | 2252 | ||
2261 | if (obj_priv->pages_refcount++ != 0) | 2253 | if (obj_priv->pages_refcount++ != 0) |
2262 | return 0; | 2254 | return 0; |
@@ -2279,11 +2271,9 @@ i915_gem_object_get_pages(struct drm_gem_object *obj, | |||
2279 | mapping_gfp_mask (mapping) | | 2271 | mapping_gfp_mask (mapping) | |
2280 | __GFP_COLD | | 2272 | __GFP_COLD | |
2281 | gfpmask); | 2273 | gfpmask); |
2282 | if (IS_ERR(page)) { | 2274 | if (IS_ERR(page)) |
2283 | ret = PTR_ERR(page); | 2275 | goto err_pages; |
2284 | i915_gem_object_put_pages(obj); | 2276 | |
2285 | return ret; | ||
2286 | } | ||
2287 | obj_priv->pages[i] = page; | 2277 | obj_priv->pages[i] = page; |
2288 | } | 2278 | } |
2289 | 2279 | ||
@@ -2291,6 +2281,15 @@ i915_gem_object_get_pages(struct drm_gem_object *obj, | |||
2291 | i915_gem_object_do_bit_17_swizzle(obj); | 2281 | i915_gem_object_do_bit_17_swizzle(obj); |
2292 | 2282 | ||
2293 | return 0; | 2283 | return 0; |
2284 | |||
2285 | err_pages: | ||
2286 | while (i--) | ||
2287 | page_cache_release(obj_priv->pages[i]); | ||
2288 | |||
2289 | drm_free_large(obj_priv->pages); | ||
2290 | obj_priv->pages = NULL; | ||
2291 | obj_priv->pages_refcount--; | ||
2292 | return PTR_ERR(page); | ||
2294 | } | 2293 | } |
2295 | 2294 | ||
2296 | static void sandybridge_write_fence_reg(struct drm_i915_fence_reg *reg) | 2295 | static void sandybridge_write_fence_reg(struct drm_i915_fence_reg *reg) |
@@ -4730,6 +4729,11 @@ i915_gem_init_ringbuffer(struct drm_device *dev) | |||
4730 | ring->space += ring->Size; | 4729 | ring->space += ring->Size; |
4731 | } | 4730 | } |
4732 | 4731 | ||
4732 | if (IS_I9XX(dev) && !IS_GEN3(dev)) { | ||
4733 | I915_WRITE(MI_MODE, | ||
4734 | (VS_TIMER_DISPATCH) << 16 | VS_TIMER_DISPATCH); | ||
4735 | } | ||
4736 | |||
4733 | return 0; | 4737 | return 0; |
4734 | } | 4738 | } |
4735 | 4739 | ||