The patch LGTM, and Guanqun's comment make sense to me. I will push it with
this change.
Thanks.
On Mon, Sep 23, 2013 at 07:06:02AM +0000, Lu, Guanqun wrote:
> I would suggest you should add { } in the first if clause. because it has
> nested if statement, that should be much clean.
>
> > -----Original Message-----
> > From: [email protected]
> > [mailto:[email protected]] On
> > Behalf Of Yang Rong
> > Sent: Monday, September 23, 2013 1:16 PM
> > To: [email protected]
> > Cc: Yang, Rong R
> > Subject: [Beignet] [PATCH] Fix clEnqueueMapImage error.
> >
> > Correct map size calc and remove ptr + offset because has done in
> > _cl_map_mem.
> >
> > Signed-off-by: Yang Rong <[email protected]>
> > ---
> > src/cl_api.c | 13 +++++++++++--
> > 1 file changed, 11 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/cl_api.c b/src/cl_api.c
> > index c81f730..b60160b 100644
> > --- a/src/cl_api.c
> > +++ b/src/cl_api.c
> > @@ -2155,13 +2155,22 @@ clEnqueueMapImage(cl_command_queue
> > command_queue,
> > }
> >
> > size_t offset = image->bpp*origin[0] + image->row_pitch*origin[1] +
> > image->slice_pitch*origin[2];
> > - size_t size = image->depth == 1 ? image->row_pitch*image->h :
> > image->slice_pitch*image->depth;
> > + size_t size;
> > + if(region[2] == 1)
> > + if(region[1] == 1)
> > + size = image->bpp * region[0];
> > + else
> > + size = image->row_pitch * (region[1] - 1) + (image->bpp * (origin[0]
> > +
> > region[0]));
> > + else {
> > + size = image->slice_pitch * (region[2] - 1);
> > + size += image->row_pitch * (origin[1] + region[1]);
> > + size += image->bpp * (origin[0] + region[0]);
> > + }
> >
> > err = _cl_map_mem(mem, &ptr, &mem_ptr, offset, size);
> > if (err != CL_SUCCESS)
> > goto error;
> >
> > - ptr = (char*)ptr + offset;
> > TRY(cl_event_check_waitlist, num_events_in_wait_list, event_wait_list,
> > event, mem->ctx);
> >
> > data = &no_wait_data;
> > --
> > 1.8.1.2
> >
> > _______________________________________________
> > Beignet mailing list
> > [email protected]
> > http://lists.freedesktop.org/mailman/listinfo/beignet
> _______________________________________________
> Beignet mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/beignet
_______________________________________________
Beignet mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/beignet