gralloc: Add foreign buffer usage flag

Adds GRALLOC_USAGE_FOREIGN_BUFFERS, which a consumer may set as a usage
flag if it intends to attach buffers that it has not detached from the
BufferQueue. It provides a hint to the producer (who may query the
consumer usage bits) that it may receive a buffer from another
BufferQueue, so that it can exit during initialization, hopefully with a
meaningful error message, if such buffers are not supported.

Also adds GRALLOC_USAGE_ALLOC_MASK, which is applied to usage bits
before calling alloc on the gralloc module, and prevents the module from
seeing GRALLOC_USAGE_FOREIGN_BUFFERS, since that usage flag is of no use
while allocating buffers.

Bug: 19801661
Change-Id: I17b927de94245f4df7cfd3f4483b544da3e9cd35
(cherry picked from commit 201c7d91b757f632bfd67ca24e6c55d0dc88a8d4)
1 file changed