Rev 4246 | Rev 5060 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4246 | Rev 4560 | ||
---|---|---|---|
Line 306... | Line 306... | ||
306 | args->stride, obj->base.size, args->tiling_mode)) { |
306 | args->stride, obj->base.size, args->tiling_mode)) { |
307 | drm_gem_object_unreference_unlocked(&obj->base); |
307 | drm_gem_object_unreference_unlocked(&obj->base); |
308 | return -EINVAL; |
308 | return -EINVAL; |
309 | } |
309 | } |
Line 310... | Line 310... | ||
310 | 310 | ||
311 | if (obj->pin_count) { |
311 | if (obj->pin_count || obj->framebuffer_references) { |
312 | drm_gem_object_unreference_unlocked(&obj->base); |
312 | drm_gem_object_unreference_unlocked(&obj->base); |
313 | return -EBUSY; |
313 | return -EBUSY; |
Line 314... | Line 314... | ||
314 | } |
314 | } |
Line 391... | Line 391... | ||
391 | args->tiling_mode = obj->tiling_mode; |
391 | args->tiling_mode = obj->tiling_mode; |
Line 392... | Line 392... | ||
392 | 392 | ||
393 | /* Try to preallocate memory required to save swizzling on put-pages */ |
393 | /* Try to preallocate memory required to save swizzling on put-pages */ |
394 | if (i915_gem_object_needs_bit17_swizzle(obj)) { |
394 | if (i915_gem_object_needs_bit17_swizzle(obj)) { |
395 | if (obj->bit_17 == NULL) { |
395 | if (obj->bit_17 == NULL) { |
396 | obj->bit_17 = kmalloc(BITS_TO_LONGS(obj->base.size >> PAGE_SHIFT) * |
396 | obj->bit_17 = kcalloc(BITS_TO_LONGS(obj->base.size >> PAGE_SHIFT), |
397 | sizeof(long), GFP_KERNEL); |
397 | sizeof(long), GFP_KERNEL); |
398 | } |
398 | } |
399 | } else { |
399 | } else { |
400 | kfree(obj->bit_17); |
400 | kfree(obj->bit_17); |
Line 503... | Line 503... | ||
503 | struct sg_page_iter sg_iter; |
503 | struct sg_page_iter sg_iter; |
504 | int page_count = obj->base.size >> PAGE_SHIFT; |
504 | int page_count = obj->base.size >> PAGE_SHIFT; |
505 | int i; |
505 | int i; |
Line 506... | Line 506... | ||
506 | 506 | ||
507 | if (obj->bit_17 == NULL) { |
507 | if (obj->bit_17 == NULL) { |
508 | obj->bit_17 = kmalloc(BITS_TO_LONGS(page_count) * |
508 | obj->bit_17 = kcalloc(BITS_TO_LONGS(page_count), |
509 | sizeof(long), GFP_KERNEL); |
509 | sizeof(long), GFP_KERNEL); |
510 | if (obj->bit_17 == NULL) { |
510 | if (obj->bit_17 == NULL) { |
511 | DRM_ERROR("Failed to allocate memory for bit 17 " |
511 | DRM_ERROR("Failed to allocate memory for bit 17 " |
512 | "record\n"); |
512 | "record\n"); |
Line 521... | Line 521... | ||
521 | else |
521 | else |
522 | __clear_bit(i, obj->bit_17); |
522 | __clear_bit(i, obj->bit_17); |
523 | i++; |
523 | i++; |
524 | } |
524 | } |
525 | } |
525 | } |
526 | - | ||
527 | #endif><>>=>>><>><> |
526 | #endif><>>=>>><>><> |