Yes, this one is correct, map_flags can be CL_MAP_WRITE | CL_MAP_READ, so 
previous patch will set write_map to 0 for this case.

> -----Original Message-----
> From: Beignet [mailto:[email protected]] On Behalf Of
> Zhenyu Wang
> Sent: Thursday, October 23, 2014 14:29
> To: Guo, Yejun
> Cc: [email protected]
> Subject: Re: [Beignet] [PATCH] Make use of write enable flag for mem bo
> map
> 
> On 2014.10.23 06:23:58 +0000, Guo, Yejun wrote:
> > diff --git a/src/cl_api.c b/src/cl_api.c index 8a2e999..1c1dd85 100644
> > --- a/src/cl_api.c
> > +++ b/src/cl_api.c
> > @@ -2653,6 +2653,10 @@ clEnqueueMapBuffer(cl_command_queue
> command_queue,
> >    data->size        = size;
> >    data->ptr         = ptr;
> >    data->unsync_map  = 1;
> > +  if (map_flags & CL_MAP_READ)
> > +    data->write_map = 0;
> > +  else if (map_flags & (CL_MAP_WRITE |
> CL_MAP_WRITE_INVALIDATE_REGION))
> > +    data->write_map = 1;
> > [yejun] from the perspective of c programming, how about the value of
> data->write_map for other conditions.  I understand it keeps the initial 
> value.
> It would be better to assign the value explicitly, just like:
> > if (...)
> >   something
> > else
> >   something
> >
> 
> Might simply write
> 
>       if (map_flags & (CL_MAP_WRITE |
> CL_MAP_WRITE_INVALIDATE_REGION))
>                data->write_map = 1;
> 
> --
> Open Source Technology Center, Intel ltd.
> 
> $gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
_______________________________________________
Beignet mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/beignet

Reply via email to