Loading include/surfaceflinger/IGraphicBufferAlloc.h +1 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ public: /* Create a new GraphicBuffer for the client to use. */ virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage) = 0; PixelFormat format, uint32_t usage, status_t* error) = 0; }; // ---------------------------------------------------------------------------- Loading libs/gui/IGraphicBufferAlloc.cpp +8 −5 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ public: } virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage) { PixelFormat format, uint32_t usage, status_t* error) { Parcel data, reply; data.writeInterfaceToken(IGraphicBufferAlloc::getInterfaceDescriptor()); data.writeInt32(w); Loading @@ -52,14 +52,15 @@ public: data.writeInt32(usage); remote()->transact(CREATE_GRAPHIC_BUFFER, data, &reply); sp<GraphicBuffer> graphicBuffer; bool nonNull = (bool)reply.readInt32(); if (nonNull) { status_t result = reply.readInt32(); if (result == NO_ERROR) { graphicBuffer = new GraphicBuffer(); reply.read(*graphicBuffer); // reply.readStrongBinder(); // here we don't even have to read the BufferReference from // the parcel, it'll die with the parcel. } *error = result; return graphicBuffer; } }; Loading Loading @@ -91,8 +92,10 @@ status_t BnGraphicBufferAlloc::onTransact( uint32_t h = data.readInt32(); PixelFormat format = data.readInt32(); uint32_t usage = data.readInt32(); sp<GraphicBuffer> result(createGraphicBuffer(w, h, format, usage)); reply->writeInt32(result != 0); status_t error; sp<GraphicBuffer> result = createGraphicBuffer(w, h, format, usage, &error); reply->writeInt32(error); if (result != 0) { reply->write(*result); // We add a BufferReference to this parcel to make sure the Loading libs/gui/SurfaceTexture.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -352,11 +352,13 @@ status_t SurfaceTexture::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h, ((uint32_t(buffer->usage) & usage) != usage)) { usage |= GraphicBuffer::USAGE_HW_TEXTURE; status_t error; sp<GraphicBuffer> graphicBuffer( mGraphicBufferAlloc->createGraphicBuffer(w, h, format, usage)); mGraphicBufferAlloc->createGraphicBuffer( w, h, format, usage, &error)); if (graphicBuffer == 0) { LOGE("dequeueBuffer: SurfaceComposer::createGraphicBuffer failed"); return NO_MEMORY; return error; } if (updateFormat) { mPixelFormat = format; Loading services/surfaceflinger/SurfaceFlinger.cpp +5 −2 Original line number Diff line number Diff line Loading @@ -2470,11 +2470,14 @@ GraphicBufferAlloc::GraphicBufferAlloc() {} GraphicBufferAlloc::~GraphicBufferAlloc() {} sp<GraphicBuffer> GraphicBufferAlloc::createGraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage) { PixelFormat format, uint32_t usage, status_t* error) { sp<GraphicBuffer> graphicBuffer(new GraphicBuffer(w, h, format, usage)); status_t err = graphicBuffer->initCheck(); *error = err; if (err != 0 || graphicBuffer->handle == 0) { if (err == NO_MEMORY) { GraphicBuffer::dumpAllocationsToSystemLog(); } LOGE("GraphicBufferAlloc::createGraphicBuffer(w=%d, h=%d) " "failed (%s), handle=%p", w, h, strerror(-err), graphicBuffer->handle); Loading services/surfaceflinger/SurfaceFlinger.h +1 −1 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ public: GraphicBufferAlloc(); virtual ~GraphicBufferAlloc(); virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage); PixelFormat format, uint32_t usage, status_t* error); }; // --------------------------------------------------------------------------- Loading Loading
include/surfaceflinger/IGraphicBufferAlloc.h +1 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ public: /* Create a new GraphicBuffer for the client to use. */ virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage) = 0; PixelFormat format, uint32_t usage, status_t* error) = 0; }; // ---------------------------------------------------------------------------- Loading
libs/gui/IGraphicBufferAlloc.cpp +8 −5 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ public: } virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage) { PixelFormat format, uint32_t usage, status_t* error) { Parcel data, reply; data.writeInterfaceToken(IGraphicBufferAlloc::getInterfaceDescriptor()); data.writeInt32(w); Loading @@ -52,14 +52,15 @@ public: data.writeInt32(usage); remote()->transact(CREATE_GRAPHIC_BUFFER, data, &reply); sp<GraphicBuffer> graphicBuffer; bool nonNull = (bool)reply.readInt32(); if (nonNull) { status_t result = reply.readInt32(); if (result == NO_ERROR) { graphicBuffer = new GraphicBuffer(); reply.read(*graphicBuffer); // reply.readStrongBinder(); // here we don't even have to read the BufferReference from // the parcel, it'll die with the parcel. } *error = result; return graphicBuffer; } }; Loading Loading @@ -91,8 +92,10 @@ status_t BnGraphicBufferAlloc::onTransact( uint32_t h = data.readInt32(); PixelFormat format = data.readInt32(); uint32_t usage = data.readInt32(); sp<GraphicBuffer> result(createGraphicBuffer(w, h, format, usage)); reply->writeInt32(result != 0); status_t error; sp<GraphicBuffer> result = createGraphicBuffer(w, h, format, usage, &error); reply->writeInt32(error); if (result != 0) { reply->write(*result); // We add a BufferReference to this parcel to make sure the Loading
libs/gui/SurfaceTexture.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -352,11 +352,13 @@ status_t SurfaceTexture::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h, ((uint32_t(buffer->usage) & usage) != usage)) { usage |= GraphicBuffer::USAGE_HW_TEXTURE; status_t error; sp<GraphicBuffer> graphicBuffer( mGraphicBufferAlloc->createGraphicBuffer(w, h, format, usage)); mGraphicBufferAlloc->createGraphicBuffer( w, h, format, usage, &error)); if (graphicBuffer == 0) { LOGE("dequeueBuffer: SurfaceComposer::createGraphicBuffer failed"); return NO_MEMORY; return error; } if (updateFormat) { mPixelFormat = format; Loading
services/surfaceflinger/SurfaceFlinger.cpp +5 −2 Original line number Diff line number Diff line Loading @@ -2470,11 +2470,14 @@ GraphicBufferAlloc::GraphicBufferAlloc() {} GraphicBufferAlloc::~GraphicBufferAlloc() {} sp<GraphicBuffer> GraphicBufferAlloc::createGraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage) { PixelFormat format, uint32_t usage, status_t* error) { sp<GraphicBuffer> graphicBuffer(new GraphicBuffer(w, h, format, usage)); status_t err = graphicBuffer->initCheck(); *error = err; if (err != 0 || graphicBuffer->handle == 0) { if (err == NO_MEMORY) { GraphicBuffer::dumpAllocationsToSystemLog(); } LOGE("GraphicBufferAlloc::createGraphicBuffer(w=%d, h=%d) " "failed (%s), handle=%p", w, h, strerror(-err), graphicBuffer->handle); Loading
services/surfaceflinger/SurfaceFlinger.h +1 −1 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ public: GraphicBufferAlloc(); virtual ~GraphicBufferAlloc(); virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage); PixelFormat format, uint32_t usage, status_t* error); }; // --------------------------------------------------------------------------- Loading