GLConsumer: Stop using default constructor params

Removes the dependency on default constructor parameters for
GLConsumer so that a different constructor prototype can safely be
added.

Change-Id: I0da924bbd4c141edbf305598c1be8bc575654680
This commit is contained in:
Dan Stoza 2014-06-24 13:09:19 -07:00
parent b410863d6a
commit e49ba8e2ed
6 changed files with 13 additions and 10 deletions

View File

@ -205,7 +205,7 @@ bool GLHelper::createNamedSurfaceTexture(GLuint name, uint32_t w, uint32_t h,
sp<IGraphicBufferConsumer> consumer; sp<IGraphicBufferConsumer> consumer;
BufferQueue::createBufferQueue(&producer, &consumer, mGraphicBufferAlloc); BufferQueue::createBufferQueue(&producer, &consumer, mGraphicBufferAlloc);
sp<GLConsumer> glc = new GLConsumer(consumer, name, sp<GLConsumer> glc = new GLConsumer(consumer, name,
GL_TEXTURE_EXTERNAL_OES, false); GL_TEXTURE_EXTERNAL_OES, false, true);
glc->setDefaultBufferSize(w, h); glc->setDefaultBufferSize(w, h);
glc->setDefaultMaxBufferCount(3); glc->setDefaultMaxBufferCount(3);
glc->setConsumerUsageBits(GRALLOC_USAGE_HW_COMPOSER); glc->setConsumerUsageBits(GRALLOC_USAGE_HW_COMPOSER);

View File

@ -52,9 +52,8 @@ class String8;
* This class was previously called SurfaceTexture. * This class was previously called SurfaceTexture.
*/ */
class GLConsumer : public ConsumerBase { class GLConsumer : public ConsumerBase {
protected:
enum { TEXTURE_EXTERNAL = 0x8D65 }; // GL_TEXTURE_EXTERNAL_OES
public: public:
enum { TEXTURE_EXTERNAL = 0x8D65 }; // GL_TEXTURE_EXTERNAL_OES
typedef ConsumerBase::FrameAvailableListener FrameAvailableListener; typedef ConsumerBase::FrameAvailableListener FrameAvailableListener;
// GLConsumer constructs a new GLConsumer object. tex indicates the // GLConsumer constructs a new GLConsumer object. tex indicates the
@ -82,8 +81,8 @@ public:
// context to another. If such a transfer is not needed there is no // context to another. If such a transfer is not needed there is no
// requirement that either of these methods be called. // requirement that either of these methods be called.
GLConsumer(const sp<IGraphicBufferConsumer>& bq, GLConsumer(const sp<IGraphicBufferConsumer>& bq,
uint32_t tex, uint32_t texureTarget = TEXTURE_EXTERNAL, uint32_t tex, uint32_t texureTarget, bool useFenceSync,
bool useFenceSync = true, bool isControlledByApp = false); bool isControlledByApp);
// updateTexImage acquires the most recently queued buffer, and sets the // updateTexImage acquires the most recently queued buffer, and sets the
// image contents of the target texture to it. // image contents of the target texture to it.

View File

@ -37,7 +37,8 @@ protected:
sp<IGraphicBufferProducer> producer; sp<IGraphicBufferProducer> producer;
sp<IGraphicBufferConsumer> consumer; sp<IGraphicBufferConsumer> consumer;
BufferQueue::createBufferQueue(&producer, &consumer); BufferQueue::createBufferQueue(&producer, &consumer);
mGlConsumer = new GLConsumer(consumer, TEX_ID); mGlConsumer = new GLConsumer(consumer, TEX_ID,
GLConsumer::TEXTURE_EXTERNAL, true, false);
mSurface = new Surface(producer); mSurface = new Surface(producer);
mANW = mSurface.get(); mANW = mSurface.get();

View File

@ -46,7 +46,8 @@ protected:
sp<IGraphicBufferProducer> producer; sp<IGraphicBufferProducer> producer;
sp<IGraphicBufferConsumer> consumer; sp<IGraphicBufferConsumer> consumer;
BufferQueue::createBufferQueue(&producer, &consumer); BufferQueue::createBufferQueue(&producer, &consumer);
mST = new GLConsumer(consumer, 123); mST = new GLConsumer(consumer, 123, GLConsumer::TEXTURE_EXTERNAL, true,
false);
mSTC = new Surface(producer); mSTC = new Surface(producer);
mANW = mSTC; mANW = mSTC;
@ -716,7 +717,8 @@ protected:
sp<IGraphicBufferProducer> producer; sp<IGraphicBufferProducer> producer;
sp<IGraphicBufferConsumer> consumer; sp<IGraphicBufferConsumer> consumer;
BufferQueue::createBufferQueue(&producer, &consumer); BufferQueue::createBufferQueue(&producer, &consumer);
sp<GLConsumer> st(new GLConsumer(consumer, i)); sp<GLConsumer> st(new GLConsumer(consumer, i,
GLConsumer::TEXTURE_EXTERNAL, true, false));
sp<Surface> stc(new Surface(producer)); sp<Surface> stc(new Surface(producer));
mEglSurfaces[i] = eglCreateWindowSurface(mEglDisplay, myConfig, mEglSurfaces[i] = eglCreateWindowSurface(mEglDisplay, myConfig,
static_cast<ANativeWindow*>(stc.get()), NULL); static_cast<ANativeWindow*>(stc.get()), NULL);

View File

@ -39,7 +39,8 @@ protected:
GLTest::SetUp(); GLTest::SetUp();
sp<IGraphicBufferProducer> producer; sp<IGraphicBufferProducer> producer;
BufferQueue::createBufferQueue(&producer, &mConsumer); BufferQueue::createBufferQueue(&producer, &mConsumer);
mST = new GLConsumer(mConsumer, TEX_ID); mST = new GLConsumer(mConsumer, TEX_ID, GLConsumer::TEXTURE_EXTERNAL,
true, false);
mSTC = new Surface(producer); mSTC = new Surface(producer);
mANW = mSTC; mANW = mSTC;
mTextureRenderer = new TextureRenderer(TEX_ID, mST); mTextureRenderer = new TextureRenderer(TEX_ID, mST);

View File

@ -34,7 +34,7 @@ public:
SurfaceFlingerConsumer(const sp<IGraphicBufferConsumer>& consumer, SurfaceFlingerConsumer(const sp<IGraphicBufferConsumer>& consumer,
uint32_t tex) uint32_t tex)
: GLConsumer(consumer, tex, GLConsumer::TEXTURE_EXTERNAL, false), : GLConsumer(consumer, tex, GLConsumer::TEXTURE_EXTERNAL, false, false),
mTransformToDisplayInverse(false) mTransformToDisplayInverse(false)
{} {}