Loading libs/gui/BufferQueueProducer.cpp +8 −8 Original line number Diff line number Diff line Loading @@ -989,14 +989,6 @@ status_t BufferQueueProducer::queueBuffer(int slot, mCallbackCondition.broadcast(); } // Wait without lock held if (connectedApi == NATIVE_WINDOW_API_EGL) { // Waiting here allows for two full buffers to be queued but not a // third. In the event that frames take varying time, this makes a // small trade-off in favor of latency rather than throughput. lastQueuedFence->waitForever("Throttling EGL Production"); } // Update and get FrameEventHistory. nsecs_t postedTime = systemTime(SYSTEM_TIME_MONOTONIC); NewFrameEventsEntry newFrameEventsEntry = { Loading @@ -1008,6 +1000,14 @@ status_t BufferQueueProducer::queueBuffer(int slot, addAndGetFrameTimestamps(&newFrameEventsEntry, getFrameTimestamps ? &output->frameTimestamps : nullptr); // Wait without lock held if (connectedApi == NATIVE_WINDOW_API_EGL) { // Waiting here allows for two full buffers to be queued but not a // third. In the event that frames take varying time, this makes a // small trade-off in favor of latency rather than throughput. lastQueuedFence->waitForever("Throttling EGL Production"); } return NO_ERROR; } Loading libs/gui/ISurfaceComposer.cpp +12 −4 Original line number Diff line number Diff line Loading @@ -103,9 +103,10 @@ public: } virtual status_t captureScreen(const sp<IBinder>& display, sp<GraphicBuffer>* outBuffer, bool& outCapturedSecureLayers, Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, int32_t minLayerZ, int32_t maxLayerZ, bool useIdentityTransform, ISurfaceComposer::Rotation rotation) { ISurfaceComposer::Rotation rotation, bool captureSecureLayers) { Parcel data, reply; data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); data.writeStrongBinder(display); Loading @@ -116,6 +117,7 @@ public: data.writeInt32(maxLayerZ); data.writeInt32(static_cast<int32_t>(useIdentityTransform)); data.writeInt32(static_cast<int32_t>(rotation)); data.writeInt32(static_cast<int32_t>(captureSecureLayers)); status_t err = remote()->transact(BnSurfaceComposer::CAPTURE_SCREEN, data, &reply); if (err != NO_ERROR) { Loading @@ -129,6 +131,8 @@ public: *outBuffer = new GraphicBuffer(); reply.read(**outBuffer); outCapturedSecureLayers = reply.readBool(); return err; } Loading Loading @@ -644,13 +648,17 @@ status_t BnSurfaceComposer::onTransact( int32_t maxLayerZ = data.readInt32(); bool useIdentityTransform = static_cast<bool>(data.readInt32()); int32_t rotation = data.readInt32(); bool captureSecureLayers = static_cast<bool>(data.readInt32()); bool capturedSecureLayers = false; status_t res = captureScreen(display, &outBuffer, capturedSecureLayers, sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ, useIdentityTransform, static_cast<ISurfaceComposer::Rotation>(rotation), captureSecureLayers); status_t res = captureScreen(display, &outBuffer, sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ, useIdentityTransform, static_cast<ISurfaceComposer::Rotation>(rotation)); reply->writeInt32(res); if (res == NO_ERROR) { reply->write(*outBuffer); reply->writeBool(capturedSecureLayers); } return NO_ERROR; } Loading libs/gui/SurfaceComposerClient.cpp +15 −4 Original line number Diff line number Diff line Loading @@ -768,18 +768,29 @@ status_t SurfaceComposerClient::getHdrCapabilities(const sp<IBinder>& display, status_t ScreenshotClient::capture(const sp<IBinder>& display, Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, int32_t minLayerZ, int32_t maxLayerZ, bool useIdentityTransform, uint32_t rotation, sp<GraphicBuffer>* outBuffer) { bool captureSecureLayers, sp<GraphicBuffer>* outBuffer, bool& outCapturedSecureLayers) { sp<ISurfaceComposer> s(ComposerService::getComposerService()); if (s == NULL) return NO_INIT; status_t ret = s->captureScreen(display, outBuffer, sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ, useIdentityTransform, static_cast<ISurfaceComposer::Rotation>(rotation)); status_t ret = s->captureScreen(display, outBuffer, outCapturedSecureLayers, sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ, useIdentityTransform, static_cast<ISurfaceComposer::Rotation>(rotation), captureSecureLayers); if (ret != NO_ERROR) { return ret; } return ret; } status_t ScreenshotClient::capture(const sp<IBinder>& display, Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, int32_t minLayerZ, int32_t maxLayerZ, bool useIdentityTransform, uint32_t rotation, sp<GraphicBuffer>* outBuffer) { bool ignored; return capture(display, sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ, useIdentityTransform, rotation, false, outBuffer, ignored); } status_t ScreenshotClient::captureLayers(const sp<IBinder>& layerHandle, Rect sourceCrop, float frameScale, sp<GraphicBuffer>* outBuffer) { sp<ISurfaceComposer> s(ComposerService::getComposerService()); Loading libs/gui/bufferqueue/1.0/H2BGraphicBufferProducer.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -1056,7 +1056,7 @@ status_t H2BGraphicBufferProducer::detachNextBuffer( status_t H2BGraphicBufferProducer::attachBuffer( int* outSlot, const sp<GraphicBuffer>& buffer) { AnwBuffer tBuffer; AnwBuffer tBuffer{}; wrapAs(&tBuffer, *buffer); status_t fnStatus; status_t transStatus = toStatusT(mBase->attachBuffer(tBuffer, Loading @@ -1071,7 +1071,7 @@ status_t H2BGraphicBufferProducer::queueBuffer( int slot, const QueueBufferInput& input, QueueBufferOutput* output) { HGraphicBufferProducer::QueueBufferInput tInput; HGraphicBufferProducer::QueueBufferInput tInput{}; native_handle_t* nh; if (!wrapAs(&tInput, &nh, input)) { ALOGE("H2BGraphicBufferProducer::queueBuffer - " Loading libs/gui/include/gui/ISurfaceComposer.h +15 −3 Original line number Diff line number Diff line Loading @@ -195,10 +195,22 @@ public: * it) around its center. */ virtual status_t captureScreen(const sp<IBinder>& display, sp<GraphicBuffer>* outBuffer, Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, int32_t minLayerZ, int32_t maxLayerZ, bool useIdentityTransform, Rotation rotation = eRotateNone) = 0; bool& outCapturedSecureLayers, Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, int32_t minLayerZ, int32_t maxLayerZ, bool useIdentityTransform, Rotation rotation = eRotateNone, bool captureSecureLayers = false) = 0; virtual status_t captureScreen(const sp<IBinder>& display, sp<GraphicBuffer>* outBuffer, Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, int32_t minLayerZ, int32_t maxLayerZ, bool useIdentityTransform, Rotation rotation = eRotateNone, bool captureSecureLayers = false) { bool ignored; return captureScreen(display, outBuffer, ignored, sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ, useIdentityTransform, rotation, captureSecureLayers); } /** * Capture a subtree of the layer hierarchy, potentially ignoring the root node. */ Loading Loading
libs/gui/BufferQueueProducer.cpp +8 −8 Original line number Diff line number Diff line Loading @@ -989,14 +989,6 @@ status_t BufferQueueProducer::queueBuffer(int slot, mCallbackCondition.broadcast(); } // Wait without lock held if (connectedApi == NATIVE_WINDOW_API_EGL) { // Waiting here allows for two full buffers to be queued but not a // third. In the event that frames take varying time, this makes a // small trade-off in favor of latency rather than throughput. lastQueuedFence->waitForever("Throttling EGL Production"); } // Update and get FrameEventHistory. nsecs_t postedTime = systemTime(SYSTEM_TIME_MONOTONIC); NewFrameEventsEntry newFrameEventsEntry = { Loading @@ -1008,6 +1000,14 @@ status_t BufferQueueProducer::queueBuffer(int slot, addAndGetFrameTimestamps(&newFrameEventsEntry, getFrameTimestamps ? &output->frameTimestamps : nullptr); // Wait without lock held if (connectedApi == NATIVE_WINDOW_API_EGL) { // Waiting here allows for two full buffers to be queued but not a // third. In the event that frames take varying time, this makes a // small trade-off in favor of latency rather than throughput. lastQueuedFence->waitForever("Throttling EGL Production"); } return NO_ERROR; } Loading
libs/gui/ISurfaceComposer.cpp +12 −4 Original line number Diff line number Diff line Loading @@ -103,9 +103,10 @@ public: } virtual status_t captureScreen(const sp<IBinder>& display, sp<GraphicBuffer>* outBuffer, bool& outCapturedSecureLayers, Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, int32_t minLayerZ, int32_t maxLayerZ, bool useIdentityTransform, ISurfaceComposer::Rotation rotation) { ISurfaceComposer::Rotation rotation, bool captureSecureLayers) { Parcel data, reply; data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); data.writeStrongBinder(display); Loading @@ -116,6 +117,7 @@ public: data.writeInt32(maxLayerZ); data.writeInt32(static_cast<int32_t>(useIdentityTransform)); data.writeInt32(static_cast<int32_t>(rotation)); data.writeInt32(static_cast<int32_t>(captureSecureLayers)); status_t err = remote()->transact(BnSurfaceComposer::CAPTURE_SCREEN, data, &reply); if (err != NO_ERROR) { Loading @@ -129,6 +131,8 @@ public: *outBuffer = new GraphicBuffer(); reply.read(**outBuffer); outCapturedSecureLayers = reply.readBool(); return err; } Loading Loading @@ -644,13 +648,17 @@ status_t BnSurfaceComposer::onTransact( int32_t maxLayerZ = data.readInt32(); bool useIdentityTransform = static_cast<bool>(data.readInt32()); int32_t rotation = data.readInt32(); bool captureSecureLayers = static_cast<bool>(data.readInt32()); bool capturedSecureLayers = false; status_t res = captureScreen(display, &outBuffer, capturedSecureLayers, sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ, useIdentityTransform, static_cast<ISurfaceComposer::Rotation>(rotation), captureSecureLayers); status_t res = captureScreen(display, &outBuffer, sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ, useIdentityTransform, static_cast<ISurfaceComposer::Rotation>(rotation)); reply->writeInt32(res); if (res == NO_ERROR) { reply->write(*outBuffer); reply->writeBool(capturedSecureLayers); } return NO_ERROR; } Loading
libs/gui/SurfaceComposerClient.cpp +15 −4 Original line number Diff line number Diff line Loading @@ -768,18 +768,29 @@ status_t SurfaceComposerClient::getHdrCapabilities(const sp<IBinder>& display, status_t ScreenshotClient::capture(const sp<IBinder>& display, Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, int32_t minLayerZ, int32_t maxLayerZ, bool useIdentityTransform, uint32_t rotation, sp<GraphicBuffer>* outBuffer) { bool captureSecureLayers, sp<GraphicBuffer>* outBuffer, bool& outCapturedSecureLayers) { sp<ISurfaceComposer> s(ComposerService::getComposerService()); if (s == NULL) return NO_INIT; status_t ret = s->captureScreen(display, outBuffer, sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ, useIdentityTransform, static_cast<ISurfaceComposer::Rotation>(rotation)); status_t ret = s->captureScreen(display, outBuffer, outCapturedSecureLayers, sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ, useIdentityTransform, static_cast<ISurfaceComposer::Rotation>(rotation), captureSecureLayers); if (ret != NO_ERROR) { return ret; } return ret; } status_t ScreenshotClient::capture(const sp<IBinder>& display, Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, int32_t minLayerZ, int32_t maxLayerZ, bool useIdentityTransform, uint32_t rotation, sp<GraphicBuffer>* outBuffer) { bool ignored; return capture(display, sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ, useIdentityTransform, rotation, false, outBuffer, ignored); } status_t ScreenshotClient::captureLayers(const sp<IBinder>& layerHandle, Rect sourceCrop, float frameScale, sp<GraphicBuffer>* outBuffer) { sp<ISurfaceComposer> s(ComposerService::getComposerService()); Loading
libs/gui/bufferqueue/1.0/H2BGraphicBufferProducer.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -1056,7 +1056,7 @@ status_t H2BGraphicBufferProducer::detachNextBuffer( status_t H2BGraphicBufferProducer::attachBuffer( int* outSlot, const sp<GraphicBuffer>& buffer) { AnwBuffer tBuffer; AnwBuffer tBuffer{}; wrapAs(&tBuffer, *buffer); status_t fnStatus; status_t transStatus = toStatusT(mBase->attachBuffer(tBuffer, Loading @@ -1071,7 +1071,7 @@ status_t H2BGraphicBufferProducer::queueBuffer( int slot, const QueueBufferInput& input, QueueBufferOutput* output) { HGraphicBufferProducer::QueueBufferInput tInput; HGraphicBufferProducer::QueueBufferInput tInput{}; native_handle_t* nh; if (!wrapAs(&tInput, &nh, input)) { ALOGE("H2BGraphicBufferProducer::queueBuffer - " Loading
libs/gui/include/gui/ISurfaceComposer.h +15 −3 Original line number Diff line number Diff line Loading @@ -195,10 +195,22 @@ public: * it) around its center. */ virtual status_t captureScreen(const sp<IBinder>& display, sp<GraphicBuffer>* outBuffer, Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, int32_t minLayerZ, int32_t maxLayerZ, bool useIdentityTransform, Rotation rotation = eRotateNone) = 0; bool& outCapturedSecureLayers, Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, int32_t minLayerZ, int32_t maxLayerZ, bool useIdentityTransform, Rotation rotation = eRotateNone, bool captureSecureLayers = false) = 0; virtual status_t captureScreen(const sp<IBinder>& display, sp<GraphicBuffer>* outBuffer, Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, int32_t minLayerZ, int32_t maxLayerZ, bool useIdentityTransform, Rotation rotation = eRotateNone, bool captureSecureLayers = false) { bool ignored; return captureScreen(display, outBuffer, ignored, sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ, useIdentityTransform, rotation, captureSecureLayers); } /** * Capture a subtree of the layer hierarchy, potentially ignoring the root node. */ Loading