[Intel-gfx] [RFC v2] libdrm_intel: Add API for execbuf pad to size functionality

Chris Wilson chris at chris-wilson.co.uk
Wed Apr 1 05:14:31 PDT 2015


On Wed, Apr 01, 2015 at 12:14:09PM +0100, Tvrtko Ursulin wrote:
>  static int
> +drm_intel_gem_bo_pad_to_size(drm_intel_bo *bo, uint64_t pad_to_size)
> +{
> +	drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
> +
> +	if (pad_to_size < bo->size)
> +		return -EINVAL;
> +
> +	if (pad_to_size > bo->size)
> +		bo_gem->pad_to_size = pad_to_size;

Thinking too hard here :)

This fails to restore a previously padded object to bo->size, and we
need to allow pad_to_size = 0.

static int
drm_intel_gem_bo_pad_to_size(drm_intel_bo *bo, uint64_t pad_to_size)
{
	drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;

	if (pad_to_size && pad_to_size < bo->size)
		return -EINVAL;

	bo_gem->pad_to_size = pad_to_size;
	return 0;
}
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list