[Beignet] [PATCH] Refine mem.h and improve the related macro defination.

Simon Richter Simon.Richter at hogyros.de
Tue Dec 20 08:05:41 UTC 2016


Hi,

On 20.12.2016 04:23, He Junyan wrote:

>>> +    if (!CL_OBJECT_IS_BUFFER(memobj)) {

>> That would match pipes as well, is that intended?

> 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))

Exactly my point. A pipe object would not match CL_OBJECT_IS_BUFFER(),
so the negated test would return true, and the code would look at
memobj->host_ptr in a pipe object, which is wrong.

   Simon


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/beignet/attachments/20161220/4079079d/attachment.sig>


More information about the Beignet mailing list