diff options
author | Mathias Agopian <mathias@google.com> | 2012-03-07 19:36:08 -0800 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2012-03-07 19:36:08 -0800 |
commit | 8c79817dc6459baa2c79db88e3c3e4d5c07d6a61 (patch) | |
tree | d7e4dfcc8a7851d5851750989664ec81ca620d6d /include/gui | |
parent | 08965ec67ada98f63f8ac879cc44c8b0e7ff046d (diff) | |
download | frameworks_base-8c79817dc6459baa2c79db88e3c3e4d5c07d6a61.zip frameworks_base-8c79817dc6459baa2c79db88e3c3e4d5c07d6a61.tar.gz frameworks_base-8c79817dc6459baa2c79db88e3c3e4d5c07d6a61.tar.bz2 |
remove files that moved to frameworks/native
Change-Id: I140d291e520097b1148930f736823650e08488f7
Diffstat (limited to 'include/gui')
-rw-r--r-- | include/gui/BitTube.h | 54 | ||||
-rw-r--r-- | include/gui/BufferQueue.h | 426 | ||||
-rw-r--r-- | include/gui/DisplayEventReceiver.h | 123 | ||||
-rw-r--r-- | include/gui/IDisplayEventConnection.h | 73 | ||||
-rw-r--r-- | include/gui/IGraphicBufferAlloc.h | 58 | ||||
-rw-r--r-- | include/gui/ISensorEventConnection.h | 57 | ||||
-rw-r--r-- | include/gui/ISensorServer.h | 57 | ||||
-rw-r--r-- | include/gui/ISurface.h | 64 | ||||
-rw-r--r-- | include/gui/ISurfaceComposer.h | 174 | ||||
-rw-r--r-- | include/gui/ISurfaceComposerClient.h | 84 | ||||
-rw-r--r-- | include/gui/ISurfaceTexture.h | 146 | ||||
-rw-r--r-- | include/gui/Sensor.h | 95 | ||||
-rw-r--r-- | include/gui/SensorEventQueue.h | 82 | ||||
-rw-r--r-- | include/gui/SensorManager.h | 75 | ||||
-rw-r--r-- | include/gui/Surface.h | 175 | ||||
-rw-r--r-- | include/gui/SurfaceComposerClient.h | 177 | ||||
-rw-r--r-- | include/gui/SurfaceTexture.h | 275 | ||||
-rw-r--r-- | include/gui/SurfaceTextureClient.h | 165 |
18 files changed, 0 insertions, 2360 deletions
diff --git a/include/gui/BitTube.h b/include/gui/BitTube.h deleted file mode 100644 index 76389a0..0000000 --- a/include/gui/BitTube.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_GUI_SENSOR_CHANNEL_H -#define ANDROID_GUI_SENSOR_CHANNEL_H - -#include <stdint.h> -#include <sys/types.h> - -#include <utils/Errors.h> -#include <utils/RefBase.h> - - -namespace android { -// ---------------------------------------------------------------------------- -class Parcel; - -class BitTube : public RefBase -{ -public: - - BitTube(); - BitTube(const Parcel& data); - virtual ~BitTube(); - - status_t initCheck() const; - int getFd() const; - ssize_t write(void const* vaddr, size_t size); - ssize_t read(void* vaddr, size_t size); - - status_t writeToParcel(Parcel* reply) const; - -private: - int mSendFd; - mutable int mReceiveFd; -}; - -// ---------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_GUI_SENSOR_CHANNEL_H diff --git a/include/gui/BufferQueue.h b/include/gui/BufferQueue.h deleted file mode 100644 index 8c21a28..0000000 --- a/include/gui/BufferQueue.h +++ /dev/null @@ -1,426 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_GUI_BUFFERQUEUE_H -#define ANDROID_GUI_BUFFERQUEUE_H - -#include <EGL/egl.h> - -#include <gui/IGraphicBufferAlloc.h> -#include <gui/ISurfaceTexture.h> - -#include <ui/GraphicBuffer.h> - -#include <utils/String8.h> -#include <utils/Vector.h> -#include <utils/threads.h> - -namespace android { -// ---------------------------------------------------------------------------- - -class BufferQueue : public BnSurfaceTexture { -public: - enum { MIN_UNDEQUEUED_BUFFERS = 2 }; - enum { - MIN_ASYNC_BUFFER_SLOTS = MIN_UNDEQUEUED_BUFFERS + 1, - MIN_SYNC_BUFFER_SLOTS = MIN_UNDEQUEUED_BUFFERS - }; - enum { NUM_BUFFER_SLOTS = 32 }; - enum { NO_CONNECTED_API = 0 }; - enum { INVALID_BUFFER_SLOT = -1 }; - - struct FrameAvailableListener : public virtual RefBase { - // onFrameAvailable() is called from queueBuffer() each time an - // additional frame becomes available for consumption. This means that - // frames that are queued while in asynchronous mode only trigger the - // callback if no previous frames are pending. Frames queued while in - // synchronous mode always trigger the callback. - // - // This is called without any lock held and can be called concurrently - // by multiple threads. - virtual void onFrameAvailable() = 0; - }; - - // BufferQueue manages a pool of gralloc memory slots to be used - // by producers and consumers. - // allowSynchronousMode specifies whether or not synchronous mode can be - // enabled. - 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). - virtual status_t setBufferCount(int bufferCount); - - virtual status_t requestBuffer(int slot, sp<GraphicBuffer>* buf); - - // dequeueBuffer gets the next buffer slot index for the client to use. If a - // buffer slot is available then that slot index is written to the location - // pointed to by the buf argument and a status of OK is returned. If no - // slot is available then a status of -EBUSY is returned and buf is - // unmodified. - // The width and height parameters must be no greater than the minimum of - // GL_MAX_VIEWPORT_DIMS and GL_MAX_TEXTURE_SIZE (see: glGetIntegerv). - // An error due to invalid dimensions might not be reported until - // updateTexImage() is called. - virtual status_t dequeueBuffer(int *buf, uint32_t width, uint32_t height, - uint32_t format, uint32_t usage); - - // queueBuffer returns a filled buffer to the BufferQueue. In addition, a - // timestamp must be provided for the buffer. The timestamp is in - // nanoseconds, and must be monotonically increasing. Its other semantics - // (zero point, etc) are client-dependent and should be documented by the - // client. - virtual status_t queueBuffer(int buf, int64_t timestamp, - uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform); - virtual void cancelBuffer(int buf); - virtual status_t setCrop(const Rect& reg); - virtual status_t setTransform(uint32_t transform); - virtual status_t setScalingMode(int mode); - - // setSynchronousMode set whether dequeueBuffer is synchronous or - // asynchronous. In synchronous mode, dequeueBuffer blocks until - // a buffer is available, the currently bound buffer can be dequeued and - // queued buffers will be retired in order. - // The default mode is asynchronous. - 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 - // except for getAllocator. - // - // This method will fail if the connect was previously called on the - // BufferQueue and no corresponding disconnect call was made. - virtual status_t connect(int api, - uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform); - - // 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. - // Successfully calling connect after this will allow the other methods to - // succeed again. - // - // This method will fail if the the BufferQueue is not currently - // connected to the specified client API. - virtual status_t disconnect(int api); - - // dump our state in a String - virtual void dump(String8& result) const; - virtual void dump(String8& result, const char* prefix, char* buffer, size_t SIZE) const; - - // public facing structure for BufferSlot - struct BufferItem { - - BufferItem() - : - mTransform(0), - mScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE), - mTimestamp(0), - mFrameNumber(0), - mBuf(INVALID_BUFFER_SLOT) { - mCrop.makeInvalid(); - } - // mGraphicBuffer points to the buffer allocated for this slot or is NULL - // if no buffer has been allocated. - sp<GraphicBuffer> mGraphicBuffer; - - // mCrop is the current crop rectangle for this buffer slot. This gets - // set to mNextCrop each time queueBuffer gets called for this buffer. - Rect mCrop; - - // mTransform is the current transform flags for this buffer slot. This - // gets set to mNextTransform each time queueBuffer gets called for this - // slot. - uint32_t mTransform; - - // mScalingMode is the current scaling mode for this buffer slot. This - // gets set to mNextScalingMode each time queueBuffer gets called for - // this slot. - uint32_t mScalingMode; - - // mTimestamp is the current timestamp for this buffer slot. This gets - // to set by queueBuffer each time this slot is queued. - int64_t mTimestamp; - - // mFrameNumber is the number of the queued frame for this slot. - uint64_t mFrameNumber; - - // buf is the slot index of this buffer - int mBuf; - - }; - - // The following public functions is the consumer facing interface - - // acquire consumes a buffer by transferring its ownership to a consumer. - // buffer contains the GraphicBuffer and its corresponding information. - // buffer.mGraphicsBuffer will be NULL when the buffer has been already - // acquired by the consumer. - - status_t acquire(BufferItem *buffer); - - // releaseBuffer releases a buffer slot from the consumer back to the - // BufferQueue pending a fence sync. - status_t releaseBuffer(int buf, EGLDisplay display, EGLSyncKHR fence); - - // consumerDisconnect disconnects a consumer from the BufferQueue. All - // buffers will be freed. - status_t consumerDisconnect(); - - // setDefaultBufferSize is used to set the size of buffers returned by - // requestBuffers when a with and height of zero is requested. - status_t setDefaultBufferSize(uint32_t w, uint32_t h); - - // setBufferCountServer set the buffer count. If the client has requested - // a buffer count using setBufferCount, the server-buffer count will - // take effect once the client sets the count back to zero. - status_t setBufferCountServer(int bufferCount); - - // isSynchronousMode returns whether the SurfaceTexture is currently in - // synchronous mode. - bool isSynchronousMode() const; - - // setConsumerName sets the name used in logging - void setConsumerName(const String8& name); - - // setFrameAvailableListener sets the listener object that will be notified - // when a new frame becomes available. - void setFrameAvailableListener(const sp<FrameAvailableListener>& listener); - - -private: - // freeBufferLocked frees the resources (both GraphicBuffer and EGLImage) - // for the given slot. - void freeBufferLocked(int index); - - // freeAllBuffersLocked frees the resources (both GraphicBuffer and - // EGLImage) for all slots. - void freeAllBuffersLocked(); - - // freeAllBuffersExceptHeadLocked frees the resources (both GraphicBuffer - // and EGLImage) for all slots except the head of mQueue - void freeAllBuffersExceptHeadLocked(); - - // drainQueueLocked drains the buffer queue if we're in synchronous mode - // returns immediately otherwise. It returns NO_INIT if the BufferQueue - // became abandoned or disconnected during this call. - status_t drainQueueLocked(); - - // drainQueueAndFreeBuffersLocked drains the buffer queue if we're in - // synchronous mode and free all buffers. In asynchronous mode, all buffers - // are freed except the current buffer. - status_t drainQueueAndFreeBuffersLocked(); - - status_t setBufferCountServerLocked(int bufferCount); - - struct BufferSlot { - - BufferSlot() - : mEglDisplay(EGL_NO_DISPLAY), - mBufferState(BufferSlot::FREE), - mRequestBufferCalled(false), - mTransform(0), - mScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE), - mTimestamp(0), - mFrameNumber(0), - mFence(EGL_NO_SYNC_KHR), - mAcquireCalled(false) { - mCrop.makeInvalid(); - } - - // mGraphicBuffer points to the buffer allocated for this slot or is NULL - // if no buffer has been allocated. - sp<GraphicBuffer> mGraphicBuffer; - - // mEglDisplay is the EGLDisplay used to create mEglImage. - EGLDisplay mEglDisplay; - - // BufferState represents the different states in which a buffer slot - // can be. - enum BufferState { - // FREE indicates that the buffer is not currently being used and - // will not be used in the future until it gets dequeued and - // subsequently queued by the client. - // aka "owned by BufferQueue, ready to be dequeued" - FREE = 0, - - // DEQUEUED indicates that the buffer has been dequeued by the - // client, but has not yet been queued or canceled. The buffer is - // considered 'owned' by the client, and the server should not use - // it for anything. - // - // Note that when in synchronous-mode (mSynchronousMode == true), - // the buffer that's currently attached to the texture may be - // dequeued by the client. That means that the current buffer can - // be in either the DEQUEUED or QUEUED state. In asynchronous mode, - // however, the current buffer is always in the QUEUED state. - // aka "owned by producer, ready to be queued" - DEQUEUED = 1, - - // QUEUED indicates that the buffer has been queued by the client, - // and has not since been made available for the client to dequeue. - // Attaching the buffer to the texture does NOT transition the - // buffer away from the QUEUED state. However, in Synchronous mode - // the current buffer may be dequeued by the client under some - // circumstances. See the note about the current buffer in the - // documentation for DEQUEUED. - // aka "owned by BufferQueue, ready to be acquired" - QUEUED = 2, - - // aka "owned by consumer, ready to be released" - ACQUIRED = 3 - }; - - // mBufferState is the current state of this buffer slot. - BufferState mBufferState; - - // mRequestBufferCalled is used for validating that the client did - // call requestBuffer() when told to do so. Technically this is not - // needed but useful for debugging and catching client bugs. - bool mRequestBufferCalled; - - // mCrop is the current crop rectangle for this buffer slot. This gets - // set to mNextCrop each time queueBuffer gets called for this buffer. - Rect mCrop; - - // mTransform is the current transform flags for this buffer slot. This - // gets set to mNextTransform each time queueBuffer gets called for this - // slot. - uint32_t mTransform; - - // mScalingMode is the current scaling mode for this buffer slot. This - // gets set to mNextScalingMode each time queueBuffer gets called for - // this slot. - uint32_t mScalingMode; - - // mTimestamp is the current timestamp for this buffer slot. This gets - // to set by queueBuffer each time this slot is queued. - int64_t mTimestamp; - - // mFrameNumber is the number of the queued frame for this slot. - uint64_t mFrameNumber; - - // mFence is the EGL sync object that must signal before the buffer - // associated with this buffer slot may be dequeued. It is initialized - // to EGL_NO_SYNC_KHR when the buffer is created and (optionally, based - // on a compile-time option) set to a new sync object in updateTexImage. - EGLSyncKHR mFence; - - // Indicates whether this buffer has been seen by a consumer yet - bool mAcquireCalled; - }; - - // mSlots is the array of buffer slots that must be mirrored on the client - // side. This allows buffer ownership to be transferred between the client - // and server without sending a GraphicBuffer over binder. The entire array - // is initialized to NULL at construction time, and buffers are allocated - // for a slot when requestBuffer is called with that slot's index. - BufferSlot mSlots[NUM_BUFFER_SLOTS]; - - // mDefaultWidth holds the default width of allocated buffers. It is used - // in requestBuffers() if a width and height of zero is specified. - uint32_t mDefaultWidth; - - // mDefaultHeight holds the default height of allocated buffers. It is used - // in requestBuffers() if a width and height of zero is specified. - uint32_t mDefaultHeight; - - // mPixelFormat holds the pixel format of allocated buffers. It is used - // in requestBuffers() if a format of zero is specified. - uint32_t mPixelFormat; - - // mBufferCount is the number of buffer slots that the client and server - // must maintain. It defaults to MIN_ASYNC_BUFFER_SLOTS and can be changed - // by calling setBufferCount or setBufferCountServer - int mBufferCount; - - // mClientBufferCount is the number of buffer slots requested by the client. - // The default is zero, which means the client doesn't care how many buffers - // there is. - int mClientBufferCount; - - // mServerBufferCount buffer count requested by the server-side - int mServerBufferCount; - - // mNextCrop is the crop rectangle that will be used for the next buffer - // that gets queued. It is set by calling setCrop. - Rect mNextCrop; - - // mNextTransform is the transform identifier that will be used for the next - // buffer that gets queued. It is set by calling setTransform. - uint32_t mNextTransform; - - // mNextScalingMode is the scaling mode that will be used for the next - // buffers that get queued. It is set by calling setScalingMode. - int mNextScalingMode; - - // mGraphicBufferAlloc is the connection to SurfaceFlinger that is used to - // allocate new GraphicBuffer objects. - sp<IGraphicBufferAlloc> mGraphicBufferAlloc; - - // mFrameAvailableListener is the listener object that will be called when a - // new frame becomes available. If it is not NULL it will be called from - // queueBuffer. - sp<FrameAvailableListener> mFrameAvailableListener; - - // mSynchronousMode whether we're in synchronous mode or not - bool mSynchronousMode; - - // mAllowSynchronousMode whether we allow synchronous mode or not - const bool mAllowSynchronousMode; - - // mConnectedApi indicates the API that is currently connected to this - // BufferQueue. It defaults to NO_CONNECTED_API (= 0), and gets updated - // by the connect and disconnect methods. - int mConnectedApi; - - // mDequeueCondition condition used for dequeueBuffer in synchronous mode - mutable Condition mDequeueCondition; - - // mQueue is a FIFO of queued buffers used in synchronous mode - typedef Vector<int> Fifo; - Fifo mQueue; - - // mAbandoned indicates that the BufferQueue will no longer be used to - // consume images buffers pushed to it using the ISurfaceTexture 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. - bool mAbandoned; - - // mName is a string used to identify the BufferQueue in log messages. - // It is set by the setName method. - String8 mConsumerName; - - // mMutex is the mutex used to prevent concurrent access to the member - // variables of BufferQueue objects. It must be locked whenever the - // member variables are accessed. - mutable Mutex mMutex; - - // mFrameCounter is the free running counter, incremented for every buffer queued - // with the surface Texture. - uint64_t mFrameCounter; - - bool mBufferHasBeenQueued; -}; - -// ---------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_GUI_BUFFERQUEUE_H diff --git a/include/gui/DisplayEventReceiver.h b/include/gui/DisplayEventReceiver.h deleted file mode 100644 index 7bca8d6..0000000 --- a/include/gui/DisplayEventReceiver.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_GUI_DISPLAY_EVENT_H -#define ANDROID_GUI_DISPLAY_EVENT_H - -#include <stdint.h> -#include <sys/types.h> - -#include <utils/Errors.h> -#include <utils/RefBase.h> -#include <utils/Timers.h> - -#include <binder/IInterface.h> - -// ---------------------------------------------------------------------------- - -namespace android { - -// ---------------------------------------------------------------------------- - -class BitTube; -class IDisplayEventConnection; - -// ---------------------------------------------------------------------------- - -class DisplayEventReceiver { -public: - enum { - DISPLAY_EVENT_VSYNC = 'vsyn' - }; - - struct Event { - - struct Header { - uint32_t type; - nsecs_t timestamp; - }; - - struct VSync { - uint32_t count; - }; - - Header header; - union { - VSync vsync; - }; - }; - -public: - /* - * DisplayEventReceiver creates and registers an event connection with - * SurfaceFlinger. VSync events are disabled by default. Call setVSyncRate - * or requestNextVsync to receive them. - * Other events start being delivered immediately. - */ - DisplayEventReceiver(); - - /* - * ~DisplayEventReceiver severs the connection with SurfaceFlinger, new events - * stop being delivered immediately. Note that the queue could have - * some events pending. These will be delivered. - */ - ~DisplayEventReceiver(); - - /* - * initCheck returns the state of DisplayEventReceiver after construction. - */ - status_t initCheck() const; - - /* - * getFd returns the file descriptor to use to receive events. - * OWNERSHIP IS RETAINED by DisplayEventReceiver. DO NOT CLOSE this - * file-descriptor. - */ - int getFd() const; - - /* - * getEvents reads event from the queue and returns how many events were - * read. Returns 0 if there are no more events or a negative error code. - * If NOT_ENOUGH_DATA is returned, the object has become invalid forever, it - * should be destroyed and getEvents() shouldn't be called again. - */ - ssize_t getEvents(Event* events, size_t count); - static ssize_t getEvents(const sp<BitTube>& dataChannel, - Event* events, size_t count); - - /* - * setVsyncRate() sets the Event::VSync delivery rate. A value of - * 1 returns every Event::VSync. A value of 2 returns every other event, - * etc... a value of 0 returns no event unless requestNextVsync() has - * been called. - */ - status_t setVsyncRate(uint32_t count); - - /* - * requestNextVsync() schedules the next Event::VSync. It has no effect - * if the vsync rate is > 0. - */ - status_t requestNextVsync(); - -private: - sp<IDisplayEventConnection> mEventConnection; - sp<BitTube> mDataChannel; -}; - -// ---------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_GUI_DISPLAY_EVENT_H diff --git a/include/gui/IDisplayEventConnection.h b/include/gui/IDisplayEventConnection.h deleted file mode 100644 index 86247de..0000000 --- a/include/gui/IDisplayEventConnection.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_GUI_IDISPLAY_EVENT_CONNECTION_H -#define ANDROID_GUI_IDISPLAY_EVENT_CONNECTION_H - -#include <stdint.h> -#include <sys/types.h> - -#include <utils/Errors.h> -#include <utils/RefBase.h> - -#include <binder/IInterface.h> - -namespace android { -// ---------------------------------------------------------------------------- - -class BitTube; - -class IDisplayEventConnection : public IInterface -{ -public: - - DECLARE_META_INTERFACE(DisplayEventConnection); - - /* - * getDataChannel() returns a BitTube where to receive the events from - */ - virtual sp<BitTube> getDataChannel() const = 0; - - /* - * setVsyncRate() sets the vsync event delivery rate. A value of - * 1 returns every vsync events. A value of 2 returns every other events, - * etc... a value of 0 returns no event unless requestNextVsync() has - * been called. - */ - virtual void setVsyncRate(uint32_t count) = 0; - - /* - * requestNextVsync() schedules the next vsync event. It has no effect - * if the vsync rate is > 0. - */ - virtual void requestNextVsync() = 0; // asynchronous -}; - -// ---------------------------------------------------------------------------- - -class BnDisplayEventConnection : public BnInterface<IDisplayEventConnection> -{ -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -// ---------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_GUI_IDISPLAY_EVENT_CONNECTION_H diff --git a/include/gui/IGraphicBufferAlloc.h b/include/gui/IGraphicBufferAlloc.h deleted file mode 100644 index cee41d9..0000000 --- a/include/gui/IGraphicBufferAlloc.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_GUI_IGRAPHIC_BUFFER_ALLOC_H -#define ANDROID_GUI_IGRAPHIC_BUFFER_ALLOC_H - -#include <stdint.h> -#include <sys/types.h> - -#include <binder/IInterface.h> -#include <ui/PixelFormat.h> -#include <utils/RefBase.h> - -namespace android { -// ---------------------------------------------------------------------------- - -class GraphicBuffer; - -class IGraphicBufferAlloc : public IInterface -{ -public: - DECLARE_META_INTERFACE(GraphicBufferAlloc); - - /* Create a new GraphicBuffer for the client to use. - */ - virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h, - PixelFormat format, uint32_t usage, status_t* error) = 0; -}; - -// ---------------------------------------------------------------------------- - -class BnGraphicBufferAlloc : public BnInterface<IGraphicBufferAlloc> -{ -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -// ---------------------------------------------------------------------------- - -}; // namespace android - -#endif // ANDROID_GUI_IGRAPHIC_BUFFER_ALLOC_H diff --git a/include/gui/ISensorEventConnection.h b/include/gui/ISensorEventConnection.h deleted file mode 100644 index 749065e..0000000 --- a/include/gui/ISensorEventConnection.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_GUI_ISENSOR_EVENT_CONNECTION_H -#define ANDROID_GUI_ISENSOR_EVENT_CONNECTION_H - -#include <stdint.h> -#include <sys/types.h> - -#include <utils/Errors.h> -#include <utils/RefBase.h> - -#include <binder/IInterface.h> - -namespace android { -// ---------------------------------------------------------------------------- - -class BitTube; - -class ISensorEventConnection : public IInterface -{ -public: - DECLARE_META_INTERFACE(SensorEventConnection); - - virtual sp<BitTube> getSensorChannel() const = 0; - virtual status_t enableDisable(int handle, bool enabled) = 0; - virtual status_t setEventRate(int handle, nsecs_t ns) = 0; -}; - -// ---------------------------------------------------------------------------- - -class BnSensorEventConnection : public BnInterface<ISensorEventConnection> -{ -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -// ---------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_GUI_ISENSOR_EVENT_CONNECTION_H diff --git a/include/gui/ISensorServer.h b/include/gui/ISensorServer.h deleted file mode 100644 index 9c8afc5..0000000 --- a/include/gui/ISensorServer.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_GUI_ISENSORSERVER_H -#define ANDROID_GUI_ISENSORSERVER_H - -#include <stdint.h> -#include <sys/types.h> - -#include <utils/Errors.h> -#include <utils/RefBase.h> - -#include <binder/IInterface.h> - -namespace android { -// ---------------------------------------------------------------------------- - -class Sensor; -class ISensorEventConnection; - -class ISensorServer : public IInterface -{ -public: - DECLARE_META_INTERFACE(SensorServer); - - virtual Vector<Sensor> getSensorList() = 0; - virtual sp<ISensorEventConnection> createSensorEventConnection() = 0; -}; - -// ---------------------------------------------------------------------------- - -class BnSensorServer : public BnInterface<ISensorServer> -{ -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -// ---------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_GUI_ISENSORSERVER_H diff --git a/include/gui/ISurface.h b/include/gui/ISurface.h deleted file mode 100644 index c0ff9fc..0000000 --- a/include/gui/ISurface.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2007 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_GUI_ISURFACE_H -#define ANDROID_GUI_ISURFACE_H - -#include <stdint.h> -#include <sys/types.h> - -#include <utils/Errors.h> -#include <utils/RefBase.h> - -#include <binder/IInterface.h> - -#include <ui/PixelFormat.h> - -namespace android { - -typedef int32_t SurfaceID; - -class ISurfaceTexture; - -class ISurface : public IInterface -{ -protected: - enum { - GET_SURFACE_TEXTURE = IBinder::FIRST_CALL_TRANSACTION, - }; - -public: - DECLARE_META_INTERFACE(Surface); - - virtual sp<ISurfaceTexture> getSurfaceTexture() const = 0; -}; - -// ---------------------------------------------------------------------------- - -class BnSurface : public BnInterface<ISurface> -{ -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -// ---------------------------------------------------------------------------- - -}; // namespace android - -#endif // ANDROID_GUI_ISURFACE_H diff --git a/include/gui/ISurfaceComposer.h b/include/gui/ISurfaceComposer.h deleted file mode 100644 index f3c0ecb..0000000 --- a/include/gui/ISurfaceComposer.h +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (C) 2006 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_GUI_ISURFACE_COMPOSER_H -#define ANDROID_GUI_ISURFACE_COMPOSER_H - -#include <stdint.h> -#include <sys/types.h> - -#include <utils/RefBase.h> -#include <utils/Errors.h> - -#include <binder/IInterface.h> - -#include <ui/PixelFormat.h> - -#include <gui/IGraphicBufferAlloc.h> -#include <gui/ISurfaceComposerClient.h> - -namespace android { -// ---------------------------------------------------------------------------- - -class ComposerState; -class IDisplayEventConnection; -class IMemoryHeap; - -class ISurfaceComposer : public IInterface -{ -public: - DECLARE_META_INTERFACE(SurfaceComposer); - - enum { // (keep in sync with Surface.java) - eHidden = 0x00000004, - eDestroyBackbuffer = 0x00000020, - eSecure = 0x00000080, - eNonPremultiplied = 0x00000100, - eOpaque = 0x00000400, - eProtectedByApp = 0x00000800, - eProtectedByDRM = 0x00001000, - - eFXSurfaceNormal = 0x00000000, - eFXSurfaceBlur = 0x00010000, - eFXSurfaceDim = 0x00020000, - eFXSurfaceScreenshot= 0x00030000, - eFXSurfaceMask = 0x000F0000, - }; - - enum { - ePositionChanged = 0x00000001, - eLayerChanged = 0x00000002, - eSizeChanged = 0x00000004, - eAlphaChanged = 0x00000008, - eMatrixChanged = 0x00000010, - eTransparentRegionChanged = 0x00000020, - eVisibilityChanged = 0x00000040, - eFreezeTintChanged = 0x00000080, - }; - - enum { - eLayerHidden = 0x01, - eLayerFrozen = 0x02, - eLayerDither = 0x04, - eLayerFilter = 0x08, - eLayerBlurFreeze = 0x10 - }; - - enum { - eOrientationDefault = 0, - eOrientation90 = 1, - eOrientation180 = 2, - eOrientation270 = 3, - eOrientationUnchanged = 4, - eOrientationSwapMask = 0x01 - }; - - enum { - eSynchronous = 0x01, - }; - - enum { - eElectronBeamAnimationOn = 0x01, - eElectronBeamAnimationOff = 0x10 - }; - - /* create connection with surface flinger, requires - * ACCESS_SURFACE_FLINGER permission - */ - virtual sp<ISurfaceComposerClient> createConnection() = 0; - - /* create a graphic buffer allocator - */ - virtual sp<IGraphicBufferAlloc> createGraphicBufferAlloc() = 0; - - /* retrieve the control block */ - virtual sp<IMemoryHeap> getCblk() const = 0; - - /* open/close transactions. requires ACCESS_SURFACE_FLINGER permission */ - virtual void setTransactionState(const Vector<ComposerState>& state, - int orientation, uint32_t flags) = 0; - - /* signal that we're done booting. - * Requires ACCESS_SURFACE_FLINGER permission - */ - virtual void bootFinished() = 0; - - /* Capture the specified screen. requires READ_FRAME_BUFFER permission - * This function will fail if there is a secure window on screen. - */ - virtual status_t captureScreen(DisplayID dpy, - sp<IMemoryHeap>* heap, - uint32_t* width, uint32_t* height, PixelFormat* format, - uint32_t reqWidth, uint32_t reqHeight, - uint32_t minLayerZ, uint32_t maxLayerZ) = 0; - - /* triggers screen off animation */ - virtual status_t turnElectronBeamOff(int32_t mode) = 0; - - /* triggers screen on animation */ - virtual status_t turnElectronBeamOn(int32_t mode) = 0; - - /* verify that an ISurfaceTexture was created by SurfaceFlinger. - */ - virtual bool authenticateSurfaceTexture( - const sp<ISurfaceTexture>& surface) const = 0; - - /* return an IDisplayEventConnection */ - virtual sp<IDisplayEventConnection> createDisplayEventConnection() = 0; -}; - -// ---------------------------------------------------------------------------- - -class BnSurfaceComposer : public BnInterface<ISurfaceComposer> -{ -public: - enum { - // Note: BOOT_FINISHED must remain this value, it is called from - // Java by ActivityManagerService. - BOOT_FINISHED = IBinder::FIRST_CALL_TRANSACTION, - CREATE_CONNECTION, - CREATE_GRAPHIC_BUFFER_ALLOC, - GET_CBLK, - SET_TRANSACTION_STATE, - SET_ORIENTATION, - CAPTURE_SCREEN, - TURN_ELECTRON_BEAM_OFF, - TURN_ELECTRON_BEAM_ON, - AUTHENTICATE_SURFACE, - CREATE_DISPLAY_EVENT_CONNECTION, - }; - - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -// ---------------------------------------------------------------------------- - -}; // namespace android - -#endif // ANDROID_GUI_ISURFACE_COMPOSER_H diff --git a/include/gui/ISurfaceComposerClient.h b/include/gui/ISurfaceComposerClient.h deleted file mode 100644 index c793933..0000000 --- a/include/gui/ISurfaceComposerClient.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2007 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_GUI_ISURFACE_COMPOSER_CLIENT_H -#define ANDROID_GUI_ISURFACE_COMPOSER_CLIENT_H - -#include <stdint.h> -#include <sys/types.h> - -#include <utils/Errors.h> -#include <utils/RefBase.h> - -#include <binder/IInterface.h> - -#include <ui/PixelFormat.h> - -#include <gui/ISurface.h> - -namespace android { - -// ---------------------------------------------------------------------------- - -typedef int32_t DisplayID; - -// ---------------------------------------------------------------------------- - -class ISurfaceComposerClient : public IInterface -{ -public: - DECLARE_META_INTERFACE(SurfaceComposerClient); - - struct surface_data_t { - int32_t token; - int32_t identity; - status_t readFromParcel(const Parcel& parcel); - status_t writeToParcel(Parcel* parcel) const; - }; - - /* - * Requires ACCESS_SURFACE_FLINGER permission - */ - virtual sp<ISurface> createSurface( surface_data_t* data, - const String8& name, - DisplayID display, - uint32_t w, - uint32_t h, - PixelFormat format, - uint32_t flags) = 0; - - /* - * Requires ACCESS_SURFACE_FLINGER permission - */ - virtual status_t destroySurface(SurfaceID sid) = 0; -}; - -// ---------------------------------------------------------------------------- - -class BnSurfaceComposerClient : public BnInterface<ISurfaceComposerClient> -{ -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -// ---------------------------------------------------------------------------- - -}; // namespace android - -#endif // ANDROID_GUI_ISURFACE_COMPOSER_CLIENT_H diff --git a/include/gui/ISurfaceTexture.h b/include/gui/ISurfaceTexture.h deleted file mode 100644 index 50626a0..0000000 --- a/include/gui/ISurfaceTexture.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_GUI_ISURFACETEXTURE_H -#define ANDROID_GUI_ISURFACETEXTURE_H - -#include <stdint.h> -#include <sys/types.h> - -#include <utils/Errors.h> -#include <utils/RefBase.h> - -#include <binder/IInterface.h> - -#include <ui/GraphicBuffer.h> -#include <ui/Rect.h> - -namespace android { -// ---------------------------------------------------------------------------- - -class SurfaceTextureClient; - -class ISurfaceTexture : public IInterface -{ -public: - DECLARE_META_INTERFACE(SurfaceTexture); - -protected: - friend class SurfaceTextureClient; - - enum { - BUFFER_NEEDS_REALLOCATION = 0x1, - RELEASE_ALL_BUFFERS = 0x2, - }; - - // 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 - // 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; - - // setBufferCount sets the number of buffer slots available. Calling this - // will also cause all buffer slots to be emptied. The caller should empty - // its mirrored copy of the buffer slots when calling this method. - virtual status_t setBufferCount(int bufferCount) = 0; - - // dequeueBuffer requests a new buffer slot for the client to use. Ownership - // of the slot is transfered to the client, meaning that the server will not - // use the contents of the buffer associated with that slot. The slot index - // returned may or may not contain a buffer. If the slot is empty the client - // should call requestBuffer to assign a new buffer to that slot. The client - // is expected to either call cancelBuffer on the dequeued slot or to fill - // in the contents of its associated buffer contents and call queueBuffer. - // If dequeueBuffer return BUFFER_NEEDS_REALLOCATION, the client is - // expected to call requestBuffer immediately. - virtual status_t dequeueBuffer(int *slot, uint32_t w, uint32_t h, - uint32_t format, uint32_t usage) = 0; - - // queueBuffer indicates that the client has finished filling in the - // contents of the buffer associated with slot and transfers ownership of - // that slot back to the server. It is not valid to call queueBuffer on a - // slot that is not owned by the client or one for which a buffer associated - // via requestBuffer. In addition, a timestamp must be provided by the - // client for this buffer. The timestamp is measured in nanoseconds, and - // must be monotonically increasing. Its other properties (zero point, etc) - // are client-dependent, and should be documented by the client. - // - // 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 queueBuffer(int slot, int64_t timestamp, - uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) = 0; - - // cancelBuffer indicates that the client does not wish to fill in the - // buffer associated with slot and transfers ownership of the slot back to - // the server. - virtual void cancelBuffer(int slot) = 0; - - virtual status_t setCrop(const Rect& reg) = 0; - virtual status_t setTransform(uint32_t transform) = 0; - virtual status_t setScalingMode(int mode) = 0; - - // query retrieves some information for this surface - // 'what' tokens allowed are that of android_natives.h - virtual int query(int what, int* value) = 0; - - // setSynchronousMode set whether dequeueBuffer is synchronous or - // asynchronous. In synchronous mode, dequeueBuffer blocks until - // a buffer is available, the currently bound buffer can be dequeued and - // queued buffers will be retired in order. - // 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. - // - // This method will fail if the connect was previously called on the - // SurfaceTexture 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, - uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) = 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. - // - // This method will fail if the the SurfaceTexture is not currently - // connected to the specified client API. - virtual status_t disconnect(int api) = 0; -}; - -// ---------------------------------------------------------------------------- - -class BnSurfaceTexture : public BnInterface<ISurfaceTexture> -{ -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -// ---------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_GUI_ISURFACETEXTURE_H diff --git a/include/gui/Sensor.h b/include/gui/Sensor.h deleted file mode 100644 index e59757a..0000000 --- a/include/gui/Sensor.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_GUI_SENSOR_H -#define ANDROID_GUI_SENSOR_H - -#include <stdint.h> -#include <sys/types.h> - -#include <utils/Errors.h> -#include <utils/Flattenable.h> -#include <utils/String8.h> -#include <utils/Timers.h> - -#include <hardware/sensors.h> - -#include <android/sensor.h> - -// ---------------------------------------------------------------------------- -// Concrete types for the NDK -struct ASensor { }; - -// ---------------------------------------------------------------------------- -namespace android { -// ---------------------------------------------------------------------------- - -class Parcel; - -// ---------------------------------------------------------------------------- - -class Sensor : public ASensor, public Flattenable -{ -public: - enum { - TYPE_ACCELEROMETER = ASENSOR_TYPE_ACCELEROMETER, - TYPE_MAGNETIC_FIELD = ASENSOR_TYPE_MAGNETIC_FIELD, - TYPE_GYROSCOPE = ASENSOR_TYPE_GYROSCOPE, - TYPE_LIGHT = ASENSOR_TYPE_LIGHT, - TYPE_PROXIMITY = ASENSOR_TYPE_PROXIMITY - }; - - Sensor(); - Sensor(struct sensor_t const* hwSensor); - virtual ~Sensor(); - - const String8& getName() const; - const String8& getVendor() const; - int32_t getHandle() const; - int32_t getType() const; - float getMinValue() const; - float getMaxValue() const; - float getResolution() const; - float getPowerUsage() const; - int32_t getMinDelay() const; - nsecs_t getMinDelayNs() const; - int32_t getVersion() const; - - // Flattenable interface - virtual size_t getFlattenedSize() const; - virtual size_t getFdCount() const; - virtual status_t flatten(void* buffer, size_t size, - int fds[], size_t count) const; - virtual status_t unflatten(void const* buffer, size_t size, - int fds[], size_t count); - -private: - String8 mName; - String8 mVendor; - int32_t mHandle; - int32_t mType; - float mMinValue; - float mMaxValue; - float mResolution; - float mPower; - int32_t mMinDelay; - int32_t mVersion; -}; - -// ---------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_GUI_SENSOR_H diff --git a/include/gui/SensorEventQueue.h b/include/gui/SensorEventQueue.h deleted file mode 100644 index ef7c6e3..0000000 --- a/include/gui/SensorEventQueue.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_SENSOR_EVENT_QUEUE_H -#define ANDROID_SENSOR_EVENT_QUEUE_H - -#include <stdint.h> -#include <sys/types.h> - -#include <utils/Errors.h> -#include <utils/RefBase.h> -#include <utils/Timers.h> - -#include <gui/BitTube.h> - -// ---------------------------------------------------------------------------- - -struct ALooper; -struct ASensorEvent; - -// Concrete types for the NDK -struct ASensorEventQueue { - ALooper* looper; -}; - -// ---------------------------------------------------------------------------- -namespace android { -// ---------------------------------------------------------------------------- - -class ISensorEventConnection; -class Sensor; -class Looper; - -// ---------------------------------------------------------------------------- - -class SensorEventQueue : public ASensorEventQueue, public RefBase -{ -public: - SensorEventQueue(const sp<ISensorEventConnection>& connection); - virtual ~SensorEventQueue(); - virtual void onFirstRef(); - - int getFd() const; - ssize_t write(ASensorEvent const* events, size_t numEvents); - ssize_t read(ASensorEvent* events, size_t numEvents); - - status_t waitForEvent() const; - status_t wake() const; - - status_t enableSensor(Sensor const* sensor) const; - status_t disableSensor(Sensor const* sensor) const; - status_t setEventRate(Sensor const* sensor, nsecs_t ns) const; - - // these are here only to support SensorManager.java - status_t enableSensor(int32_t handle, int32_t us) const; - status_t disableSensor(int32_t handle) const; - -private: - sp<Looper> getLooper() const; - sp<ISensorEventConnection> mSensorEventConnection; - sp<BitTube> mSensorChannel; - mutable Mutex mLock; - mutable sp<Looper> mLooper; -}; - -// ---------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_SENSOR_EVENT_QUEUE_H diff --git a/include/gui/SensorManager.h b/include/gui/SensorManager.h deleted file mode 100644 index 3176462..0000000 --- a/include/gui/SensorManager.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_GUI_SENSOR_MANAGER_H -#define ANDROID_GUI_SENSOR_MANAGER_H - -#include <stdint.h> -#include <sys/types.h> - -#include <binder/IBinder.h> - -#include <utils/Errors.h> -#include <utils/RefBase.h> -#include <utils/Singleton.h> -#include <utils/Vector.h> - -#include <gui/SensorEventQueue.h> - -// ---------------------------------------------------------------------------- -// Concrete types for the NDK -struct ASensorManager { }; - -// ---------------------------------------------------------------------------- -namespace android { -// ---------------------------------------------------------------------------- - -class ISensorServer; -class Sensor; -class SensorEventQueue; - -// ---------------------------------------------------------------------------- - -class SensorManager : - public ASensorManager, - public Singleton<SensorManager> -{ -public: - SensorManager(); - ~SensorManager(); - - ssize_t getSensorList(Sensor const* const** list) const; - Sensor const* getDefaultSensor(int type); - sp<SensorEventQueue> createEventQueue(); - -private: - // DeathRecipient interface - void sensorManagerDied(); - - status_t assertStateLocked() const; - -private: - mutable Mutex mLock; - mutable sp<ISensorServer> mSensorServer; - mutable Sensor const** mSensorList; - mutable Vector<Sensor> mSensors; - mutable sp<IBinder::DeathRecipient> mDeathObserver; -}; - -// ---------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_GUI_SENSOR_MANAGER_H diff --git a/include/gui/Surface.h b/include/gui/Surface.h deleted file mode 100644 index 1f90c59..0000000 --- a/include/gui/Surface.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (C) 2007 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_GUI_SURFACE_H -#define ANDROID_GUI_SURFACE_H - -#include <stdint.h> -#include <sys/types.h> - -#include <utils/KeyedVector.h> -#include <utils/RefBase.h> -#include <utils/threads.h> - -#include <ui/PixelFormat.h> -#include <ui/Region.h> - -#include <gui/SurfaceTextureClient.h> -#include <gui/ISurface.h> -#include <gui/ISurfaceComposerClient.h> - -#define ANDROID_VIEW_SURFACE_JNI_ID "mNativeSurface" - -namespace android { - -// --------------------------------------------------------------------------- - -class ISurfaceTexture; -class Surface; -class SurfaceComposerClient; - -// --------------------------------------------------------------------------- - -class SurfaceControl : public RefBase -{ -public: - static bool isValid(const sp<SurfaceControl>& surface) { - return (surface != 0) && surface->isValid(); - } - bool isValid() { - return mToken>=0 && mClient!=0; - } - static bool isSameSurface( - const sp<SurfaceControl>& lhs, const sp<SurfaceControl>& rhs); - - uint32_t getIdentity() const { return mIdentity; } - - // release surface data from java - void clear(); - - status_t setLayer(int32_t layer); - status_t setPosition(int32_t x, int32_t y); - status_t setSize(uint32_t w, uint32_t h); - status_t hide(); - status_t show(int32_t layer = -1); - status_t freeze(); - status_t unfreeze(); - status_t setFlags(uint32_t flags, uint32_t mask); - status_t setTransparentRegionHint(const Region& transparent); - status_t setAlpha(float alpha=1.0f); - status_t setMatrix(float dsdx, float dtdx, float dsdy, float dtdy); - status_t setFreezeTint(uint32_t tint); - - static status_t writeSurfaceToParcel( - const sp<SurfaceControl>& control, Parcel* parcel); - - sp<Surface> getSurface() const; - -private: - // can't be copied - SurfaceControl& operator = (SurfaceControl& rhs); - SurfaceControl(const SurfaceControl& rhs); - - friend class SurfaceComposerClient; - friend class Surface; - - SurfaceControl( - const sp<SurfaceComposerClient>& client, - const sp<ISurface>& surface, - const ISurfaceComposerClient::surface_data_t& data); - - ~SurfaceControl(); - - status_t validate() const; - void destroy(); - - sp<SurfaceComposerClient> mClient; - sp<ISurface> mSurface; - SurfaceID mToken; - uint32_t mIdentity; - mutable Mutex mLock; - - mutable sp<Surface> mSurfaceData; -}; - -// --------------------------------------------------------------------------- - -class Surface : public SurfaceTextureClient -{ -public: - struct SurfaceInfo { - uint32_t w; - uint32_t h; - uint32_t s; - uint32_t usage; - PixelFormat format; - void* bits; - uint32_t reserved[2]; - }; - - explicit Surface(const sp<ISurfaceTexture>& st); - - static status_t writeToParcel(const sp<Surface>& control, Parcel* parcel); - - static sp<Surface> readFromParcel(const Parcel& data); - static bool isValid(const sp<Surface>& surface) { - return (surface != 0) && surface->isValid(); - } - - bool isValid(); - uint32_t getIdentity() const { return mIdentity; } - sp<ISurfaceTexture> getSurfaceTexture(); - - // the lock/unlock APIs must be used from the same thread - status_t lock(SurfaceInfo* info, Region* dirty = NULL); - status_t unlockAndPost(); - - sp<IBinder> asBinder() const; - -private: - // this is just to be able to write some unit tests - friend class Test; - friend class SurfaceControl; - - // can't be copied - Surface& operator = (Surface& rhs); - Surface(const Surface& rhs); - - explicit Surface(const sp<SurfaceControl>& control); - Surface(const Parcel& data, const sp<IBinder>& ref); - ~Surface(); - - /* - * private stuff... - */ - void init(const sp<ISurfaceTexture>& surfaceTexture); - - static void cleanCachedSurfacesLocked(); - - virtual int query(int what, int* value) const; - - // constants - sp<ISurface> mSurface; - uint32_t mIdentity; - - // A cache of Surface objects that have been deserialized into this process. - static Mutex sCachedSurfacesLock; - static DefaultKeyedVector<wp<IBinder>, wp<Surface> > sCachedSurfaces; -}; - -}; // namespace android - -#endif // ANDROID_GUI_SURFACE_H diff --git a/include/gui/SurfaceComposerClient.h b/include/gui/SurfaceComposerClient.h deleted file mode 100644 index d971031..0000000 --- a/include/gui/SurfaceComposerClient.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (C) 2007 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_GUI_SURFACE_COMPOSER_CLIENT_H -#define ANDROID_GUI_SURFACE_COMPOSER_CLIENT_H - -#include <stdint.h> -#include <sys/types.h> - -#include <binder/IBinder.h> - -#include <utils/RefBase.h> -#include <utils/Singleton.h> -#include <utils/SortedVector.h> -#include <utils/threads.h> - -#include <ui/PixelFormat.h> - -#include <gui/Surface.h> - -namespace android { - -// --------------------------------------------------------------------------- - -class DisplayInfo; -class Composer; -class IMemoryHeap; -class ISurfaceComposerClient; -class Region; - -// --------------------------------------------------------------------------- - -class SurfaceComposerClient : public RefBase -{ - friend class Composer; -public: - SurfaceComposerClient(); - virtual ~SurfaceComposerClient(); - - // Always make sure we could initialize - status_t initCheck() const; - - // Return the connection of this client - sp<IBinder> connection() const; - - // Forcibly remove connection before all references have gone away. - void dispose(); - - // ------------------------------------------------------------------------ - // surface creation / destruction - - //! Create a surface - sp<SurfaceControl> createSurface( - const String8& name,// name of the surface - DisplayID display, // Display to create this surface on - uint32_t w, // width in pixel - uint32_t h, // height in pixel - PixelFormat format, // pixel-format desired - uint32_t flags = 0 // usage flags - ); - - sp<SurfaceControl> createSurface( - DisplayID display, // Display to create this surface on - uint32_t w, // width in pixel - uint32_t h, // height in pixel - PixelFormat format, // pixel-format desired - uint32_t flags = 0 // usage flags - ); - - - // ------------------------------------------------------------------------ - // Composer parameters - // All composer parameters must be changed within a transaction - // several surfaces can be updated in one transaction, all changes are - // committed at once when the transaction is closed. - // closeGlobalTransaction() usually requires an IPC with the server. - - //! Open a composer transaction on all active SurfaceComposerClients. - static void openGlobalTransaction(); - - //! Close a composer transaction on all active SurfaceComposerClients. - static void closeGlobalTransaction(bool synchronous = false); - - //! Freeze the specified display but not transactions. - static status_t freezeDisplay(DisplayID dpy, uint32_t flags = 0); - - //! Resume updates on the specified display. - static status_t unfreezeDisplay(DisplayID dpy, uint32_t flags = 0); - - //! Set the orientation of the given display - static int setOrientation(DisplayID dpy, int orientation, uint32_t flags); - - // Query the number of displays - static ssize_t getNumberOfDisplays(); - - // Get information about a display - static status_t getDisplayInfo(DisplayID dpy, DisplayInfo* info); - static ssize_t getDisplayWidth(DisplayID dpy); - static ssize_t getDisplayHeight(DisplayID dpy); - static ssize_t getDisplayOrientation(DisplayID dpy); - - status_t linkToComposerDeath(const sp<IBinder::DeathRecipient>& recipient, - void* cookie = NULL, uint32_t flags = 0); - - status_t hide(SurfaceID id); - status_t show(SurfaceID id, int32_t layer = -1); - status_t freeze(SurfaceID id); - status_t unfreeze(SurfaceID id); - status_t setFlags(SurfaceID id, uint32_t flags, uint32_t mask); - status_t setTransparentRegionHint(SurfaceID id, const Region& transparent); - status_t setLayer(SurfaceID id, int32_t layer); - status_t setAlpha(SurfaceID id, float alpha=1.0f); - status_t setFreezeTint(SurfaceID id, uint32_t tint); - status_t setMatrix(SurfaceID id, float dsdx, float dtdx, float dsdy, float dtdy); - status_t setPosition(SurfaceID id, float x, float y); - status_t setSize(SurfaceID id, uint32_t w, uint32_t h); - status_t destroySurface(SurfaceID sid); - -private: - virtual void onFirstRef(); - Composer& getComposer(); - - mutable Mutex mLock; - status_t mStatus; - sp<ISurfaceComposerClient> mClient; - Composer& mComposer; -}; - -// --------------------------------------------------------------------------- - -class ScreenshotClient -{ - sp<IMemoryHeap> mHeap; - uint32_t mWidth; - uint32_t mHeight; - PixelFormat mFormat; -public: - ScreenshotClient(); - - // frees the previous screenshot and capture a new one - status_t update(); - status_t update(uint32_t reqWidth, uint32_t reqHeight); - status_t update(uint32_t reqWidth, uint32_t reqHeight, - uint32_t minLayerZ, uint32_t maxLayerZ); - - // release memory occupied by the screenshot - void release(); - - // pixels are valid until this object is freed or - // release() or update() is called - void const* getPixels() const; - - uint32_t getWidth() const; - uint32_t getHeight() const; - PixelFormat getFormat() const; - uint32_t getStride() const; - // size of allocated memory in bytes - size_t getSize() const; -}; - -// --------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_GUI_SURFACE_COMPOSER_CLIENT_H diff --git a/include/gui/SurfaceTexture.h b/include/gui/SurfaceTexture.h deleted file mode 100644 index 5531e53..0000000 --- a/include/gui/SurfaceTexture.h +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_GUI_SURFACETEXTURE_H -#define ANDROID_GUI_SURFACETEXTURE_H - -#include <EGL/egl.h> -#include <EGL/eglext.h> -#include <GLES2/gl2.h> -#include <GLES2/gl2ext.h> - -#include <gui/ISurfaceTexture.h> -#include <gui/BufferQueue.h> - -#include <ui/GraphicBuffer.h> - -#include <utils/String8.h> -#include <utils/Vector.h> -#include <utils/threads.h> - -#define ANDROID_GRAPHICS_SURFACETEXTURE_JNI_ID "mSurfaceTexture" - -namespace android { -// ---------------------------------------------------------------------------- - - -class String8; - -class SurfaceTexture : public BufferQueue { -public: - - // SurfaceTexture constructs a new SurfaceTexture object. tex indicates the - // name of the OpenGL ES texture to which images are to be streamed. This - // texture name cannot be changed once the SurfaceTexture is created. - // allowSynchronousMode specifies whether or not synchronous mode can be - // enabled. texTarget specifies the OpenGL ES texture target to which the - // texture will be bound in updateTexImage. useFenceSync specifies whether - // fences should be used to synchronize access to buffers if that behavior - // is enabled at compile-time. - SurfaceTexture(GLuint tex, bool allowSynchronousMode = true, - GLenum texTarget = GL_TEXTURE_EXTERNAL_OES, bool useFenceSync = true); - - virtual ~SurfaceTexture(); - - - - // updateTexImage sets the image contents of the target texture to that of - // the most recently queued buffer. - // - // This call may only be made while the OpenGL ES context to which the - // target texture belongs is bound to the calling thread. - status_t updateTexImage(); - - // setBufferCountServer set the buffer count. If the client has requested - // a buffer count using setBufferCount, the server-buffer count will - // take effect once the client sets the count back to zero. - status_t setBufferCountServer(int bufferCount); - - // getTransformMatrix retrieves the 4x4 texture coordinate transform matrix - // associated with the texture image set by the most recent call to - // updateTexImage. - // - // This transform matrix maps 2D homogeneous texture coordinates of the form - // (s, t, 0, 1) with s and t in the inclusive range [0, 1] to the texture - // coordinate that should be used to sample that location from the texture. - // Sampling the texture outside of the range of this transform is undefined. - // - // 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 - // copy of the data that would be needed to hide the transform from the - // user. - // - // The matrix is stored in column-major order so that it may be passed - // directly to OpenGL ES via the glLoadMatrixf or glUniformMatrix4fv - // functions. - void getTransformMatrix(float mtx[16]); - - // getTimestamp retrieves the timestamp associated with the texture image - // set by the most recent call to updateTexImage. - // - // The timestamp is in nanoseconds, and is monotonically increasing. Its - // other semantics (zero point, etc) are source-dependent and should be - // documented by the source. - int64_t getTimestamp(); - - // setFrameAvailableListener sets the listener object that will be notified - // when a new frame becomes available. - void setFrameAvailableListener(const sp<FrameAvailableListener>& listener); - - // getAllocator retrieves the binder object that must be referenced as long - // as the GraphicBuffers dequeued from this SurfaceTexture are referenced. - // Holding this binder reference prevents SurfaceFlinger from freeing the - // buffers before the client is done with them. - sp<IBinder> getAllocator(); - - // setDefaultBufferSize is used to set the size of buffers returned by - // requestBuffers when a with and height of zero is requested. - // A call to setDefaultBufferSize() may trigger requestBuffers() to - // be called from the client. - // The width and height parameters must be no greater than the minimum of - // GL_MAX_VIEWPORT_DIMS and GL_MAX_TEXTURE_SIZE (see: glGetIntegerv). - // An error due to invalid dimensions might not be reported until - // updateTexImage() is called. - status_t setDefaultBufferSize(uint32_t width, uint32_t height); - - // getCurrentBuffer returns the buffer associated with the current image. - sp<GraphicBuffer> getCurrentBuffer() const; - - // getCurrentTextureTarget returns the texture target of the current - // texture as returned by updateTexImage(). - GLenum getCurrentTextureTarget() const; - - // getCurrentCrop returns the cropping rectangle of the current buffer - Rect getCurrentCrop() const; - - // getCurrentTransform returns the transform of the current buffer - uint32_t getCurrentTransform() const; - - // getCurrentScalingMode returns the scaling mode of the current buffer - uint32_t getCurrentScalingMode() const; - - // isSynchronousMode returns whether the SurfaceTexture is currently in - // synchronous mode. - bool isSynchronousMode() const; - - // abandon frees all the buffers and puts the SurfaceTexture into the - // 'abandoned' state. Once put in this state the SurfaceTexture can never - // leave it. When in the 'abandoned' state, all methods of the - // ISurfaceTexture 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 SurfaceTexture, if there are additional - // references on the buffers (e.g. if a buffer is referenced by a client or - // by OpenGL ES as a texture) then those buffer will remain allocated. - void abandon(); - - // set the name of the SurfaceTexture that will be used to identify it in - // log messages. - void setName(const String8& name); - - // dump our state in a String - virtual void dump(String8& result) const; - virtual void dump(String8& result, const char* prefix, char* buffer, size_t SIZE) const; - -protected: - - static bool isExternalFormat(uint32_t format); - -private: - - // createImage creates a new EGLImage from a GraphicBuffer. - EGLImageKHR createImage(EGLDisplay dpy, - const sp<GraphicBuffer>& graphicBuffer); - - // computeCurrentTransformMatrix computes the transform matrix for the - // current texture. It uses mCurrentTransform and the current GraphicBuffer - // to compute this matrix and stores it in mCurrentTransformMatrix. - void computeCurrentTransformMatrix(); - - // mCurrentTextureBuf is the graphic buffer of the current texture. It's - // possible that this buffer is not associated with any buffer slot, so we - // must track it separately in order to support the getCurrentBuffer method. - sp<GraphicBuffer> mCurrentTextureBuf; - - // mCurrentCrop is the crop rectangle that applies to the current texture. - // It gets set each time updateTexImage is called. - Rect mCurrentCrop; - - // mCurrentTransform is the transform identifier for the current texture. It - // gets set each time updateTexImage is called. - uint32_t mCurrentTransform; - - // mCurrentScalingMode is the scaling mode for the current texture. It gets - // set to each time updateTexImage is called. - uint32_t mCurrentScalingMode; - - // mCurrentTransformMatrix is the transform matrix for the current texture. - // It gets computed by computeTransformMatrix each time updateTexImage is - // called. - float mCurrentTransformMatrix[16]; - - // mCurrentTimestamp is the timestamp for the current texture. It - // gets set each time updateTexImage is called. - int64_t mCurrentTimestamp; - - // mTexName is the name of the OpenGL texture to which streamed images will - // be bound when updateTexImage is called. It is set at construction time - // changed with a call to setTexName. - const GLuint mTexName; - - // mUseFenceSync indicates whether creation of the EGL_KHR_fence_sync - // extension should be used to prevent buffers from being dequeued before - // it's safe for them to be written. It gets set at construction time and - // never changes. - const bool mUseFenceSync; - - // mTexTarget is the GL texture target with which the GL texture object is - // associated. It is set in the constructor and never changed. It is - // almost always GL_TEXTURE_EXTERNAL_OES except for one use case in Android - // Browser. In that case it is set to GL_TEXTURE_2D to allow - // glCopyTexSubImage to read from the texture. This is a hack to work - // around a GL driver limitation on the number of FBO attachments, which the - // browser's tile cache exceeds. - const GLenum mTexTarget; - - // SurfaceTexture maintains EGL information about GraphicBuffers that corresponds - // directly with BufferQueue's buffers - struct EGLSlot { - EGLSlot() - : mEglImage(EGL_NO_IMAGE_KHR), - mEglDisplay(EGL_NO_DISPLAY), - mFence(EGL_NO_SYNC_KHR) { - } - - sp<GraphicBuffer> mGraphicBuffer; - - // mEglImage is the EGLImage created from mGraphicBuffer. - EGLImageKHR mEglImage; - - // mEglDisplay is the EGLDisplay used to create mEglImage. - EGLDisplay mEglDisplay; - - // mFence is the EGL sync object that must signal before the buffer - // associated with this buffer slot may be dequeued. It is initialized - // to EGL_NO_SYNC_KHR when the buffer is created and (optionally, based - // on a compile-time option) set to a new sync object in updateTexImage. - EGLSyncKHR mFence; - }; - - EGLSlot mEGLSlots[NUM_BUFFER_SLOTS]; - - // mAbandoned indicates that the BufferQueue will no longer be used to - // consume images buffers pushed to it using the ISurfaceTexture 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. - bool mAbandoned; - - // mName is a string used to identify the SurfaceTexture in log messages. - // It can be set by the setName method. - String8 mName; - - // mMutex is the mutex used to prevent concurrent access to the member - // variables of SurfaceTexture objects. It must be locked whenever the - // member variables are accessed. - mutable Mutex mMutex; - - // mCurrentTexture is the buffer slot index of the buffer that is currently - // bound to the OpenGL texture. It is initialized to INVALID_BUFFER_SLOT, - // indicating that no buffer slot is currently bound to the texture. Note, - // however, that a value of INVALID_BUFFER_SLOT does not necessarily mean - // that no buffer is bound to the texture. A call to setBufferCount will - // reset mCurrentTexture to INVALID_BUFFER_SLOT. - int mCurrentTexture; - -}; - -// ---------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_GUI_SURFACETEXTURE_H diff --git a/include/gui/SurfaceTextureClient.h b/include/gui/SurfaceTextureClient.h deleted file mode 100644 index aa7fe48..0000000 --- a/include/gui/SurfaceTextureClient.h +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_GUI_SURFACETEXTURECLIENT_H -#define ANDROID_GUI_SURFACETEXTURECLIENT_H - -#include <gui/ISurfaceTexture.h> -#include <gui/SurfaceTexture.h> - -#include <ui/ANativeObjectBase.h> -#include <ui/Region.h> - -#include <utils/RefBase.h> -#include <utils/threads.h> - -namespace android { - -class Surface; - -class SurfaceTextureClient - : public ANativeObjectBase<ANativeWindow, SurfaceTextureClient, RefBase> -{ -public: - SurfaceTextureClient(const sp<ISurfaceTexture>& surfaceTexture); - - sp<ISurfaceTexture> getISurfaceTexture() const; - -protected: - SurfaceTextureClient(); - virtual ~SurfaceTextureClient(); - void setISurfaceTexture(const sp<ISurfaceTexture>& surfaceTexture); - -private: - // can't be copied - SurfaceTextureClient& operator = (const SurfaceTextureClient& rhs); - SurfaceTextureClient(const SurfaceTextureClient& rhs); - void init(); - - // ANativeWindow hooks - static int hook_cancelBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer); - static int hook_dequeueBuffer(ANativeWindow* window, ANativeWindowBuffer** buffer); - static int hook_lockBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer); - static int hook_perform(ANativeWindow* window, int operation, ...); - static int hook_query(const ANativeWindow* window, int what, int* value); - static int hook_queueBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer); - static int hook_setSwapInterval(ANativeWindow* window, int interval); - - int dispatchConnect(va_list args); - int dispatchDisconnect(va_list args); - int dispatchSetBufferCount(va_list args); - int dispatchSetBuffersGeometry(va_list args); - int dispatchSetBuffersDimensions(va_list args); - int dispatchSetBuffersFormat(va_list args); - int dispatchSetScalingMode(va_list args); - int dispatchSetBuffersTransform(va_list args); - int dispatchSetBuffersTimestamp(va_list args); - int dispatchSetCrop(va_list args); - int dispatchSetUsage(va_list args); - int dispatchLock(va_list args); - int dispatchUnlockAndPost(va_list args); - -protected: - virtual int cancelBuffer(ANativeWindowBuffer* buffer); - virtual int dequeueBuffer(ANativeWindowBuffer** buffer); - virtual int lockBuffer(ANativeWindowBuffer* buffer); - virtual int perform(int operation, va_list args); - virtual int query(int what, int* value) const; - virtual int queueBuffer(ANativeWindowBuffer* buffer); - virtual int setSwapInterval(int interval); - - virtual int connect(int api); - virtual int disconnect(int api); - virtual int setBufferCount(int bufferCount); - virtual int setBuffersDimensions(int w, int h); - virtual int setBuffersFormat(int format); - virtual int setScalingMode(int mode); - virtual int setBuffersTransform(int transform); - virtual int setBuffersTimestamp(int64_t timestamp); - virtual int setCrop(Rect const* rect); - virtual int setUsage(uint32_t reqUsage); - virtual int lock(ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds); - virtual int unlockAndPost(); - - enum { MIN_UNDEQUEUED_BUFFERS = SurfaceTexture::MIN_UNDEQUEUED_BUFFERS }; - enum { NUM_BUFFER_SLOTS = SurfaceTexture::NUM_BUFFER_SLOTS }; - enum { DEFAULT_FORMAT = PIXEL_FORMAT_RGBA_8888 }; - -private: - void freeAllBuffers(); - int getSlotFromBufferLocked(android_native_buffer_t* buffer) const; - - // 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; - - // 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 - // 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. - sp<GraphicBuffer> mSlots[NUM_BUFFER_SLOTS]; - - // mReqWidth is the buffer width that will be requested at the next dequeue - // operation. It is initialized to 1. - uint32_t mReqWidth; - - // mReqHeight is the buffer height that will be requested at the next deuque - // operation. It is initialized to 1. - uint32_t mReqHeight; - - // mReqFormat is the buffer pixel format that will be requested at the next - // deuque operation. It is initialized to PIXEL_FORMAT_RGBA_8888. - uint32_t mReqFormat; - - // mReqUsage is the set of buffer usage flags that will be requested - // at the next deuque operation. It is initialized to 0. - uint32_t mReqUsage; - - // mTimestamp is the timestamp that will be used for the next buffer queue - // operation. It defaults to NATIVE_WINDOW_TIMESTAMP_AUTO, which means that - // a timestamp is auto-generated when queueBuffer is called. - int64_t mTimestamp; - - // mDefaultWidth is default width of the window, regardless of the - // native_window_set_buffers_dimensions call - uint32_t mDefaultWidth; - - // mDefaultHeight is default width of the window, regardless of the - // native_window_set_buffers_dimensions call - uint32_t mDefaultHeight; - - // mTransformHint is the transform probably applied to buffers of this - // window. this is only a hint, actual transform may differ. - uint32_t mTransformHint; - - // mMutex is the mutex used to prevent concurrent access to the member - // variables of SurfaceTexture objects. It must be locked whenever the - // member variables are accessed. - mutable Mutex mMutex; - - // must be used from the lock/unlock thread - sp<GraphicBuffer> mLockedBuffer; - sp<GraphicBuffer> mPostedBuffer; - mutable Region mOldDirtyRegion; - bool mConnectedToCpu; -}; - -}; // namespace android - -#endif // ANDROID_GUI_SURFACETEXTURECLIENT_H |