/* Linear is always fine */ if (tiling == I915_TILING_NONE) returntrue;
if (tiling > I915_TILING_LAST) returnfalse;
/* check maximum stride & object size */ /* i965+ stores the end address of the gtt mapping in the fence
* reg, so dont bother to check the size */ if (GRAPHICS_VER(i915) >= 7) { if (stride / 128 > GEN7_FENCE_MAX_PITCH_VAL) returnfalse;
} elseif (GRAPHICS_VER(i915) >= 4) { if (stride / 128 > I965_FENCE_MAX_PITCH_VAL) returnfalse;
} else { if (stride > 8192) returnfalse;
alignment = i915_gem_fence_alignment(i915, vma->size, tiling_mode, stride); if (!IS_ALIGNED(i915_ggtt_offset(vma), alignment)) returnfalse;
returntrue;
}
/* Make the current GTT allocation valid for the change in tiling. */ staticint
i915_gem_object_fence_prepare(struct drm_i915_gem_object *obj, int tiling_mode, unsignedint stride)
{ struct drm_i915_private *i915 = to_i915(obj->base.dev); struct i915_ggtt *ggtt = to_gt(i915)->ggtt; struct i915_vma *vma, *vn;
LIST_HEAD(unbind); int ret = 0;
list_for_each_entry_safe(vma, vn, &unbind, vm_link) {
ret = __i915_vma_unbind(vma); if (ret) { /* Restore the remaining vma on an error */
list_splice(&unbind, &ggtt->vm.bound_list); break;
}
}
if ((tiling | stride) == obj->tiling_and_stride) return0;
if (i915_gem_object_is_framebuffer(obj)) return -EBUSY;
/* We need to rebind the object if its current allocation *nolongermeetsthealignmentrestrictionsforitsnew *tilingmode.Otherwisewecanjustleaveitalone,but *needtoensurethatanyfenceregisterisupdatedbefore *thenextfenced(eitherthroughtheGTTorbytheBLTunit *onolderGPUs)access. * *Afterupdatingthetilingparameters,wethenflagwhether *weneedtoupdateanassociatedfenceregister.Notethis *hastoalsoincludetheunfencedregistertheGPUuses *whilstexecutingafencedcommandforanuntiledobject.
*/
i915_gem_object_lock(obj, NULL); if (i915_gem_object_is_framebuffer(obj)) {
i915_gem_object_unlock(obj); return -EBUSY;
}
/* Hide bit 17 swizzling from the user. This prevents old Mesa *fromabortingtheapplicationonswfallbackstobit17, *andweusethepread/pwritebit17pathstoswizzleforit. *Iftherewasauserthatwasrelyingontheswizzle *informationfordrm_intel_bo_map()edreads/writesthiswould *breakit,butwedon'thaveanyofthose.
*/ if (args->swizzle_mode == I915_BIT_6_SWIZZLE_9_17)
args->swizzle_mode = I915_BIT_6_SWIZZLE_9; if (args->swizzle_mode == I915_BIT_6_SWIZZLE_9_10_17)
args->swizzle_mode = I915_BIT_6_SWIZZLE_9_10;
/* If we can't handle the swizzling, make it untiled. */ if (args->swizzle_mode == I915_BIT_6_SWIZZLE_UNKNOWN) {
args->tiling_mode = I915_TILING_NONE;
args->swizzle_mode = I915_BIT_6_SWIZZLE_NONE;
args->stride = 0;
}
}
switch (args->tiling_mode) { case I915_TILING_X:
args->swizzle_mode = to_gt(i915)->ggtt->bit_6_swizzle_x; break; case I915_TILING_Y:
args->swizzle_mode = to_gt(i915)->ggtt->bit_6_swizzle_y; break; default: case I915_TILING_NONE:
args->swizzle_mode = I915_BIT_6_SWIZZLE_NONE; break;
}
/* Hide bit 17 from the user -- see comment in i915_gem_set_tiling */ if (i915->gem_quirks & GEM_QUIRK_PIN_SWIZZLED_PAGES)
args->phys_swizzle_mode = I915_BIT_6_SWIZZLE_UNKNOWN; else
args->phys_swizzle_mode = args->swizzle_mode; if (args->swizzle_mode == I915_BIT_6_SWIZZLE_9_17)
args->swizzle_mode = I915_BIT_6_SWIZZLE_9; if (args->swizzle_mode == I915_BIT_6_SWIZZLE_9_10_17)
args->swizzle_mode = I915_BIT_6_SWIZZLE_9_10;
return0;
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet am 2026-10-03)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.