Overall looks fine to me except some indent issues and better keep with /* */ comment style in C files.
On 2014.11.06 09:40:05 +0800, Guo Yejun wrote:
> +
> +#ifdef HAS_USERPTR
> + //currently only cl buf is supported, will add cl image support later
> + if ((flags & CL_MEM_USE_HOST_PTR) && host_ptr != NULL) {
> + if (!is_tiled) { //userptr not support tiling
> + int page_size = getpagesize();
> + if ((((unsigned long)host_ptr | sz) & (page_size - 1)) == 0) {
> //page aligned
> + mem->bo = cl_buffer_alloc_userptr(bufmgr, "CL memory object",
> host_ptr, sz, 0);
> + if (mem->bo != NULL)
> + mem->is_userptr = 1;
> + else
> + fprintf(stderr, "failed to alloc with host ptr %p %lu,
> fallback\n", host_ptr, sz);
> + }
> + }
> + }
comment style here, and remove above debug log.
> @@ -690,6 +690,19 @@ cl_buffer intel_share_image_from_libva(cl_context ctx,
> return (cl_buffer)intel_bo;
> }
>
> +static cl_buffer intel_buffer_alloc_userptr(cl_buffer_mgr bufmgr, const
> char* name, void *data,size_t size, unsigned long flags)
> +{
> +#ifdef HAS_USERPTR
> + drm_intel_bo *bo;
> + bo = drm_intel_bo_alloc_userptr((drm_intel_bufmgr *)bufmgr, name, data,
> I915_TILING_NONE, 0, size, flags);
> + if (bo == NULL) //Fallback to unsynchronized userptr allocation if kernel
> has no MMU notifier enabled.
> + bo = drm_intel_bo_alloc_userptr((drm_intel_bufmgr *)bufmgr, name, data,
> I915_TILING_NONE, 0, size, flags | I915_USERPTR_UNSYNCHRONIZED);
> + return (cl_buffer)bo;
> +#else
> + return NULL;
> +#endif
> +}
indent and comment style.
--
Open Source Technology Center, Intel ltd.
$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
signature.asc
Description: Digital signature
_______________________________________________ Beignet mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/beignet
