Loading include/gui/SurfaceTextureClient.h +0 −8 Original line number Diff line number Diff line Loading @@ -104,7 +104,6 @@ protected: virtual int setBuffersTransform(int transform); virtual int setBuffersTimestamp(int64_t timestamp); virtual int setCrop(Rect const* rect); virtual int setPostTransformCrop(Rect const* rect); virtual int setUsage(uint32_t reqUsage); virtual int lock(ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds); virtual int unlockAndPost(); Loading Loading @@ -159,13 +158,6 @@ private: // that gets queued. It is set by calling setCrop. Rect mCrop; // mCropNeedsTransform indicates whether mCrop is in post-transform // coordinates and must be transformed using the inverse of mTransform // before being queued with a buffer. Otherwise the crop is passed // untransformed. It is initialized to false, is set to true by // setPostTransformCrop, and set to false by setCrop. bool mCropNeedsTransform; // mScalingMode is the scaling mode that will be used for the next // buffers that get queued. It is set by calling setScalingMode. int mScalingMode; Loading libs/gui/BufferQueue.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -495,9 +495,9 @@ status_t BufferQueue::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h, // synchronizing access to it. It's too late at this point to abort the // dequeue operation. if (result == EGL_FALSE) { ALOGE("dequeueBuffer: error waiting for fence: %#x", eglGetError()); ST_LOGE("dequeueBuffer: error waiting for fence: %#x", eglGetError()); } else if (result == EGL_TIMEOUT_EXPIRED_KHR) { ALOGE("dequeueBuffer: timeout waiting for fence"); ST_LOGE("dequeueBuffer: timeout waiting for fence"); } eglDestroySyncKHR(dpy, fence); } Loading libs/gui/SurfaceTextureClient.cpp +2 −49 Original line number Diff line number Diff line Loading @@ -76,7 +76,6 @@ void SurfaceTextureClient::init() { mReqUsage = 0; mTimestamp = NATIVE_WINDOW_TIMESTAMP_AUTO; mCrop.clear(); mCropNeedsTransform = false; mScalingMode = NATIVE_WINDOW_SCALING_MODE_FREEZE; mTransform = 0; mDefaultWidth = 0; Loading Loading @@ -238,25 +237,9 @@ int SurfaceTextureClient::queueBuffer(android_native_buffer_t* buffer) { return i; } Rect crop(mCrop); if (mCropNeedsTransform) { // The crop rect was specified in the post-transform coordinate space, // so we need to transform that rect by the inverse of mTransform to // put it into the buffer pixel space before queuing it. uint32_t invTransform = mTransform; int32_t width = buffer->width; int32_t height = buffer->height; if (mTransform & NATIVE_WINDOW_TRANSFORM_ROT_90) { invTransform ^= NATIVE_WINDOW_TRANSFORM_FLIP_V | NATIVE_WINDOW_TRANSFORM_FLIP_H; width = buffer->height; height = buffer->width; } crop = mCrop.transform(invTransform, width, height); } // Make sure the crop rectangle is entirely inside the buffer. crop.intersect(Rect(buffer->width, buffer->height), &crop); Rect crop; mCrop.intersect(Rect(buffer->width, buffer->height), &crop); ISurfaceTexture::QueueBufferOutput output; ISurfaceTexture::QueueBufferInput input(timestamp, crop, mScalingMode, Loading Loading @@ -341,9 +324,6 @@ int SurfaceTextureClient::perform(int operation, va_list args) case NATIVE_WINDOW_SET_CROP: res = dispatchSetCrop(args); break; case NATIVE_WINDOW_SET_POST_TRANSFORM_CROP: res = dispatchSetPostTransformCrop(args); break; case NATIVE_WINDOW_SET_BUFFER_COUNT: res = dispatchSetBufferCount(args); break; Loading Loading @@ -407,11 +387,6 @@ int SurfaceTextureClient::dispatchSetCrop(va_list args) { return setCrop(reinterpret_cast<Rect const*>(rect)); } int SurfaceTextureClient::dispatchSetPostTransformCrop(va_list args) { android_native_rect_t const* rect = va_arg(args, android_native_rect_t*); return setPostTransformCrop(reinterpret_cast<Rect const*>(rect)); } int SurfaceTextureClient::dispatchSetBufferCount(va_list args) { size_t bufferCount = va_arg(args, size_t); return setBufferCount(bufferCount); Loading Loading @@ -501,7 +476,6 @@ int SurfaceTextureClient::disconnect(int api) { mReqHeight = 0; mReqUsage = 0; mCrop.clear(); mCropNeedsTransform = false; mScalingMode = NATIVE_WINDOW_SCALING_MODE_FREEZE; mTransform = 0; if (api == NATIVE_WINDOW_API_CPU) { Loading Loading @@ -535,27 +509,6 @@ int SurfaceTextureClient::setCrop(Rect const* rect) Mutex::Autolock lock(mMutex); mCrop = realRect; mCropNeedsTransform = false; return NO_ERROR; } int SurfaceTextureClient::setPostTransformCrop(Rect const* rect) { ATRACE_CALL(); Rect realRect; if (rect == NULL || rect->isEmpty()) { realRect.clear(); } else { realRect = *rect; } ALOGV("SurfaceTextureClient::setPostTransformCrop rect=[%d %d %d %d]", realRect.left, realRect.top, realRect.right, realRect.bottom); Mutex::Autolock lock(mMutex); mCrop = realRect; mCropNeedsTransform = true; return NO_ERROR; } Loading libs/gui/tests/SurfaceTextureClient_test.cpp +0 −44 Original line number Diff line number Diff line Loading @@ -442,50 +442,6 @@ TEST_F(SurfaceTextureClientTest, SurfaceTextureSyncModeMinUndequeued) { ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[2])); } TEST_F(SurfaceTextureClientTest, SetPostTransformCropUntransforms) { android_native_rect_t rect = {1, 5, 4, 14}; native_window_set_post_transform_crop(mANW.get(), &rect); uint32_t xforms[] = { HAL_TRANSFORM_FLIP_H, HAL_TRANSFORM_FLIP_V, HAL_TRANSFORM_ROT_90, HAL_TRANSFORM_ROT_180, HAL_TRANSFORM_ROT_270, }; Rect expectedRects[] = { Rect(4, 5, 7, 14), // HAL_TRANSFORM_FLIP_H Rect(1, 2, 4, 11), // HAL_TRANSFORM_FLIP_V Rect(5, 4, 14, 7), // HAL_TRANSFORM_ROT_90 Rect(4, 2, 7, 11), // HAL_TRANSFORM_ROT_180 Rect(2, 1, 11, 4), // HAL_TRANSFORM_ROT_270 }; for (size_t i = 0; i < sizeof(xforms)/sizeof(xforms[0]); i++) { SCOPED_TRACE(String8::format("xform=%#x", xforms[i]).string()); int w = 8, h = 16; if (xforms[i] & HAL_TRANSFORM_ROT_90) { w = 16; h = 8; } ASSERT_EQ(OK, native_window_set_buffers_transform(mANW.get(), xforms[i])); ASSERT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), w, h)); android_native_buffer_t* buf; ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf)); ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf)); ASSERT_EQ(OK, mST->updateTexImage()); Rect crop = mST->getCurrentCrop(); EXPECT_EQ(expectedRects[i].left, crop.left); EXPECT_EQ(expectedRects[i].top, crop.top); EXPECT_EQ(expectedRects[i].right, crop.right); EXPECT_EQ(expectedRects[i].bottom, crop.bottom); } } TEST_F(SurfaceTextureClientTest, SetCropCropsCrop) { android_native_rect_t rect = {-2, -13, 40, 18}; native_window_set_crop(mANW.get(), &rect); Loading services/surfaceflinger/Layer.cpp +0 −2 Original line number Diff line number Diff line Loading @@ -528,7 +528,6 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions) mCurrentTransform = transform; mCurrentScalingMode = scalingMode; mFlinger->invalidateHwcGeometry(); recomputeVisibleRegions = true; } uint32_t bufWidth = mActiveBuffer->getWidth(); Loading @@ -537,7 +536,6 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions) if (bufWidth != uint32_t(oldActiveBuffer->width) || bufHeight != uint32_t(oldActiveBuffer->height)) { mFlinger->invalidateHwcGeometry(); recomputeVisibleRegions = true; } } Loading Loading
include/gui/SurfaceTextureClient.h +0 −8 Original line number Diff line number Diff line Loading @@ -104,7 +104,6 @@ protected: virtual int setBuffersTransform(int transform); virtual int setBuffersTimestamp(int64_t timestamp); virtual int setCrop(Rect const* rect); virtual int setPostTransformCrop(Rect const* rect); virtual int setUsage(uint32_t reqUsage); virtual int lock(ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds); virtual int unlockAndPost(); Loading Loading @@ -159,13 +158,6 @@ private: // that gets queued. It is set by calling setCrop. Rect mCrop; // mCropNeedsTransform indicates whether mCrop is in post-transform // coordinates and must be transformed using the inverse of mTransform // before being queued with a buffer. Otherwise the crop is passed // untransformed. It is initialized to false, is set to true by // setPostTransformCrop, and set to false by setCrop. bool mCropNeedsTransform; // mScalingMode is the scaling mode that will be used for the next // buffers that get queued. It is set by calling setScalingMode. int mScalingMode; Loading
libs/gui/BufferQueue.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -495,9 +495,9 @@ status_t BufferQueue::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h, // synchronizing access to it. It's too late at this point to abort the // dequeue operation. if (result == EGL_FALSE) { ALOGE("dequeueBuffer: error waiting for fence: %#x", eglGetError()); ST_LOGE("dequeueBuffer: error waiting for fence: %#x", eglGetError()); } else if (result == EGL_TIMEOUT_EXPIRED_KHR) { ALOGE("dequeueBuffer: timeout waiting for fence"); ST_LOGE("dequeueBuffer: timeout waiting for fence"); } eglDestroySyncKHR(dpy, fence); } Loading
libs/gui/SurfaceTextureClient.cpp +2 −49 Original line number Diff line number Diff line Loading @@ -76,7 +76,6 @@ void SurfaceTextureClient::init() { mReqUsage = 0; mTimestamp = NATIVE_WINDOW_TIMESTAMP_AUTO; mCrop.clear(); mCropNeedsTransform = false; mScalingMode = NATIVE_WINDOW_SCALING_MODE_FREEZE; mTransform = 0; mDefaultWidth = 0; Loading Loading @@ -238,25 +237,9 @@ int SurfaceTextureClient::queueBuffer(android_native_buffer_t* buffer) { return i; } Rect crop(mCrop); if (mCropNeedsTransform) { // The crop rect was specified in the post-transform coordinate space, // so we need to transform that rect by the inverse of mTransform to // put it into the buffer pixel space before queuing it. uint32_t invTransform = mTransform; int32_t width = buffer->width; int32_t height = buffer->height; if (mTransform & NATIVE_WINDOW_TRANSFORM_ROT_90) { invTransform ^= NATIVE_WINDOW_TRANSFORM_FLIP_V | NATIVE_WINDOW_TRANSFORM_FLIP_H; width = buffer->height; height = buffer->width; } crop = mCrop.transform(invTransform, width, height); } // Make sure the crop rectangle is entirely inside the buffer. crop.intersect(Rect(buffer->width, buffer->height), &crop); Rect crop; mCrop.intersect(Rect(buffer->width, buffer->height), &crop); ISurfaceTexture::QueueBufferOutput output; ISurfaceTexture::QueueBufferInput input(timestamp, crop, mScalingMode, Loading Loading @@ -341,9 +324,6 @@ int SurfaceTextureClient::perform(int operation, va_list args) case NATIVE_WINDOW_SET_CROP: res = dispatchSetCrop(args); break; case NATIVE_WINDOW_SET_POST_TRANSFORM_CROP: res = dispatchSetPostTransformCrop(args); break; case NATIVE_WINDOW_SET_BUFFER_COUNT: res = dispatchSetBufferCount(args); break; Loading Loading @@ -407,11 +387,6 @@ int SurfaceTextureClient::dispatchSetCrop(va_list args) { return setCrop(reinterpret_cast<Rect const*>(rect)); } int SurfaceTextureClient::dispatchSetPostTransformCrop(va_list args) { android_native_rect_t const* rect = va_arg(args, android_native_rect_t*); return setPostTransformCrop(reinterpret_cast<Rect const*>(rect)); } int SurfaceTextureClient::dispatchSetBufferCount(va_list args) { size_t bufferCount = va_arg(args, size_t); return setBufferCount(bufferCount); Loading Loading @@ -501,7 +476,6 @@ int SurfaceTextureClient::disconnect(int api) { mReqHeight = 0; mReqUsage = 0; mCrop.clear(); mCropNeedsTransform = false; mScalingMode = NATIVE_WINDOW_SCALING_MODE_FREEZE; mTransform = 0; if (api == NATIVE_WINDOW_API_CPU) { Loading Loading @@ -535,27 +509,6 @@ int SurfaceTextureClient::setCrop(Rect const* rect) Mutex::Autolock lock(mMutex); mCrop = realRect; mCropNeedsTransform = false; return NO_ERROR; } int SurfaceTextureClient::setPostTransformCrop(Rect const* rect) { ATRACE_CALL(); Rect realRect; if (rect == NULL || rect->isEmpty()) { realRect.clear(); } else { realRect = *rect; } ALOGV("SurfaceTextureClient::setPostTransformCrop rect=[%d %d %d %d]", realRect.left, realRect.top, realRect.right, realRect.bottom); Mutex::Autolock lock(mMutex); mCrop = realRect; mCropNeedsTransform = true; return NO_ERROR; } Loading
libs/gui/tests/SurfaceTextureClient_test.cpp +0 −44 Original line number Diff line number Diff line Loading @@ -442,50 +442,6 @@ TEST_F(SurfaceTextureClientTest, SurfaceTextureSyncModeMinUndequeued) { ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[2])); } TEST_F(SurfaceTextureClientTest, SetPostTransformCropUntransforms) { android_native_rect_t rect = {1, 5, 4, 14}; native_window_set_post_transform_crop(mANW.get(), &rect); uint32_t xforms[] = { HAL_TRANSFORM_FLIP_H, HAL_TRANSFORM_FLIP_V, HAL_TRANSFORM_ROT_90, HAL_TRANSFORM_ROT_180, HAL_TRANSFORM_ROT_270, }; Rect expectedRects[] = { Rect(4, 5, 7, 14), // HAL_TRANSFORM_FLIP_H Rect(1, 2, 4, 11), // HAL_TRANSFORM_FLIP_V Rect(5, 4, 14, 7), // HAL_TRANSFORM_ROT_90 Rect(4, 2, 7, 11), // HAL_TRANSFORM_ROT_180 Rect(2, 1, 11, 4), // HAL_TRANSFORM_ROT_270 }; for (size_t i = 0; i < sizeof(xforms)/sizeof(xforms[0]); i++) { SCOPED_TRACE(String8::format("xform=%#x", xforms[i]).string()); int w = 8, h = 16; if (xforms[i] & HAL_TRANSFORM_ROT_90) { w = 16; h = 8; } ASSERT_EQ(OK, native_window_set_buffers_transform(mANW.get(), xforms[i])); ASSERT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), w, h)); android_native_buffer_t* buf; ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf)); ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf)); ASSERT_EQ(OK, mST->updateTexImage()); Rect crop = mST->getCurrentCrop(); EXPECT_EQ(expectedRects[i].left, crop.left); EXPECT_EQ(expectedRects[i].top, crop.top); EXPECT_EQ(expectedRects[i].right, crop.right); EXPECT_EQ(expectedRects[i].bottom, crop.bottom); } } TEST_F(SurfaceTextureClientTest, SetCropCropsCrop) { android_native_rect_t rect = {-2, -13, 40, 18}; native_window_set_crop(mANW.get(), &rect); Loading
services/surfaceflinger/Layer.cpp +0 −2 Original line number Diff line number Diff line Loading @@ -528,7 +528,6 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions) mCurrentTransform = transform; mCurrentScalingMode = scalingMode; mFlinger->invalidateHwcGeometry(); recomputeVisibleRegions = true; } uint32_t bufWidth = mActiveBuffer->getWidth(); Loading @@ -537,7 +536,6 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions) if (bufWidth != uint32_t(oldActiveBuffer->width) || bufHeight != uint32_t(oldActiveBuffer->height)) { mFlinger->invalidateHwcGeometry(); recomputeVisibleRegions = true; } } Loading