[Beignet] [PATCH] Correct check for optimized copy in clEnqueueReadImage and clEnqueueWriteImage.
Zhigang Gong
zhigang.gong at linux.intel.com
Sun May 19 22:59:55 PDT 2013
Could you merge this with the previous clEnqueueRead/Write Image patch?
Thanks.
On Sat, May 18, 2013 at 07:13:40PM +0200, Dag Lem wrote:
>
> Signed-off-by: Dag Lem <dag at nimrod.no>
> ---
> src/cl_api.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/src/cl_api.c b/src/cl_api.c
> index a134dcc..ff1883c 100644
> --- a/src/cl_api.c
> +++ b/src/cl_api.c
> @@ -1025,7 +1025,10 @@ clEnqueueReadImage(cl_command_queue command_queue,
> size_t offset = image->bpp*origin[0] + image->row_pitch*origin[1] + image->slice_pitch*origin[2];
> src_ptr = (char*)src_ptr + offset;
>
> - if (row_pitch == image->row_pitch && slice_pitch == image->slice_pitch) {
> + if (!origin[0] && !origin[1] &&
> + region[0] == image->w && region[1] == image->h &&
> + row_pitch == image->row_pitch && slice_pitch == image->slice_pitch)
> + {
> memcpy(ptr, src_ptr, slice_pitch ? slice_pitch*region[2] : row_pitch*region[1]);
> }
> else {
> @@ -1117,7 +1120,10 @@ clEnqueueWriteImage(cl_command_queue command_queue,
> size_t offset = image->bpp*origin[0] + image->row_pitch*origin[1] + image->slice_pitch*origin[2];
> dst_ptr = (char*)dst_ptr + offset;
>
> - if (row_pitch == image->row_pitch && slice_pitch == image->slice_pitch) {
> + if (!origin[0] && !origin[1] &&
> + region[0] == image->w && region[1] == image->h &&
> + row_pitch == image->row_pitch && slice_pitch == image->slice_pitch)
> + {
> memcpy(dst_ptr, ptr, slice_pitch ? slice_pitch*region[2] : row_pitch*region[1]);
> }
> else {
> --
> 1.8.1.4
>
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list