Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 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 | |
| 17 | #include <stdint.h> |
| 18 | #include <sys/types.h> |
| 19 | |
| 20 | #include <utils/Errors.h> |
Jesse Hall | 399184a | 2014-03-03 15:42:54 -0800 | [diff] [blame] | 21 | #include <utils/NativeHandle.h> |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 22 | #include <utils/RefBase.h> |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 23 | #include <utils/Timers.h> |
Jesse Hall | 399184a | 2014-03-03 15:42:54 -0800 | [diff] [blame] | 24 | #include <utils/Vector.h> |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 25 | |
| 26 | #include <binder/Parcel.h> |
| 27 | #include <binder/IInterface.h> |
| 28 | |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 29 | #include <gui/IGraphicBufferProducer.h> |
Dan Stoza | f0eaf25 | 2014-03-21 13:05:51 -0700 | [diff] [blame] | 30 | #include <gui/IProducerListener.h> |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 31 | |
| 32 | namespace android { |
| 33 | // ---------------------------------------------------------------------------- |
| 34 | |
| 35 | enum { |
| 36 | REQUEST_BUFFER = IBinder::FIRST_CALL_TRANSACTION, |
| 37 | SET_BUFFER_COUNT, |
| 38 | DEQUEUE_BUFFER, |
Dan Stoza | 9f3053d | 2014-03-06 15:14:33 -0800 | [diff] [blame] | 39 | DETACH_BUFFER, |
Dan Stoza | d9822a3 | 2014-03-28 15:25:31 -0700 | [diff] [blame] | 40 | DETACH_NEXT_BUFFER, |
Dan Stoza | 9f3053d | 2014-03-06 15:14:33 -0800 | [diff] [blame] | 41 | ATTACH_BUFFER, |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 42 | QUEUE_BUFFER, |
| 43 | CANCEL_BUFFER, |
Mathias Agopian | eafabcd | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 44 | QUERY, |
Jamie Gennis | fe0a87b | 2011-07-13 19:12:20 -0700 | [diff] [blame] | 45 | CONNECT, |
| 46 | DISCONNECT, |
Jesse Hall | 399184a | 2014-03-03 15:42:54 -0800 | [diff] [blame] | 47 | SET_SIDEBAND_STREAM, |
Dan Stoza | 29a3e90 | 2014-06-20 13:13:57 -0700 | [diff] [blame] | 48 | ALLOCATE_BUFFERS, |
Dan Stoza | 9de7293 | 2015-04-16 17:28:43 -0700 | [diff] [blame] | 49 | ALLOW_ALLOCATION, |
Dan Stoza | 812ed06 | 2015-06-02 15:45:22 -0700 | [diff] [blame] | 50 | SET_GENERATION_NUMBER, |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 51 | }; |
| 52 | |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 53 | class BpGraphicBufferProducer : public BpInterface<IGraphicBufferProducer> |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 54 | { |
| 55 | public: |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 56 | BpGraphicBufferProducer(const sp<IBinder>& impl) |
| 57 | : BpInterface<IGraphicBufferProducer>(impl) |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 58 | { |
| 59 | } |
| 60 | |
Dan Stoza | 3be1c6b | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 61 | virtual ~BpGraphicBufferProducer(); |
| 62 | |
Jamie Gennis | 7b305ff | 2011-07-19 12:08:33 -0700 | [diff] [blame] | 63 | virtual status_t requestBuffer(int bufferIdx, sp<GraphicBuffer>* buf) { |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 64 | Parcel data, reply; |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 65 | data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 66 | data.writeInt32(bufferIdx); |
Jamie Gennis | 8a29ff2 | 2011-10-14 15:03:17 -0700 | [diff] [blame] | 67 | status_t result =remote()->transact(REQUEST_BUFFER, data, &reply); |
| 68 | if (result != NO_ERROR) { |
| 69 | return result; |
| 70 | } |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 71 | bool nonNull = reply.readInt32(); |
| 72 | if (nonNull) { |
Jamie Gennis | 7b305ff | 2011-07-19 12:08:33 -0700 | [diff] [blame] | 73 | *buf = new GraphicBuffer(); |
Lingyun Zhu | 2aff702 | 2012-11-20 19:24:35 +0800 | [diff] [blame] | 74 | result = reply.read(**buf); |
| 75 | if(result != NO_ERROR) { |
| 76 | (*buf).clear(); |
| 77 | return result; |
| 78 | } |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 79 | } |
Jamie Gennis | 8a29ff2 | 2011-10-14 15:03:17 -0700 | [diff] [blame] | 80 | result = reply.readInt32(); |
Jamie Gennis | 7b305ff | 2011-07-19 12:08:33 -0700 | [diff] [blame] | 81 | return result; |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 82 | } |
| 83 | |
| 84 | virtual status_t setBufferCount(int bufferCount) |
| 85 | { |
| 86 | Parcel data, reply; |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 87 | data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 88 | data.writeInt32(bufferCount); |
Jamie Gennis | 8a29ff2 | 2011-10-14 15:03:17 -0700 | [diff] [blame] | 89 | status_t result =remote()->transact(SET_BUFFER_COUNT, data, &reply); |
| 90 | if (result != NO_ERROR) { |
| 91 | return result; |
| 92 | } |
| 93 | result = reply.readInt32(); |
| 94 | return result; |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 95 | } |
| 96 | |
Mathias Agopian | 7cdd786 | 2013-07-18 22:10:56 -0700 | [diff] [blame] | 97 | virtual status_t dequeueBuffer(int *buf, sp<Fence>* fence, bool async, |
Dan Stoza | 3be1c6b | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 98 | uint32_t width, uint32_t height, PixelFormat format, |
| 99 | uint32_t usage) { |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 100 | Parcel data, reply; |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 101 | data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); |
Dan Stoza | 3be1c6b | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 102 | data.writeInt32(static_cast<int32_t>(async)); |
| 103 | data.writeUint32(width); |
| 104 | data.writeUint32(height); |
| 105 | data.writeInt32(static_cast<int32_t>(format)); |
| 106 | data.writeUint32(usage); |
Jamie Gennis | 8a29ff2 | 2011-10-14 15:03:17 -0700 | [diff] [blame] | 107 | status_t result = remote()->transact(DEQUEUE_BUFFER, data, &reply); |
| 108 | if (result != NO_ERROR) { |
| 109 | return result; |
| 110 | } |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 111 | *buf = reply.readInt32(); |
Mathias Agopian | ba93b3f | 2013-08-01 15:48:40 -0700 | [diff] [blame] | 112 | bool nonNull = reply.readInt32(); |
| 113 | if (nonNull) { |
Jesse Hall | 4c00cc1 | 2013-03-15 21:34:30 -0700 | [diff] [blame] | 114 | *fence = new Fence(); |
Mathias Agopian | ba93b3f | 2013-08-01 15:48:40 -0700 | [diff] [blame] | 115 | reply.read(**fence); |
Jesse Hall | f785754 | 2012-06-14 15:26:33 -0700 | [diff] [blame] | 116 | } |
Jamie Gennis | 8a29ff2 | 2011-10-14 15:03:17 -0700 | [diff] [blame] | 117 | result = reply.readInt32(); |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 118 | return result; |
| 119 | } |
| 120 | |
Dan Stoza | 9f3053d | 2014-03-06 15:14:33 -0800 | [diff] [blame] | 121 | virtual status_t detachBuffer(int slot) { |
| 122 | Parcel data, reply; |
| 123 | data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); |
| 124 | data.writeInt32(slot); |
| 125 | status_t result = remote()->transact(DETACH_BUFFER, data, &reply); |
| 126 | if (result != NO_ERROR) { |
| 127 | return result; |
| 128 | } |
| 129 | result = reply.readInt32(); |
| 130 | return result; |
| 131 | } |
| 132 | |
Dan Stoza | d9822a3 | 2014-03-28 15:25:31 -0700 | [diff] [blame] | 133 | virtual status_t detachNextBuffer(sp<GraphicBuffer>* outBuffer, |
| 134 | sp<Fence>* outFence) { |
| 135 | if (outBuffer == NULL) { |
| 136 | ALOGE("detachNextBuffer: outBuffer must not be NULL"); |
| 137 | return BAD_VALUE; |
| 138 | } else if (outFence == NULL) { |
| 139 | ALOGE("detachNextBuffer: outFence must not be NULL"); |
| 140 | return BAD_VALUE; |
| 141 | } |
| 142 | Parcel data, reply; |
| 143 | data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); |
| 144 | status_t result = remote()->transact(DETACH_NEXT_BUFFER, data, &reply); |
| 145 | if (result != NO_ERROR) { |
| 146 | return result; |
| 147 | } |
| 148 | result = reply.readInt32(); |
| 149 | if (result == NO_ERROR) { |
| 150 | bool nonNull = reply.readInt32(); |
| 151 | if (nonNull) { |
| 152 | *outBuffer = new GraphicBuffer; |
| 153 | reply.read(**outBuffer); |
| 154 | } |
| 155 | nonNull = reply.readInt32(); |
| 156 | if (nonNull) { |
| 157 | *outFence = new Fence; |
| 158 | reply.read(**outFence); |
| 159 | } |
| 160 | } |
| 161 | return result; |
| 162 | } |
| 163 | |
Dan Stoza | 9f3053d | 2014-03-06 15:14:33 -0800 | [diff] [blame] | 164 | virtual status_t attachBuffer(int* slot, const sp<GraphicBuffer>& buffer) { |
| 165 | Parcel data, reply; |
| 166 | data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); |
| 167 | data.write(*buffer.get()); |
| 168 | status_t result = remote()->transact(ATTACH_BUFFER, data, &reply); |
| 169 | if (result != NO_ERROR) { |
| 170 | return result; |
| 171 | } |
| 172 | *slot = reply.readInt32(); |
| 173 | result = reply.readInt32(); |
| 174 | return result; |
| 175 | } |
| 176 | |
Mathias Agopian | f0bc2f1 | 2012-04-09 16:14:01 -0700 | [diff] [blame] | 177 | virtual status_t queueBuffer(int buf, |
| 178 | const QueueBufferInput& input, QueueBufferOutput* output) { |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 179 | Parcel data, reply; |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 180 | data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 181 | data.writeInt32(buf); |
Jesse Hall | c777b0b | 2012-06-28 12:52:05 -0700 | [diff] [blame] | 182 | data.write(input); |
Jamie Gennis | 8a29ff2 | 2011-10-14 15:03:17 -0700 | [diff] [blame] | 183 | status_t result = remote()->transact(QUEUE_BUFFER, data, &reply); |
| 184 | if (result != NO_ERROR) { |
| 185 | return result; |
| 186 | } |
Mathias Agopian | f0bc2f1 | 2012-04-09 16:14:01 -0700 | [diff] [blame] | 187 | memcpy(output, reply.readInplace(sizeof(*output)), sizeof(*output)); |
Jamie Gennis | 8a29ff2 | 2011-10-14 15:03:17 -0700 | [diff] [blame] | 188 | result = reply.readInt32(); |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 189 | return result; |
| 190 | } |
| 191 | |
Jesse Hall | 4c00cc1 | 2013-03-15 21:34:30 -0700 | [diff] [blame] | 192 | virtual void cancelBuffer(int buf, const sp<Fence>& fence) { |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 193 | Parcel data, reply; |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 194 | data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 195 | data.writeInt32(buf); |
Jamie Gennis | 1df8c34 | 2012-12-20 14:05:45 -0800 | [diff] [blame] | 196 | data.write(*fence.get()); |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 197 | remote()->transact(CANCEL_BUFFER, data, &reply); |
| 198 | } |
| 199 | |
Mathias Agopian | eafabcd | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 200 | virtual int query(int what, int* value) { |
| 201 | Parcel data, reply; |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 202 | data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); |
Mathias Agopian | eafabcd | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 203 | data.writeInt32(what); |
Jamie Gennis | 8a29ff2 | 2011-10-14 15:03:17 -0700 | [diff] [blame] | 204 | status_t result = remote()->transact(QUERY, data, &reply); |
| 205 | if (result != NO_ERROR) { |
| 206 | return result; |
| 207 | } |
Mathias Agopian | eafabcd | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 208 | value[0] = reply.readInt32(); |
Jamie Gennis | 8a29ff2 | 2011-10-14 15:03:17 -0700 | [diff] [blame] | 209 | result = reply.readInt32(); |
Mathias Agopian | eafabcd | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 210 | return result; |
| 211 | } |
| 212 | |
Dan Stoza | f0eaf25 | 2014-03-21 13:05:51 -0700 | [diff] [blame] | 213 | virtual status_t connect(const sp<IProducerListener>& listener, |
Mathias Agopian | 365857d | 2013-09-11 19:35:45 -0700 | [diff] [blame] | 214 | int api, bool producerControlledByApp, QueueBufferOutput* output) { |
Jamie Gennis | fe0a87b | 2011-07-13 19:12:20 -0700 | [diff] [blame] | 215 | Parcel data, reply; |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 216 | data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); |
Dan Stoza | f0eaf25 | 2014-03-21 13:05:51 -0700 | [diff] [blame] | 217 | if (listener != NULL) { |
| 218 | data.writeInt32(1); |
Marco Nelissen | 097ca27 | 2014-11-14 08:01:01 -0800 | [diff] [blame] | 219 | data.writeStrongBinder(IInterface::asBinder(listener)); |
Dan Stoza | f0eaf25 | 2014-03-21 13:05:51 -0700 | [diff] [blame] | 220 | } else { |
| 221 | data.writeInt32(0); |
| 222 | } |
Jamie Gennis | fe0a87b | 2011-07-13 19:12:20 -0700 | [diff] [blame] | 223 | data.writeInt32(api); |
Mathias Agopian | 595264f | 2013-07-16 22:56:09 -0700 | [diff] [blame] | 224 | data.writeInt32(producerControlledByApp); |
Jamie Gennis | 8a29ff2 | 2011-10-14 15:03:17 -0700 | [diff] [blame] | 225 | status_t result = remote()->transact(CONNECT, data, &reply); |
| 226 | if (result != NO_ERROR) { |
| 227 | return result; |
| 228 | } |
Mathias Agopian | 24202f5 | 2012-04-23 14:28:58 -0700 | [diff] [blame] | 229 | memcpy(output, reply.readInplace(sizeof(*output)), sizeof(*output)); |
Jamie Gennis | 8a29ff2 | 2011-10-14 15:03:17 -0700 | [diff] [blame] | 230 | result = reply.readInt32(); |
Jamie Gennis | fe0a87b | 2011-07-13 19:12:20 -0700 | [diff] [blame] | 231 | return result; |
| 232 | } |
Mathias Agopian | 8072711 | 2011-05-02 19:51:12 -0700 | [diff] [blame] | 233 | |
Jamie Gennis | fe0a87b | 2011-07-13 19:12:20 -0700 | [diff] [blame] | 234 | virtual status_t disconnect(int api) { |
| 235 | Parcel data, reply; |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 236 | data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); |
Jamie Gennis | fe0a87b | 2011-07-13 19:12:20 -0700 | [diff] [blame] | 237 | data.writeInt32(api); |
Jamie Gennis | 8a29ff2 | 2011-10-14 15:03:17 -0700 | [diff] [blame] | 238 | status_t result =remote()->transact(DISCONNECT, data, &reply); |
| 239 | if (result != NO_ERROR) { |
| 240 | return result; |
| 241 | } |
| 242 | result = reply.readInt32(); |
Jamie Gennis | fe0a87b | 2011-07-13 19:12:20 -0700 | [diff] [blame] | 243 | return result; |
| 244 | } |
Jesse Hall | 399184a | 2014-03-03 15:42:54 -0800 | [diff] [blame] | 245 | |
| 246 | virtual status_t setSidebandStream(const sp<NativeHandle>& stream) { |
| 247 | Parcel data, reply; |
| 248 | status_t result; |
| 249 | data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); |
| 250 | if (stream.get()) { |
| 251 | data.writeInt32(true); |
| 252 | data.writeNativeHandle(stream->handle()); |
| 253 | } else { |
| 254 | data.writeInt32(false); |
| 255 | } |
| 256 | if ((result = remote()->transact(SET_SIDEBAND_STREAM, data, &reply)) == NO_ERROR) { |
| 257 | result = reply.readInt32(); |
| 258 | } |
| 259 | return result; |
| 260 | } |
Dan Stoza | 29a3e90 | 2014-06-20 13:13:57 -0700 | [diff] [blame] | 261 | |
| 262 | virtual void allocateBuffers(bool async, uint32_t width, uint32_t height, |
Dan Stoza | 3be1c6b | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 263 | PixelFormat format, uint32_t usage) { |
Dan Stoza | 29a3e90 | 2014-06-20 13:13:57 -0700 | [diff] [blame] | 264 | Parcel data, reply; |
| 265 | data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); |
| 266 | data.writeInt32(static_cast<int32_t>(async)); |
Dan Stoza | 3be1c6b | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 267 | data.writeUint32(width); |
| 268 | data.writeUint32(height); |
Dan Stoza | 29a3e90 | 2014-06-20 13:13:57 -0700 | [diff] [blame] | 269 | data.writeInt32(static_cast<int32_t>(format)); |
Dan Stoza | 3be1c6b | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 270 | data.writeUint32(usage); |
Dan Stoza | 29a3e90 | 2014-06-20 13:13:57 -0700 | [diff] [blame] | 271 | status_t result = remote()->transact(ALLOCATE_BUFFERS, data, &reply); |
| 272 | if (result != NO_ERROR) { |
| 273 | ALOGE("allocateBuffers failed to transact: %d", result); |
| 274 | } |
| 275 | } |
Dan Stoza | 9de7293 | 2015-04-16 17:28:43 -0700 | [diff] [blame] | 276 | |
| 277 | virtual status_t allowAllocation(bool allow) { |
| 278 | Parcel data, reply; |
| 279 | data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); |
| 280 | data.writeInt32(static_cast<int32_t>(allow)); |
| 281 | status_t result = remote()->transact(ALLOW_ALLOCATION, data, &reply); |
| 282 | if (result != NO_ERROR) { |
| 283 | return result; |
| 284 | } |
| 285 | result = reply.readInt32(); |
| 286 | return result; |
| 287 | } |
Dan Stoza | 812ed06 | 2015-06-02 15:45:22 -0700 | [diff] [blame] | 288 | |
| 289 | virtual status_t setGenerationNumber(uint32_t generationNumber) { |
| 290 | Parcel data, reply; |
| 291 | data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); |
| 292 | data.writeUint32(generationNumber); |
| 293 | status_t result = remote()->transact(SET_GENERATION_NUMBER, data, &reply); |
| 294 | if (result == NO_ERROR) { |
| 295 | result = reply.readInt32(); |
| 296 | } |
| 297 | return result; |
| 298 | } |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 299 | }; |
| 300 | |
Dan Stoza | 3be1c6b | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 301 | // Out-of-line virtual method definition to trigger vtable emission in this |
| 302 | // translation unit (see clang warning -Wweak-vtables) |
| 303 | BpGraphicBufferProducer::~BpGraphicBufferProducer() {} |
| 304 | |
Andy McFadden | 466a192 | 2013-01-08 11:25:51 -0800 | [diff] [blame] | 305 | IMPLEMENT_META_INTERFACE(GraphicBufferProducer, "android.gui.IGraphicBufferProducer"); |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 306 | |
| 307 | // ---------------------------------------------------------------------- |
| 308 | |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 309 | status_t BnGraphicBufferProducer::onTransact( |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 310 | uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) |
| 311 | { |
| 312 | switch(code) { |
| 313 | case REQUEST_BUFFER: { |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 314 | CHECK_INTERFACE(IGraphicBufferProducer, data, reply); |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 315 | int bufferIdx = data.readInt32(); |
Jamie Gennis | 7b305ff | 2011-07-19 12:08:33 -0700 | [diff] [blame] | 316 | sp<GraphicBuffer> buffer; |
| 317 | int result = requestBuffer(bufferIdx, &buffer); |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 318 | reply->writeInt32(buffer != 0); |
| 319 | if (buffer != 0) { |
| 320 | reply->write(*buffer); |
| 321 | } |
Jamie Gennis | 7b305ff | 2011-07-19 12:08:33 -0700 | [diff] [blame] | 322 | reply->writeInt32(result); |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 323 | return NO_ERROR; |
Dan Stoza | 3be1c6b | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 324 | } |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 325 | case SET_BUFFER_COUNT: { |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 326 | CHECK_INTERFACE(IGraphicBufferProducer, data, reply); |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 327 | int bufferCount = data.readInt32(); |
| 328 | int result = setBufferCount(bufferCount); |
| 329 | reply->writeInt32(result); |
| 330 | return NO_ERROR; |
Dan Stoza | 3be1c6b | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 331 | } |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 332 | case DEQUEUE_BUFFER: { |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 333 | CHECK_INTERFACE(IGraphicBufferProducer, data, reply); |
Dan Stoza | 3be1c6b | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 334 | bool async = static_cast<bool>(data.readInt32()); |
| 335 | uint32_t width = data.readUint32(); |
| 336 | uint32_t height = data.readUint32(); |
| 337 | PixelFormat format = static_cast<PixelFormat>(data.readInt32()); |
| 338 | uint32_t usage = data.readUint32(); |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 339 | int buf; |
Jesse Hall | f785754 | 2012-06-14 15:26:33 -0700 | [diff] [blame] | 340 | sp<Fence> fence; |
Dan Stoza | 3be1c6b | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 341 | int result = dequeueBuffer(&buf, &fence, async, width, height, |
| 342 | format, usage); |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 343 | reply->writeInt32(buf); |
Jamie Gennis | 1df8c34 | 2012-12-20 14:05:45 -0800 | [diff] [blame] | 344 | reply->writeInt32(fence != NULL); |
| 345 | if (fence != NULL) { |
Mathias Agopian | ba93b3f | 2013-08-01 15:48:40 -0700 | [diff] [blame] | 346 | reply->write(*fence); |
Jesse Hall | f785754 | 2012-06-14 15:26:33 -0700 | [diff] [blame] | 347 | } |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 348 | reply->writeInt32(result); |
| 349 | return NO_ERROR; |
Dan Stoza | 3be1c6b | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 350 | } |
Dan Stoza | 9f3053d | 2014-03-06 15:14:33 -0800 | [diff] [blame] | 351 | case DETACH_BUFFER: { |
| 352 | CHECK_INTERFACE(IGraphicBufferProducer, data, reply); |
| 353 | int slot = data.readInt32(); |
| 354 | int result = detachBuffer(slot); |
| 355 | reply->writeInt32(result); |
| 356 | return NO_ERROR; |
Dan Stoza | 3be1c6b | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 357 | } |
Dan Stoza | d9822a3 | 2014-03-28 15:25:31 -0700 | [diff] [blame] | 358 | case DETACH_NEXT_BUFFER: { |
| 359 | CHECK_INTERFACE(IGraphicBufferProducer, data, reply); |
| 360 | sp<GraphicBuffer> buffer; |
| 361 | sp<Fence> fence; |
| 362 | int32_t result = detachNextBuffer(&buffer, &fence); |
| 363 | reply->writeInt32(result); |
| 364 | if (result == NO_ERROR) { |
| 365 | reply->writeInt32(buffer != NULL); |
| 366 | if (buffer != NULL) { |
| 367 | reply->write(*buffer); |
| 368 | } |
| 369 | reply->writeInt32(fence != NULL); |
| 370 | if (fence != NULL) { |
| 371 | reply->write(*fence); |
| 372 | } |
| 373 | } |
| 374 | return NO_ERROR; |
Dan Stoza | 3be1c6b | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 375 | } |
Dan Stoza | 9f3053d | 2014-03-06 15:14:33 -0800 | [diff] [blame] | 376 | case ATTACH_BUFFER: { |
| 377 | CHECK_INTERFACE(IGraphicBufferProducer, data, reply); |
| 378 | sp<GraphicBuffer> buffer = new GraphicBuffer(); |
| 379 | data.read(*buffer.get()); |
| 380 | int slot; |
| 381 | int result = attachBuffer(&slot, buffer); |
| 382 | reply->writeInt32(slot); |
| 383 | reply->writeInt32(result); |
| 384 | return NO_ERROR; |
Dan Stoza | 3be1c6b | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 385 | } |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 386 | case QUEUE_BUFFER: { |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 387 | CHECK_INTERFACE(IGraphicBufferProducer, data, reply); |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 388 | int buf = data.readInt32(); |
Jesse Hall | c777b0b | 2012-06-28 12:52:05 -0700 | [diff] [blame] | 389 | QueueBufferInput input(data); |
Mathias Agopian | f0bc2f1 | 2012-04-09 16:14:01 -0700 | [diff] [blame] | 390 | QueueBufferOutput* const output = |
| 391 | reinterpret_cast<QueueBufferOutput *>( |
| 392 | reply->writeInplace(sizeof(QueueBufferOutput))); |
Jesse Hall | c777b0b | 2012-06-28 12:52:05 -0700 | [diff] [blame] | 393 | status_t result = queueBuffer(buf, input, output); |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 394 | reply->writeInt32(result); |
| 395 | return NO_ERROR; |
Dan Stoza | 3be1c6b | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 396 | } |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 397 | case CANCEL_BUFFER: { |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 398 | CHECK_INTERFACE(IGraphicBufferProducer, data, reply); |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 399 | int buf = data.readInt32(); |
Jamie Gennis | 1df8c34 | 2012-12-20 14:05:45 -0800 | [diff] [blame] | 400 | sp<Fence> fence = new Fence(); |
| 401 | data.read(*fence.get()); |
Jesse Hall | c777b0b | 2012-06-28 12:52:05 -0700 | [diff] [blame] | 402 | cancelBuffer(buf, fence); |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 403 | return NO_ERROR; |
Dan Stoza | 3be1c6b | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 404 | } |
Mathias Agopian | eafabcd | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 405 | case QUERY: { |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 406 | CHECK_INTERFACE(IGraphicBufferProducer, data, reply); |
Mathias Agopian | eafabcd | 2011-04-20 14:20:59 -0700 | [diff] [blame] | 407 | int value; |
| 408 | int what = data.readInt32(); |
| 409 | int res = query(what, &value); |
| 410 | reply->writeInt32(value); |
| 411 | reply->writeInt32(res); |
| 412 | return NO_ERROR; |
Dan Stoza | 3be1c6b | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 413 | } |
Jamie Gennis | fe0a87b | 2011-07-13 19:12:20 -0700 | [diff] [blame] | 414 | case CONNECT: { |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 415 | CHECK_INTERFACE(IGraphicBufferProducer, data, reply); |
Dan Stoza | f0eaf25 | 2014-03-21 13:05:51 -0700 | [diff] [blame] | 416 | sp<IProducerListener> listener; |
| 417 | if (data.readInt32() == 1) { |
| 418 | listener = IProducerListener::asInterface(data.readStrongBinder()); |
| 419 | } |
Jamie Gennis | fe0a87b | 2011-07-13 19:12:20 -0700 | [diff] [blame] | 420 | int api = data.readInt32(); |
Mathias Agopian | 595264f | 2013-07-16 22:56:09 -0700 | [diff] [blame] | 421 | bool producerControlledByApp = data.readInt32(); |
Mathias Agopian | 24202f5 | 2012-04-23 14:28:58 -0700 | [diff] [blame] | 422 | QueueBufferOutput* const output = |
| 423 | reinterpret_cast<QueueBufferOutput *>( |
| 424 | reply->writeInplace(sizeof(QueueBufferOutput))); |
Dan Stoza | f0eaf25 | 2014-03-21 13:05:51 -0700 | [diff] [blame] | 425 | status_t res = connect(listener, api, producerControlledByApp, output); |
Jamie Gennis | fe0a87b | 2011-07-13 19:12:20 -0700 | [diff] [blame] | 426 | reply->writeInt32(res); |
| 427 | return NO_ERROR; |
Dan Stoza | 3be1c6b | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 428 | } |
Jamie Gennis | fe0a87b | 2011-07-13 19:12:20 -0700 | [diff] [blame] | 429 | case DISCONNECT: { |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 430 | CHECK_INTERFACE(IGraphicBufferProducer, data, reply); |
Jamie Gennis | fe0a87b | 2011-07-13 19:12:20 -0700 | [diff] [blame] | 431 | int api = data.readInt32(); |
Mathias Agopian | 2773004 | 2011-07-14 20:20:58 -0700 | [diff] [blame] | 432 | status_t res = disconnect(api); |
Jamie Gennis | fe0a87b | 2011-07-13 19:12:20 -0700 | [diff] [blame] | 433 | reply->writeInt32(res); |
| 434 | return NO_ERROR; |
Dan Stoza | 3be1c6b | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 435 | } |
Jesse Hall | 399184a | 2014-03-03 15:42:54 -0800 | [diff] [blame] | 436 | case SET_SIDEBAND_STREAM: { |
| 437 | CHECK_INTERFACE(IGraphicBufferProducer, data, reply); |
| 438 | sp<NativeHandle> stream; |
| 439 | if (data.readInt32()) { |
Wonsik Kim | 0ec54e1 | 2014-03-21 10:46:24 +0900 | [diff] [blame] | 440 | stream = NativeHandle::create(data.readNativeHandle(), true); |
Jesse Hall | 399184a | 2014-03-03 15:42:54 -0800 | [diff] [blame] | 441 | } |
| 442 | status_t result = setSidebandStream(stream); |
| 443 | reply->writeInt32(result); |
| 444 | return NO_ERROR; |
Dan Stoza | 3be1c6b | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 445 | } |
Dan Stoza | 9de7293 | 2015-04-16 17:28:43 -0700 | [diff] [blame] | 446 | case ALLOCATE_BUFFERS: { |
Dan Stoza | 29a3e90 | 2014-06-20 13:13:57 -0700 | [diff] [blame] | 447 | CHECK_INTERFACE(IGraphicBufferProducer, data, reply); |
| 448 | bool async = static_cast<bool>(data.readInt32()); |
Dan Stoza | 3be1c6b | 2014-11-18 10:24:03 -0800 | [diff] [blame] | 449 | uint32_t width = data.readUint32(); |
| 450 | uint32_t height = data.readUint32(); |
| 451 | PixelFormat format = static_cast<PixelFormat>(data.readInt32()); |
| 452 | uint32_t usage = data.readUint32(); |
Dan Stoza | 29a3e90 | 2014-06-20 13:13:57 -0700 | [diff] [blame] | 453 | allocateBuffers(async, width, height, format, usage); |
| 454 | return NO_ERROR; |
Dan Stoza | 9de7293 | 2015-04-16 17:28:43 -0700 | [diff] [blame] | 455 | } |
| 456 | case ALLOW_ALLOCATION: { |
| 457 | CHECK_INTERFACE(IGraphicBufferProducer, data, reply); |
| 458 | bool allow = static_cast<bool>(data.readInt32()); |
| 459 | status_t result = allowAllocation(allow); |
| 460 | reply->writeInt32(result); |
| 461 | return NO_ERROR; |
| 462 | } |
Dan Stoza | 812ed06 | 2015-06-02 15:45:22 -0700 | [diff] [blame] | 463 | case SET_GENERATION_NUMBER: { |
| 464 | CHECK_INTERFACE(IGraphicBufferProducer, data, reply); |
| 465 | uint32_t generationNumber = data.readUint32(); |
| 466 | status_t result = setGenerationNumber(generationNumber); |
| 467 | reply->writeInt32(result); |
| 468 | return NO_ERROR; |
| 469 | } |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 470 | } |
| 471 | return BBinder::onTransact(code, data, reply, flags); |
| 472 | } |
| 473 | |
| 474 | // ---------------------------------------------------------------------------- |
| 475 | |
Andy McFadden | 2adaf04 | 2012-12-18 09:49:45 -0800 | [diff] [blame] | 476 | IGraphicBufferProducer::QueueBufferInput::QueueBufferInput(const Parcel& parcel) { |
Jesse Hall | c777b0b | 2012-06-28 12:52:05 -0700 | [diff] [blame] | 477 | parcel.read(*this); |
| 478 | } |
| 479 | |
Mathias Agopian | e142428 | 2013-07-29 21:24:40 -0700 | [diff] [blame] | 480 | size_t IGraphicBufferProducer::QueueBufferInput::getFlattenedSize() const { |
Jesse Hall | c777b0b | 2012-06-28 12:52:05 -0700 | [diff] [blame] | 481 | return sizeof(timestamp) |
Andy McFadden | 3c25621 | 2013-08-16 14:55:39 -0700 | [diff] [blame] | 482 | + sizeof(isAutoTimestamp) |
Eino-Ville Talvala | 82c6bcc | 2015-02-19 16:10:43 -0800 | [diff] [blame] | 483 | + sizeof(dataSpace) |
Jesse Hall | c777b0b | 2012-06-28 12:52:05 -0700 | [diff] [blame] | 484 | + sizeof(crop) |
| 485 | + sizeof(scalingMode) |
| 486 | + sizeof(transform) |
Ruben Brunk | 1681d95 | 2014-06-27 15:51:55 -0700 | [diff] [blame] | 487 | + sizeof(stickyTransform) |
Mathias Agopian | 7cdd786 | 2013-07-18 22:10:56 -0700 | [diff] [blame] | 488 | + sizeof(async) |
Dan Stoza | 5065a55 | 2015-03-17 16:23:42 -0700 | [diff] [blame] | 489 | + fence->getFlattenedSize() |
| 490 | + surfaceDamage.getFlattenedSize(); |
Jesse Hall | c777b0b | 2012-06-28 12:52:05 -0700 | [diff] [blame] | 491 | } |
| 492 | |
Mathias Agopian | e142428 | 2013-07-29 21:24:40 -0700 | [diff] [blame] | 493 | size_t IGraphicBufferProducer::QueueBufferInput::getFdCount() const { |
Jamie Gennis | 1df8c34 | 2012-12-20 14:05:45 -0800 | [diff] [blame] | 494 | return fence->getFdCount(); |
Jesse Hall | c777b0b | 2012-06-28 12:52:05 -0700 | [diff] [blame] | 495 | } |
| 496 | |
Mathias Agopian | e142428 | 2013-07-29 21:24:40 -0700 | [diff] [blame] | 497 | status_t IGraphicBufferProducer::QueueBufferInput::flatten( |
| 498 | void*& buffer, size_t& size, int*& fds, size_t& count) const |
Jesse Hall | c777b0b | 2012-06-28 12:52:05 -0700 | [diff] [blame] | 499 | { |
Mathias Agopian | e142428 | 2013-07-29 21:24:40 -0700 | [diff] [blame] | 500 | if (size < getFlattenedSize()) { |
| 501 | return NO_MEMORY; |
| 502 | } |
| 503 | FlattenableUtils::write(buffer, size, timestamp); |
Andy McFadden | 3c25621 | 2013-08-16 14:55:39 -0700 | [diff] [blame] | 504 | FlattenableUtils::write(buffer, size, isAutoTimestamp); |
Eino-Ville Talvala | 82c6bcc | 2015-02-19 16:10:43 -0800 | [diff] [blame] | 505 | FlattenableUtils::write(buffer, size, dataSpace); |
Mathias Agopian | e142428 | 2013-07-29 21:24:40 -0700 | [diff] [blame] | 506 | FlattenableUtils::write(buffer, size, crop); |
| 507 | FlattenableUtils::write(buffer, size, scalingMode); |
| 508 | FlattenableUtils::write(buffer, size, transform); |
Ruben Brunk | 1681d95 | 2014-06-27 15:51:55 -0700 | [diff] [blame] | 509 | FlattenableUtils::write(buffer, size, stickyTransform); |
Mathias Agopian | e142428 | 2013-07-29 21:24:40 -0700 | [diff] [blame] | 510 | FlattenableUtils::write(buffer, size, async); |
Dan Stoza | 5065a55 | 2015-03-17 16:23:42 -0700 | [diff] [blame] | 511 | status_t result = fence->flatten(buffer, size, fds, count); |
| 512 | if (result != NO_ERROR) { |
| 513 | return result; |
| 514 | } |
| 515 | return surfaceDamage.flatten(buffer, size); |
Jesse Hall | c777b0b | 2012-06-28 12:52:05 -0700 | [diff] [blame] | 516 | } |
| 517 | |
Mathias Agopian | e142428 | 2013-07-29 21:24:40 -0700 | [diff] [blame] | 518 | status_t IGraphicBufferProducer::QueueBufferInput::unflatten( |
| 519 | void const*& buffer, size_t& size, int const*& fds, size_t& count) |
Jesse Hall | c777b0b | 2012-06-28 12:52:05 -0700 | [diff] [blame] | 520 | { |
Mathias Agopian | e142428 | 2013-07-29 21:24:40 -0700 | [diff] [blame] | 521 | size_t minNeeded = |
| 522 | sizeof(timestamp) |
Andy McFadden | 3c25621 | 2013-08-16 14:55:39 -0700 | [diff] [blame] | 523 | + sizeof(isAutoTimestamp) |
Eino-Ville Talvala | 82c6bcc | 2015-02-19 16:10:43 -0800 | [diff] [blame] | 524 | + sizeof(dataSpace) |
Mathias Agopian | e142428 | 2013-07-29 21:24:40 -0700 | [diff] [blame] | 525 | + sizeof(crop) |
| 526 | + sizeof(scalingMode) |
| 527 | + sizeof(transform) |
Ruben Brunk | 1681d95 | 2014-06-27 15:51:55 -0700 | [diff] [blame] | 528 | + sizeof(stickyTransform) |
Mathias Agopian | e142428 | 2013-07-29 21:24:40 -0700 | [diff] [blame] | 529 | + sizeof(async); |
| 530 | |
| 531 | if (size < minNeeded) { |
| 532 | return NO_MEMORY; |
| 533 | } |
| 534 | |
| 535 | FlattenableUtils::read(buffer, size, timestamp); |
Andy McFadden | 3c25621 | 2013-08-16 14:55:39 -0700 | [diff] [blame] | 536 | FlattenableUtils::read(buffer, size, isAutoTimestamp); |
Eino-Ville Talvala | 82c6bcc | 2015-02-19 16:10:43 -0800 | [diff] [blame] | 537 | FlattenableUtils::read(buffer, size, dataSpace); |
Mathias Agopian | e142428 | 2013-07-29 21:24:40 -0700 | [diff] [blame] | 538 | FlattenableUtils::read(buffer, size, crop); |
| 539 | FlattenableUtils::read(buffer, size, scalingMode); |
| 540 | FlattenableUtils::read(buffer, size, transform); |
Ruben Brunk | 1681d95 | 2014-06-27 15:51:55 -0700 | [diff] [blame] | 541 | FlattenableUtils::read(buffer, size, stickyTransform); |
Mathias Agopian | e142428 | 2013-07-29 21:24:40 -0700 | [diff] [blame] | 542 | FlattenableUtils::read(buffer, size, async); |
| 543 | |
Jamie Gennis | 1df8c34 | 2012-12-20 14:05:45 -0800 | [diff] [blame] | 544 | fence = new Fence(); |
Dan Stoza | 5065a55 | 2015-03-17 16:23:42 -0700 | [diff] [blame] | 545 | status_t result = fence->unflatten(buffer, size, fds, count); |
| 546 | if (result != NO_ERROR) { |
| 547 | return result; |
| 548 | } |
| 549 | return surfaceDamage.unflatten(buffer, size); |
Jesse Hall | c777b0b | 2012-06-28 12:52:05 -0700 | [diff] [blame] | 550 | } |
| 551 | |
Jamie Gennis | 8ba32fa | 2010-12-20 11:27:26 -0800 | [diff] [blame] | 552 | }; // namespace android |