blob: ccf98e500c9a55d470d47175453a49ee18faf94f [file] [log] [blame]
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -08001/*
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
17#define LOG_TAG "Surface"
18
19#include <stdint.h>
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080020#include <errno.h>
21#include <sys/types.h>
22#include <sys/stat.h>
23
Mathias Agopiancbb288b2009-09-07 16:32:45 -070024#include <utils/CallStack.h>
Mathias Agopiana67932f2011-04-20 14:20:59 -070025#include <utils/Errors.h>
Mathias Agopian9cce3252010-02-09 17:46:37 -080026#include <utils/Log.h>
Mathias Agopiana67932f2011-04-20 14:20:59 -070027#include <utils/threads.h>
Mathias Agopian9cce3252010-02-09 17:46:37 -080028
Mathias Agopiana67932f2011-04-20 14:20:59 -070029#include <binder/IPCThreadState.h>
30
31#include <gui/SurfaceTextureClient.h>
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080032
Mathias Agopian076b1cc2009-04-10 14:24:30 -070033#include <ui/DisplayInfo.h>
Mathias Agopian3330b202009-10-05 17:07:12 -070034#include <ui/GraphicBuffer.h>
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080035#include <ui/Rect.h>
36
Mathias Agopian9cce3252010-02-09 17:46:37 -080037#include <surfaceflinger/ISurface.h>
38#include <surfaceflinger/ISurfaceComposer.h>
Mathias Agopiana67932f2011-04-20 14:20:59 -070039#include <surfaceflinger/Surface.h>
Mathias Agopian9cce3252010-02-09 17:46:37 -080040#include <surfaceflinger/SurfaceComposerClient.h>
Mathias Agopian076b1cc2009-04-10 14:24:30 -070041
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080042namespace android {
43
Mathias Agopian62185b72009-04-16 16:19:50 -070044// ============================================================================
45// SurfaceControl
46// ============================================================================
47
Mathias Agopian01b76682009-04-16 20:04:08 -070048SurfaceControl::SurfaceControl(
49 const sp<SurfaceComposerClient>& client,
Mathias Agopian62185b72009-04-16 16:19:50 -070050 const sp<ISurface>& surface,
Mathias Agopianc10d9d92011-07-20 16:46:11 -070051 const ISurfaceComposerClient::surface_data_t& data)
Mathias Agopian62185b72009-04-16 16:19:50 -070052 : mClient(client), mSurface(surface),
Mathias Agopianc10d9d92011-07-20 16:46:11 -070053 mToken(data.token), mIdentity(data.identity)
Mathias Agopian62185b72009-04-16 16:19:50 -070054{
55}
Mathias Agopian18d84462009-04-16 20:30:22 -070056
Mathias Agopian62185b72009-04-16 16:19:50 -070057SurfaceControl::~SurfaceControl()
58{
59 destroy();
60}
61
62void SurfaceControl::destroy()
63{
Mathias Agopian18d84462009-04-16 20:30:22 -070064 if (isValid()) {
Mathias Agopian62185b72009-04-16 16:19:50 -070065 mClient->destroySurface(mToken);
66 }
67
68 // clear all references and trigger an IPC now, to make sure things
69 // happen without delay, since these resources are quite heavy.
70 mClient.clear();
71 mSurface.clear();
72 IPCThreadState::self()->flushCommands();
73}
74
75void SurfaceControl::clear()
76{
77 // here, the window manager tells us explicitly that we should destroy
78 // the surface's resource. Soon after this call, it will also release
79 // its last reference (which will call the dtor); however, it is possible
80 // that a client living in the same process still holds references which
81 // would delay the call to the dtor -- that is why we need this explicit
82 // "clear()" call.
83 destroy();
84}
85
Mathias Agopian62185b72009-04-16 16:19:50 -070086bool SurfaceControl::isSameSurface(
87 const sp<SurfaceControl>& lhs, const sp<SurfaceControl>& rhs)
88{
89 if (lhs == 0 || rhs == 0)
90 return false;
91 return lhs->mSurface->asBinder() == rhs->mSurface->asBinder();
92}
93
Mathias Agopian01b76682009-04-16 20:04:08 -070094status_t SurfaceControl::setLayer(int32_t layer) {
Mathias Agopian963abad2009-11-13 15:26:29 -080095 status_t err = validate();
Mathias Agopian01b76682009-04-16 20:04:08 -070096 if (err < 0) return err;
Mathias Agopian631f3582010-05-25 17:51:34 -070097 const sp<SurfaceComposerClient>& client(mClient);
Mathias Agopian01b76682009-04-16 20:04:08 -070098 return client->setLayer(mToken, layer);
99}
100status_t SurfaceControl::setPosition(int32_t x, int32_t y) {
Mathias Agopian963abad2009-11-13 15:26:29 -0800101 status_t err = validate();
Mathias Agopian01b76682009-04-16 20:04:08 -0700102 if (err < 0) return err;
Mathias Agopian631f3582010-05-25 17:51:34 -0700103 const sp<SurfaceComposerClient>& client(mClient);
Mathias Agopian01b76682009-04-16 20:04:08 -0700104 return client->setPosition(mToken, x, y);
105}
106status_t SurfaceControl::setSize(uint32_t w, uint32_t h) {
Mathias Agopian963abad2009-11-13 15:26:29 -0800107 status_t err = validate();
Mathias Agopian01b76682009-04-16 20:04:08 -0700108 if (err < 0) return err;
Mathias Agopian631f3582010-05-25 17:51:34 -0700109 const sp<SurfaceComposerClient>& client(mClient);
Mathias Agopian01b76682009-04-16 20:04:08 -0700110 return client->setSize(mToken, w, h);
111}
112status_t SurfaceControl::hide() {
Mathias Agopian963abad2009-11-13 15:26:29 -0800113 status_t err = validate();
Mathias Agopian01b76682009-04-16 20:04:08 -0700114 if (err < 0) return err;
Mathias Agopian631f3582010-05-25 17:51:34 -0700115 const sp<SurfaceComposerClient>& client(mClient);
Mathias Agopian01b76682009-04-16 20:04:08 -0700116 return client->hide(mToken);
117}
118status_t SurfaceControl::show(int32_t layer) {
Mathias Agopian963abad2009-11-13 15:26:29 -0800119 status_t err = validate();
Mathias Agopian01b76682009-04-16 20:04:08 -0700120 if (err < 0) return err;
Mathias Agopian631f3582010-05-25 17:51:34 -0700121 const sp<SurfaceComposerClient>& client(mClient);
Mathias Agopian01b76682009-04-16 20:04:08 -0700122 return client->show(mToken, layer);
123}
124status_t SurfaceControl::freeze() {
Mathias Agopian963abad2009-11-13 15:26:29 -0800125 status_t err = validate();
Mathias Agopian01b76682009-04-16 20:04:08 -0700126 if (err < 0) return err;
Mathias Agopian631f3582010-05-25 17:51:34 -0700127 const sp<SurfaceComposerClient>& client(mClient);
Mathias Agopian01b76682009-04-16 20:04:08 -0700128 return client->freeze(mToken);
129}
130status_t SurfaceControl::unfreeze() {
Mathias Agopian963abad2009-11-13 15:26:29 -0800131 status_t err = validate();
Mathias Agopian01b76682009-04-16 20:04:08 -0700132 if (err < 0) return err;
Mathias Agopian631f3582010-05-25 17:51:34 -0700133 const sp<SurfaceComposerClient>& client(mClient);
Mathias Agopian01b76682009-04-16 20:04:08 -0700134 return client->unfreeze(mToken);
135}
136status_t SurfaceControl::setFlags(uint32_t flags, uint32_t mask) {
Mathias Agopian963abad2009-11-13 15:26:29 -0800137 status_t err = validate();
Mathias Agopian01b76682009-04-16 20:04:08 -0700138 if (err < 0) return err;
Mathias Agopian631f3582010-05-25 17:51:34 -0700139 const sp<SurfaceComposerClient>& client(mClient);
Mathias Agopian01b76682009-04-16 20:04:08 -0700140 return client->setFlags(mToken, flags, mask);
141}
142status_t SurfaceControl::setTransparentRegionHint(const Region& transparent) {
Mathias Agopian963abad2009-11-13 15:26:29 -0800143 status_t err = validate();
Mathias Agopian01b76682009-04-16 20:04:08 -0700144 if (err < 0) return err;
Mathias Agopian631f3582010-05-25 17:51:34 -0700145 const sp<SurfaceComposerClient>& client(mClient);
Mathias Agopian01b76682009-04-16 20:04:08 -0700146 return client->setTransparentRegionHint(mToken, transparent);
147}
148status_t SurfaceControl::setAlpha(float alpha) {
Mathias Agopian963abad2009-11-13 15:26:29 -0800149 status_t err = validate();
Mathias Agopian01b76682009-04-16 20:04:08 -0700150 if (err < 0) return err;
Mathias Agopian631f3582010-05-25 17:51:34 -0700151 const sp<SurfaceComposerClient>& client(mClient);
Mathias Agopian01b76682009-04-16 20:04:08 -0700152 return client->setAlpha(mToken, alpha);
153}
154status_t SurfaceControl::setMatrix(float dsdx, float dtdx, float dsdy, float dtdy) {
Mathias Agopian963abad2009-11-13 15:26:29 -0800155 status_t err = validate();
Mathias Agopian01b76682009-04-16 20:04:08 -0700156 if (err < 0) return err;
Mathias Agopian631f3582010-05-25 17:51:34 -0700157 const sp<SurfaceComposerClient>& client(mClient);
Mathias Agopian01b76682009-04-16 20:04:08 -0700158 return client->setMatrix(mToken, dsdx, dtdx, dsdy, dtdy);
159}
160status_t SurfaceControl::setFreezeTint(uint32_t tint) {
Mathias Agopian963abad2009-11-13 15:26:29 -0800161 status_t err = validate();
Mathias Agopian01b76682009-04-16 20:04:08 -0700162 if (err < 0) return err;
Mathias Agopian631f3582010-05-25 17:51:34 -0700163 const sp<SurfaceComposerClient>& client(mClient);
Mathias Agopian01b76682009-04-16 20:04:08 -0700164 return client->setFreezeTint(mToken, tint);
165}
Mathias Agopian62185b72009-04-16 16:19:50 -0700166
Mathias Agopian963abad2009-11-13 15:26:29 -0800167status_t SurfaceControl::validate() const
Mathias Agopian62185b72009-04-16 16:19:50 -0700168{
169 if (mToken<0 || mClient==0) {
170 LOGE("invalid token (%d, identity=%u) or client (%p)",
171 mToken, mIdentity, mClient.get());
172 return NO_INIT;
173 }
Mathias Agopian62185b72009-04-16 16:19:50 -0700174 return NO_ERROR;
175}
176
Mathias Agopian01b76682009-04-16 20:04:08 -0700177status_t SurfaceControl::writeSurfaceToParcel(
178 const sp<SurfaceControl>& control, Parcel* parcel)
179{
Mathias Agopian579b3f82010-06-08 19:54:15 -0700180 sp<ISurface> sur;
Mathias Agopian01b76682009-04-16 20:04:08 -0700181 uint32_t identity = 0;
Mathias Agopian01b76682009-04-16 20:04:08 -0700182 if (SurfaceControl::isValid(control)) {
Mathias Agopian01b76682009-04-16 20:04:08 -0700183 sur = control->mSurface;
Mathias Agopian579b3f82010-06-08 19:54:15 -0700184 identity = control->mIdentity;
Mathias Agopian01b76682009-04-16 20:04:08 -0700185 }
Mathias Agopianb7e930d2010-06-01 15:12:58 -0700186 parcel->writeStrongBinder(sur!=0 ? sur->asBinder() : NULL);
Ted Bonkenburgbd050ab2011-07-15 15:10:10 -0700187 parcel->writeStrongBinder(NULL); // NULL ISurfaceTexture in this case.
Mathias Agopian01b76682009-04-16 20:04:08 -0700188 parcel->writeInt32(identity);
Mathias Agopian01b76682009-04-16 20:04:08 -0700189 return NO_ERROR;
190}
191
192sp<Surface> SurfaceControl::getSurface() const
193{
194 Mutex::Autolock _l(mLock);
195 if (mSurfaceData == 0) {
Ted Bonkenburgbd050ab2011-07-15 15:10:10 -0700196 sp<SurfaceControl> surface_control(const_cast<SurfaceControl*>(this));
197 mSurfaceData = new Surface(surface_control);
Mathias Agopian01b76682009-04-16 20:04:08 -0700198 }
199 return mSurfaceData;
200}
201
Mathias Agopian076b1cc2009-04-10 14:24:30 -0700202// ============================================================================
203// Surface
204// ============================================================================
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800205
Mathias Agopianb7e930d2010-06-01 15:12:58 -0700206// ---------------------------------------------------------------------------
207
Mathias Agopian01b76682009-04-16 20:04:08 -0700208Surface::Surface(const sp<SurfaceControl>& surface)
Mathias Agopian8f9dbf92011-07-13 17:39:11 -0700209 : SurfaceTextureClient(),
Mathias Agopianb7e930d2010-06-01 15:12:58 -0700210 mSurface(surface->mSurface),
Mathias Agopianc10d9d92011-07-20 16:46:11 -0700211 mIdentity(surface->mIdentity)
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800212{
Ted Bonkenburgbd050ab2011-07-15 15:10:10 -0700213 sp<ISurfaceTexture> st;
214 if (mSurface != NULL) {
215 st = mSurface->getSurfaceTexture();
216 }
217 init(st);
Mathias Agopian01b76682009-04-16 20:04:08 -0700218}
Mathias Agopian62185b72009-04-16 16:19:50 -0700219
Mathias Agopiana0c30e92010-06-04 18:26:32 -0700220Surface::Surface(const Parcel& parcel, const sp<IBinder>& ref)
Mathias Agopianc10d9d92011-07-20 16:46:11 -0700221 : SurfaceTextureClient()
Mathias Agopian01b76682009-04-16 20:04:08 -0700222{
Ted Bonkenburgbd050ab2011-07-15 15:10:10 -0700223 mSurface = interface_cast<ISurface>(ref);
224 sp<IBinder> st_binder(parcel.readStrongBinder());
225 sp<ISurfaceTexture> st;
226 if (st_binder != NULL) {
227 st = interface_cast<ISurfaceTexture>(st_binder);
228 } else if (mSurface != NULL) {
229 st = mSurface->getSurfaceTexture();
230 }
231
Mathias Agopian01b76682009-04-16 20:04:08 -0700232 mIdentity = parcel.readInt32();
Ted Bonkenburgbd050ab2011-07-15 15:10:10 -0700233 init(st);
234}
235
236Surface::Surface(const sp<ISurfaceTexture>& st)
237 : SurfaceTextureClient(),
238 mSurface(NULL),
239 mIdentity(0)
240{
241 init(st);
Mathias Agopian01b76682009-04-16 20:04:08 -0700242}
243
Mathias Agopian579b3f82010-06-08 19:54:15 -0700244status_t Surface::writeToParcel(
245 const sp<Surface>& surface, Parcel* parcel)
246{
247 sp<ISurface> sur;
Ted Bonkenburgbd050ab2011-07-15 15:10:10 -0700248 sp<ISurfaceTexture> st;
Mathias Agopian579b3f82010-06-08 19:54:15 -0700249 uint32_t identity = 0;
Mathias Agopian579b3f82010-06-08 19:54:15 -0700250 if (Surface::isValid(surface)) {
251 sur = surface->mSurface;
Ted Bonkenburgbd050ab2011-07-15 15:10:10 -0700252 st = surface->getISurfaceTexture();
Mathias Agopian579b3f82010-06-08 19:54:15 -0700253 identity = surface->mIdentity;
Ted Bonkenburgbd050ab2011-07-15 15:10:10 -0700254 } else if (surface != 0 &&
255 (surface->mSurface != NULL ||
256 surface->getISurfaceTexture() != NULL)) {
257 LOGE("Parceling invalid surface with non-NULL ISurface/ISurfaceTexture as NULL: "
258 "mSurface = %p, surfaceTexture = %p, mIdentity = %d, ",
259 surface->mSurface.get(), surface->getISurfaceTexture().get(),
260 surface->mIdentity);
Mathias Agopian579b3f82010-06-08 19:54:15 -0700261 }
Ted Bonkenburgbd050ab2011-07-15 15:10:10 -0700262
263 parcel->writeStrongBinder(sur != NULL ? sur->asBinder() : NULL);
264 parcel->writeStrongBinder(st != NULL ? st->asBinder() : NULL);
Mathias Agopian579b3f82010-06-08 19:54:15 -0700265 parcel->writeInt32(identity);
Mathias Agopian579b3f82010-06-08 19:54:15 -0700266 return NO_ERROR;
267
268}
269
Jamie Gennisaca4e222010-07-15 17:29:15 -0700270Mutex Surface::sCachedSurfacesLock;
Mathias Agopian455d18d2010-12-13 16:47:31 -0800271DefaultKeyedVector<wp<IBinder>, wp<Surface> > Surface::sCachedSurfaces;
Jamie Gennisaca4e222010-07-15 17:29:15 -0700272
273sp<Surface> Surface::readFromParcel(const Parcel& data) {
274 Mutex::Autolock _l(sCachedSurfacesLock);
Mathias Agopiana0c30e92010-06-04 18:26:32 -0700275 sp<IBinder> binder(data.readStrongBinder());
Jamie Gennisaca4e222010-07-15 17:29:15 -0700276 sp<Surface> surface = sCachedSurfaces.valueFor(binder).promote();
277 if (surface == 0) {
278 surface = new Surface(data, binder);
279 sCachedSurfaces.add(binder, surface);
Mathias Agopiana0c30e92010-06-04 18:26:32 -0700280 }
Ted Bonkenburgbd050ab2011-07-15 15:10:10 -0700281 if (surface->mSurface == NULL && surface->getISurfaceTexture() == NULL) {
282 surface = 0;
Jamie Gennisaca4e222010-07-15 17:29:15 -0700283 }
Mathias Agopian455d18d2010-12-13 16:47:31 -0800284 cleanCachedSurfacesLocked();
Jamie Gennisaca4e222010-07-15 17:29:15 -0700285 return surface;
286}
287
288// Remove the stale entries from the surface cache. This should only be called
289// with sCachedSurfacesLock held.
Mathias Agopian455d18d2010-12-13 16:47:31 -0800290void Surface::cleanCachedSurfacesLocked() {
Jamie Gennisaca4e222010-07-15 17:29:15 -0700291 for (int i = sCachedSurfaces.size()-1; i >= 0; --i) {
292 wp<Surface> s(sCachedSurfaces.valueAt(i));
293 if (s == 0 || s.promote() == 0) {
294 sCachedSurfaces.removeItemsAt(i);
295 }
296 }
Mathias Agopiana0c30e92010-06-04 18:26:32 -0700297}
298
Ted Bonkenburgbd050ab2011-07-15 15:10:10 -0700299void Surface::init(const sp<ISurfaceTexture>& surfaceTexture)
Mathias Agopian01b76682009-04-16 20:04:08 -0700300{
Ted Bonkenburgbd050ab2011-07-15 15:10:10 -0700301 if (mSurface != NULL || surfaceTexture != NULL) {
Mathias Agopiana67932f2011-04-20 14:20:59 -0700302 LOGE_IF(surfaceTexture==0, "got a NULL ISurfaceTexture from ISurface");
303 if (surfaceTexture != NULL) {
Mathias Agopian8f9dbf92011-07-13 17:39:11 -0700304 setISurfaceTexture(surfaceTexture);
305 setUsage(GraphicBuffer::USAGE_HW_RENDER);
Mathias Agopiana67932f2011-04-20 14:20:59 -0700306 }
Mathias Agopian631f3582010-05-25 17:51:34 -0700307
Mathias Agopiana67932f2011-04-20 14:20:59 -0700308 DisplayInfo dinfo;
309 SurfaceComposerClient::getDisplayInfo(0, &dinfo);
310 const_cast<float&>(ANativeWindow::xdpi) = dinfo.xdpi;
311 const_cast<float&>(ANativeWindow::ydpi) = dinfo.ydpi;
Mathias Agopiana67932f2011-04-20 14:20:59 -0700312 const_cast<uint32_t&>(ANativeWindow::flags) = 0;
Mathias Agopian631f3582010-05-25 17:51:34 -0700313 }
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800314}
315
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800316Surface::~Surface()
317{
Mathias Agopian40b7f6e2009-04-14 18:21:47 -0700318 // clear all references and trigger an IPC now, to make sure things
319 // happen without delay, since these resources are quite heavy.
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800320 mSurface.clear();
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800321 IPCThreadState::self()->flushCommands();
322}
323
Mathias Agopian631f3582010-05-25 17:51:34 -0700324bool Surface::isValid() {
Mathias Agopianc10d9d92011-07-20 16:46:11 -0700325 return getISurfaceTexture() != NULL;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800326}
327
tedbo1e7fa9e2011-06-22 15:52:53 -0700328sp<ISurfaceTexture> Surface::getSurfaceTexture() {
Mathias Agopianc10d9d92011-07-20 16:46:11 -0700329 return getISurfaceTexture();
tedbo1e7fa9e2011-06-22 15:52:53 -0700330}
331
Mathias Agopian47d87302011-04-05 15:44:20 -0700332sp<IBinder> Surface::asBinder() const {
333 return mSurface!=0 ? mSurface->asBinder() : 0;
Mathias Agopian631f3582010-05-25 17:51:34 -0700334}
335
Mathias Agopian076b1cc2009-04-10 14:24:30 -0700336// ----------------------------------------------------------------------------
337
Mathias Agopiana67932f2011-04-20 14:20:59 -0700338int Surface::query(int what, int* value) const {
Mathias Agopiancb6b9042009-07-30 18:14:56 -0700339 switch (what) {
Mathias Agopiana67932f2011-04-20 14:20:59 -0700340 case NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER:
Mathias Agopiana67932f2011-04-20 14:20:59 -0700341 *value = 1;
Mathias Agopiancbb288b2009-09-07 16:32:45 -0700342 return NO_ERROR;
Jamie Gennis391bbe22011-03-14 15:00:06 -0700343 case NATIVE_WINDOW_CONCRETE_TYPE:
344 *value = NATIVE_WINDOW_SURFACE;
345 return NO_ERROR;
346 }
Mathias Agopian8f9dbf92011-07-13 17:39:11 -0700347 return SurfaceTextureClient::query(what, value);
Eino-Ville Talvala1d01a122011-02-18 11:02:42 -0800348}
349
Mathias Agopiana138f892010-05-21 17:24:35 -0700350// ----------------------------------------------------------------------------
351
Mathias Agopian8f9dbf92011-07-13 17:39:11 -0700352status_t Surface::lock(SurfaceInfo* other, Region* dirtyIn) {
353 ANativeWindow_Buffer outBuffer;
Mathias Agopian55fa2512010-03-11 15:06:54 -0800354
Mathias Agopian8f9dbf92011-07-13 17:39:11 -0700355 ARect temp;
356 ARect* inOutDirtyBounds = NULL;
357 if (dirtyIn) {
358 temp = dirtyIn->getBounds();
359 inOutDirtyBounds = &temp;
Mathias Agopian55fa2512010-03-11 15:06:54 -0800360 }
361
Mathias Agopian8f9dbf92011-07-13 17:39:11 -0700362 status_t err = SurfaceTextureClient::lock(&outBuffer, inOutDirtyBounds);
Mathias Agopian90147262010-01-22 11:47:55 -0800363
Mathias Agopian076b1cc2009-04-10 14:24:30 -0700364 if (err == NO_ERROR) {
Mathias Agopian8f9dbf92011-07-13 17:39:11 -0700365 other->w = uint32_t(outBuffer.width);
366 other->h = uint32_t(outBuffer.height);
367 other->s = uint32_t(outBuffer.stride);
368 other->usage = GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN;
369 other->format = uint32_t(outBuffer.format);
370 other->bits = outBuffer.bits;
Mathias Agopian076b1cc2009-04-10 14:24:30 -0700371 }
372 return err;
373}
Mathias Agopian076b1cc2009-04-10 14:24:30 -0700374
Mathias Agopian8f9dbf92011-07-13 17:39:11 -0700375status_t Surface::unlockAndPost() {
376 return SurfaceTextureClient::unlockAndPost();
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800377}
378
Mathias Agopiana138f892010-05-21 17:24:35 -0700379// ----------------------------------------------------------------------------
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800380}; // namespace android