[Beignet] [PATCH] Make use of write enable flag for mem bo map
Zhenyu Wang
zhenyuw at linux.intel.com
Wed Oct 22 23:28:38 PDT 2014
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/beignet/attachments/20141023/657addf3/attachment.sig>
More information about the Beignet
mailing list