[Mesa-dev] [PATCH] clover: Add support for CL_MAP_WRITE_INVALIDATE_REGION

Francisco Jerez currojerez at riseup.net
Thu Aug 7 04:57:38 PDT 2014


Bruno Jiménez <brunojimen at gmail.com> writes:

> OpenCL 1.2 CL_MAP_WRITE_INVALIDATE_REGION sounds a lot like
> PIPE_TRANSFER_DISCARD_RANGE:
>
> From OpenCL 1.2 spec:
>     The contents of the region being mapped are to be discarded.
>
> From p_defines.h:
>     Discards the memory within the mapped region.
> ---
>  src/gallium/state_trackers/clover/core/resource.cpp | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/src/gallium/state_trackers/clover/core/resource.cpp b/src/gallium/state_trackers/clover/core/resource.cpp
> index 7b8a40a..f7d24ef 100644
> --- a/src/gallium/state_trackers/clover/core/resource.cpp
> +++ b/src/gallium/state_trackers/clover/core/resource.cpp
> @@ -172,8 +172,14 @@ mapping::mapping(command_queue &q, resource &r,
>                   const resource::vector &origin,
>                   const resource::vector &region) :
>     pctx(q.pipe) {
> +   if (((flags & CL_MAP_WRITE) || (flags & CL_MAP_READ)) &&
> +        (flags & CL_MAP_WRITE_INVALIDATE_REGION))
> +       throw error(CL_INVALID_VALUE);
> +

This parameter check belongs in the front-end (clover/api/transfer.cpp).
Otherwise looks OK to me.

>     unsigned usage = ((flags & CL_MAP_WRITE ? PIPE_TRANSFER_WRITE : 0 ) |
>                       (flags & CL_MAP_READ ? PIPE_TRANSFER_READ : 0 ) |
> +                     (flags & CL_MAP_WRITE_INVALIDATE_REGION ?
> +                        PIPE_TRANSFER_DISCARD_RANGE : 0) |
>                       (!blocking ? PIPE_TRANSFER_UNSYNCHRONIZED : 0));
>  
>     p = pctx->transfer_map(pctx, r.pipe, 0, usage,
> -- 
> 2.0.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140807/7deae6b7/attachment.sig>


More information about the mesa-dev mailing list