Loading include/gui/BufferQueue.h +0 −13 Original line number Original line Diff line number Diff line Loading @@ -170,7 +170,6 @@ public: mFrameNumber(0), mFrameNumber(0), mBuf(INVALID_BUFFER_SLOT) { mBuf(INVALID_BUFFER_SLOT) { mCrop.makeInvalid(); mCrop.makeInvalid(); mActiveRect.makeInvalid(); } } // mGraphicBuffer points to the buffer allocated for this slot or is NULL // mGraphicBuffer points to the buffer allocated for this slot or is NULL // if no buffer has been allocated. // if no buffer has been allocated. Loading @@ -194,11 +193,6 @@ public: // mBuf is the slot index of this buffer // mBuf is the slot index of this buffer int mBuf; int mBuf; // mActiveRect is the active rectangle for the buffer. Pixels outside // this rectangle are considered completely transparent for the purposes // of window composition. Rect mActiveRect; }; }; // The following public functions is the consumer facing interface // The following public functions is the consumer facing interface Loading Loading @@ -302,7 +296,6 @@ private: mAcquireCalled(false), mAcquireCalled(false), mNeedsCleanupOnRelease(false) { mNeedsCleanupOnRelease(false) { mCrop.makeInvalid(); mCrop.makeInvalid(); mActiveRect.makeInvalid(); } } // mGraphicBuffer points to the buffer allocated for this slot or is NULL // mGraphicBuffer points to the buffer allocated for this slot or is NULL Loading Loading @@ -359,12 +352,6 @@ private: // mCrop is the current crop rectangle for this buffer slot. // mCrop is the current crop rectangle for this buffer slot. Rect mCrop; Rect mCrop; // mActiveRect is the current active rectangle for this buffer slot. // Pixels outside of this rectangle are to be treated as completely // transparent during window composition. The rectangle is in buffer // pixel coordinates. Rect mActiveRect; // mTransform is the current transform flags for this buffer slot. // mTransform is the current transform flags for this buffer slot. uint32_t mTransform; uint32_t mTransform; Loading include/gui/ISurfaceTexture.h +3 −7 Original line number Original line Diff line number Diff line Loading @@ -86,25 +86,21 @@ protected: // QueueBufferInput must be a POD structure // QueueBufferInput must be a POD structure struct QueueBufferInput { struct QueueBufferInput { inline QueueBufferInput(int64_t timestamp, inline QueueBufferInput(int64_t timestamp, const Rect& crop, int scalingMode, uint32_t transform, const Rect& crop, int scalingMode, uint32_t transform) const Rect& activeRect) : timestamp(timestamp), crop(crop), scalingMode(scalingMode), : timestamp(timestamp), crop(crop), scalingMode(scalingMode), transform(transform), activeRect(activeRect) { } transform(transform) { } inline void deflate(int64_t* outTimestamp, Rect* outCrop, inline void deflate(int64_t* outTimestamp, Rect* outCrop, int* outScalingMode, uint32_t* outTransform, int* outScalingMode, uint32_t* outTransform) const { Rect* outActiveRect) const { *outTimestamp = timestamp; *outTimestamp = timestamp; *outCrop = crop; *outCrop = crop; *outScalingMode = scalingMode; *outScalingMode = scalingMode; *outTransform = transform; *outTransform = transform; *outActiveRect = activeRect; } } private: private: int64_t timestamp; int64_t timestamp; Rect crop; Rect crop; int scalingMode; int scalingMode; uint32_t transform; uint32_t transform; Rect activeRect; }; }; // QueueBufferOutput must be a POD structure // QueueBufferOutput must be a POD structure Loading include/gui/SurfaceTexture.h +0 −9 Original line number Original line Diff line number Diff line Loading @@ -154,9 +154,6 @@ public: // getCurrentCrop returns the cropping rectangle of the current buffer. // getCurrentCrop returns the cropping rectangle of the current buffer. Rect getCurrentCrop() const; Rect getCurrentCrop() const; // getCurrentActiveRect returns the active rectangle of the current buffer. Rect getCurrentActiveRect() const; // getCurrentTransform returns the transform of the current buffer. // getCurrentTransform returns the transform of the current buffer. uint32_t getCurrentTransform() const; uint32_t getCurrentTransform() const; Loading Loading @@ -273,12 +270,6 @@ private: // It gets set each time updateTexImage is called. // It gets set each time updateTexImage is called. Rect mCurrentCrop; Rect mCurrentCrop; // mCurrentActiveRect is the active rectangle that applies to the current // texture. It gets set each time updateTexImage is called. All pixels // outside the active rectangle are be considered completely transparent for // the purpose of window composition. Rect mCurrentActiveRect; // mCurrentTransform is the transform identifier for the current texture. It // mCurrentTransform is the transform identifier for the current texture. It // gets set each time updateTexImage is called. // gets set each time updateTexImage is called. uint32_t mCurrentTransform; uint32_t mCurrentTransform; Loading include/gui/SurfaceTextureClient.h +9 −6 Original line number Original line Diff line number Diff line Loading @@ -80,10 +80,10 @@ private: int dispatchSetBuffersTransform(va_list args); int dispatchSetBuffersTransform(va_list args); int dispatchSetBuffersTimestamp(va_list args); int dispatchSetBuffersTimestamp(va_list args); int dispatchSetCrop(va_list args); int dispatchSetCrop(va_list args); int dispatchSetPostTransformCrop(va_list args); int dispatchSetUsage(va_list args); int dispatchSetUsage(va_list args); int dispatchLock(va_list args); int dispatchLock(va_list args); int dispatchUnlockAndPost(va_list args); int dispatchUnlockAndPost(va_list args); int dispatchSetActiveRect(va_list args); protected: protected: virtual int cancelBuffer(ANativeWindowBuffer* buffer); virtual int cancelBuffer(ANativeWindowBuffer* buffer); Loading @@ -104,10 +104,10 @@ protected: virtual int setBuffersTransform(int transform); virtual int setBuffersTransform(int transform); virtual int setBuffersTimestamp(int64_t timestamp); virtual int setBuffersTimestamp(int64_t timestamp); virtual int setCrop(Rect const* rect); virtual int setCrop(Rect const* rect); virtual int setPostTransformCrop(Rect const* rect); virtual int setUsage(uint32_t reqUsage); virtual int setUsage(uint32_t reqUsage); virtual int lock(ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds); virtual int lock(ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds); virtual int unlockAndPost(); virtual int unlockAndPost(); virtual int setActiveRect(Rect const* rect); enum { NUM_BUFFER_SLOTS = BufferQueue::NUM_BUFFER_SLOTS }; enum { NUM_BUFFER_SLOTS = BufferQueue::NUM_BUFFER_SLOTS }; enum { DEFAULT_FORMAT = PIXEL_FORMAT_RGBA_8888 }; enum { DEFAULT_FORMAT = PIXEL_FORMAT_RGBA_8888 }; Loading Loading @@ -159,6 +159,13 @@ private: // that gets queued. It is set by calling setCrop. // that gets queued. It is set by calling setCrop. Rect mCrop; 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 // mScalingMode is the scaling mode that will be used for the next // buffers that get queued. It is set by calling setScalingMode. // buffers that get queued. It is set by calling setScalingMode. int mScalingMode; int mScalingMode; Loading @@ -167,10 +174,6 @@ private: // buffer that gets queued. It is set by calling setTransform. // buffer that gets queued. It is set by calling setTransform. uint32_t mTransform; uint32_t mTransform; // mActiveRect is the active rectangle that will be used for the next buffer // that gets queued. It is set by calling setActiveRect. Rect mActiveRect; // mDefaultWidth is default width of the buffers, regardless of the // mDefaultWidth is default width of the buffers, regardless of the // native_window_set_buffers_dimensions call. // native_window_set_buffers_dimensions call. uint32_t mDefaultWidth; uint32_t mDefaultWidth; Loading libs/gui/BufferQueue.cpp +14 −9 Original line number Original line Diff line number Diff line Loading @@ -540,15 +540,11 @@ status_t BufferQueue::queueBuffer(int buf, uint32_t transform; uint32_t transform; int scalingMode; int scalingMode; int64_t timestamp; int64_t timestamp; Rect activeRect; input.deflate(×tamp, &crop, &scalingMode, &transform, input.deflate(×tamp, &crop, &scalingMode, &transform); &activeRect); ST_LOGV("queueBuffer: slot=%d time=%lld crop=[%d,%d,%d,%d] " ST_LOGV("queueBuffer: slot=%d time=%lld crop=[%d,%d,%d,%d]", "active=[%d,%d,%d,%d]", buf, timestamp, crop.left, crop.top, buf, timestamp, crop.left, crop.top, crop.right, crop.bottom); crop.right, crop.bottom, activeRect.left, activeRect.top, activeRect.right, activeRect.bottom); sp<ConsumerListener> listener; sp<ConsumerListener> listener; Loading @@ -572,6 +568,16 @@ status_t BufferQueue::queueBuffer(int buf, return -EINVAL; return -EINVAL; } } const sp<GraphicBuffer>& graphicBuffer(mSlots[buf].mGraphicBuffer); Rect bufferRect(graphicBuffer->getWidth(), graphicBuffer->getHeight()); Rect croppedCrop; crop.intersect(bufferRect, &croppedCrop); if (croppedCrop != crop) { ST_LOGE("queueBuffer: crop rect is not contained within the " "buffer in slot %d", buf); return -EINVAL; } if (mSynchronousMode) { if (mSynchronousMode) { // In synchronous mode we queue all buffers in a FIFO. // In synchronous mode we queue all buffers in a FIFO. mQueue.push_back(buf); mQueue.push_back(buf); Loading Loading @@ -600,12 +606,12 @@ status_t BufferQueue::queueBuffer(int buf, mSlots[buf].mTimestamp = timestamp; mSlots[buf].mTimestamp = timestamp; mSlots[buf].mCrop = crop; mSlots[buf].mCrop = crop; mSlots[buf].mTransform = transform; mSlots[buf].mTransform = transform; mSlots[buf].mActiveRect = activeRect; switch (scalingMode) { switch (scalingMode) { case NATIVE_WINDOW_SCALING_MODE_FREEZE: case NATIVE_WINDOW_SCALING_MODE_FREEZE: case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW: case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW: case NATIVE_WINDOW_SCALING_MODE_SCALE_CROP: case NATIVE_WINDOW_SCALING_MODE_SCALE_CROP: case NATIVE_WINDOW_SCALING_MODE_NO_SCALE_CROP: break; break; default: default: ST_LOGE("unknown scaling mode: %d (ignoring)", scalingMode); ST_LOGE("unknown scaling mode: %d (ignoring)", scalingMode); Loading Loading @@ -859,7 +865,6 @@ status_t BufferQueue::acquireBuffer(BufferItem *buffer) { buffer->mFrameNumber = mSlots[buf].mFrameNumber; buffer->mFrameNumber = mSlots[buf].mFrameNumber; buffer->mTimestamp = mSlots[buf].mTimestamp; buffer->mTimestamp = mSlots[buf].mTimestamp; buffer->mBuf = buf; buffer->mBuf = buf; buffer->mActiveRect = mSlots[buf].mActiveRect; mSlots[buf].mAcquireCalled = true; mSlots[buf].mAcquireCalled = true; mSlots[buf].mBufferState = BufferSlot::ACQUIRED; mSlots[buf].mBufferState = BufferSlot::ACQUIRED; Loading Loading
include/gui/BufferQueue.h +0 −13 Original line number Original line Diff line number Diff line Loading @@ -170,7 +170,6 @@ public: mFrameNumber(0), mFrameNumber(0), mBuf(INVALID_BUFFER_SLOT) { mBuf(INVALID_BUFFER_SLOT) { mCrop.makeInvalid(); mCrop.makeInvalid(); mActiveRect.makeInvalid(); } } // mGraphicBuffer points to the buffer allocated for this slot or is NULL // mGraphicBuffer points to the buffer allocated for this slot or is NULL // if no buffer has been allocated. // if no buffer has been allocated. Loading @@ -194,11 +193,6 @@ public: // mBuf is the slot index of this buffer // mBuf is the slot index of this buffer int mBuf; int mBuf; // mActiveRect is the active rectangle for the buffer. Pixels outside // this rectangle are considered completely transparent for the purposes // of window composition. Rect mActiveRect; }; }; // The following public functions is the consumer facing interface // The following public functions is the consumer facing interface Loading Loading @@ -302,7 +296,6 @@ private: mAcquireCalled(false), mAcquireCalled(false), mNeedsCleanupOnRelease(false) { mNeedsCleanupOnRelease(false) { mCrop.makeInvalid(); mCrop.makeInvalid(); mActiveRect.makeInvalid(); } } // mGraphicBuffer points to the buffer allocated for this slot or is NULL // mGraphicBuffer points to the buffer allocated for this slot or is NULL Loading Loading @@ -359,12 +352,6 @@ private: // mCrop is the current crop rectangle for this buffer slot. // mCrop is the current crop rectangle for this buffer slot. Rect mCrop; Rect mCrop; // mActiveRect is the current active rectangle for this buffer slot. // Pixels outside of this rectangle are to be treated as completely // transparent during window composition. The rectangle is in buffer // pixel coordinates. Rect mActiveRect; // mTransform is the current transform flags for this buffer slot. // mTransform is the current transform flags for this buffer slot. uint32_t mTransform; uint32_t mTransform; Loading
include/gui/ISurfaceTexture.h +3 −7 Original line number Original line Diff line number Diff line Loading @@ -86,25 +86,21 @@ protected: // QueueBufferInput must be a POD structure // QueueBufferInput must be a POD structure struct QueueBufferInput { struct QueueBufferInput { inline QueueBufferInput(int64_t timestamp, inline QueueBufferInput(int64_t timestamp, const Rect& crop, int scalingMode, uint32_t transform, const Rect& crop, int scalingMode, uint32_t transform) const Rect& activeRect) : timestamp(timestamp), crop(crop), scalingMode(scalingMode), : timestamp(timestamp), crop(crop), scalingMode(scalingMode), transform(transform), activeRect(activeRect) { } transform(transform) { } inline void deflate(int64_t* outTimestamp, Rect* outCrop, inline void deflate(int64_t* outTimestamp, Rect* outCrop, int* outScalingMode, uint32_t* outTransform, int* outScalingMode, uint32_t* outTransform) const { Rect* outActiveRect) const { *outTimestamp = timestamp; *outTimestamp = timestamp; *outCrop = crop; *outCrop = crop; *outScalingMode = scalingMode; *outScalingMode = scalingMode; *outTransform = transform; *outTransform = transform; *outActiveRect = activeRect; } } private: private: int64_t timestamp; int64_t timestamp; Rect crop; Rect crop; int scalingMode; int scalingMode; uint32_t transform; uint32_t transform; Rect activeRect; }; }; // QueueBufferOutput must be a POD structure // QueueBufferOutput must be a POD structure Loading
include/gui/SurfaceTexture.h +0 −9 Original line number Original line Diff line number Diff line Loading @@ -154,9 +154,6 @@ public: // getCurrentCrop returns the cropping rectangle of the current buffer. // getCurrentCrop returns the cropping rectangle of the current buffer. Rect getCurrentCrop() const; Rect getCurrentCrop() const; // getCurrentActiveRect returns the active rectangle of the current buffer. Rect getCurrentActiveRect() const; // getCurrentTransform returns the transform of the current buffer. // getCurrentTransform returns the transform of the current buffer. uint32_t getCurrentTransform() const; uint32_t getCurrentTransform() const; Loading Loading @@ -273,12 +270,6 @@ private: // It gets set each time updateTexImage is called. // It gets set each time updateTexImage is called. Rect mCurrentCrop; Rect mCurrentCrop; // mCurrentActiveRect is the active rectangle that applies to the current // texture. It gets set each time updateTexImage is called. All pixels // outside the active rectangle are be considered completely transparent for // the purpose of window composition. Rect mCurrentActiveRect; // mCurrentTransform is the transform identifier for the current texture. It // mCurrentTransform is the transform identifier for the current texture. It // gets set each time updateTexImage is called. // gets set each time updateTexImage is called. uint32_t mCurrentTransform; uint32_t mCurrentTransform; Loading
include/gui/SurfaceTextureClient.h +9 −6 Original line number Original line Diff line number Diff line Loading @@ -80,10 +80,10 @@ private: int dispatchSetBuffersTransform(va_list args); int dispatchSetBuffersTransform(va_list args); int dispatchSetBuffersTimestamp(va_list args); int dispatchSetBuffersTimestamp(va_list args); int dispatchSetCrop(va_list args); int dispatchSetCrop(va_list args); int dispatchSetPostTransformCrop(va_list args); int dispatchSetUsage(va_list args); int dispatchSetUsage(va_list args); int dispatchLock(va_list args); int dispatchLock(va_list args); int dispatchUnlockAndPost(va_list args); int dispatchUnlockAndPost(va_list args); int dispatchSetActiveRect(va_list args); protected: protected: virtual int cancelBuffer(ANativeWindowBuffer* buffer); virtual int cancelBuffer(ANativeWindowBuffer* buffer); Loading @@ -104,10 +104,10 @@ protected: virtual int setBuffersTransform(int transform); virtual int setBuffersTransform(int transform); virtual int setBuffersTimestamp(int64_t timestamp); virtual int setBuffersTimestamp(int64_t timestamp); virtual int setCrop(Rect const* rect); virtual int setCrop(Rect const* rect); virtual int setPostTransformCrop(Rect const* rect); virtual int setUsage(uint32_t reqUsage); virtual int setUsage(uint32_t reqUsage); virtual int lock(ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds); virtual int lock(ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds); virtual int unlockAndPost(); virtual int unlockAndPost(); virtual int setActiveRect(Rect const* rect); enum { NUM_BUFFER_SLOTS = BufferQueue::NUM_BUFFER_SLOTS }; enum { NUM_BUFFER_SLOTS = BufferQueue::NUM_BUFFER_SLOTS }; enum { DEFAULT_FORMAT = PIXEL_FORMAT_RGBA_8888 }; enum { DEFAULT_FORMAT = PIXEL_FORMAT_RGBA_8888 }; Loading Loading @@ -159,6 +159,13 @@ private: // that gets queued. It is set by calling setCrop. // that gets queued. It is set by calling setCrop. Rect mCrop; 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 // mScalingMode is the scaling mode that will be used for the next // buffers that get queued. It is set by calling setScalingMode. // buffers that get queued. It is set by calling setScalingMode. int mScalingMode; int mScalingMode; Loading @@ -167,10 +174,6 @@ private: // buffer that gets queued. It is set by calling setTransform. // buffer that gets queued. It is set by calling setTransform. uint32_t mTransform; uint32_t mTransform; // mActiveRect is the active rectangle that will be used for the next buffer // that gets queued. It is set by calling setActiveRect. Rect mActiveRect; // mDefaultWidth is default width of the buffers, regardless of the // mDefaultWidth is default width of the buffers, regardless of the // native_window_set_buffers_dimensions call. // native_window_set_buffers_dimensions call. uint32_t mDefaultWidth; uint32_t mDefaultWidth; Loading
libs/gui/BufferQueue.cpp +14 −9 Original line number Original line Diff line number Diff line Loading @@ -540,15 +540,11 @@ status_t BufferQueue::queueBuffer(int buf, uint32_t transform; uint32_t transform; int scalingMode; int scalingMode; int64_t timestamp; int64_t timestamp; Rect activeRect; input.deflate(×tamp, &crop, &scalingMode, &transform, input.deflate(×tamp, &crop, &scalingMode, &transform); &activeRect); ST_LOGV("queueBuffer: slot=%d time=%lld crop=[%d,%d,%d,%d] " ST_LOGV("queueBuffer: slot=%d time=%lld crop=[%d,%d,%d,%d]", "active=[%d,%d,%d,%d]", buf, timestamp, crop.left, crop.top, buf, timestamp, crop.left, crop.top, crop.right, crop.bottom); crop.right, crop.bottom, activeRect.left, activeRect.top, activeRect.right, activeRect.bottom); sp<ConsumerListener> listener; sp<ConsumerListener> listener; Loading @@ -572,6 +568,16 @@ status_t BufferQueue::queueBuffer(int buf, return -EINVAL; return -EINVAL; } } const sp<GraphicBuffer>& graphicBuffer(mSlots[buf].mGraphicBuffer); Rect bufferRect(graphicBuffer->getWidth(), graphicBuffer->getHeight()); Rect croppedCrop; crop.intersect(bufferRect, &croppedCrop); if (croppedCrop != crop) { ST_LOGE("queueBuffer: crop rect is not contained within the " "buffer in slot %d", buf); return -EINVAL; } if (mSynchronousMode) { if (mSynchronousMode) { // In synchronous mode we queue all buffers in a FIFO. // In synchronous mode we queue all buffers in a FIFO. mQueue.push_back(buf); mQueue.push_back(buf); Loading Loading @@ -600,12 +606,12 @@ status_t BufferQueue::queueBuffer(int buf, mSlots[buf].mTimestamp = timestamp; mSlots[buf].mTimestamp = timestamp; mSlots[buf].mCrop = crop; mSlots[buf].mCrop = crop; mSlots[buf].mTransform = transform; mSlots[buf].mTransform = transform; mSlots[buf].mActiveRect = activeRect; switch (scalingMode) { switch (scalingMode) { case NATIVE_WINDOW_SCALING_MODE_FREEZE: case NATIVE_WINDOW_SCALING_MODE_FREEZE: case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW: case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW: case NATIVE_WINDOW_SCALING_MODE_SCALE_CROP: case NATIVE_WINDOW_SCALING_MODE_SCALE_CROP: case NATIVE_WINDOW_SCALING_MODE_NO_SCALE_CROP: break; break; default: default: ST_LOGE("unknown scaling mode: %d (ignoring)", scalingMode); ST_LOGE("unknown scaling mode: %d (ignoring)", scalingMode); Loading Loading @@ -859,7 +865,6 @@ status_t BufferQueue::acquireBuffer(BufferItem *buffer) { buffer->mFrameNumber = mSlots[buf].mFrameNumber; buffer->mFrameNumber = mSlots[buf].mFrameNumber; buffer->mTimestamp = mSlots[buf].mTimestamp; buffer->mTimestamp = mSlots[buf].mTimestamp; buffer->mBuf = buf; buffer->mBuf = buf; buffer->mActiveRect = mSlots[buf].mActiveRect; mSlots[buf].mAcquireCalled = true; mSlots[buf].mAcquireCalled = true; mSlots[buf].mBufferState = BufferSlot::ACQUIRED; mSlots[buf].mBufferState = BufferSlot::ACQUIRED; Loading