[Mesa-dev] [PATCH] clover: Add support for CL_MAP_WRITE_INVALIDATE_REGION
Bruno Jimenez
brunojimen at gmail.com
Thu Aug 7 07:27:32 PDT 2014
On Thu, 2014-08-07 at 14:57 +0300, Francisco Jerez wrote:
> 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 ®ion) :
> > 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.
Sure, I will add a 'validate_flags' function for it.
>
> > 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
More information about the mesa-dev
mailing list