Loading libs/gui/ISurfaceComposer.cpp +22 −0 Original line number Diff line number Diff line Loading @@ -1235,6 +1235,18 @@ public: } return reply.readInt32(); } status_t getExtraBufferCount(int* extraBuffers) const override { Parcel data, reply; data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); status_t err = remote()->transact(BnSurfaceComposer::GET_EXTRA_BUFFER_COUNT, data, &reply); if (err != NO_ERROR) { ALOGE("getExtraBufferCount failed to read data: %s (%d)", strerror(-err), err); return err; } return reply.readInt32(extraBuffers); } }; // Out-of-line virtual method definition to trigger vtable emission in this Loading Loading @@ -2107,6 +2119,16 @@ status_t BnSurfaceComposer::onTransact( SAFE_PARCEL(reply->writeInt32, priority); return NO_ERROR; } case GET_EXTRA_BUFFER_COUNT: { CHECK_INTERFACE(ISurfaceComposer, data, reply); int extraBuffers = 0; int err = getExtraBufferCount(&extraBuffers); if (err != NO_ERROR) { return err; } SAFE_PARCEL(reply->writeInt32, extraBuffers); return NO_ERROR; } default: { return BBinder::onTransact(code, data, reply, flags); } Loading libs/gui/Surface.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -1499,6 +1499,9 @@ int Surface::perform(int operation, va_list args) case NATIVE_WINDOW_SET_FRAME_TIMELINE_INFO: res = dispatchSetFrameTimelineInfo(args); break; case NATIVE_WINDOW_GET_EXTRA_BUFFER_COUNT: res = dispatchGetExtraBufferCount(args); break; default: res = NAME_NOT_FOUND; break; Loading Loading @@ -1815,6 +1818,14 @@ int Surface::dispatchSetFrameTimelineInfo(va_list args) { return setFrameTimelineInfo({frameTimelineVsyncId, inputEventId}); } int Surface::dispatchGetExtraBufferCount(va_list args) { ATRACE_CALL(); auto extraBuffers = static_cast<int*>(va_arg(args, int*)); ALOGV("Surface::dispatchGetExtraBufferCount"); return getExtraBufferCount(extraBuffers); } bool Surface::transformToDisplayInverse() { return (mTransform & NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY) == NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY; Loading Loading @@ -2584,4 +2595,8 @@ status_t Surface::setFrameTimelineInfo(const FrameTimelineInfo& frameTimelineInf return composerService()->setFrameTimelineInfo(mGraphicBufferProducer, frameTimelineInfo); } status_t Surface::getExtraBufferCount(int* extraBuffers) const { return composerService()->getExtraBufferCount(extraBuffers); } }; // namespace android libs/gui/include/gui/ISurfaceComposer.h +19 −0 Original line number Diff line number Diff line Loading @@ -505,6 +505,24 @@ public: * Gets priority of the RenderEngine in SurfaceFlinger. */ virtual int getGPUContextPriority() = 0; /** * Gets the extra buffers a client would need to allocate if it passes * the Choreographer#getVsyncId with its buffers. * * When Choreographer#getVsyncId is passed to SurfaceFlinger, it is used * as an indication of when to latch the buffer. SurfaceFlinger will make * sure that it will give the app at least the time configured as the * 'appDuration' before trying to latch the buffer. * * The total buffers needed for a given configuration is basically the * numbers of vsyncs a single buffer is used across the stack. For the default * configuration a buffer is held ~1 vsync by the app, ~1 vsync by SurfaceFlinger * and 1 vsync by the display. The extra buffers are calculated as the * number of additional buffers on top of the 3 buffers already allocated * by the app. */ virtual status_t getExtraBufferCount(int* extraBuffers) const = 0; }; // ---------------------------------------------------------------------------- Loading Loading @@ -567,6 +585,7 @@ public: SET_FRAME_TIMELINE_INFO, ADD_TRANSACTION_TRACE_LISTENER, GET_GPU_CONTEXT_PRIORITY, GET_EXTRA_BUFFER_COUNT, // Always append new enum to the end. }; Loading libs/gui/include/gui/Surface.h +2 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,7 @@ public: virtual status_t setFrameRate(float frameRate, int8_t compatibility, bool shouldBeSeamless); virtual status_t setFrameTimelineInfo(const FrameTimelineInfo& info); virtual status_t getExtraBufferCount(int* extraBuffers) const; protected: virtual ~Surface(); Loading Loading @@ -275,6 +276,7 @@ private: int dispatchAddQueryInterceptor(va_list args); int dispatchGetLastQueuedBuffer(va_list args); int dispatchSetFrameTimelineInfo(va_list args); int dispatchGetExtraBufferCount(va_list args); bool transformToDisplayInverse(); protected: Loading libs/gui/tests/Surface_test.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -889,6 +889,8 @@ public: int getGPUContextPriority() override { return 0; }; status_t getExtraBufferCount(int* /*extraBuffers*/) const override { return NO_ERROR; } protected: IBinder* onAsBinder() override { return nullptr; } Loading Loading
libs/gui/ISurfaceComposer.cpp +22 −0 Original line number Diff line number Diff line Loading @@ -1235,6 +1235,18 @@ public: } return reply.readInt32(); } status_t getExtraBufferCount(int* extraBuffers) const override { Parcel data, reply; data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); status_t err = remote()->transact(BnSurfaceComposer::GET_EXTRA_BUFFER_COUNT, data, &reply); if (err != NO_ERROR) { ALOGE("getExtraBufferCount failed to read data: %s (%d)", strerror(-err), err); return err; } return reply.readInt32(extraBuffers); } }; // Out-of-line virtual method definition to trigger vtable emission in this Loading Loading @@ -2107,6 +2119,16 @@ status_t BnSurfaceComposer::onTransact( SAFE_PARCEL(reply->writeInt32, priority); return NO_ERROR; } case GET_EXTRA_BUFFER_COUNT: { CHECK_INTERFACE(ISurfaceComposer, data, reply); int extraBuffers = 0; int err = getExtraBufferCount(&extraBuffers); if (err != NO_ERROR) { return err; } SAFE_PARCEL(reply->writeInt32, extraBuffers); return NO_ERROR; } default: { return BBinder::onTransact(code, data, reply, flags); } Loading
libs/gui/Surface.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -1499,6 +1499,9 @@ int Surface::perform(int operation, va_list args) case NATIVE_WINDOW_SET_FRAME_TIMELINE_INFO: res = dispatchSetFrameTimelineInfo(args); break; case NATIVE_WINDOW_GET_EXTRA_BUFFER_COUNT: res = dispatchGetExtraBufferCount(args); break; default: res = NAME_NOT_FOUND; break; Loading Loading @@ -1815,6 +1818,14 @@ int Surface::dispatchSetFrameTimelineInfo(va_list args) { return setFrameTimelineInfo({frameTimelineVsyncId, inputEventId}); } int Surface::dispatchGetExtraBufferCount(va_list args) { ATRACE_CALL(); auto extraBuffers = static_cast<int*>(va_arg(args, int*)); ALOGV("Surface::dispatchGetExtraBufferCount"); return getExtraBufferCount(extraBuffers); } bool Surface::transformToDisplayInverse() { return (mTransform & NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY) == NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY; Loading Loading @@ -2584,4 +2595,8 @@ status_t Surface::setFrameTimelineInfo(const FrameTimelineInfo& frameTimelineInf return composerService()->setFrameTimelineInfo(mGraphicBufferProducer, frameTimelineInfo); } status_t Surface::getExtraBufferCount(int* extraBuffers) const { return composerService()->getExtraBufferCount(extraBuffers); } }; // namespace android
libs/gui/include/gui/ISurfaceComposer.h +19 −0 Original line number Diff line number Diff line Loading @@ -505,6 +505,24 @@ public: * Gets priority of the RenderEngine in SurfaceFlinger. */ virtual int getGPUContextPriority() = 0; /** * Gets the extra buffers a client would need to allocate if it passes * the Choreographer#getVsyncId with its buffers. * * When Choreographer#getVsyncId is passed to SurfaceFlinger, it is used * as an indication of when to latch the buffer. SurfaceFlinger will make * sure that it will give the app at least the time configured as the * 'appDuration' before trying to latch the buffer. * * The total buffers needed for a given configuration is basically the * numbers of vsyncs a single buffer is used across the stack. For the default * configuration a buffer is held ~1 vsync by the app, ~1 vsync by SurfaceFlinger * and 1 vsync by the display. The extra buffers are calculated as the * number of additional buffers on top of the 3 buffers already allocated * by the app. */ virtual status_t getExtraBufferCount(int* extraBuffers) const = 0; }; // ---------------------------------------------------------------------------- Loading Loading @@ -567,6 +585,7 @@ public: SET_FRAME_TIMELINE_INFO, ADD_TRANSACTION_TRACE_LISTENER, GET_GPU_CONTEXT_PRIORITY, GET_EXTRA_BUFFER_COUNT, // Always append new enum to the end. }; Loading
libs/gui/include/gui/Surface.h +2 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,7 @@ public: virtual status_t setFrameRate(float frameRate, int8_t compatibility, bool shouldBeSeamless); virtual status_t setFrameTimelineInfo(const FrameTimelineInfo& info); virtual status_t getExtraBufferCount(int* extraBuffers) const; protected: virtual ~Surface(); Loading Loading @@ -275,6 +276,7 @@ private: int dispatchAddQueryInterceptor(va_list args); int dispatchGetLastQueuedBuffer(va_list args); int dispatchSetFrameTimelineInfo(va_list args); int dispatchGetExtraBufferCount(va_list args); bool transformToDisplayInverse(); protected: Loading
libs/gui/tests/Surface_test.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -889,6 +889,8 @@ public: int getGPUContextPriority() override { return 0; }; status_t getExtraBufferCount(int* /*extraBuffers*/) const override { return NO_ERROR; } protected: IBinder* onAsBinder() override { return nullptr; } Loading