Rename ISurfaceTexture and SurfaceTexture
The C++ class names don't match what the classes do, so rename
ISurfaceTexture to IGraphicBufferProducer, and SurfaceTexture to
GLConsumer.
Bug 7736700
Change-Id: Ia03e468888025b5cae3c0ee1995434515dbea387
diff --git a/include/gui/BufferItemConsumer.h b/include/gui/BufferItemConsumer.h
index cd4df25..0840891 100644
--- a/include/gui/BufferItemConsumer.h
+++ b/include/gui/BufferItemConsumer.h
@@ -82,7 +82,7 @@
status_t releaseBuffer(const BufferItem &item,
const sp<Fence>& releaseFence = Fence::NO_FENCE);
- sp<ISurfaceTexture> getProducerInterface() const { return getBufferQueue(); }
+ sp<IGraphicBufferProducer> getProducerInterface() const { return getBufferQueue(); }
};
diff --git a/include/gui/BufferQueue.h b/include/gui/BufferQueue.h
index 88bcd8f..c59e00e 100644
--- a/include/gui/BufferQueue.h
+++ b/include/gui/BufferQueue.h
@@ -21,7 +21,7 @@
#include <EGL/eglext.h>
#include <gui/IGraphicBufferAlloc.h>
-#include <gui/ISurfaceTexture.h>
+#include <gui/IGraphicBufferProducer.h>
#include <ui/Fence.h>
#include <ui/GraphicBuffer.h>
@@ -33,7 +33,7 @@
namespace android {
// ----------------------------------------------------------------------------
-class BufferQueue : public BnSurfaceTexture {
+class BufferQueue : public BnGraphicBufferProducer {
public:
enum { MIN_UNDEQUEUED_BUFFERS = 2 };
enum { NUM_BUFFER_SLOTS = 32 };
@@ -149,7 +149,7 @@
virtual status_t setSynchronousMode(bool enabled);
// connect attempts to connect a producer client API to the BufferQueue.
- // This must be called before any other ISurfaceTexture methods are called
+ // This must be called before any other IGraphicBufferProducer methods are called
// except for getAllocator.
//
// This method will fail if the connect was previously called on the
@@ -158,7 +158,7 @@
// disconnect attempts to disconnect a producer client API from the
// BufferQueue. Calling this method will cause any subsequent calls to other
- // ISurfaceTexture methods to fail except for getAllocator and connect.
+ // IGraphicBufferProducer methods to fail except for getAllocator and connect.
// Successfully calling connect after this will allow the other methods to
// succeed again.
//
@@ -265,7 +265,7 @@
// producer is connected to the BufferQueue.
status_t setMaxAcquiredBufferCount(int maxAcquiredBuffers);
- // isSynchronousMode returns whether the SurfaceTexture is currently in
+ // isSynchronousMode returns whether the BufferQueue is currently in
// synchronous mode.
bool isSynchronousMode() const;
@@ -506,10 +506,10 @@
Fifo mQueue;
// mAbandoned indicates that the BufferQueue will no longer be used to
- // consume images buffers pushed to it using the ISurfaceTexture interface.
+ // consume images buffers pushed to it using the IGraphicBufferProducer interface.
// It is initialized to false, and set to true in the abandon method. A
// BufferQueue that has been abandoned will return the NO_INIT error from
- // all ISurfaceTexture methods capable of returning an error.
+ // all IGraphicBufferProducer methods capable of returning an error.
bool mAbandoned;
// mName is a string used to identify the BufferQueue in log messages.
diff --git a/include/gui/ConsumerBase.h b/include/gui/ConsumerBase.h
index 5ae5a19..49a764f 100644
--- a/include/gui/ConsumerBase.h
+++ b/include/gui/ConsumerBase.h
@@ -53,7 +53,7 @@
// abandon frees all the buffers and puts the ConsumerBase into the
// 'abandoned' state. Once put in this state the ConsumerBase can never
// leave it. When in the 'abandoned' state, all methods of the
- // ISurfaceTexture interface will fail with the NO_INIT error.
+ // IGraphicBufferProducer interface will fail with the NO_INIT error.
//
// Note that while calling this method causes all the buffers to be freed
// from the perspective of the the ConsumerBase, if there are additional
@@ -186,7 +186,7 @@
Slot mSlots[BufferQueue::NUM_BUFFER_SLOTS];
// mAbandoned indicates that the BufferQueue will no longer be used to
- // consume images buffers pushed to it using the ISurfaceTexture
+ // consume images buffers pushed to it using the IGraphicBufferProducer
// interface. It is initialized to false, and set to true in the abandon
// method. A BufferQueue that has been abandoned will return the NO_INIT
// error from all IConsumerBase methods capable of returning an error.
diff --git a/include/gui/CpuConsumer.h b/include/gui/CpuConsumer.h
index 807a4b5..a08c718 100644
--- a/include/gui/CpuConsumer.h
+++ b/include/gui/CpuConsumer.h
@@ -82,7 +82,7 @@
// lockNextBuffer.
status_t unlockBuffer(const LockedBuffer &nativeBuffer);
- sp<ISurfaceTexture> getProducerInterface() const { return getBufferQueue(); }
+ sp<IGraphicBufferProducer> getProducerInterface() const { return getBufferQueue(); }
private:
// Maximum number of buffers that can be locked at a time
diff --git a/include/gui/DummyConsumer.h b/include/gui/DummyConsumer.h
index 7fe4d40..08e8ec8 100644
--- a/include/gui/DummyConsumer.h
+++ b/include/gui/DummyConsumer.h
@@ -24,7 +24,7 @@
// The DummyConsumer does not keep a reference to BufferQueue
-// unlike SurfaceTexture. This prevents a circular reference from
+// unlike GLConsumer. This prevents a circular reference from
// forming without having to use a ProxyConsumerListener
class DummyConsumer : public BufferQueue::ConsumerListener {
public:
@@ -33,7 +33,7 @@
protected:
// Implementation of the BufferQueue::ConsumerListener interface. These
- // calls are used to notify the SurfaceTexture of asynchronous events in the
+ // calls are used to notify the GLConsumer of asynchronous events in the
// BufferQueue.
virtual void onFrameAvailable();
virtual void onBuffersReleased();
diff --git a/include/gui/SurfaceTexture.h b/include/gui/GLConsumer.h
similarity index 88%
rename from include/gui/SurfaceTexture.h
rename to include/gui/GLConsumer.h
index 50efb73..e0fa893 100644
--- a/include/gui/SurfaceTexture.h
+++ b/include/gui/GLConsumer.h
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-#ifndef ANDROID_GUI_SURFACETEXTURE_H
-#define ANDROID_GUI_SURFACETEXTURE_H
+#ifndef ANDROID_GUI_CONSUMER_H
+#define ANDROID_GUI_CONSUMER_H
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-#include <gui/ISurfaceTexture.h>
+#include <gui/IGraphicBufferProducer.h>
#include <gui/BufferQueue.h>
#include <gui/ConsumerBase.h>
@@ -43,10 +43,10 @@
class String8;
/*
- * SurfaceTexture consumes buffers of graphics data from a BufferQueue,
+ * GLConsumer consumes buffers of graphics data from a BufferQueue,
* and makes them available to OpenGL as a texture.
*
- * A typical usage pattern is to set up the SurfaceTexture with the
+ * A typical usage pattern is to set up the GLConsumer with the
* desired options, and call updateTexImage() when a new frame is desired.
* If a new frame is available, the texture will be updated. If not,
* the previous contents are retained.
@@ -55,13 +55,13 @@
* texture target, in the EGL context of the first thread that calls
* updateTexImage().
*
- * TODO: rename to GLConsumer (OpenGLConsumer?)
+ * This class was previously called SurfaceTexture.
*/
-class SurfaceTexture : public ConsumerBase {
+class GLConsumer : public ConsumerBase {
public:
typedef ConsumerBase::FrameAvailableListener FrameAvailableListener;
- // SurfaceTexture constructs a new SurfaceTexture object. tex indicates the
+ // GLConsumer constructs a new GLConsumer object. tex indicates the
// name of the OpenGL ES texture to which images are to be streamed.
// allowSynchronousMode specifies whether or not synchronous mode can be
// enabled. texTarget specifies the OpenGL ES texture target to which the
@@ -71,7 +71,7 @@
// if behavior for queue/dequeue/connect etc needs to be customized.
// Otherwise a default BufferQueue will be created and used.
//
- // For legacy reasons, the SurfaceTexture is created in a state where it is
+ // For legacy reasons, the GLConsumer is created in a state where it is
// considered attached to an OpenGL ES context for the purposes of the
// attachToContext and detachFromContext methods. However, despite being
// considered "attached" to a context, the specific OpenGL ES context
@@ -79,13 +79,13 @@
// point, all calls to updateTexImage must be made with the same OpenGL ES
// context current.
//
- // A SurfaceTexture may be detached from one OpenGL ES context and then
+ // A GLConsumer may be detached from one OpenGL ES context and then
// attached to a different context using the detachFromContext and
// attachToContext methods, respectively. The intention of these methods is
- // purely to allow a SurfaceTexture to be transferred from one consumer
+ // purely to allow a GLConsumer to be transferred from one consumer
// context to another. If such a transfer is not needed there is no
// requirement that either of these methods be called.
- SurfaceTexture(GLuint tex, bool allowSynchronousMode = true,
+ GLConsumer(GLuint tex, bool allowSynchronousMode = true,
GLenum texTarget = GL_TEXTURE_EXTERNAL_OES, bool useFenceSync = true,
const sp<BufferQueue> &bufferQueue = 0);
@@ -102,7 +102,7 @@
// current buffer is no longer being read. This fence will be returned to
// the producer when the current buffer is released by updateTexImage().
// Multiple fences can be set for a given buffer; they will be merged into
- // a single union fence. The SurfaceTexture will close the file descriptor
+ // a single union fence. The GLConsumer will close the file descriptor
// when finished with it.
void setReleaseFence(int fenceFd);
@@ -122,7 +122,7 @@
//
// This transform is necessary to compensate for transforms that the stream
// content producer may implicitly apply to the content. By forcing users of
- // a SurfaceTexture to apply this transform we avoid performing an extra
+ // a GLConsumer to apply this transform we avoid performing an extra
// copy of the data that would be needed to hide the transform from the
// user.
//
@@ -178,11 +178,11 @@
// current texture buffer.
status_t doGLFenceWait() const;
- // isSynchronousMode returns whether the SurfaceTexture is currently in
+ // isSynchronousMode returns whether the GLConsumer is currently in
// synchronous mode.
bool isSynchronousMode() const;
- // set the name of the SurfaceTexture that will be used to identify it in
+ // set the name of the GLConsumer that will be used to identify it in
// log messages.
void setName(const String8& name);
@@ -194,29 +194,29 @@
virtual status_t setSynchronousMode(bool enabled);
// getBufferQueue returns the BufferQueue object to which this
- // SurfaceTexture is connected.
+ // GLConsumer is connected.
sp<BufferQueue> getBufferQueue() const {
return mBufferQueue;
}
- // detachFromContext detaches the SurfaceTexture from the calling thread's
+ // detachFromContext detaches the GLConsumer from the calling thread's
// current OpenGL ES context. This context must be the same as the context
// that was current for previous calls to updateTexImage.
//
- // Detaching a SurfaceTexture from an OpenGL ES context will result in the
+ // Detaching a GLConsumer from an OpenGL ES context will result in the
// deletion of the OpenGL ES texture object into which the images were being
- // streamed. After a SurfaceTexture has been detached from the OpenGL ES
+ // streamed. After a GLConsumer has been detached from the OpenGL ES
// context calls to updateTexImage will fail returning INVALID_OPERATION
- // until the SurfaceTexture is attached to a new OpenGL ES context using the
+ // until the GLConsumer is attached to a new OpenGL ES context using the
// attachToContext method.
status_t detachFromContext();
- // attachToContext attaches a SurfaceTexture that is currently in the
- // 'detached' state to the current OpenGL ES context. A SurfaceTexture is
+ // attachToContext attaches a GLConsumer that is currently in the
+ // 'detached' state to the current OpenGL ES context. A GLConsumer is
// in the 'detached' state iff detachFromContext has successfully been
// called and no calls to attachToContext have succeeded since the last
// detachFromContext call. Calls to attachToContext made on a
- // SurfaceTexture that is not in the 'detached' state will result in an
+ // GLConsumer that is not in the 'detached' state will result in an
// INVALID_OPERATION error.
//
// The tex argument specifies the OpenGL ES texture object name in the
@@ -232,7 +232,7 @@
// mCurrentTextureBuf in addition to the ConsumerBase behavior.
virtual void abandonLocked();
- // dumpLocked overrides the ConsumerBase method to dump SurfaceTexture-
+ // dumpLocked overrides the ConsumerBase method to dump GLConsumer-
// specific info in addition to the ConsumerBase behavior.
virtual void dumpLocked(String8& result, const char* prefix, char* buffer,
size_t size) const;
@@ -268,7 +268,7 @@
// values.
status_t checkAndUpdateEglStateLocked();
- // If set, SurfaceTexture will use the EGL_ANDROID_native_fence_sync
+ // If set, GLConsumer will use the EGL_ANDROID_native_fence_sync
// extension to create Android native fences for GLES activity.
static const bool sUseNativeFenceSync;
@@ -308,9 +308,9 @@
// binding the buffer without touching the EglSlots.
status_t bindUnslottedBufferLocked(EGLDisplay dpy);
- // The default consumer usage flags that SurfaceTexture always sets on its
+ // The default consumer usage flags that GLConsumer always sets on its
// BufferQueue instance; these will be OR:d with any additional flags passed
- // from the SurfaceTexture user. In particular, SurfaceTexture will always
+ // from the GLConsumer user. In particular, GLConsumer will always
// consume buffers as hardware textures.
static const uint32_t DEFAULT_USAGE_FLAGS = GraphicBuffer::USAGE_HW_TEXTURE;
@@ -371,7 +371,7 @@
const GLenum mTexTarget;
// EGLSlot contains the information and object references that
- // SurfaceTexture maintains about a BufferQueue buffer slot.
+ // GLConsumer maintains about a BufferQueue buffer slot.
struct EglSlot {
EglSlot()
: mEglImage(EGL_NO_IMAGE_KHR),
@@ -388,13 +388,13 @@
EGLSyncKHR mEglFence;
};
- // mEglDisplay is the EGLDisplay with which this SurfaceTexture is currently
+ // mEglDisplay is the EGLDisplay with which this GLConsumer is currently
// associated. It is intialized to EGL_NO_DISPLAY and gets set to the
// current display when updateTexImage is called for the first time and when
// attachToContext is called.
EGLDisplay mEglDisplay;
- // mEglContext is the OpenGL ES context with which this SurfaceTexture is
+ // mEglContext is the OpenGL ES context with which this GLConsumer is
// currently associated. It is initialized to EGL_NO_CONTEXT and gets set
// to the current GL context when updateTexImage is called for the first
// time and when attachToContext is called.
@@ -429,4 +429,4 @@
// ----------------------------------------------------------------------------
}; // namespace android
-#endif // ANDROID_GUI_SURFACETEXTURE_H
+#endif // ANDROID_GUI_CONSUMER_H
diff --git a/include/gui/ISurfaceTexture.h b/include/gui/IGraphicBufferProducer.h
similarity index 85%
rename from include/gui/ISurfaceTexture.h
rename to include/gui/IGraphicBufferProducer.h
index 58345a0..3b61229 100644
--- a/include/gui/ISurfaceTexture.h
+++ b/include/gui/IGraphicBufferProducer.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ANDROID_GUI_ISURFACETEXTURE_H
-#define ANDROID_GUI_ISURFACETEXTURE_H
+#ifndef ANDROID_GUI_IGRAPHICBUFFERPRODUCER_H
+#define ANDROID_GUI_IGRAPHICBUFFERPRODUCER_H
#include <stdint.h>
#include <sys/types.h>
@@ -44,16 +44,15 @@
* producer calls dequeueBuffer() to get an empty buffer, fills it with
* data, then calls queueBuffer() to make it available to the consumer.
*
- * The BnSurfaceTexture and BpSurfaceTexture classes provide the Binder
- * IPC implementation.
+ * The BnGraphicBufferProducer and BpGraphicBufferProducer classes provide
+ * the Binder IPC implementation.
*
- * TODO: rename to IGraphicBufferProducer (IBufferProducer?
- * IBufferQueueProducer?)
+ * This class was previously called ISurfaceTexture.
*/
-class ISurfaceTexture : public IInterface
+class IGraphicBufferProducer : public IInterface
{
public:
- DECLARE_META_INTERFACE(SurfaceTexture);
+ DECLARE_META_INTERFACE(GraphicBufferProducer);
enum {
BUFFER_NEEDS_REALLOCATION = 0x1,
@@ -61,8 +60,8 @@
};
// requestBuffer requests a new buffer for the given index. The server (i.e.
- // the ISurfaceTexture implementation) assigns the newly created buffer to
- // the given slot index, and the client is expected to mirror the
+ // the IGraphicBufferProducer implementation) assigns the newly created
+ // buffer to the given slot index, and the client is expected to mirror the
// slot->buffer mapping so that it's not necessary to transfer a
// GraphicBuffer for every dequeue operation.
virtual status_t requestBuffer(int slot, sp<GraphicBuffer>* buf) = 0;
@@ -180,32 +179,32 @@
// The default mode is asynchronous.
virtual status_t setSynchronousMode(bool enabled) = 0;
- // connect attempts to connect a client API to the SurfaceTexture. This
- // must be called before any other ISurfaceTexture methods are called except
- // for getAllocator.
+ // connect attempts to connect a client API to the IGraphicBufferProducer.
+ // This must be called before any other IGraphicBufferProducer methods are
+ // called except for getAllocator.
//
// This method will fail if the connect was previously called on the
- // SurfaceTexture and no corresponding disconnect call was made.
+ // IGraphicBufferProducer and no corresponding disconnect call was made.
//
// outWidth, outHeight and outTransform are filled with the default width
// and height of the window and current transform applied to buffers,
// respectively.
virtual status_t connect(int api, QueueBufferOutput* output) = 0;
- // disconnect attempts to disconnect a client API from the SurfaceTexture.
- // Calling this method will cause any subsequent calls to other
- // ISurfaceTexture methods to fail except for getAllocator and connect.
- // Successfully calling connect after this will allow the other methods to
- // succeed again.
+ // disconnect attempts to disconnect a client API from the
+ // IGraphicBufferProducer. Calling this method will cause any subsequent
+ // calls to other IGraphicBufferProducer methods to fail except for
+ // getAllocator and connect. Successfully calling connect after this will
+ // allow the other methods to succeed again.
//
- // This method will fail if the the SurfaceTexture is not currently
+ // This method will fail if the the IGraphicBufferProducer is not currently
// connected to the specified client API.
virtual status_t disconnect(int api) = 0;
};
// ----------------------------------------------------------------------------
-class BnSurfaceTexture : public BnInterface<ISurfaceTexture>
+class BnGraphicBufferProducer : public BnInterface<IGraphicBufferProducer>
{
public:
virtual status_t onTransact( uint32_t code,
@@ -217,4 +216,4 @@
// ----------------------------------------------------------------------------
}; // namespace android
-#endif // ANDROID_GUI_ISURFACETEXTURE_H
+#endif // ANDROID_GUI_IGRAPHICBUFFERPRODUCER_H
diff --git a/include/gui/ISurface.h b/include/gui/ISurface.h
index c0ff9fc..ce6e715 100644
--- a/include/gui/ISurface.h
+++ b/include/gui/ISurface.h
@@ -31,7 +31,7 @@
typedef int32_t SurfaceID;
-class ISurfaceTexture;
+class IGraphicBufferProducer;
class ISurface : public IInterface
{
@@ -43,7 +43,7 @@
public:
DECLARE_META_INTERFACE(Surface);
- virtual sp<ISurfaceTexture> getSurfaceTexture() const = 0;
+ virtual sp<IGraphicBufferProducer> getSurfaceTexture() const = 0;
};
// ----------------------------------------------------------------------------
diff --git a/include/gui/ISurfaceComposer.h b/include/gui/ISurfaceComposer.h
index 6500ad5..50b2ad1 100644
--- a/include/gui/ISurfaceComposer.h
+++ b/include/gui/ISurfaceComposer.h
@@ -86,10 +86,10 @@
*/
virtual void bootFinished() = 0;
- /* verify that an ISurfaceTexture was created by SurfaceFlinger.
+ /* verify that an IGraphicBufferProducer was created by SurfaceFlinger.
*/
virtual bool authenticateSurfaceTexture(
- const sp<ISurfaceTexture>& surface) const = 0;
+ const sp<IGraphicBufferProducer>& surface) const = 0;
/* Capture the specified screen. requires READ_FRAME_BUFFER permission
* This function will fail if there is a secure window on screen.
diff --git a/include/gui/Surface.h b/include/gui/Surface.h
index f3455b5..cba11b8 100644
--- a/include/gui/Surface.h
+++ b/include/gui/Surface.h
@@ -37,7 +37,7 @@
// ---------------------------------------------------------------------------
-class ISurfaceTexture;
+class IGraphicBufferProducer;
class Surface;
class SurfaceComposerClient;
@@ -126,7 +126,7 @@
uint32_t reserved[2];
};
- explicit Surface(const sp<ISurfaceTexture>& st);
+ explicit Surface(const sp<IGraphicBufferProducer>& bp);
static status_t writeToParcel(const sp<Surface>& control, Parcel* parcel);
@@ -137,7 +137,7 @@
bool isValid();
uint32_t getIdentity() const { return mIdentity; }
- sp<ISurfaceTexture> getSurfaceTexture();
+ sp<IGraphicBufferProducer> getSurfaceTexture(); // TODO: rename this
// the lock/unlock APIs must be used from the same thread
status_t lock(SurfaceInfo* info, Region* dirty = NULL);
@@ -161,7 +161,7 @@
/*
* private stuff...
*/
- void init(const sp<ISurfaceTexture>& surfaceTexture);
+ void init(const sp<IGraphicBufferProducer>& bufferProducer);
static void cleanCachedSurfacesLocked();
diff --git a/include/gui/SurfaceComposerClient.h b/include/gui/SurfaceComposerClient.h
index ae5d69a..22e6b14 100644
--- a/include/gui/SurfaceComposerClient.h
+++ b/include/gui/SurfaceComposerClient.h
@@ -39,7 +39,7 @@
class Composer;
class IMemoryHeap;
class ISurfaceComposerClient;
-class ISurfaceTexture;
+class IGraphicBufferProducer;
class Region;
// ---------------------------------------------------------------------------
@@ -122,7 +122,7 @@
status_t destroySurface(SurfaceID sid);
static void setDisplaySurface(const sp<IBinder>& token,
- const sp<ISurfaceTexture>& surface);
+ const sp<IGraphicBufferProducer>& bufferProducer);
static void setDisplayLayerStack(const sp<IBinder>& token,
uint32_t layerStack);
diff --git a/include/gui/SurfaceTextureClient.h b/include/gui/SurfaceTextureClient.h
index a582975..bce2329 100644
--- a/include/gui/SurfaceTextureClient.h
+++ b/include/gui/SurfaceTextureClient.h
@@ -17,8 +17,8 @@
#ifndef ANDROID_GUI_SURFACETEXTURECLIENT_H
#define ANDROID_GUI_SURFACETEXTURECLIENT_H
-#include <gui/ISurfaceTexture.h>
-#include <gui/SurfaceTexture.h>
+#include <gui/IGraphicBufferProducer.h>
+#include <gui/GLConsumer.h>
#include <gui/BufferQueue.h>
#include <ui/ANativeObjectBase.h>
@@ -44,7 +44,7 @@
* compositing. For example, a video decoder could render a frame and call
* eglSwapBuffers(), which invokes ANativeWindow callbacks defined by
* SurfaceTextureClient. STC then acts as the BufferQueue producer,
- * providing the new frame to a consumer such as SurfaceTexture.
+ * providing the new frame to a consumer such as GLConsumer.
*
* TODO: rename to Surface. The existing Surface class wraps STC with
* some Binder goodies, which most users of Surface class don't care about.
@@ -54,14 +54,14 @@
{
public:
- SurfaceTextureClient(const sp<ISurfaceTexture>& surfaceTexture);
+ SurfaceTextureClient(const sp<IGraphicBufferProducer>& bufferProducer);
- sp<ISurfaceTexture> getISurfaceTexture() const;
+ sp<IGraphicBufferProducer> getISurfaceTexture() const; // TODO: rename
protected:
SurfaceTextureClient();
virtual ~SurfaceTextureClient();
- void setISurfaceTexture(const sp<ISurfaceTexture>& surfaceTexture);
+ void setISurfaceTexture(const sp<IGraphicBufferProducer>& bufferProducer);
private:
// can't be copied
@@ -144,11 +144,12 @@
// mSurfaceTexture is the interface to the surface texture server. All
// operations on the surface texture client ultimately translate into
// interactions with the server using this interface.
- sp<ISurfaceTexture> mSurfaceTexture;
+ // TODO: rename to mBufferProducer
+ sp<IGraphicBufferProducer> mSurfaceTexture;
// mSlots stores the buffers that have been allocated for each buffer slot.
// It is initialized to null pointers, and gets filled in with the result of
- // ISurfaceTexture::requestBuffer when the client dequeues a buffer from a
+ // IGraphicBufferProducer::requestBuffer when the client dequeues a buffer from a
// slot that has not yet been used. The buffer allocated to a slot will also
// be replaced if the requested buffer usage or geometry differs from that
// of the buffer allocated to a slot.
@@ -214,7 +215,7 @@
mutable bool mConsumerRunningBehind;
// mMutex is the mutex used to prevent concurrent access to the member
- // variables of SurfaceTexture objects. It must be locked whenever the
+ // variables of SurfaceTextureClient objects. It must be locked whenever the
// member variables are accessed.
mutable Mutex mMutex;
diff --git a/include/private/gui/LayerState.h b/include/private/gui/LayerState.h
index a7eb48c..5b400ca 100644
--- a/include/private/gui/LayerState.h
+++ b/include/private/gui/LayerState.h
@@ -114,7 +114,7 @@
uint32_t what;
sp<IBinder> token;
- sp<ISurfaceTexture> surface;
+ sp<IGraphicBufferProducer> surface;
uint32_t layerStack;
uint32_t orientation;
Rect viewport;
diff --git a/libs/gui/Android.mk b/libs/gui/Android.mk
index 04444e9..b1aeb32 100644
--- a/libs/gui/Android.mk
+++ b/libs/gui/Android.mk
@@ -9,23 +9,23 @@
CpuConsumer.cpp \
DisplayEventReceiver.cpp \
DummyConsumer.cpp \
+ GLConsumer.cpp \
GraphicBufferAlloc.cpp \
GuiConfig.cpp \
IDisplayEventConnection.cpp \
IGraphicBufferAlloc.cpp \
+ IGraphicBufferProducer.cpp \
ISensorEventConnection.cpp \
ISensorServer.cpp \
ISurface.cpp \
ISurfaceComposer.cpp \
ISurfaceComposerClient.cpp \
- ISurfaceTexture.cpp \
LayerState.cpp \
Sensor.cpp \
SensorEventQueue.cpp \
SensorManager.cpp \
Surface.cpp \
SurfaceComposerClient.cpp \
- SurfaceTexture.cpp \
SurfaceTextureClient.cpp \
LOCAL_SHARED_LIBRARIES := \
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp
index 609e7d2..4be655b 100644
--- a/libs/gui/BufferQueue.cpp
+++ b/libs/gui/BufferQueue.cpp
@@ -146,7 +146,7 @@
Mutex::Autolock lock(mMutex);
if (mAbandoned) {
- ST_LOGE("setBufferCount: SurfaceTexture has been abandoned!");
+ ST_LOGE("setBufferCount: BufferQueue has been abandoned!");
return NO_INIT;
}
if (bufferCount > NUM_BUFFER_SLOTS) {
@@ -200,7 +200,7 @@
Mutex::Autolock lock(mMutex);
if (mAbandoned) {
- ST_LOGE("query: SurfaceTexture has been abandoned!");
+ ST_LOGE("query: BufferQueue has been abandoned!");
return NO_INIT;
}
@@ -233,7 +233,7 @@
ST_LOGV("requestBuffer: slot=%d", slot);
Mutex::Autolock lock(mMutex);
if (mAbandoned) {
- ST_LOGE("requestBuffer: SurfaceTexture has been abandoned!");
+ ST_LOGE("requestBuffer: BufferQueue has been abandoned!");
return NO_INIT;
}
int maxBufferCount = getMaxBufferCountLocked();
@@ -282,7 +282,7 @@
bool tryAgain = true;
while (tryAgain) {
if (mAbandoned) {
- ST_LOGE("dequeueBuffer: SurfaceTexture has been abandoned!");
+ ST_LOGE("dequeueBuffer: BufferQueue has been abandoned!");
return NO_INIT;
}
@@ -294,7 +294,7 @@
assert(mSlots[i].mBufferState == BufferSlot::FREE);
if (mSlots[i].mGraphicBuffer != NULL) {
freeBufferLocked(i);
- returnFlags |= ISurfaceTexture::RELEASE_ALL_BUFFERS;
+ returnFlags |= IGraphicBufferProducer::RELEASE_ALL_BUFFERS;
}
}
@@ -390,7 +390,7 @@
mSlots[buf].mFence.clear();
mSlots[buf].mEglDisplay = EGL_NO_DISPLAY;
- returnFlags |= ISurfaceTexture::BUFFER_NEEDS_REALLOCATION;
+ returnFlags |= IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION;
}
dpy = mSlots[buf].mEglDisplay;
@@ -400,7 +400,7 @@
mSlots[buf].mFence.clear();
} // end lock scope
- if (returnFlags & ISurfaceTexture::BUFFER_NEEDS_REALLOCATION) {
+ if (returnFlags & IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION) {
status_t error;
sp<GraphicBuffer> graphicBuffer(
mGraphicBufferAlloc->createGraphicBuffer(
@@ -415,7 +415,7 @@
Mutex::Autolock lock(mMutex);
if (mAbandoned) {
- ST_LOGE("dequeueBuffer: SurfaceTexture has been abandoned!");
+ ST_LOGE("dequeueBuffer: BufferQueue has been abandoned!");
return NO_INIT;
}
@@ -449,7 +449,7 @@
Mutex::Autolock lock(mMutex);
if (mAbandoned) {
- ST_LOGE("setSynchronousMode: SurfaceTexture has been abandoned!");
+ ST_LOGE("setSynchronousMode: BufferQueue has been abandoned!");
return NO_INIT;
}
@@ -498,7 +498,7 @@
{ // scope for the lock
Mutex::Autolock lock(mMutex);
if (mAbandoned) {
- ST_LOGE("queueBuffer: SurfaceTexture has been abandoned!");
+ ST_LOGE("queueBuffer: BufferQueue has been abandoned!");
return NO_INIT;
}
int maxBufferCount = getMaxBufferCountLocked();
diff --git a/libs/gui/ConsumerBase.cpp b/libs/gui/ConsumerBase.cpp
index 2e7c424..8f391aa 100644
--- a/libs/gui/ConsumerBase.cpp
+++ b/libs/gui/ConsumerBase.cpp
@@ -69,7 +69,7 @@
status_t err = mBufferQueue->consumerConnect(proxy);
if (err != NO_ERROR) {
- CB_LOGE("SurfaceTexture: error connecting to BufferQueue: %s (%d)",
+ CB_LOGE("ConsumerBase: error connecting to BufferQueue: %s (%d)",
strerror(-err), err);
} else {
mBufferQueue->setConsumerName(mName);
@@ -233,4 +233,4 @@
return err;
}
-} // namespace android
\ No newline at end of file
+} // namespace android
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/GLConsumer.cpp
similarity index 88%
rename from libs/gui/SurfaceTexture.cpp
rename to libs/gui/GLConsumer.cpp
index ee3079e..ba23f9e 100644
--- a/libs/gui/SurfaceTexture.cpp
+++ b/libs/gui/GLConsumer.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#define LOG_TAG "SurfaceTexture"
+#define LOG_TAG "GLConsumer"
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
//#define LOG_NDEBUG 0
@@ -31,7 +31,7 @@
#include <gui/IGraphicBufferAlloc.h>
#include <gui/ISurfaceComposer.h>
#include <gui/SurfaceComposerClient.h>
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
#include <private/gui/ComposerService.h>
@@ -41,7 +41,7 @@
namespace android {
-// This compile option makes SurfaceTexture use the
+// This compile option makes GLConsumer use the
// EGL_ANDROID_native_fence_sync extension to create Android native fences to
// signal when all GLES reads for a given buffer have completed. It is not
// compatible with using the EGL_KHR_fence_sync extension for the same
@@ -50,12 +50,12 @@
#ifdef USE_FENCE_SYNC
#error "USE_NATIVE_FENCE_SYNC and USE_FENCE_SYNC are incompatible"
#endif
-const bool SurfaceTexture::sUseNativeFenceSync = true;
+const bool GLConsumer::sUseNativeFenceSync = true;
#else
-const bool SurfaceTexture::sUseNativeFenceSync = false;
+const bool GLConsumer::sUseNativeFenceSync = false;
#endif
-// This compile option makes SurfaceTexture use the EGL_ANDROID_sync_wait
+// This compile option makes GLConsumer use the EGL_ANDROID_sync_wait
// extension to insert server-side waits into the GLES command stream. This
// feature requires the EGL_ANDROID_native_fence_sync and
// EGL_ANDROID_wait_sync extensions.
@@ -65,7 +65,7 @@
static const bool useWaitSync = false;
#endif
-// Macros for including the SurfaceTexture name in log messages
+// Macros for including the GLConsumer name in log messages
#define ST_LOGV(x, ...) ALOGV("[%s] "x, mName.string(), ##__VA_ARGS__)
#define ST_LOGD(x, ...) ALOGD("[%s] "x, mName.string(), ##__VA_ARGS__)
#define ST_LOGI(x, ...) ALOGI("[%s] "x, mName.string(), ##__VA_ARGS__)
@@ -113,7 +113,7 @@
static void mtxMul(float out[16], const float a[16], const float b[16]);
-SurfaceTexture::SurfaceTexture(GLuint tex, bool allowSynchronousMode,
+GLConsumer::GLConsumer(GLuint tex, bool allowSynchronousMode,
GLenum texTarget, bool useFenceSync, const sp<BufferQueue> &bufferQueue) :
ConsumerBase(bufferQueue == 0 ? new BufferQueue(allowSynchronousMode) : bufferQueue),
mCurrentTransform(0),
@@ -131,7 +131,7 @@
mCurrentTexture(BufferQueue::INVALID_BUFFER_SLOT),
mAttached(true)
{
- ST_LOGV("SurfaceTexture");
+ ST_LOGV("GLConsumer");
memcpy(mCurrentTransformMatrix, mtxIdentity,
sizeof(mCurrentTransformMatrix));
@@ -139,13 +139,13 @@
mBufferQueue->setConsumerUsageBits(DEFAULT_USAGE_FLAGS);
}
-status_t SurfaceTexture::setDefaultMaxBufferCount(int bufferCount) {
+status_t GLConsumer::setDefaultMaxBufferCount(int bufferCount) {
Mutex::Autolock lock(mMutex);
return mBufferQueue->setDefaultMaxBufferCount(bufferCount);
}
-status_t SurfaceTexture::setDefaultBufferSize(uint32_t w, uint32_t h)
+status_t GLConsumer::setDefaultBufferSize(uint32_t w, uint32_t h)
{
Mutex::Autolock lock(mMutex);
mDefaultWidth = w;
@@ -153,13 +153,13 @@
return mBufferQueue->setDefaultBufferSize(w, h);
}
-status_t SurfaceTexture::updateTexImage() {
+status_t GLConsumer::updateTexImage() {
ATRACE_CALL();
ST_LOGV("updateTexImage");
Mutex::Autolock lock(mMutex);
if (mAbandoned) {
- ST_LOGE("updateTexImage: SurfaceTexture is abandoned!");
+ ST_LOGE("updateTexImage: GLConsumer is abandoned!");
return NO_INIT;
}
@@ -200,7 +200,7 @@
return bindTextureImageLocked();
}
-status_t SurfaceTexture::acquireBufferLocked(BufferQueue::BufferItem *item) {
+status_t GLConsumer::acquireBufferLocked(BufferQueue::BufferItem *item) {
status_t err = ConsumerBase::acquireBufferLocked(item);
if (err != NO_ERROR) {
return err;
@@ -223,7 +223,7 @@
return NO_ERROR;
}
-status_t SurfaceTexture::releaseBufferLocked(int buf, EGLDisplay display,
+status_t GLConsumer::releaseBufferLocked(int buf, EGLDisplay display,
EGLSyncKHR eglFence) {
status_t err = ConsumerBase::releaseBufferLocked(buf, display, eglFence);
@@ -232,12 +232,12 @@
return err;
}
-status_t SurfaceTexture::releaseAndUpdateLocked(const BufferQueue::BufferItem& item)
+status_t GLConsumer::releaseAndUpdateLocked(const BufferQueue::BufferItem& item)
{
status_t err = NO_ERROR;
if (!mAttached) {
- ST_LOGE("releaseAndUpdate: SurfaceTexture is not attached to an OpenGL "
+ ST_LOGE("releaseAndUpdate: GLConsumer is not attached to an OpenGL "
"ES context");
return INVALID_OPERATION;
}
@@ -293,7 +293,7 @@
}
}
- // Update the SurfaceTexture state.
+ // Update the GLConsumer state.
mCurrentTexture = buf;
mCurrentTextureBuf = mSlots[buf].mGraphicBuffer;
mCurrentCrop = item.mCrop;
@@ -307,7 +307,7 @@
return err;
}
-status_t SurfaceTexture::bindTextureImageLocked() {
+status_t GLConsumer::bindTextureImageLocked() {
if (mEglDisplay == EGL_NO_DISPLAY) {
ALOGE("bindTextureImage: invalid display");
return INVALID_OPERATION;
@@ -345,7 +345,7 @@
}
-status_t SurfaceTexture::checkAndUpdateEglStateLocked() {
+status_t GLConsumer::checkAndUpdateEglStateLocked() {
EGLDisplay dpy = eglGetCurrentDisplay();
EGLContext ctx = eglGetCurrentContext();
@@ -366,7 +366,7 @@
return NO_ERROR;
}
-void SurfaceTexture::setReleaseFence(int fenceFd) {
+void GLConsumer::setReleaseFence(int fenceFd) {
sp<Fence> fence(new Fence(fenceFd));
if (fenceFd == -1 || mCurrentTexture == BufferQueue::INVALID_BUFFER_SLOT)
return;
@@ -377,18 +377,18 @@
}
}
-status_t SurfaceTexture::detachFromContext() {
+status_t GLConsumer::detachFromContext() {
ATRACE_CALL();
ST_LOGV("detachFromContext");
Mutex::Autolock lock(mMutex);
if (mAbandoned) {
- ST_LOGE("detachFromContext: abandoned SurfaceTexture");
+ ST_LOGE("detachFromContext: abandoned GLConsumer");
return NO_INIT;
}
if (!mAttached) {
- ST_LOGE("detachFromContext: SurfaceTexture is not attached to a "
+ ST_LOGE("detachFromContext: GLConsumer is not attached to a "
"context");
return INVALID_OPERATION;
}
@@ -417,7 +417,7 @@
// Because we're giving up the EGLDisplay we need to free all the EGLImages
// that are associated with it. They'll be recreated when the
- // SurfaceTexture gets attached to a new OpenGL ES context (and thus gets a
+ // GLConsumer gets attached to a new OpenGL ES context (and thus gets a
// new EGLDisplay).
for (int i =0; i < BufferQueue::NUM_BUFFER_SLOTS; i++) {
EGLImageKHR img = mEglSlots[i].mEglImage;
@@ -434,18 +434,18 @@
return OK;
}
-status_t SurfaceTexture::attachToContext(GLuint tex) {
+status_t GLConsumer::attachToContext(GLuint tex) {
ATRACE_CALL();
ST_LOGV("attachToContext");
Mutex::Autolock lock(mMutex);
if (mAbandoned) {
- ST_LOGE("attachToContext: abandoned SurfaceTexture");
+ ST_LOGE("attachToContext: abandoned GLConsumer");
return NO_INIT;
}
if (mAttached) {
- ST_LOGE("attachToContext: SurfaceTexture is already attached to a "
+ ST_LOGE("attachToContext: GLConsumer is already attached to a "
"context");
return INVALID_OPERATION;
}
@@ -469,7 +469,7 @@
if (mCurrentTextureBuf != NULL) {
// The EGLImageKHR that was associated with the slot was destroyed when
- // the SurfaceTexture was detached from the old context, so we need to
+ // the GLConsumer was detached from the old context, so we need to
// recreate it here.
status_t err = bindUnslottedBufferLocked(dpy);
if (err != NO_ERROR) {
@@ -485,7 +485,7 @@
return OK;
}
-status_t SurfaceTexture::bindUnslottedBufferLocked(EGLDisplay dpy) {
+status_t GLConsumer::bindUnslottedBufferLocked(EGLDisplay dpy) {
ST_LOGV("bindUnslottedBuffer ct=%d ctb=%p",
mCurrentTexture, mCurrentTextureBuf.get());
@@ -517,7 +517,7 @@
}
-status_t SurfaceTexture::syncForReleaseLocked(EGLDisplay dpy) {
+status_t GLConsumer::syncForReleaseLocked(EGLDisplay dpy) {
ST_LOGV("syncForReleaseLocked");
if (mCurrentTexture != BufferQueue::INVALID_BUFFER_SLOT) {
@@ -580,7 +580,7 @@
return OK;
}
-bool SurfaceTexture::isExternalFormat(uint32_t format)
+bool GLConsumer::isExternalFormat(uint32_t format)
{
switch (format) {
// supported YUV formats
@@ -599,19 +599,19 @@
return false;
}
-GLenum SurfaceTexture::getCurrentTextureTarget() const {
+GLenum GLConsumer::getCurrentTextureTarget() const {
return mTexTarget;
}
-void SurfaceTexture::getTransformMatrix(float mtx[16]) {
+void GLConsumer::getTransformMatrix(float mtx[16]) {
Mutex::Autolock lock(mMutex);
memcpy(mtx, mCurrentTransformMatrix, sizeof(mCurrentTransformMatrix));
}
-void SurfaceTexture::setFilteringEnabled(bool enabled) {
+void GLConsumer::setFilteringEnabled(bool enabled) {
Mutex::Autolock lock(mMutex);
if (mAbandoned) {
- ST_LOGE("setFilteringEnabled: SurfaceTexture is abandoned!");
+ ST_LOGE("setFilteringEnabled: GLConsumer is abandoned!");
return;
}
bool needsRecompute = mFilteringEnabled != enabled;
@@ -626,7 +626,7 @@
}
}
-void SurfaceTexture::computeCurrentTransformMatrixLocked() {
+void GLConsumer::computeCurrentTransformMatrixLocked() {
ST_LOGV("computeCurrentTransformMatrixLocked");
float xform[16];
@@ -719,19 +719,19 @@
mtxMul(mtxBeforeFlipV, crop, xform);
// SurfaceFlinger expects the top of its window textures to be at a Y
- // coordinate of 0, so SurfaceTexture must behave the same way. We don't
+ // coordinate of 0, so GLConsumer must behave the same way. We don't
// want to expose this to applications, however, so we must add an
// additional vertical flip to the transform after all the other transforms.
mtxMul(mCurrentTransformMatrix, mtxFlipV, mtxBeforeFlipV);
}
-nsecs_t SurfaceTexture::getTimestamp() {
+nsecs_t GLConsumer::getTimestamp() {
ST_LOGV("getTimestamp");
Mutex::Autolock lock(mMutex);
return mCurrentTimestamp;
}
-EGLImageKHR SurfaceTexture::createImage(EGLDisplay dpy,
+EGLImageKHR GLConsumer::createImage(EGLDisplay dpy,
const sp<GraphicBuffer>& graphicBuffer) {
EGLClientBuffer cbuf = (EGLClientBuffer)graphicBuffer->getNativeBuffer();
EGLint attrs[] = {
@@ -747,12 +747,12 @@
return image;
}
-sp<GraphicBuffer> SurfaceTexture::getCurrentBuffer() const {
+sp<GraphicBuffer> GLConsumer::getCurrentBuffer() const {
Mutex::Autolock lock(mMutex);
return mCurrentTextureBuf;
}
-Rect SurfaceTexture::getCurrentCrop() const {
+Rect GLConsumer::getCurrentCrop() const {
Mutex::Autolock lock(mMutex);
Rect outCrop = mCurrentCrop;
@@ -788,27 +788,27 @@
return outCrop;
}
-uint32_t SurfaceTexture::getCurrentTransform() const {
+uint32_t GLConsumer::getCurrentTransform() const {
Mutex::Autolock lock(mMutex);
return mCurrentTransform;
}
-uint32_t SurfaceTexture::getCurrentScalingMode() const {
+uint32_t GLConsumer::getCurrentScalingMode() const {
Mutex::Autolock lock(mMutex);
return mCurrentScalingMode;
}
-sp<Fence> SurfaceTexture::getCurrentFence() const {
+sp<Fence> GLConsumer::getCurrentFence() const {
Mutex::Autolock lock(mMutex);
return mCurrentFence;
}
-status_t SurfaceTexture::doGLFenceWait() const {
+status_t GLConsumer::doGLFenceWait() const {
Mutex::Autolock lock(mMutex);
return doGLFenceWaitLocked();
}
-status_t SurfaceTexture::doGLFenceWaitLocked() const {
+status_t GLConsumer::doGLFenceWaitLocked() const {
EGLDisplay dpy = eglGetCurrentDisplay();
EGLContext ctx = eglGetCurrentContext();
@@ -857,7 +857,7 @@
}
} else {
status_t err = mCurrentFence->waitForever(1000,
- "SurfaceTexture::doGLFenceWaitLocked");
+ "GLConsumer::doGLFenceWaitLocked");
if (err != NO_ERROR) {
ST_LOGE("doGLFenceWait: error waiting for fence: %d", err);
return err;
@@ -868,12 +868,12 @@
return NO_ERROR;
}
-bool SurfaceTexture::isSynchronousMode() const {
+bool GLConsumer::isSynchronousMode() const {
Mutex::Autolock lock(mMutex);
return mBufferQueue->isSynchronousMode();
}
-void SurfaceTexture::freeBufferLocked(int slotIndex) {
+void GLConsumer::freeBufferLocked(int slotIndex) {
ST_LOGV("freeBufferLocked: slotIndex=%d", slotIndex);
if (slotIndex == mCurrentTexture) {
mCurrentTexture = BufferQueue::INVALID_BUFFER_SLOT;
@@ -887,42 +887,42 @@
ConsumerBase::freeBufferLocked(slotIndex);
}
-void SurfaceTexture::abandonLocked() {
+void GLConsumer::abandonLocked() {
ST_LOGV("abandonLocked");
mCurrentTextureBuf.clear();
ConsumerBase::abandonLocked();
}
-void SurfaceTexture::setName(const String8& name) {
+void GLConsumer::setName(const String8& name) {
Mutex::Autolock _l(mMutex);
mName = name;
mBufferQueue->setConsumerName(name);
}
-status_t SurfaceTexture::setDefaultBufferFormat(uint32_t defaultFormat) {
+status_t GLConsumer::setDefaultBufferFormat(uint32_t defaultFormat) {
Mutex::Autolock lock(mMutex);
return mBufferQueue->setDefaultBufferFormat(defaultFormat);
}
-status_t SurfaceTexture::setConsumerUsageBits(uint32_t usage) {
+status_t GLConsumer::setConsumerUsageBits(uint32_t usage) {
Mutex::Autolock lock(mMutex);
usage |= DEFAULT_USAGE_FLAGS;
return mBufferQueue->setConsumerUsageBits(usage);
}
-status_t SurfaceTexture::setTransformHint(uint32_t hint) {
+status_t GLConsumer::setTransformHint(uint32_t hint) {
Mutex::Autolock lock(mMutex);
return mBufferQueue->setTransformHint(hint);
}
-// Used for refactoring BufferQueue from SurfaceTexture
-// Should not be in final interface once users of SurfaceTexture are clean up.
-status_t SurfaceTexture::setSynchronousMode(bool enabled) {
+// Used for refactoring BufferQueue from GLConsumer
+// Should not be in final interface once users of GLConsumer are clean up.
+status_t GLConsumer::setSynchronousMode(bool enabled) {
Mutex::Autolock lock(mMutex);
return mBufferQueue->setSynchronousMode(enabled);
}
-void SurfaceTexture::dumpLocked(String8& result, const char* prefix,
+void GLConsumer::dumpLocked(String8& result, const char* prefix,
char* buffer, size_t size) const
{
snprintf(buffer, size,
diff --git a/libs/gui/ISurfaceTexture.cpp b/libs/gui/IGraphicBufferProducer.cpp
similarity index 82%
rename from libs/gui/ISurfaceTexture.cpp
rename to libs/gui/IGraphicBufferProducer.cpp
index a0b1e74..923e394 100644
--- a/libs/gui/ISurfaceTexture.cpp
+++ b/libs/gui/IGraphicBufferProducer.cpp
@@ -25,7 +25,7 @@
#include <binder/Parcel.h>
#include <binder/IInterface.h>
-#include <gui/ISurfaceTexture.h>
+#include <gui/IGraphicBufferProducer.h>
namespace android {
// ----------------------------------------------------------------------------
@@ -43,17 +43,17 @@
};
-class BpSurfaceTexture : public BpInterface<ISurfaceTexture>
+class BpGraphicBufferProducer : public BpInterface<IGraphicBufferProducer>
{
public:
- BpSurfaceTexture(const sp<IBinder>& impl)
- : BpInterface<ISurfaceTexture>(impl)
+ BpGraphicBufferProducer(const sp<IBinder>& impl)
+ : BpInterface<IGraphicBufferProducer>(impl)
{
}
virtual status_t requestBuffer(int bufferIdx, sp<GraphicBuffer>* buf) {
Parcel data, reply;
- data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
+ data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
data.writeInt32(bufferIdx);
status_t result =remote()->transact(REQUEST_BUFFER, data, &reply);
if (result != NO_ERROR) {
@@ -71,7 +71,7 @@
virtual status_t setBufferCount(int bufferCount)
{
Parcel data, reply;
- data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
+ data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
data.writeInt32(bufferCount);
status_t result =remote()->transact(SET_BUFFER_COUNT, data, &reply);
if (result != NO_ERROR) {
@@ -84,7 +84,7 @@
virtual status_t dequeueBuffer(int *buf, sp<Fence>& fence,
uint32_t w, uint32_t h, uint32_t format, uint32_t usage) {
Parcel data, reply;
- data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
+ data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
data.writeInt32(w);
data.writeInt32(h);
data.writeInt32(format);
@@ -107,7 +107,7 @@
virtual status_t queueBuffer(int buf,
const QueueBufferInput& input, QueueBufferOutput* output) {
Parcel data, reply;
- data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
+ data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
data.writeInt32(buf);
data.write(input);
status_t result = remote()->transact(QUEUE_BUFFER, data, &reply);
@@ -122,7 +122,7 @@
virtual void cancelBuffer(int buf, sp<Fence> fence) {
Parcel data, reply;
bool hasFence = fence.get() && fence->isValid();
- data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
+ data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
data.writeInt32(buf);
data.writeInt32(hasFence);
if (hasFence) {
@@ -133,7 +133,7 @@
virtual int query(int what, int* value) {
Parcel data, reply;
- data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
+ data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
data.writeInt32(what);
status_t result = remote()->transact(QUERY, data, &reply);
if (result != NO_ERROR) {
@@ -146,7 +146,7 @@
virtual status_t setSynchronousMode(bool enabled) {
Parcel data, reply;
- data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
+ data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
data.writeInt32(enabled);
status_t result = remote()->transact(SET_SYNCHRONOUS_MODE, data, &reply);
if (result != NO_ERROR) {
@@ -158,7 +158,7 @@
virtual status_t connect(int api, QueueBufferOutput* output) {
Parcel data, reply;
- data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
+ data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
data.writeInt32(api);
status_t result = remote()->transact(CONNECT, data, &reply);
if (result != NO_ERROR) {
@@ -171,7 +171,7 @@
virtual status_t disconnect(int api) {
Parcel data, reply;
- data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
+ data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
data.writeInt32(api);
status_t result =remote()->transact(DISCONNECT, data, &reply);
if (result != NO_ERROR) {
@@ -182,16 +182,16 @@
}
};
-IMPLEMENT_META_INTERFACE(SurfaceTexture, "android.gui.SurfaceTexture");
+IMPLEMENT_META_INTERFACE(GraphicBufferProducer, "android.gui.SurfaceTexture");
// ----------------------------------------------------------------------
-status_t BnSurfaceTexture::onTransact(
+status_t BnGraphicBufferProducer::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
switch(code) {
case REQUEST_BUFFER: {
- CHECK_INTERFACE(ISurfaceTexture, data, reply);
+ CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
int bufferIdx = data.readInt32();
sp<GraphicBuffer> buffer;
int result = requestBuffer(bufferIdx, &buffer);
@@ -203,14 +203,14 @@
return NO_ERROR;
} break;
case SET_BUFFER_COUNT: {
- CHECK_INTERFACE(ISurfaceTexture, data, reply);
+ CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
int bufferCount = data.readInt32();
int result = setBufferCount(bufferCount);
reply->writeInt32(result);
return NO_ERROR;
} break;
case DEQUEUE_BUFFER: {
- CHECK_INTERFACE(ISurfaceTexture, data, reply);
+ CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
uint32_t w = data.readInt32();
uint32_t h = data.readInt32();
uint32_t format = data.readInt32();
@@ -228,7 +228,7 @@
return NO_ERROR;
} break;
case QUEUE_BUFFER: {
- CHECK_INTERFACE(ISurfaceTexture, data, reply);
+ CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
int buf = data.readInt32();
QueueBufferInput input(data);
QueueBufferOutput* const output =
@@ -239,7 +239,7 @@
return NO_ERROR;
} break;
case CANCEL_BUFFER: {
- CHECK_INTERFACE(ISurfaceTexture, data, reply);
+ CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
int buf = data.readInt32();
sp<Fence> fence;
bool hasFence = data.readInt32();
@@ -251,7 +251,7 @@
return NO_ERROR;
} break;
case QUERY: {
- CHECK_INTERFACE(ISurfaceTexture, data, reply);
+ CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
int value;
int what = data.readInt32();
int res = query(what, &value);
@@ -260,14 +260,14 @@
return NO_ERROR;
} break;
case SET_SYNCHRONOUS_MODE: {
- CHECK_INTERFACE(ISurfaceTexture, data, reply);
+ CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
bool enabled = data.readInt32();
status_t res = setSynchronousMode(enabled);
reply->writeInt32(res);
return NO_ERROR;
} break;
case CONNECT: {
- CHECK_INTERFACE(ISurfaceTexture, data, reply);
+ CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
int api = data.readInt32();
QueueBufferOutput* const output =
reinterpret_cast<QueueBufferOutput *>(
@@ -277,7 +277,7 @@
return NO_ERROR;
} break;
case DISCONNECT: {
- CHECK_INTERFACE(ISurfaceTexture, data, reply);
+ CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
int api = data.readInt32();
status_t res = disconnect(api);
reply->writeInt32(res);
@@ -293,11 +293,11 @@
return fence.get() && fence->isValid();
}
-ISurfaceTexture::QueueBufferInput::QueueBufferInput(const Parcel& parcel) {
+IGraphicBufferProducer::QueueBufferInput::QueueBufferInput(const Parcel& parcel) {
parcel.read(*this);
}
-size_t ISurfaceTexture::QueueBufferInput::getFlattenedSize() const
+size_t IGraphicBufferProducer::QueueBufferInput::getFlattenedSize() const
{
return sizeof(timestamp)
+ sizeof(crop)
@@ -307,12 +307,12 @@
+ (isValid(fence) ? fence->getFlattenedSize() : 0);
}
-size_t ISurfaceTexture::QueueBufferInput::getFdCount() const
+size_t IGraphicBufferProducer::QueueBufferInput::getFdCount() const
{
return isValid(fence) ? fence->getFdCount() : 0;
}
-status_t ISurfaceTexture::QueueBufferInput::flatten(void* buffer, size_t size,
+status_t IGraphicBufferProducer::QueueBufferInput::flatten(void* buffer, size_t size,
int fds[], size_t count) const
{
status_t err = NO_ERROR;
@@ -329,7 +329,7 @@
return err;
}
-status_t ISurfaceTexture::QueueBufferInput::unflatten(void const* buffer,
+status_t IGraphicBufferProducer::QueueBufferInput::unflatten(void const* buffer,
size_t size, int fds[], size_t count)
{
status_t err = NO_ERROR;
diff --git a/libs/gui/ISurface.cpp b/libs/gui/ISurface.cpp
index c2ea183..8c25f45 100644
--- a/libs/gui/ISurface.cpp
+++ b/libs/gui/ISurface.cpp
@@ -23,7 +23,7 @@
#include <binder/Parcel.h>
#include <gui/ISurface.h>
-#include <gui/ISurfaceTexture.h>
+#include <gui/IGraphicBufferProducer.h>
namespace android {
@@ -37,11 +37,11 @@
{
}
- virtual sp<ISurfaceTexture> getSurfaceTexture() const {
+ virtual sp<IGraphicBufferProducer> getSurfaceTexture() const {
Parcel data, reply;
data.writeInterfaceToken(ISurface::getInterfaceDescriptor());
remote()->transact(GET_SURFACE_TEXTURE, data, &reply);
- return interface_cast<ISurfaceTexture>(reply.readStrongBinder());
+ return interface_cast<IGraphicBufferProducer>(reply.readStrongBinder());
}
};
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp
index 85a9488..72b6277 100644
--- a/libs/gui/ISurfaceComposer.cpp
+++ b/libs/gui/ISurfaceComposer.cpp
@@ -28,7 +28,7 @@
#include <gui/BitTube.h>
#include <gui/IDisplayEventConnection.h>
#include <gui/ISurfaceComposer.h>
-#include <gui/ISurfaceTexture.h>
+#include <gui/IGraphicBufferProducer.h>
#include <private/gui/LayerState.h>
@@ -124,7 +124,7 @@
}
virtual bool authenticateSurfaceTexture(
- const sp<ISurfaceTexture>& surfaceTexture) const
+ const sp<IGraphicBufferProducer>& bufferProducer) const
{
Parcel data, reply;
int err = NO_ERROR;
@@ -135,7 +135,7 @@
"interface descriptor: %s (%d)", strerror(-err), -err);
return false;
}
- err = data.writeStrongBinder(surfaceTexture->asBinder());
+ err = data.writeStrongBinder(bufferProducer->asBinder());
if (err != NO_ERROR) {
ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error writing "
"strong binder to parcel: %s (%d)", strerror(-err), -err);
@@ -288,9 +288,9 @@
} break;
case AUTHENTICATE_SURFACE: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
- sp<ISurfaceTexture> surfaceTexture =
- interface_cast<ISurfaceTexture>(data.readStrongBinder());
- int32_t result = authenticateSurfaceTexture(surfaceTexture) ? 1 : 0;
+ sp<IGraphicBufferProducer> bufferProducer =
+ interface_cast<IGraphicBufferProducer>(data.readStrongBinder());
+ int32_t result = authenticateSurfaceTexture(bufferProducer) ? 1 : 0;
reply->writeInt32(result);
} break;
case CREATE_DISPLAY_EVENT_CONNECTION: {
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index e2604f8..5e5edcd 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -17,7 +17,7 @@
#include <utils/Errors.h>
#include <binder/Parcel.h>
#include <gui/ISurfaceComposerClient.h>
-#include <gui/ISurfaceTexture.h>
+#include <gui/IGraphicBufferProducer.h>
#include <private/gui/LayerState.h>
namespace android {
@@ -74,7 +74,7 @@
status_t DisplayState::read(const Parcel& input) {
token = input.readStrongBinder();
- surface = interface_cast<ISurfaceTexture>(input.readStrongBinder());
+ surface = interface_cast<IGraphicBufferProducer>(input.readStrongBinder());
what = input.readInt32();
layerStack = input.readInt32();
orientation = input.readInt32();
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
index 1745061..51d37b3 100644
--- a/libs/gui/Surface.cpp
+++ b/libs/gui/Surface.cpp
@@ -179,7 +179,7 @@
identity = control->mIdentity;
}
parcel->writeStrongBinder(sur!=0 ? sur->asBinder() : NULL);
- parcel->writeStrongBinder(NULL); // NULL ISurfaceTexture in this case.
+ parcel->writeStrongBinder(NULL); // NULL IGraphicBufferProducer in this case.
parcel->writeInt32(identity);
return NO_ERROR;
}
@@ -205,7 +205,7 @@
mSurface(surface->mSurface),
mIdentity(surface->mIdentity)
{
- sp<ISurfaceTexture> st;
+ sp<IGraphicBufferProducer> st;
if (mSurface != NULL) {
st = mSurface->getSurfaceTexture();
}
@@ -217,9 +217,9 @@
{
mSurface = interface_cast<ISurface>(ref);
sp<IBinder> st_binder(parcel.readStrongBinder());
- sp<ISurfaceTexture> st;
+ sp<IGraphicBufferProducer> st;
if (st_binder != NULL) {
- st = interface_cast<ISurfaceTexture>(st_binder);
+ st = interface_cast<IGraphicBufferProducer>(st_binder);
} else if (mSurface != NULL) {
st = mSurface->getSurfaceTexture();
}
@@ -228,7 +228,7 @@
init(st);
}
-Surface::Surface(const sp<ISurfaceTexture>& st)
+Surface::Surface(const sp<IGraphicBufferProducer>& st)
: SurfaceTextureClient(),
mSurface(NULL),
mIdentity(0)
@@ -240,7 +240,7 @@
const sp<Surface>& surface, Parcel* parcel)
{
sp<ISurface> sur;
- sp<ISurfaceTexture> st;
+ sp<IGraphicBufferProducer> st;
uint32_t identity = 0;
if (Surface::isValid(surface)) {
sur = surface->mSurface;
@@ -249,8 +249,8 @@
} else if (surface != 0 &&
(surface->mSurface != NULL ||
surface->getISurfaceTexture() != NULL)) {
- ALOGE("Parceling invalid surface with non-NULL ISurface/ISurfaceTexture as NULL: "
- "mSurface = %p, surfaceTexture = %p, mIdentity = %d, ",
+ ALOGE("Parceling invalid surface with non-NULL ISurface/IGraphicBufferProducer "
+ "as NULL: mSurface = %p, bufferProducer = %p, mIdentity = %d, ",
surface->mSurface.get(), surface->getISurfaceTexture().get(),
surface->mIdentity);
}
@@ -275,7 +275,7 @@
} else {
// The Surface was found in the cache, but we still should clear any
// remaining data from the parcel.
- data.readStrongBinder(); // ISurfaceTexture
+ data.readStrongBinder(); // IGraphicBufferProducer
data.readInt32(); // identity
}
if (surface->mSurface == NULL && surface->getISurfaceTexture() == NULL) {
@@ -296,12 +296,12 @@
}
}
-void Surface::init(const sp<ISurfaceTexture>& surfaceTexture)
+void Surface::init(const sp<IGraphicBufferProducer>& bufferProducer)
{
- if (mSurface != NULL || surfaceTexture != NULL) {
- ALOGE_IF(surfaceTexture==0, "got a NULL ISurfaceTexture from ISurface");
- if (surfaceTexture != NULL) {
- setISurfaceTexture(surfaceTexture);
+ if (mSurface != NULL || bufferProducer != NULL) {
+ ALOGE_IF(bufferProducer==0, "got a NULL IGraphicBufferProducer from ISurface");
+ if (bufferProducer != NULL) {
+ setISurfaceTexture(bufferProducer);
setUsage(GraphicBuffer::USAGE_HW_RENDER);
}
@@ -328,7 +328,7 @@
return getISurfaceTexture() != NULL;
}
-sp<ISurfaceTexture> Surface::getSurfaceTexture() {
+sp<IGraphicBufferProducer> Surface::getSurfaceTexture() {
return getISurfaceTexture();
}
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 746057b..0c6881a 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -157,7 +157,8 @@
status_t setLayerStack(const sp<SurfaceComposerClient>& client,
SurfaceID id, uint32_t layerStack);
- void setDisplaySurface(const sp<IBinder>& token, const sp<ISurfaceTexture>& surface);
+ void setDisplaySurface(const sp<IBinder>& token,
+ const sp<IGraphicBufferProducer>& bufferProducer);
void setDisplayLayerStack(const sp<IBinder>& token, uint32_t layerStack);
void setDisplayProjection(const sp<IBinder>& token,
uint32_t orientation,
@@ -386,10 +387,10 @@
}
void Composer::setDisplaySurface(const sp<IBinder>& token,
- const sp<ISurfaceTexture>& surface) {
+ const sp<IGraphicBufferProducer>& bufferProducer) {
Mutex::Autolock _l(mLock);
DisplayState& s(getDisplayStateLocked(token));
- s.surface = surface;
+ s.surface = bufferProducer;
s.what |= DisplayState::eSurfaceChanged;
}
@@ -571,8 +572,8 @@
// ----------------------------------------------------------------------------
void SurfaceComposerClient::setDisplaySurface(const sp<IBinder>& token,
- const sp<ISurfaceTexture>& surface) {
- Composer::getInstance().setDisplaySurface(token, surface);
+ const sp<IGraphicBufferProducer>& bufferProducer) {
+ Composer::getInstance().setDisplaySurface(token, bufferProducer);
}
void SurfaceComposerClient::setDisplayLayerStack(const sp<IBinder>& token,
diff --git a/libs/gui/SurfaceTextureClient.cpp b/libs/gui/SurfaceTextureClient.cpp
index 7588b9e..c015b81 100644
--- a/libs/gui/SurfaceTextureClient.cpp
+++ b/libs/gui/SurfaceTextureClient.cpp
@@ -27,7 +27,7 @@
#include <gui/ISurfaceComposer.h>
#include <gui/SurfaceComposerClient.h>
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
#include <gui/SurfaceTextureClient.h>
#include <private/gui/ComposerService.h>
@@ -35,10 +35,10 @@
namespace android {
SurfaceTextureClient::SurfaceTextureClient(
- const sp<ISurfaceTexture>& surfaceTexture)
+ const sp<IGraphicBufferProducer>& bufferProducer)
{
SurfaceTextureClient::init();
- SurfaceTextureClient::setISurfaceTexture(surfaceTexture);
+ SurfaceTextureClient::setISurfaceTexture(bufferProducer);
}
SurfaceTextureClient::SurfaceTextureClient() {
@@ -86,12 +86,12 @@
}
void SurfaceTextureClient::setISurfaceTexture(
- const sp<ISurfaceTexture>& surfaceTexture)
+ const sp<IGraphicBufferProducer>& bufferProducer)
{
- mSurfaceTexture = surfaceTexture;
+ mSurfaceTexture = bufferProducer;
}
-sp<ISurfaceTexture> SurfaceTextureClient::getISurfaceTexture() const {
+sp<IGraphicBufferProducer> SurfaceTextureClient::getISurfaceTexture() const {
return mSurfaceTexture;
}
@@ -197,20 +197,20 @@
status_t result = mSurfaceTexture->dequeueBuffer(&buf, fence, reqW, reqH,
mReqFormat, mReqUsage);
if (result < 0) {
- ALOGV("dequeueBuffer: ISurfaceTexture::dequeueBuffer(%d, %d, %d, %d)"
+ ALOGV("dequeueBuffer: IGraphicBufferProducer::dequeueBuffer(%d, %d, %d, %d)"
"failed: %d", mReqWidth, mReqHeight, mReqFormat, mReqUsage,
result);
return result;
}
sp<GraphicBuffer>& gbuf(mSlots[buf].buffer);
- if (result & ISurfaceTexture::RELEASE_ALL_BUFFERS) {
+ if (result & IGraphicBufferProducer::RELEASE_ALL_BUFFERS) {
freeAllBuffers();
}
- if ((result & ISurfaceTexture::BUFFER_NEEDS_REALLOCATION) || gbuf == 0) {
+ if ((result & IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION) || gbuf == 0) {
result = mSurfaceTexture->requestBuffer(buf, &gbuf);
if (result != NO_ERROR) {
- ALOGE("dequeueBuffer: ISurfaceTexture::requestBuffer failed: %d",
+ ALOGE("dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: %d",
result);
return result;
}
@@ -288,8 +288,8 @@
mCrop.intersect(Rect(buffer->width, buffer->height), &crop);
sp<Fence> fence(fenceFd >= 0 ? new Fence(fenceFd) : NULL);
- ISurfaceTexture::QueueBufferOutput output;
- ISurfaceTexture::QueueBufferInput input(timestamp, crop, mScalingMode,
+ IGraphicBufferProducer::QueueBufferOutput output;
+ IGraphicBufferProducer::QueueBufferInput input(timestamp, crop, mScalingMode,
mTransform, fence);
status_t err = mSurfaceTexture->queueBuffer(i, input, &output);
if (err != OK) {
@@ -497,7 +497,7 @@
ATRACE_CALL();
ALOGV("SurfaceTextureClient::connect");
Mutex::Autolock lock(mMutex);
- ISurfaceTexture::QueueBufferOutput output;
+ IGraphicBufferProducer::QueueBufferOutput output;
int err = mSurfaceTexture->connect(api, &output);
if (err == NO_ERROR) {
uint32_t numPendingBuffers = 0;
@@ -566,7 +566,7 @@
Mutex::Autolock lock(mMutex);
status_t err = mSurfaceTexture->setBufferCount(bufferCount);
- ALOGE_IF(err, "ISurfaceTexture::setBufferCount(%d) returned %s",
+ ALOGE_IF(err, "IGraphicBufferProducer::setBufferCount(%d) returned %s",
bufferCount, strerror(-err));
if (err == NO_ERROR) {
diff --git a/libs/gui/tests/BufferQueue_test.cpp b/libs/gui/tests/BufferQueue_test.cpp
index 817abb4..12cbfb0 100644
--- a/libs/gui/tests/BufferQueue_test.cpp
+++ b/libs/gui/tests/BufferQueue_test.cpp
@@ -63,19 +63,19 @@
TEST_F(BufferQueueTest, AcquireBuffer_ExceedsMaxAcquireCount_Fails) {
sp<DummyConsumer> dc(new DummyConsumer);
mBQ->consumerConnect(dc);
- ISurfaceTexture::QueueBufferOutput qbo;
+ IGraphicBufferProducer::QueueBufferOutput qbo;
mBQ->connect(NATIVE_WINDOW_API_CPU, &qbo);
mBQ->setBufferCount(4);
int slot;
sp<Fence> fence;
sp<GraphicBuffer> buf;
- ISurfaceTexture::QueueBufferInput qbi(0, Rect(0, 0, 1, 1),
+ IGraphicBufferProducer::QueueBufferInput qbi(0, Rect(0, 0, 1, 1),
NATIVE_WINDOW_SCALING_MODE_FREEZE, 0, fence);
BufferQueue::BufferItem item;
for (int i = 0; i < 2; i++) {
- ASSERT_EQ(ISurfaceTexture::BUFFER_NEEDS_REALLOCATION,
+ ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION,
mBQ->dequeueBuffer(&slot, fence, 1, 1, 0,
GRALLOC_USAGE_SW_READ_OFTEN));
ASSERT_EQ(OK, mBQ->requestBuffer(slot, &buf));
@@ -83,7 +83,7 @@
ASSERT_EQ(OK, mBQ->acquireBuffer(&item));
}
- ASSERT_EQ(ISurfaceTexture::BUFFER_NEEDS_REALLOCATION,
+ ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION,
mBQ->dequeueBuffer(&slot, fence, 1, 1, 0,
GRALLOC_USAGE_SW_READ_OFTEN));
ASSERT_EQ(OK, mBQ->requestBuffer(slot, &buf));
diff --git a/libs/gui/tests/SurfaceTextureClient_test.cpp b/libs/gui/tests/SurfaceTextureClient_test.cpp
index baeca06..2df83a0 100644
--- a/libs/gui/tests/SurfaceTextureClient_test.cpp
+++ b/libs/gui/tests/SurfaceTextureClient_test.cpp
@@ -40,7 +40,7 @@
ALOGV("Begin test: %s.%s", testInfo->test_case_name(),
testInfo->name());
- mST = new SurfaceTexture(123);
+ mST = new GLConsumer(123);
mSTC = new SurfaceTextureClient(mST->getBufferQueue());
mANW = mSTC;
@@ -102,7 +102,7 @@
return sDefaultConfigAttribs;
}
- sp<SurfaceTexture> mST;
+ sp<GLConsumer> mST;
sp<SurfaceTextureClient> mSTC;
sp<ANativeWindow> mANW;
@@ -112,7 +112,7 @@
};
TEST_F(SurfaceTextureClientTest, GetISurfaceTextureIsNotNull) {
- sp<ISurfaceTexture> ist(mSTC->getISurfaceTexture());
+ sp<IGraphicBufferProducer> ist(mSTC->getISurfaceTexture());
ASSERT_TRUE(ist != NULL);
}
@@ -250,7 +250,7 @@
}
TEST_F(SurfaceTextureClientTest, SurfaceTextureSetDefaultSize) {
- sp<SurfaceTexture> st(mST);
+ sp<GLConsumer> st(mST);
ANativeWindowBuffer* buf;
EXPECT_EQ(OK, st->setDefaultBufferSize(16, 8));
ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf));
@@ -464,7 +464,7 @@
// from the SurfaceTexture class.
TEST_F(SurfaceTextureClientTest, DISABLED_SurfaceTextureSyncModeWaitRetire) {
class MyThread : public Thread {
- sp<SurfaceTexture> mST;
+ sp<GLConsumer> mST;
EGLContext ctx;
EGLSurface sur;
EGLDisplay dpy;
@@ -480,7 +480,7 @@
return false;
}
public:
- MyThread(const sp<SurfaceTexture>& mST)
+ MyThread(const sp<GLConsumer>& mST)
: mST(mST), mBufferRetired(false) {
ctx = eglGetCurrentContext();
sur = eglGetCurrentSurface(EGL_DRAW);
@@ -685,7 +685,7 @@
ASSERT_NE(EGL_NO_CONTEXT, mEglContext);
for (int i = 0; i < NUM_SURFACE_TEXTURES; i++) {
- sp<SurfaceTexture> st(new SurfaceTexture(i));
+ sp<GLConsumer> st(new GLConsumer(i));
sp<SurfaceTextureClient> stc(new SurfaceTextureClient(st->getBufferQueue()));
mEglSurfaces[i] = eglCreateWindowSurface(mEglDisplay, myConfig,
static_cast<ANativeWindow*>(stc.get()), NULL);
diff --git a/libs/gui/tests/SurfaceTexture_test.cpp b/libs/gui/tests/SurfaceTexture_test.cpp
index 58976ad..b6020ca 100644
--- a/libs/gui/tests/SurfaceTexture_test.cpp
+++ b/libs/gui/tests/SurfaceTexture_test.cpp
@@ -18,7 +18,7 @@
//#define LOG_NDEBUG 0
#include <gtest/gtest.h>
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
#include <gui/SurfaceTextureClient.h>
#include <ui/GraphicBuffer.h>
#include <utils/String8.h>
@@ -384,7 +384,7 @@
virtual void SetUp() {
GLTest::SetUp();
- mST = new SurfaceTexture(TEX_ID);
+ mST = new GLConsumer(TEX_ID);
mSTC = new SurfaceTextureClient(mST->getBufferQueue());
mANW = mSTC;
mTextureRenderer = new TextureRenderer(TEX_ID, mST);
@@ -406,7 +406,7 @@
class TextureRenderer: public RefBase {
public:
- TextureRenderer(GLuint texName, const sp<SurfaceTexture>& st):
+ TextureRenderer(GLuint texName, const sp<GLConsumer>& st):
mTexName(texName),
mST(st) {
}
@@ -447,7 +447,7 @@
ASSERT_NE(-1, mTexMatrixHandle);
}
- // drawTexture draws the SurfaceTexture over the entire GL viewport.
+ // drawTexture draws the GLConsumer over the entire GL viewport.
void drawTexture() {
static const GLfloat triangleVertices[] = {
-1.0f, 1.0f,
@@ -494,14 +494,14 @@
}
GLuint mTexName;
- sp<SurfaceTexture> mST;
+ sp<GLConsumer> mST;
GLuint mPgm;
GLint mPositionHandle;
GLint mTexSamplerHandle;
GLint mTexMatrixHandle;
};
- class FrameWaiter : public SurfaceTexture::FrameAvailableListener {
+ class FrameWaiter : public GLConsumer::FrameAvailableListener {
public:
FrameWaiter():
mPendingFrames(0) {
@@ -526,7 +526,7 @@
Condition mCondition;
};
- // Note that SurfaceTexture will lose the notifications
+ // Note that GLConsumer will lose the notifications
// onBuffersReleased and onFrameAvailable as there is currently
// no way to forward the events. This DisconnectWaiter will not let the
// disconnect finish until finishDisconnect() is called. It will
@@ -575,7 +575,7 @@
Condition mFrameCondition;
};
- sp<SurfaceTexture> mST;
+ sp<GLConsumer> mST;
sp<SurfaceTextureClient> mSTC;
sp<ANativeWindow> mANW;
sp<TextureRenderer> mTextureRenderer;
@@ -1070,7 +1070,7 @@
EXPECT_TRUE(checkPixel( 3, 52, 35, 231, 35, 35));
}
-// Tests if SurfaceTexture and BufferQueue are robust enough
+// Tests if GLConsumer and BufferQueue are robust enough
// to handle a special case where updateTexImage is called
// in the middle of disconnect. This ordering is enforced
// by blocking in the disconnect callback.
@@ -1123,12 +1123,12 @@
sp<Thread> pt(new ProducerThread(mANW));
pt->run();
- // eat a frame so SurfaceTexture will own an at least one slot
+ // eat a frame so GLConsumer will own an at least one slot
dw->waitForFrame();
EXPECT_EQ(OK,mST->updateTexImage());
dw->waitForFrame();
- // Could fail here as SurfaceTexture thinks it still owns the slot
+ // Could fail here as GLConsumer thinks it still owns the slot
// but bufferQueue has released all slots
EXPECT_EQ(OK,mST->updateTexImage());
@@ -1136,7 +1136,7 @@
}
-// This test ensures that the SurfaceTexture clears the mCurrentTexture
+// This test ensures that the GLConsumer clears the mCurrentTexture
// when it is disconnected and reconnected. Otherwise it will
// attempt to release a buffer that it does not owned
TEST_F(SurfaceTextureGLTest, DisconnectClearsCurrentTexture) {
@@ -1581,7 +1581,7 @@
// This test should have the only reference to buffer 0.
EXPECT_EQ(1, buffers[0]->getStrongCount());
- // The SurfaceTexture should hold a single reference to buffer 1 in its
+ // The GLConsumer should hold a single reference to buffer 1 in its
// mCurrentBuffer member. All of the references in the slots should have
// been released.
EXPECT_EQ(2, buffers[1]->getStrongCount());
@@ -1615,7 +1615,7 @@
buffers[i] = mST->getCurrentBuffer();
}
- // Abandon the SurfaceTexture, releasing the ref that the SurfaceTexture has
+ // Abandon the GLConsumer, releasing the ref that the GLConsumer has
// on buffers[2].
mST->abandon();
@@ -1847,7 +1847,7 @@
* This test fixture is for testing GL -> GL texture streaming from one thread
* to another. It contains functionality to create a producer thread that will
* perform GL rendering to an ANativeWindow that feeds frames to a
- * SurfaceTexture. Additionally it supports interlocking the producer and
+ * GLConsumer. Additionally it supports interlocking the producer and
* consumer threads so that a specific sequence of calls can be
* deterministically created by the test.
*
@@ -1914,13 +1914,13 @@
// FrameCondition is a utility class for interlocking between the producer
// and consumer threads. The FrameCondition object should be created and
// destroyed in the consumer thread only. The consumer thread should set
- // the FrameCondition as the FrameAvailableListener of the SurfaceTexture,
+ // the FrameCondition as the FrameAvailableListener of the GLConsumer,
// and should call both waitForFrame and finishFrame once for each expected
// frame.
//
// This interlocking relies on the fact that onFrameAvailable gets called
- // synchronously from SurfaceTexture::queueBuffer.
- class FrameCondition : public SurfaceTexture::FrameAvailableListener {
+ // synchronously from GLConsumer::queueBuffer.
+ class FrameCondition : public GLConsumer::FrameAvailableListener {
public:
FrameCondition():
mFrameAvailable(false),
@@ -1951,7 +1951,7 @@
ALOGV("-finishFrame");
}
- // This should be called by SurfaceTexture on the producer thread.
+ // This should be called by GLConsumer on the producer thread.
virtual void onFrameAvailable() {
Mutex::Autolock lock(mMutex);
ALOGV("+onFrameAvailable");
diff --git a/opengl/tests/EGLTest/EGL_test.cpp b/opengl/tests/EGLTest/EGL_test.cpp
index d511cae..ec433fb 100644
--- a/opengl/tests/EGLTest/EGL_test.cpp
+++ b/opengl/tests/EGLTest/EGL_test.cpp
@@ -104,7 +104,7 @@
// Create a EGLSurface
sp<BufferQueue> bq = new BufferQueue();
bq->consumerConnect(new DummyConsumer());
- sp<SurfaceTextureClient> mSTC = new SurfaceTextureClient(static_cast<sp<ISurfaceTexture> >( bq));
+ sp<SurfaceTextureClient> mSTC = new SurfaceTextureClient(static_cast<sp<IGraphicBufferProducer> >( bq));
sp<ANativeWindow> mANW = mSTC;
EGLSurface eglSurface = eglCreateWindowSurface(mEglDisplay, config,
diff --git a/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp b/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp
index 7904ac7..290d102 100644
--- a/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp
+++ b/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp
@@ -1,4 +1,4 @@
-**
+/*
** Copyright 2012, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
@@ -27,7 +27,7 @@
#include <EGL/egl.h>
#include <gui/Surface.h>
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
#include <gui/SurfaceTextureClient.h>
#include <ui/ANativeObjectBase.h>
diff --git a/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp b/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp
index 610cde5..a3d000a 100644
--- a/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp
+++ b/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp
@@ -90,7 +90,7 @@
jint _remaining;
EGLint *attrib_list = (EGLint *) 0;
android::sp<ANativeWindow> window;
- android::sp<android::SurfaceTexture> surfaceTexture;
+ android::sp<android::GLConsumer> glConsumer;
if (!attrib_list_ref) {
_exception = 1;
@@ -111,8 +111,8 @@
_exceptionMessage = "Make sure the SurfaceView or associated SurfaceHolder has a valid Surface";
goto exit;
}
- surfaceTexture = android::SurfaceTexture_getSurfaceTexture(_env, win);
- window = new android::SurfaceTextureClient(surfaceTexture);
+ glConsumer = android::SurfaceTexture_getSurfaceTexture(_env, win);
+ window = new android::SurfaceTextureClient(glConsumer);
if (window == NULL)
goto not_valid_surface;
diff --git a/services/surfaceflinger/DisplayHardware/FramebufferSurface.h b/services/surfaceflinger/DisplayHardware/FramebufferSurface.h
index 6336345..b61b7f5 100644
--- a/services/surfaceflinger/DisplayHardware/FramebufferSurface.h
+++ b/services/surfaceflinger/DisplayHardware/FramebufferSurface.h
@@ -46,7 +46,7 @@
// current buffer is no longer being read. This fence will be returned to
// the producer when the current buffer is released by updateTexImage().
// Multiple fences can be set for a given buffer; they will be merged into
- // a single union fence. The SurfaceTexture will close the file descriptor
+ // a single union fence. The GLConsumer will close the file descriptor
// when finished with it.
status_t setReleaseFenceFd(int fenceFd);
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index a1d46d9..8c2dade 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -127,8 +127,8 @@
{
class BSurface : public BnSurface, public LayerCleaner {
wp<const Layer> mOwner;
- virtual sp<ISurfaceTexture> getSurfaceTexture() const {
- sp<ISurfaceTexture> res;
+ virtual sp<IGraphicBufferProducer> getSurfaceTexture() const {
+ sp<IGraphicBufferProducer> res;
sp<const Layer> that( mOwner.promote() );
if (that != NULL) {
res = that->mSurfaceFlingerConsumer->getBufferQueue();
diff --git a/services/surfaceflinger/LayerBase.cpp b/services/surfaceflinger/LayerBase.cpp
index 9b03c74..31ef941 100644
--- a/services/surfaceflinger/LayerBase.cpp
+++ b/services/surfaceflinger/LayerBase.cpp
@@ -506,7 +506,7 @@
sp<ISurface> LayerBaseClient::createSurface()
{
class BSurface : public BnSurface, public LayerCleaner {
- virtual sp<ISurfaceTexture> getSurfaceTexture() const { return 0; }
+ virtual sp<IGraphicBufferProducer> getSurfaceTexture() const { return 0; }
public:
BSurface(const sp<SurfaceFlinger>& flinger,
const sp<LayerBaseClient>& layer)
diff --git a/services/surfaceflinger/LayerBase.h b/services/surfaceflinger/LayerBase.h
index 46713fa..7a9471e 100644
--- a/services/surfaceflinger/LayerBase.h
+++ b/services/surfaceflinger/LayerBase.h
@@ -243,8 +243,8 @@
virtual void onPostComposition() { }
/**
- * Updates the SurfaceTexture's transform hint, for layers that have
- * a SurfaceTexture.
+ * Updates the GLConsumer's transform hint, for layers that have
+ * a GLConsumer.
*/
virtual void updateTransformHint(const sp<const DisplayDevice>& hw) const { }
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index f65b82f..f0e5719 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -503,7 +503,7 @@
sp<FramebufferSurface> fbs = new FramebufferSurface(*mHwc, i);
sp<SurfaceTextureClient> stc = new SurfaceTextureClient(
- static_cast< sp<ISurfaceTexture> >(fbs->getBufferQueue()));
+ static_cast< sp<IGraphicBufferProducer> >(fbs->getBufferQueue()));
sp<DisplayDevice> hw = new DisplayDevice(this,
type, isSecure, token, stc, fbs, mEGLConfig);
if (i > DisplayDevice::DISPLAY_PRIMARY) {
@@ -571,9 +571,9 @@
// ----------------------------------------------------------------------------
bool SurfaceFlinger::authenticateSurfaceTexture(
- const sp<ISurfaceTexture>& surfaceTexture) const {
+ const sp<IGraphicBufferProducer>& bufferProducer) const {
Mutex::Autolock _l(mStateLock);
- sp<IBinder> surfaceTextureBinder(surfaceTexture->asBinder());
+ sp<IBinder> surfaceTextureBinder(bufferProducer->asBinder());
// Check the visible layer list for the ISurface
const LayerVector& currentLayers = mCurrentState.layersSortedByZ;
@@ -590,7 +590,7 @@
}
// Check the layers in the purgatory. This check is here so that if a
- // SurfaceTexture gets destroyed before all the clients are done using it,
+ // GLConsumer gets destroyed before all the clients are done using it,
// the error will not be reported as "surface XYZ is not authenticated", but
// will instead fail later on when the client tries to use the surface,
// which should be reported as "surface XYZ returned an -ENODEV". The
@@ -1172,7 +1172,7 @@
// own rendering surface
fbs = new FramebufferSurface(*mHwc, state.type);
stc = new SurfaceTextureClient(
- static_cast< sp<ISurfaceTexture> >(
+ static_cast< sp<IGraphicBufferProducer> >(
fbs->getBufferQueue()));
} else {
if (state.surface != NULL) {
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 1b549e4..65fea30 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -163,7 +163,7 @@
bool isMainDisplay() const { return type == DisplayDevice::DISPLAY_PRIMARY; }
bool isVirtualDisplay() const { return type >= DisplayDevice::DISPLAY_VIRTUAL; }
DisplayDevice::DisplayType type;
- sp<ISurfaceTexture> surface;
+ sp<IGraphicBufferProducer> surface;
uint32_t layerStack;
Rect viewport;
Rect frame;
@@ -195,7 +195,7 @@
const Vector<DisplayState>& displays, uint32_t flags);
virtual void bootFinished();
virtual bool authenticateSurfaceTexture(
- const sp<ISurfaceTexture>& surface) const;
+ const sp<IGraphicBufferProducer>& bufferProducer) const;
virtual sp<IDisplayEventConnection> createDisplayEventConnection();
virtual status_t captureScreen(const sp<IBinder>& display, sp<IMemoryHeap>* heap,
uint32_t* width, uint32_t* height, PixelFormat* format,
diff --git a/services/surfaceflinger/SurfaceFlingerConsumer.cpp b/services/surfaceflinger/SurfaceFlingerConsumer.cpp
index a316896..dc9089e 100644
--- a/services/surfaceflinger/SurfaceFlingerConsumer.cpp
+++ b/services/surfaceflinger/SurfaceFlingerConsumer.cpp
@@ -33,7 +33,7 @@
Mutex::Autolock lock(mMutex);
if (mAbandoned) {
- ALOGE("updateTexImage: SurfaceTexture is abandoned!");
+ ALOGE("updateTexImage: GLConsumer is abandoned!");
return NO_INIT;
}
diff --git a/services/surfaceflinger/SurfaceFlingerConsumer.h b/services/surfaceflinger/SurfaceFlingerConsumer.h
index 308a288..22eec81 100644
--- a/services/surfaceflinger/SurfaceFlingerConsumer.h
+++ b/services/surfaceflinger/SurfaceFlingerConsumer.h
@@ -17,20 +17,20 @@
#ifndef ANDROID_SURFACEFLINGERCONSUMER_H
#define ANDROID_SURFACEFLINGERCONSUMER_H
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
namespace android {
// ----------------------------------------------------------------------------
/*
- * This is a thin wrapper around SurfaceTexture.
+ * This is a thin wrapper around GLConsumer.
*/
-class SurfaceFlingerConsumer : public SurfaceTexture {
+class SurfaceFlingerConsumer : public GLConsumer {
public:
SurfaceFlingerConsumer(GLuint tex, bool allowSynchronousMode = true,
GLenum texTarget = GL_TEXTURE_EXTERNAL_OES, bool useFenceSync = true,
const sp<BufferQueue> &bufferQueue = 0)
- : SurfaceTexture(tex, allowSynchronousMode, texTarget, useFenceSync,
+ : GLConsumer(tex, allowSynchronousMode, texTarget, useFenceSync,
bufferQueue)
{}
@@ -44,12 +44,12 @@
};
// This version of updateTexImage() takes a functor that may be used to
- // reject the newly acquired buffer. Unlike the SurfaceTexture version,
+ // reject the newly acquired buffer. Unlike the GLConsumer version,
// this does not guarantee that the buffer has been bound to the GL
// texture.
status_t updateTexImage(BufferRejecter* rejecter);
- // See SurfaceTexture::bindTextureImageLocked().
+ // See GLConsumer::bindTextureImageLocked().
status_t bindTextureImage();
};
diff --git a/services/surfaceflinger/SurfaceTextureLayer.h b/services/surfaceflinger/SurfaceTextureLayer.h
index e892ea0..8baa8d2 100644
--- a/services/surfaceflinger/SurfaceTextureLayer.h
+++ b/services/surfaceflinger/SurfaceTextureLayer.h
@@ -29,8 +29,6 @@
class Layer;
-// SurfaceTextureLayer is now a BufferQueue since SurfaceTexture has been
-// refactored
class SurfaceTextureLayer : public BufferQueue
{
public: