blob: 638ac6299130981ad1ab2f38bcfd987e15476ab1 [file] [log] [blame]
Mathias Agopian3330b202009-10-05 17:07:12 -07001/*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Mathias Agopian98e71dd2010-02-11 17:30:52 -080017#define LOG_TAG "GraphicBuffer"
18
Mathias Agopian3330b202009-10-05 17:07:12 -070019#include <stdlib.h>
20#include <stdint.h>
21#include <sys/types.h>
22
Mathias Agopian3330b202009-10-05 17:07:12 -070023#include <utils/Errors.h>
24#include <utils/Log.h>
25
26#include <ui/GraphicBuffer.h>
27#include <ui/GraphicBufferAllocator.h>
28#include <ui/GraphicBufferMapper.h>
29#include <ui/PixelFormat.h>
30
Mathias Agopian3330b202009-10-05 17:07:12 -070031namespace android {
32
33// ===========================================================================
Iliyan Malchev697526b2011-05-01 11:33:26 -070034// Buffer and implementation of ANativeWindowBuffer
Mathias Agopian3330b202009-10-05 17:07:12 -070035// ===========================================================================
36
Dan Stozab1363d32014-03-28 15:10:52 -070037static uint64_t getUniqueId() {
38 static volatile int32_t nextId = 0;
39 uint64_t id = static_cast<uint64_t>(getpid()) << 32;
40 id |= static_cast<uint32_t>(android_atomic_inc(&nextId));
41 return id;
42}
43
Mathias Agopian3330b202009-10-05 17:07:12 -070044GraphicBuffer::GraphicBuffer()
Mathias Agopian54ba51d2009-10-26 20:12:37 -070045 : BASE(), mOwner(ownData), mBufferMapper(GraphicBufferMapper::get()),
Dan Stozab1363d32014-03-28 15:10:52 -070046 mInitCheck(NO_ERROR), mId(getUniqueId())
47{
Dan Stoza01049c82014-11-11 10:32:31 -080048 width =
49 height =
50 stride =
51 format =
Mathias Agopian3330b202009-10-05 17:07:12 -070052 usage = 0;
53 handle = NULL;
54}
55
Dan Stozad3182402014-11-17 12:03:59 -080056GraphicBuffer::GraphicBuffer(uint32_t inWidth, uint32_t inHeight,
57 PixelFormat inFormat, uint32_t inUsage)
Mathias Agopian54ba51d2009-10-26 20:12:37 -070058 : BASE(), mOwner(ownData), mBufferMapper(GraphicBufferMapper::get()),
Dan Stozab1363d32014-03-28 15:10:52 -070059 mInitCheck(NO_ERROR), mId(getUniqueId())
Mathias Agopian3330b202009-10-05 17:07:12 -070060{
Dan Stoza01049c82014-11-11 10:32:31 -080061 width =
62 height =
63 stride =
64 format =
Mathias Agopian3330b202009-10-05 17:07:12 -070065 usage = 0;
66 handle = NULL;
Dan Stozad3182402014-11-17 12:03:59 -080067 mInitCheck = initSize(inWidth, inHeight, inFormat, inUsage);
Mathias Agopian3330b202009-10-05 17:07:12 -070068}
69
Dan Stozad3182402014-11-17 12:03:59 -080070GraphicBuffer::GraphicBuffer(uint32_t inWidth, uint32_t inHeight,
71 PixelFormat inFormat, uint32_t inUsage, uint32_t inStride,
72 native_handle_t* inHandle, bool keepOwnership)
Mathias Agopian54ba51d2009-10-26 20:12:37 -070073 : BASE(), mOwner(keepOwnership ? ownHandle : ownNone),
74 mBufferMapper(GraphicBufferMapper::get()),
Dan Stozab1363d32014-03-28 15:10:52 -070075 mInitCheck(NO_ERROR), mId(getUniqueId())
Mathias Agopian54ba51d2009-10-26 20:12:37 -070076{
Dan Stozad3182402014-11-17 12:03:59 -080077 width = static_cast<int>(inWidth);
78 height = static_cast<int>(inHeight);
79 stride = static_cast<int>(inStride);
Mathias Agopian54ba51d2009-10-26 20:12:37 -070080 format = inFormat;
Dan Stozad3182402014-11-17 12:03:59 -080081 usage = static_cast<int>(inUsage);
Mathias Agopian54ba51d2009-10-26 20:12:37 -070082 handle = inHandle;
83}
84
Iliyan Malchev697526b2011-05-01 11:33:26 -070085GraphicBuffer::GraphicBuffer(ANativeWindowBuffer* buffer, bool keepOwnership)
Jamie Gennis309d3bb2010-10-07 13:46:55 -070086 : BASE(), mOwner(keepOwnership ? ownHandle : ownNone),
87 mBufferMapper(GraphicBufferMapper::get()),
Dan Stozab1363d32014-03-28 15:10:52 -070088 mInitCheck(NO_ERROR), mWrappedBuffer(buffer), mId(getUniqueId())
Jamie Gennis309d3bb2010-10-07 13:46:55 -070089{
90 width = buffer->width;
91 height = buffer->height;
92 stride = buffer->stride;
93 format = buffer->format;
94 usage = buffer->usage;
95 handle = buffer->handle;
96}
97
Mathias Agopian3330b202009-10-05 17:07:12 -070098GraphicBuffer::~GraphicBuffer()
99{
100 if (handle) {
Mathias Agopian98e71dd2010-02-11 17:30:52 -0800101 free_handle();
102 }
103}
104
105void GraphicBuffer::free_handle()
106{
107 if (mOwner == ownHandle) {
Jamie Gennis309d3bb2010-10-07 13:46:55 -0700108 mBufferMapper.unregisterBuffer(handle);
Mathias Agopian98e71dd2010-02-11 17:30:52 -0800109 native_handle_close(handle);
110 native_handle_delete(const_cast<native_handle*>(handle));
111 } else if (mOwner == ownData) {
112 GraphicBufferAllocator& allocator(GraphicBufferAllocator::get());
113 allocator.free(handle);
Mathias Agopian3330b202009-10-05 17:07:12 -0700114 }
Jamie Gennis309d3bb2010-10-07 13:46:55 -0700115 mWrappedBuffer = 0;
Mathias Agopian3330b202009-10-05 17:07:12 -0700116}
117
118status_t GraphicBuffer::initCheck() const {
Dan Stoza133caac2014-12-01 15:15:31 -0800119 return static_cast<status_t>(mInitCheck);
Mathias Agopian3330b202009-10-05 17:07:12 -0700120}
121
Mathias Agopian678bdd62010-12-03 17:33:09 -0800122void GraphicBuffer::dumpAllocationsToSystemLog()
123{
124 GraphicBufferAllocator::dumpToSystemLog();
125}
126
Iliyan Malchev697526b2011-05-01 11:33:26 -0700127ANativeWindowBuffer* GraphicBuffer::getNativeBuffer() const
Mathias Agopian3330b202009-10-05 17:07:12 -0700128{
Colin Cross18fae752014-07-22 15:55:08 -0700129 LOG_ALWAYS_FATAL_IF(this == NULL, "getNativeBuffer() called on NULL GraphicBuffer");
Iliyan Malchev697526b2011-05-01 11:33:26 -0700130 return static_cast<ANativeWindowBuffer*>(
Mathias Agopian3330b202009-10-05 17:07:12 -0700131 const_cast<GraphicBuffer*>(this));
132}
133
Dan Stozad3182402014-11-17 12:03:59 -0800134status_t GraphicBuffer::reallocate(uint32_t inWidth, uint32_t inHeight,
135 PixelFormat inFormat, uint32_t inUsage)
Mathias Agopian3330b202009-10-05 17:07:12 -0700136{
Mathias Agopian54ba51d2009-10-26 20:12:37 -0700137 if (mOwner != ownData)
138 return INVALID_OPERATION;
139
Dan Stozad3182402014-11-17 12:03:59 -0800140 if (handle &&
141 static_cast<int>(inWidth) == width &&
142 static_cast<int>(inHeight) == height &&
143 inFormat == format &&
144 static_cast<int>(inUsage) == usage)
Mathias Agopian579b3f82010-06-08 19:54:15 -0700145 return NO_ERROR;
146
Mathias Agopian3330b202009-10-05 17:07:12 -0700147 if (handle) {
148 GraphicBufferAllocator& allocator(GraphicBufferAllocator::get());
149 allocator.free(handle);
150 handle = 0;
151 }
Dan Stozad3182402014-11-17 12:03:59 -0800152 return initSize(inWidth, inHeight, inFormat, inUsage);
Mathias Agopian3330b202009-10-05 17:07:12 -0700153}
154
Dan Stozad3182402014-11-17 12:03:59 -0800155status_t GraphicBuffer::initSize(uint32_t inWidth, uint32_t inHeight,
156 PixelFormat inFormat, uint32_t inUsage)
Mathias Agopian3330b202009-10-05 17:07:12 -0700157{
Mathias Agopian3330b202009-10-05 17:07:12 -0700158 GraphicBufferAllocator& allocator = GraphicBufferAllocator::get();
Dan Stozad3182402014-11-17 12:03:59 -0800159 uint32_t outStride = 0;
160 status_t err = allocator.alloc(inWidth, inHeight, inFormat, inUsage,
161 &handle, &outStride);
Mathias Agopian3330b202009-10-05 17:07:12 -0700162 if (err == NO_ERROR) {
Dan Stozad3182402014-11-17 12:03:59 -0800163 width = static_cast<int>(inWidth);
164 height = static_cast<int>(inHeight);
165 format = inFormat;
166 usage = static_cast<int>(inUsage);
167 stride = static_cast<int>(outStride);
Mathias Agopian3330b202009-10-05 17:07:12 -0700168 }
169 return err;
170}
171
Dan Stozad3182402014-11-17 12:03:59 -0800172status_t GraphicBuffer::lock(uint32_t inUsage, void** vaddr)
Mathias Agopian3330b202009-10-05 17:07:12 -0700173{
174 const Rect lockBounds(width, height);
Dan Stozad3182402014-11-17 12:03:59 -0800175 status_t res = lock(inUsage, lockBounds, vaddr);
Mathias Agopian3330b202009-10-05 17:07:12 -0700176 return res;
177}
178
Dan Stozad3182402014-11-17 12:03:59 -0800179status_t GraphicBuffer::lock(uint32_t inUsage, const Rect& rect, void** vaddr)
Mathias Agopian3330b202009-10-05 17:07:12 -0700180{
Dan Stozad3182402014-11-17 12:03:59 -0800181 if (rect.left < 0 || rect.right > width ||
182 rect.top < 0 || rect.bottom > height) {
Steve Blocke6f43dd2012-01-06 19:20:56 +0000183 ALOGE("locking pixels (%d,%d,%d,%d) outside of buffer (w=%d, h=%d)",
Dan Stoza01049c82014-11-11 10:32:31 -0800184 rect.left, rect.top, rect.right, rect.bottom,
Dan Stozad3182402014-11-17 12:03:59 -0800185 width, height);
Mathias Agopian3330b202009-10-05 17:07:12 -0700186 return BAD_VALUE;
187 }
Dan Stozad3182402014-11-17 12:03:59 -0800188 status_t res = getBufferMapper().lock(handle, inUsage, rect, vaddr);
Mathias Agopian3330b202009-10-05 17:07:12 -0700189 return res;
190}
191
Dan Stozad3182402014-11-17 12:03:59 -0800192status_t GraphicBuffer::lockYCbCr(uint32_t inUsage, android_ycbcr* ycbcr)
Eino-Ville Talvalac43946b2013-05-04 18:07:43 -0700193{
194 const Rect lockBounds(width, height);
Dan Stozad3182402014-11-17 12:03:59 -0800195 status_t res = lockYCbCr(inUsage, lockBounds, ycbcr);
Eino-Ville Talvalac43946b2013-05-04 18:07:43 -0700196 return res;
197}
198
Dan Stozad3182402014-11-17 12:03:59 -0800199status_t GraphicBuffer::lockYCbCr(uint32_t inUsage, const Rect& rect,
200 android_ycbcr* ycbcr)
Eino-Ville Talvalac43946b2013-05-04 18:07:43 -0700201{
Dan Stozad3182402014-11-17 12:03:59 -0800202 if (rect.left < 0 || rect.right > width ||
203 rect.top < 0 || rect.bottom > height) {
Eino-Ville Talvalac43946b2013-05-04 18:07:43 -0700204 ALOGE("locking pixels (%d,%d,%d,%d) outside of buffer (w=%d, h=%d)",
205 rect.left, rect.top, rect.right, rect.bottom,
Dan Stozad3182402014-11-17 12:03:59 -0800206 width, height);
Eino-Ville Talvalac43946b2013-05-04 18:07:43 -0700207 return BAD_VALUE;
208 }
Dan Stozad3182402014-11-17 12:03:59 -0800209 status_t res = getBufferMapper().lockYCbCr(handle, inUsage, rect, ycbcr);
Eino-Ville Talvalac43946b2013-05-04 18:07:43 -0700210 return res;
211}
212
Mathias Agopian3330b202009-10-05 17:07:12 -0700213status_t GraphicBuffer::unlock()
214{
215 status_t res = getBufferMapper().unlock(handle);
216 return res;
217}
218
Dan Stozad3182402014-11-17 12:03:59 -0800219status_t GraphicBuffer::lockAsync(uint32_t inUsage, void** vaddr, int fenceFd)
Francis Hart8f396012014-04-01 15:30:53 +0300220{
221 const Rect lockBounds(width, height);
Dan Stozad3182402014-11-17 12:03:59 -0800222 status_t res = lockAsync(inUsage, lockBounds, vaddr, fenceFd);
Francis Hart8f396012014-04-01 15:30:53 +0300223 return res;
224}
225
Dan Stozad3182402014-11-17 12:03:59 -0800226status_t GraphicBuffer::lockAsync(uint32_t inUsage, const Rect& rect,
227 void** vaddr, int fenceFd)
Francis Hart8f396012014-04-01 15:30:53 +0300228{
Dan Stozad3182402014-11-17 12:03:59 -0800229 if (rect.left < 0 || rect.right > width ||
230 rect.top < 0 || rect.bottom > height) {
Francis Hart8f396012014-04-01 15:30:53 +0300231 ALOGE("locking pixels (%d,%d,%d,%d) outside of buffer (w=%d, h=%d)",
232 rect.left, rect.top, rect.right, rect.bottom,
Dan Stozad3182402014-11-17 12:03:59 -0800233 width, height);
Francis Hart8f396012014-04-01 15:30:53 +0300234 return BAD_VALUE;
235 }
Dan Stozad3182402014-11-17 12:03:59 -0800236 status_t res = getBufferMapper().lockAsync(handle, inUsage, rect, vaddr,
237 fenceFd);
Francis Hart8f396012014-04-01 15:30:53 +0300238 return res;
239}
240
Dan Stozad3182402014-11-17 12:03:59 -0800241status_t GraphicBuffer::lockAsyncYCbCr(uint32_t inUsage, android_ycbcr* ycbcr,
242 int fenceFd)
Francis Hart8f396012014-04-01 15:30:53 +0300243{
244 const Rect lockBounds(width, height);
Dan Stozad3182402014-11-17 12:03:59 -0800245 status_t res = lockAsyncYCbCr(inUsage, lockBounds, ycbcr, fenceFd);
Francis Hart8f396012014-04-01 15:30:53 +0300246 return res;
247}
248
Dan Stozad3182402014-11-17 12:03:59 -0800249status_t GraphicBuffer::lockAsyncYCbCr(uint32_t inUsage, const Rect& rect,
250 android_ycbcr* ycbcr, int fenceFd)
Francis Hart8f396012014-04-01 15:30:53 +0300251{
Dan Stozad3182402014-11-17 12:03:59 -0800252 if (rect.left < 0 || rect.right > width ||
253 rect.top < 0 || rect.bottom > height) {
Francis Hart8f396012014-04-01 15:30:53 +0300254 ALOGE("locking pixels (%d,%d,%d,%d) outside of buffer (w=%d, h=%d)",
255 rect.left, rect.top, rect.right, rect.bottom,
Dan Stozad3182402014-11-17 12:03:59 -0800256 width, height);
Francis Hart8f396012014-04-01 15:30:53 +0300257 return BAD_VALUE;
258 }
Dan Stozad3182402014-11-17 12:03:59 -0800259 status_t res = getBufferMapper().lockAsyncYCbCr(handle, inUsage, rect,
260 ycbcr, fenceFd);
Francis Hart8f396012014-04-01 15:30:53 +0300261 return res;
262}
263
264status_t GraphicBuffer::unlockAsync(int *fenceFd)
265{
266 status_t res = getBufferMapper().unlockAsync(handle, fenceFd);
267 return res;
268}
269
Mathias Agopian98e71dd2010-02-11 17:30:52 -0800270size_t GraphicBuffer::getFlattenedSize() const {
Dan Stozad3182402014-11-17 12:03:59 -0800271 return static_cast<size_t>(10 + (handle ? handle->numInts : 0)) * sizeof(int);
Mathias Agopian98e71dd2010-02-11 17:30:52 -0800272}
Mathias Agopian3330b202009-10-05 17:07:12 -0700273
Mathias Agopian98e71dd2010-02-11 17:30:52 -0800274size_t GraphicBuffer::getFdCount() const {
Dan Stozad3182402014-11-17 12:03:59 -0800275 return static_cast<size_t>(handle ? handle->numFds : 0);
Mathias Agopian98e71dd2010-02-11 17:30:52 -0800276}
277
Mathias Agopiane1424282013-07-29 21:24:40 -0700278status_t GraphicBuffer::flatten(void*& buffer, size_t& size, int*& fds, size_t& count) const {
Mathias Agopian98e71dd2010-02-11 17:30:52 -0800279 size_t sizeNeeded = GraphicBuffer::getFlattenedSize();
280 if (size < sizeNeeded) return NO_MEMORY;
Mathias Agopian3330b202009-10-05 17:07:12 -0700281
Mathias Agopian98e71dd2010-02-11 17:30:52 -0800282 size_t fdCountNeeded = GraphicBuffer::getFdCount();
283 if (count < fdCountNeeded) return NO_MEMORY;
Mathias Agopian3330b202009-10-05 17:07:12 -0700284
Dan Stozab1363d32014-03-28 15:10:52 -0700285 int32_t* buf = static_cast<int32_t*>(buffer);
Mathias Agopian98e71dd2010-02-11 17:30:52 -0800286 buf[0] = 'GBFR';
287 buf[1] = width;
288 buf[2] = height;
289 buf[3] = stride;
290 buf[4] = format;
291 buf[5] = usage;
Dan Stozab1363d32014-03-28 15:10:52 -0700292 buf[6] = static_cast<int32_t>(mId >> 32);
293 buf[7] = static_cast<int32_t>(mId & 0xFFFFFFFFull);
294 buf[8] = 0;
295 buf[9] = 0;
Mathias Agopian98e71dd2010-02-11 17:30:52 -0800296
297 if (handle) {
Dan Stozab1363d32014-03-28 15:10:52 -0700298 buf[8] = handle->numFds;
299 buf[9] = handle->numInts;
Dan Stozad3182402014-11-17 12:03:59 -0800300 memcpy(fds, handle->data,
301 static_cast<size_t>(handle->numFds) * sizeof(int));
302 memcpy(&buf[10], handle->data + handle->numFds,
303 static_cast<size_t>(handle->numInts) * sizeof(int));
Mathias Agopian3330b202009-10-05 17:07:12 -0700304 }
Mathias Agopian98e71dd2010-02-11 17:30:52 -0800305
Mathias Agopiane1424282013-07-29 21:24:40 -0700306 buffer = reinterpret_cast<void*>(static_cast<int*>(buffer) + sizeNeeded);
307 size -= sizeNeeded;
Andy McFaddenbc96e472014-03-17 16:48:23 -0700308 if (handle) {
309 fds += handle->numFds;
Dan Stozad3182402014-11-17 12:03:59 -0800310 count -= static_cast<size_t>(handle->numFds);
Andy McFaddenbc96e472014-03-17 16:48:23 -0700311 }
Mathias Agopiane1424282013-07-29 21:24:40 -0700312
Mathias Agopian98e71dd2010-02-11 17:30:52 -0800313 return NO_ERROR;
314}
315
Mathias Agopiane1424282013-07-29 21:24:40 -0700316status_t GraphicBuffer::unflatten(
317 void const*& buffer, size_t& size, int const*& fds, size_t& count) {
Mathias Agopian98e71dd2010-02-11 17:30:52 -0800318 if (size < 8*sizeof(int)) return NO_MEMORY;
319
320 int const* buf = static_cast<int const*>(buffer);
321 if (buf[0] != 'GBFR') return BAD_TYPE;
322
Dan Stozad3182402014-11-17 12:03:59 -0800323 const size_t numFds = static_cast<size_t>(buf[8]);
324 const size_t numInts = static_cast<size_t>(buf[9]);
Mathias Agopian98e71dd2010-02-11 17:30:52 -0800325
Michael Lentinec168b8a2015-02-18 10:14:18 -0800326 // Limit the maxNumber to be relatively small. The number of fds or ints
327 // should not come close to this number, and the number itself was simply
328 // chosen to be high enough to not cause issues and low enough to prevent
329 // overflow problems.
330 const size_t maxNumber = 4096;
Michael Lentine38803262014-10-31 15:25:03 -0700331 if (numFds >= maxNumber || numInts >= (maxNumber - 10)) {
332 width = height = stride = format = usage = 0;
333 handle = NULL;
Dan Stoza01049c82014-11-11 10:32:31 -0800334 ALOGE("unflatten: numFds or numInts is too large: %zd, %zd",
Michael Lentine38803262014-10-31 15:25:03 -0700335 numFds, numInts);
336 return BAD_VALUE;
337 }
338
Dan Stozab1363d32014-03-28 15:10:52 -0700339 const size_t sizeNeeded = (10 + numInts) * sizeof(int);
Mathias Agopian98e71dd2010-02-11 17:30:52 -0800340 if (size < sizeNeeded) return NO_MEMORY;
341
Michael Lentine38803262014-10-31 15:25:03 -0700342 size_t fdCountNeeded = numFds;
Mathias Agopian98e71dd2010-02-11 17:30:52 -0800343 if (count < fdCountNeeded) return NO_MEMORY;
344
345 if (handle) {
346 // free previous handle if any
347 free_handle();
348 }
349
350 if (numFds || numInts) {
351 width = buf[1];
352 height = buf[2];
353 stride = buf[3];
354 format = buf[4];
355 usage = buf[5];
Dan Stozad3182402014-11-17 12:03:59 -0800356 native_handle* h = native_handle_create(
357 static_cast<int>(numFds), static_cast<int>(numInts));
Michael Lentine38803262014-10-31 15:25:03 -0700358 if (!h) {
359 width = height = stride = format = usage = 0;
360 handle = NULL;
361 ALOGE("unflatten: native_handle_create failed");
362 return NO_MEMORY;
363 }
Dan Stozad3182402014-11-17 12:03:59 -0800364 memcpy(h->data, fds, numFds * sizeof(int));
365 memcpy(h->data + numFds, &buf[10], numInts * sizeof(int));
Mathias Agopian98e71dd2010-02-11 17:30:52 -0800366 handle = h;
367 } else {
368 width = height = stride = format = usage = 0;
369 handle = NULL;
370 }
371
Dan Stozab1363d32014-03-28 15:10:52 -0700372 mId = static_cast<uint64_t>(buf[6]) << 32;
373 mId |= static_cast<uint32_t>(buf[7]);
374
Mathias Agopian98e71dd2010-02-11 17:30:52 -0800375 mOwner = ownHandle;
Jamie Gennis309d3bb2010-10-07 13:46:55 -0700376
377 if (handle != 0) {
Jamie Gennisd69097f2012-08-30 13:28:23 -0700378 status_t err = mBufferMapper.registerBuffer(handle);
379 if (err != NO_ERROR) {
Lingyun Zhu2aff7022012-11-20 19:24:35 +0800380 width = height = stride = format = usage = 0;
381 handle = NULL;
Jamie Gennisd69097f2012-08-30 13:28:23 -0700382 ALOGE("unflatten: registerBuffer failed: %s (%d)",
383 strerror(-err), err);
384 return err;
385 }
Jamie Gennis309d3bb2010-10-07 13:46:55 -0700386 }
387
Mathias Agopiane1424282013-07-29 21:24:40 -0700388 buffer = reinterpret_cast<void const*>(static_cast<int const*>(buffer) + sizeNeeded);
389 size -= sizeNeeded;
390 fds += numFds;
391 count -= numFds;
392
Mathias Agopian98e71dd2010-02-11 17:30:52 -0800393 return NO_ERROR;
Mathias Agopian3330b202009-10-05 17:07:12 -0700394}
395
Mathias Agopian3330b202009-10-05 17:07:12 -0700396// ---------------------------------------------------------------------------
397
398}; // namespace android