Loading include/gui/ISurfaceTexture.h +1 −0 Original line number Diff line number Diff line Loading @@ -87,6 +87,7 @@ protected: virtual status_t setCrop(const Rect& reg) = 0; virtual status_t setTransform(uint32_t transform) = 0; virtual status_t setScalingMode(int mode) = 0; // getAllocator retrieves the binder object that must be referenced as long // as the GraphicBuffers dequeued from this ISurfaceTexture are referenced. Loading include/gui/SurfaceTexture.h +21 −3 Original line number Diff line number Diff line Loading @@ -88,6 +88,7 @@ public: virtual void cancelBuffer(int buf); virtual status_t setCrop(const Rect& reg); virtual status_t setTransform(uint32_t transform); virtual status_t setScalingMode(int mode); virtual int query(int what, int* value); Loading Loading @@ -185,6 +186,9 @@ public: // getCurrentTransform returns the transform of the current buffer uint32_t getCurrentTransform() const; // getCurrentScalingMode returns the scaling mode of the current buffer uint32_t getCurrentScalingMode() const; // dump our state in a String void dump(String8& result) const; void dump(String8& result, const char* prefix, char* buffer, size_t SIZE) const; Loading Loading @@ -220,6 +224,7 @@ private: mBufferState(BufferSlot::FREE), mRequestBufferCalled(false), mTransform(0), mScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE), mTimestamp(0) { mCrop.makeInvalid(); } Loading Loading @@ -281,6 +286,11 @@ private: // slot. uint32_t mTransform; // mScalingMode is the current scaling mode for this buffer slot. This // gets set to mNextScalingMode each time queueBuffer gets called for // this slot. uint32_t mScalingMode; // mTimestamp is the current timestamp for this buffer slot. This gets // to set by queueBuffer each time this slot is queued. int64_t mTimestamp; Loading Loading @@ -337,20 +347,24 @@ private: sp<GraphicBuffer> mCurrentTextureBuf; // mCurrentCrop is the crop rectangle that applies to the current texture. // It gets set to mLastQueuedCrop each time updateTexImage is called. // It gets set each time updateTexImage is called. Rect mCurrentCrop; // mCurrentTransform is the transform identifier for the current texture. It // gets set to mLastQueuedTransform each time updateTexImage is called. // gets set each time updateTexImage is called. uint32_t mCurrentTransform; // mCurrentScalingMode is the scaling mode for the current texture. It gets // set to each time updateTexImage is called. uint32_t mCurrentScalingMode; // mCurrentTransformMatrix is the transform matrix for the current texture. // It gets computed by computeTransformMatrix each time updateTexImage is // called. float mCurrentTransformMatrix[16]; // mCurrentTimestamp is the timestamp for the current texture. It // gets set to mLastQueuedTimestamp each time updateTexImage is called. // gets set each time updateTexImage is called. int64_t mCurrentTimestamp; // mNextCrop is the crop rectangle that will be used for the next buffer Loading @@ -361,6 +375,10 @@ private: // buffer that gets queued. It is set by calling setTransform. uint32_t mNextTransform; // mNextScalingMode is the scaling mode that will be used for the next // buffers that get queued. It is set by calling setScalingMode. int mNextScalingMode; // mTexName is the name of the OpenGL texture to which streamed images will // be bound when updateTexImage is called. It is set at construction time // changed with a call to setTexName. Loading include/gui/SurfaceTextureClient.h +2 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ private: int dispatchSetBuffersGeometry(va_list args); int dispatchSetBuffersDimensions(va_list args); int dispatchSetBuffersFormat(va_list args); int dispatchSetScalingMode(va_list args); int dispatchSetBuffersTransform(va_list args); int dispatchSetBuffersTimestamp(va_list args); int dispatchSetCrop(va_list args); Loading @@ -84,6 +85,7 @@ protected: virtual int setBufferCount(int bufferCount); virtual int setBuffersDimensions(int w, int h); virtual int setBuffersFormat(int format); virtual int setScalingMode(int mode); virtual int setBuffersTransform(int transform); virtual int setBuffersTimestamp(int64_t timestamp); virtual int setCrop(Rect const* rect); Loading libs/gui/ISurfaceTexture.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ enum { SET_SYNCHRONOUS_MODE, CONNECT, DISCONNECT, SET_SCALING_MODE, }; Loading Loading @@ -130,6 +131,15 @@ public: return result; } virtual status_t setScalingMode(int mode) { Parcel data, reply; data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor()); data.writeInt32(mode); remote()->transact(SET_SCALING_MODE, data, &reply); status_t result = reply.readInt32(); return result; } virtual sp<IBinder> getAllocator() { Parcel data, reply; data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor()); Loading Loading @@ -244,6 +254,13 @@ status_t BnSurfaceTexture::onTransact( reply->writeInt32(result); return NO_ERROR; } break; case SET_SCALING_MODE: { CHECK_INTERFACE(ISurfaceTexture, data, reply); int mode = data.readInt32(); status_t result = setScalingMode(mode); reply->writeInt32(result); return NO_ERROR; } break; case GET_ALLOCATOR: { CHECK_INTERFACE(ISurfaceTexture, data, reply); sp<IBinder> result = getAllocator(); Loading libs/gui/SurfaceTexture.cpp +24 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,7 @@ SurfaceTexture::SurfaceTexture(GLuint tex, bool allowSynchronousMode) : mCurrentTransform(0), mCurrentTimestamp(0), mNextTransform(0), mNextScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE), mTexName(tex), mSynchronousMode(false), mAllowSynchronousMode(allowSynchronousMode), Loading Loading @@ -453,6 +454,7 @@ status_t SurfaceTexture::queueBuffer(int buf, int64_t timestamp) { mSlots[buf].mBufferState = BufferSlot::QUEUED; mSlots[buf].mCrop = mNextCrop; mSlots[buf].mTransform = mNextTransform; mSlots[buf].mScalingMode = mNextScalingMode; mSlots[buf].mTimestamp = timestamp; mDequeueCondition.signal(); } // scope for the lock Loading Loading @@ -542,6 +544,22 @@ status_t SurfaceTexture::disconnect(int api) { return err; } status_t SurfaceTexture::setScalingMode(int mode) { LOGV("SurfaceTexture::setScalingMode(%d)", mode); switch (mode) { case NATIVE_WINDOW_SCALING_MODE_FREEZE: case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW: break; default: return BAD_VALUE; } Mutex::Autolock lock(mMutex); mNextScalingMode = mode; return OK; } status_t SurfaceTexture::updateTexImage() { LOGV("SurfaceTexture::updateTexImage"); Mutex::Autolock lock(mMutex); Loading Loading @@ -602,6 +620,7 @@ status_t SurfaceTexture::updateTexImage() { mCurrentTextureBuf = mSlots[buf].mGraphicBuffer; mCurrentCrop = mSlots[buf].mCrop; mCurrentTransform = mSlots[buf].mTransform; mCurrentScalingMode = mSlots[buf].mScalingMode; mCurrentTimestamp = mSlots[buf].mTimestamp; computeCurrentTransformMatrix(); Loading Loading @@ -809,6 +828,11 @@ uint32_t SurfaceTexture::getCurrentTransform() const { return mCurrentTransform; } uint32_t SurfaceTexture::getCurrentScalingMode() const { Mutex::Autolock lock(mMutex); return mCurrentScalingMode; } int SurfaceTexture::query(int what, int* outValue) { Mutex::Autolock lock(mMutex); Loading Loading
include/gui/ISurfaceTexture.h +1 −0 Original line number Diff line number Diff line Loading @@ -87,6 +87,7 @@ protected: virtual status_t setCrop(const Rect& reg) = 0; virtual status_t setTransform(uint32_t transform) = 0; virtual status_t setScalingMode(int mode) = 0; // getAllocator retrieves the binder object that must be referenced as long // as the GraphicBuffers dequeued from this ISurfaceTexture are referenced. Loading
include/gui/SurfaceTexture.h +21 −3 Original line number Diff line number Diff line Loading @@ -88,6 +88,7 @@ public: virtual void cancelBuffer(int buf); virtual status_t setCrop(const Rect& reg); virtual status_t setTransform(uint32_t transform); virtual status_t setScalingMode(int mode); virtual int query(int what, int* value); Loading Loading @@ -185,6 +186,9 @@ public: // getCurrentTransform returns the transform of the current buffer uint32_t getCurrentTransform() const; // getCurrentScalingMode returns the scaling mode of the current buffer uint32_t getCurrentScalingMode() const; // dump our state in a String void dump(String8& result) const; void dump(String8& result, const char* prefix, char* buffer, size_t SIZE) const; Loading Loading @@ -220,6 +224,7 @@ private: mBufferState(BufferSlot::FREE), mRequestBufferCalled(false), mTransform(0), mScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE), mTimestamp(0) { mCrop.makeInvalid(); } Loading Loading @@ -281,6 +286,11 @@ private: // slot. uint32_t mTransform; // mScalingMode is the current scaling mode for this buffer slot. This // gets set to mNextScalingMode each time queueBuffer gets called for // this slot. uint32_t mScalingMode; // mTimestamp is the current timestamp for this buffer slot. This gets // to set by queueBuffer each time this slot is queued. int64_t mTimestamp; Loading Loading @@ -337,20 +347,24 @@ private: sp<GraphicBuffer> mCurrentTextureBuf; // mCurrentCrop is the crop rectangle that applies to the current texture. // It gets set to mLastQueuedCrop each time updateTexImage is called. // It gets set each time updateTexImage is called. Rect mCurrentCrop; // mCurrentTransform is the transform identifier for the current texture. It // gets set to mLastQueuedTransform each time updateTexImage is called. // gets set each time updateTexImage is called. uint32_t mCurrentTransform; // mCurrentScalingMode is the scaling mode for the current texture. It gets // set to each time updateTexImage is called. uint32_t mCurrentScalingMode; // mCurrentTransformMatrix is the transform matrix for the current texture. // It gets computed by computeTransformMatrix each time updateTexImage is // called. float mCurrentTransformMatrix[16]; // mCurrentTimestamp is the timestamp for the current texture. It // gets set to mLastQueuedTimestamp each time updateTexImage is called. // gets set each time updateTexImage is called. int64_t mCurrentTimestamp; // mNextCrop is the crop rectangle that will be used for the next buffer Loading @@ -361,6 +375,10 @@ private: // buffer that gets queued. It is set by calling setTransform. uint32_t mNextTransform; // mNextScalingMode is the scaling mode that will be used for the next // buffers that get queued. It is set by calling setScalingMode. int mNextScalingMode; // mTexName is the name of the OpenGL texture to which streamed images will // be bound when updateTexImage is called. It is set at construction time // changed with a call to setTexName. Loading
include/gui/SurfaceTextureClient.h +2 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ private: int dispatchSetBuffersGeometry(va_list args); int dispatchSetBuffersDimensions(va_list args); int dispatchSetBuffersFormat(va_list args); int dispatchSetScalingMode(va_list args); int dispatchSetBuffersTransform(va_list args); int dispatchSetBuffersTimestamp(va_list args); int dispatchSetCrop(va_list args); Loading @@ -84,6 +85,7 @@ protected: virtual int setBufferCount(int bufferCount); virtual int setBuffersDimensions(int w, int h); virtual int setBuffersFormat(int format); virtual int setScalingMode(int mode); virtual int setBuffersTransform(int transform); virtual int setBuffersTimestamp(int64_t timestamp); virtual int setCrop(Rect const* rect); Loading
libs/gui/ISurfaceTexture.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ enum { SET_SYNCHRONOUS_MODE, CONNECT, DISCONNECT, SET_SCALING_MODE, }; Loading Loading @@ -130,6 +131,15 @@ public: return result; } virtual status_t setScalingMode(int mode) { Parcel data, reply; data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor()); data.writeInt32(mode); remote()->transact(SET_SCALING_MODE, data, &reply); status_t result = reply.readInt32(); return result; } virtual sp<IBinder> getAllocator() { Parcel data, reply; data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor()); Loading Loading @@ -244,6 +254,13 @@ status_t BnSurfaceTexture::onTransact( reply->writeInt32(result); return NO_ERROR; } break; case SET_SCALING_MODE: { CHECK_INTERFACE(ISurfaceTexture, data, reply); int mode = data.readInt32(); status_t result = setScalingMode(mode); reply->writeInt32(result); return NO_ERROR; } break; case GET_ALLOCATOR: { CHECK_INTERFACE(ISurfaceTexture, data, reply); sp<IBinder> result = getAllocator(); Loading
libs/gui/SurfaceTexture.cpp +24 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,7 @@ SurfaceTexture::SurfaceTexture(GLuint tex, bool allowSynchronousMode) : mCurrentTransform(0), mCurrentTimestamp(0), mNextTransform(0), mNextScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE), mTexName(tex), mSynchronousMode(false), mAllowSynchronousMode(allowSynchronousMode), Loading Loading @@ -453,6 +454,7 @@ status_t SurfaceTexture::queueBuffer(int buf, int64_t timestamp) { mSlots[buf].mBufferState = BufferSlot::QUEUED; mSlots[buf].mCrop = mNextCrop; mSlots[buf].mTransform = mNextTransform; mSlots[buf].mScalingMode = mNextScalingMode; mSlots[buf].mTimestamp = timestamp; mDequeueCondition.signal(); } // scope for the lock Loading Loading @@ -542,6 +544,22 @@ status_t SurfaceTexture::disconnect(int api) { return err; } status_t SurfaceTexture::setScalingMode(int mode) { LOGV("SurfaceTexture::setScalingMode(%d)", mode); switch (mode) { case NATIVE_WINDOW_SCALING_MODE_FREEZE: case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW: break; default: return BAD_VALUE; } Mutex::Autolock lock(mMutex); mNextScalingMode = mode; return OK; } status_t SurfaceTexture::updateTexImage() { LOGV("SurfaceTexture::updateTexImage"); Mutex::Autolock lock(mMutex); Loading Loading @@ -602,6 +620,7 @@ status_t SurfaceTexture::updateTexImage() { mCurrentTextureBuf = mSlots[buf].mGraphicBuffer; mCurrentCrop = mSlots[buf].mCrop; mCurrentTransform = mSlots[buf].mTransform; mCurrentScalingMode = mSlots[buf].mScalingMode; mCurrentTimestamp = mSlots[buf].mTimestamp; computeCurrentTransformMatrix(); Loading Loading @@ -809,6 +828,11 @@ uint32_t SurfaceTexture::getCurrentTransform() const { return mCurrentTransform; } uint32_t SurfaceTexture::getCurrentScalingMode() const { Mutex::Autolock lock(mMutex); return mCurrentScalingMode; } int SurfaceTexture::query(int what, int* outValue) { Mutex::Autolock lock(mMutex); Loading