Refactored query function from SurfaceTexture into BufferQueue
Change-Id: Id1cb6cc38d01edb4fcfcad867c5a7693bdcc3ab1
This commit is contained in:
parent
9e4b89486e
commit
b856052c00
|
@ -60,6 +60,8 @@ public:
|
||||||
BufferQueue(bool allowSynchronousMode = true);
|
BufferQueue(bool allowSynchronousMode = true);
|
||||||
virtual ~BufferQueue();
|
virtual ~BufferQueue();
|
||||||
|
|
||||||
|
virtual int query(int what, int* value);
|
||||||
|
|
||||||
// setBufferCount updates the number of available buffer slots. After
|
// setBufferCount updates the number of available buffer slots. After
|
||||||
// calling this all buffer slots are both unallocated and owned by the
|
// calling this all buffer slots are both unallocated and owned by the
|
||||||
// BufferQueue object (i.e. they are not owned by the client).
|
// BufferQueue object (i.e. they are not owned by the client).
|
||||||
|
|
|
@ -55,7 +55,7 @@ public:
|
||||||
|
|
||||||
virtual ~SurfaceTexture();
|
virtual ~SurfaceTexture();
|
||||||
|
|
||||||
virtual int query(int what, int* value);
|
|
||||||
|
|
||||||
// updateTexImage sets the image contents of the target texture to that of
|
// updateTexImage sets the image contents of the target texture to that of
|
||||||
// the most recently queued buffer.
|
// the most recently queued buffer.
|
||||||
|
|
|
@ -166,6 +166,37 @@ status_t BufferQueue::setBufferCount(int bufferCount) {
|
||||||
return OK;
|
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) {
|
status_t BufferQueue::requestBuffer(int slot, sp<GraphicBuffer>* buf) {
|
||||||
ST_LOGV("requestBuffer: slot=%d", slot);
|
ST_LOGV("requestBuffer: slot=%d", slot);
|
||||||
Mutex::Autolock lock(mMutex);
|
Mutex::Autolock lock(mMutex);
|
||||||
|
|
|
@ -416,36 +416,7 @@ bool SurfaceTexture::isSynchronousMode() const {
|
||||||
return mSynchronousMode;
|
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() {
|
void SurfaceTexture::abandon() {
|
||||||
Mutex::Autolock lock(mMutex);
|
Mutex::Autolock lock(mMutex);
|
||||||
|
|
Loading…
Reference in New Issue