Merge "Refactored query function from SurfaceTexture into BufferQueue"
This commit is contained in:
commit
1eea29f48d
@ -60,6 +60,8 @@ public:
|
||||
BufferQueue(bool allowSynchronousMode = true);
|
||||
virtual ~BufferQueue();
|
||||
|
||||
virtual int query(int what, int* value);
|
||||
|
||||
// setBufferCount updates the number of available buffer slots. After
|
||||
// calling this all buffer slots are both unallocated and owned by the
|
||||
// BufferQueue object (i.e. they are not owned by the client).
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
|
||||
virtual ~SurfaceTexture();
|
||||
|
||||
virtual int query(int what, int* value);
|
||||
|
||||
|
||||
// updateTexImage sets the image contents of the target texture to that of
|
||||
// the most recently queued buffer.
|
||||
|
@ -166,6 +166,37 @@ status_t BufferQueue::setBufferCount(int bufferCount) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int BufferQueue::query(int what, int* outValue)
|
||||
{
|
||||
Mutex::Autolock lock(mMutex);
|
||||
|
||||
if (mAbandoned) {
|
||||
ST_LOGE("query: SurfaceTexture has been abandoned!");
|
||||
return NO_INIT;
|
||||
}
|
||||
|
||||
int value;
|
||||
switch (what) {
|
||||
case NATIVE_WINDOW_WIDTH:
|
||||
value = mDefaultWidth;
|
||||
break;
|
||||
case NATIVE_WINDOW_HEIGHT:
|
||||
value = mDefaultHeight;
|
||||
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;
|
||||
}
|
||||
|
||||
status_t BufferQueue::requestBuffer(int slot, sp<GraphicBuffer>* buf) {
|
||||
ST_LOGV("requestBuffer: slot=%d", slot);
|
||||
Mutex::Autolock lock(mMutex);
|
||||
|
@ -416,36 +416,7 @@ bool SurfaceTexture::isSynchronousMode() const {
|
||||
return mSynchronousMode;
|
||||
}
|
||||
|
||||
int SurfaceTexture::query(int what, int* outValue)
|
||||
{
|
||||
Mutex::Autolock lock(mMutex);
|
||||
|
||||
if (mAbandoned) {
|
||||
ST_LOGE("query: SurfaceTexture has been abandoned!");
|
||||
return NO_INIT;
|
||||
}
|
||||
|
||||
int value;
|
||||
switch (what) {
|
||||
case NATIVE_WINDOW_WIDTH:
|
||||
value = mDefaultWidth;
|
||||
break;
|
||||
case NATIVE_WINDOW_HEIGHT:
|
||||
value = mDefaultHeight;
|
||||
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;
|
||||
}
|
||||
|
||||
void SurfaceTexture::abandon() {
|
||||
Mutex::Autolock lock(mMutex);
|
||||
|
Loading…
Reference in New Issue
Block a user