Lines Matching refs:obj
264 i915_gem_object_fence_ok(struct drm_i915_gem_object *obj, int tiling_mode)
271 if (INTEL_INFO(obj->base.dev)->gen >= 4)
274 if (INTEL_INFO(obj->base.dev)->gen == 3) {
275 if (obj->gtt_offset & ~I915_FENCE_START_MASK)
278 if (obj->gtt_offset & ~I830_FENCE_START_MASK)
282 size = i915_gem_get_gtt_size(obj->base.dev, obj->base.size, tiling_mode);
283 if (obj->gtt_space->size != size)
286 if (obj->gtt_offset & (size - 1))
302 struct drm_i915_gem_object *obj;
305 obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle));
306 if (&obj->base == NULL)
310 args->stride, obj->base.size, args->tiling_mode)) {
311 drm_gem_object_unreference_unlocked(&obj->base);
315 if (obj->pin_count) {
316 drm_gem_object_unreference_unlocked(&obj->base);
350 if (args->tiling_mode != obj->tiling_mode ||
351 args->stride != obj->stride) {
365 obj->map_and_fenceable =
366 obj->gtt_space == NULL ||
367 (obj->gtt_offset + obj->base.size <= dev_priv->gtt.mappable_end &&
368 i915_gem_object_fence_ok(obj, args->tiling_mode));
371 if (!obj->map_and_fenceable) {
373 i915_gem_get_gtt_alignment(dev, obj->base.size,
376 if (obj->gtt_offset & (unfenced_alignment - 1))
377 ret = i915_gem_object_unbind(obj, 1);
381 obj->fence_dirty =
382 obj->fenced_gpu_access ||
383 obj->fence_reg != I915_FENCE_REG_NONE;
385 obj->tiling_mode = args->tiling_mode;
386 obj->stride = args->stride;
389 i915_gem_release_mmap(obj);
393 args->stride = obj->stride;
394 args->tiling_mode = obj->tiling_mode;
397 if (i915_gem_object_needs_bit17_swizzle(obj)) {
398 if (obj->bit_17 == NULL) {
399 obj->bit_17 = kmalloc(BITS_TO_LONGS(obj->base.size >> PAGE_SHIFT) *
403 if (obj->bit_17 != NULL) {
404 kfree(obj->bit_17, BITS_TO_LONGS(obj->base.size >> PAGE_SHIFT) *
406 obj->bit_17 = NULL;
410 drm_gem_object_unreference(&obj->base);
425 struct drm_i915_gem_object *obj;
427 obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle));
428 if (&obj->base == NULL)
433 args->tiling_mode = obj->tiling_mode;
434 switch (obj->tiling_mode) {
454 drm_gem_object_unreference(&obj->base);
483 i915_gem_object_do_bit_17_swizzle(struct drm_i915_gem_object *obj)
485 int page_count = obj->base.size >> PAGE_SHIFT;
488 if (obj->bit_17 == NULL)
492 char new_bit_17 = (char)(page_to_phys(obj->page_list[i]) >> 17);
494 (test_bit(i, obj->bit_17) != 0)) {
495 i915_gem_swizzle_page(obj->page_list[i]);
501 i915_gem_object_save_bit_17_swizzle(struct drm_i915_gem_object *obj)
503 int page_count = obj->base.size >> PAGE_SHIFT;
506 if (obj->bit_17 == NULL) {
507 obj->bit_17 = kmalloc(BITS_TO_LONGS(page_count) *
509 if (obj->bit_17 == NULL) {
517 if (page_to_phys(obj->page_list[i]) & (1 << 17))
518 set_bit(i, obj->bit_17);
520 clear_bit(i, obj->bit_17);