[Beignet] [PATCH] Make use of write enable flag for mem bo map
Guo, Yejun
yejun.guo at intel.com
Wed Oct 22 23:36:19 PDT 2014
Yes, simpler.
-----Original Message-----
From: Zhenyu Wang [mailto:zhenyuw at linux.intel.com]
Sent: Thursday, October 23, 2014 2:29 PM
To: Guo, Yejun
Cc: beignet at lists.freedesktop.org
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
More information about the Beignet
mailing list