Loading include/gui/ISurfaceTexture.h +9 −0 Original line number Diff line number Diff line Loading @@ -31,11 +31,16 @@ namespace android { // ---------------------------------------------------------------------------- class SurfaceTextureClient; class ISurfaceTexture : public IInterface { public: DECLARE_META_INTERFACE(SurfaceTexture); protected: friend class SurfaceTextureClient; enum { BUFFER_NEEDS_REALLOCATION = 1 }; // requestBuffer requests a new buffer for the given index. The server (i.e. Loading Loading @@ -85,6 +90,10 @@ public: // Holding this binder reference prevents SurfaceFlinger from freeing the // buffers before the client is done with them. virtual sp<IBinder> getAllocator() = 0; // query retrieves some information for this surface // 'what' tokens allowed are that of android_natives.h virtual int query(int what, int* value) = 0; }; // ---------------------------------------------------------------------------- Loading include/gui/SurfaceTexture.h +2 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,8 @@ public: virtual status_t setCrop(const Rect& reg); virtual status_t setTransform(uint32_t transform); virtual int query(int what, int* value); // updateTexImage sets the image contents of the target texture to that of // the most recently queued buffer. // Loading libs/gui/ISurfaceTexture.cpp +21 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ enum { SET_CROP, SET_TRANSFORM, GET_ALLOCATOR, QUERY, }; Loading Loading @@ -132,6 +133,17 @@ public: remote()->transact(GET_ALLOCATOR, data, &reply); return reply.readStrongBinder(); } virtual int query(int what, int* value) { Parcel data, reply; data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor()); data.writeInt32(what); remote()->transact(QUERY, data, &reply); value[0] = reply.readInt32(); status_t result = reply.readInt32(); return result; } }; IMPLEMENT_META_INTERFACE(SurfaceTexture, "android.gui.SurfaceTexture"); Loading Loading @@ -209,6 +221,15 @@ status_t BnSurfaceTexture::onTransact( reply->writeStrongBinder(result); return NO_ERROR; } break; case QUERY: { CHECK_INTERFACE(ISurfaceTexture, data, reply); int value; int what = data.readInt32(); int res = query(what, &value); reply->writeInt32(value); reply->writeInt32(res); return NO_ERROR; } break; } return BBinder::onTransact(code, data, reply, flags); } Loading libs/gui/SurfaceTexture.cpp +28 −0 Original line number Diff line number Diff line Loading @@ -509,6 +509,34 @@ uint32_t SurfaceTexture::getCurrentTransform() const { return mCurrentTransform; } int SurfaceTexture::query(int what, int* outValue) { Mutex::Autolock lock(mMutex); int value; switch (what) { case NATIVE_WINDOW_WIDTH: value = mDefaultWidth; if (!mDefaultWidth && !mDefaultHeight && mCurrentTextureBuf!=0) value = mCurrentTextureBuf->width; break; case NATIVE_WINDOW_HEIGHT: value = mDefaultHeight; if (!mDefaultWidth && !mDefaultHeight && mCurrentTextureBuf!=0) value = mCurrentTextureBuf->height; break; case NATIVE_WINDOW_FORMAT: value = mPixelFormat; break; case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS: value = mSynchronousMode ? (MIN_UNDEQUEUED_BUFFERS-1) : MIN_UNDEQUEUED_BUFFERS; break; default: return BAD_VALUE; } outValue[0] = value; return NO_ERROR; } static void mtxMul(float out[16], const float a[16], const float b[16]) { out[0] = a[0]*b[0] + a[4]*b[1] + a[8]*b[2] + a[12]*b[3]; Loading libs/gui/SurfaceTextureClient.cpp +3 −15 Original line number Diff line number Diff line Loading @@ -159,29 +159,17 @@ int SurfaceTextureClient::queueBuffer(android_native_buffer_t* buffer) { int SurfaceTextureClient::query(int what, int* value) const { LOGV("SurfaceTextureClient::query"); Mutex::Autolock lock(mMutex); switch (what) { case NATIVE_WINDOW_WIDTH: *value = mQueryWidth ? mQueryWidth : mReqWidth; return NO_ERROR; case NATIVE_WINDOW_HEIGHT: *value = mQueryHeight ? mQueryHeight : mReqHeight; return NO_ERROR; case NATIVE_WINDOW_FORMAT: *value = mQueryFormat ? mQueryFormat : mReqFormat; return NO_ERROR; case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS: *value = MIN_UNDEQUEUED_BUFFERS; return NO_ERROR; case NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER: // SurfaceTextureClient currently never queues frames to SurfaceFlinger. // TODO: this is not needed anymore *value = 0; return NO_ERROR; case NATIVE_WINDOW_CONCRETE_TYPE: // TODO: this is not needed anymore *value = NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT; return NO_ERROR; } return BAD_VALUE; return mSurfaceTexture->query(what, value); } int SurfaceTextureClient::perform(int operation, va_list args) Loading Loading
include/gui/ISurfaceTexture.h +9 −0 Original line number Diff line number Diff line Loading @@ -31,11 +31,16 @@ namespace android { // ---------------------------------------------------------------------------- class SurfaceTextureClient; class ISurfaceTexture : public IInterface { public: DECLARE_META_INTERFACE(SurfaceTexture); protected: friend class SurfaceTextureClient; enum { BUFFER_NEEDS_REALLOCATION = 1 }; // requestBuffer requests a new buffer for the given index. The server (i.e. Loading Loading @@ -85,6 +90,10 @@ public: // Holding this binder reference prevents SurfaceFlinger from freeing the // buffers before the client is done with them. virtual sp<IBinder> getAllocator() = 0; // query retrieves some information for this surface // 'what' tokens allowed are that of android_natives.h virtual int query(int what, int* value) = 0; }; // ---------------------------------------------------------------------------- Loading
include/gui/SurfaceTexture.h +2 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,8 @@ public: virtual status_t setCrop(const Rect& reg); virtual status_t setTransform(uint32_t transform); virtual int query(int what, int* value); // updateTexImage sets the image contents of the target texture to that of // the most recently queued buffer. // Loading
libs/gui/ISurfaceTexture.cpp +21 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ enum { SET_CROP, SET_TRANSFORM, GET_ALLOCATOR, QUERY, }; Loading Loading @@ -132,6 +133,17 @@ public: remote()->transact(GET_ALLOCATOR, data, &reply); return reply.readStrongBinder(); } virtual int query(int what, int* value) { Parcel data, reply; data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor()); data.writeInt32(what); remote()->transact(QUERY, data, &reply); value[0] = reply.readInt32(); status_t result = reply.readInt32(); return result; } }; IMPLEMENT_META_INTERFACE(SurfaceTexture, "android.gui.SurfaceTexture"); Loading Loading @@ -209,6 +221,15 @@ status_t BnSurfaceTexture::onTransact( reply->writeStrongBinder(result); return NO_ERROR; } break; case QUERY: { CHECK_INTERFACE(ISurfaceTexture, data, reply); int value; int what = data.readInt32(); int res = query(what, &value); reply->writeInt32(value); reply->writeInt32(res); return NO_ERROR; } break; } return BBinder::onTransact(code, data, reply, flags); } Loading
libs/gui/SurfaceTexture.cpp +28 −0 Original line number Diff line number Diff line Loading @@ -509,6 +509,34 @@ uint32_t SurfaceTexture::getCurrentTransform() const { return mCurrentTransform; } int SurfaceTexture::query(int what, int* outValue) { Mutex::Autolock lock(mMutex); int value; switch (what) { case NATIVE_WINDOW_WIDTH: value = mDefaultWidth; if (!mDefaultWidth && !mDefaultHeight && mCurrentTextureBuf!=0) value = mCurrentTextureBuf->width; break; case NATIVE_WINDOW_HEIGHT: value = mDefaultHeight; if (!mDefaultWidth && !mDefaultHeight && mCurrentTextureBuf!=0) value = mCurrentTextureBuf->height; break; case NATIVE_WINDOW_FORMAT: value = mPixelFormat; break; case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS: value = mSynchronousMode ? (MIN_UNDEQUEUED_BUFFERS-1) : MIN_UNDEQUEUED_BUFFERS; break; default: return BAD_VALUE; } outValue[0] = value; return NO_ERROR; } static void mtxMul(float out[16], const float a[16], const float b[16]) { out[0] = a[0]*b[0] + a[4]*b[1] + a[8]*b[2] + a[12]*b[3]; Loading
libs/gui/SurfaceTextureClient.cpp +3 −15 Original line number Diff line number Diff line Loading @@ -159,29 +159,17 @@ int SurfaceTextureClient::queueBuffer(android_native_buffer_t* buffer) { int SurfaceTextureClient::query(int what, int* value) const { LOGV("SurfaceTextureClient::query"); Mutex::Autolock lock(mMutex); switch (what) { case NATIVE_WINDOW_WIDTH: *value = mQueryWidth ? mQueryWidth : mReqWidth; return NO_ERROR; case NATIVE_WINDOW_HEIGHT: *value = mQueryHeight ? mQueryHeight : mReqHeight; return NO_ERROR; case NATIVE_WINDOW_FORMAT: *value = mQueryFormat ? mQueryFormat : mReqFormat; return NO_ERROR; case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS: *value = MIN_UNDEQUEUED_BUFFERS; return NO_ERROR; case NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER: // SurfaceTextureClient currently never queues frames to SurfaceFlinger. // TODO: this is not needed anymore *value = 0; return NO_ERROR; case NATIVE_WINDOW_CONCRETE_TYPE: // TODO: this is not needed anymore *value = NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT; return NO_ERROR; } return BAD_VALUE; return mSurfaceTexture->query(what, value); } int SurfaceTextureClient::perform(int operation, va_list args) Loading