The patch LGTM, thanks.
> -----Original Message----- > From: Beignet [mailto:[email protected]] On Behalf Of > Mark Thompson > Sent: Thursday, September 1, 2016 2:55 > To: [email protected] > Subject: [Beignet] [PATCH] Apply image offset to read/write/map operations > > If an image is created from a buffer, it need not start at the beginning of > the > containing mappable object (especially for an image with multiple planes, > such as one created from VAAPI). This fixes the implementation of the > clEnqueue{Read,Write,Map}Image functions to take that offset into account. > > Signed-off-by: Mark Thompson <[email protected]> > --- > v2: Added a more descriptive commit message and s-o-b line. > > Thanks, > > - Mark > > src/cl_enqueue.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/src/cl_enqueue.c b/src/cl_enqueue.c index 081ffce..54c0ffa > 100644 > --- a/src/cl_enqueue.c > +++ b/src/cl_enqueue.c > @@ -204,7 +204,7 @@ cl_int cl_enqueue_read_image(enqueue_data *data) > goto error; > } > > - size_t offset = image->bpp*origin[0] + image->row_pitch*origin[1] + > image->slice_pitch*origin[2]; > + size_t offset = image->offset + image->bpp*origin[0] + > + image->row_pitch*origin[1] + image->slice_pitch*origin[2]; > src_ptr = (char*)src_ptr + offset; > > if (!origin[0] && region[0] == image->w && data->row_pitch == image- > >row_pitch && @@ -246,8 +246,8 @@ cl_int > cl_enqueue_write_image(enqueue_data *data) > err = CL_MAP_FAILURE; > goto error; > } > - //dst need to add offset > - cl_mem_copy_image_region(data->origin, data->region, dst_ptr, > + cl_mem_copy_image_region(data->origin, data->region, > + dst_ptr + image->offset, > image->row_pitch, image->slice_pitch, > data->const_ptr, data->row_pitch, > data->slice_pitch, image, CL_TRUE, CL_FALSE); @@ > -311,7 > +311,7 @@ cl_int cl_enqueue_map_image(enqueue_data *data) > err = CL_MAP_FAILURE; > goto error; > } > - data->ptr = ptr; > + data->ptr = (char*)ptr + image->offset; > if (image->image_type == CL_MEM_OBJECT_IMAGE1D_ARRAY) > row_pitch = image->slice_pitch; > else > -- > 2.9.3 > > _______________________________________________ > Beignet mailing list > [email protected] > https://lists.freedesktop.org/mailman/listinfo/beignet _______________________________________________ Beignet mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/beignet
