[Intel-gfx] [PATCH 1/3] drm/i915: Unbind the bo if the user requests a different alignment

Daniel Vetter daniel at ffwll.ch
Mon Apr 5 21:47:21 CEST 2010


On Sun, Apr 04, 2010 at 10:35:19PM +0100, Chris Wilson wrote:
> @@ -2625,12 +2626,9 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
>  		return -EINVAL;
>  	}
>  
> -	if (alignment == 0)
> -		alignment = i915_gem_get_gtt_alignment(obj);
> -	if (alignment & (i915_gem_get_gtt_alignment(obj) - 1)) {
> -		DRM_ERROR("Invalid object alignment requested %u\n", alignment);
> -		return -EINVAL;
> -	}
> +	fence_alignment = i915_gem_get_fence_alignment(obj);
> +	if (alignment < fence_alignment)
> +		alignment = fence_alignment;

I don't think you can just drop the pot test here. I think either 

	if (alignment & (i915_gem_get_gtt_alignment(obj) - 1)) {
		DRM_ERROR("Invalid object alignment requested %u\n", alignment);
		return -EINVAL;
	}

or

	if (alignment & (alingment - 1)) {
		DRM_ERROR("Invalid object alignment requested %u\n", alignment);
		return -EINVAL;
	}

is needed after the alignment fixup.
-- 
Daniel Vetter
Mail: daniel at ffwll.ch
Mobile: +41 (0)79 365 57 48



More information about the Intel-gfx mailing list