|
@@ -396,6 +396,18 @@ i915_gem_set_tiling(struct drm_device *dev, void *data,
|
|
|
/* we have to maintain this existing ABI... */
|
|
|
args->stride = obj->stride;
|
|
|
args->tiling_mode = obj->tiling_mode;
|
|
|
+
|
|
|
+ /* Try to preallocate memory required to save swizzling on put-pages */
|
|
|
+ if (i915_gem_object_needs_bit17_swizzle(obj)) {
|
|
|
+ if (obj->bit_17 == NULL) {
|
|
|
+ obj->bit_17 = kmalloc(BITS_TO_LONGS(obj->base.size >> PAGE_SHIFT) *
|
|
|
+ sizeof(long), GFP_KERNEL);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ kfree(obj->bit_17);
|
|
|
+ obj->bit_17 = NULL;
|
|
|
+ }
|
|
|
+
|
|
|
drm_gem_object_unreference(&obj->base);
|
|
|
mutex_unlock(&dev->struct_mutex);
|
|
|
|