diff options
author | Eric Anholt <eric@anholt.net> | 2008-07-23 11:49:25 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2008-07-23 11:49:25 -0700 |
commit | 6d258ddf7715412e2fb6fae35ea28d49c57ee130 (patch) | |
tree | d0e6744e678dc2c2d2037b3027a5117529ce1e3a /linux-core | |
parent | 439d7106832f2e9742deb900d96f1d3bc07162b1 (diff) |
intel-gem: Fix pread math and logic errors.
Fixes an oops in fbotexture from walking off the end of the page list.
Diffstat (limited to 'linux-core')
-rw-r--r-- | linux-core/i915_gem.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/linux-core/i915_gem.c b/linux-core/i915_gem.c index db068ce3..e4697427 100644 --- a/linux-core/i915_gem.c +++ b/linux-core/i915_gem.c @@ -169,20 +169,16 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data, } } if ((obj->read_domains & I915_GEM_DOMAIN_CPU) == 0) { - int got_page_list = 0; int first_page = args->offset / PAGE_SIZE; - int last_page = (args->offset + args->size) / PAGE_SIZE; + int last_page = (args->offset + args->size - 1) / PAGE_SIZE; - if (obj_priv->page_list == NULL) { - i915_gem_object_get_page_list(obj); - got_page_list = 1; - } + /* If we don't have the page list, the pages are unpinned + * and swappable, and thus should already be in the CPU domain. + */ + BUG_ON(obj_priv->page_list == NULL); drm_ttm_cache_flush(&obj_priv->page_list[first_page], last_page - first_page + 1); - - if (got_page_list) - i915_gem_object_free_page_list(obj); } offset = args->offset; |