[Beignet] [PATCH] Refine mem.h and improve the related macro defination.
He Junyan
junyan.he at inbox.com
Tue Dec 20 03:23:03 UTC 2016
On Mon, Dec 19, 2016 at 06:25:26PM +0100, Simon Richter wrote:
> Date: Mon, 19 Dec 2016 18:25:26 +0100
> From: Simon Richter <Simon.Richter at hogyros.de>
> To: beignet at lists.freedesktop.org
> Subject: Re: [Beignet] [PATCH] Refine mem.h and improve the related macro
> defination.
>
> Hi,
>
> On 19.12.2016 10:21, junyan.he at inbox.com wrote:
>
> > --- a/src/cl_api_mem.c
> > +++ b/src/cl_api_mem.c
> > @@ -71,54 +71,54 @@ clGetMemObjectInfo(cl_mem memobj,
> > break;
> > case CL_MEM_HOST_PTR: {
> > ptr = 0;
> > - if (memobj->type == CL_MEM_IMAGE_TYPE) {
> > + if (!CL_OBJECT_IS_BUFFER(memobj)) {
> > ptr = (size_t)memobj->host_ptr;
> > } else {
>
> That would match pipes as well, is that intended?
>
> Simon
>
Already redefine CL_OBJECT_IS_BUFFER to just match buffer and subbuffer.
+#define CL_OBJECT_IS_BUFFER(mem) ((mem && \
+ ((cl_base_object)mem)->magic == CL_OBJECT_MEM_MAGIC && \
+ CL_OBJECT_GET_REF(mem) >= 1 && \
+ ((cl_mem)mem)->type <= CL_MEM_SUBBUFFER_TYPE))
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list