Subversion Repositories Kolibri OS

Rev

Rev 3031 | Rev 3746 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3031 Rev 3480
Line 289... Line 289...
289
	} else {
289
	} else {
290
		if (obj->gtt_offset & ~I830_FENCE_START_MASK)
290
		if (obj->gtt_offset & ~I830_FENCE_START_MASK)
291
			return false;
291
			return false;
292
	}
292
	}
Line 293... Line -...
293
 
-
 
294
	/*
293
 
295
	 * Previous chips need to be aligned to the size of the smallest
-
 
296
	 * fence register that can contain the object.
-
 
297
	 */
-
 
298
	if (INTEL_INFO(obj->base.dev)->gen == 3)
-
 
299
		size = 1024*1024;
-
 
300
	else
-
 
301
		size = 512*1024;
-
 
302
 
-
 
303
	while (size < obj->base.size)
-
 
304
		size <<= 1;
-
 
305
 
294
	size = i915_gem_get_gtt_size(obj->base.dev, obj->base.size, tiling_mode);
306
	if (obj->gtt_space->size != size)
295
	if (obj->gtt_space->size != size)
Line 307... Line 296...
307
		return false;
296
		return false;
308
 
297
 
Line 385... Line 374...
385
		 * whilst executing a fenced command for an untiled object.
374
		 * whilst executing a fenced command for an untiled object.
386
		 */
375
		 */
Line 387... Line 376...
387
 
376
 
388
		obj->map_and_fenceable =
377
		obj->map_and_fenceable =
389
			obj->gtt_space == NULL ||
378
			obj->gtt_space == NULL ||
390
			(obj->gtt_offset + obj->base.size <= dev_priv->mm.gtt_mappable_end &&
379
			(obj->gtt_offset + obj->base.size <= dev_priv->gtt.mappable_end &&
Line 391... Line 380...
391
			 i915_gem_object_fence_ok(obj, args->tiling_mode));
380
			 i915_gem_object_fence_ok(obj, args->tiling_mode));
392
 
381
 
393
		/* Rebind if we need a change of alignment */
382
		/* Rebind if we need a change of alignment */
394
		if (!obj->map_and_fenceable) {
383
		if (!obj->map_and_fenceable) {
395
			u32 unfenced_alignment =
384
			u32 unfenced_alignment =
396
				i915_gem_get_unfenced_gtt_alignment(dev,
385
				i915_gem_get_gtt_alignment(dev, obj->base.size,
397
								    obj->base.size,
386
							    args->tiling_mode,
398
								    args->tiling_mode);
387
							    false);
399
			if (obj->gtt_offset & (unfenced_alignment - 1))
388
			if (obj->gtt_offset & (unfenced_alignment - 1))
Line 400... Line 389...
400
				ret = i915_gem_object_unbind(obj);
389
				ret = i915_gem_object_unbind(obj);
Line 413... Line 402...
413
		}
402
		}
414
	}
403
	}
415
	/* we have to maintain this existing ABI... */
404
	/* we have to maintain this existing ABI... */
416
	args->stride = obj->stride;
405
	args->stride = obj->stride;
417
	args->tiling_mode = obj->tiling_mode;
406
	args->tiling_mode = obj->tiling_mode;
-
 
407
 
-
 
408
	/* Try to preallocate memory required to save swizzling on put-pages */
-
 
409
	if (i915_gem_object_needs_bit17_swizzle(obj)) {
-
 
410
		if (obj->bit_17 == NULL) {
-
 
411
			obj->bit_17 = kmalloc(BITS_TO_LONGS(obj->base.size >> PAGE_SHIFT) *
-
 
412
					      sizeof(long), GFP_KERNEL);
-
 
413
		}
-
 
414
	} else {
-
 
415
		kfree(obj->bit_17);
-
 
416
		obj->bit_17 = NULL;
-
 
417
	}
-
 
418
 
418
	drm_gem_object_unreference(&obj->base);
419
	drm_gem_object_unreference(&obj->base);
419
	mutex_unlock(&dev->struct_mutex);
420
	mutex_unlock(&dev->struct_mutex);
Line 420... Line 421...
420
 
421
 
421
	return ret;
422
	return ret;