diff options
161 files changed, 22745 insertions, 2145 deletions
diff --git a/cmds/keystore/keystore.cpp b/cmds/keystore/keystore.cpp index 4b4b9b9d4a..05f77e5326 100644 --- a/cmds/keystore/keystore.cpp +++ b/cmds/keystore/keystore.cpp @@ -133,7 +133,7 @@ public: const char* randomDevice = "/dev/urandom"; mRandom = ::open(randomDevice, O_RDONLY); if (mRandom == -1) { - LOGE("open: %s: %s", randomDevice, strerror(errno)); + ALOGE("open: %s: %s", randomDevice, strerror(errno)); return false; } return true; @@ -754,11 +754,11 @@ static ResponseCode process(KeyStore* keyStore, int sock, uid_t uid, int8_t code int main(int argc, char* argv[]) { int controlSocket = android_get_control_socket("keystore"); if (argc < 2) { - LOGE("A directory must be specified!"); + ALOGE("A directory must be specified!"); return 1; } if (chdir(argv[1]) == -1) { - LOGE("chdir: %s: %s", argv[1], strerror(errno)); + ALOGE("chdir: %s: %s", argv[1], strerror(errno)); return 1; } @@ -767,7 +767,7 @@ int main(int argc, char* argv[]) { return 1; } if (listen(controlSocket, 3) == -1) { - LOGE("listen: %s", strerror(errno)); + ALOGE("listen: %s", strerror(errno)); return 1; } @@ -785,7 +785,7 @@ int main(int argc, char* argv[]) { socklen_t size = sizeof(cred); int credResult = getsockopt(sock, SOL_SOCKET, SO_PEERCRED, &cred, &size); if (credResult != 0) { - LOGW("getsockopt: %s", strerror(errno)); + ALOGW("getsockopt: %s", strerror(errno)); } else { int8_t request; if (recv_code(sock, &request)) { @@ -796,7 +796,7 @@ int main(int argc, char* argv[]) { } else { send_code(sock, response); } - LOGI("uid: %d action: %c -> %d state: %d -> %d retry: %d", + ALOGI("uid: %d action: %c -> %d state: %d -> %d retry: %d", cred.uid, request, response, old_state, keyStore.getState(), @@ -805,6 +805,6 @@ int main(int argc, char* argv[]) { } close(sock); } - LOGE("accept: %s", strerror(errno)); + ALOGE("accept: %s", strerror(errno)); return 1; } diff --git a/include/binder/CursorWindow.h b/include/binder/CursorWindow.h index f0284ded0c..8a2979a375 100644 --- a/include/binder/CursorWindow.h +++ b/include/binder/CursorWindow.h @@ -31,8 +31,8 @@ #else -#define IF_LOG_WINDOW() IF_LOG(LOG_DEBUG, "CursorWindow") -#define LOG_WINDOW(...) LOG(LOG_DEBUG, "CursorWindow", __VA_ARGS__) +#define IF_LOG_WINDOW() IF_ALOG(LOG_DEBUG, "CursorWindow") +#define LOG_WINDOW(...) ALOG(LOG_DEBUG, "CursorWindow", __VA_ARGS__) #endif diff --git a/include/gui/SensorChannel.h b/include/gui/BitTube.h index bb546186a6..76389a037f 100644 --- a/include/gui/SensorChannel.h +++ b/include/gui/BitTube.h @@ -28,14 +28,15 @@ namespace android { // ---------------------------------------------------------------------------- class Parcel; -class SensorChannel : public RefBase +class BitTube : public RefBase { public: - SensorChannel(); - SensorChannel(const Parcel& data); - virtual ~SensorChannel(); + 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); diff --git a/include/gui/DisplayEventReceiver.h b/include/gui/DisplayEventReceiver.h new file mode 100644 index 0000000000..dccc1643c9 --- /dev/null +++ b/include/gui/DisplayEventReceiver.h @@ -0,0 +1,119 @@ +/* + * 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. 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); + + /* + * 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 new file mode 100644 index 0000000000..86247de62b --- /dev/null +++ b/include/gui/IDisplayEventConnection.h @@ -0,0 +1,73 @@ +/* + * 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/ISensorEventConnection.h b/include/gui/ISensorEventConnection.h index ed4e4cc72f..749065e84d 100644 --- a/include/gui/ISensorEventConnection.h +++ b/include/gui/ISensorEventConnection.h @@ -28,14 +28,14 @@ namespace android { // ---------------------------------------------------------------------------- -class SensorChannel; +class BitTube; class ISensorEventConnection : public IInterface { public: DECLARE_META_INTERFACE(SensorEventConnection); - virtual sp<SensorChannel> getSensorChannel() const = 0; + 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; }; diff --git a/include/gui/SensorEventQueue.h b/include/gui/SensorEventQueue.h index 97dd3919bd..ef7c6e3696 100644 --- a/include/gui/SensorEventQueue.h +++ b/include/gui/SensorEventQueue.h @@ -24,7 +24,7 @@ #include <utils/RefBase.h> #include <utils/Timers.h> -#include <gui/SensorChannel.h> +#include <gui/BitTube.h> // ---------------------------------------------------------------------------- @@ -71,7 +71,7 @@ public: private: sp<Looper> getLooper() const; sp<ISensorEventConnection> mSensorEventConnection; - sp<SensorChannel> mSensorChannel; + sp<BitTube> mSensorChannel; mutable Mutex mLock; mutable sp<Looper> mLooper; }; diff --git a/include/private/gui/ComposerService.h b/include/private/gui/ComposerService.h new file mode 100644 index 0000000000..d04491a86e --- /dev/null +++ b/include/private/gui/ComposerService.h @@ -0,0 +1,53 @@ +/* + * 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_PRIVATE_GUI_COMPOSER_SERVICE_H +#define ANDROID_PRIVATE_GUI_COMPOSER_SERVICE_H + +#include <stdint.h> +#include <sys/types.h> + +#include <utils/Singleton.h> +#include <utils/StrongPointer.h> + + +namespace android { + +// --------------------------------------------------------------------------- + +class IMemoryHeap; +class ISurfaceComposer; +class surface_flinger_cblk_t; + +// --------------------------------------------------------------------------- + +class ComposerService : public Singleton<ComposerService> +{ + // these are constants + sp<ISurfaceComposer> mComposerService; + sp<IMemoryHeap> mServerCblkMemory; + surface_flinger_cblk_t volatile* mServerCblk; + ComposerService(); + friend class Singleton<ComposerService>; +public: + static sp<ISurfaceComposer> getComposerService(); + static surface_flinger_cblk_t const volatile * getControlBlock(); +}; + +// --------------------------------------------------------------------------- +}; // namespace android + +#endif // ANDROID_PRIVATE_GUI_COMPOSER_SERVICE_H diff --git a/include/surfaceflinger/ISurfaceComposer.h b/include/surfaceflinger/ISurfaceComposer.h index 5eb09c7966..58fd89d3b6 100644 --- a/include/surfaceflinger/ISurfaceComposer.h +++ b/include/surfaceflinger/ISurfaceComposer.h @@ -33,8 +33,9 @@ namespace android { // ---------------------------------------------------------------------------- -class IMemoryHeap; class ComposerState; +class IDisplayEventConnection; +class IMemoryHeap; class ISurfaceComposer : public IInterface { @@ -124,13 +125,19 @@ public: 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; }; // ---------------------------------------------------------------------------- @@ -151,6 +158,7 @@ public: TURN_ELECTRON_BEAM_OFF, TURN_ELECTRON_BEAM_ON, AUTHENTICATE_SURFACE, + CREATE_DISPLAY_EVENT_CONNECTION, }; virtual status_t onTransact( uint32_t code, diff --git a/include/surfaceflinger/SurfaceComposerClient.h b/include/surfaceflinger/SurfaceComposerClient.h index 8226abec1c..99affdae64 100644 --- a/include/surfaceflinger/SurfaceComposerClient.h +++ b/include/surfaceflinger/SurfaceComposerClient.h @@ -28,7 +28,6 @@ #include <utils/threads.h> #include <ui/PixelFormat.h> -#include <ui/Region.h> #include <surfaceflinger/Surface.h> @@ -39,30 +38,11 @@ namespace android { class DisplayInfo; class Composer; class IMemoryHeap; -class ISurfaceComposer; +class ISurfaceComposerClient; class Region; -class surface_flinger_cblk_t; -struct layer_state_t; // --------------------------------------------------------------------------- -class ComposerService : public Singleton<ComposerService> -{ - // these are constants - sp<ISurfaceComposer> mComposerService; - sp<IMemoryHeap> mServerCblkMemory; - surface_flinger_cblk_t volatile* mServerCblk; - ComposerService(); - friend class Singleton<ComposerService>; -public: - static sp<ISurfaceComposer> getComposerService(); - static surface_flinger_cblk_t const volatile * getControlBlock(); -}; - -// --------------------------------------------------------------------------- - -class Composer; - class SurfaceComposerClient : public RefBase { friend class Composer; diff --git a/include/utils/BasicHashtable.h b/include/utils/BasicHashtable.h new file mode 100644 index 0000000000..fdf97385f9 --- /dev/null +++ b/include/utils/BasicHashtable.h @@ -0,0 +1,393 @@ +/* + * 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_BASIC_HASHTABLE_H +#define ANDROID_BASIC_HASHTABLE_H + +#include <stdint.h> +#include <sys/types.h> +#include <utils/SharedBuffer.h> +#include <utils/TypeHelpers.h> + +namespace android { + +/* Implementation type. Nothing to see here. */ +class BasicHashtableImpl { +protected: + struct Bucket { + // The collision flag indicates that the bucket is part of a collision chain + // such that at least two entries both hash to this bucket. When true, we + // may need to seek further along the chain to find the entry. + static const uint32_t COLLISION = 0x80000000UL; + + // The present flag indicates that the bucket contains an initialized entry value. + static const uint32_t PRESENT = 0x40000000UL; + + // Mask for 30 bits worth of the hash code that are stored within the bucket to + // speed up lookups and rehashing by eliminating the need to recalculate the + // hash code of the entry's key. + static const uint32_t HASH_MASK = 0x3fffffffUL; + + // Combined value that stores the collision and present flags as well as + // a 30 bit hash code. + uint32_t cookie; + + // Storage for the entry begins here. + char entry[0]; + }; + + BasicHashtableImpl(size_t entrySize, bool hasTrivialDestructor, + size_t minimumInitialCapacity, float loadFactor); + BasicHashtableImpl(const BasicHashtableImpl& other); + + void dispose(); + + inline void edit() { + if (mBuckets && !SharedBuffer::bufferFromData(mBuckets)->onlyOwner()) { + clone(); + } + } + + void setTo(const BasicHashtableImpl& other); + void clear(); + + ssize_t next(ssize_t index) const; + ssize_t find(ssize_t index, hash_t hash, const void* __restrict__ key) const; + size_t add(hash_t hash, const void* __restrict__ entry); + void removeAt(size_t index); + void rehash(size_t minimumCapacity, float loadFactor); + + const size_t mBucketSize; // number of bytes per bucket including the entry + const bool mHasTrivialDestructor; // true if the entry type does not require destruction + size_t mCapacity; // number of buckets that can be filled before exceeding load factor + float mLoadFactor; // load factor + size_t mSize; // number of elements actually in the table + size_t mFilledBuckets; // number of buckets for which collision or present is true + size_t mBucketCount; // number of slots in the mBuckets array + void* mBuckets; // array of buckets, as a SharedBuffer + + inline const Bucket& bucketAt(const void* __restrict__ buckets, size_t index) const { + return *reinterpret_cast<const Bucket*>( + static_cast<const uint8_t*>(buckets) + index * mBucketSize); + } + + inline Bucket& bucketAt(void* __restrict__ buckets, size_t index) const { + return *reinterpret_cast<Bucket*>(static_cast<uint8_t*>(buckets) + index * mBucketSize); + } + + virtual bool compareBucketKey(const Bucket& bucket, const void* __restrict__ key) const = 0; + virtual void initializeBucketEntry(Bucket& bucket, const void* __restrict__ entry) const = 0; + virtual void destroyBucketEntry(Bucket& bucket) const = 0; + +private: + void clone(); + + // Allocates a bucket array as a SharedBuffer. + void* allocateBuckets(size_t count) const; + + // Releases a bucket array's associated SharedBuffer. + void releaseBuckets(void* __restrict__ buckets, size_t count) const; + + // Destroys the contents of buckets (invokes destroyBucketEntry for each + // populated bucket if needed). + void destroyBuckets(void* __restrict__ buckets, size_t count) const; + + // Copies the content of buckets (copies the cookie and invokes copyBucketEntry + // for each populated bucket if needed). + void copyBuckets(const void* __restrict__ fromBuckets, + void* __restrict__ toBuckets, size_t count) const; + + // Determines the appropriate size of a bucket array to store a certain minimum + // number of entries and returns its effective capacity. + static void determineCapacity(size_t minimumCapacity, float loadFactor, + size_t* __restrict__ outBucketCount, size_t* __restrict__ outCapacity); + + // Trim a hash code to 30 bits to match what we store in the bucket's cookie. + inline static hash_t trimHash(hash_t hash) { + return (hash & Bucket::HASH_MASK) ^ (hash >> 30); + } + + // Returns the index of the first bucket that is in the collision chain + // for the specified hash code, given the total number of buckets. + // (Primary hash) + inline static size_t chainStart(hash_t hash, size_t count) { + return hash % count; + } + + // Returns the increment to add to a bucket index to seek to the next bucket + // in the collision chain for the specified hash code, given the total number of buckets. + // (Secondary hash) + inline static size_t chainIncrement(hash_t hash, size_t count) { + return ((hash >> 7) | (hash << 25)) % (count - 1) + 1; + } + + // Returns the index of the next bucket that is in the collision chain + // that is defined by the specified increment, given the total number of buckets. + inline static size_t chainSeek(size_t index, size_t increment, size_t count) { + return (index + increment) % count; + } +}; + +/* + * A BasicHashtable stores entries that are indexed by hash code in place + * within an array. The basic operations are finding entries by key, + * adding new entries and removing existing entries. + * + * This class provides a very limited set of operations with simple semantics. + * It is intended to be used as a building block to construct more complex + * and interesting data structures such as HashMap. Think very hard before + * adding anything extra to BasicHashtable, it probably belongs at a + * higher level of abstraction. + * + * TKey: The key type. + * TEntry: The entry type which is what is actually stored in the array. + * + * TKey must support the following contract: + * bool operator==(const TKey& other) const; // return true if equal + * bool operator!=(const TKey& other) const; // return true if unequal + * + * TEntry must support the following contract: + * const TKey& getKey() const; // get the key from the entry + * + * This class supports storing entries with duplicate keys. Of course, it can't + * tell them apart during removal so only the first entry will be removed. + * We do this because it means that operations like add() can't fail. + */ +template <typename TKey, typename TEntry> +class BasicHashtable : private BasicHashtableImpl { +public: + /* Creates a hashtable with the specified minimum initial capacity. + * The underlying array will be created when the first entry is added. + * + * minimumInitialCapacity: The minimum initial capacity for the hashtable. + * Default is 0. + * loadFactor: The desired load factor for the hashtable, between 0 and 1. + * Default is 0.75. + */ + BasicHashtable(size_t minimumInitialCapacity = 0, float loadFactor = 0.75f); + + /* Copies a hashtable. + * The underlying storage is shared copy-on-write. + */ + BasicHashtable(const BasicHashtable& other); + + /* Clears and destroys the hashtable. + */ + virtual ~BasicHashtable(); + + /* Making this hashtable a copy of the other hashtable. + * The underlying storage is shared copy-on-write. + * + * other: The hashtable to copy. + */ + inline BasicHashtable<TKey, TEntry>& operator =(const BasicHashtable<TKey, TEntry> & other) { + setTo(other); + return *this; + } + + /* Returns the number of entries in the hashtable. + */ + inline size_t size() const { + return mSize; + } + + /* Returns the capacity of the hashtable, which is the number of elements that can + * added to the hashtable without requiring it to be grown. + */ + inline size_t capacity() const { + return mCapacity; + } + + /* Returns the number of buckets that the hashtable has, which is the size of its + * underlying array. + */ + inline size_t bucketCount() const { + return mBucketCount; + } + + /* Returns the load factor of the hashtable. */ + inline float loadFactor() const { + return mLoadFactor; + }; + + /* Returns a const reference to the entry at the specified index. + * + * index: The index of the entry to retrieve. Must be a valid index within + * the bounds of the hashtable. + */ + inline const TEntry& entryAt(size_t index) const { + return entryFor(bucketAt(mBuckets, index)); + } + + /* Returns a non-const reference to the entry at the specified index. + * + * index: The index of the entry to edit. Must be a valid index within + * the bounds of the hashtable. + */ + inline TEntry& editEntryAt(size_t index) { + edit(); + return entryFor(bucketAt(mBuckets, index)); + } + + /* Clears the hashtable. + * All entries in the hashtable are destroyed immediately. + * If you need to do something special with the entries in the hashtable then iterate + * over them and do what you need before clearing the hashtable. + */ + inline void clear() { + BasicHashtableImpl::clear(); + } + + /* Returns the index of the next entry in the hashtable given the index of a previous entry. + * If the given index is -1, then returns the index of the first entry in the hashtable, + * if there is one, or -1 otherwise. + * If the given index is not -1, then returns the index of the next entry in the hashtable, + * in strictly increasing order, or -1 if there are none left. + * + * index: The index of the previous entry that was iterated, or -1 to begin + * iteration at the beginning of the hashtable. + */ + inline ssize_t next(ssize_t index) const { + return BasicHashtableImpl::next(index); + } + + /* Finds the index of an entry with the specified key. + * If the given index is -1, then returns the index of the first matching entry, + * otherwise returns the index of the next matching entry. + * If the hashtable contains multiple entries with keys that match the requested + * key, then the sequence of entries returned is arbitrary. + * Returns -1 if no entry was found. + * + * index: The index of the previous entry with the specified key, or -1 to + * find the first matching entry. + * hash: The hashcode of the key. + * key: The key. + */ + inline ssize_t find(ssize_t index, hash_t hash, const TKey& key) const { + return BasicHashtableImpl::find(index, hash, &key); + } + + /* Adds the entry to the hashtable. + * Returns the index of the newly added entry. + * If an entry with the same key already exists, then a duplicate entry is added. + * If the entry will not fit, then the hashtable's capacity is increased and + * its contents are rehashed. See rehash(). + * + * hash: The hashcode of the key. + * entry: The entry to add. + */ + inline size_t add(hash_t hash, const TEntry& entry) { + return BasicHashtableImpl::add(hash, &entry); + } + + /* Removes the entry with the specified index from the hashtable. + * The entry is destroyed immediately. + * The index must be valid. + * + * The hashtable is not compacted after an item is removed, so it is legal + * to continue iterating over the hashtable using next() or find(). + * + * index: The index of the entry to remove. Must be a valid index within the + * bounds of the hashtable, and it must refer to an existing entry. + */ + inline void removeAt(size_t index) { + BasicHashtableImpl::removeAt(index); + } + + /* Rehashes the contents of the hashtable. + * Grows the hashtable to at least the specified minimum capacity or the + * current number of elements, whichever is larger. + * + * Rehashing causes all entries to be copied and the entry indices may change. + * Although the hash codes are cached by the hashtable, rehashing can be an + * expensive operation and should be avoided unless the hashtable's size + * needs to be changed. + * + * Rehashing is the only way to change the capacity or load factor of the + * hashtable once it has been created. It can be used to compact the + * hashtable by choosing a minimum capacity that is smaller than the current + * capacity (such as 0). + * + * minimumCapacity: The desired minimum capacity after rehashing. + * loadFactor: The desired load factor after rehashing. + */ + inline void rehash(size_t minimumCapacity, float loadFactor) { + BasicHashtableImpl::rehash(minimumCapacity, loadFactor); + } + +protected: + static inline const TEntry& entryFor(const Bucket& bucket) { + return reinterpret_cast<const TEntry&>(bucket.entry); + } + + static inline TEntry& entryFor(Bucket& bucket) { + return reinterpret_cast<TEntry&>(bucket.entry); + } + + virtual bool compareBucketKey(const Bucket& bucket, const void* __restrict__ key) const; + virtual void initializeBucketEntry(Bucket& bucket, const void* __restrict__ entry) const; + virtual void destroyBucketEntry(Bucket& bucket) const; + +private: + // For dumping the raw contents of a hashtable during testing. + friend class BasicHashtableTest; + inline uint32_t cookieAt(size_t index) const { + return bucketAt(mBuckets, index).cookie; + } +}; + +template <typename TKey, typename TEntry> +BasicHashtable<TKey, TEntry>::BasicHashtable(size_t minimumInitialCapacity, float loadFactor) : + BasicHashtableImpl(sizeof(TEntry), traits<TEntry>::has_trivial_dtor, + minimumInitialCapacity, loadFactor) { +} + +template <typename TKey, typename TEntry> +BasicHashtable<TKey, TEntry>::BasicHashtable(const BasicHashtable<TKey, TEntry>& other) : + BasicHashtableImpl(other) { +} + +template <typename TKey, typename TEntry> +BasicHashtable<TKey, TEntry>::~BasicHashtable() { + dispose(); +} + +template <typename TKey, typename TEntry> +bool BasicHashtable<TKey, TEntry>::compareBucketKey(const Bucket& bucket, + const void* __restrict__ key) const { + return entryFor(bucket).getKey() == *static_cast<const TKey*>(key); +} + +template <typename TKey, typename TEntry> +void BasicHashtable<TKey, TEntry>::initializeBucketEntry(Bucket& bucket, + const void* __restrict__ entry) const { + if (!traits<TEntry>::has_trivial_copy) { + new (&entryFor(bucket)) TEntry(*(static_cast<const TEntry*>(entry))); + } else { + memcpy(&entryFor(bucket), entry, sizeof(TEntry)); + } +} + +template <typename TKey, typename TEntry> +void BasicHashtable<TKey, TEntry>::destroyBucketEntry(Bucket& bucket) const { + if (!traits<TEntry>::has_trivial_dtor) { + entryFor(bucket).~TEntry(); + } +} + +}; // namespace android + +#endif // ANDROID_BASIC_HASHTABLE_H diff --git a/include/utils/CallStack.h b/include/utils/CallStack.h index 8817120eff..079e20c696 100644 --- a/include/utils/CallStack.h +++ b/include/utils/CallStack.h @@ -21,6 +21,7 @@ #include <sys/types.h> #include <utils/String8.h> +#include <corkscrew/backtrace.h> // --------------------------------------------------------------------------- @@ -61,11 +62,8 @@ public: size_t size() const { return mCount; } private: - // Internal helper function - String8 toStringSingleLevel(const char* prefix, int32_t level) const; - - size_t mCount; - const void* mStack[MAX_DEPTH]; + size_t mCount; + backtrace_frame_t mStack[MAX_DEPTH]; }; }; // namespace android diff --git a/include/utils/GenerationCache.h b/include/utils/GenerationCache.h index bb9ddd6778..40722d11e3 100644 --- a/include/utils/GenerationCache.h +++ b/include/utils/GenerationCache.h @@ -34,17 +34,17 @@ public: template<typename EntryKey, typename EntryValue> struct Entry: public LightRefBase<Entry<EntryKey, EntryValue> > { - Entry() { } - Entry(const Entry<EntryKey, EntryValue>& e): - key(e.key), value(e.value), parent(e.parent), child(e.child) { } - Entry(sp<Entry<EntryKey, EntryValue> > e): - key(e->key), value(e->value), parent(e->parent), child(e->child) { } + Entry(const Entry<EntryKey, EntryValue>& e) : + key(e.key), value(e.value), + parent(e.parent), child(e.child) { } + Entry(const EntryKey& key, const EntryValue& value) : + key(key), value(value) { } EntryKey key; EntryValue value; - sp<Entry<EntryKey, EntryValue> > parent; - sp<Entry<EntryKey, EntryValue> > child; + sp<Entry<EntryKey, EntryValue> > parent; // next older entry + sp<Entry<EntryKey, EntryValue> > child; // next younger entry }; // struct Entry /** @@ -62,23 +62,20 @@ public: void setOnEntryRemovedListener(OnEntryRemoved<K, V>* listener); - void clear(); + size_t size() const; - bool contains(K key) const; - V get(K key); - K getKeyAt(uint32_t index) const; - bool put(K key, V value); - V remove(K key); - V removeOldest(); - V getValueAt(uint32_t index) const; + void clear(); - uint32_t size() const; + bool contains(const K& key) const; + const K& getKeyAt(size_t index) const; + const V& getValueAt(size_t index) const; - void addToCache(sp<Entry<K, V> > entry, K key, V value); - void attachToCache(sp<Entry<K, V> > entry); - void detachFromCache(sp<Entry<K, V> > entry); + const V& get(const K& key); + bool put(const K& key, const V& value); - V removeAt(ssize_t index); + void removeAt(ssize_t index); + bool remove(const K& key); + bool removeOldest(); private: KeyedVector<K, sp<Entry<K, V> > > mCache; @@ -88,11 +85,16 @@ private: sp<Entry<K, V> > mOldest; sp<Entry<K, V> > mYoungest; + + void attachToCache(const sp<Entry<K, V> >& entry); + void detachFromCache(const sp<Entry<K, V> >& entry); + + const V mNullValue; }; // class GenerationCache template<typename K, typename V> GenerationCache<K, V>::GenerationCache(uint32_t maxCapacity): mMaxCapacity(maxCapacity), - mListener(NULL) { + mListener(NULL), mNullValue(NULL) { }; template<typename K, typename V> @@ -130,45 +132,44 @@ void GenerationCache<K, V>::clear() { } template<typename K, typename V> -bool GenerationCache<K, V>::contains(K key) const { +bool GenerationCache<K, V>::contains(const K& key) const { return mCache.indexOfKey(key) >= 0; } template<typename K, typename V> -K GenerationCache<K, V>::getKeyAt(uint32_t index) const { +const K& GenerationCache<K, V>::getKeyAt(size_t index) const { return mCache.keyAt(index); } template<typename K, typename V> -V GenerationCache<K, V>::getValueAt(uint32_t index) const { +const V& GenerationCache<K, V>::getValueAt(size_t index) const { return mCache.valueAt(index)->value; } template<typename K, typename V> -V GenerationCache<K, V>::get(K key) { +const V& GenerationCache<K, V>::get(const K& key) { ssize_t index = mCache.indexOfKey(key); if (index >= 0) { - sp<Entry<K, V> > entry = mCache.valueAt(index); - if (entry.get()) { - detachFromCache(entry); - attachToCache(entry); - return entry->value; - } + const sp<Entry<K, V> >& entry = mCache.valueAt(index); + detachFromCache(entry); + attachToCache(entry); + return entry->value; } - return NULL; + return mNullValue; } template<typename K, typename V> -bool GenerationCache<K, V>::put(K key, V value) { +bool GenerationCache<K, V>::put(const K& key, const V& value) { if (mMaxCapacity != kUnlimitedCapacity && mCache.size() >= mMaxCapacity) { removeOldest(); } ssize_t index = mCache.indexOfKey(key); if (index < 0) { - sp<Entry<K, V> > entry = new Entry<K, V>; - addToCache(entry, key, value); + sp<Entry<K, V> > entry = new Entry<K, V>(key, value); + mCache.add(key, entry); + attachToCache(entry); return true; } @@ -176,49 +177,44 @@ bool GenerationCache<K, V>::put(K key, V value) { } template<typename K, typename V> -void GenerationCache<K, V>::addToCache(sp<Entry<K, V> > entry, K key, V value) { - entry->key = key; - entry->value = value; - mCache.add(key, entry); - attachToCache(entry); -} - -template<typename K, typename V> -V GenerationCache<K, V>::remove(K key) { +bool GenerationCache<K, V>::remove(const K& key) { ssize_t index = mCache.indexOfKey(key); if (index >= 0) { - return removeAt(index); + removeAt(index); + return true; } - return NULL; + return false; } template<typename K, typename V> -V GenerationCache<K, V>::removeAt(ssize_t index) { +void GenerationCache<K, V>::removeAt(ssize_t index) { sp<Entry<K, V> > entry = mCache.valueAt(index); if (mListener) { (*mListener)(entry->key, entry->value); } mCache.removeItemsAt(index, 1); detachFromCache(entry); - - return entry->value; } template<typename K, typename V> -V GenerationCache<K, V>::removeOldest() { +bool GenerationCache<K, V>::removeOldest() { if (mOldest.get()) { ssize_t index = mCache.indexOfKey(mOldest->key); if (index >= 0) { - return removeAt(index); + removeAt(index); + return true; } + ALOGE("GenerationCache: removeOldest failed to find the item in the cache " + "with the given key, but we know it must be in there. " + "Is the key comparator kaput?"); } - return NULL; + return false; } template<typename K, typename V> -void GenerationCache<K, V>::attachToCache(sp<Entry<K, V> > entry) { +void GenerationCache<K, V>::attachToCache(const sp<Entry<K, V> >& entry) { if (!mYoungest.get()) { mYoungest = mOldest = entry; } else { @@ -229,20 +225,16 @@ void GenerationCache<K, V>::attachToCache(sp<Entry<K, V> > entry) { } template<typename K, typename V> -void GenerationCache<K, V>::detachFromCache(sp<Entry<K, V> > entry) { +void GenerationCache<K, V>::detachFromCache(const sp<Entry<K, V> >& entry) { if (entry->parent.get()) { entry->parent->child = entry->child; + } else { + mOldest = entry->child; } if (entry->child.get()) { entry->child->parent = entry->parent; - } - - if (mOldest == entry) { - mOldest = entry->child; - } - - if (mYoungest == entry) { + } else { mYoungest = entry->parent; } diff --git a/include/utils/ResourceTypes.h b/include/utils/ResourceTypes.h index 612ff93463..46420c1316 100644 --- a/include/utils/ResourceTypes.h +++ b/include/utils/ResourceTypes.h @@ -955,6 +955,7 @@ struct ResTable_config UI_MODE_TYPE_DESK = ACONFIGURATION_UI_MODE_TYPE_DESK, UI_MODE_TYPE_CAR = ACONFIGURATION_UI_MODE_TYPE_CAR, UI_MODE_TYPE_TELEVISION = ACONFIGURATION_UI_MODE_TYPE_TELEVISION, + UI_MODE_TYPE_APPLIANCE = ACONFIGURATION_UI_MODE_TYPE_APPLIANCE, // uiMode bits for the night switch. MASK_UI_MODE_NIGHT = 0x30, @@ -1277,7 +1278,7 @@ struct ResTable_config myDelta += requested->screenHeightDp - screenHeightDp; otherDelta += requested->screenHeightDp - o.screenHeightDp; } - //LOGI("Comparing this %dx%d to other %dx%d in %dx%d: myDelta=%d otherDelta=%d", + //ALOGI("Comparing this %dx%d to other %dx%d in %dx%d: myDelta=%d otherDelta=%d", // screenWidthDp, screenHeightDp, o.screenWidthDp, o.screenHeightDp, // requested->screenWidthDp, requested->screenHeightDp, myDelta, otherDelta); return (myDelta <= otherDelta); @@ -1506,11 +1507,11 @@ struct ResTable_config } if (screenSizeDp != 0) { if (screenWidthDp != 0 && screenWidthDp > settings.screenWidthDp) { - //LOGI("Filtering out width %d in requested %d", screenWidthDp, settings.screenWidthDp); + //ALOGI("Filtering out width %d in requested %d", screenWidthDp, settings.screenWidthDp); return false; } if (screenHeightDp != 0 && screenHeightDp > settings.screenHeightDp) { - //LOGI("Filtering out height %d in requested %d", screenHeightDp, settings.screenHeightDp); + //ALOGI("Filtering out height %d in requested %d", screenHeightDp, settings.screenHeightDp); return false; } } @@ -1530,9 +1531,9 @@ struct ResTable_config // For compatibility, we count a request for KEYSHIDDEN_NO as also // matching the more recent KEYSHIDDEN_SOFT. Basically // KEYSHIDDEN_NO means there is some kind of keyboard available. - //LOGI("Matching keysHidden: have=%d, config=%d\n", keysHidden, setKeysHidden); + //ALOGI("Matching keysHidden: have=%d, config=%d\n", keysHidden, setKeysHidden); if (keysHidden != KEYSHIDDEN_NO || setKeysHidden != KEYSHIDDEN_SOFT) { - //LOGI("No match!"); + //ALOGI("No match!"); return false; } } diff --git a/include/utils/TypeHelpers.h b/include/utils/TypeHelpers.h index a1663f30e5..7b4fb70ba6 100644 --- a/include/utils/TypeHelpers.h +++ b/include/utils/TypeHelpers.h @@ -213,6 +213,9 @@ void move_backward_type(TYPE* d, const TYPE* s, size_t n = 1) { template <typename KEY, typename VALUE> struct key_value_pair_t { + typedef KEY key_t; + typedef VALUE value_t; + KEY key; VALUE value; key_value_pair_t() { } @@ -222,6 +225,12 @@ struct key_value_pair_t { inline bool operator < (const key_value_pair_t& o) const { return strictly_order_type(key, o.key); } + inline const KEY& getKey() const { + return key; + } + inline const VALUE& getValue() const { + return value; + } }; template<> @@ -243,6 +252,41 @@ struct trait_trivial_move< key_value_pair_t<K, V> > // --------------------------------------------------------------------------- +/* + * Hash codes. + */ +typedef uint32_t hash_t; + +template <typename TKey> +hash_t hash_type(const TKey& key); + +/* Built-in hash code specializations. + * Assumes pointers are 32bit. */ +#define ANDROID_INT32_HASH(T) \ + template <> inline hash_t hash_type(const T& value) { return hash_t(value); } +#define ANDROID_INT64_HASH(T) \ + template <> inline hash_t hash_type(const T& value) { \ + return hash_t((value >> 32) ^ value); } +#define ANDROID_REINTERPRET_HASH(T, R) \ + template <> inline hash_t hash_type(const T& value) { \ + return hash_type(*reinterpret_cast<const R*>(&value)); } + +ANDROID_INT32_HASH(bool) +ANDROID_INT32_HASH(int8_t) +ANDROID_INT32_HASH(uint8_t) +ANDROID_INT32_HASH(int16_t) +ANDROID_INT32_HASH(uint16_t) +ANDROID_INT32_HASH(int32_t) +ANDROID_INT32_HASH(uint32_t) +ANDROID_INT64_HASH(int64_t) +ANDROID_INT64_HASH(uint64_t) +ANDROID_REINTERPRET_HASH(float, uint32_t) +ANDROID_REINTERPRET_HASH(double, uint64_t) + +template <typename T> inline hash_t hash_type(const T*& value) { + return hash_type(uintptr_t(value)); +} + }; // namespace android // --------------------------------------------------------------------------- diff --git a/libs/binder/Binder.cpp b/libs/binder/Binder.cpp index 9945f9188f..e20d8a3c91 100644 --- a/libs/binder/Binder.cpp +++ b/libs/binder/Binder.cpp @@ -89,7 +89,7 @@ const String16& BBinder::getInterfaceDescriptor() const // This is a local static rather than a global static, // to avoid static initializer ordering issues. static String16 sEmptyDescriptor; - LOGW("reached BBinder::getInterfaceDescriptor (this=%p)", this); + ALOGW("reached BBinder::getInterfaceDescriptor (this=%p)", this); return sEmptyDescriptor; } diff --git a/libs/binder/BpBinder.cpp b/libs/binder/BpBinder.cpp index 5de87ec769..47a62db41d 100644 --- a/libs/binder/BpBinder.cpp +++ b/libs/binder/BpBinder.cpp @@ -24,8 +24,8 @@ #include <stdio.h> -//#undef LOGV -//#define LOGV(...) fprintf(stderr, __VA_ARGS__) +//#undef ALOGV +//#define ALOGV(...) fprintf(stderr, __VA_ARGS__) namespace android { @@ -50,7 +50,7 @@ void BpBinder::ObjectManager::attach( e.func = func; if (mObjects.indexOfKey(objectID) >= 0) { - LOGE("Trying to attach object ID %p to binder ObjectManager %p with object %p, but object ID already in use", + ALOGE("Trying to attach object ID %p to binder ObjectManager %p with object %p, but object ID already in use", objectID, this, object); return; } @@ -73,7 +73,7 @@ void BpBinder::ObjectManager::detach(const void* objectID) void BpBinder::ObjectManager::kill() { const size_t N = mObjects.size(); - LOGV("Killing %d objects in manager %p", N, this); + ALOGV("Killing %d objects in manager %p", N, this); for (size_t i=0; i<N; i++) { const entry_t& e = mObjects.valueAt(i); if (e.func != NULL) { @@ -92,7 +92,7 @@ BpBinder::BpBinder(int32_t handle) , mObitsSent(0) , mObituaries(NULL) { - LOGV("Creating BpBinder %p handle %d\n", this, mHandle); + ALOGV("Creating BpBinder %p handle %d\n", this, mHandle); extendObjectLifetime(OBJECT_LIFETIME_WEAK); IPCThreadState::self()->incWeakHandle(handle); @@ -190,7 +190,7 @@ status_t BpBinder::linkToDeath( if (!mObituaries) { return NO_MEMORY; } - LOGV("Requesting death notification: %p handle %d\n", this, mHandle); + ALOGV("Requesting death notification: %p handle %d\n", this, mHandle); getWeakRefs()->incWeak(this); IPCThreadState* self = IPCThreadState::self(); self->requestDeathNotification(mHandle, this); @@ -226,7 +226,7 @@ status_t BpBinder::unlinkToDeath( } mObituaries->removeAt(i); if (mObituaries->size() == 0) { - LOGV("Clearing death notification: %p handle %d\n", this, mHandle); + ALOGV("Clearing death notification: %p handle %d\n", this, mHandle); IPCThreadState* self = IPCThreadState::self(); self->clearDeathNotification(mHandle, this); self->flushCommands(); @@ -242,7 +242,7 @@ status_t BpBinder::unlinkToDeath( void BpBinder::sendObituary() { - LOGV("Sending obituary for proxy %p handle %d, mObitsSent=%s\n", + ALOGV("Sending obituary for proxy %p handle %d, mObitsSent=%s\n", this, mHandle, mObitsSent ? "true" : "false"); mAlive = 0; @@ -251,7 +251,7 @@ void BpBinder::sendObituary() mLock.lock(); Vector<Obituary>* obits = mObituaries; if(obits != NULL) { - LOGV("Clearing sent death notification: %p handle %d\n", this, mHandle); + ALOGV("Clearing sent death notification: %p handle %d\n", this, mHandle); IPCThreadState* self = IPCThreadState::self(); self->clearDeathNotification(mHandle, this); self->flushCommands(); @@ -260,7 +260,7 @@ void BpBinder::sendObituary() mObitsSent = 1; mLock.unlock(); - LOGV("Reporting death of proxy %p for %d recipients\n", + ALOGV("Reporting death of proxy %p for %d recipients\n", this, obits ? obits->size() : 0); if (obits != NULL) { @@ -276,7 +276,7 @@ void BpBinder::sendObituary() void BpBinder::reportOneDeath(const Obituary& obit) { sp<DeathRecipient> recipient = obit.recipient.promote(); - LOGV("Reporting death to recipient: %p\n", recipient.get()); + ALOGV("Reporting death to recipient: %p\n", recipient.get()); if (recipient == NULL) return; recipient->binderDied(this); @@ -288,7 +288,7 @@ void BpBinder::attachObject( object_cleanup_func func) { AutoMutex _l(mLock); - LOGV("Attaching object %p to binder %p (manager=%p)", object, this, &mObjects); + ALOGV("Attaching object %p to binder %p (manager=%p)", object, this, &mObjects); mObjects.attach(objectID, object, cleanupCookie, func); } @@ -311,7 +311,7 @@ BpBinder* BpBinder::remoteBinder() BpBinder::~BpBinder() { - LOGV("Destroying BpBinder %p handle %d\n", this, mHandle); + ALOGV("Destroying BpBinder %p handle %d\n", this, mHandle); IPCThreadState* ipc = IPCThreadState::self(); @@ -338,15 +338,15 @@ BpBinder::~BpBinder() void BpBinder::onFirstRef() { - LOGV("onFirstRef BpBinder %p handle %d\n", this, mHandle); + ALOGV("onFirstRef BpBinder %p handle %d\n", this, mHandle); IPCThreadState* ipc = IPCThreadState::self(); if (ipc) ipc->incStrongHandle(mHandle); } void BpBinder::onLastStrongRef(const void* id) { - LOGV("onLastStrongRef BpBinder %p handle %d\n", this, mHandle); - IF_LOGV() { + ALOGV("onLastStrongRef BpBinder %p handle %d\n", this, mHandle); + IF_ALOGV() { printRefs(); } IPCThreadState* ipc = IPCThreadState::self(); @@ -355,7 +355,7 @@ void BpBinder::onLastStrongRef(const void* id) bool BpBinder::onIncStrongAttempted(uint32_t flags, const void* id) { - LOGV("onIncStrongAttempted BpBinder %p handle %d\n", this, mHandle); + ALOGV("onIncStrongAttempted BpBinder %p handle %d\n", this, mHandle); IPCThreadState* ipc = IPCThreadState::self(); return ipc ? ipc->attemptIncStrongHandle(mHandle) == NO_ERROR : false; } diff --git a/libs/binder/CursorWindow.cpp b/libs/binder/CursorWindow.cpp index 07333787cb..a6e5f711da 100644 --- a/libs/binder/CursorWindow.cpp +++ b/libs/binder/CursorWindow.cpp @@ -150,7 +150,7 @@ status_t CursorWindow::setNumColumns(uint32_t numColumns) { uint32_t cur = mHeader->numColumns; if ((cur > 0 || mHeader->numRows > 0) && cur != numColumns) { - LOGE("Trying to go from %d columns to %d", cur, numColumns); + ALOGE("Trying to go from %d columns to %d", cur, numColumns); return INVALID_OPERATION; } mHeader->numColumns = numColumns; @@ -209,7 +209,7 @@ uint32_t CursorWindow::alloc(size_t size, bool aligned) { uint32_t offset = mHeader->freeOffset + padding; uint32_t nextFreeOffset = offset + size; if (nextFreeOffset > mSize) { - LOGW("Window is full: requested allocation %d bytes, " + ALOGW("Window is full: requested allocation %d bytes, " "free space %d bytes, window size %d bytes", size, freeSpace(), mSize); return 0; @@ -255,14 +255,14 @@ CursorWindow::RowSlot* CursorWindow::allocRowSlot() { CursorWindow::FieldSlot* CursorWindow::getFieldSlot(uint32_t row, uint32_t column) { if (row >= mHeader->numRows || column >= mHeader->numColumns) { - LOGE("Failed to read row %d, column %d from a CursorWindow which " + ALOGE("Failed to read row %d, column %d from a CursorWindow which " "has %d rows, %d columns.", row, column, mHeader->numRows, mHeader->numColumns); return NULL; } RowSlot* rowSlot = getRowSlot(row); if (!rowSlot) { - LOGE("Failed to find rowSlot for row %d.", row); + ALOGE("Failed to find rowSlot for row %d.", row); return NULL; } FieldSlot* fieldDir = static_cast<FieldSlot*>(offsetToPtr(rowSlot->offset)); diff --git a/libs/binder/IMemory.cpp b/libs/binder/IMemory.cpp index 1ace8f8291..cd2451a676 100644 --- a/libs/binder/IMemory.cpp +++ b/libs/binder/IMemory.cpp @@ -244,7 +244,7 @@ BpMemoryHeap::~BpMemoryHeap() { sp<IBinder> binder = const_cast<BpMemoryHeap*>(this)->asBinder(); if (VERBOSE) { - LOGD("UNMAPPING binder=%p, heap=%p, size=%d, fd=%d", + ALOGD("UNMAPPING binder=%p, heap=%p, size=%d, fd=%d", binder.get(), this, mSize, mHeapId); CallStack stack; stack.update(); @@ -298,11 +298,11 @@ void BpMemoryHeap::assertReallyMapped() const uint32_t flags = reply.readInt32(); uint32_t offset = reply.readInt32(); - LOGE_IF(err, "binder=%p transaction failed fd=%d, size=%ld, err=%d (%s)", + ALOGE_IF(err, "binder=%p transaction failed fd=%d, size=%ld, err=%d (%s)", asBinder().get(), parcel_fd, size, err, strerror(-err)); int fd = dup( parcel_fd ); - LOGE_IF(fd==-1, "cannot dup fd=%d, size=%ld, err=%d (%s)", + ALOGE_IF(fd==-1, "cannot dup fd=%d, size=%ld, err=%d (%s)", parcel_fd, size, err, strerror(errno)); int access = PROT_READ; @@ -315,7 +315,7 @@ void BpMemoryHeap::assertReallyMapped() const mRealHeap = true; mBase = mmap(0, size, access, MAP_SHARED, fd, offset); if (mBase == MAP_FAILED) { - LOGE("cannot map BpMemoryHeap (binder=%p), size=%ld, fd=%d (%s)", + ALOGE("cannot map BpMemoryHeap (binder=%p), size=%ld, fd=%d (%s)", asBinder().get(), size, fd, strerror(errno)); close(fd); } else { @@ -393,7 +393,7 @@ HeapCache::~HeapCache() void HeapCache::binderDied(const wp<IBinder>& binder) { - //LOGD("binderDied binder=%p", binder.unsafe_get()); + //ALOGD("binderDied binder=%p", binder.unsafe_get()); free_heap(binder); } @@ -403,7 +403,7 @@ sp<IMemoryHeap> HeapCache::find_heap(const sp<IBinder>& binder) ssize_t i = mHeapCache.indexOfKey(binder); if (i>=0) { heap_info_t& info = mHeapCache.editValueAt(i); - LOGD_IF(VERBOSE, + ALOGD_IF(VERBOSE, "found binder=%p, heap=%p, size=%d, fd=%d, count=%d", binder.get(), info.heap.get(), static_cast<BpMemoryHeap*>(info.heap.get())->mSize, @@ -415,7 +415,7 @@ sp<IMemoryHeap> HeapCache::find_heap(const sp<IBinder>& binder) heap_info_t info; info.heap = interface_cast<IMemoryHeap>(binder); info.count = 1; - //LOGD("adding binder=%p, heap=%p, count=%d", + //ALOGD("adding binder=%p, heap=%p, count=%d", // binder.get(), info.heap.get(), info.count); mHeapCache.add(binder, info); return info.heap; @@ -436,7 +436,7 @@ void HeapCache::free_heap(const wp<IBinder>& binder) heap_info_t& info(mHeapCache.editValueAt(i)); int32_t c = android_atomic_dec(&info.count); if (c == 1) { - LOGD_IF(VERBOSE, + ALOGD_IF(VERBOSE, "removing binder=%p, heap=%p, size=%d, fd=%d, count=%d", binder.unsafe_get(), info.heap.get(), static_cast<BpMemoryHeap*>(info.heap.get())->mSize, @@ -446,7 +446,7 @@ void HeapCache::free_heap(const wp<IBinder>& binder) mHeapCache.removeItemsAt(i); } } else { - LOGE("free_heap binder=%p not found!!!", binder.unsafe_get()); + ALOGE("free_heap binder=%p not found!!!", binder.unsafe_get()); } } } @@ -468,7 +468,7 @@ void HeapCache::dump_heaps() for (int i=0 ; i<c ; i++) { const heap_info_t& info = mHeapCache.valueAt(i); BpMemoryHeap const* h(static_cast<BpMemoryHeap const *>(info.heap.get())); - LOGD("hey=%p, heap=%p, count=%d, (fd=%d, base=%p, size=%d)", + ALOGD("hey=%p, heap=%p, count=%d, (fd=%d, base=%p, size=%d)", mHeapCache.keyAt(i).unsafe_get(), info.heap.get(), info.count, h->mHeapId, h->mBase, h->mSize); diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp index 5d34787d6c..a42c33694a 100644 --- a/libs/binder/IPCThreadState.cpp +++ b/libs/binder/IPCThreadState.cpp @@ -56,12 +56,12 @@ #else -#define IF_LOG_TRANSACTIONS() IF_LOG(LOG_VERBOSE, "transact") -#define IF_LOG_COMMANDS() IF_LOG(LOG_VERBOSE, "ipc") -#define LOG_REMOTEREFS(...) LOG(LOG_DEBUG, "remoterefs", __VA_ARGS__) -#define IF_LOG_REMOTEREFS() IF_LOG(LOG_DEBUG, "remoterefs") -#define LOG_THREADPOOL(...) LOG(LOG_DEBUG, "threadpool", __VA_ARGS__) -#define LOG_ONEWAY(...) LOG(LOG_DEBUG, "ipc", __VA_ARGS__) +#define IF_LOG_TRANSACTIONS() IF_ALOG(LOG_VERBOSE, "transact") +#define IF_LOG_COMMANDS() IF_ALOG(LOG_VERBOSE, "ipc") +#define LOG_REMOTEREFS(...) ALOG(LOG_DEBUG, "remoterefs", __VA_ARGS__) +#define IF_LOG_REMOTEREFS() IF_ALOG(LOG_DEBUG, "remoterefs") +#define LOG_THREADPOOL(...) ALOG(LOG_DEBUG, "threadpool", __VA_ARGS__) +#define LOG_ONEWAY(...) ALOG(LOG_DEBUG, "ipc", __VA_ARGS__) #endif @@ -493,7 +493,7 @@ void IPCThreadState::joinThreadPool(bool isMain) void IPCThreadState::stopProcess(bool immediate) { - //LOGI("**** STOPPING PROCESS"); + //ALOGI("**** STOPPING PROCESS"); flushCommands(); int fd = mProcess->mDriverFD; mProcess->mDriverFD = -1; @@ -530,9 +530,9 @@ status_t IPCThreadState::transact(int32_t handle, if ((flags & TF_ONE_WAY) == 0) { #if 0 if (code == 4) { // relayout - LOGI(">>>>>> CALLING transaction 4"); + ALOGI(">>>>>> CALLING transaction 4"); } else { - LOGI(">>>>>> CALLING transaction %d", code); + ALOGI(">>>>>> CALLING transaction %d", code); } #endif if (reply) { @@ -543,9 +543,9 @@ status_t IPCThreadState::transact(int32_t handle, } #if 0 if (code == 4) { // relayout - LOGI("<<<<<< RETURNING transaction 4"); + ALOGI("<<<<<< RETURNING transaction 4"); } else { - LOGI("<<<<<< RETURNING transaction %d", code); + ALOGI("<<<<<< RETURNING transaction %d", code); } #endif @@ -1009,7 +1009,7 @@ status_t IPCThreadState::executeCommand(int32_t cmd) } } - //LOGI(">>>> TRANSACT from pid %d uid %d\n", mCallingPid, mCallingUid); + //ALOGI(">>>> TRANSACT from pid %d uid %d\n", mCallingPid, mCallingUid); Parcel reply; IF_LOG_TRANSACTIONS() { @@ -1033,7 +1033,7 @@ status_t IPCThreadState::executeCommand(int32_t cmd) if (error < NO_ERROR) reply.setError(error); } - //LOGI("<<<< TRANSACT from pid %d restore pid %d uid %d\n", + //ALOGI("<<<< TRANSACT from pid %d restore pid %d uid %d\n", // mCallingPid, origPid, origUid); if ((tr.flags & TF_ONE_WAY) == 0) { @@ -1110,7 +1110,7 @@ void IPCThreadState::freeBuffer(Parcel* parcel, const uint8_t* data, size_t data const size_t* objects, size_t objectsSize, void* cookie) { - //LOGI("Freeing parcel %p", &parcel); + //ALOGI("Freeing parcel %p", &parcel); IF_LOG_COMMANDS() { alog << "Writing BC_FREE_BUFFER for " << data << endl; } diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp index 1fa4c3579c..33b305dccb 100644 --- a/libs/binder/IServiceManager.cpp +++ b/libs/binder/IServiceManager.cpp @@ -78,7 +78,7 @@ bool checkPermission(const String16& permission, pid_t pid, uid_t uid) bool res = pc->checkPermission(permission, pid, uid); if (res) { if (startTime != 0) { - LOGI("Check passed after %d seconds for %s from uid=%d pid=%d", + ALOGI("Check passed after %d seconds for %s from uid=%d pid=%d", (int)((uptimeMillis()-startTime)/1000), String8(permission).string(), uid, pid); } @@ -87,7 +87,7 @@ bool checkPermission(const String16& permission, pid_t pid, uid_t uid) // Is this a permission failure, or did the controller go away? if (pc->asBinder()->isBinderAlive()) { - LOGW("Permission failure: %s from uid=%d pid=%d", + ALOGW("Permission failure: %s from uid=%d pid=%d", String8(permission).string(), uid, pid); return false; } @@ -106,7 +106,7 @@ bool checkPermission(const String16& permission, pid_t pid, uid_t uid) // Wait for the permission controller to come back... if (startTime == 0) { startTime = uptimeMillis(); - LOGI("Waiting to check permission %s from uid=%d pid=%d", + ALOGI("Waiting to check permission %s from uid=%d pid=%d", String8(permission).string(), uid, pid); } sleep(1); @@ -136,7 +136,7 @@ public: for (n = 0; n < 5; n++){ sp<IBinder> svc = checkService(name); if (svc != NULL) return svc; - LOGI("Waiting for service %s...\n", String8(name).string()); + ALOGI("Waiting for service %s...\n", String8(name).string()); sleep(1); } return NULL; diff --git a/libs/binder/MemoryDealer.cpp b/libs/binder/MemoryDealer.cpp index 18669f76dd..8d0e0a7413 100644 --- a/libs/binder/MemoryDealer.cpp +++ b/libs/binder/MemoryDealer.cpp @@ -180,7 +180,6 @@ Allocation::~Allocation() /* NOTE: it's VERY important to not free allocations of size 0 because * they're special as they don't have any record in the allocator * and could alias some real allocation (their offset is zero). */ - mDealer->deallocate(freedOffset); // keep the size to unmap in excess size_t pagesize = getpagesize(); @@ -211,11 +210,16 @@ Allocation::~Allocation() #ifdef MADV_REMOVE if (size) { int err = madvise(start_ptr, size, MADV_REMOVE); - LOGW_IF(err, "madvise(%p, %u, MADV_REMOVE) returned %s", + ALOGW_IF(err, "madvise(%p, %u, MADV_REMOVE) returned %s", start_ptr, size, err<0 ? strerror(errno) : "Ok"); } #endif } + + // This should be done after madvise(MADV_REMOVE), otherwise madvise() + // might kick out the memory region that's allocated and/or written + // right after the deallocation. + mDealer->deallocate(freedOffset); } } @@ -344,7 +348,7 @@ ssize_t SimpleBestFitAllocator::alloc(size_t size, uint32_t flags) mList.insertBefore(free_chunk, split); } - LOGE_IF((flags&PAGE_ALIGNED) && + ALOGE_IF((flags&PAGE_ALIGNED) && ((free_chunk->start*kMemoryAlign)&(pagesize-1)), "PAGE_ALIGNED requested, but page is not aligned!!!"); @@ -411,7 +415,7 @@ void SimpleBestFitAllocator::dump_l(const char* what) const { String8 result; dump_l(result, what); - LOGD("%s", result.string()); + ALOGD("%s", result.string()); } void SimpleBestFitAllocator::dump(String8& result, diff --git a/libs/binder/MemoryHeapBase.cpp b/libs/binder/MemoryHeapBase.cpp index bf4a73f389..d1cbf1cbae 100644 --- a/libs/binder/MemoryHeapBase.cpp +++ b/libs/binder/MemoryHeapBase.cpp @@ -53,7 +53,7 @@ MemoryHeapBase::MemoryHeapBase(size_t size, uint32_t flags, char const * name) const size_t pagesize = getpagesize(); size = ((size + pagesize-1) & ~(pagesize-1)); int fd = ashmem_create_region(name == NULL ? "MemoryHeapBase" : name, size); - LOGE_IF(fd<0, "error creating ashmem region: %s", strerror(errno)); + ALOGE_IF(fd<0, "error creating ashmem region: %s", strerror(errno)); if (fd >= 0) { if (mapfd(fd, size) == NO_ERROR) { if (flags & READ_ONLY) { @@ -72,7 +72,7 @@ MemoryHeapBase::MemoryHeapBase(const char* device, size_t size, uint32_t flags) open_flags |= O_SYNC; int fd = open(device, open_flags); - LOGE_IF(fd<0, "error opening %s: %s", device, strerror(errno)); + ALOGE_IF(fd<0, "error opening %s: %s", device, strerror(errno)); if (fd >= 0) { const size_t pagesize = getpagesize(); size = ((size + pagesize-1) & ~(pagesize-1)); @@ -127,12 +127,12 @@ status_t MemoryHeapBase::mapfd(int fd, size_t size, uint32_t offset) void* base = (uint8_t*)mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, offset); if (base == MAP_FAILED) { - LOGE("mmap(fd=%d, size=%u) failed (%s)", + ALOGE("mmap(fd=%d, size=%u) failed (%s)", fd, uint32_t(size), strerror(errno)); close(fd); return -errno; } - //LOGD("mmap(fd=%d, base=%p, size=%lu)", fd, base, size); + //ALOGD("mmap(fd=%d, base=%p, size=%lu)", fd, base, size); mBase = base; mNeedUnmap = true; } else { @@ -155,7 +155,7 @@ void MemoryHeapBase::dispose() int fd = android_atomic_or(-1, &mFD); if (fd >= 0) { if (mNeedUnmap) { - //LOGD("munmap(fd=%d, base=%p, size=%lu)", fd, mBase, mSize); + //ALOGD("munmap(fd=%d, base=%p, size=%lu)", fd, mBase, mSize); munmap(mBase, mSize); } mBase = 0; diff --git a/libs/binder/MemoryHeapPmem.cpp b/libs/binder/MemoryHeapPmem.cpp index 03322ea5d9..66bcf4d2c7 100644 --- a/libs/binder/MemoryHeapPmem.cpp +++ b/libs/binder/MemoryHeapPmem.cpp @@ -79,7 +79,7 @@ SubRegionMemory::SubRegionMemory(const sp<MemoryHeapPmem>& heap, int our_fd = heap->heapID(); struct pmem_region sub = { offset, size }; int err = ioctl(our_fd, PMEM_MAP, &sub); - LOGE_IF(err<0, "PMEM_MAP failed (%s), " + ALOGE_IF(err<0, "PMEM_MAP failed (%s), " "mFD=%d, sub.offset=%lu, sub.size=%lu", strerror(errno), our_fd, sub.offset, sub.len); } @@ -115,7 +115,7 @@ void SubRegionMemory::revoke() sub.offset = mOffset; sub.len = mSize; int err = ioctl(our_fd, PMEM_UNMAP, &sub); - LOGE_IF(err<0, "PMEM_UNMAP failed (%s), " + ALOGE_IF(err<0, "PMEM_UNMAP failed (%s), " "mFD=%d, sub.offset=%lu, sub.size=%lu", strerror(errno), our_fd, sub.offset, sub.len); mSize = 0; @@ -133,11 +133,11 @@ MemoryHeapPmem::MemoryHeapPmem(const sp<MemoryHeapBase>& pmemHeap, #ifdef HAVE_ANDROID_OS if (device) { int fd = open(device, O_RDWR | (flags & NO_CACHING ? O_SYNC : 0)); - LOGE_IF(fd<0, "couldn't open %s (%s)", device, strerror(errno)); + ALOGE_IF(fd<0, "couldn't open %s (%s)", device, strerror(errno)); if (fd >= 0) { int err = ioctl(fd, PMEM_CONNECT, pmemHeap->heapID()); if (err < 0) { - LOGE("PMEM_CONNECT failed (%s), mFD=%d, sub-fd=%d", + ALOGE("PMEM_CONNECT failed (%s), mFD=%d, sub-fd=%d", strerror(errno), fd, pmemHeap->heapID()); close(fd); } else { @@ -194,7 +194,7 @@ status_t MemoryHeapPmem::slap() int our_fd = getHeapID(); struct pmem_region sub = { 0, size }; int err = ioctl(our_fd, PMEM_MAP, &sub); - LOGE_IF(err<0, "PMEM_MAP failed (%s), " + ALOGE_IF(err<0, "PMEM_MAP failed (%s), " "mFD=%d, sub.offset=%lu, sub.size=%lu", strerror(errno), our_fd, sub.offset, sub.len); return -errno; @@ -212,7 +212,7 @@ status_t MemoryHeapPmem::unslap() int our_fd = getHeapID(); struct pmem_region sub = { 0, size }; int err = ioctl(our_fd, PMEM_UNMAP, &sub); - LOGE_IF(err<0, "PMEM_UNMAP failed (%s), " + ALOGE_IF(err<0, "PMEM_UNMAP failed (%s), " "mFD=%d, sub.offset=%lu, sub.size=%lu", strerror(errno), our_fd, sub.offset, sub.len); return -errno; diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp index 6b4c1a61e4..dea14bb970 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -44,7 +44,7 @@ #endif #define LOG_REFS(...) -//#define LOG_REFS(...) LOG(LOG_DEBUG, "Parcel", __VA_ARGS__) +//#define LOG_REFS(...) ALOG(LOG_DEBUG, "Parcel", __VA_ARGS__) // --------------------------------------------------------------------------- @@ -103,7 +103,7 @@ void acquire_object(const sp<ProcessState>& proc, } } - LOGD("Invalid object type 0x%08lx", obj.type); + ALOGD("Invalid object type 0x%08lx", obj.type); } void release_object(const sp<ProcessState>& proc, @@ -139,7 +139,7 @@ void release_object(const sp<ProcessState>& proc, } } - LOGE("Invalid object type 0x%08lx", obj.type); + ALOGE("Invalid object type 0x%08lx", obj.type); } inline static status_t finish_flatten_binder( @@ -159,7 +159,7 @@ status_t flatten_binder(const sp<ProcessState>& proc, if (!local) { BpBinder *proxy = binder->remoteBinder(); if (proxy == NULL) { - LOGE("null proxy"); + ALOGE("null proxy"); } const int32_t handle = proxy ? proxy->handle() : 0; obj.type = BINDER_TYPE_HANDLE; @@ -192,7 +192,7 @@ status_t flatten_binder(const sp<ProcessState>& proc, if (!local) { BpBinder *proxy = real->remoteBinder(); if (proxy == NULL) { - LOGE("null proxy"); + ALOGE("null proxy"); } const int32_t handle = proxy ? proxy->handle() : 0; obj.type = BINDER_TYPE_WEAK_HANDLE; @@ -213,7 +213,7 @@ status_t flatten_binder(const sp<ProcessState>& proc, // The OpenBinder implementation uses a dynamic_cast<> here, // but we can't do that with the different reference counting // implementation we are using. - LOGE("Unable to unflatten Binder weak reference!"); + ALOGE("Unable to unflatten Binder weak reference!"); obj.type = BINDER_TYPE_BINDER; obj.binder = NULL; obj.cookie = NULL; @@ -330,7 +330,7 @@ status_t Parcel::setDataSize(size_t size) err = continueWrite(size); if (err == NO_ERROR) { mDataSize = size; - LOGV("setDataSize Setting data size of %p to %d\n", this, mDataSize); + ALOGV("setDataSize Setting data size of %p to %d\n", this, mDataSize); } return err; } @@ -504,7 +504,7 @@ bool Parcel::enforceInterface(const String16& interface, if (str == interface) { return true; } else { - LOGW("**** enforceInterface() expected '%s' but read '%s'\n", + ALOGW("**** enforceInterface() expected '%s' but read '%s'\n", String8(interface).string(), String8(str).string()); return false; } @@ -534,10 +534,10 @@ status_t Parcel::finishWrite(size_t len) { //printf("Finish write of %d\n", len); mDataPos += len; - LOGV("finishWrite Setting data pos of %p to %d\n", this, mDataPos); + ALOGV("finishWrite Setting data pos of %p to %d\n", this, mDataPos); if (mDataPos > mDataSize) { mDataSize = mDataPos; - LOGV("finishWrite Setting data size of %p to %d\n", this, mDataSize); + ALOGV("finishWrite Setting data size of %p to %d\n", this, mDataSize); } //printf("New pos=%d, size=%d\n", mDataPos, mDataSize); return NO_ERROR; @@ -703,7 +703,7 @@ status_t Parcel::writeNativeHandle(const native_handle* handle) err = writeDupFileDescriptor(handle->data[i]); if (err != NO_ERROR) { - LOGD("write native handle, write dup fd failed"); + ALOGD("write native handle, write dup fd failed"); return err; } err = write(handle->data + handle->numFds, sizeof(int)*handle->numInts); @@ -722,7 +722,15 @@ status_t Parcel::writeFileDescriptor(int fd, bool takeOwnership) status_t Parcel::writeDupFileDescriptor(int fd) { - return writeFileDescriptor(dup(fd), true /*takeOwnership*/); + int dupFd = dup(fd); + if (dupFd < 0) { + return -errno; + } + status_t err = writeFileDescriptor(dupFd, true /*takeOwnership*/); + if (err) { + close(dupFd); + } + return err; } status_t Parcel::writeBlob(size_t len, WritableBlob* outBlob) @@ -730,7 +738,7 @@ status_t Parcel::writeBlob(size_t len, WritableBlob* outBlob) status_t status; if (!mAllowFds || len <= IN_PLACE_BLOB_LIMIT) { - LOGV("writeBlob: write in place"); + ALOGV("writeBlob: write in place"); status = writeInt32(0); if (status) return status; @@ -741,7 +749,7 @@ status_t Parcel::writeBlob(size_t len, WritableBlob* outBlob) return NO_ERROR; } - LOGV("writeBlob: write to ashmem"); + ALOGV("writeBlob: write to ashmem"); int fd = ashmem_create_region("Parcel Blob", len); if (fd < 0) return NO_MEMORY; @@ -865,7 +873,7 @@ status_t Parcel::read(void* outData, size_t len) const if ((mDataPos+PAD_SIZE(len)) >= mDataPos && (mDataPos+PAD_SIZE(len)) <= mDataSize) { memcpy(outData, mData+mDataPos, len); mDataPos += PAD_SIZE(len); - LOGV("read Setting data pos of %p to %d\n", this, mDataPos); + ALOGV("read Setting data pos of %p to %d\n", this, mDataPos); return NO_ERROR; } return NOT_ENOUGH_DATA; @@ -876,7 +884,7 @@ const void* Parcel::readInplace(size_t len) const if ((mDataPos+PAD_SIZE(len)) >= mDataPos && (mDataPos+PAD_SIZE(len)) <= mDataSize) { const void* data = mData+mDataPos; mDataPos += PAD_SIZE(len); - LOGV("readInplace Setting data pos of %p to %d\n", this, mDataPos); + ALOGV("readInplace Setting data pos of %p to %d\n", this, mDataPos); return data; } return NULL; @@ -987,7 +995,7 @@ const char* Parcel::readCString() const if (eos) { const size_t len = eos - str; mDataPos += PAD_SIZE(len+1); - LOGV("readCString Setting data pos of %p to %d\n", this, mDataPos); + ALOGV("readCString Setting data pos of %p to %d\n", this, mDataPos); return str; } } @@ -1010,7 +1018,7 @@ String16 Parcel::readString16() const size_t len; const char16_t* str = readString16Inplace(&len); if (str) return String16(str, len); - LOGE("Reading a NULL string not supported here."); + ALOGE("Reading a NULL string not supported here."); return String16(); } @@ -1088,7 +1096,7 @@ int Parcel::readFileDescriptor() const if (flat) { switch (flat->type) { case BINDER_TYPE_FD: - //LOGI("Returning file descriptor %ld from parcel %p\n", flat->handle, this); + //ALOGI("Returning file descriptor %ld from parcel %p\n", flat->handle, this); return flat->handle; } } @@ -1102,7 +1110,7 @@ status_t Parcel::readBlob(size_t len, ReadableBlob* outBlob) const if (status) return status; if (!useAshmem) { - LOGV("readBlob: read in place"); + ALOGV("readBlob: read in place"); const void* ptr = readInplace(len); if (!ptr) return BAD_VALUE; @@ -1110,7 +1118,7 @@ status_t Parcel::readBlob(size_t len, ReadableBlob* outBlob) const return NO_ERROR; } - LOGV("readBlob: read from ashmem"); + ALOGV("readBlob: read from ashmem"); int fd = readFileDescriptor(); if (fd == int(BAD_TYPE)) return BAD_VALUE; @@ -1164,7 +1172,7 @@ const flat_binder_object* Parcel::readObject(bool nullMetaData) const // When transferring a NULL object, we don't write it into // the object list, so we don't want to check for it when // reading. - LOGV("readObject Setting data pos of %p to %d\n", this, mDataPos); + ALOGV("readObject Setting data pos of %p to %d\n", this, mDataPos); return obj; } @@ -1174,7 +1182,7 @@ const flat_binder_object* Parcel::readObject(bool nullMetaData) const size_t opos = mNextObjectHint; if (N > 0) { - LOGV("Parcel %p looking for obj at %d, hint=%d\n", + ALOGV("Parcel %p looking for obj at %d, hint=%d\n", this, DPOS, opos); // Start at the current hint position, looking for an object at @@ -1188,10 +1196,10 @@ const flat_binder_object* Parcel::readObject(bool nullMetaData) const } if (OBJS[opos] == DPOS) { // Found it! - LOGV("Parcel found obj %d at index %d with forward search", + ALOGV("Parcel found obj %d at index %d with forward search", this, DPOS, opos); mNextObjectHint = opos+1; - LOGV("readObject Setting data pos of %p to %d\n", this, mDataPos); + ALOGV("readObject Setting data pos of %p to %d\n", this, mDataPos); return obj; } @@ -1201,14 +1209,14 @@ const flat_binder_object* Parcel::readObject(bool nullMetaData) const } if (OBJS[opos] == DPOS) { // Found it! - LOGV("Parcel found obj %d at index %d with backward search", + ALOGV("Parcel found obj %d at index %d with backward search", this, DPOS, opos); mNextObjectHint = opos+1; - LOGV("readObject Setting data pos of %p to %d\n", this, mDataPos); + ALOGV("readObject Setting data pos of %p to %d\n", this, mDataPos); return obj; } } - LOGW("Attempt to read object from Parcel %p at offset %d that is not in the object list", + ALOGW("Attempt to read object from Parcel %p at offset %d that is not in the object list", this, DPOS); } return NULL; @@ -1218,14 +1226,14 @@ void Parcel::closeFileDescriptors() { size_t i = mObjectsSize; if (i > 0) { - //LOGI("Closing file descriptors for %d objects...", mObjectsSize); + //ALOGI("Closing file descriptors for %d objects...", mObjectsSize); } while (i > 0) { i--; const flat_binder_object* flat = reinterpret_cast<flat_binder_object*>(mData+mObjects[i]); if (flat->type == BINDER_TYPE_FD) { - //LOGI("Closing fd: %ld\n", flat->handle); + //ALOGI("Closing fd: %ld\n", flat->handle); close(flat->handle); } } @@ -1258,9 +1266,9 @@ void Parcel::ipcSetDataReference(const uint8_t* data, size_t dataSize, mError = NO_ERROR; mData = const_cast<uint8_t*>(data); mDataSize = mDataCapacity = dataSize; - //LOGI("setDataReference Setting data size of %p to %lu (pid=%d)\n", this, mDataSize, getpid()); + //ALOGI("setDataReference Setting data size of %p to %lu (pid=%d)\n", this, mDataSize, getpid()); mDataPos = 0; - LOGV("setDataReference Setting data pos of %p to %d\n", this, mDataPos); + ALOGV("setDataReference Setting data pos of %p to %d\n", this, mDataPos); mObjects = const_cast<size_t*>(objects); mObjectsSize = mObjectsCapacity = objectsCount; mNextObjectHint = 0; @@ -1332,7 +1340,7 @@ void Parcel::freeData() void Parcel::freeDataNoInit() { if (mOwner) { - //LOGI("Freeing data ref of %p (pid=%d)\n", this, getpid()); + //ALOGI("Freeing data ref of %p (pid=%d)\n", this, getpid()); mOwner(this, mData, mDataSize, mObjects, mObjectsSize, mOwnerCookie); } else { releaseObjects(); @@ -1370,8 +1378,8 @@ status_t Parcel::restartWrite(size_t desired) } mDataSize = mDataPos = 0; - LOGV("restartWrite Setting data size of %p to %d\n", this, mDataSize); - LOGV("restartWrite Setting data pos of %p to %d\n", this, mDataPos); + ALOGV("restartWrite Setting data size of %p to %d\n", this, mDataSize); + ALOGV("restartWrite Setting data pos of %p to %d\n", this, mDataPos); free(mObjects); mObjects = NULL; @@ -1438,14 +1446,14 @@ status_t Parcel::continueWrite(size_t desired) if (objects && mObjects) { memcpy(objects, mObjects, objectsSize*sizeof(size_t)); } - //LOGI("Freeing data ref of %p (pid=%d)\n", this, getpid()); + //ALOGI("Freeing data ref of %p (pid=%d)\n", this, getpid()); mOwner(this, mData, mDataSize, mObjects, mObjectsSize, mOwnerCookie); mOwner = NULL; mData = data; mObjects = objects; mDataSize = (mDataSize < desired) ? mDataSize : desired; - LOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize); + ALOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize); mDataCapacity = desired; mObjectsSize = mObjectsCapacity = objectsSize; mNextObjectHint = 0; @@ -1485,11 +1493,11 @@ status_t Parcel::continueWrite(size_t desired) } else { if (mDataSize > desired) { mDataSize = desired; - LOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize); + ALOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize); } if (mDataPos > desired) { mDataPos = desired; - LOGV("continueWrite Setting data pos of %p to %d\n", this, mDataPos); + ALOGV("continueWrite Setting data pos of %p to %d\n", this, mDataPos); } } @@ -1503,13 +1511,13 @@ status_t Parcel::continueWrite(size_t desired) if(!(mDataCapacity == 0 && mObjects == NULL && mObjectsCapacity == 0)) { - LOGE("continueWrite: %d/%p/%d/%d", mDataCapacity, mObjects, mObjectsCapacity, desired); + ALOGE("continueWrite: %d/%p/%d/%d", mDataCapacity, mObjects, mObjectsCapacity, desired); } mData = data; mDataSize = mDataPos = 0; - LOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize); - LOGV("continueWrite Setting data pos of %p to %d\n", this, mDataPos); + ALOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize); + ALOGV("continueWrite Setting data pos of %p to %d\n", this, mDataPos); mDataCapacity = desired; } @@ -1523,8 +1531,8 @@ void Parcel::initState() mDataSize = 0; mDataCapacity = 0; mDataPos = 0; - LOGV("initState Setting data size of %p to %d\n", this, mDataSize); - LOGV("initState Setting data pos of %p to %d\n", this, mDataPos); + ALOGV("initState Setting data size of %p to %d\n", this, mDataSize); + ALOGV("initState Setting data pos of %p to %d\n", this, mDataPos); mObjects = NULL; mObjectsSize = 0; mObjectsCapacity = 0; diff --git a/libs/binder/PermissionCache.cpp b/libs/binder/PermissionCache.cpp index 7278187b08..a503be8cd7 100644 --- a/libs/binder/PermissionCache.cpp +++ b/libs/binder/PermissionCache.cpp @@ -101,7 +101,7 @@ bool PermissionCache::checkPermission( nsecs_t t = -systemTime(); granted = android::checkPermission(permission, pid, uid); t += systemTime(); - LOGD("checking %s for uid=%d => %s (%d us)", + ALOGD("checking %s for uid=%d => %s (%d us)", String8(permission).string(), uid, granted?"granted":"denied", (int)ns2us(t)); pc.cache(permission, uid, granted); diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp index f5288c8c3e..f96fe50e03 100644 --- a/libs/binder/ProcessState.cpp +++ b/libs/binder/ProcessState.cpp @@ -109,7 +109,7 @@ sp<IBinder> ProcessState::getContextObject(const String16& name, const sp<IBinde // Don't attempt to retrieve contexts if we manage them if (mManagesContexts) { - LOGE("getContextObject(%s) failed, but we manage the contexts!\n", + ALOGE("getContextObject(%s) failed, but we manage the contexts!\n", String8(name).string()); return NULL; } @@ -160,7 +160,7 @@ bool ProcessState::becomeContextManager(context_check_func checkFunc, void* user } else if (result == -1) { mBinderContextCheckFunc = NULL; mBinderContextUserData = NULL; - LOGE("Binder ioctl to become context manager failed: %s\n", strerror(errno)); + ALOGE("Binder ioctl to become context manager failed: %s\n", strerror(errno)); } } return mManagesContexts; @@ -288,7 +288,7 @@ void ProcessState::spawnPooledThread(bool isMain) int32_t s = android_atomic_add(1, &mThreadPoolSeq); char buf[32]; sprintf(buf, "Binder Thread #%d", s); - LOGV("Spawning new pooled thread, name=%s\n", buf); + ALOGV("Spawning new pooled thread, name=%s\n", buf); sp<Thread> t = new PoolThread(isMain); t->run(buf); } @@ -302,22 +302,22 @@ static int open_driver() int vers; status_t result = ioctl(fd, BINDER_VERSION, &vers); if (result == -1) { - LOGE("Binder ioctl to obtain version failed: %s", strerror(errno)); + ALOGE("Binder ioctl to obtain version failed: %s", strerror(errno)); close(fd); fd = -1; } if (result != 0 || vers != BINDER_CURRENT_PROTOCOL_VERSION) { - LOGE("Binder driver protocol does not match user space protocol!"); + ALOGE("Binder driver protocol does not match user space protocol!"); close(fd); fd = -1; } size_t maxThreads = 15; result = ioctl(fd, BINDER_SET_MAX_THREADS, &maxThreads); if (result == -1) { - LOGE("Binder ioctl to set max threads failed: %s", strerror(errno)); + ALOGE("Binder ioctl to set max threads failed: %s", strerror(errno)); } } else { - LOGW("Opening '/dev/binder' failed: %s\n", strerror(errno)); + ALOGW("Opening '/dev/binder' failed: %s\n", strerror(errno)); } return fd; } @@ -340,7 +340,7 @@ ProcessState::ProcessState() mVMStart = mmap(0, BINDER_VM_SIZE, PROT_READ, MAP_PRIVATE | MAP_NORESERVE, mDriverFD, 0); if (mVMStart == MAP_FAILED) { // *sigh* - LOGE("Using /dev/binder failed: unable to mmap transaction memory.\n"); + ALOGE("Using /dev/binder failed: unable to mmap transaction memory.\n"); close(mDriverFD); mDriverFD = -1; } diff --git a/libs/gui/Android.mk b/libs/gui/Android.mk index 9767568bed..b8be67d446 100644 --- a/libs/gui/Android.mk +++ b/libs/gui/Android.mk @@ -2,11 +2,13 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES:= \ + BitTube.cpp \ + DisplayEventReceiver.cpp \ + IDisplayEventConnection.cpp \ ISensorEventConnection.cpp \ ISensorServer.cpp \ ISurfaceTexture.cpp \ Sensor.cpp \ - SensorChannel.cpp \ SensorEventQueue.cpp \ SensorManager.cpp \ SurfaceTexture.cpp \ diff --git a/libs/gui/SensorChannel.cpp b/libs/gui/BitTube.cpp index 147e1c2bb4..785da39b95 100644 --- a/libs/gui/SensorChannel.cpp +++ b/libs/gui/BitTube.cpp @@ -24,12 +24,12 @@ #include <binder/Parcel.h> -#include <gui/SensorChannel.h> +#include <gui/BitTube.h> namespace android { // ---------------------------------------------------------------------------- -SensorChannel::SensorChannel() +BitTube::BitTube() : mSendFd(-1), mReceiveFd(-1) { int fds[2]; @@ -38,17 +38,26 @@ SensorChannel::SensorChannel() mSendFd = fds[1]; fcntl(mReceiveFd, F_SETFL, O_NONBLOCK); fcntl(mSendFd, F_SETFL, O_NONBLOCK); + } else { + mReceiveFd = -errno; + ALOGE("BitTube: pipe creation failed (%s)", strerror(-mReceiveFd)); } } -SensorChannel::SensorChannel(const Parcel& data) +BitTube::BitTube(const Parcel& data) : mSendFd(-1), mReceiveFd(-1) { mReceiveFd = dup(data.readFileDescriptor()); - fcntl(mReceiveFd, F_SETFL, O_NONBLOCK); + if (mReceiveFd >= 0) { + fcntl(mReceiveFd, F_SETFL, O_NONBLOCK); + } else { + mReceiveFd = -errno; + ALOGE("BitTube(Parcel): can't dup filedescriptor (%s)", + strerror(-mReceiveFd)); + } } -SensorChannel::~SensorChannel() +BitTube::~BitTube() { if (mSendFd >= 0) close(mSendFd); @@ -57,28 +66,46 @@ SensorChannel::~SensorChannel() close(mReceiveFd); } -int SensorChannel::getFd() const +status_t BitTube::initCheck() const +{ + if (mReceiveFd < 0) { + return status_t(mReceiveFd); + } + return NO_ERROR; +} + +int BitTube::getFd() const { return mReceiveFd; } -ssize_t SensorChannel::write(void const* vaddr, size_t size) +ssize_t BitTube::write(void const* vaddr, size_t size) { - ssize_t len = ::write(mSendFd, vaddr, size); - if (len < 0) - return -errno; - return len; + ssize_t err, len; + do { + len = ::write(mSendFd, vaddr, size); + err = len < 0 ? errno : 0; + } while (err == EINTR); + return err == 0 ? len : -err; + } -ssize_t SensorChannel::read(void* vaddr, size_t size) +ssize_t BitTube::read(void* vaddr, size_t size) { - ssize_t len = ::read(mReceiveFd, vaddr, size); - if (len < 0) - return -errno; - return len; + ssize_t err, len; + do { + len = ::read(mReceiveFd, vaddr, size); + err = len < 0 ? errno : 0; + } while (err == EINTR); + if (err == EAGAIN || err == EWOULDBLOCK) { + // EAGAIN means that we have non-blocking I/O but there was + // no data to be read. Nothing the client should care about. + return 0; + } + return err == 0 ? len : -err; } -status_t SensorChannel::writeToParcel(Parcel* reply) const +status_t BitTube::writeToParcel(Parcel* reply) const { if (mReceiveFd < 0) return -EINVAL; diff --git a/libs/gui/DisplayEventReceiver.cpp b/libs/gui/DisplayEventReceiver.cpp new file mode 100644 index 0000000000..3b3ccaaf74 --- /dev/null +++ b/libs/gui/DisplayEventReceiver.cpp @@ -0,0 +1,103 @@ +/* + * 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. + */ + +#include <string.h> + +#include <utils/Errors.h> + +#include <gui/BitTube.h> +#include <gui/DisplayEventReceiver.h> +#include <gui/IDisplayEventConnection.h> + +#include <private/gui/ComposerService.h> + +#include <surfaceflinger/ISurfaceComposer.h> + +// --------------------------------------------------------------------------- + +namespace android { + +// --------------------------------------------------------------------------- + +DisplayEventReceiver::DisplayEventReceiver() { + sp<ISurfaceComposer> sf(ComposerService::getComposerService()); + if (sf != NULL) { + mEventConnection = sf->createDisplayEventConnection(); + if (mEventConnection != NULL) { + mDataChannel = mEventConnection->getDataChannel(); + } + } +} + +DisplayEventReceiver::~DisplayEventReceiver() { +} + +status_t DisplayEventReceiver::initCheck() const { + if (mDataChannel != NULL) + return NO_ERROR; + return NO_INIT; +} + +int DisplayEventReceiver::getFd() const { + if (mDataChannel == NULL) + return NO_INIT; + + return mDataChannel->getFd(); +} + +status_t DisplayEventReceiver::setVsyncRate(uint32_t count) { + if (int32_t(count) < 0) + return BAD_VALUE; + + if (mEventConnection != NULL) { + mEventConnection->setVsyncRate(count); + return NO_ERROR; + } + return NO_INIT; +} + +status_t DisplayEventReceiver::requestNextVsync() { + if (mEventConnection != NULL) { + mEventConnection->requestNextVsync(); + return NO_ERROR; + } + return NO_INIT; +} + + +ssize_t DisplayEventReceiver::getEvents(DisplayEventReceiver::Event* events, + size_t count) { + ssize_t size = mDataChannel->read(events, sizeof(events[0])*count); + ALOGE_IF(size<0, + "DisplayEventReceiver::getEvents error (%s)", + strerror(-size)); + if (size >= 0) { + // Note: if (size % sizeof(events[0])) != 0, we've got a + // partial read. This can happen if the queue filed up (ie: if we + // didn't pull from it fast enough). + // We discard the partial event and rely on the sender to + // re-send the event if appropriate (some events, like VSYNC + // can be lost forever). + + // returns number of events read + size /= sizeof(events[0]); + } + return size; +} + +// --------------------------------------------------------------------------- + +}; // namespace android diff --git a/libs/gui/IDisplayEventConnection.cpp b/libs/gui/IDisplayEventConnection.cpp new file mode 100644 index 0000000000..887d176b44 --- /dev/null +++ b/libs/gui/IDisplayEventConnection.cpp @@ -0,0 +1,98 @@ +/* + * 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. + */ + +#include <stdint.h> +#include <sys/types.h> + +#include <utils/Errors.h> +#include <utils/RefBase.h> +#include <utils/Timers.h> + +#include <binder/Parcel.h> +#include <binder/IInterface.h> + +#include <gui/IDisplayEventConnection.h> +#include <gui/BitTube.h> + +namespace android { +// ---------------------------------------------------------------------------- + +enum { + GET_DATA_CHANNEL = IBinder::FIRST_CALL_TRANSACTION, + SET_VSYNC_RATE, + REQUEST_NEXT_VSYNC +}; + +class BpDisplayEventConnection : public BpInterface<IDisplayEventConnection> +{ +public: + BpDisplayEventConnection(const sp<IBinder>& impl) + : BpInterface<IDisplayEventConnection>(impl) + { + } + + virtual sp<BitTube> getDataChannel() const + { + Parcel data, reply; + data.writeInterfaceToken(IDisplayEventConnection::getInterfaceDescriptor()); + remote()->transact(GET_DATA_CHANNEL, data, &reply); + return new BitTube(reply); + } + + virtual void setVsyncRate(uint32_t count) { + Parcel data, reply; + data.writeInterfaceToken(IDisplayEventConnection::getInterfaceDescriptor()); + data.writeInt32(count); + remote()->transact(SET_VSYNC_RATE, data, &reply); + } + + virtual void requestNextVsync() { + Parcel data, reply; + data.writeInterfaceToken(IDisplayEventConnection::getInterfaceDescriptor()); + remote()->transact(REQUEST_NEXT_VSYNC, data, &reply, IBinder::FLAG_ONEWAY); + } +}; + +IMPLEMENT_META_INTERFACE(DisplayEventConnection, "android.gui.DisplayEventConnection"); + +// ---------------------------------------------------------------------------- + +status_t BnDisplayEventConnection::onTransact( + uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) +{ + switch(code) { + case GET_DATA_CHANNEL: { + CHECK_INTERFACE(IDisplayEventConnection, data, reply); + sp<BitTube> channel(getDataChannel()); + channel->writeToParcel(reply); + return NO_ERROR; + } break; + case SET_VSYNC_RATE: { + CHECK_INTERFACE(IDisplayEventConnection, data, reply); + setVsyncRate(data.readInt32()); + return NO_ERROR; + } break; + case REQUEST_NEXT_VSYNC: { + CHECK_INTERFACE(IDisplayEventConnection, data, reply); + requestNextVsync(); + return NO_ERROR; + } break; + } + return BBinder::onTransact(code, data, reply, flags); +} + +// ---------------------------------------------------------------------------- +}; // namespace android diff --git a/libs/gui/ISensorEventConnection.cpp b/libs/gui/ISensorEventConnection.cpp index a5083fed0a..0e51e8ef0d 100644 --- a/libs/gui/ISensorEventConnection.cpp +++ b/libs/gui/ISensorEventConnection.cpp @@ -25,7 +25,7 @@ #include <binder/IInterface.h> #include <gui/ISensorEventConnection.h> -#include <gui/SensorChannel.h> +#include <gui/BitTube.h> namespace android { // ---------------------------------------------------------------------------- @@ -44,12 +44,12 @@ public: { } - virtual sp<SensorChannel> getSensorChannel() const + virtual sp<BitTube> getSensorChannel() const { Parcel data, reply; data.writeInterfaceToken(ISensorEventConnection::getInterfaceDescriptor()); remote()->transact(GET_SENSOR_CHANNEL, data, &reply); - return new SensorChannel(reply); + return new BitTube(reply); } virtual status_t enableDisable(int handle, bool enabled) @@ -83,7 +83,7 @@ status_t BnSensorEventConnection::onTransact( switch(code) { case GET_SENSOR_CHANNEL: { CHECK_INTERFACE(ISensorEventConnection, data, reply); - sp<SensorChannel> channel(getSensorChannel()); + sp<BitTube> channel(getSensorChannel()); channel->writeToParcel(reply); return NO_ERROR; } break; diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp index 86bc62aa28..95b2379344 100644 --- a/libs/gui/ISurfaceComposer.cpp +++ b/libs/gui/ISurfaceComposer.cpp @@ -29,6 +29,9 @@ #include <surfaceflinger/ISurfaceComposer.h> +#include <gui/BitTube.h> +#include <gui/IDisplayEventConnection.h> + #include <ui/DisplayInfo.h> #include <gui/ISurfaceTexture.h> @@ -37,13 +40,10 @@ // --------------------------------------------------------------------------- -#define LIKELY( exp ) (__builtin_expect( (exp) != 0, true )) -#define UNLIKELY( exp ) (__builtin_expect( (exp) != 0, false )) - -// --------------------------------------------------------------------------- - namespace android { +class IDisplayEventConnection; + class BpSurfaceComposer : public BpInterface<ISurfaceComposer> { public: @@ -148,32 +148,53 @@ public: err = data.writeInterfaceToken( ISurfaceComposer::getInterfaceDescriptor()); if (err != NO_ERROR) { - LOGE("ISurfaceComposer::authenticateSurfaceTexture: error writing " + ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error writing " "interface descriptor: %s (%d)", strerror(-err), -err); return false; } err = data.writeStrongBinder(surfaceTexture->asBinder()); if (err != NO_ERROR) { - LOGE("ISurfaceComposer::authenticateSurfaceTexture: error writing " + ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error writing " "strong binder to parcel: %s (%d)", strerror(-err), -err); return false; } err = remote()->transact(BnSurfaceComposer::AUTHENTICATE_SURFACE, data, &reply); if (err != NO_ERROR) { - LOGE("ISurfaceComposer::authenticateSurfaceTexture: error " + ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error " "performing transaction: %s (%d)", strerror(-err), -err); return false; } int32_t result = 0; err = reply.readInt32(&result); if (err != NO_ERROR) { - LOGE("ISurfaceComposer::authenticateSurfaceTexture: error " + ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error " "retrieving result: %s (%d)", strerror(-err), -err); return false; } return result != 0; } + + virtual sp<IDisplayEventConnection> createDisplayEventConnection() + { + Parcel data, reply; + sp<IDisplayEventConnection> result; + int err = data.writeInterfaceToken( + ISurfaceComposer::getInterfaceDescriptor()); + if (err != NO_ERROR) { + return result; + } + err = remote()->transact( + BnSurfaceComposer::CREATE_DISPLAY_EVENT_CONNECTION, + data, &reply); + if (err != NO_ERROR) { + ALOGE("ISurfaceComposer::createDisplayEventConnection: error performing " + "transaction: %s (%d)", strerror(-err), -err); + return result; + } + result = interface_cast<IDisplayEventConnection>(reply.readStrongBinder()); + return result; + } }; IMPLEMENT_META_INTERFACE(SurfaceComposer, "android.ui.ISurfaceComposer"); @@ -254,6 +275,12 @@ status_t BnSurfaceComposer::onTransact( int32_t result = authenticateSurfaceTexture(surfaceTexture) ? 1 : 0; reply->writeInt32(result); } break; + case CREATE_DISPLAY_EVENT_CONNECTION: { + CHECK_INTERFACE(ISurfaceComposer, data, reply); + sp<IDisplayEventConnection> connection(createDisplayEventConnection()); + reply->writeStrongBinder(connection->asBinder()); + return NO_ERROR; + } break; default: return BBinder::onTransact(code, data, reply, flags); } diff --git a/libs/gui/ISurfaceComposerClient.cpp b/libs/gui/ISurfaceComposerClient.cpp index ace16aaae4..5ebdbd9558 100644 --- a/libs/gui/ISurfaceComposerClient.cpp +++ b/libs/gui/ISurfaceComposerClient.cpp @@ -42,9 +42,6 @@ #define AID_GRAPHICS 1003 #endif -#define LIKELY( exp ) (__builtin_expect( (exp) != 0, true )) -#define UNLIKELY( exp ) (__builtin_expect( (exp) != 0, false )) - // --------------------------------------------------------------------------- namespace android { diff --git a/libs/gui/SensorEventQueue.cpp b/libs/gui/SensorEventQueue.cpp index f9355249ab..b95dd90230 100644 --- a/libs/gui/SensorEventQueue.cpp +++ b/libs/gui/SensorEventQueue.cpp @@ -24,7 +24,7 @@ #include <utils/Looper.h> #include <gui/Sensor.h> -#include <gui/SensorChannel.h> +#include <gui/BitTube.h> #include <gui/SensorEventQueue.h> #include <gui/ISensorEventConnection.h> @@ -70,12 +70,12 @@ ssize_t SensorEventQueue::write(ASensorEvent const* events, size_t numEvents) ssize_t SensorEventQueue::read(ASensorEvent* events, size_t numEvents) { ssize_t size = mSensorChannel->read(events, numEvents*sizeof(events[0])); - LOGE_IF(size<0 && size!=-EAGAIN, + ALOGE_IF(size<0 && size!=-EAGAIN, "SensorChannel::read error (%s)", strerror(-size)); if (size >= 0) { if (size % sizeof(events[0])) { // partial read!!! should never happen. - LOGE("SensorEventQueue partial read (event-size=%u, read=%d)", + ALOGE("SensorEventQueue partial read (event-size=%u, read=%d)", sizeof(events[0]), int(size)); return -EINVAL; } @@ -104,7 +104,7 @@ status_t SensorEventQueue::waitForEvent() const do { result = looper->pollOnce(-1); if (result == ALOOPER_EVENT_ERROR) { - LOGE("SensorChannel::waitForEvent error (errno=%d)", errno); + ALOGE("SensorEventQueue::waitForEvent error (errno=%d)", errno); result = -EPIPE; // unknown error, so we make up one break; } diff --git a/libs/gui/SensorManager.cpp b/libs/gui/SensorManager.cpp index dafcdea233..b80da56813 100644 --- a/libs/gui/SensorManager.cpp +++ b/libs/gui/SensorManager.cpp @@ -78,7 +78,7 @@ status_t SensorManager::assertStateLocked() const { class DeathObserver : public IBinder::DeathRecipient { SensorManager& mSensorManger; virtual void binderDied(const wp<IBinder>& who) { - LOGW("sensorservice died [%p]", who.unsafe_get()); + ALOGW("sensorservice died [%p]", who.unsafe_get()); mSensorManger.sensorManagerDied(); } public: @@ -137,7 +137,7 @@ sp<SensorEventQueue> SensorManager::createEventQueue() mSensorServer->createSensorEventConnection(); if (connection == NULL) { // SensorService just died. - LOGE("createEventQueue: connection is NULL. SensorService died."); + ALOGE("createEventQueue: connection is NULL. SensorService died."); continue; } queue = new SensorEventQueue(connection); diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp index ff45fa3470..337950c3e6 100644 --- a/libs/gui/Surface.cpp +++ b/libs/gui/Surface.cpp @@ -167,7 +167,7 @@ status_t SurfaceControl::setFreezeTint(uint32_t tint) { status_t SurfaceControl::validate() const { if (mToken<0 || mClient==0) { - LOGE("invalid token (%d, identity=%u) or client (%p)", + ALOGE("invalid token (%d, identity=%u) or client (%p)", mToken, mIdentity, mClient.get()); return NO_INIT; } @@ -254,7 +254,7 @@ status_t Surface::writeToParcel( } else if (surface != 0 && (surface->mSurface != NULL || surface->getISurfaceTexture() != NULL)) { - LOGE("Parceling invalid surface with non-NULL ISurface/ISurfaceTexture as NULL: " + ALOGE("Parceling invalid surface with non-NULL ISurface/ISurfaceTexture as NULL: " "mSurface = %p, surfaceTexture = %p, mIdentity = %d, ", surface->mSurface.get(), surface->getISurfaceTexture().get(), surface->mIdentity); @@ -304,7 +304,7 @@ void Surface::cleanCachedSurfacesLocked() { void Surface::init(const sp<ISurfaceTexture>& surfaceTexture) { if (mSurface != NULL || surfaceTexture != NULL) { - LOGE_IF(surfaceTexture==0, "got a NULL ISurfaceTexture from ISurface"); + ALOGE_IF(surfaceTexture==0, "got a NULL ISurfaceTexture from ISurface"); if (surfaceTexture != NULL) { setISurfaceTexture(surfaceTexture); setUsage(GraphicBuffer::USAGE_HW_RENDER); diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 4ad6c22c0d..699438c0d7 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -39,6 +39,7 @@ #include <private/surfaceflinger/LayerState.h> #include <private/surfaceflinger/SharedBufferStack.h> +#include <private/gui/ComposerService.h> namespace android { // --------------------------------------------------------------------------- diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp index 4772189b7f..3abe84ad8b 100644 --- a/libs/gui/SurfaceTexture.cpp +++ b/libs/gui/SurfaceTexture.cpp @@ -29,6 +29,8 @@ #include <hardware/hardware.h> +#include <private/gui/ComposerService.h> + #include <surfaceflinger/ISurfaceComposer.h> #include <surfaceflinger/SurfaceComposerClient.h> #include <surfaceflinger/IGraphicBufferAlloc.h> @@ -60,11 +62,11 @@ #endif // Macros for including the SurfaceTexture name in log messages -#define ST_LOGV(x, ...) LOGV("[%s] "x, mName.string(), ##__VA_ARGS__) -#define ST_LOGD(x, ...) LOGD("[%s] "x, mName.string(), ##__VA_ARGS__) -#define ST_LOGI(x, ...) LOGI("[%s] "x, mName.string(), ##__VA_ARGS__) -#define ST_LOGW(x, ...) LOGW("[%s] "x, mName.string(), ##__VA_ARGS__) -#define ST_LOGE(x, ...) LOGE("[%s] "x, mName.string(), ##__VA_ARGS__) +#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__) +#define ST_LOGW(x, ...) ALOGW("[%s] "x, mName.string(), ##__VA_ARGS__) +#define ST_LOGE(x, ...) ALOGE("[%s] "x, mName.string(), ##__VA_ARGS__) namespace android { @@ -350,7 +352,7 @@ status_t SurfaceTexture::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h, } // if buffer is FREE it CANNOT be current - LOGW_IF((state == BufferSlot::FREE) && (mCurrentTexture==i), + ALOGW_IF((state == BufferSlot::FREE) && (mCurrentTexture==i), "dequeueBuffer: buffer %d is both FREE and current!", i); @@ -491,9 +493,9 @@ status_t SurfaceTexture::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h, // synchronizing access to it. It's too late at this point to abort the // dequeue operation. if (result == EGL_FALSE) { - LOGE("dequeueBuffer: error waiting for fence: %#x", eglGetError()); + ALOGE("dequeueBuffer: error waiting for fence: %#x", eglGetError()); } else if (result == EGL_TIMEOUT_EXPIRED_KHR) { - LOGE("dequeueBuffer: timeout waiting for fence"); + ALOGE("dequeueBuffer: timeout waiting for fence"); } eglDestroySyncKHR(dpy, fence); } @@ -802,7 +804,7 @@ status_t SurfaceTexture::updateTexImage() { EGLSyncKHR fence = eglCreateSyncKHR(dpy, EGL_SYNC_FENCE_KHR, NULL); if (fence == EGL_NO_SYNC_KHR) { - LOGE("updateTexImage: error creating fence: %#x", + ALOGE("updateTexImage: error creating fence: %#x", eglGetError()); return -EINVAL; } @@ -990,7 +992,7 @@ void SurfaceTexture::freeBufferLocked(int i) { } void SurfaceTexture::freeAllBuffersLocked() { - LOGW_IF(!mQueue.isEmpty(), + ALOGW_IF(!mQueue.isEmpty(), "freeAllBuffersLocked called but mQueue is not empty"); mCurrentTexture = INVALID_BUFFER_SLOT; for (int i = 0; i < NUM_BUFFER_SLOTS; i++) { @@ -999,7 +1001,7 @@ void SurfaceTexture::freeAllBuffersLocked() { } void SurfaceTexture::freeAllBuffersExceptHeadLocked() { - LOGW_IF(!mQueue.isEmpty(), + ALOGW_IF(!mQueue.isEmpty(), "freeAllBuffersExceptCurrentLocked called but mQueue is not empty"); int head = -1; if (!mQueue.empty()) { diff --git a/libs/gui/SurfaceTextureClient.cpp b/libs/gui/SurfaceTextureClient.cpp index 48070d67c3..d0934ba8aa 100644 --- a/libs/gui/SurfaceTextureClient.cpp +++ b/libs/gui/SurfaceTextureClient.cpp @@ -23,6 +23,8 @@ #include <utils/Log.h> +#include <private/gui/ComposerService.h> + namespace android { SurfaceTextureClient::SurfaceTextureClient( @@ -136,13 +138,13 @@ int SurfaceTextureClient::setSwapInterval(int interval) { } int SurfaceTextureClient::dequeueBuffer(android_native_buffer_t** buffer) { - LOGV("SurfaceTextureClient::dequeueBuffer"); + ALOGV("SurfaceTextureClient::dequeueBuffer"); Mutex::Autolock lock(mMutex); int buf = -1; status_t result = mSurfaceTexture->dequeueBuffer(&buf, mReqWidth, mReqHeight, mReqFormat, mReqUsage); if (result < 0) { - LOGV("dequeueBuffer: ISurfaceTexture::dequeueBuffer(%d, %d, %d, %d)" + ALOGV("dequeueBuffer: ISurfaceTexture::dequeueBuffer(%d, %d, %d, %d)" "failed: %d", mReqWidth, mReqHeight, mReqFormat, mReqUsage, result); return result; @@ -155,7 +157,7 @@ int SurfaceTextureClient::dequeueBuffer(android_native_buffer_t** buffer) { if ((result & ISurfaceTexture::BUFFER_NEEDS_REALLOCATION) || gbuf == 0) { result = mSurfaceTexture->requestBuffer(buf, &gbuf); if (result != NO_ERROR) { - LOGE("dequeueBuffer: ISurfaceTexture::requestBuffer failed: %d", + ALOGE("dequeueBuffer: ISurfaceTexture::requestBuffer failed: %d", result); return result; } @@ -165,7 +167,7 @@ int SurfaceTextureClient::dequeueBuffer(android_native_buffer_t** buffer) { } int SurfaceTextureClient::cancelBuffer(android_native_buffer_t* buffer) { - LOGV("SurfaceTextureClient::cancelBuffer"); + ALOGV("SurfaceTextureClient::cancelBuffer"); Mutex::Autolock lock(mMutex); int i = getSlotFromBufferLocked(buffer); if (i < 0) { @@ -183,13 +185,13 @@ int SurfaceTextureClient::getSlotFromBufferLocked( // a buffer. if (mSlots[i] == NULL) { if (!dumpedState) { - LOGD("getSlotFromBufferLocked: encountered NULL buffer in slot %d " + ALOGD("getSlotFromBufferLocked: encountered NULL buffer in slot %d " "looking for buffer %p", i, buffer->handle); for (int j = 0; j < NUM_BUFFER_SLOTS; j++) { if (mSlots[j] == NULL) { - LOGD("getSlotFromBufferLocked: %02d: NULL", j); + ALOGD("getSlotFromBufferLocked: %02d: NULL", j); } else { - LOGD("getSlotFromBufferLocked: %02d: %p", j, mSlots[j]->handle); + ALOGD("getSlotFromBufferLocked: %02d: %p", j, mSlots[j]->handle); } } dumpedState = true; @@ -200,23 +202,23 @@ int SurfaceTextureClient::getSlotFromBufferLocked( return i; } } - LOGE("getSlotFromBufferLocked: unknown buffer: %p", buffer->handle); + ALOGE("getSlotFromBufferLocked: unknown buffer: %p", buffer->handle); return BAD_VALUE; } int SurfaceTextureClient::lockBuffer(android_native_buffer_t* buffer) { - LOGV("SurfaceTextureClient::lockBuffer"); + ALOGV("SurfaceTextureClient::lockBuffer"); Mutex::Autolock lock(mMutex); return OK; } int SurfaceTextureClient::queueBuffer(android_native_buffer_t* buffer) { - LOGV("SurfaceTextureClient::queueBuffer"); + ALOGV("SurfaceTextureClient::queueBuffer"); Mutex::Autolock lock(mMutex); int64_t timestamp; if (mTimestamp == NATIVE_WINDOW_TIMESTAMP_AUTO) { timestamp = systemTime(SYSTEM_TIME_MONOTONIC); - LOGV("SurfaceTextureClient::queueBuffer making up timestamp: %.2f ms", + ALOGV("SurfaceTextureClient::queueBuffer making up timestamp: %.2f ms", timestamp / 1000000.f); } else { timestamp = mTimestamp; @@ -228,13 +230,13 @@ int SurfaceTextureClient::queueBuffer(android_native_buffer_t* buffer) { status_t err = mSurfaceTexture->queueBuffer(i, timestamp, &mDefaultWidth, &mDefaultHeight, &mTransformHint); if (err != OK) { - LOGE("queueBuffer: error queuing buffer to SurfaceTexture, %d", err); + ALOGE("queueBuffer: error queuing buffer to SurfaceTexture, %d", err); } return err; } int SurfaceTextureClient::query(int what, int* value) const { - LOGV("SurfaceTextureClient::query"); + ALOGV("SurfaceTextureClient::query"); { // scope for the lock Mutex::Autolock lock(mMutex); switch (what) { @@ -402,7 +404,7 @@ int SurfaceTextureClient::dispatchUnlockAndPost(va_list args) { int SurfaceTextureClient::connect(int api) { - LOGV("SurfaceTextureClient::connect"); + ALOGV("SurfaceTextureClient::connect"); Mutex::Autolock lock(mMutex); int err = mSurfaceTexture->connect(api, &mDefaultWidth, &mDefaultHeight, &mTransformHint); @@ -413,7 +415,7 @@ int SurfaceTextureClient::connect(int api) { } int SurfaceTextureClient::disconnect(int api) { - LOGV("SurfaceTextureClient::disconnect"); + ALOGV("SurfaceTextureClient::disconnect"); Mutex::Autolock lock(mMutex); freeAllBuffers(); int err = mSurfaceTexture->disconnect(api); @@ -431,7 +433,7 @@ int SurfaceTextureClient::disconnect(int api) { int SurfaceTextureClient::setUsage(uint32_t reqUsage) { - LOGV("SurfaceTextureClient::setUsage"); + ALOGV("SurfaceTextureClient::setUsage"); Mutex::Autolock lock(mMutex); mReqUsage = reqUsage; return OK; @@ -439,7 +441,7 @@ int SurfaceTextureClient::setUsage(uint32_t reqUsage) int SurfaceTextureClient::setCrop(Rect const* rect) { - LOGV("SurfaceTextureClient::setCrop"); + ALOGV("SurfaceTextureClient::setCrop"); Mutex::Autolock lock(mMutex); Rect realRect; @@ -450,18 +452,18 @@ int SurfaceTextureClient::setCrop(Rect const* rect) } status_t err = mSurfaceTexture->setCrop(*rect); - LOGE_IF(err, "ISurfaceTexture::setCrop(...) returned %s", strerror(-err)); + ALOGE_IF(err, "ISurfaceTexture::setCrop(...) returned %s", strerror(-err)); return err; } int SurfaceTextureClient::setBufferCount(int bufferCount) { - LOGV("SurfaceTextureClient::setBufferCount"); + ALOGV("SurfaceTextureClient::setBufferCount"); Mutex::Autolock lock(mMutex); status_t err = mSurfaceTexture->setBufferCount(bufferCount); - LOGE_IF(err, "ISurfaceTexture::setBufferCount(%d) returned %s", + ALOGE_IF(err, "ISurfaceTexture::setBufferCount(%d) returned %s", bufferCount, strerror(-err)); if (err == NO_ERROR) { @@ -473,7 +475,7 @@ int SurfaceTextureClient::setBufferCount(int bufferCount) int SurfaceTextureClient::setBuffersDimensions(int w, int h) { - LOGV("SurfaceTextureClient::setBuffersDimensions"); + ALOGV("SurfaceTextureClient::setBuffersDimensions"); Mutex::Autolock lock(mMutex); if (w<0 || h<0) @@ -486,14 +488,14 @@ int SurfaceTextureClient::setBuffersDimensions(int w, int h) mReqHeight = h; status_t err = mSurfaceTexture->setCrop(Rect(0, 0)); - LOGE_IF(err, "ISurfaceTexture::setCrop(...) returned %s", strerror(-err)); + ALOGE_IF(err, "ISurfaceTexture::setCrop(...) returned %s", strerror(-err)); return err; } int SurfaceTextureClient::setBuffersFormat(int format) { - LOGV("SurfaceTextureClient::setBuffersFormat"); + ALOGV("SurfaceTextureClient::setBuffersFormat"); Mutex::Autolock lock(mMutex); if (format<0) @@ -506,11 +508,11 @@ int SurfaceTextureClient::setBuffersFormat(int format) int SurfaceTextureClient::setScalingMode(int mode) { - LOGV("SurfaceTextureClient::setScalingMode(%d)", mode); + ALOGV("SurfaceTextureClient::setScalingMode(%d)", mode); Mutex::Autolock lock(mMutex); // mode is validated on the server status_t err = mSurfaceTexture->setScalingMode(mode); - LOGE_IF(err, "ISurfaceTexture::setScalingMode(%d) returned %s", + ALOGE_IF(err, "ISurfaceTexture::setScalingMode(%d) returned %s", mode, strerror(-err)); return err; @@ -518,7 +520,7 @@ int SurfaceTextureClient::setScalingMode(int mode) int SurfaceTextureClient::setBuffersTransform(int transform) { - LOGV("SurfaceTextureClient::setBuffersTransform"); + ALOGV("SurfaceTextureClient::setBuffersTransform"); Mutex::Autolock lock(mMutex); status_t err = mSurfaceTexture->setTransform(transform); return err; @@ -526,7 +528,7 @@ int SurfaceTextureClient::setBuffersTransform(int transform) int SurfaceTextureClient::setBuffersTimestamp(int64_t timestamp) { - LOGV("SurfaceTextureClient::setBuffersTimestamp"); + ALOGV("SurfaceTextureClient::setBuffersTimestamp"); Mutex::Autolock lock(mMutex); mTimestamp = timestamp; return NO_ERROR; @@ -551,11 +553,11 @@ static status_t copyBlt( status_t err; uint8_t const * src_bits = NULL; err = src->lock(GRALLOC_USAGE_SW_READ_OFTEN, reg.bounds(), (void**)&src_bits); - LOGE_IF(err, "error locking src buffer %s", strerror(-err)); + ALOGE_IF(err, "error locking src buffer %s", strerror(-err)); uint8_t* dst_bits = NULL; err = dst->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, reg.bounds(), (void**)&dst_bits); - LOGE_IF(err, "error locking dst buffer %s", strerror(-err)); + ALOGE_IF(err, "error locking dst buffer %s", strerror(-err)); Region::const_iterator head(reg.begin()); Region::const_iterator tail(reg.end()); @@ -598,7 +600,7 @@ status_t SurfaceTextureClient::lock( ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds) { if (mLockedBuffer != 0) { - LOGE("Surface::lock failed, already locked"); + ALOGE("Surface::lock failed, already locked"); return INVALID_OPERATION; } @@ -613,11 +615,11 @@ status_t SurfaceTextureClient::lock( ANativeWindowBuffer* out; status_t err = dequeueBuffer(&out); - LOGE_IF(err, "dequeueBuffer failed (%s)", strerror(-err)); + ALOGE_IF(err, "dequeueBuffer failed (%s)", strerror(-err)); if (err == NO_ERROR) { sp<GraphicBuffer> backBuffer(GraphicBuffer::getSelf(out)); err = lockBuffer(backBuffer.get()); - LOGE_IF(err, "lockBuffer (handle=%p) failed (%s)", + ALOGE_IF(err, "lockBuffer (handle=%p) failed (%s)", backBuffer->handle, strerror(-err)); if (err == NO_ERROR) { const Rect bounds(backBuffer->width, backBuffer->height); @@ -661,7 +663,7 @@ status_t SurfaceTextureClient::lock( GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN, newDirtyRegion.bounds(), &vaddr); - LOGW_IF(res, "failed locking buffer (handle = %p)", + ALOGW_IF(res, "failed locking buffer (handle = %p)", backBuffer->handle); mLockedBuffer = backBuffer; @@ -678,15 +680,15 @@ status_t SurfaceTextureClient::lock( status_t SurfaceTextureClient::unlockAndPost() { if (mLockedBuffer == 0) { - LOGE("Surface::unlockAndPost failed, no locked buffer"); + ALOGE("Surface::unlockAndPost failed, no locked buffer"); return INVALID_OPERATION; } status_t err = mLockedBuffer->unlock(); - LOGE_IF(err, "failed unlocking buffer (%p)", mLockedBuffer->handle); + ALOGE_IF(err, "failed unlocking buffer (%p)", mLockedBuffer->handle); err = queueBuffer(mLockedBuffer.get()); - LOGE_IF(err, "queueBuffer (handle=%p) failed (%s)", + ALOGE_IF(err, "queueBuffer (handle=%p) failed (%s)", mLockedBuffer->handle, strerror(-err)); mPostedBuffer = mLockedBuffer; diff --git a/libs/gui/tests/SurfaceTexture_test.cpp b/libs/gui/tests/SurfaceTexture_test.cpp index c313904283..b18e7b057e 100644 --- a/libs/gui/tests/SurfaceTexture_test.cpp +++ b/libs/gui/tests/SurfaceTexture_test.cpp @@ -1399,12 +1399,12 @@ protected: // test. void waitForFrame() { Mutex::Autolock lock(mMutex); - LOGV("+waitForFrame"); + ALOGV("+waitForFrame"); while (!mFrameAvailable) { mFrameAvailableCondition.wait(mMutex); } mFrameAvailable = false; - LOGV("-waitForFrame"); + ALOGV("-waitForFrame"); } // Allow the producer to return from its swapBuffers call and continue @@ -1412,23 +1412,23 @@ protected: // thread once for every frame expected by the test. void finishFrame() { Mutex::Autolock lock(mMutex); - LOGV("+finishFrame"); + ALOGV("+finishFrame"); mFrameFinished = true; mFrameFinishCondition.signal(); - LOGV("-finishFrame"); + ALOGV("-finishFrame"); } // This should be called by SurfaceTexture on the producer thread. virtual void onFrameAvailable() { Mutex::Autolock lock(mMutex); - LOGV("+onFrameAvailable"); + ALOGV("+onFrameAvailable"); mFrameAvailable = true; mFrameAvailableCondition.signal(); while (!mFrameFinished) { mFrameFinishCondition.wait(mMutex); } mFrameFinished = false; - LOGV("-onFrameAvailable"); + ALOGV("-onFrameAvailable"); } protected: @@ -1514,9 +1514,9 @@ TEST_F(SurfaceTextureGLThreadToGLTest, for (int i = 0; i < NUM_ITERATIONS; i++) { glClearColor(0.0f, 1.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); - LOGV("+swapBuffers"); + ALOGV("+swapBuffers"); swapBuffers(); - LOGV("-swapBuffers"); + ALOGV("-swapBuffers"); } } }; @@ -1525,9 +1525,9 @@ TEST_F(SurfaceTextureGLThreadToGLTest, for (int i = 0; i < NUM_ITERATIONS; i++) { mFC->waitForFrame(); - LOGV("+updateTexImage"); + ALOGV("+updateTexImage"); mST->updateTexImage(); - LOGV("-updateTexImage"); + ALOGV("-updateTexImage"); mFC->finishFrame(); // TODO: Add frame verification once RGB TEX_EXTERNAL_OES is supported! @@ -1543,9 +1543,9 @@ TEST_F(SurfaceTextureGLThreadToGLTest, for (int i = 0; i < NUM_ITERATIONS; i++) { glClearColor(0.0f, 1.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); - LOGV("+swapBuffers"); + ALOGV("+swapBuffers"); swapBuffers(); - LOGV("-swapBuffers"); + ALOGV("-swapBuffers"); } } }; @@ -1555,9 +1555,9 @@ TEST_F(SurfaceTextureGLThreadToGLTest, for (int i = 0; i < NUM_ITERATIONS; i++) { mFC->waitForFrame(); mFC->finishFrame(); - LOGV("+updateTexImage"); + ALOGV("+updateTexImage"); mST->updateTexImage(); - LOGV("-updateTexImage"); + ALOGV("-updateTexImage"); // TODO: Add frame verification once RGB TEX_EXTERNAL_OES is supported! } @@ -1573,9 +1573,9 @@ TEST_F(SurfaceTextureGLThreadToGLTest, for (int i = 0; i < NUM_ITERATIONS; i++) { glClearColor(0.0f, 1.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); - LOGV("+swapBuffers"); + ALOGV("+swapBuffers"); swapBuffers(); - LOGV("-swapBuffers"); + ALOGV("-swapBuffers"); } } }; @@ -1624,9 +1624,9 @@ TEST_F(SurfaceTextureGLThreadToGLTest, for (int i = 0; i < NUM_ITERATIONS-3; i++) { mFC->waitForFrame(); mFC->finishFrame(); - LOGV("+updateTexImage"); + ALOGV("+updateTexImage"); mST->updateTexImage(); - LOGV("-updateTexImage"); + ALOGV("-updateTexImage"); } } diff --git a/libs/gui/tests/Surface_test.cpp b/libs/gui/tests/Surface_test.cpp index 693b7b8248..ea527504b1 100644 --- a/libs/gui/tests/Surface_test.cpp +++ b/libs/gui/tests/Surface_test.cpp @@ -22,6 +22,8 @@ #include <surfaceflinger/SurfaceComposerClient.h> #include <utils/String8.h> +#include <private/gui/ComposerService.h> + namespace android { class SurfaceTest : public ::testing::Test { diff --git a/libs/ui/FramebufferNativeWindow.cpp b/libs/ui/FramebufferNativeWindow.cpp index 89497302a2..f5ed9813ec 100644 --- a/libs/ui/FramebufferNativeWindow.cpp +++ b/libs/ui/FramebufferNativeWindow.cpp @@ -85,10 +85,10 @@ FramebufferNativeWindow::FramebufferNativeWindow() int err; int i; err = framebuffer_open(module, &fbDev); - LOGE_IF(err, "couldn't open framebuffer HAL (%s)", strerror(-err)); + ALOGE_IF(err, "couldn't open framebuffer HAL (%s)", strerror(-err)); err = gralloc_open(module, &grDev); - LOGE_IF(err, "couldn't open gralloc HAL (%s)", strerror(-err)); + ALOGE_IF(err, "couldn't open gralloc HAL (%s)", strerror(-err)); // bail out if we can't initialize the modules if (!fbDev || !grDev) @@ -113,7 +113,7 @@ FramebufferNativeWindow::FramebufferNativeWindow() fbDev->width, fbDev->height, fbDev->format, GRALLOC_USAGE_HW_FB, &buffers[i]->handle, &buffers[i]->stride); - LOGE_IF(err, "fb buffer %d allocation failed w=%d, h=%d, err=%s", + ALOGE_IF(err, "fb buffer %d allocation failed w=%d, h=%d, err=%s", i, fbDev->width, fbDev->height, strerror(-err)); if (err) @@ -133,7 +133,7 @@ FramebufferNativeWindow::FramebufferNativeWindow() const_cast<int&>(ANativeWindow::maxSwapInterval) = fbDev->maxSwapInterval; } else { - LOGE("Couldn't get gralloc module"); + ALOGE("Couldn't get gralloc module"); } ANativeWindow::setSwapInterval = setSwapInterval; diff --git a/libs/ui/GraphicBuffer.cpp b/libs/ui/GraphicBuffer.cpp index 54a3ffa566..f549a3795f 100644 --- a/libs/ui/GraphicBuffer.cpp +++ b/libs/ui/GraphicBuffer.cpp @@ -167,7 +167,7 @@ status_t GraphicBuffer::lock(uint32_t usage, const Rect& rect, void** vaddr) { if (rect.left < 0 || rect.right > this->width || rect.top < 0 || rect.bottom > this->height) { - LOGE("locking pixels (%d,%d,%d,%d) outside of buffer (w=%d, h=%d)", + ALOGE("locking pixels (%d,%d,%d,%d) outside of buffer (w=%d, h=%d)", rect.left, rect.top, rect.right, rect.bottom, this->width, this->height); return BAD_VALUE; diff --git a/libs/ui/GraphicBufferAllocator.cpp b/libs/ui/GraphicBufferAllocator.cpp index e75415b37b..d3447377fe 100644 --- a/libs/ui/GraphicBufferAllocator.cpp +++ b/libs/ui/GraphicBufferAllocator.cpp @@ -38,7 +38,7 @@ GraphicBufferAllocator::GraphicBufferAllocator() { hw_module_t const* module; int err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module); - LOGE_IF(err, "FATAL: can't find the %s module", GRALLOC_HARDWARE_MODULE_ID); + ALOGE_IF(err, "FATAL: can't find the %s module", GRALLOC_HARDWARE_MODULE_ID); if (err == 0) { gralloc_open(module, &mAllocDev); } @@ -85,7 +85,7 @@ void GraphicBufferAllocator::dumpToSystemLog() { String8 s; GraphicBufferAllocator::getInstance().dump(s); - LOGD("%s", s.string()); + ALOGD("%s", s.string()); } status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, PixelFormat format, @@ -101,7 +101,7 @@ status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, PixelFormat forma err = mAllocDev->alloc(mAllocDev, w, h, format, usage, handle, stride); - LOGW_IF(err, "alloc(%u, %u, %d, %08x, ...) failed %d (%s)", + ALOGW_IF(err, "alloc(%u, %u, %d, %08x, ...) failed %d (%s)", w, h, format, usage, err, strerror(-err)); if (err == NO_ERROR) { @@ -132,7 +132,7 @@ status_t GraphicBufferAllocator::free(buffer_handle_t handle) err = mAllocDev->free(mAllocDev, handle); - LOGW_IF(err, "free(...) failed %d (%s)", err, strerror(-err)); + ALOGW_IF(err, "free(...) failed %d (%s)", err, strerror(-err)); if (err == NO_ERROR) { Mutex::Autolock _l(sLock); KeyedVector<buffer_handle_t, alloc_rec_t>& list(sAllocList); diff --git a/libs/ui/GraphicBufferMapper.cpp b/libs/ui/GraphicBufferMapper.cpp index 07c067474d..b173c854d9 100644 --- a/libs/ui/GraphicBufferMapper.cpp +++ b/libs/ui/GraphicBufferMapper.cpp @@ -38,7 +38,7 @@ GraphicBufferMapper::GraphicBufferMapper() { hw_module_t const* module; int err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module); - LOGE_IF(err, "FATAL: can't find the %s module", GRALLOC_HARDWARE_MODULE_ID); + ALOGE_IF(err, "FATAL: can't find the %s module", GRALLOC_HARDWARE_MODULE_ID); if (err == 0) { mAllocMod = (gralloc_module_t const *)module; } @@ -50,7 +50,7 @@ status_t GraphicBufferMapper::registerBuffer(buffer_handle_t handle) err = mAllocMod->registerBuffer(mAllocMod, handle); - LOGW_IF(err, "registerBuffer(%p) failed %d (%s)", + ALOGW_IF(err, "registerBuffer(%p) failed %d (%s)", handle, err, strerror(-err)); return err; } @@ -61,7 +61,7 @@ status_t GraphicBufferMapper::unregisterBuffer(buffer_handle_t handle) err = mAllocMod->unregisterBuffer(mAllocMod, handle); - LOGW_IF(err, "unregisterBuffer(%p) failed %d (%s)", + ALOGW_IF(err, "unregisterBuffer(%p) failed %d (%s)", handle, err, strerror(-err)); return err; } @@ -75,7 +75,7 @@ status_t GraphicBufferMapper::lock(buffer_handle_t handle, bounds.left, bounds.top, bounds.width(), bounds.height(), vaddr); - LOGW_IF(err, "lock(...) failed %d (%s)", err, strerror(-err)); + ALOGW_IF(err, "lock(...) failed %d (%s)", err, strerror(-err)); return err; } @@ -85,7 +85,7 @@ status_t GraphicBufferMapper::unlock(buffer_handle_t handle) err = mAllocMod->unlock(mAllocMod, handle); - LOGW_IF(err, "unlock(...) failed %d (%s)", err, strerror(-err)); + ALOGW_IF(err, "unlock(...) failed %d (%s)", err, strerror(-err)); return err; } diff --git a/libs/ui/Input.cpp b/libs/ui/Input.cpp index 3de75bae94..263c8d9198 100644 --- a/libs/ui/Input.cpp +++ b/libs/ui/Input.cpp @@ -106,11 +106,11 @@ String8 getInputDeviceConfigurationFilePathByName( path.append("/usr/"); appendInputDeviceConfigurationFileRelativePath(path, name, type); #if DEBUG_PROBE - LOGD("Probing for system provided input device configuration file: path='%s'", path.string()); + ALOGD("Probing for system provided input device configuration file: path='%s'", path.string()); #endif if (!access(path.string(), R_OK)) { #if DEBUG_PROBE - LOGD("Found"); + ALOGD("Found"); #endif return path; } @@ -121,18 +121,18 @@ String8 getInputDeviceConfigurationFilePathByName( path.append("/system/devices/"); appendInputDeviceConfigurationFileRelativePath(path, name, type); #if DEBUG_PROBE - LOGD("Probing for system user input device configuration file: path='%s'", path.string()); + ALOGD("Probing for system user input device configuration file: path='%s'", path.string()); #endif if (!access(path.string(), R_OK)) { #if DEBUG_PROBE - LOGD("Found"); + ALOGD("Found"); #endif return path; } // Not found. #if DEBUG_PROBE - LOGD("Probe failed to find input device configuration file: name='%s', type=%d", + ALOGD("Probe failed to find input device configuration file: name='%s', type=%d", name.string(), type); #endif return String8(); @@ -345,7 +345,7 @@ status_t PointerCoords::writeToParcel(Parcel* parcel) const { #endif void PointerCoords::tooManyAxes(int axis) { - LOGW("Could not set value for axis %d because the PointerCoords structure is full and " + ALOGW("Could not set value for axis %d because the PointerCoords structure is full and " "cannot contain more than %d axis values.", axis, int(MAX_AXES)); } @@ -782,7 +782,7 @@ void VelocityTracker::addMovement(nsecs_t eventTime, BitSet32 idBits, const Posi } #if DEBUG_VELOCITY - LOGD("VelocityTracker: addMovement eventTime=%lld, idBits=0x%08x, activePointerId=%d", + ALOGD("VelocityTracker: addMovement eventTime=%lld, idBits=0x%08x, activePointerId=%d", eventTime, idBits.value, mActivePointerId); for (BitSet32 iterBits(idBits); !iterBits.isEmpty(); ) { uint32_t id = iterBits.firstMarkedBit(); @@ -790,7 +790,7 @@ void VelocityTracker::addMovement(nsecs_t eventTime, BitSet32 idBits, const Posi iterBits.clearBit(id); Estimator estimator; getEstimator(id, DEFAULT_DEGREE, DEFAULT_HORIZON, &estimator); - LOGD(" %d: position (%0.3f, %0.3f), " + ALOGD(" %d: position (%0.3f, %0.3f), " "estimator (degree=%d, xCoeff=%s, yCoeff=%s, confidence=%f)", id, positions[index].x, positions[index].y, int(estimator.degree), @@ -903,7 +903,7 @@ void VelocityTracker::addMovement(const MotionEvent* event) { static bool solveLeastSquares(const float* x, const float* y, uint32_t m, uint32_t n, float* outB, float* outDet) { #if DEBUG_LEAST_SQUARES - LOGD("solveLeastSquares: m=%d, n=%d, x=%s, y=%s", int(m), int(n), + ALOGD("solveLeastSquares: m=%d, n=%d, x=%s, y=%s", int(m), int(n), vectorToString(x, m).string(), vectorToString(y, m).string()); #endif @@ -916,7 +916,7 @@ static bool solveLeastSquares(const float* x, const float* y, uint32_t m, uint32 } } #if DEBUG_LEAST_SQUARES - LOGD(" - a=%s", matrixToString(&a[0][0], m, n, false /*rowMajor*/).string()); + ALOGD(" - a=%s", matrixToString(&a[0][0], m, n, false /*rowMajor*/).string()); #endif // Apply the Gram-Schmidt process to A to obtain its QR decomposition. @@ -937,7 +937,7 @@ static bool solveLeastSquares(const float* x, const float* y, uint32_t m, uint32 if (norm < 0.000001f) { // vectors are linearly dependent or zero so no solution #if DEBUG_LEAST_SQUARES - LOGD(" - no solution, norm=%f", norm); + ALOGD(" - no solution, norm=%f", norm); #endif return false; } @@ -951,8 +951,8 @@ static bool solveLeastSquares(const float* x, const float* y, uint32_t m, uint32 } } #if DEBUG_LEAST_SQUARES - LOGD(" - q=%s", matrixToString(&q[0][0], m, n, false /*rowMajor*/).string()); - LOGD(" - r=%s", matrixToString(&r[0][0], n, n, true /*rowMajor*/).string()); + ALOGD(" - q=%s", matrixToString(&q[0][0], m, n, false /*rowMajor*/).string()); + ALOGD(" - r=%s", matrixToString(&r[0][0], n, n, true /*rowMajor*/).string()); // calculate QR, if we factored A correctly then QR should equal A float qr[n][m]; @@ -964,7 +964,7 @@ static bool solveLeastSquares(const float* x, const float* y, uint32_t m, uint32 } } } - LOGD(" - qr=%s", matrixToString(&qr[0][0], m, n, false /*rowMajor*/).string()); + ALOGD(" - qr=%s", matrixToString(&qr[0][0], m, n, false /*rowMajor*/).string()); #endif // Solve R B = Qt Y to find B. This is easy because R is upper triangular. @@ -977,7 +977,7 @@ static bool solveLeastSquares(const float* x, const float* y, uint32_t m, uint32 outB[i] /= r[i][i]; } #if DEBUG_LEAST_SQUARES - LOGD(" - b=%s", vectorToString(outB, n).string()); + ALOGD(" - b=%s", vectorToString(outB, n).string()); #endif // Calculate the coefficient of determination as 1 - (SSerr / SStot) where @@ -1004,9 +1004,9 @@ static bool solveLeastSquares(const float* x, const float* y, uint32_t m, uint32 } *outDet = sstot > 0.000001f ? 1.0f - (sserr / sstot) : 1; #if DEBUG_LEAST_SQUARES - LOGD(" - sserr=%f", sserr); - LOGD(" - sstot=%f", sstot); - LOGD(" - det=%f", *outDet); + ALOGD(" - sserr=%f", sserr); + ALOGD(" - sstot=%f", sstot); + ALOGD(" - det=%f", *outDet); #endif return true; } @@ -1073,7 +1073,7 @@ bool VelocityTracker::getEstimator(uint32_t id, uint32_t degree, nsecs_t horizon outEstimator->degree = degree; outEstimator->confidence = xdet * ydet; #if DEBUG_LEAST_SQUARES - LOGD("estimate: degree=%d, xCoeff=%s, yCoeff=%s, confidence=%f", + ALOGD("estimate: degree=%d, xCoeff=%s, yCoeff=%s, confidence=%f", int(outEstimator->degree), vectorToString(outEstimator->xCoeff, n).string(), vectorToString(outEstimator->yCoeff, n).string(), @@ -1116,7 +1116,7 @@ void VelocityControl::move(nsecs_t eventTime, float* deltaX, float* deltaY) { if ((deltaX && *deltaX) || (deltaY && *deltaY)) { if (eventTime >= mLastMovementTime + STOP_TIME) { #if DEBUG_ACCELERATION - LOGD("VelocityControl: stopped, last movement was %0.3fms ago", + ALOGD("VelocityControl: stopped, last movement was %0.3fms ago", (eventTime - mLastMovementTime) * 0.000001f); #endif reset(); @@ -1147,7 +1147,7 @@ void VelocityControl::move(nsecs_t eventTime, float* deltaX, float* deltaY) { } #if DEBUG_ACCELERATION - LOGD("VelocityControl(%0.3f, %0.3f, %0.3f, %0.3f): " + ALOGD("VelocityControl(%0.3f, %0.3f, %0.3f, %0.3f): " "vx=%0.3f, vy=%0.3f, speed=%0.3f, accel=%0.3f", mParameters.scale, mParameters.lowThreshold, mParameters.highThreshold, mParameters.acceleration, @@ -1155,7 +1155,7 @@ void VelocityControl::move(nsecs_t eventTime, float* deltaX, float* deltaY) { #endif } else { #if DEBUG_ACCELERATION - LOGD("VelocityControl(%0.3f, %0.3f, %0.3f, %0.3f): unknown velocity", + ALOGD("VelocityControl(%0.3f, %0.3f, %0.3f, %0.3f): unknown velocity", mParameters.scale, mParameters.lowThreshold, mParameters.highThreshold, mParameters.acceleration); #endif diff --git a/libs/ui/InputTransport.cpp b/libs/ui/InputTransport.cpp index 1e602e982d..09cbb318cd 100644 --- a/libs/ui/InputTransport.cpp +++ b/libs/ui/InputTransport.cpp @@ -55,7 +55,7 @@ InputChannel::InputChannel(const String8& name, int32_t ashmemFd, int32_t receiv int32_t sendPipeFd) : mName(name), mAshmemFd(ashmemFd), mReceivePipeFd(receivePipeFd), mSendPipeFd(sendPipeFd) { #if DEBUG_CHANNEL_LIFECYCLE - LOGD("Input channel constructed: name='%s', ashmemFd=%d, receivePipeFd=%d, sendPipeFd=%d", + ALOGD("Input channel constructed: name='%s', ashmemFd=%d, receivePipeFd=%d, sendPipeFd=%d", mName.string(), ashmemFd, receivePipeFd, sendPipeFd); #endif @@ -70,7 +70,7 @@ InputChannel::InputChannel(const String8& name, int32_t ashmemFd, int32_t receiv InputChannel::~InputChannel() { #if DEBUG_CHANNEL_LIFECYCLE - LOGD("Input channel destroyed: name='%s', ashmemFd=%d, receivePipeFd=%d, sendPipeFd=%d", + ALOGD("Input channel destroyed: name='%s', ashmemFd=%d, receivePipeFd=%d, sendPipeFd=%d", mName.string(), mAshmemFd, mReceivePipeFd, mSendPipeFd); #endif @@ -88,12 +88,12 @@ status_t InputChannel::openInputChannelPair(const String8& name, int serverAshmemFd = ashmem_create_region(ashmemName.string(), DEFAULT_MESSAGE_BUFFER_SIZE); if (serverAshmemFd < 0) { result = -errno; - LOGE("channel '%s' ~ Could not create shared memory region. errno=%d", + ALOGE("channel '%s' ~ Could not create shared memory region. errno=%d", name.string(), errno); } else { result = ashmem_set_prot_region(serverAshmemFd, PROT_READ | PROT_WRITE); if (result < 0) { - LOGE("channel '%s' ~ Error %d trying to set protection of ashmem fd %d.", + ALOGE("channel '%s' ~ Error %d trying to set protection of ashmem fd %d.", name.string(), result, serverAshmemFd); } else { // Dup the file descriptor because the server and client input channel objects that @@ -102,19 +102,19 @@ status_t InputChannel::openInputChannelPair(const String8& name, clientAshmemFd = dup(serverAshmemFd); if (clientAshmemFd < 0) { result = -errno; - LOGE("channel '%s' ~ Could not dup() shared memory region fd. errno=%d", + ALOGE("channel '%s' ~ Could not dup() shared memory region fd. errno=%d", name.string(), errno); } else { int forward[2]; if (pipe(forward)) { result = -errno; - LOGE("channel '%s' ~ Could not create forward pipe. errno=%d", + ALOGE("channel '%s' ~ Could not create forward pipe. errno=%d", name.string(), errno); } else { int reverse[2]; if (pipe(reverse)) { result = -errno; - LOGE("channel '%s' ~ Could not create reverse pipe. errno=%d", + ALOGE("channel '%s' ~ Could not create reverse pipe. errno=%d", name.string(), errno); } else { String8 serverChannelName = name; @@ -150,13 +150,13 @@ status_t InputChannel::sendSignal(char signal) { if (nWrite == 1) { #if DEBUG_CHANNEL_SIGNALS - LOGD("channel '%s' ~ sent signal '%c'", mName.string(), signal); + ALOGD("channel '%s' ~ sent signal '%c'", mName.string(), signal); #endif return OK; } #if DEBUG_CHANNEL_SIGNALS - LOGD("channel '%s' ~ error sending signal '%c', errno=%d", mName.string(), signal, errno); + ALOGD("channel '%s' ~ error sending signal '%c', errno=%d", mName.string(), signal, errno); #endif return -errno; } @@ -169,27 +169,27 @@ status_t InputChannel::receiveSignal(char* outSignal) { if (nRead == 1) { #if DEBUG_CHANNEL_SIGNALS - LOGD("channel '%s' ~ received signal '%c'", mName.string(), *outSignal); + ALOGD("channel '%s' ~ received signal '%c'", mName.string(), *outSignal); #endif return OK; } if (nRead == 0) { // check for EOF #if DEBUG_CHANNEL_SIGNALS - LOGD("channel '%s' ~ receive signal failed because peer was closed", mName.string()); + ALOGD("channel '%s' ~ receive signal failed because peer was closed", mName.string()); #endif return DEAD_OBJECT; } if (errno == EAGAIN) { #if DEBUG_CHANNEL_SIGNALS - LOGD("channel '%s' ~ receive signal failed because no signal available", mName.string()); + ALOGD("channel '%s' ~ receive signal failed because no signal available", mName.string()); #endif return WOULD_BLOCK; } #if DEBUG_CHANNEL_SIGNALS - LOGD("channel '%s' ~ receive signal failed, errno=%d", mName.string(), errno); + ALOGD("channel '%s' ~ receive signal failed, errno=%d", mName.string(), errno); #endif return -errno; } @@ -213,14 +213,14 @@ InputPublisher::~InputPublisher() { status_t InputPublisher::initialize() { #if DEBUG_TRANSPORT_ACTIONS - LOGD("channel '%s' publisher ~ initialize", + ALOGD("channel '%s' publisher ~ initialize", mChannel->getName().string()); #endif int ashmemFd = mChannel->getAshmemFd(); int result = ashmem_get_size_region(ashmemFd); if (result < 0) { - LOGE("channel '%s' publisher ~ Error %d getting size of ashmem fd %d.", + ALOGE("channel '%s' publisher ~ Error %d getting size of ashmem fd %d.", mChannel->getName().string(), result, ashmemFd); return UNKNOWN_ERROR; } @@ -229,7 +229,7 @@ status_t InputPublisher::initialize() { mSharedMessage = static_cast<InputMessage*>(mmap(NULL, mAshmemSize, PROT_READ | PROT_WRITE, MAP_SHARED, ashmemFd, 0)); if (! mSharedMessage) { - LOGE("channel '%s' publisher ~ mmap failed on ashmem fd %d.", + ALOGE("channel '%s' publisher ~ mmap failed on ashmem fd %d.", mChannel->getName().string(), ashmemFd); return NO_MEMORY; } @@ -242,7 +242,7 @@ status_t InputPublisher::initialize() { status_t InputPublisher::reset() { #if DEBUG_TRANSPORT_ACTIONS - LOGD("channel '%s' publisher ~ reset", + ALOGD("channel '%s' publisher ~ reset", mChannel->getName().string()); #endif @@ -253,7 +253,7 @@ status_t InputPublisher::reset() { if (mSharedMessage->consumed) { result = sem_post(& mSharedMessage->semaphore); if (result < 0) { - LOGE("channel '%s' publisher ~ Error %d in sem_post.", + ALOGE("channel '%s' publisher ~ Error %d in sem_post.", mChannel->getName().string(), errno); return UNKNOWN_ERROR; } @@ -261,7 +261,7 @@ status_t InputPublisher::reset() { result = sem_destroy(& mSharedMessage->semaphore); if (result < 0) { - LOGE("channel '%s' publisher ~ Error %d in sem_destroy.", + ALOGE("channel '%s' publisher ~ Error %d in sem_destroy.", mChannel->getName().string(), errno); return UNKNOWN_ERROR; } @@ -273,7 +273,7 @@ status_t InputPublisher::reset() { int ashmemFd = mChannel->getAshmemFd(); result = ashmem_unpin_region(ashmemFd, 0, 0); if (result < 0) { - LOGE("channel '%s' publisher ~ Error %d unpinning ashmem fd %d.", + ALOGE("channel '%s' publisher ~ Error %d unpinning ashmem fd %d.", mChannel->getName().string(), result, ashmemFd); return UNKNOWN_ERROR; } @@ -291,7 +291,7 @@ status_t InputPublisher::publishInputEvent( int32_t deviceId, int32_t source) { if (mPinned) { - LOGE("channel '%s' publisher ~ Attempted to publish a new event but publisher has " + ALOGE("channel '%s' publisher ~ Attempted to publish a new event but publisher has " "not yet been reset.", mChannel->getName().string()); return INVALID_OPERATION; } @@ -302,7 +302,7 @@ status_t InputPublisher::publishInputEvent( int ashmemFd = mChannel->getAshmemFd(); int result = ashmem_pin_region(ashmemFd, 0, 0); if (result < 0) { - LOGE("channel '%s' publisher ~ Error %d pinning ashmem fd %d.", + ALOGE("channel '%s' publisher ~ Error %d pinning ashmem fd %d.", mChannel->getName().string(), result, ashmemFd); return UNKNOWN_ERROR; } @@ -311,7 +311,7 @@ status_t InputPublisher::publishInputEvent( result = sem_init(& mSharedMessage->semaphore, 1, 1); if (result < 0) { - LOGE("channel '%s' publisher ~ Error %d in sem_init.", + ALOGE("channel '%s' publisher ~ Error %d in sem_init.", mChannel->getName().string(), errno); return UNKNOWN_ERROR; } @@ -337,7 +337,7 @@ status_t InputPublisher::publishKeyEvent( nsecs_t downTime, nsecs_t eventTime) { #if DEBUG_TRANSPORT_ACTIONS - LOGD("channel '%s' publisher ~ publishKeyEvent: deviceId=%d, source=0x%x, " + ALOGD("channel '%s' publisher ~ publishKeyEvent: deviceId=%d, source=0x%x, " "action=0x%x, flags=0x%x, keyCode=%d, scanCode=%d, metaState=0x%x, repeatCount=%d," "downTime=%lld, eventTime=%lld", mChannel->getName().string(), @@ -379,7 +379,7 @@ status_t InputPublisher::publishMotionEvent( const PointerProperties* pointerProperties, const PointerCoords* pointerCoords) { #if DEBUG_TRANSPORT_ACTIONS - LOGD("channel '%s' publisher ~ publishMotionEvent: deviceId=%d, source=0x%x, " + ALOGD("channel '%s' publisher ~ publishMotionEvent: deviceId=%d, source=0x%x, " "action=0x%x, flags=0x%x, edgeFlags=0x%x, metaState=0x%x, buttonState=0x%x, " "xOffset=%f, yOffset=%f, " "xPrecision=%f, yPrecision=%f, downTime=%lld, eventTime=%lld, " @@ -390,7 +390,7 @@ status_t InputPublisher::publishMotionEvent( #endif if (pointerCount > MAX_POINTERS || pointerCount < 1) { - LOGE("channel '%s' publisher ~ Invalid number of pointers provided: %d.", + ALOGE("channel '%s' publisher ~ Invalid number of pointers provided: %d.", mChannel->getName().string(), pointerCount); return BAD_VALUE; } @@ -439,12 +439,12 @@ status_t InputPublisher::appendMotionSample( nsecs_t eventTime, const PointerCoords* pointerCoords) { #if DEBUG_TRANSPORT_ACTIONS - LOGD("channel '%s' publisher ~ appendMotionSample: eventTime=%lld", + ALOGD("channel '%s' publisher ~ appendMotionSample: eventTime=%lld", mChannel->getName().string(), eventTime); #endif if (! mPinned || ! mMotionEventSampleDataTail) { - LOGE("channel '%s' publisher ~ Cannot append motion sample because there is no current " + ALOGE("channel '%s' publisher ~ Cannot append motion sample because there is no current " "AMOTION_EVENT_ACTION_MOVE or AMOTION_EVENT_ACTION_HOVER_MOVE event.", mChannel->getName().string()); return INVALID_OPERATION; @@ -457,7 +457,7 @@ status_t InputPublisher::appendMotionSample( if (newBytesUsed > mAshmemSize) { #if DEBUG_TRANSPORT_ACTIONS - LOGD("channel '%s' publisher ~ Cannot append motion sample because the shared memory " + ALOGD("channel '%s' publisher ~ Cannot append motion sample because the shared memory " "buffer is full. Buffer size: %d bytes, pointers: %d, samples: %d", mChannel->getName().string(), mAshmemSize, mMotionEventPointerCount, mSharedMessage->motion.sampleCount); @@ -473,12 +473,12 @@ status_t InputPublisher::appendMotionSample( // Only possible source of contention is the consumer having consumed (or being in the // process of consuming) the message and left the semaphore count at 0. #if DEBUG_TRANSPORT_ACTIONS - LOGD("channel '%s' publisher ~ Cannot append motion sample because the message has " + ALOGD("channel '%s' publisher ~ Cannot append motion sample because the message has " "already been consumed.", mChannel->getName().string()); #endif return FAILED_TRANSACTION; } else { - LOGE("channel '%s' publisher ~ Error %d in sem_trywait.", + ALOGE("channel '%s' publisher ~ Error %d in sem_trywait.", mChannel->getName().string(), errno); return UNKNOWN_ERROR; } @@ -496,7 +496,7 @@ status_t InputPublisher::appendMotionSample( if (mWasDispatched) { result = sem_post(& mSharedMessage->semaphore); if (result < 0) { - LOGE("channel '%s' publisher ~ Error %d in sem_post.", + ALOGE("channel '%s' publisher ~ Error %d in sem_post.", mChannel->getName().string(), errno); return UNKNOWN_ERROR; } @@ -506,7 +506,7 @@ status_t InputPublisher::appendMotionSample( status_t InputPublisher::sendDispatchSignal() { #if DEBUG_TRANSPORT_ACTIONS - LOGD("channel '%s' publisher ~ sendDispatchSignal", + ALOGD("channel '%s' publisher ~ sendDispatchSignal", mChannel->getName().string()); #endif @@ -516,7 +516,7 @@ status_t InputPublisher::sendDispatchSignal() { status_t InputPublisher::receiveFinishedSignal(bool* outHandled) { #if DEBUG_TRANSPORT_ACTIONS - LOGD("channel '%s' publisher ~ receiveFinishedSignal", + ALOGD("channel '%s' publisher ~ receiveFinishedSignal", mChannel->getName().string()); #endif @@ -531,7 +531,7 @@ status_t InputPublisher::receiveFinishedSignal(bool* outHandled) { } else if (signal == INPUT_SIGNAL_FINISHED_UNHANDLED) { *outHandled = false; } else { - LOGE("channel '%s' publisher ~ Received unexpected signal '%c' from consumer", + ALOGE("channel '%s' publisher ~ Received unexpected signal '%c' from consumer", mChannel->getName().string(), signal); return UNKNOWN_ERROR; } @@ -552,14 +552,14 @@ InputConsumer::~InputConsumer() { status_t InputConsumer::initialize() { #if DEBUG_TRANSPORT_ACTIONS - LOGD("channel '%s' consumer ~ initialize", + ALOGD("channel '%s' consumer ~ initialize", mChannel->getName().string()); #endif int ashmemFd = mChannel->getAshmemFd(); int result = ashmem_get_size_region(ashmemFd); if (result < 0) { - LOGE("channel '%s' consumer ~ Error %d getting size of ashmem fd %d.", + ALOGE("channel '%s' consumer ~ Error %d getting size of ashmem fd %d.", mChannel->getName().string(), result, ashmemFd); return UNKNOWN_ERROR; } @@ -569,7 +569,7 @@ status_t InputConsumer::initialize() { mSharedMessage = static_cast<InputMessage*>(mmap(NULL, mAshmemSize, PROT_READ | PROT_WRITE, MAP_SHARED, ashmemFd, 0)); if (! mSharedMessage) { - LOGE("channel '%s' consumer ~ mmap failed on ashmem fd %d.", + ALOGE("channel '%s' consumer ~ mmap failed on ashmem fd %d.", mChannel->getName().string(), ashmemFd); return NO_MEMORY; } @@ -579,7 +579,7 @@ status_t InputConsumer::initialize() { status_t InputConsumer::consume(InputEventFactoryInterface* factory, InputEvent** outEvent) { #if DEBUG_TRANSPORT_ACTIONS - LOGD("channel '%s' consumer ~ consume", + ALOGD("channel '%s' consumer ~ consume", mChannel->getName().string()); #endif @@ -589,19 +589,19 @@ status_t InputConsumer::consume(InputEventFactoryInterface* factory, InputEvent* int result = ashmem_pin_region(ashmemFd, 0, 0); if (result != ASHMEM_NOT_PURGED) { if (result == ASHMEM_WAS_PURGED) { - LOGE("channel '%s' consumer ~ Error %d pinning ashmem fd %d because it was purged " + ALOGE("channel '%s' consumer ~ Error %d pinning ashmem fd %d because it was purged " "which probably indicates that the publisher and consumer are out of sync.", mChannel->getName().string(), result, ashmemFd); return INVALID_OPERATION; } - LOGE("channel '%s' consumer ~ Error %d pinning ashmem fd %d.", + ALOGE("channel '%s' consumer ~ Error %d pinning ashmem fd %d.", mChannel->getName().string(), result, ashmemFd); return UNKNOWN_ERROR; } if (mSharedMessage->consumed) { - LOGE("channel '%s' consumer ~ The current message has already been consumed.", + ALOGE("channel '%s' consumer ~ The current message has already been consumed.", mChannel->getName().string()); return INVALID_OPERATION; } @@ -611,7 +611,7 @@ status_t InputConsumer::consume(InputEventFactoryInterface* factory, InputEvent* // consumed). Eventually the publisher will reinitialize the semaphore for the next message. result = sem_wait(& mSharedMessage->semaphore); if (result < 0) { - LOGE("channel '%s' consumer ~ Error %d in sem_wait.", + ALOGE("channel '%s' consumer ~ Error %d in sem_wait.", mChannel->getName().string(), errno); return UNKNOWN_ERROR; } @@ -640,7 +640,7 @@ status_t InputConsumer::consume(InputEventFactoryInterface* factory, InputEvent* } default: - LOGE("channel '%s' consumer ~ Received message of unknown type %d", + ALOGE("channel '%s' consumer ~ Received message of unknown type %d", mChannel->getName().string(), mSharedMessage->type); return UNKNOWN_ERROR; } @@ -650,7 +650,7 @@ status_t InputConsumer::consume(InputEventFactoryInterface* factory, InputEvent* status_t InputConsumer::sendFinishedSignal(bool handled) { #if DEBUG_TRANSPORT_ACTIONS - LOGD("channel '%s' consumer ~ sendFinishedSignal: handled=%d", + ALOGD("channel '%s' consumer ~ sendFinishedSignal: handled=%d", mChannel->getName().string(), handled); #endif @@ -661,7 +661,7 @@ status_t InputConsumer::sendFinishedSignal(bool handled) { status_t InputConsumer::receiveDispatchSignal() { #if DEBUG_TRANSPORT_ACTIONS - LOGD("channel '%s' consumer ~ receiveDispatchSignal", + ALOGD("channel '%s' consumer ~ receiveDispatchSignal", mChannel->getName().string()); #endif @@ -671,7 +671,7 @@ status_t InputConsumer::receiveDispatchSignal() { return result; } if (signal != INPUT_SIGNAL_DISPATCH) { - LOGE("channel '%s' consumer ~ Received unexpected signal '%c' from publisher", + ALOGE("channel '%s' consumer ~ Received unexpected signal '%c' from publisher", mChannel->getName().string(), signal); return UNKNOWN_ERROR; } diff --git a/libs/ui/KeyCharacterMap.cpp b/libs/ui/KeyCharacterMap.cpp index 77f18dec5c..485234c2ab 100644 --- a/libs/ui/KeyCharacterMap.cpp +++ b/libs/ui/KeyCharacterMap.cpp @@ -95,11 +95,11 @@ status_t KeyCharacterMap::load(const String8& filename, KeyCharacterMap** outMap Tokenizer* tokenizer; status_t status = Tokenizer::open(filename, &tokenizer); if (status) { - LOGE("Error %d opening key character map file %s.", status, filename.string()); + ALOGE("Error %d opening key character map file %s.", status, filename.string()); } else { KeyCharacterMap* map = new KeyCharacterMap(); if (!map) { - LOGE("Error allocating key character map."); + ALOGE("Error allocating key character map."); status = NO_MEMORY; } else { #if DEBUG_PARSER_PERFORMANCE @@ -109,7 +109,7 @@ status_t KeyCharacterMap::load(const String8& filename, KeyCharacterMap** outMap status = parser.parse(); #if DEBUG_PARSER_PERFORMANCE nsecs_t elapsedTime = systemTime(SYSTEM_TIME_MONOTONIC) - startTime; - LOGD("Parsed key character map file '%s' %d lines in %0.3fms.", + ALOGD("Parsed key character map file '%s' %d lines in %0.3fms.", tokenizer->getFilename().string(), tokenizer->getLineNumber(), elapsedTime / 1000000.0); #endif @@ -135,7 +135,7 @@ char16_t KeyCharacterMap::getDisplayLabel(int32_t keyCode) const { result = key->label; } #if DEBUG_MAPPING - LOGD("getDisplayLabel: keyCode=%d ~ Result %d.", keyCode, result); + ALOGD("getDisplayLabel: keyCode=%d ~ Result %d.", keyCode, result); #endif return result; } @@ -147,7 +147,7 @@ char16_t KeyCharacterMap::getNumber(int32_t keyCode) const { result = key->number; } #if DEBUG_MAPPING - LOGD("getNumber: keyCode=%d ~ Result %d.", keyCode, result); + ALOGD("getNumber: keyCode=%d ~ Result %d.", keyCode, result); #endif return result; } @@ -160,7 +160,7 @@ char16_t KeyCharacterMap::getCharacter(int32_t keyCode, int32_t metaState) const result = behavior->character; } #if DEBUG_MAPPING - LOGD("getCharacter: keyCode=%d, metaState=0x%08x ~ Result %d.", keyCode, metaState, result); + ALOGD("getCharacter: keyCode=%d, metaState=0x%08x ~ Result %d.", keyCode, metaState, result); #endif return result; } @@ -181,7 +181,7 @@ bool KeyCharacterMap::getFallbackAction(int32_t keyCode, int32_t metaState, } } #if DEBUG_MAPPING - LOGD("getFallbackKeyCode: keyCode=%d, metaState=0x%08x ~ Result %s, " + ALOGD("getFallbackKeyCode: keyCode=%d, metaState=0x%08x ~ Result %s, " "fallback keyCode=%d, fallback metaState=0x%08x.", keyCode, metaState, result ? "true" : "false", outFallbackAction->keyCode, outFallbackAction->metaState); @@ -213,7 +213,7 @@ char16_t KeyCharacterMap::getMatch(int32_t keyCode, const char16_t* chars, size_ ExactMatch: ; } #if DEBUG_MAPPING - LOGD("getMatch: keyCode=%d, chars=[%s], metaState=0x%08x ~ Result %d.", + ALOGD("getMatch: keyCode=%d, chars=[%s], metaState=0x%08x ~ Result %d.", keyCode, toString(chars, numChars).string(), metaState, result); #endif return result; @@ -228,7 +228,7 @@ bool KeyCharacterMap::getEvents(int32_t deviceId, const char16_t* chars, size_t char16_t ch = chars[i]; if (!findKey(ch, &keyCode, &metaState)) { #if DEBUG_MAPPING - LOGD("getEvents: deviceId=%d, chars=[%s] ~ Failed to find mapping for character %d.", + ALOGD("getEvents: deviceId=%d, chars=[%s] ~ Failed to find mapping for character %d.", deviceId, toString(chars, numChars).string(), ch); #endif return false; @@ -241,10 +241,10 @@ bool KeyCharacterMap::getEvents(int32_t deviceId, const char16_t* chars, size_t addMetaKeys(outEvents, deviceId, metaState, false, now, ¤tMetaState); } #if DEBUG_MAPPING - LOGD("getEvents: deviceId=%d, chars=[%s] ~ Generated %d events.", + ALOGD("getEvents: deviceId=%d, chars=[%s] ~ Generated %d events.", deviceId, toString(chars, numChars).string(), int32_t(outEvents.size())); for (size_t i = 0; i < outEvents.size(); i++) { - LOGD(" Key: keyCode=%d, metaState=0x%08x, %s.", + ALOGD(" Key: keyCode=%d, metaState=0x%08x, %s.", outEvents[i].getKeyCode(), outEvents[i].getMetaState(), outEvents[i].getAction() == AKEY_EVENT_ACTION_DOWN ? "down" : "up"); } @@ -455,7 +455,7 @@ KeyCharacterMap::Parser::~Parser() { status_t KeyCharacterMap::Parser::parse() { while (!mTokenizer->isEof()) { #if DEBUG_PARSER - LOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(), + ALOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(), mTokenizer->peekRemainderOfLine().string()); #endif @@ -474,7 +474,7 @@ status_t KeyCharacterMap::Parser::parse() { status_t status = parseKey(); if (status) return status; } else { - LOGE("%s: Expected keyword, got '%s'.", mTokenizer->getLocation().string(), + ALOGE("%s: Expected keyword, got '%s'.", mTokenizer->getLocation().string(), keywordToken.string()); return BAD_VALUE; } @@ -490,7 +490,7 @@ status_t KeyCharacterMap::Parser::parse() { mTokenizer->skipDelimiters(WHITESPACE); if (!mTokenizer->isEol()) { - LOGE("%s: Expected end of line, got '%s'.", + ALOGE("%s: Expected end of line, got '%s'.", mTokenizer->getLocation().string(), mTokenizer->peekRemainderOfLine().string()); return BAD_VALUE; @@ -501,13 +501,13 @@ status_t KeyCharacterMap::Parser::parse() { } if (mState != STATE_TOP) { - LOGE("%s: Unterminated key description at end of file.", + ALOGE("%s: Unterminated key description at end of file.", mTokenizer->getLocation().string()); return BAD_VALUE; } if (mMap->mType == KEYBOARD_TYPE_UNKNOWN) { - LOGE("%s: Missing required keyboard 'type' declaration.", + ALOGE("%s: Missing required keyboard 'type' declaration.", mTokenizer->getLocation().string()); return BAD_VALUE; } @@ -517,7 +517,7 @@ status_t KeyCharacterMap::Parser::parse() { status_t KeyCharacterMap::Parser::parseType() { if (mMap->mType != KEYBOARD_TYPE_UNKNOWN) { - LOGE("%s: Duplicate keyboard 'type' declaration.", + ALOGE("%s: Duplicate keyboard 'type' declaration.", mTokenizer->getLocation().string()); return BAD_VALUE; } @@ -535,13 +535,13 @@ status_t KeyCharacterMap::Parser::parseType() { } else if (typeToken == "SPECIAL_FUNCTION") { type = KEYBOARD_TYPE_SPECIAL_FUNCTION; } else { - LOGE("%s: Expected keyboard type label, got '%s'.", mTokenizer->getLocation().string(), + ALOGE("%s: Expected keyboard type label, got '%s'.", mTokenizer->getLocation().string(), typeToken.string()); return BAD_VALUE; } #if DEBUG_PARSER - LOGD("Parsed type: type=%d.", type); + ALOGD("Parsed type: type=%d.", type); #endif mMap->mType = type; return NO_ERROR; @@ -551,12 +551,12 @@ status_t KeyCharacterMap::Parser::parseKey() { String8 keyCodeToken = mTokenizer->nextToken(WHITESPACE); int32_t keyCode = getKeyCodeByLabel(keyCodeToken.string()); if (!keyCode) { - LOGE("%s: Expected key code label, got '%s'.", mTokenizer->getLocation().string(), + ALOGE("%s: Expected key code label, got '%s'.", mTokenizer->getLocation().string(), keyCodeToken.string()); return BAD_VALUE; } if (mMap->mKeys.indexOfKey(keyCode) >= 0) { - LOGE("%s: Duplicate entry for key code '%s'.", mTokenizer->getLocation().string(), + ALOGE("%s: Duplicate entry for key code '%s'.", mTokenizer->getLocation().string(), keyCodeToken.string()); return BAD_VALUE; } @@ -564,13 +564,13 @@ status_t KeyCharacterMap::Parser::parseKey() { mTokenizer->skipDelimiters(WHITESPACE); String8 openBraceToken = mTokenizer->nextToken(WHITESPACE); if (openBraceToken != "{") { - LOGE("%s: Expected '{' after key code label, got '%s'.", + ALOGE("%s: Expected '{' after key code label, got '%s'.", mTokenizer->getLocation().string(), openBraceToken.string()); return BAD_VALUE; } #if DEBUG_PARSER - LOGD("Parsed beginning of key: keyCode=%d.", keyCode); + ALOGD("Parsed beginning of key: keyCode=%d.", keyCode); #endif mKeyCode = keyCode; mMap->mKeys.add(keyCode, new Key()); @@ -597,7 +597,7 @@ status_t KeyCharacterMap::Parser::parseKeyProperty() { int32_t metaState; status_t status = parseModifier(token, &metaState); if (status) { - LOGE("%s: Expected a property name or modifier, got '%s'.", + ALOGE("%s: Expected a property name or modifier, got '%s'.", mTokenizer->getLocation().string(), token.string()); return status; } @@ -616,7 +616,7 @@ status_t KeyCharacterMap::Parser::parseKeyProperty() { } } - LOGE("%s: Expected ',' or ':' after property name.", + ALOGE("%s: Expected ',' or ':' after property name.", mTokenizer->getLocation().string()); return BAD_VALUE; } @@ -634,12 +634,12 @@ status_t KeyCharacterMap::Parser::parseKeyProperty() { char16_t character; status_t status = parseCharacterLiteral(&character); if (status || !character) { - LOGE("%s: Invalid character literal for key.", + ALOGE("%s: Invalid character literal for key.", mTokenizer->getLocation().string()); return BAD_VALUE; } if (haveCharacter) { - LOGE("%s: Cannot combine multiple character literals or 'none'.", + ALOGE("%s: Cannot combine multiple character literals or 'none'.", mTokenizer->getLocation().string()); return BAD_VALUE; } @@ -649,7 +649,7 @@ status_t KeyCharacterMap::Parser::parseKeyProperty() { token = mTokenizer->nextToken(WHITESPACE); if (token == "none") { if (haveCharacter) { - LOGE("%s: Cannot combine multiple character literals or 'none'.", + ALOGE("%s: Cannot combine multiple character literals or 'none'.", mTokenizer->getLocation().string()); return BAD_VALUE; } @@ -659,20 +659,20 @@ status_t KeyCharacterMap::Parser::parseKeyProperty() { token = mTokenizer->nextToken(WHITESPACE); int32_t keyCode = getKeyCodeByLabel(token.string()); if (!keyCode) { - LOGE("%s: Invalid key code label for fallback behavior, got '%s'.", + ALOGE("%s: Invalid key code label for fallback behavior, got '%s'.", mTokenizer->getLocation().string(), token.string()); return BAD_VALUE; } if (haveFallback) { - LOGE("%s: Cannot combine multiple fallback key codes.", + ALOGE("%s: Cannot combine multiple fallback key codes.", mTokenizer->getLocation().string()); return BAD_VALUE; } behavior.fallbackKeyCode = keyCode; haveFallback = true; } else { - LOGE("%s: Expected a key behavior after ':'.", + ALOGE("%s: Expected a key behavior after ':'.", mTokenizer->getLocation().string()); return BAD_VALUE; } @@ -688,30 +688,30 @@ status_t KeyCharacterMap::Parser::parseKeyProperty() { switch (property.property) { case PROPERTY_LABEL: if (key->label) { - LOGE("%s: Duplicate label for key.", + ALOGE("%s: Duplicate label for key.", mTokenizer->getLocation().string()); return BAD_VALUE; } key->label = behavior.character; #if DEBUG_PARSER - LOGD("Parsed key label: keyCode=%d, label=%d.", mKeyCode, key->label); + ALOGD("Parsed key label: keyCode=%d, label=%d.", mKeyCode, key->label); #endif break; case PROPERTY_NUMBER: if (key->number) { - LOGE("%s: Duplicate number for key.", + ALOGE("%s: Duplicate number for key.", mTokenizer->getLocation().string()); return BAD_VALUE; } key->number = behavior.character; #if DEBUG_PARSER - LOGD("Parsed key number: keyCode=%d, number=%d.", mKeyCode, key->number); + ALOGD("Parsed key number: keyCode=%d, number=%d.", mKeyCode, key->number); #endif break; case PROPERTY_META: { for (Behavior* b = key->firstBehavior; b; b = b->next) { if (b->metaState == property.metaState) { - LOGE("%s: Duplicate key behavior for modifier.", + ALOGE("%s: Duplicate key behavior for modifier.", mTokenizer->getLocation().string()); return BAD_VALUE; } @@ -721,7 +721,7 @@ status_t KeyCharacterMap::Parser::parseKeyProperty() { newBehavior->next = key->firstBehavior; key->firstBehavior = newBehavior; #if DEBUG_PARSER - LOGD("Parsed key meta: keyCode=%d, meta=0x%x, char=%d, fallback=%d.", mKeyCode, + ALOGD("Parsed key meta: keyCode=%d, meta=0x%x, char=%d, fallback=%d.", mKeyCode, newBehavior->metaState, newBehavior->character, newBehavior->fallbackKeyCode); #endif break; @@ -757,7 +757,7 @@ status_t KeyCharacterMap::Parser::parseModifier(const String8& token, int32_t* o return BAD_VALUE; } if (combinedMeta & metaState) { - LOGE("%s: Duplicate modifier combination '%s'.", + ALOGE("%s: Duplicate modifier combination '%s'.", mTokenizer->getLocation().string(), token.string()); return BAD_VALUE; } @@ -831,7 +831,7 @@ status_t KeyCharacterMap::Parser::parseCharacterLiteral(char16_t* outCharacter) } Error: - LOGE("%s: Malformed character literal.", mTokenizer->getLocation().string()); + ALOGE("%s: Malformed character literal.", mTokenizer->getLocation().string()); return BAD_VALUE; } diff --git a/libs/ui/KeyLayoutMap.cpp b/libs/ui/KeyLayoutMap.cpp index 8626a03bf8..44a94207c1 100644 --- a/libs/ui/KeyLayoutMap.cpp +++ b/libs/ui/KeyLayoutMap.cpp @@ -53,11 +53,11 @@ status_t KeyLayoutMap::load(const String8& filename, KeyLayoutMap** outMap) { Tokenizer* tokenizer; status_t status = Tokenizer::open(filename, &tokenizer); if (status) { - LOGE("Error %d opening key layout map file %s.", status, filename.string()); + ALOGE("Error %d opening key layout map file %s.", status, filename.string()); } else { KeyLayoutMap* map = new KeyLayoutMap(); if (!map) { - LOGE("Error allocating key layout map."); + ALOGE("Error allocating key layout map."); status = NO_MEMORY; } else { #if DEBUG_PARSER_PERFORMANCE @@ -67,7 +67,7 @@ status_t KeyLayoutMap::load(const String8& filename, KeyLayoutMap** outMap) { status = parser.parse(); #if DEBUG_PARSER_PERFORMANCE nsecs_t elapsedTime = systemTime(SYSTEM_TIME_MONOTONIC) - startTime; - LOGD("Parsed key layout map file '%s' %d lines in %0.3fms.", + ALOGD("Parsed key layout map file '%s' %d lines in %0.3fms.", tokenizer->getFilename().string(), tokenizer->getLineNumber(), elapsedTime / 1000000.0); #endif @@ -86,7 +86,7 @@ status_t KeyLayoutMap::mapKey(int32_t scanCode, int32_t* keyCode, uint32_t* flag ssize_t index = mKeys.indexOfKey(scanCode); if (index < 0) { #if DEBUG_MAPPING - LOGD("mapKey: scanCode=%d ~ Failed.", scanCode); + ALOGD("mapKey: scanCode=%d ~ Failed.", scanCode); #endif *keyCode = AKEYCODE_UNKNOWN; *flags = 0; @@ -98,7 +98,7 @@ status_t KeyLayoutMap::mapKey(int32_t scanCode, int32_t* keyCode, uint32_t* flag *flags = k.flags; #if DEBUG_MAPPING - LOGD("mapKey: scanCode=%d ~ Result keyCode=%d, flags=0x%08x.", scanCode, *keyCode, *flags); + ALOGD("mapKey: scanCode=%d ~ Result keyCode=%d, flags=0x%08x.", scanCode, *keyCode, *flags); #endif return NO_ERROR; } @@ -117,7 +117,7 @@ status_t KeyLayoutMap::mapAxis(int32_t scanCode, AxisInfo* outAxisInfo) const { ssize_t index = mAxes.indexOfKey(scanCode); if (index < 0) { #if DEBUG_MAPPING - LOGD("mapAxis: scanCode=%d ~ Failed.", scanCode); + ALOGD("mapAxis: scanCode=%d ~ Failed.", scanCode); #endif return NAME_NOT_FOUND; } @@ -125,7 +125,7 @@ status_t KeyLayoutMap::mapAxis(int32_t scanCode, AxisInfo* outAxisInfo) const { *outAxisInfo = mAxes.valueAt(index); #if DEBUG_MAPPING - LOGD("mapAxis: scanCode=%d ~ Result mode=%d, axis=%d, highAxis=%d, " + ALOGD("mapAxis: scanCode=%d ~ Result mode=%d, axis=%d, highAxis=%d, " "splitValue=%d, flatOverride=%d.", scanCode, outAxisInfo->mode, outAxisInfo->axis, outAxisInfo->highAxis, @@ -147,7 +147,7 @@ KeyLayoutMap::Parser::~Parser() { status_t KeyLayoutMap::Parser::parse() { while (!mTokenizer->isEof()) { #if DEBUG_PARSER - LOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(), + ALOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(), mTokenizer->peekRemainderOfLine().string()); #endif @@ -164,14 +164,14 @@ status_t KeyLayoutMap::Parser::parse() { status_t status = parseAxis(); if (status) return status; } else { - LOGE("%s: Expected keyword, got '%s'.", mTokenizer->getLocation().string(), + ALOGE("%s: Expected keyword, got '%s'.", mTokenizer->getLocation().string(), keywordToken.string()); return BAD_VALUE; } mTokenizer->skipDelimiters(WHITESPACE); if (!mTokenizer->isEol()) { - LOGE("%s: Expected end of line, got '%s'.", + ALOGE("%s: Expected end of line, got '%s'.", mTokenizer->getLocation().string(), mTokenizer->peekRemainderOfLine().string()); return BAD_VALUE; @@ -188,12 +188,12 @@ status_t KeyLayoutMap::Parser::parseKey() { char* end; int32_t scanCode = int32_t(strtol(scanCodeToken.string(), &end, 0)); if (*end) { - LOGE("%s: Expected key scan code number, got '%s'.", mTokenizer->getLocation().string(), + ALOGE("%s: Expected key scan code number, got '%s'.", mTokenizer->getLocation().string(), scanCodeToken.string()); return BAD_VALUE; } if (mMap->mKeys.indexOfKey(scanCode) >= 0) { - LOGE("%s: Duplicate entry for key scan code '%s'.", mTokenizer->getLocation().string(), + ALOGE("%s: Duplicate entry for key scan code '%s'.", mTokenizer->getLocation().string(), scanCodeToken.string()); return BAD_VALUE; } @@ -202,7 +202,7 @@ status_t KeyLayoutMap::Parser::parseKey() { String8 keyCodeToken = mTokenizer->nextToken(WHITESPACE); int32_t keyCode = getKeyCodeByLabel(keyCodeToken.string()); if (!keyCode) { - LOGE("%s: Expected key code label, got '%s'.", mTokenizer->getLocation().string(), + ALOGE("%s: Expected key code label, got '%s'.", mTokenizer->getLocation().string(), keyCodeToken.string()); return BAD_VALUE; } @@ -215,12 +215,12 @@ status_t KeyLayoutMap::Parser::parseKey() { String8 flagToken = mTokenizer->nextToken(WHITESPACE); uint32_t flag = getKeyFlagByLabel(flagToken.string()); if (!flag) { - LOGE("%s: Expected key flag label, got '%s'.", mTokenizer->getLocation().string(), + ALOGE("%s: Expected key flag label, got '%s'.", mTokenizer->getLocation().string(), flagToken.string()); return BAD_VALUE; } if (flags & flag) { - LOGE("%s: Duplicate key flag '%s'.", mTokenizer->getLocation().string(), + ALOGE("%s: Duplicate key flag '%s'.", mTokenizer->getLocation().string(), flagToken.string()); return BAD_VALUE; } @@ -228,7 +228,7 @@ status_t KeyLayoutMap::Parser::parseKey() { } #if DEBUG_PARSER - LOGD("Parsed key: scanCode=%d, keyCode=%d, flags=0x%08x.", scanCode, keyCode, flags); + ALOGD("Parsed key: scanCode=%d, keyCode=%d, flags=0x%08x.", scanCode, keyCode, flags); #endif Key key; key.keyCode = keyCode; @@ -242,12 +242,12 @@ status_t KeyLayoutMap::Parser::parseAxis() { char* end; int32_t scanCode = int32_t(strtol(scanCodeToken.string(), &end, 0)); if (*end) { - LOGE("%s: Expected axis scan code number, got '%s'.", mTokenizer->getLocation().string(), + ALOGE("%s: Expected axis scan code number, got '%s'.", mTokenizer->getLocation().string(), scanCodeToken.string()); return BAD_VALUE; } if (mMap->mAxes.indexOfKey(scanCode) >= 0) { - LOGE("%s: Duplicate entry for axis scan code '%s'.", mTokenizer->getLocation().string(), + ALOGE("%s: Duplicate entry for axis scan code '%s'.", mTokenizer->getLocation().string(), scanCodeToken.string()); return BAD_VALUE; } @@ -263,7 +263,7 @@ status_t KeyLayoutMap::Parser::parseAxis() { String8 axisToken = mTokenizer->nextToken(WHITESPACE); axisInfo.axis = getAxisByLabel(axisToken.string()); if (axisInfo.axis < 0) { - LOGE("%s: Expected inverted axis label, got '%s'.", + ALOGE("%s: Expected inverted axis label, got '%s'.", mTokenizer->getLocation().string(), axisToken.string()); return BAD_VALUE; } @@ -274,7 +274,7 @@ status_t KeyLayoutMap::Parser::parseAxis() { String8 splitToken = mTokenizer->nextToken(WHITESPACE); axisInfo.splitValue = int32_t(strtol(splitToken.string(), &end, 0)); if (*end) { - LOGE("%s: Expected split value, got '%s'.", + ALOGE("%s: Expected split value, got '%s'.", mTokenizer->getLocation().string(), splitToken.string()); return BAD_VALUE; } @@ -283,7 +283,7 @@ status_t KeyLayoutMap::Parser::parseAxis() { String8 lowAxisToken = mTokenizer->nextToken(WHITESPACE); axisInfo.axis = getAxisByLabel(lowAxisToken.string()); if (axisInfo.axis < 0) { - LOGE("%s: Expected low axis label, got '%s'.", + ALOGE("%s: Expected low axis label, got '%s'.", mTokenizer->getLocation().string(), lowAxisToken.string()); return BAD_VALUE; } @@ -292,14 +292,14 @@ status_t KeyLayoutMap::Parser::parseAxis() { String8 highAxisToken = mTokenizer->nextToken(WHITESPACE); axisInfo.highAxis = getAxisByLabel(highAxisToken.string()); if (axisInfo.highAxis < 0) { - LOGE("%s: Expected high axis label, got '%s'.", + ALOGE("%s: Expected high axis label, got '%s'.", mTokenizer->getLocation().string(), highAxisToken.string()); return BAD_VALUE; } } else { axisInfo.axis = getAxisByLabel(token.string()); if (axisInfo.axis < 0) { - LOGE("%s: Expected axis label, 'split' or 'invert', got '%s'.", + ALOGE("%s: Expected axis label, 'split' or 'invert', got '%s'.", mTokenizer->getLocation().string(), token.string()); return BAD_VALUE; } @@ -316,19 +316,19 @@ status_t KeyLayoutMap::Parser::parseAxis() { String8 flatToken = mTokenizer->nextToken(WHITESPACE); axisInfo.flatOverride = int32_t(strtol(flatToken.string(), &end, 0)); if (*end) { - LOGE("%s: Expected flat value, got '%s'.", + ALOGE("%s: Expected flat value, got '%s'.", mTokenizer->getLocation().string(), flatToken.string()); return BAD_VALUE; } } else { - LOGE("%s: Expected keyword 'flat', got '%s'.", + ALOGE("%s: Expected keyword 'flat', got '%s'.", mTokenizer->getLocation().string(), keywordToken.string()); return BAD_VALUE; } } #if DEBUG_PARSER - LOGD("Parsed axis: scanCode=%d, mode=%d, axis=%d, highAxis=%d, " + ALOGD("Parsed axis: scanCode=%d, mode=%d, axis=%d, highAxis=%d, " "splitValue=%d, flatOverride=%d.", scanCode, axisInfo.mode, axisInfo.axis, axisInfo.highAxis, diff --git a/libs/ui/Keyboard.cpp b/libs/ui/Keyboard.cpp index 10bb39c575..e4611f71cb 100644 --- a/libs/ui/Keyboard.cpp +++ b/libs/ui/Keyboard.cpp @@ -50,7 +50,7 @@ status_t KeyMap::load(const InputDeviceIdentifier& deviceIdenfifier, keyLayoutName)) { status_t status = loadKeyLayout(deviceIdenfifier, keyLayoutName); if (status == NAME_NOT_FOUND) { - LOGE("Configuration for keyboard device '%s' requested keyboard layout '%s' but " + ALOGE("Configuration for keyboard device '%s' requested keyboard layout '%s' but " "it was not found.", deviceIdenfifier.name.string(), keyLayoutName.string()); } @@ -61,7 +61,7 @@ status_t KeyMap::load(const InputDeviceIdentifier& deviceIdenfifier, keyCharacterMapName)) { status_t status = loadKeyCharacterMap(deviceIdenfifier, keyCharacterMapName); if (status == NAME_NOT_FOUND) { - LOGE("Configuration for keyboard device '%s' requested keyboard character " + ALOGE("Configuration for keyboard device '%s' requested keyboard character " "map '%s' but it was not found.", deviceIdenfifier.name.string(), keyLayoutName.string()); } @@ -90,7 +90,7 @@ status_t KeyMap::load(const InputDeviceIdentifier& deviceIdenfifier, } // Give up! - LOGE("Could not determine key map for device '%s' and no default key maps were found!", + ALOGE("Could not determine key map for device '%s' and no default key maps were found!", deviceIdenfifier.name.string()); return NAME_NOT_FOUND; } diff --git a/libs/ui/Region.cpp b/libs/ui/Region.cpp index 565608889d..8cd047afb8 100644 --- a/libs/ui/Region.cpp +++ b/libs/ui/Region.cpp @@ -69,7 +69,7 @@ Region::Region(const Rect& rhs) Region::Region(const void* buffer) { status_t err = read(buffer); - LOGE_IF(err<0, "error %s reading Region from buffer", strerror(err)); + ALOGE_IF(err<0, "error %s reading Region from buffer", strerror(err)); } Region::~Region() @@ -272,7 +272,7 @@ public: } virtual void operator()(const Rect& rect) { - //LOGD(">>> %3d, %3d, %3d, %3d", + //ALOGD(">>> %3d, %3d, %3d, %3d", // rect.left, rect.top, rect.right, rect.bottom); if (span.size()) { if (cur->top != rect.top) { @@ -338,15 +338,15 @@ bool Region::validate(const Region& reg, const char* name) b.bottom = b.bottom > cur->bottom ? b.bottom : cur->bottom; if (cur->top == prev->top) { if (cur->bottom != prev->bottom) { - LOGE("%s: invalid span %p", name, cur); + ALOGE("%s: invalid span %p", name, cur); result = false; } else if (cur->left < prev->right) { - LOGE("%s: spans overlap horizontally prev=%p, cur=%p", + ALOGE("%s: spans overlap horizontally prev=%p, cur=%p", name, prev, cur); result = false; } } else if (cur->top < prev->bottom) { - LOGE("%s: spans overlap vertically prev=%p, cur=%p", + ALOGE("%s: spans overlap vertically prev=%p, cur=%p", name, prev, cur); result = false; } @@ -355,7 +355,7 @@ bool Region::validate(const Region& reg, const char* name) } if (b != reg.getBounds()) { result = false; - LOGE("%s: invalid bounds [%d,%d,%d,%d] vs. [%d,%d,%d,%d]", name, + ALOGE("%s: invalid bounds [%d,%d,%d,%d] vs. [%d,%d,%d,%d]", name, b.left, b.top, b.right, b.bottom, reg.getBounds().left, reg.getBounds().top, reg.getBounds().right, reg.getBounds().bottom); @@ -457,14 +457,14 @@ void Region::boolean_operation(int op, Region& dst, } if(!same) { - LOGD("---\nregion boolean %s failed", name); + ALOGD("---\nregion boolean %s failed", name); lhs.dump("lhs"); rhs.dump("rhs"); dst.dump("dst"); - LOGD("should be"); + ALOGD("should be"); SkRegion::Iterator it(sk_dst); while (!it.done()) { - LOGD(" [%3d, %3d, %3d, %3d]", + ALOGD(" [%3d, %3d, %3d, %3d]", it.rect().fLeft, it.rect().fTop, it.rect().fRight, @@ -480,7 +480,7 @@ void Region::boolean_operation(int op, Region& dst, const Rect& rhs, int dx, int dy) { if (!rhs.isValid()) { - LOGE("Region::boolean_operation(op=%d) invalid Rect={%d,%d,%d,%d}", + ALOGE("Region::boolean_operation(op=%d) invalid Rect={%d,%d,%d,%d}", op, rhs.left, rhs.top, rhs.right, rhs.bottom); return; } @@ -647,9 +647,9 @@ void Region::dump(const char* what, uint32_t flags) const (void)flags; const_iterator head = begin(); const_iterator const tail = end(); - LOGD(" Region %s (this=%p, count=%d)\n", what, this, tail-head); + ALOGD(" Region %s (this=%p, count=%d)\n", what, this, tail-head); while (head != tail) { - LOGD(" [%3d, %3d, %3d, %3d]\n", + ALOGD(" [%3d, %3d, %3d, %3d]\n", head->left, head->top, head->right, head->bottom); head++; } diff --git a/libs/ui/VirtualKeyMap.cpp b/libs/ui/VirtualKeyMap.cpp index e756cdd782..62d5b593b2 100644 --- a/libs/ui/VirtualKeyMap.cpp +++ b/libs/ui/VirtualKeyMap.cpp @@ -51,11 +51,11 @@ status_t VirtualKeyMap::load(const String8& filename, VirtualKeyMap** outMap) { Tokenizer* tokenizer; status_t status = Tokenizer::open(filename, &tokenizer); if (status) { - LOGE("Error %d opening virtual key map file %s.", status, filename.string()); + ALOGE("Error %d opening virtual key map file %s.", status, filename.string()); } else { VirtualKeyMap* map = new VirtualKeyMap(); if (!map) { - LOGE("Error allocating virtual key map."); + ALOGE("Error allocating virtual key map."); status = NO_MEMORY; } else { #if DEBUG_PARSER_PERFORMANCE @@ -65,7 +65,7 @@ status_t VirtualKeyMap::load(const String8& filename, VirtualKeyMap** outMap) { status = parser.parse(); #if DEBUG_PARSER_PERFORMANCE nsecs_t elapsedTime = systemTime(SYSTEM_TIME_MONOTONIC) - startTime; - LOGD("Parsed key character map file '%s' %d lines in %0.3fms.", + ALOGD("Parsed key character map file '%s' %d lines in %0.3fms.", tokenizer->getFilename().string(), tokenizer->getLineNumber(), elapsedTime / 1000000.0); #endif @@ -93,7 +93,7 @@ VirtualKeyMap::Parser::~Parser() { status_t VirtualKeyMap::Parser::parse() { while (!mTokenizer->isEof()) { #if DEBUG_PARSER - LOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(), + ALOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(), mTokenizer->peekRemainderOfLine().string()); #endif @@ -104,7 +104,7 @@ status_t VirtualKeyMap::Parser::parse() { do { String8 token = mTokenizer->nextToken(WHITESPACE_OR_FIELD_DELIMITER); if (token != "0x01") { - LOGE("%s: Unknown virtual key type, expected 0x01.", + ALOGE("%s: Unknown virtual key type, expected 0x01.", mTokenizer->getLocation().string()); return BAD_VALUE; } @@ -116,13 +116,13 @@ status_t VirtualKeyMap::Parser::parse() { && parseNextIntField(&defn.width) && parseNextIntField(&defn.height); if (!success) { - LOGE("%s: Expected 5 colon-delimited integers in virtual key definition.", + ALOGE("%s: Expected 5 colon-delimited integers in virtual key definition.", mTokenizer->getLocation().string()); return BAD_VALUE; } #if DEBUG_PARSER - LOGD("Parsed virtual key: scanCode=%d, centerX=%d, centerY=%d, " + ALOGD("Parsed virtual key: scanCode=%d, centerX=%d, centerY=%d, " "width=%d, height=%d", defn.scanCode, defn.centerX, defn.centerY, defn.width, defn.height); #endif @@ -130,7 +130,7 @@ status_t VirtualKeyMap::Parser::parse() { } while (consumeFieldDelimiterAndSkipWhitespace()); if (!mTokenizer->isEol()) { - LOGE("%s: Expected end of line, got '%s'.", + ALOGE("%s: Expected end of line, got '%s'.", mTokenizer->getLocation().string(), mTokenizer->peekRemainderOfLine().string()); return BAD_VALUE; @@ -162,7 +162,7 @@ bool VirtualKeyMap::Parser::parseNextIntField(int32_t* outValue) { char* end; *outValue = strtol(token.string(), &end, 0); if (token.isEmpty() || *end != '\0') { - LOGE("Expected an integer, got '%s'.", token.string()); + ALOGE("Expected an integer, got '%s'.", token.string()); return false; } return true; diff --git a/libs/ui/tests/region/region.cpp b/libs/ui/tests/region/region.cpp index ef15de9747..6347294ce9 100644 --- a/libs/ui/tests/region/region.cpp +++ b/libs/ui/tests/region/region.cpp @@ -58,7 +58,7 @@ int main() //reg2.dump("reg2"); //reg3.dump("reg3"); - LOGD("---"); + ALOGD("---"); reg2 = reg0 | reg0.translate(100, 0); reg0.dump("reg0"); reg1.dump("reg1"); diff --git a/libs/utils/Android.mk b/libs/utils/Android.mk index 831d9e3789..544ab744e3 100644 --- a/libs/utils/Android.mk +++ b/libs/utils/Android.mk @@ -21,6 +21,7 @@ commonSources:= \ Asset.cpp \ AssetDir.cpp \ AssetManager.cpp \ + BasicHashtable.cpp \ BlobCache.cpp \ BufferedTextOutput.cpp \ CallStack.cpp \ @@ -105,7 +106,8 @@ LOCAL_SHARED_LIBRARIES := \ libz \ liblog \ libcutils \ - libdl + libdl \ + libcorkscrew LOCAL_MODULE:= libutils include $(BUILD_SHARED_LIBRARY) diff --git a/libs/utils/Asset.cpp b/libs/utils/Asset.cpp index a18294b18c..50e701aa8d 100644 --- a/libs/utils/Asset.cpp +++ b/libs/utils/Asset.cpp @@ -89,7 +89,7 @@ Asset::Asset(void) gTail->mNext = this; gTail = this; } - //LOGI("Creating Asset %p #%d\n", this, gCount); + //ALOGI("Creating Asset %p #%d\n", this, gCount); } Asset::~Asset(void) @@ -109,7 +109,7 @@ Asset::~Asset(void) mPrev->mNext = mNext; } mNext = mPrev = NULL; - //LOGI("Destroying Asset in %p #%d\n", this, gCount); + //ALOGI("Destroying Asset in %p #%d\n", this, gCount); } /* @@ -210,7 +210,7 @@ Asset::~Asset(void) offset = ftell(fp); fclose(fp); if (!scanResult) { - LOGD("File '%s' is not in gzip format\n", fileName); + ALOGD("File '%s' is not in gzip format\n", fileName); ::close(fd); return NULL; } @@ -327,14 +327,14 @@ off64_t Asset::handleSeek(off64_t offset, int whence, off64_t curPosn, off64_t m newOffset = maxPosn + offset; break; default: - LOGW("unexpected whence %d\n", whence); + ALOGW("unexpected whence %d\n", whence); // this was happening due to an off64_t size mismatch assert(false); return (off64_t) -1; } if (newOffset < 0 || newOffset > maxPosn) { - LOGW("seek out of range: want %ld, end=%ld\n", + ALOGW("seek out of range: want %ld, end=%ld\n", (long) newOffset, (long) maxPosn); return (off64_t) -1; } @@ -384,12 +384,12 @@ status_t _FileAsset::openChunk(const char* fileName, int fd, off64_t offset, siz fileLength = lseek64(fd, 0, SEEK_END); if (fileLength == (off64_t) -1) { // probably a bad file descriptor - LOGD("failed lseek (errno=%d)\n", errno); + ALOGD("failed lseek (errno=%d)\n", errno); return UNKNOWN_ERROR; } if ((off64_t) (offset + length) > fileLength) { - LOGD("start (%ld) + len (%ld) > end (%ld)\n", + ALOGD("start (%ld) + len (%ld) > end (%ld)\n", (long) offset, (long) length, (long) fileLength); return BAD_INDEX; } @@ -473,7 +473,7 @@ ssize_t _FileAsset::read(void* buf, size_t count) /* read from the file */ //printf("file read\n"); if (ftell(mFp) != mStart + mOffset) { - LOGE("Hosed: %ld != %ld+%ld\n", + ALOGE("Hosed: %ld != %ld+%ld\n", ftell(mFp), (long) mStart, (long) mOffset); assert(false); } @@ -581,23 +581,23 @@ const void* _FileAsset::getBuffer(bool wordAligned) buf = new unsigned char[allocLen]; if (buf == NULL) { - LOGE("alloc of %ld bytes failed\n", (long) allocLen); + ALOGE("alloc of %ld bytes failed\n", (long) allocLen); return NULL; } - LOGV("Asset %p allocating buffer size %d (smaller than threshold)", this, (int)allocLen); + ALOGV("Asset %p allocating buffer size %d (smaller than threshold)", this, (int)allocLen); if (mLength > 0) { long oldPosn = ftell(mFp); fseek(mFp, mStart, SEEK_SET); if (fread(buf, 1, mLength, mFp) != (size_t) mLength) { - LOGE("failed reading %ld bytes\n", (long) mLength); + ALOGE("failed reading %ld bytes\n", (long) mLength); delete[] buf; return NULL; } fseek(mFp, oldPosn, SEEK_SET); } - LOGV(" getBuffer: loaded into buffer\n"); + ALOGV(" getBuffer: loaded into buffer\n"); mBuf = buf; return mBuf; @@ -610,7 +610,7 @@ const void* _FileAsset::getBuffer(bool wordAligned) return NULL; } - LOGV(" getBuffer: mapped\n"); + ALOGV(" getBuffer: mapped\n"); mMap = map; if (!wordAligned) { @@ -648,17 +648,17 @@ const void* _FileAsset::ensureAlignment(FileMap* map) if ((((size_t)data)&0x3) == 0) { // We can return this directly if it is aligned on a word // boundary. - LOGV("Returning aligned FileAsset %p (%s).", this, + ALOGV("Returning aligned FileAsset %p (%s).", this, getAssetSource()); return data; } // If not aligned on a word boundary, then we need to copy it into // our own buffer. - LOGV("Copying FileAsset %p (%s) to buffer size %d to make it aligned.", this, + ALOGV("Copying FileAsset %p (%s) to buffer size %d to make it aligned.", this, getAssetSource(), (int)mLength); unsigned char* buf = new unsigned char[mLength]; if (buf == NULL) { - LOGE("alloc of %ld bytes failed\n", (long) mLength); + ALOGE("alloc of %ld bytes failed\n", (long) mLength); return NULL; } memcpy(buf, data, mLength); @@ -855,7 +855,7 @@ const void* _CompressedAsset::getBuffer(bool wordAligned) */ buf = new unsigned char[mUncompressedLen]; if (buf == NULL) { - LOGW("alloc %ld bytes failed\n", (long) mUncompressedLen); + ALOGW("alloc %ld bytes failed\n", (long) mUncompressedLen); goto bail; } diff --git a/libs/utils/AssetManager.cpp b/libs/utils/AssetManager.cpp index 22034c5935..47a2b9953f 100644 --- a/libs/utils/AssetManager.cpp +++ b/libs/utils/AssetManager.cpp @@ -117,14 +117,14 @@ AssetManager::AssetManager(CacheMode cacheMode) mCacheMode(cacheMode), mCacheValid(false) { int count = android_atomic_inc(&gCount)+1; - //LOGI("Creating AssetManager %p #%d\n", this, count); + //ALOGI("Creating AssetManager %p #%d\n", this, count); memset(mConfig, 0, sizeof(ResTable_config)); } AssetManager::~AssetManager(void) { int count = android_atomic_dec(&gCount); - //LOGI("Destroying AssetManager in %p #%d\n", this, count); + //ALOGI("Destroying AssetManager in %p #%d\n", this, count); delete mConfig; delete mResources; @@ -151,7 +151,7 @@ bool AssetManager::addAssetPath(const String8& path, void** cookie) ap.path = path; ap.type = ::getFileType(path.string()); if (ap.type != kFileTypeDirectory && ap.type != kFileTypeRegular) { - LOGW("Asset path %s is neither a directory nor file (type=%d).", + ALOGW("Asset path %s is neither a directory nor file (type=%d).", path.string(), (int)ap.type); return false; } @@ -167,7 +167,7 @@ bool AssetManager::addAssetPath(const String8& path, void** cookie) } } - LOGV("In %p Asset %s path: %s", this, + ALOGV("In %p Asset %s path: %s", this, ap.type == kFileTypeDirectory ? "dir" : "zip", ap.path.string()); mAssetPaths.add(ap); @@ -200,7 +200,7 @@ bool AssetManager::addAssetPath(const String8& path, void** cookie) if (addOverlay) { mAssetPaths.add(oap); } else { - LOGW("failed to add overlay package %s\n", overlayPath.string()); + ALOGW("failed to add overlay package %s\n", overlayPath.string()); } } } @@ -216,17 +216,17 @@ bool AssetManager::isIdmapStaleLocked(const String8& originalPath, const String8 if (errno == ENOENT) { return true; // non-existing idmap is always stale } else { - LOGW("failed to stat file %s: %s\n", idmapPath.string(), strerror(errno)); + ALOGW("failed to stat file %s: %s\n", idmapPath.string(), strerror(errno)); return false; } } if (st.st_size < ResTable::IDMAP_HEADER_SIZE_BYTES) { - LOGW("file %s has unexpectedly small size=%zd\n", idmapPath.string(), (size_t)st.st_size); + ALOGW("file %s has unexpectedly small size=%zd\n", idmapPath.string(), (size_t)st.st_size); return false; } int fd = TEMP_FAILURE_RETRY(::open(idmapPath.string(), O_RDONLY)); if (fd == -1) { - LOGW("failed to open file %s: %s\n", idmapPath.string(), strerror(errno)); + ALOGW("failed to open file %s: %s\n", idmapPath.string(), strerror(errno)); return false; } char buf[ResTable::IDMAP_HEADER_SIZE_BYTES]; @@ -283,7 +283,7 @@ bool AssetManager::getZipEntryCrcLocked(const String8& zipPath, const char* entr bool AssetManager::createIdmapFileLocked(const String8& originalPath, const String8& overlayPath, const String8& idmapPath) { - LOGD("%s: originalPath=%s overlayPath=%s idmapPath=%s\n", + ALOGD("%s: originalPath=%s overlayPath=%s idmapPath=%s\n", __FUNCTION__, originalPath.string(), overlayPath.string(), idmapPath.string()); ResTable tables[2]; const String8* paths[2] = { &originalPath, &overlayPath }; @@ -300,24 +300,24 @@ bool AssetManager::createIdmapFileLocked(const String8& originalPath, const Stri ap.path = *paths[i]; Asset* ass = openNonAssetInPathLocked("resources.arsc", Asset::ACCESS_BUFFER, ap); if (ass == NULL) { - LOGW("failed to find resources.arsc in %s\n", ap.path.string()); + ALOGW("failed to find resources.arsc in %s\n", ap.path.string()); goto error; } tables[i].add(ass, (void*)1, false); } if (!getZipEntryCrcLocked(originalPath, "resources.arsc", &originalCrc)) { - LOGW("failed to retrieve crc for resources.arsc in %s\n", originalPath.string()); + ALOGW("failed to retrieve crc for resources.arsc in %s\n", originalPath.string()); goto error; } if (!getZipEntryCrcLocked(overlayPath, "resources.arsc", &overlayCrc)) { - LOGW("failed to retrieve crc for resources.arsc in %s\n", overlayPath.string()); + ALOGW("failed to retrieve crc for resources.arsc in %s\n", overlayPath.string()); goto error; } if (tables[0].createIdmap(tables[1], originalCrc, overlayCrc, (void**)&data, &size) != NO_ERROR) { - LOGW("failed to generate idmap data for file %s\n", idmapPath.string()); + ALOGW("failed to generate idmap data for file %s\n", idmapPath.string()); goto error; } @@ -326,13 +326,13 @@ bool AssetManager::createIdmapFileLocked(const String8& originalPath, const Stri // installd). fd = TEMP_FAILURE_RETRY(::open(idmapPath.string(), O_WRONLY | O_CREAT | O_TRUNC, 0644)); if (fd == -1) { - LOGW("failed to write idmap file %s (open: %s)\n", idmapPath.string(), strerror(errno)); + ALOGW("failed to write idmap file %s (open: %s)\n", idmapPath.string(), strerror(errno)); goto error_free; } for (;;) { ssize_t written = TEMP_FAILURE_RETRY(write(fd, data + offset, size)); if (written < 0) { - LOGW("failed to write idmap file %s (write: %s)\n", idmapPath.string(), + ALOGW("failed to write idmap file %s (write: %s)\n", idmapPath.string(), strerror(errno)); goto error_close; } @@ -498,7 +498,7 @@ Asset* AssetManager::open(const char* fileName, AccessMode mode) size_t i = mAssetPaths.size(); while (i > 0) { i--; - LOGV("Looking for asset '%s' in '%s'\n", + ALOGV("Looking for asset '%s' in '%s'\n", assetName.string(), mAssetPaths.itemAt(i).path.string()); Asset* pAsset = openNonAssetInPathLocked(assetName.string(), mode, mAssetPaths.itemAt(i)); if (pAsset != NULL) { @@ -532,7 +532,7 @@ Asset* AssetManager::openNonAsset(const char* fileName, AccessMode mode) size_t i = mAssetPaths.size(); while (i > 0) { i--; - LOGV("Looking for non-asset '%s' in '%s'\n", fileName, mAssetPaths.itemAt(i).path.string()); + ALOGV("Looking for non-asset '%s' in '%s'\n", fileName, mAssetPaths.itemAt(i).path.string()); Asset* pAsset = openNonAssetInPathLocked( fileName, mode, mAssetPaths.itemAt(i)); if (pAsset != NULL) { @@ -556,7 +556,7 @@ Asset* AssetManager::openNonAsset(void* cookie, const char* fileName, AccessMode loadFileNameCacheLocked(); if (which < mAssetPaths.size()) { - LOGV("Looking for non-asset '%s' in '%s'\n", fileName, + ALOGV("Looking for non-asset '%s' in '%s'\n", fileName, mAssetPaths.itemAt(which).path.string()); Asset* pAsset = openNonAssetInPathLocked( fileName, mode, mAssetPaths.itemAt(which)); @@ -621,7 +621,7 @@ const ResTable* AssetManager::getResTable(bool required) const bool shared = true; const asset_path& ap = mAssetPaths.itemAt(i); Asset* idmap = openIdmapLocked(ap); - LOGV("Looking for resource asset in '%s'\n", ap.path.string()); + ALOGV("Looking for resource asset in '%s'\n", ap.path.string()); if (ap.type != kFileTypeDirectory) { if (i == 0) { // The first item is typically the framework resources, @@ -633,7 +633,7 @@ const ResTable* AssetManager::getResTable(bool required) const ass = const_cast<AssetManager*>(this)-> mZipSet.getZipResourceTableAsset(ap.path); if (ass == NULL) { - LOGV("loading resource table %s\n", ap.path.string()); + ALOGV("loading resource table %s\n", ap.path.string()); ass = const_cast<AssetManager*>(this)-> openNonAssetInPathLocked("resources.arsc", Asset::ACCESS_BUFFER, @@ -648,7 +648,7 @@ const ResTable* AssetManager::getResTable(bool required) const // If this is the first resource table in the asset // manager, then we are going to cache it so that we // can quickly copy it out for others. - LOGV("Creating shared resources for %s", ap.path.string()); + ALOGV("Creating shared resources for %s", ap.path.string()); sharedRes = new ResTable(); sharedRes->add(ass, (void*)(i+1), false, idmap); sharedRes = const_cast<AssetManager*>(this)-> @@ -656,7 +656,7 @@ const ResTable* AssetManager::getResTable(bool required) const } } } else { - LOGV("loading resource table %s\n", ap.path.string()); + ALOGV("loading resource table %s\n", ap.path.string()); Asset* ass = const_cast<AssetManager*>(this)-> openNonAssetInPathLocked("resources.arsc", Asset::ACCESS_BUFFER, @@ -668,12 +668,12 @@ const ResTable* AssetManager::getResTable(bool required) const mResources = rt = new ResTable(); updateResourceParamsLocked(); } - LOGV("Installing resource asset %p in to table %p\n", ass, mResources); + ALOGV("Installing resource asset %p in to table %p\n", ass, mResources); if (sharedRes != NULL) { - LOGV("Copying existing resources for %s", ap.path.string()); + ALOGV("Copying existing resources for %s", ap.path.string()); rt->add(sharedRes); } else { - LOGV("Parsing resources for %s", ap.path.string()); + ALOGV("Parsing resources for %s", ap.path.string()); rt->add(ass, (void*)(i+1), !shared, idmap); } @@ -686,7 +686,7 @@ const ResTable* AssetManager::getResTable(bool required) const } } - if (required && !rt) LOGW("Unable to find resources file resources.arsc"); + if (required && !rt) ALOGW("Unable to find resources file resources.arsc"); if (!rt) { mResources = rt = new ResTable(); } @@ -725,9 +725,9 @@ Asset* AssetManager::openIdmapLocked(const struct asset_path& ap) const ass = const_cast<AssetManager*>(this)-> openAssetFromFileLocked(ap.idmap, Asset::ACCESS_BUFFER); if (ass) { - LOGV("loading idmap %s\n", ap.idmap.string()); + ALOGV("loading idmap %s\n", ap.idmap.string()); } else { - LOGW("failed to load idmap %s\n", ap.idmap.string()); + ALOGW("failed to load idmap %s\n", ap.idmap.string()); } } return ass; @@ -923,7 +923,7 @@ Asset* AssetManager::openInLocaleVendorLocked(const char* fileName, AccessMode m */ if (found) { if (pAsset == NULL) - LOGD("Expected file not found: '%s'\n", path.string()); + ALOGD("Expected file not found: '%s'\n", path.string()); return pAsset; } } @@ -1019,7 +1019,7 @@ String8 AssetManager::createPathNameLocked(const asset_path& ap, const char* roo */ ZipFileRO* AssetManager::getZipFileLocked(const asset_path& ap) { - LOGV("getZipFileLocked() in %p\n", this); + ALOGV("getZipFileLocked() in %p\n", this); return mZipSet.getZip(ap.path); } @@ -1074,29 +1074,29 @@ Asset* AssetManager::openAssetFromZipLocked(const ZipFileRO* pZipFile, if (!pZipFile->getEntryInfo(entry, &method, &uncompressedLen, NULL, NULL, NULL, NULL)) { - LOGW("getEntryInfo failed\n"); + ALOGW("getEntryInfo failed\n"); return NULL; } FileMap* dataMap = pZipFile->createEntryFileMap(entry); if (dataMap == NULL) { - LOGW("create map from entry failed\n"); + ALOGW("create map from entry failed\n"); return NULL; } if (method == ZipFileRO::kCompressStored) { pAsset = Asset::createFromUncompressedMap(dataMap, mode); - LOGV("Opened uncompressed entry %s in zip %s mode %d: %p", entryName.string(), + ALOGV("Opened uncompressed entry %s in zip %s mode %d: %p", entryName.string(), dataMap->getFileName(), mode, pAsset); } else { pAsset = Asset::createFromCompressedMap(dataMap, method, uncompressedLen, mode); - LOGV("Opened compressed entry %s in zip %s mode %d: %p", entryName.string(), + ALOGV("Opened compressed entry %s in zip %s mode %d: %p", entryName.string(), dataMap->getFileName(), mode, pAsset); } if (pAsset == NULL) { /* unexpected */ - LOGW("create from segment failed\n"); + ALOGW("create from segment failed\n"); } return pAsset; @@ -1146,10 +1146,10 @@ AssetDir* AssetManager::openDir(const char* dirName) i--; const asset_path& ap = mAssetPaths.itemAt(i); if (ap.type == kFileTypeRegular) { - LOGV("Adding directory %s from zip %s", dirName, ap.path.string()); + ALOGV("Adding directory %s from zip %s", dirName, ap.path.string()); scanAndMergeZipLocked(pMergedInfo, ap, kAssetsRoot, dirName); } else { - LOGV("Adding directory %s from dir %s", dirName, ap.path.string()); + ALOGV("Adding directory %s from dir %s", dirName, ap.path.string()); scanAndMergeDirLocked(pMergedInfo, ap, kAssetsRoot, dirName); } } @@ -1200,10 +1200,10 @@ AssetDir* AssetManager::openNonAssetDir(void* cookie, const char* dirName) if (which < mAssetPaths.size()) { const asset_path& ap = mAssetPaths.itemAt(which); if (ap.type == kFileTypeRegular) { - LOGV("Adding directory %s from zip %s", dirName, ap.path.string()); + ALOGV("Adding directory %s from zip %s", dirName, ap.path.string()); scanAndMergeZipLocked(pMergedInfo, ap, NULL, dirName); } else { - LOGV("Adding directory %s from dir %s", dirName, ap.path.string()); + ALOGV("Adding directory %s from dir %s", dirName, ap.path.string()); scanAndMergeDirLocked(pMergedInfo, ap, NULL, dirName); } } @@ -1325,7 +1325,7 @@ bool AssetManager::scanAndMergeDirLocked(SortedVector<AssetDir::FileInfo>* pMerg matchIdx = AssetDir::FileInfo::findEntry(pMergedInfo, match); if (matchIdx > 0) { - LOGV("Excluding '%s' [%s]\n", + ALOGV("Excluding '%s' [%s]\n", pMergedInfo->itemAt(matchIdx).getFileName().string(), pMergedInfo->itemAt(matchIdx).getSourceName().string()); pMergedInfo->removeAt(matchIdx); @@ -1333,7 +1333,7 @@ bool AssetManager::scanAndMergeDirLocked(SortedVector<AssetDir::FileInfo>* pMerg //printf("+++ no match on '%s'\n", (const char*) match); } - LOGD("HEY: size=%d removing %d\n", (int)pContents->size(), i); + ALOGD("HEY: size=%d removing %d\n", (int)pContents->size(), i); pContents->removeAt(i); i--; // adjust "for" loop count--; // and loop limit @@ -1365,7 +1365,7 @@ SortedVector<AssetDir::FileInfo>* AssetManager::scanDirLocked(const String8& pat struct dirent* entry; FileType fileType; - LOGV("Scanning dir '%s'\n", path.string()); + ALOGV("Scanning dir '%s'\n", path.string()); dir = opendir(path.string()); if (dir == NULL) @@ -1427,7 +1427,7 @@ bool AssetManager::scanAndMergeZipLocked(SortedVector<AssetDir::FileInfo>* pMerg pZip = mZipSet.getZip(ap.path); if (pZip == NULL) { - LOGW("Failure opening zip %s\n", ap.path.string()); + ALOGW("Failure opening zip %s\n", ap.path.string()); return false; } @@ -1461,7 +1461,7 @@ bool AssetManager::scanAndMergeZipLocked(SortedVector<AssetDir::FileInfo>* pMerg entry = pZip->findEntryByIndex(i); if (pZip->getEntryFileName(entry, nameBuf, sizeof(nameBuf)) != 0) { // TODO: fix this if we expect to have long names - LOGE("ARGH: name too long?\n"); + ALOGE("ARGH: name too long?\n"); continue; } //printf("Comparing %s in %s?\n", nameBuf, dirName.string()); @@ -1652,7 +1652,7 @@ void AssetManager::loadFileNameCacheLocked(void) #ifdef DO_TIMINGS timer.stop(); - LOGD("Cache scan took %.3fms\n", + ALOGD("Cache scan took %.3fms\n", timer.durationUsecs() / 1000.0); #endif @@ -1780,11 +1780,11 @@ AssetManager::SharedZip::SharedZip(const String8& path, time_t modWhen) : mPath(path), mZipFile(NULL), mModWhen(modWhen), mResourceTableAsset(NULL), mResourceTable(NULL) { - //LOGI("Creating SharedZip %p %s\n", this, (const char*)mPath); + //ALOGI("Creating SharedZip %p %s\n", this, (const char*)mPath); mZipFile = new ZipFileRO; - LOGV("+++ opening zip '%s'\n", mPath.string()); + ALOGV("+++ opening zip '%s'\n", mPath.string()); if (mZipFile->open(mPath.string()) != NO_ERROR) { - LOGD("failed to open Zip archive '%s'\n", mPath.string()); + ALOGD("failed to open Zip archive '%s'\n", mPath.string()); delete mZipFile; mZipFile = NULL; } @@ -1811,7 +1811,7 @@ ZipFileRO* AssetManager::SharedZip::getZip() Asset* AssetManager::SharedZip::getResourceTableAsset() { - LOGV("Getting from SharedZip %p resource asset %p\n", this, mResourceTableAsset); + ALOGV("Getting from SharedZip %p resource asset %p\n", this, mResourceTableAsset); return mResourceTableAsset; } @@ -1833,7 +1833,7 @@ Asset* AssetManager::SharedZip::setResourceTableAsset(Asset* asset) ResTable* AssetManager::SharedZip::getResourceTable() { - LOGV("Getting from SharedZip %p resource table %p\n", this, mResourceTable); + ALOGV("Getting from SharedZip %p resource table %p\n", this, mResourceTable); return mResourceTable; } @@ -1858,7 +1858,7 @@ bool AssetManager::SharedZip::isUpToDate() AssetManager::SharedZip::~SharedZip() { - //LOGI("Destroying SharedZip %p %s\n", this, (const char*)mPath); + //ALOGI("Destroying SharedZip %p %s\n", this, (const char*)mPath); if (mResourceTable != NULL) { delete mResourceTable; } @@ -1867,7 +1867,7 @@ AssetManager::SharedZip::~SharedZip() } if (mZipFile != NULL) { delete mZipFile; - LOGV("Closed '%s'\n", mPath.string()); + ALOGV("Closed '%s'\n", mPath.string()); } } diff --git a/libs/utils/BackupData.cpp b/libs/utils/BackupData.cpp index 8791263933..f956306136 100644 --- a/libs/utils/BackupData.cpp +++ b/libs/utils/BackupData.cpp @@ -78,7 +78,7 @@ BackupDataWriter::write_padding_for(int n) paddingSize = padding_extra(n); if (paddingSize > 0) { uint32_t padding = 0xbcbcbcbc; - if (DEBUG) LOGI("writing %d padding bytes for %d", paddingSize, n); + if (DEBUG) ALOGI("writing %d padding bytes for %d", paddingSize, n); amt = write(m_fd, &padding, paddingSize); if (amt != paddingSize) { m_status = errno; @@ -112,8 +112,8 @@ BackupDataWriter::WriteEntityHeader(const String8& key, size_t dataSize) k = key; } if (DEBUG) { - LOGD("Writing header: prefix='%s' key='%s' dataSize=%d", m_keyPrefix.string(), key.string(), - dataSize); + ALOGD("Writing header: prefix='%s' key='%s' dataSize=%d", m_keyPrefix.string(), + key.string(), dataSize); } entity_header_v1 header; @@ -125,7 +125,7 @@ BackupDataWriter::WriteEntityHeader(const String8& key, size_t dataSize) header.keyLen = tolel(keyLen); header.dataSize = tolel(dataSize); - if (DEBUG) LOGI("writing entity header, %d bytes", sizeof(entity_header_v1)); + if (DEBUG) ALOGI("writing entity header, %d bytes", sizeof(entity_header_v1)); amt = write(m_fd, &header, sizeof(entity_header_v1)); if (amt != sizeof(entity_header_v1)) { m_status = errno; @@ -133,7 +133,7 @@ BackupDataWriter::WriteEntityHeader(const String8& key, size_t dataSize) } m_pos += amt; - if (DEBUG) LOGI("writing entity header key, %d bytes", keyLen+1); + if (DEBUG) ALOGI("writing entity header key, %d bytes", keyLen+1); amt = write(m_fd, k.string(), keyLen+1); if (amt != keyLen+1) { m_status = errno; @@ -151,11 +151,11 @@ BackupDataWriter::WriteEntityHeader(const String8& key, size_t dataSize) status_t BackupDataWriter::WriteEntityData(const void* data, size_t size) { - if (DEBUG) LOGD("Writing data: size=%lu", (unsigned long) size); + if (DEBUG) ALOGD("Writing data: size=%lu", (unsigned long) size); if (m_status != NO_ERROR) { if (DEBUG) { - LOGD("Not writing data - stream in error state %d (%s)", m_status, strerror(m_status)); + ALOGD("Not writing data - stream in error state %d (%s)", m_status, strerror(m_status)); } return m_status; } @@ -166,7 +166,7 @@ BackupDataWriter::WriteEntityData(const void* data, size_t size) ssize_t amt = write(m_fd, data, size); if (amt != (ssize_t)size) { m_status = errno; - if (DEBUG) LOGD("write returned error %d (%s)", m_status, strerror(m_status)); + if (DEBUG) ALOGD("write returned error %d (%s)", m_status, strerror(m_status)); return m_status; } m_pos += amt; @@ -208,7 +208,7 @@ BackupDataReader::Status() m_done = true; \ } else { \ m_status = errno; \ - LOGD("CHECK_SIZE(a=%ld e=%ld) failed at line %d m_status='%s'", \ + ALOGD("CHECK_SIZE(a=%ld e=%ld) failed at line %d m_status='%s'", \ long(actual), long(expected), __LINE__, strerror(m_status)); \ } \ return m_status; \ @@ -218,7 +218,7 @@ BackupDataReader::Status() do { \ status_t err = skip_padding(); \ if (err != NO_ERROR) { \ - LOGD("SKIP_PADDING FAILED at line %d", __LINE__); \ + ALOGD("SKIP_PADDING FAILED at line %d", __LINE__); \ m_status = err; \ return err; \ } \ @@ -261,7 +261,7 @@ BackupDataReader::ReadNextHeader(bool* done, int* type) { m_header.entity.keyLen = fromlel(m_header.entity.keyLen); if (m_header.entity.keyLen <= 0) { - LOGD("Entity header at %d has keyLen<=0: 0x%08x\n", (int)m_pos, + ALOGD("Entity header at %d has keyLen<=0: 0x%08x\n", (int)m_pos, (int)m_header.entity.keyLen); m_status = EINVAL; } @@ -285,7 +285,7 @@ BackupDataReader::ReadNextHeader(bool* done, int* type) break; } default: - LOGD("Chunk header at %d has invalid type: 0x%08x", + ALOGD("Chunk header at %d has invalid type: 0x%08x", (int)(m_pos - sizeof(m_header)), (int)m_header.type); m_status = EINVAL; } @@ -339,7 +339,7 @@ BackupDataReader::ReadEntityData(void* data, size_t size) return -1; } int remaining = m_dataEndPos - m_pos; - //LOGD("ReadEntityData size=%d m_pos=0x%x m_dataEndPos=0x%x remaining=%d\n", + //ALOGD("ReadEntityData size=%d m_pos=0x%x m_dataEndPos=0x%x remaining=%d\n", // size, m_pos, m_dataEndPos, remaining); if (remaining <= 0) { return 0; @@ -347,7 +347,7 @@ BackupDataReader::ReadEntityData(void* data, size_t size) if (((int)size) > remaining) { size = remaining; } - //LOGD(" reading %d bytes", size); + //ALOGD(" reading %d bytes", size); int amt = read(m_fd, data, size); if (amt < 0) { m_status = errno; diff --git a/libs/utils/BackupHelpers.cpp b/libs/utils/BackupHelpers.cpp index 7ef30f9990..f77a8917c7 100644 --- a/libs/utils/BackupHelpers.cpp +++ b/libs/utils/BackupHelpers.cpp @@ -74,7 +74,7 @@ const static int CURRENT_METADATA_VERSION = 1; #if TEST_BACKUP_HELPERS #define LOGP(f, x...) printf(f "\n", x) #else -#define LOGP(x...) LOGD(x) +#define LOGP(x...) ALOGD(x) #endif #endif @@ -100,7 +100,7 @@ read_snapshot_file(int fd, KeyedVector<String8,FileState>* snapshot) bytesRead += amt; if (header.magic0 != MAGIC0 || header.magic1 != MAGIC1) { - LOGW("read_snapshot_file header.magic0=0x%08x magic1=0x%08x", header.magic0, header.magic1); + ALOGW("read_snapshot_file header.magic0=0x%08x magic1=0x%08x", header.magic0, header.magic1); return 1; } @@ -110,7 +110,7 @@ read_snapshot_file(int fd, KeyedVector<String8,FileState>* snapshot) amt = read(fd, &file, sizeof(FileState)); if (amt != sizeof(FileState)) { - LOGW("read_snapshot_file FileState truncated/error with read at %d bytes\n", bytesRead); + ALOGW("read_snapshot_file FileState truncated/error with read at %d bytes\n", bytesRead); return 1; } bytesRead += amt; @@ -129,13 +129,13 @@ read_snapshot_file(int fd, KeyedVector<String8,FileState>* snapshot) free(filename); } if (amt != nameBufSize) { - LOGW("read_snapshot_file filename truncated/error with read at %d bytes\n", bytesRead); + ALOGW("read_snapshot_file filename truncated/error with read at %d bytes\n", bytesRead); return 1; } } if (header.totalSize != bytesRead) { - LOGW("read_snapshot_file length mismatch: header.totalSize=%d bytesRead=%d\n", + ALOGW("read_snapshot_file length mismatch: header.totalSize=%d bytesRead=%d\n", header.totalSize, bytesRead); return 1; } @@ -166,7 +166,7 @@ write_snapshot_file(int fd, const KeyedVector<String8,FileRec>& snapshot) amt = write(fd, &header, sizeof(header)); if (amt != sizeof(header)) { - LOGW("write_snapshot_file error writing header %s", strerror(errno)); + ALOGW("write_snapshot_file error writing header %s", strerror(errno)); return errno; } @@ -178,14 +178,14 @@ write_snapshot_file(int fd, const KeyedVector<String8,FileRec>& snapshot) amt = write(fd, &r.s, sizeof(FileState)); if (amt != sizeof(FileState)) { - LOGW("write_snapshot_file error writing header %s", strerror(errno)); + ALOGW("write_snapshot_file error writing header %s", strerror(errno)); return 1; } // filename is not NULL terminated, but it is padded amt = write(fd, name.string(), nameLen); if (amt != nameLen) { - LOGW("write_snapshot_file error writing filename %s", strerror(errno)); + ALOGW("write_snapshot_file error writing filename %s", strerror(errno)); return 1; } int paddingLen = ROUND_UP[nameLen % 4]; @@ -193,7 +193,7 @@ write_snapshot_file(int fd, const KeyedVector<String8,FileRec>& snapshot) int padding = 0xabababab; amt = write(fd, &padding, paddingLen); if (amt != paddingLen) { - LOGW("write_snapshot_file error writing %d bytes of filename padding %s", + ALOGW("write_snapshot_file error writing %d bytes of filename padding %s", paddingLen, strerror(errno)); return 1; } @@ -232,7 +232,7 @@ write_update_file(BackupDataWriter* dataStream, int fd, int mode, const String8& lseek(fd, 0, SEEK_SET); if (sizeof(metadata) != 16) { - LOGE("ERROR: metadata block is the wrong size!"); + ALOGE("ERROR: metadata block is the wrong size!"); } bytesLeft = fileSize + sizeof(metadata); @@ -280,7 +280,7 @@ write_update_file(BackupDataWriter* dataStream, int fd, int mode, const String8& } } } - LOGE("write_update_file size mismatch for %s. expected=%d actual=%d." + ALOGE("write_update_file size mismatch for %s. expected=%d actual=%d." " You aren't doing proper locking!", realFilename, fileSize, fileSize-bytesLeft); } @@ -525,7 +525,7 @@ int write_tarfile(const String8& packageName, const String8& domain, struct stat64 s; if (lstat64(filepath.string(), &s) != 0) { err = errno; - LOGE("Error %d (%s) from lstat64(%s)", err, strerror(err), filepath.string()); + ALOGE("Error %d (%s) from lstat64(%s)", err, strerror(err), filepath.string()); return err; } @@ -540,7 +540,7 @@ int write_tarfile(const String8& packageName, const String8& domain, int fd = open(filepath.string(), O_RDONLY); if (fd < 0) { err = errno; - LOGE("Error %d (%s) from open(%s)", err, strerror(err), filepath.string()); + ALOGE("Error %d (%s) from open(%s)", err, strerror(err), filepath.string()); return err; } @@ -551,7 +551,7 @@ int write_tarfile(const String8& packageName, const String8& domain, char* paxData = buf + 1024; if (buf == NULL) { - LOGE("Out of mem allocating transfer buffer"); + ALOGE("Out of mem allocating transfer buffer"); err = ENOMEM; goto cleanup; } @@ -591,7 +591,7 @@ int write_tarfile(const String8& packageName, const String8& domain, } else if (S_ISREG(s.st_mode)) { type = '0'; // tar magic: '0' == normal file } else { - LOGW("Error: unknown file mode 0%o [%s]", s.st_mode, filepath.string()); + ALOGW("Error: unknown file mode 0%o [%s]", s.st_mode, filepath.string()); goto cleanup; } buf[156] = type; @@ -628,7 +628,7 @@ int write_tarfile(const String8& packageName, const String8& domain, // [ 329 : 8 ] and [ 337 : 8 ] devmajor/devminor, not used - LOGI(" Name: %s", fullname.string()); + ALOGI(" Name: %s", fullname.string()); // If we're using a pax extended header, build & write that here; lengths are // already preflighted @@ -688,11 +688,11 @@ int write_tarfile(const String8& packageName, const String8& domain, ssize_t nRead = read(fd, buf, toRead); if (nRead < 0) { err = errno; - LOGE("Unable to read file [%s], err=%d (%s)", filepath.string(), + ALOGE("Unable to read file [%s], err=%d (%s)", filepath.string(), err, strerror(err)); break; } else if (nRead == 0) { - LOGE("EOF but expect %lld more bytes in [%s]", (long long) toWrite, + ALOGE("EOF but expect %lld more bytes in [%s]", (long long) toWrite, filepath.string()); err = EIO; break; @@ -759,7 +759,7 @@ RestoreHelperBase::WriteFile(const String8& filename, BackupDataReader* in) file_metadata_v1 metadata; amt = in->ReadEntityData(&metadata, sizeof(metadata)); if (amt != sizeof(metadata)) { - LOGW("Could not read metadata for %s -- %ld / %s", filename.string(), + ALOGW("Could not read metadata for %s -- %ld / %s", filename.string(), (long)amt, strerror(errno)); return EIO; } @@ -768,7 +768,7 @@ RestoreHelperBase::WriteFile(const String8& filename, BackupDataReader* in) if (metadata.version > CURRENT_METADATA_VERSION) { if (!m_loggedUnknownMetadata) { m_loggedUnknownMetadata = true; - LOGW("Restoring file with unsupported metadata version %d (currently %d)", + ALOGW("Restoring file with unsupported metadata version %d (currently %d)", metadata.version, CURRENT_METADATA_VERSION); } } @@ -778,7 +778,7 @@ RestoreHelperBase::WriteFile(const String8& filename, BackupDataReader* in) crc = crc32(0L, Z_NULL, 0); fd = open(filename.string(), O_CREAT|O_RDWR|O_TRUNC, mode); if (fd == -1) { - LOGW("Could not open file %s -- %s", filename.string(), strerror(errno)); + ALOGW("Could not open file %s -- %s", filename.string(), strerror(errno)); return errno; } @@ -786,7 +786,7 @@ RestoreHelperBase::WriteFile(const String8& filename, BackupDataReader* in) err = write(fd, buf, amt); if (err != amt) { close(fd); - LOGW("Error '%s' writing '%s'", strerror(errno), filename.string()); + ALOGW("Error '%s' writing '%s'", strerror(errno), filename.string()); return errno; } crc = crc32(crc, (Bytef*)buf, amt); @@ -797,7 +797,7 @@ RestoreHelperBase::WriteFile(const String8& filename, BackupDataReader* in) // Record for the snapshot err = stat(filename.string(), &st); if (err != 0) { - LOGW("Error stating file that we just created %s", filename.string()); + ALOGW("Error stating file that we just created %s", filename.string()); return errno; } diff --git a/libs/utils/BasicHashtable.cpp b/libs/utils/BasicHashtable.cpp new file mode 100644 index 0000000000..fb8ec9f83f --- /dev/null +++ b/libs/utils/BasicHashtable.cpp @@ -0,0 +1,338 @@ +/* + * 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. + */ + +#define LOG_TAG "BasicHashtable" + +#include <math.h> + +#include <utils/Log.h> +#include <utils/BasicHashtable.h> +#include <utils/misc.h> + +namespace android { + +BasicHashtableImpl::BasicHashtableImpl(size_t entrySize, bool hasTrivialDestructor, + size_t minimumInitialCapacity, float loadFactor) : + mBucketSize(entrySize + sizeof(Bucket)), mHasTrivialDestructor(hasTrivialDestructor), + mLoadFactor(loadFactor), mSize(0), + mFilledBuckets(0), mBuckets(NULL) { + determineCapacity(minimumInitialCapacity, mLoadFactor, &mBucketCount, &mCapacity); +} + +BasicHashtableImpl::BasicHashtableImpl(const BasicHashtableImpl& other) : + mBucketSize(other.mBucketSize), mHasTrivialDestructor(other.mHasTrivialDestructor), + mCapacity(other.mCapacity), mLoadFactor(other.mLoadFactor), + mSize(other.mSize), mFilledBuckets(other.mFilledBuckets), + mBucketCount(other.mBucketCount), mBuckets(other.mBuckets) { + if (mBuckets) { + SharedBuffer::bufferFromData(mBuckets)->acquire(); + } +} + +void BasicHashtableImpl::dispose() { + if (mBuckets) { + releaseBuckets(mBuckets, mBucketCount); + } +} + +void BasicHashtableImpl::clone() { + if (mBuckets) { + void* newBuckets = allocateBuckets(mBucketCount); + copyBuckets(mBuckets, newBuckets, mBucketCount); + releaseBuckets(mBuckets, mBucketCount); + mBuckets = newBuckets; + } +} + +void BasicHashtableImpl::setTo(const BasicHashtableImpl& other) { + if (mBuckets) { + releaseBuckets(mBuckets, mBucketCount); + } + + mCapacity = other.mCapacity; + mLoadFactor = other.mLoadFactor; + mSize = other.mSize; + mFilledBuckets = other.mFilledBuckets; + mBucketCount = other.mBucketCount; + mBuckets = other.mBuckets; + + if (mBuckets) { + SharedBuffer::bufferFromData(mBuckets)->acquire(); + } +} + +void BasicHashtableImpl::clear() { + if (mBuckets) { + if (mFilledBuckets) { + SharedBuffer* sb = SharedBuffer::bufferFromData(mBuckets); + if (sb->onlyOwner()) { + destroyBuckets(mBuckets, mBucketCount); + for (size_t i = 0; i < mSize; i++) { + Bucket& bucket = bucketAt(mBuckets, i); + bucket.cookie = 0; + } + } else { + releaseBuckets(mBuckets, mBucketCount); + mBuckets = NULL; + } + mFilledBuckets = 0; + } + mSize = 0; + } +} + +ssize_t BasicHashtableImpl::next(ssize_t index) const { + if (mSize) { + while (size_t(++index) < mBucketCount) { + const Bucket& bucket = bucketAt(mBuckets, index); + if (bucket.cookie & Bucket::PRESENT) { + return index; + } + } + } + return -1; +} + +ssize_t BasicHashtableImpl::find(ssize_t index, hash_t hash, + const void* __restrict__ key) const { + if (!mSize) { + return -1; + } + + hash = trimHash(hash); + if (index < 0) { + index = chainStart(hash, mBucketCount); + + const Bucket& bucket = bucketAt(mBuckets, size_t(index)); + if (bucket.cookie & Bucket::PRESENT) { + if (compareBucketKey(bucket, key)) { + return index; + } + } else { + if (!(bucket.cookie & Bucket::COLLISION)) { + return -1; + } + } + } + + size_t inc = chainIncrement(hash, mBucketCount); + for (;;) { + index = chainSeek(index, inc, mBucketCount); + + const Bucket& bucket = bucketAt(mBuckets, size_t(index)); + if (bucket.cookie & Bucket::PRESENT) { + if ((bucket.cookie & Bucket::HASH_MASK) == hash + && compareBucketKey(bucket, key)) { + return index; + } + } + if (!(bucket.cookie & Bucket::COLLISION)) { + return -1; + } + } +} + +size_t BasicHashtableImpl::add(hash_t hash, const void* entry) { + if (!mBuckets) { + mBuckets = allocateBuckets(mBucketCount); + } else { + edit(); + } + + hash = trimHash(hash); + for (;;) { + size_t index = chainStart(hash, mBucketCount); + Bucket* bucket = &bucketAt(mBuckets, size_t(index)); + if (bucket->cookie & Bucket::PRESENT) { + size_t inc = chainIncrement(hash, mBucketCount); + do { + bucket->cookie |= Bucket::COLLISION; + index = chainSeek(index, inc, mBucketCount); + bucket = &bucketAt(mBuckets, size_t(index)); + } while (bucket->cookie & Bucket::PRESENT); + } + + uint32_t collision = bucket->cookie & Bucket::COLLISION; + if (!collision) { + if (mFilledBuckets >= mCapacity) { + rehash(mCapacity * 2, mLoadFactor); + continue; + } + mFilledBuckets += 1; + } + + bucket->cookie = collision | Bucket::PRESENT | hash; + mSize += 1; + initializeBucketEntry(*bucket, entry); + return index; + } +} + +void BasicHashtableImpl::removeAt(size_t index) { + edit(); + + Bucket& bucket = bucketAt(mBuckets, index); + bucket.cookie &= ~Bucket::PRESENT; + if (!(bucket.cookie & Bucket::COLLISION)) { + mFilledBuckets -= 1; + } + mSize -= 1; + if (!mHasTrivialDestructor) { + destroyBucketEntry(bucket); + } +} + +void BasicHashtableImpl::rehash(size_t minimumCapacity, float loadFactor) { + if (minimumCapacity < mSize) { + minimumCapacity = mSize; + } + size_t newBucketCount, newCapacity; + determineCapacity(minimumCapacity, loadFactor, &newBucketCount, &newCapacity); + + if (newBucketCount != mBucketCount || newCapacity != mCapacity) { + if (mBuckets) { + void* newBuckets; + if (mSize) { + newBuckets = allocateBuckets(newBucketCount); + for (size_t i = 0; i < mBucketCount; i++) { + const Bucket& fromBucket = bucketAt(mBuckets, i); + if (fromBucket.cookie & Bucket::PRESENT) { + hash_t hash = fromBucket.cookie & Bucket::HASH_MASK; + size_t index = chainStart(hash, newBucketCount); + Bucket* toBucket = &bucketAt(newBuckets, size_t(index)); + if (toBucket->cookie & Bucket::PRESENT) { + size_t inc = chainIncrement(hash, newBucketCount); + do { + toBucket->cookie |= Bucket::COLLISION; + index = chainSeek(index, inc, newBucketCount); + toBucket = &bucketAt(newBuckets, size_t(index)); + } while (toBucket->cookie & Bucket::PRESENT); + } + toBucket->cookie = Bucket::PRESENT | hash; + initializeBucketEntry(*toBucket, fromBucket.entry); + } + } + } else { + newBuckets = NULL; + } + releaseBuckets(mBuckets, mBucketCount); + mBuckets = newBuckets; + mFilledBuckets = mSize; + } + mBucketCount = newBucketCount; + mCapacity = newCapacity; + } + mLoadFactor = loadFactor; +} + +void* BasicHashtableImpl::allocateBuckets(size_t count) const { + size_t bytes = count * mBucketSize; + SharedBuffer* sb = SharedBuffer::alloc(bytes); + LOG_ALWAYS_FATAL_IF(!sb, "Could not allocate %u bytes for hashtable with %u buckets.", + uint32_t(bytes), uint32_t(count)); + void* buckets = sb->data(); + for (size_t i = 0; i < count; i++) { + Bucket& bucket = bucketAt(buckets, i); + bucket.cookie = 0; + } + return buckets; +} + +void BasicHashtableImpl::releaseBuckets(void* __restrict__ buckets, size_t count) const { + SharedBuffer* sb = SharedBuffer::bufferFromData(buckets); + if (sb->release(SharedBuffer::eKeepStorage) == 1) { + destroyBuckets(buckets, count); + SharedBuffer::dealloc(sb); + } +} + +void BasicHashtableImpl::destroyBuckets(void* __restrict__ buckets, size_t count) const { + if (!mHasTrivialDestructor) { + for (size_t i = 0; i < count; i++) { + Bucket& bucket = bucketAt(buckets, i); + if (bucket.cookie & Bucket::PRESENT) { + destroyBucketEntry(bucket); + } + } + } +} + +void BasicHashtableImpl::copyBuckets(const void* __restrict__ fromBuckets, + void* __restrict__ toBuckets, size_t count) const { + for (size_t i = 0; i < count; i++) { + const Bucket& fromBucket = bucketAt(fromBuckets, i); + Bucket& toBucket = bucketAt(toBuckets, i); + toBucket.cookie = fromBucket.cookie; + if (fromBucket.cookie & Bucket::PRESENT) { + initializeBucketEntry(toBucket, fromBucket.entry); + } + } +} + +// Table of 31-bit primes where each prime is no less than twice as large +// as the previous one. Generated by "primes.py". +static size_t PRIMES[] = { + 5, + 11, + 23, + 47, + 97, + 197, + 397, + 797, + 1597, + 3203, + 6421, + 12853, + 25717, + 51437, + 102877, + 205759, + 411527, + 823117, + 1646237, + 3292489, + 6584983, + 13169977, + 26339969, + 52679969, + 105359939, + 210719881, + 421439783, + 842879579, + 1685759167, + 0, +}; + +void BasicHashtableImpl::determineCapacity(size_t minimumCapacity, float loadFactor, + size_t* __restrict__ outBucketCount, size_t* __restrict__ outCapacity) { + LOG_ALWAYS_FATAL_IF(loadFactor <= 0.0f || loadFactor > 1.0f, + "Invalid load factor %0.3f. Must be in the range (0, 1].", loadFactor); + + size_t count = ceilf(minimumCapacity / loadFactor) + 1; + size_t i = 0; + while (count > PRIMES[i] && i < NELEM(PRIMES)) { + i++; + } + count = PRIMES[i]; + LOG_ALWAYS_FATAL_IF(!count, "Could not determine required number of buckets for " + "hashtable with minimum capacity %u and load factor %0.3f.", + uint32_t(minimumCapacity), loadFactor); + *outBucketCount = count; + *outCapacity = ceilf((count - 1) * loadFactor); +} + +}; // namespace android diff --git a/libs/utils/BlobCache.cpp b/libs/utils/BlobCache.cpp index d38aae9cd4..e52cf2f845 100644 --- a/libs/utils/BlobCache.cpp +++ b/libs/utils/BlobCache.cpp @@ -48,32 +48,32 @@ BlobCache::BlobCache(size_t maxKeySize, size_t maxValueSize, size_t maxTotalSize mRandState[1] = (now >> 16) & 0xFFFF; mRandState[2] = (now >> 32) & 0xFFFF; #endif - LOGV("initializing random seed using %lld", now); + ALOGV("initializing random seed using %lld", now); } void BlobCache::set(const void* key, size_t keySize, const void* value, size_t valueSize) { if (mMaxKeySize < keySize) { - LOGV("set: not caching because the key is too large: %d (limit: %d)", + ALOGV("set: not caching because the key is too large: %d (limit: %d)", keySize, mMaxKeySize); return; } if (mMaxValueSize < valueSize) { - LOGV("set: not caching because the value is too large: %d (limit: %d)", + ALOGV("set: not caching because the value is too large: %d (limit: %d)", valueSize, mMaxValueSize); return; } if (mMaxTotalSize < keySize + valueSize) { - LOGV("set: not caching because the combined key/value size is too " + ALOGV("set: not caching because the combined key/value size is too " "large: %d (limit: %d)", keySize + valueSize, mMaxTotalSize); return; } if (keySize == 0) { - LOGW("set: not caching because keySize is 0"); + ALOGW("set: not caching because keySize is 0"); return; } if (valueSize <= 0) { - LOGW("set: not caching because valueSize is 0"); + ALOGW("set: not caching because valueSize is 0"); return; } @@ -93,7 +93,7 @@ void BlobCache::set(const void* key, size_t keySize, const void* value, clean(); continue; } else { - LOGV("set: not caching new key/value pair because the " + ALOGV("set: not caching new key/value pair because the " "total cache size limit would be exceeded: %d " "(limit: %d)", keySize + valueSize, mMaxTotalSize); @@ -102,7 +102,7 @@ void BlobCache::set(const void* key, size_t keySize, const void* value, } mCacheEntries.add(CacheEntry(keyBlob, valueBlob)); mTotalSize = newTotalSize; - LOGV("set: created new cache entry with %d byte key and %d byte value", + ALOGV("set: created new cache entry with %d byte key and %d byte value", keySize, valueSize); } else { // Update the existing cache entry. @@ -115,7 +115,7 @@ void BlobCache::set(const void* key, size_t keySize, const void* value, clean(); continue; } else { - LOGV("set: not caching new value because the total cache " + ALOGV("set: not caching new value because the total cache " "size limit would be exceeded: %d (limit: %d)", keySize + valueSize, mMaxTotalSize); break; @@ -123,7 +123,7 @@ void BlobCache::set(const void* key, size_t keySize, const void* value, } mCacheEntries.editItemAt(index).setValue(valueBlob); mTotalSize = newTotalSize; - LOGV("set: updated existing cache entry with %d byte key and %d byte " + ALOGV("set: updated existing cache entry with %d byte key and %d byte " "value", keySize, valueSize); } break; @@ -133,7 +133,7 @@ void BlobCache::set(const void* key, size_t keySize, const void* value, size_t BlobCache::get(const void* key, size_t keySize, void* value, size_t valueSize) { if (mMaxKeySize < keySize) { - LOGV("get: not searching because the key is too large: %d (limit %d)", + ALOGV("get: not searching because the key is too large: %d (limit %d)", keySize, mMaxKeySize); return 0; } @@ -141,7 +141,7 @@ size_t BlobCache::get(const void* key, size_t keySize, void* value, CacheEntry dummyEntry(dummyKey, NULL); ssize_t index = mCacheEntries.indexOf(dummyEntry); if (index < 0) { - LOGV("get: no cache entry found for key of size %d", keySize); + ALOGV("get: no cache entry found for key of size %d", keySize); return 0; } @@ -150,10 +150,10 @@ size_t BlobCache::get(const void* key, size_t keySize, void* value, sp<Blob> valueBlob(mCacheEntries[index].getValue()); size_t valueBlobSize = valueBlob->getSize(); if (valueBlobSize <= valueSize) { - LOGV("get: copying %d bytes to caller's buffer", valueBlobSize); + ALOGV("get: copying %d bytes to caller's buffer", valueBlobSize); memcpy(value, valueBlob->getData(), valueBlobSize); } else { - LOGV("get: caller's buffer is too small for value: %d (needs %d)", + ALOGV("get: caller's buffer is too small for value: %d (needs %d)", valueSize, valueBlobSize); } return valueBlobSize; @@ -183,13 +183,13 @@ size_t BlobCache::getFdCount() const { status_t BlobCache::flatten(void* buffer, size_t size, int fds[], size_t count) const { if (count != 0) { - LOGE("flatten: nonzero fd count: %d", count); + ALOGE("flatten: nonzero fd count: %d", count); return BAD_VALUE; } // Write the cache header if (size < sizeof(Header)) { - LOGE("flatten: not enough room for cache header"); + ALOGE("flatten: not enough room for cache header"); return BAD_VALUE; } Header* header = reinterpret_cast<Header*>(buffer); @@ -210,7 +210,7 @@ status_t BlobCache::flatten(void* buffer, size_t size, int fds[], size_t count) size_t entrySize = sizeof(EntryHeader) + keySize + valueSize; if (byteOffset + entrySize > size) { - LOGE("flatten: not enough room for cache entries"); + ALOGE("flatten: not enough room for cache entries"); return BAD_VALUE; } @@ -234,18 +234,18 @@ status_t BlobCache::unflatten(void const* buffer, size_t size, int fds[], mCacheEntries.clear(); if (count != 0) { - LOGE("unflatten: nonzero fd count: %d", count); + ALOGE("unflatten: nonzero fd count: %d", count); return BAD_VALUE; } // Read the cache header if (size < sizeof(Header)) { - LOGE("unflatten: not enough room for cache header"); + ALOGE("unflatten: not enough room for cache header"); return BAD_VALUE; } const Header* header = reinterpret_cast<const Header*>(buffer); if (header->mMagicNumber != blobCacheMagic) { - LOGE("unflatten: bad magic number: %d", header->mMagicNumber); + ALOGE("unflatten: bad magic number: %d", header->mMagicNumber); return BAD_VALUE; } if (header->mBlobCacheVersion != blobCacheVersion || @@ -261,7 +261,7 @@ status_t BlobCache::unflatten(void const* buffer, size_t size, int fds[], for (size_t i = 0; i < numEntries; i++) { if (byteOffset + sizeof(EntryHeader) > size) { mCacheEntries.clear(); - LOGE("unflatten: not enough room for cache entry headers"); + ALOGE("unflatten: not enough room for cache entry headers"); return BAD_VALUE; } @@ -273,7 +273,7 @@ status_t BlobCache::unflatten(void const* buffer, size_t size, int fds[], if (byteOffset + entrySize > size) { mCacheEntries.clear(); - LOGE("unflatten: not enough room for cache entry headers"); + ALOGE("unflatten: not enough room for cache entry headers"); return BAD_VALUE; } diff --git a/libs/utils/CallStack.cpp b/libs/utils/CallStack.cpp index 55b6024f63..18fd84f258 100644 --- a/libs/utils/CallStack.cpp +++ b/libs/utils/CallStack.cpp @@ -17,218 +17,33 @@ #define LOG_TAG "CallStack" #include <string.h> -#include <stdlib.h> -#include <stdio.h> - -#if HAVE_DLADDR -#include <dlfcn.h> -#endif - -#if HAVE_CXXABI -#include <cxxabi.h> -#endif - -#include <unwind.h> #include <utils/Log.h> #include <utils/Errors.h> #include <utils/CallStack.h> -#include <utils/threads.h> - +#include <corkscrew/backtrace.h> /*****************************************************************************/ namespace android { - -typedef struct { - size_t count; - size_t ignore; - const void** addrs; -} stack_crawl_state_t; - -static -_Unwind_Reason_Code trace_function(_Unwind_Context *context, void *arg) -{ - stack_crawl_state_t* state = (stack_crawl_state_t*)arg; - if (state->count) { - void* ip = (void*)_Unwind_GetIP(context); - if (ip) { - if (state->ignore) { - state->ignore--; - } else { - state->addrs[0] = ip; - state->addrs++; - state->count--; - } - } - } - return _URC_NO_REASON; -} - -static -int backtrace(const void** addrs, size_t ignore, size_t size) -{ - stack_crawl_state_t state; - state.count = size; - state.ignore = ignore; - state.addrs = addrs; - _Unwind_Backtrace(trace_function, (void*)&state); - return size - state.count; -} - -/*****************************************************************************/ - -static -const char *lookup_symbol(const void* addr, void **offset, char* name, size_t bufSize) -{ -#if HAVE_DLADDR - Dl_info info; - if (dladdr(addr, &info)) { - *offset = info.dli_saddr; - return info.dli_sname; - } -#endif - return NULL; -} - -static -int32_t linux_gcc_demangler(const char *mangled_name, char *unmangled_name, size_t buffersize) -{ - size_t out_len = 0; -#if HAVE_CXXABI - int status = 0; - char *demangled = abi::__cxa_demangle(mangled_name, 0, &out_len, &status); - if (status == 0) { - // OK - if (out_len < buffersize) memcpy(unmangled_name, demangled, out_len); - else out_len = 0; - free(demangled); - } else { - out_len = 0; - } -#endif - return out_len; -} - -/*****************************************************************************/ - -class MapInfo { - struct mapinfo { - struct mapinfo *next; - uint64_t start; - uint64_t end; - char name[]; - }; - - const char *map_to_name(uint64_t pc, const char* def, uint64_t* start) { - mapinfo* mi = getMapInfoList(); - while(mi) { - if ((pc >= mi->start) && (pc < mi->end)) { - if (start) - *start = mi->start; - return mi->name; - } - mi = mi->next; - } - if (start) - *start = 0; - return def; - } - - mapinfo *parse_maps_line(char *line) { - mapinfo *mi; - int len = strlen(line); - if (len < 1) return 0; - line[--len] = 0; - if (len < 50) return 0; - if (line[20] != 'x') return 0; - mi = (mapinfo*)malloc(sizeof(mapinfo) + (len - 47)); - if (mi == 0) return 0; - mi->start = strtoull(line, 0, 16); - mi->end = strtoull(line + 9, 0, 16); - mi->next = 0; - strcpy(mi->name, line + 49); - return mi; - } - - mapinfo* getMapInfoList() { - Mutex::Autolock _l(mLock); - if (milist == 0) { - char data[1024]; - FILE *fp; - sprintf(data, "/proc/%d/maps", getpid()); - fp = fopen(data, "r"); - if (fp) { - while(fgets(data, 1024, fp)) { - mapinfo *mi = parse_maps_line(data); - if(mi) { - mi->next = milist; - milist = mi; - } - } - fclose(fp); - } - } - return milist; - } - mapinfo* milist; - Mutex mLock; - static MapInfo sMapInfo; - -public: - MapInfo() - : milist(0) { - } - - ~MapInfo() { - while (milist) { - mapinfo *next = milist->next; - free(milist); - milist = next; - } - } - - static const char *mapAddressToName(const void* pc, const char* def, - void const** start) - { - uint64_t s; - char const* name = sMapInfo.map_to_name(uint64_t(uintptr_t(pc)), def, &s); - if (start) { - *start = (void*)s; - } - return name; - } - -}; - -/*****************************************************************************/ - -MapInfo MapInfo::sMapInfo; - -/*****************************************************************************/ - -CallStack::CallStack() - : mCount(0) -{ +CallStack::CallStack() : + mCount(0) { } -CallStack::CallStack(const CallStack& rhs) - : mCount(rhs.mCount) -{ +CallStack::CallStack(const CallStack& rhs) : + mCount(rhs.mCount) { if (mCount) { - memcpy(mStack, rhs.mStack, mCount*sizeof(void*)); + memcpy(mStack, rhs.mStack, mCount * sizeof(backtrace_frame_t)); } } -CallStack::~CallStack() -{ +CallStack::~CallStack() { } -CallStack& CallStack::operator = (const CallStack& rhs) -{ +CallStack& CallStack::operator = (const CallStack& rhs) { mCount = rhs.mCount; if (mCount) { - memcpy(mStack, rhs.mStack, mCount*sizeof(void*)); + memcpy(mStack, rhs.mStack, mCount * sizeof(backtrace_frame_t)); } return *this; } @@ -236,7 +51,7 @@ CallStack& CallStack::operator = (const CallStack& rhs) bool CallStack::operator == (const CallStack& rhs) const { if (mCount != rhs.mCount) return false; - return !mCount || (memcmp(mStack, rhs.mStack, mCount*sizeof(void*)) == 0); + return !mCount || memcmp(mStack, rhs.mStack, mCount * sizeof(backtrace_frame_t)) == 0; } bool CallStack::operator != (const CallStack& rhs) const { @@ -246,7 +61,7 @@ bool CallStack::operator != (const CallStack& rhs) const { bool CallStack::operator < (const CallStack& rhs) const { if (mCount != rhs.mCount) return mCount < rhs.mCount; - return memcmp(mStack, rhs.mStack, mCount*sizeof(void*)) < 0; + return memcmp(mStack, rhs.mStack, mCount * sizeof(backtrace_frame_t)) < 0; } bool CallStack::operator >= (const CallStack& rhs) const { @@ -256,7 +71,7 @@ bool CallStack::operator >= (const CallStack& rhs) const { bool CallStack::operator > (const CallStack& rhs) const { if (mCount != rhs.mCount) return mCount > rhs.mCount; - return memcmp(mStack, rhs.mStack, mCount*sizeof(void*)) > 0; + return memcmp(mStack, rhs.mStack, mCount * sizeof(backtrace_frame_t)) > 0; } bool CallStack::operator <= (const CallStack& rhs) const { @@ -266,84 +81,49 @@ bool CallStack::operator <= (const CallStack& rhs) const { const void* CallStack::operator [] (int index) const { if (index >= int(mCount)) return 0; - return mStack[index]; + return reinterpret_cast<const void*>(mStack[index].absolute_pc); } - -void CallStack::clear() -{ +void CallStack::clear() { mCount = 0; } -void CallStack::update(int32_t ignoreDepth, int32_t maxDepth) -{ - if (maxDepth > MAX_DEPTH) +void CallStack::update(int32_t ignoreDepth, int32_t maxDepth) { + if (maxDepth > MAX_DEPTH) { maxDepth = MAX_DEPTH; - mCount = backtrace(mStack, ignoreDepth, maxDepth); -} - -// Return the stack frame name on the designated level -String8 CallStack::toStringSingleLevel(const char* prefix, int32_t level) const -{ - String8 res; - char namebuf[1024]; - char tmp[256]; - char tmp1[32]; - char tmp2[32]; - void *offs; - - const void* ip = mStack[level]; - if (!ip) return res; - - if (prefix) res.append(prefix); - snprintf(tmp1, 32, "#%02d ", level); - res.append(tmp1); - - const char* name = lookup_symbol(ip, &offs, namebuf, sizeof(namebuf)); - if (name) { - if (linux_gcc_demangler(name, tmp, 256) != 0) - name = tmp; - snprintf(tmp1, 32, "0x%p: <", ip); - snprintf(tmp2, 32, ">+0x%p", offs); - res.append(tmp1); - res.append(name); - res.append(tmp2); - } else { - void const* start = 0; - name = MapInfo::mapAddressToName(ip, "<unknown>", &start); - snprintf(tmp, 256, "pc %08lx %s", - long(uintptr_t(ip)-uintptr_t(start)), name); - res.append(tmp); } - res.append("\n"); - - return res; + ssize_t count = unwind_backtrace(mStack, ignoreDepth + 1, maxDepth); + mCount = count > 0 ? count : 0; } -// Dump a stack trace to the log -void CallStack::dump(const char* prefix) const -{ - /* - * Sending a single long log may be truncated since the stack levels can - * get very deep. So we request function names of each frame individually. - */ - for (int i=0; i<int(mCount); i++) { - LOGD("%s", toStringSingleLevel(prefix, i).string()); +void CallStack::dump(const char* prefix) const { + backtrace_symbol_t symbols[mCount]; + + get_backtrace_symbols(mStack, mCount, symbols); + for (size_t i = 0; i < mCount; i++) { + char line[MAX_BACKTRACE_LINE_LENGTH]; + format_backtrace_line(i, &mStack[i], &symbols[i], + line, MAX_BACKTRACE_LINE_LENGTH); + ALOGD("%s%s", prefix, line); } + free_backtrace_symbols(symbols, mCount); } -// Return a string (possibly very long) containing the complete stack trace -String8 CallStack::toString(const char* prefix) const -{ - String8 res; +String8 CallStack::toString(const char* prefix) const { + String8 str; + backtrace_symbol_t symbols[mCount]; - for (int i=0; i<int(mCount); i++) { - res.append(toStringSingleLevel(prefix, i).string()); + get_backtrace_symbols(mStack, mCount, symbols); + for (size_t i = 0; i < mCount; i++) { + char line[MAX_BACKTRACE_LINE_LENGTH]; + format_backtrace_line(i, &mStack[i], &symbols[i], + line, MAX_BACKTRACE_LINE_LENGTH); + str.append(prefix); + str.append(line); + str.append("\n"); } - - return res; + free_backtrace_symbols(symbols, mCount); + return str; } -/*****************************************************************************/ - }; // namespace android diff --git a/libs/utils/FileMap.cpp b/libs/utils/FileMap.cpp index c220a9016f..9ce370e0eb 100644 --- a/libs/utils/FileMap.cpp +++ b/libs/utils/FileMap.cpp @@ -64,12 +64,12 @@ FileMap::~FileMap(void) } #ifdef HAVE_POSIX_FILEMAP if (mBasePtr && munmap(mBasePtr, mBaseLength) != 0) { - LOGD("munmap(%p, %d) failed\n", mBasePtr, (int) mBaseLength); + ALOGD("munmap(%p, %d) failed\n", mBasePtr, (int) mBaseLength); } #endif #ifdef HAVE_WIN32_FILEMAP if (mBasePtr && UnmapViewOfFile(mBasePtr) == 0) { - LOGD("UnmapViewOfFile(%p) failed, error = %ld\n", mBasePtr, + ALOGD("UnmapViewOfFile(%p) failed, error = %ld\n", mBasePtr, GetLastError() ); } if (mFileMapping != INVALID_HANDLE_VALUE) { @@ -108,7 +108,7 @@ bool FileMap::create(const char* origFileName, int fd, off64_t offset, size_t le mFileHandle = (HANDLE) _get_osfhandle(fd); mFileMapping = CreateFileMapping( mFileHandle, NULL, protect, 0, 0, NULL); if (mFileMapping == NULL) { - LOGE("CreateFileMapping(%p, %lx) failed with error %ld\n", + ALOGE("CreateFileMapping(%p, %lx) failed with error %ld\n", mFileHandle, protect, GetLastError() ); return false; } @@ -123,7 +123,7 @@ bool FileMap::create(const char* origFileName, int fd, off64_t offset, size_t le (DWORD)(adjOffset), adjLength ); if (mBasePtr == NULL) { - LOGE("MapViewOfFile(%ld, %ld) failed with error %ld\n", + ALOGE("MapViewOfFile(%ld, %ld) failed with error %ld\n", adjOffset, adjLength, GetLastError() ); CloseHandle(mFileMapping); mFileMapping = INVALID_HANDLE_VALUE; @@ -147,7 +147,7 @@ bool FileMap::create(const char* origFileName, int fd, off64_t offset, size_t le #if NOT_USING_KLIBC mPageSize = sysconf(_SC_PAGESIZE); if (mPageSize == -1) { - LOGE("could not get _SC_PAGESIZE\n"); + ALOGE("could not get _SC_PAGESIZE\n"); return false; } #else @@ -175,7 +175,7 @@ try_again: goto try_again; } - LOGE("mmap(%ld,%ld) failed: %s\n", + ALOGE("mmap(%ld,%ld) failed: %s\n", (long) adjOffset, (long) adjLength, strerror(errno)); return false; } @@ -190,7 +190,7 @@ try_again: assert(mBasePtr != NULL); - LOGV("MAP: base %p/%d data %p/%d\n", + ALOGV("MAP: base %p/%d data %p/%d\n", mBasePtr, (int) mBaseLength, mDataPtr, (int) mDataLength); return true; @@ -217,7 +217,7 @@ int FileMap::advise(MapAdvice advice) cc = madvise(mBasePtr, mBaseLength, sysAdvice); if (cc != 0) - LOGW("madvise(%d) failed: %s\n", sysAdvice, strerror(errno)); + ALOGW("madvise(%d) failed: %s\n", sysAdvice, strerror(errno)); return cc; #else return -1; diff --git a/libs/utils/Looper.cpp b/libs/utils/Looper.cpp index b54fb9dd73..d1aa664bca 100644 --- a/libs/utils/Looper.cpp +++ b/libs/utils/Looper.cpp @@ -163,7 +163,7 @@ sp<Looper> Looper::prepare(int opts) { Looper::setForThread(looper); } if (looper->getAllowNonCallbacks() != allowNonCallbacks) { - LOGW("Looper already prepared for this thread with a different value for the " + ALOGW("Looper already prepared for this thread with a different value for the " "ALOOPER_PREPARE_ALLOW_NON_CALLBACKS option."); } return looper; @@ -185,7 +185,7 @@ int Looper::pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outDa int events = response.events; void* data = response.request.data; #if DEBUG_POLL_AND_WAKE - LOGD("%p ~ pollOnce - returning signalled identifier %d: " + ALOGD("%p ~ pollOnce - returning signalled identifier %d: " "fd=%d, events=0x%x, data=%p", this, ident, fd, events, data); #endif @@ -198,7 +198,7 @@ int Looper::pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outDa if (result != 0) { #if DEBUG_POLL_AND_WAKE - LOGD("%p ~ pollOnce - returning result %d", this, result); + ALOGD("%p ~ pollOnce - returning result %d", this, result); #endif if (outFd != NULL) *outFd = 0; if (outEvents != NULL) *outEvents = NULL; @@ -212,7 +212,7 @@ int Looper::pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outDa int Looper::pollInner(int timeoutMillis) { #if DEBUG_POLL_AND_WAKE - LOGD("%p ~ pollOnce - waiting: timeoutMillis=%d", this, timeoutMillis); + ALOGD("%p ~ pollOnce - waiting: timeoutMillis=%d", this, timeoutMillis); #endif // Adjust the timeout based on when the next message is due. @@ -224,7 +224,7 @@ int Looper::pollInner(int timeoutMillis) { timeoutMillis = messageTimeoutMillis; } #if DEBUG_POLL_AND_WAKE - LOGD("%p ~ pollOnce - next message in %lldns, adjusted timeout: timeoutMillis=%d", + ALOGD("%p ~ pollOnce - next message in %lldns, adjusted timeout: timeoutMillis=%d", this, mNextMessageUptime - now, timeoutMillis); #endif } @@ -262,7 +262,7 @@ int Looper::pollInner(int timeoutMillis) { if (errno == EINTR) { goto Done; } - LOGW("Poll failed with an unexpected error, errno=%d", errno); + ALOGW("Poll failed with an unexpected error, errno=%d", errno); result = ALOOPER_POLL_ERROR; goto Done; } @@ -270,7 +270,7 @@ int Looper::pollInner(int timeoutMillis) { // Check for poll timeout. if (eventCount == 0) { #if DEBUG_POLL_AND_WAKE - LOGD("%p ~ pollOnce - timeout", this); + ALOGD("%p ~ pollOnce - timeout", this); #endif result = ALOOPER_POLL_TIMEOUT; goto Done; @@ -278,7 +278,7 @@ int Looper::pollInner(int timeoutMillis) { // Handle all events. #if DEBUG_POLL_AND_WAKE - LOGD("%p ~ pollOnce - handling events from %d fds", this, eventCount); + ALOGD("%p ~ pollOnce - handling events from %d fds", this, eventCount); #endif #ifdef LOOPER_USES_EPOLL @@ -289,7 +289,7 @@ int Looper::pollInner(int timeoutMillis) { if (epollEvents & EPOLLIN) { awoken(); } else { - LOGW("Ignoring unexpected epoll events 0x%x on wake read pipe.", epollEvents); + ALOGW("Ignoring unexpected epoll events 0x%x on wake read pipe.", epollEvents); } } else { ssize_t requestIndex = mRequests.indexOfKey(fd); @@ -301,7 +301,7 @@ int Looper::pollInner(int timeoutMillis) { if (epollEvents & EPOLLHUP) events |= ALOOPER_EVENT_HANGUP; pushResponse(events, mRequests.valueAt(requestIndex)); } else { - LOGW("Ignoring unexpected epoll events 0x%x on fd %d that is " + ALOGW("Ignoring unexpected epoll events 0x%x on fd %d that is " "no longer registered.", epollEvents, fd); } } @@ -317,7 +317,7 @@ Done: ; if (pollEvents & POLLIN) { awoken(); } else { - LOGW("Ignoring unexpected poll events 0x%x on wake read pipe.", pollEvents); + ALOGW("Ignoring unexpected poll events 0x%x on wake read pipe.", pollEvents); } } else { int events = 0; @@ -353,7 +353,7 @@ Done: - milliseconds_to_nanoseconds(timeoutMillis); } if (mSampledPolls == SAMPLED_POLLS_TO_AGGREGATE) { - LOGD("%p ~ poll latency statistics: %0.3fms zero timeout, %0.3fms non-zero timeout", this, + ALOGD("%p ~ poll latency statistics: %0.3fms zero timeout, %0.3fms non-zero timeout", this, 0.000001f * float(mSampledZeroPollLatencySum) / mSampledZeroPollCount, 0.000001f * float(mSampledTimeoutPollLatencySum) / mSampledTimeoutPollCount); mSampledPolls = 0; @@ -382,7 +382,7 @@ Done: mLock.unlock(); #if DEBUG_POLL_AND_WAKE || DEBUG_CALLBACKS - LOGD("%p ~ pollOnce - sending message: handler=%p, what=%d", + ALOGD("%p ~ pollOnce - sending message: handler=%p, what=%d", this, handler.get(), message.what); #endif handler->handleMessage(message); @@ -410,7 +410,7 @@ Done: int events = response.events; void* data = response.request.data; #if DEBUG_POLL_AND_WAKE || DEBUG_CALLBACKS - LOGD("%p ~ pollOnce - invoking fd event callback %p: fd=%d, events=0x%x, data=%p", + ALOGD("%p ~ pollOnce - invoking fd event callback %p: fd=%d, events=0x%x, data=%p", this, callback, fd, events, data); #endif int callbackResult = callback(fd, events, data); @@ -451,7 +451,7 @@ int Looper::pollAll(int timeoutMillis, int* outFd, int* outEvents, void** outDat void Looper::wake() { #if DEBUG_POLL_AND_WAKE - LOGD("%p ~ wake", this); + ALOGD("%p ~ wake", this); #endif #ifdef LOOPER_STATISTICS @@ -468,19 +468,19 @@ void Looper::wake() { if (nWrite != 1) { if (errno != EAGAIN) { - LOGW("Could not write wake signal, errno=%d", errno); + ALOGW("Could not write wake signal, errno=%d", errno); } } } void Looper::awoken() { #if DEBUG_POLL_AND_WAKE - LOGD("%p ~ awoken", this); + ALOGD("%p ~ awoken", this); #endif #ifdef LOOPER_STATISTICS if (mPendingWakeCount == 0) { - LOGD("%p ~ awoken: spurious!", this); + ALOGD("%p ~ awoken: spurious!", this); } else { mSampledWakeCycles += 1; mSampledWakeCountSum += mPendingWakeCount; @@ -488,7 +488,7 @@ void Looper::awoken() { mPendingWakeCount = 0; mPendingWakeTime = -1; if (mSampledWakeCycles == SAMPLED_WAKE_CYCLES_TO_AGGREGATE) { - LOGD("%p ~ wake statistics: %0.3fms wake latency, %0.3f wakes per cycle", this, + ALOGD("%p ~ wake statistics: %0.3fms wake latency, %0.3f wakes per cycle", this, 0.000001f * float(mSampledWakeLatencySum) / mSampledWakeCycles, float(mSampledWakeCountSum) / mSampledWakeCycles); mSampledWakeCycles = 0; @@ -514,18 +514,18 @@ void Looper::pushResponse(int events, const Request& request) { int Looper::addFd(int fd, int ident, int events, ALooper_callbackFunc callback, void* data) { #if DEBUG_CALLBACKS - LOGD("%p ~ addFd - fd=%d, ident=%d, events=0x%x, callback=%p, data=%p", this, fd, ident, + ALOGD("%p ~ addFd - fd=%d, ident=%d, events=0x%x, callback=%p, data=%p", this, fd, ident, events, callback, data); #endif if (! callback) { if (! mAllowNonCallbacks) { - LOGE("Invalid attempt to set NULL callback but not allowed for this looper."); + ALOGE("Invalid attempt to set NULL callback but not allowed for this looper."); return -1; } if (ident < 0) { - LOGE("Invalid attempt to set NULL callback with ident <= 0."); + ALOGE("Invalid attempt to set NULL callback with ident <= 0."); return -1; } } @@ -553,14 +553,14 @@ int Looper::addFd(int fd, int ident, int events, ALooper_callbackFunc callback, if (requestIndex < 0) { int epollResult = epoll_ctl(mEpollFd, EPOLL_CTL_ADD, fd, & eventItem); if (epollResult < 0) { - LOGE("Error adding epoll events for fd %d, errno=%d", fd, errno); + ALOGE("Error adding epoll events for fd %d, errno=%d", fd, errno); return -1; } mRequests.add(fd, request); } else { int epollResult = epoll_ctl(mEpollFd, EPOLL_CTL_MOD, fd, & eventItem); if (epollResult < 0) { - LOGE("Error modifying epoll events for fd %d, errno=%d", fd, errno); + ALOGE("Error modifying epoll events for fd %d, errno=%d", fd, errno); return -1; } mRequests.replaceValueAt(requestIndex, request); @@ -598,7 +598,7 @@ int Looper::addFd(int fd, int ident, int events, ALooper_callbackFunc callback, int Looper::removeFd(int fd) { #if DEBUG_CALLBACKS - LOGD("%p ~ removeFd - fd=%d", this, fd); + ALOGD("%p ~ removeFd - fd=%d", this, fd); #endif #ifdef LOOPER_USES_EPOLL @@ -611,7 +611,7 @@ int Looper::removeFd(int fd) { int epollResult = epoll_ctl(mEpollFd, EPOLL_CTL_DEL, fd, NULL); if (epollResult < 0) { - LOGE("Error removing epoll events for fd %d, errno=%d", fd, errno); + ALOGE("Error removing epoll events for fd %d, errno=%d", fd, errno); return -1; } @@ -675,7 +675,7 @@ void Looper::sendMessageDelayed(nsecs_t uptimeDelay, const sp<MessageHandler>& h void Looper::sendMessageAtTime(nsecs_t uptime, const sp<MessageHandler>& handler, const Message& message) { #if DEBUG_CALLBACKS - LOGD("%p ~ sendMessageAtTime - uptime=%lld, handler=%p, what=%d", + ALOGD("%p ~ sendMessageAtTime - uptime=%lld, handler=%p, what=%d", this, uptime, handler.get(), message.what); #endif @@ -708,7 +708,7 @@ void Looper::sendMessageAtTime(nsecs_t uptime, const sp<MessageHandler>& handler void Looper::removeMessages(const sp<MessageHandler>& handler) { #if DEBUG_CALLBACKS - LOGD("%p ~ removeMessages - handler=%p", this, handler.get()); + ALOGD("%p ~ removeMessages - handler=%p", this, handler.get()); #endif { // acquire lock @@ -725,7 +725,7 @@ void Looper::removeMessages(const sp<MessageHandler>& handler) { void Looper::removeMessages(const sp<MessageHandler>& handler, int what) { #if DEBUG_CALLBACKS - LOGD("%p ~ removeMessages - handler=%p, what=%d", this, handler.get(), what); + ALOGD("%p ~ removeMessages - handler=%p, what=%d", this, handler.get(), what); #endif { // acquire lock diff --git a/libs/utils/ObbFile.cpp b/libs/utils/ObbFile.cpp index 2907b5666b..ddf59914b8 100644 --- a/libs/utils/ObbFile.cpp +++ b/libs/utils/ObbFile.cpp @@ -90,14 +90,14 @@ bool ObbFile::readFrom(const char* filename) fd = ::open(filename, O_RDONLY); if (fd < 0) { - LOGW("couldn't open file %s: %s", filename, strerror(errno)); + ALOGW("couldn't open file %s: %s", filename, strerror(errno)); goto out; } success = readFrom(fd); close(fd); if (!success) { - LOGW("failed to read from %s (fd=%d)\n", filename, fd); + ALOGW("failed to read from %s (fd=%d)\n", filename, fd); } out: @@ -107,7 +107,7 @@ out: bool ObbFile::readFrom(int fd) { if (fd < 0) { - LOGW("attempt to read from invalid fd\n"); + ALOGW("attempt to read from invalid fd\n"); return false; } @@ -120,9 +120,9 @@ bool ObbFile::parseObbFile(int fd) if (fileLength < kFooterMinSize) { if (fileLength < 0) { - LOGW("error seeking in ObbFile: %s\n", strerror(errno)); + ALOGW("error seeking in ObbFile: %s\n", strerror(errno)); } else { - LOGW("file is only %lld (less than %d minimum)\n", fileLength, kFooterMinSize); + ALOGW("file is only %lld (less than %d minimum)\n", fileLength, kFooterMinSize); } return false; } @@ -136,13 +136,13 @@ bool ObbFile::parseObbFile(int fd) char *footer = new char[kFooterTagSize]; actual = TEMP_FAILURE_RETRY(read(fd, footer, kFooterTagSize)); if (actual != kFooterTagSize) { - LOGW("couldn't read footer signature: %s\n", strerror(errno)); + ALOGW("couldn't read footer signature: %s\n", strerror(errno)); return false; } unsigned int fileSig = get4LE((unsigned char*)footer + sizeof(int32_t)); if (fileSig != kSignature) { - LOGW("footer didn't match magic string (expected 0x%08x; got 0x%08x)\n", + ALOGW("footer didn't match magic string (expected 0x%08x; got 0x%08x)\n", kSignature, fileSig); return false; } @@ -150,13 +150,13 @@ bool ObbFile::parseObbFile(int fd) footerSize = get4LE((unsigned char*)footer); if (footerSize > (size_t)fileLength - kFooterTagSize || footerSize > kMaxBufSize) { - LOGW("claimed footer size is too large (0x%08zx; file size is 0x%08llx)\n", + ALOGW("claimed footer size is too large (0x%08zx; file size is 0x%08llx)\n", footerSize, fileLength); return false; } if (footerSize < (kFooterMinSize - kFooterTagSize)) { - LOGW("claimed footer size is too small (0x%zx; minimum size is 0x%x)\n", + ALOGW("claimed footer size is too small (0x%zx; minimum size is 0x%x)\n", footerSize, kFooterMinSize - kFooterTagSize); return false; } @@ -164,7 +164,7 @@ bool ObbFile::parseObbFile(int fd) off64_t fileOffset = fileLength - footerSize - kFooterTagSize; if (lseek64(fd, fileOffset, SEEK_SET) != fileOffset) { - LOGW("seek %lld failed: %s\n", fileOffset, strerror(errno)); + ALOGW("seek %lld failed: %s\n", fileOffset, strerror(errno)); return false; } @@ -172,27 +172,27 @@ bool ObbFile::parseObbFile(int fd) char* scanBuf = (char*)malloc(footerSize); if (scanBuf == NULL) { - LOGW("couldn't allocate scanBuf: %s\n", strerror(errno)); + ALOGW("couldn't allocate scanBuf: %s\n", strerror(errno)); return false; } actual = TEMP_FAILURE_RETRY(read(fd, scanBuf, footerSize)); // readAmount is guaranteed to be less than kMaxBufSize if (actual != (ssize_t)footerSize) { - LOGI("couldn't read ObbFile footer: %s\n", strerror(errno)); + ALOGI("couldn't read ObbFile footer: %s\n", strerror(errno)); free(scanBuf); return false; } #ifdef DEBUG for (int i = 0; i < footerSize; ++i) { - LOGI("char: 0x%02x\n", scanBuf[i]); + ALOGI("char: 0x%02x\n", scanBuf[i]); } #endif uint32_t sigVersion = get4LE((unsigned char*)scanBuf); if (sigVersion != kSigVersion) { - LOGW("Unsupported ObbFile version %d\n", sigVersion); + ALOGW("Unsupported ObbFile version %d\n", sigVersion); free(scanBuf); return false; } @@ -205,7 +205,7 @@ bool ObbFile::parseObbFile(int fd) size_t packageNameLen = get4LE((unsigned char*)scanBuf + kPackageNameLenOffset); if (packageNameLen == 0 || packageNameLen > (footerSize - kPackageNameOffset)) { - LOGW("bad ObbFile package name length (0x%04zx; 0x%04zx possible)\n", + ALOGW("bad ObbFile package name length (0x%04zx; 0x%04zx possible)\n", packageNameLen, footerSize - kPackageNameOffset); free(scanBuf); return false; @@ -217,7 +217,7 @@ bool ObbFile::parseObbFile(int fd) free(scanBuf); #ifdef DEBUG - LOGI("Obb scan succeeded: packageName=%s, version=%d\n", mPackageName.string(), mVersion); + ALOGI("Obb scan succeeded: packageName=%s, version=%d\n", mPackageName.string(), mVersion); #endif return true; @@ -237,7 +237,7 @@ bool ObbFile::writeTo(const char* filename) out: if (!success) { - LOGW("failed to write to %s: %s\n", filename, strerror(errno)); + ALOGW("failed to write to %s: %s\n", filename, strerror(errno)); } return success; } @@ -251,7 +251,7 @@ bool ObbFile::writeTo(int fd) lseek64(fd, 0, SEEK_END); if (mPackageName.size() == 0 || mVersion == -1) { - LOGW("tried to write uninitialized ObbFile data\n"); + ALOGW("tried to write uninitialized ObbFile data\n"); return false; } @@ -260,48 +260,48 @@ bool ObbFile::writeTo(int fd) put4LE(intBuf, kSigVersion); if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) { - LOGW("couldn't write signature version: %s\n", strerror(errno)); + ALOGW("couldn't write signature version: %s\n", strerror(errno)); return false; } put4LE(intBuf, mVersion); if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) { - LOGW("couldn't write package version\n"); + ALOGW("couldn't write package version\n"); return false; } put4LE(intBuf, mFlags); if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) { - LOGW("couldn't write package version\n"); + ALOGW("couldn't write package version\n"); return false; } if (write(fd, mSalt, sizeof(mSalt)) != (ssize_t)sizeof(mSalt)) { - LOGW("couldn't write salt: %s\n", strerror(errno)); + ALOGW("couldn't write salt: %s\n", strerror(errno)); return false; } size_t packageNameLen = mPackageName.size(); put4LE(intBuf, packageNameLen); if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) { - LOGW("couldn't write package name length: %s\n", strerror(errno)); + ALOGW("couldn't write package name length: %s\n", strerror(errno)); return false; } if (write(fd, mPackageName.string(), packageNameLen) != (ssize_t)packageNameLen) { - LOGW("couldn't write package name: %s\n", strerror(errno)); + ALOGW("couldn't write package name: %s\n", strerror(errno)); return false; } put4LE(intBuf, kPackageNameOffset + packageNameLen); if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) { - LOGW("couldn't write footer size: %s\n", strerror(errno)); + ALOGW("couldn't write footer size: %s\n", strerror(errno)); return false; } put4LE(intBuf, kSignature); if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) { - LOGW("couldn't write footer magic signature: %s\n", strerror(errno)); + ALOGW("couldn't write footer magic signature: %s\n", strerror(errno)); return false; } @@ -322,7 +322,7 @@ bool ObbFile::removeFrom(const char* filename) out: if (!success) { - LOGW("failed to remove signature from %s: %s\n", filename, strerror(errno)); + ALOGW("failed to remove signature from %s: %s\n", filename, strerror(errno)); } return success; } diff --git a/libs/utils/PropertyMap.cpp b/libs/utils/PropertyMap.cpp index d472d45c4d..55207027bf 100644 --- a/libs/utils/PropertyMap.cpp +++ b/libs/utils/PropertyMap.cpp @@ -84,7 +84,7 @@ bool PropertyMap::tryGetProperty(const String8& key, int32_t& outValue) const { char* end; int value = strtol(stringValue.string(), & end, 10); if (*end != '\0') { - LOGW("Property key '%s' has invalid value '%s'. Expected an integer.", + ALOGW("Property key '%s' has invalid value '%s'. Expected an integer.", key.string(), stringValue.string()); return false; } @@ -101,7 +101,7 @@ bool PropertyMap::tryGetProperty(const String8& key, float& outValue) const { char* end; float value = strtof(stringValue.string(), & end); if (*end != '\0') { - LOGW("Property key '%s' has invalid value '%s'. Expected a float.", + ALOGW("Property key '%s' has invalid value '%s'. Expected a float.", key.string(), stringValue.string()); return false; } @@ -121,11 +121,11 @@ status_t PropertyMap::load(const String8& filename, PropertyMap** outMap) { Tokenizer* tokenizer; status_t status = Tokenizer::open(filename, &tokenizer); if (status) { - LOGE("Error %d opening property file %s.", status, filename.string()); + ALOGE("Error %d opening property file %s.", status, filename.string()); } else { PropertyMap* map = new PropertyMap(); if (!map) { - LOGE("Error allocating property map."); + ALOGE("Error allocating property map."); status = NO_MEMORY; } else { #if DEBUG_PARSER_PERFORMANCE @@ -135,7 +135,7 @@ status_t PropertyMap::load(const String8& filename, PropertyMap** outMap) { status = parser.parse(); #if DEBUG_PARSER_PERFORMANCE nsecs_t elapsedTime = systemTime(SYSTEM_TIME_MONOTONIC) - startTime; - LOGD("Parsed property file '%s' %d lines in %0.3fms.", + ALOGD("Parsed property file '%s' %d lines in %0.3fms.", tokenizer->getFilename().string(), tokenizer->getLineNumber(), elapsedTime / 1000000.0); #endif @@ -163,7 +163,7 @@ PropertyMap::Parser::~Parser() { status_t PropertyMap::Parser::parse() { while (!mTokenizer->isEof()) { #if DEBUG_PARSER - LOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(), + ALOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(), mTokenizer->peekRemainderOfLine().string()); #endif @@ -172,14 +172,14 @@ status_t PropertyMap::Parser::parse() { if (!mTokenizer->isEol() && mTokenizer->peekChar() != '#') { String8 keyToken = mTokenizer->nextToken(WHITESPACE_OR_PROPERTY_DELIMITER); if (keyToken.isEmpty()) { - LOGE("%s: Expected non-empty property key.", mTokenizer->getLocation().string()); + ALOGE("%s: Expected non-empty property key.", mTokenizer->getLocation().string()); return BAD_VALUE; } mTokenizer->skipDelimiters(WHITESPACE); if (mTokenizer->nextChar() != '=') { - LOGE("%s: Expected '=' between property key and value.", + ALOGE("%s: Expected '=' between property key and value.", mTokenizer->getLocation().string()); return BAD_VALUE; } @@ -188,21 +188,21 @@ status_t PropertyMap::Parser::parse() { String8 valueToken = mTokenizer->nextToken(WHITESPACE); if (valueToken.find("\\", 0) >= 0 || valueToken.find("\"", 0) >= 0) { - LOGE("%s: Found reserved character '\\' or '\"' in property value.", + ALOGE("%s: Found reserved character '\\' or '\"' in property value.", mTokenizer->getLocation().string()); return BAD_VALUE; } mTokenizer->skipDelimiters(WHITESPACE); if (!mTokenizer->isEol()) { - LOGE("%s: Expected end of line, got '%s'.", + ALOGE("%s: Expected end of line, got '%s'.", mTokenizer->getLocation().string(), mTokenizer->peekRemainderOfLine().string()); return BAD_VALUE; } if (mMap->hasProperty(keyToken)) { - LOGE("%s: Duplicate property value for key '%s'.", + ALOGE("%s: Duplicate property value for key '%s'.", mTokenizer->getLocation().string(), keyToken.string()); return BAD_VALUE; } diff --git a/libs/utils/RefBase.cpp b/libs/utils/RefBase.cpp index 37d061cb3c..ad0939e574 100644 --- a/libs/utils/RefBase.cpp +++ b/libs/utils/RefBase.cpp @@ -98,12 +98,12 @@ public: #if DEBUG_REFS_FATAL_SANITY_CHECKS LOG_ALWAYS_FATAL("Strong references remain!"); #else - LOGE("Strong references remain:"); + ALOGE("Strong references remain:"); #endif ref_entry* refs = mStrongRefs; while (refs) { char inc = refs->ref >= 0 ? '+' : '-'; - LOGD("\t%c ID %p (ref %d):", inc, refs->id, refs->ref); + ALOGD("\t%c ID %p (ref %d):", inc, refs->id, refs->ref); #if DEBUG_REFS_CALLSTACK_ENABLED refs->stack.dump(); #endif @@ -116,12 +116,12 @@ public: #if DEBUG_REFS_FATAL_SANITY_CHECKS LOG_ALWAYS_FATAL("Weak references remain:"); #else - LOGE("Weak references remain!"); + ALOGE("Weak references remain!"); #endif ref_entry* refs = mWeakRefs; while (refs) { char inc = refs->ref >= 0 ? '+' : '-'; - LOGD("\t%c ID %p (ref %d):", inc, refs->id, refs->ref); + ALOGD("\t%c ID %p (ref %d):", inc, refs->id, refs->ref); #if DEBUG_REFS_CALLSTACK_ENABLED refs->stack.dump(); #endif @@ -129,7 +129,7 @@ public: } } if (dumpStack) { - LOGE("above errors at:"); + ALOGE("above errors at:"); CallStack stack; stack.update(); stack.dump(); @@ -137,13 +137,13 @@ public: } void addStrongRef(const void* id) { - //LOGD_IF(mTrackEnabled, + //ALOGD_IF(mTrackEnabled, // "addStrongRef: RefBase=%p, id=%p", mBase, id); addRef(&mStrongRefs, id, mStrong); } void removeStrongRef(const void* id) { - //LOGD_IF(mTrackEnabled, + //ALOGD_IF(mTrackEnabled, // "removeStrongRef: RefBase=%p, id=%p", mBase, id); if (!mRetain) { removeRef(&mStrongRefs, id); @@ -153,7 +153,7 @@ public: } void renameStrongRefId(const void* old_id, const void* new_id) { - //LOGD_IF(mTrackEnabled, + //ALOGD_IF(mTrackEnabled, // "renameStrongRefId: RefBase=%p, oid=%p, nid=%p", // mBase, old_id, new_id); renameRefsId(mStrongRefs, old_id, new_id); @@ -203,9 +203,9 @@ public: if (rc >= 0) { write(rc, text.string(), text.length()); close(rc); - LOGD("STACK TRACE for %p saved in %s", this, name); + ALOGD("STACK TRACE for %p saved in %s", this, name); } - else LOGE("FAILED TO PRINT STACK TRACE for %p in %s: %s", this, + else ALOGE("FAILED TO PRINT STACK TRACE for %p in %s: %s", this, name, strerror(errno)); } } @@ -263,14 +263,14 @@ private: id, mBase, this); #endif - LOGE("RefBase: removing id %p on RefBase %p" + ALOGE("RefBase: removing id %p on RefBase %p" "(weakref_type %p) that doesn't exist!", id, mBase, this); ref = head; while (ref) { char inc = ref->ref >= 0 ? '+' : '-'; - LOGD("\t%c ID %p (ref %d):", inc, ref->id, ref->ref); + ALOGD("\t%c ID %p (ref %d):", inc, ref->id, ref->ref); ref = ref->next; } @@ -334,7 +334,7 @@ void RefBase::incStrong(const void* id) const const int32_t c = android_atomic_inc(&refs->mStrong); LOG_ASSERT(c > 0, "incStrong() called on %p after last strong ref", refs); #if PRINT_REFS - LOGD("incStrong of %p from %p: cnt=%d\n", this, id, c); + ALOGD("incStrong of %p from %p: cnt=%d\n", this, id, c); #endif if (c != INITIAL_STRONG_VALUE) { return; @@ -350,7 +350,7 @@ void RefBase::decStrong(const void* id) const refs->removeStrongRef(id); const int32_t c = android_atomic_dec(&refs->mStrong); #if PRINT_REFS - LOGD("decStrong of %p from %p: cnt=%d\n", this, id, c); + ALOGD("decStrong of %p from %p: cnt=%d\n", this, id, c); #endif LOG_ASSERT(c >= 1, "decStrong() called on %p too many times", refs); if (c == 1) { @@ -372,7 +372,7 @@ void RefBase::forceIncStrong(const void* id) const LOG_ASSERT(c >= 0, "forceIncStrong called on %p after ref count underflow", refs); #if PRINT_REFS - LOGD("forceIncStrong of %p from %p: cnt=%d\n", this, id, c); + ALOGD("forceIncStrong of %p from %p: cnt=%d\n", this, id, c); #endif switch (c) { @@ -421,7 +421,7 @@ void RefBase::weakref_type::decWeak(const void* id) // destroy the object now. delete impl->mBase; } else { - // LOGV("Freeing refs %p of old RefBase %p\n", this, impl->mBase); + // ALOGV("Freeing refs %p of old RefBase %p\n", this, impl->mBase); delete impl; } } else { @@ -487,7 +487,7 @@ bool RefBase::weakref_type::attemptIncStrong(const void* id) impl->addStrongRef(id); #if PRINT_REFS - LOGD("attemptIncStrong of %p from %p: cnt=%d\n", this, id, curCount); + ALOGD("attemptIncStrong of %p from %p: cnt=%d\n", this, id, curCount); #endif if (curCount == INITIAL_STRONG_VALUE) { diff --git a/libs/utils/ResourceTypes.cpp b/libs/utils/ResourceTypes.cpp index 6cf01c8d68..15b83bbd2c 100644 --- a/libs/utils/ResourceTypes.cpp +++ b/libs/utils/ResourceTypes.cpp @@ -69,7 +69,7 @@ namespace android { static void printToLogFunc(void* cookie, const char* txt) { - LOGV("%s", txt); + ALOGV("%s", txt); } // Standard C isspace() is only required to look at the low byte of its input, so @@ -107,20 +107,20 @@ static status_t validate_chunk(const ResChunk_header* chunk, if ((ssize_t)size <= (dataEnd-((const uint8_t*)chunk))) { return NO_ERROR; } - LOGW("%s data size %p extends beyond resource end %p.", + ALOGW("%s data size %p extends beyond resource end %p.", name, (void*)size, (void*)(dataEnd-((const uint8_t*)chunk))); return BAD_TYPE; } - LOGW("%s size 0x%x or headerSize 0x%x is not on an integer boundary.", + ALOGW("%s size 0x%x or headerSize 0x%x is not on an integer boundary.", name, (int)size, (int)headerSize); return BAD_TYPE; } - LOGW("%s size %p is smaller than header size %p.", + ALOGW("%s size %p is smaller than header size %p.", name, (void*)size, (void*)(int)headerSize); return BAD_TYPE; } - LOGW("%s header size %p is too small.", + ALOGW("%s header size %p is too small.", name, (void*)(int)headerSize); return BAD_TYPE; } @@ -221,11 +221,11 @@ static void deserializeInternal(const void* inData, Res_png_9patch* outData) { static bool assertIdmapHeader(const uint32_t* map, size_t sizeBytes) { if (sizeBytes < ResTable::IDMAP_HEADER_SIZE_BYTES) { - LOGW("idmap assertion failed: size=%d bytes\n", sizeBytes); + ALOGW("idmap assertion failed: size=%d bytes\n", sizeBytes); return false; } if (*map != htodl(IDMAP_MAGIC)) { // htodl: map data expected to be in correct endianess - LOGW("idmap assertion failed: invalid magic found (is 0x%08x, expected 0x%08x)\n", + ALOGW("idmap assertion failed: invalid magic found (is 0x%08x, expected 0x%08x)\n", *map, htodl(IDMAP_MAGIC)); return false; } @@ -246,11 +246,11 @@ static status_t idmapLookup(const uint32_t* map, size_t sizeBytes, uint32_t key, const uint32_t typeCount = *map; if (type > typeCount) { - LOGW("Resource ID map: type=%d exceeds number of types=%d\n", type, typeCount); + ALOGW("Resource ID map: type=%d exceeds number of types=%d\n", type, typeCount); return UNKNOWN_ERROR; } if (typeCount > size) { - LOGW("Resource ID map: number of types=%d exceeds size of map=%d\n", typeCount, size); + ALOGW("Resource ID map: number of types=%d exceeds size of map=%d\n", typeCount, size); return UNKNOWN_ERROR; } const uint32_t typeOffset = map[type]; @@ -259,7 +259,7 @@ static status_t idmapLookup(const uint32_t* map, size_t sizeBytes, uint32_t key, return NO_ERROR; } if (typeOffset + 1 > size) { - LOGW("Resource ID map: type offset=%d exceeds reasonable value, size of map=%d\n", + ALOGW("Resource ID map: type offset=%d exceeds reasonable value, size of map=%d\n", typeOffset, size); return UNKNOWN_ERROR; } @@ -271,7 +271,7 @@ static status_t idmapLookup(const uint32_t* map, size_t sizeBytes, uint32_t key, } const uint32_t index = typeOffset + 2 + entry - entryOffset; if (index > size) { - LOGW("Resource ID map: entry index=%d exceeds size of map=%d\n", index, size); + ALOGW("Resource ID map: entry index=%d exceeds size of map=%d\n", index, size); *outValue = 0; return NO_ERROR; } @@ -296,7 +296,7 @@ static status_t getIdmapPackageId(const uint32_t* map, size_t mapSize, uint32_t Res_png_9patch* Res_png_9patch::deserialize(const void* inData) { if (sizeof(void*) != sizeof(int32_t)) { - LOGE("Cannot deserialize on non 32-bit system\n"); + ALOGE("Cannot deserialize on non 32-bit system\n"); return NULL; } deserializeInternal(inData, (Res_png_9patch*) inData); @@ -358,7 +358,7 @@ status_t ResStringPool::setTo(const void* data, size_t size, bool copyData) if (mHeader->header.headerSize > mHeader->header.size || mHeader->header.size > size) { - LOGW("Bad string block: header size %d or total size %d is larger than data size %d\n", + ALOGW("Bad string block: header size %d or total size %d is larger than data size %d\n", (int)mHeader->header.headerSize, (int)mHeader->header.size, (int)size); return (mError=BAD_TYPE); } @@ -370,7 +370,7 @@ status_t ResStringPool::setTo(const void* data, size_t size, bool copyData) if ((mHeader->stringCount*sizeof(uint32_t) < mHeader->stringCount) // uint32 overflow? || (mHeader->header.headerSize+(mHeader->stringCount*sizeof(uint32_t))) > size) { - LOGW("Bad string block: entry of %d items extends past data size %d\n", + ALOGW("Bad string block: entry of %d items extends past data size %d\n", (int)(mHeader->header.headerSize+(mHeader->stringCount*sizeof(uint32_t))), (int)size); return (mError=BAD_TYPE); @@ -388,7 +388,7 @@ status_t ResStringPool::setTo(const void* data, size_t size, bool copyData) mStrings = (const void*) (((const uint8_t*)data)+mHeader->stringsStart); if (mHeader->stringsStart >= (mHeader->header.size-sizeof(uint16_t))) { - LOGW("Bad string block: string pool starts at %d, after total size %d\n", + ALOGW("Bad string block: string pool starts at %d, after total size %d\n", (int)mHeader->stringsStart, (int)mHeader->header.size); return (mError=BAD_TYPE); } @@ -398,13 +398,13 @@ status_t ResStringPool::setTo(const void* data, size_t size, bool copyData) } else { // check invariant: styles starts before end of data if (mHeader->stylesStart >= (mHeader->header.size-sizeof(uint16_t))) { - LOGW("Bad style block: style block starts at %d past data size of %d\n", + ALOGW("Bad style block: style block starts at %d past data size of %d\n", (int)mHeader->stylesStart, (int)mHeader->header.size); return (mError=BAD_TYPE); } // check invariant: styles follow the strings if (mHeader->stylesStart <= mHeader->stringsStart) { - LOGW("Bad style block: style block starts at %d, before strings at %d\n", + ALOGW("Bad style block: style block starts at %d, before strings at %d\n", (int)mHeader->stylesStart, (int)mHeader->stringsStart); return (mError=BAD_TYPE); } @@ -414,7 +414,7 @@ status_t ResStringPool::setTo(const void* data, size_t size, bool copyData) // check invariant: stringCount > 0 requires a string pool to exist if (mStringPoolSize == 0) { - LOGW("Bad string block: stringCount is %d but pool size is 0\n", (int)mHeader->stringCount); + ALOGW("Bad string block: stringCount is %d but pool size is 0\n", (int)mHeader->stringCount); return (mError=BAD_TYPE); } @@ -437,7 +437,7 @@ status_t ResStringPool::setTo(const void* data, size_t size, bool copyData) ((uint8_t*)mStrings)[mStringPoolSize-1] != 0) || (!mHeader->flags&ResStringPool_header::UTF8_FLAG && ((char16_t*)mStrings)[mStringPoolSize-1] != 0)) { - LOGW("Bad string block: last string is not 0-terminated\n"); + ALOGW("Bad string block: last string is not 0-terminated\n"); return (mError=BAD_TYPE); } } else { @@ -449,12 +449,12 @@ status_t ResStringPool::setTo(const void* data, size_t size, bool copyData) mEntryStyles = mEntries + mHeader->stringCount; // invariant: integer overflow in calculating mEntryStyles if (mEntryStyles < mEntries) { - LOGW("Bad string block: integer overflow finding styles\n"); + ALOGW("Bad string block: integer overflow finding styles\n"); return (mError=BAD_TYPE); } if (((const uint8_t*)mEntryStyles-(const uint8_t*)mHeader) > (int)size) { - LOGW("Bad string block: entry of %d styles extends past data size %d\n", + ALOGW("Bad string block: entry of %d styles extends past data size %d\n", (int)((const uint8_t*)mEntryStyles-(const uint8_t*)mHeader), (int)size); return (mError=BAD_TYPE); @@ -462,7 +462,7 @@ status_t ResStringPool::setTo(const void* data, size_t size, bool copyData) mStyles = (const uint32_t*) (((const uint8_t*)data)+mHeader->stylesStart); if (mHeader->stylesStart >= mHeader->header.size) { - LOGW("Bad string block: style pool starts %d, after total size %d\n", + ALOGW("Bad string block: style pool starts %d, after total size %d\n", (int)mHeader->stylesStart, (int)mHeader->header.size); return (mError=BAD_TYPE); } @@ -487,7 +487,7 @@ status_t ResStringPool::setTo(const void* data, size_t size, bool copyData) }; if (memcmp(&mStyles[mStylePoolSize-(sizeof(endSpan)/sizeof(uint32_t))], &endSpan, sizeof(endSpan)) != 0) { - LOGW("Bad string block: last style is not 0xFFFFFFFF-terminated\n"); + ALOGW("Bad string block: last style is not 0xFFFFFFFF-terminated\n"); return (mError=BAD_TYPE); } } else { @@ -581,7 +581,7 @@ const uint16_t* ResStringPool::stringAt(size_t idx, size_t* u16len) const if ((uint32_t)(str+*u16len-strings) < mStringPoolSize) { return str; } else { - LOGW("Bad string block: string #%d extends to %d, past end at %d\n", + ALOGW("Bad string block: string #%d extends to %d, past end at %d\n", (int)idx, (int)(str+*u16len-strings), (int)mStringPoolSize); } } else { @@ -601,7 +601,7 @@ const uint16_t* ResStringPool::stringAt(size_t idx, size_t* u16len) const ssize_t actualLen = utf8_to_utf16_length(u8str, u8len); if (actualLen < 0 || (size_t)actualLen != *u16len) { - LOGW("Bad string block: string #%lld decoded length is not correct " + ALOGW("Bad string block: string #%lld decoded length is not correct " "%lld vs %llu\n", (long long)idx, (long long)actualLen, (long long)*u16len); return NULL; @@ -609,7 +609,7 @@ const uint16_t* ResStringPool::stringAt(size_t idx, size_t* u16len) const char16_t *u16str = (char16_t *)calloc(*u16len+1, sizeof(char16_t)); if (!u16str) { - LOGW("No memory when trying to allocate decode cache for string #%d\n", + ALOGW("No memory when trying to allocate decode cache for string #%d\n", (int)idx); return NULL; } @@ -618,13 +618,13 @@ const uint16_t* ResStringPool::stringAt(size_t idx, size_t* u16len) const mCache[idx] = u16str; return u16str; } else { - LOGW("Bad string block: string #%lld extends to %lld, past end at %lld\n", + ALOGW("Bad string block: string #%lld extends to %lld, past end at %lld\n", (long long)idx, (long long)(u8str+u8len-strings), (long long)mStringPoolSize); } } } else { - LOGW("Bad string block: string #%d entry is at %d, past end at %d\n", + ALOGW("Bad string block: string #%d entry is at %d, past end at %d\n", (int)idx, (int)(off*sizeof(uint16_t)), (int)(mStringPoolSize*sizeof(uint16_t))); } @@ -646,12 +646,12 @@ const char* ResStringPool::string8At(size_t idx, size_t* outLen) const if ((uint32_t)(str+encLen-strings) < mStringPoolSize) { return (const char*)str; } else { - LOGW("Bad string block: string #%d extends to %d, past end at %d\n", + ALOGW("Bad string block: string #%d extends to %d, past end at %d\n", (int)idx, (int)(str+encLen-strings), (int)mStringPoolSize); } } } else { - LOGW("Bad string block: string #%d entry is at %d, past end at %d\n", + ALOGW("Bad string block: string #%d entry is at %d, past end at %d\n", (int)idx, (int)(off*sizeof(uint16_t)), (int)(mStringPoolSize*sizeof(uint16_t))); } @@ -671,7 +671,7 @@ const ResStringPool_span* ResStringPool::styleAt(size_t idx) const if (off < mStylePoolSize) { return (const ResStringPool_span*)(mStyles+off); } else { - LOGW("Bad string block: style #%d entry is at %d, past end at %d\n", + ALOGW("Bad string block: style #%d entry is at %d, past end at %d\n", (int)idx, (int)(off*sizeof(uint32_t)), (int)(mStylePoolSize*sizeof(uint32_t))); } @@ -1087,7 +1087,7 @@ ResXMLParser::event_code_t ResXMLParser::nextNode() do { const ResXMLTree_node* next = (const ResXMLTree_node*) (((const uint8_t*)mCurNode) + dtohl(mCurNode->header.size)); - //LOGW("Next node: prev=%p, next=%p\n", mCurNode, next); + //ALOGW("Next node: prev=%p, next=%p\n", mCurNode, next); if (((const uint8_t*)next) >= mTree.mDataEnd) { mCurNode = NULL; @@ -1120,14 +1120,14 @@ ResXMLParser::event_code_t ResXMLParser::nextNode() minExtSize = sizeof(ResXMLTree_cdataExt); break; default: - LOGW("Unknown XML block: header type %d in node at %d\n", + ALOGW("Unknown XML block: header type %d in node at %d\n", (int)dtohs(next->header.type), (int)(((const uint8_t*)next)-((const uint8_t*)mTree.mHeader))); continue; } if ((totalSize-headerSize) < minExtSize) { - LOGW("Bad XML block: header type 0x%x in node at 0x%x has size %d, need %d\n", + ALOGW("Bad XML block: header type 0x%x in node at 0x%x has size %d, need %d\n", (int)dtohs(next->header.type), (int)(((const uint8_t*)next)-((const uint8_t*)mTree.mHeader)), (int)(totalSize-headerSize), (int)minExtSize); @@ -1164,7 +1164,7 @@ ResXMLTree::ResXMLTree() : ResXMLParser(*this) , mError(NO_INIT), mOwnedData(NULL) { - //LOGI("Creating ResXMLTree %p #%d\n", this, android_atomic_inc(&gCount)+1); + //ALOGI("Creating ResXMLTree %p #%d\n", this, android_atomic_inc(&gCount)+1); restart(); } @@ -1172,13 +1172,13 @@ ResXMLTree::ResXMLTree(const void* data, size_t size, bool copyData) : ResXMLParser(*this) , mError(NO_INIT), mOwnedData(NULL) { - //LOGI("Creating ResXMLTree %p #%d\n", this, android_atomic_inc(&gCount)+1); + //ALOGI("Creating ResXMLTree %p #%d\n", this, android_atomic_inc(&gCount)+1); setTo(data, size, copyData); } ResXMLTree::~ResXMLTree() { - //LOGI("Destroying ResXMLTree in %p #%d\n", this, android_atomic_dec(&gCount)-1); + //ALOGI("Destroying ResXMLTree in %p #%d\n", this, android_atomic_dec(&gCount)-1); uninit(); } @@ -1199,7 +1199,7 @@ status_t ResXMLTree::setTo(const void* data, size_t size, bool copyData) mHeader = (const ResXMLTree_header*)data; mSize = dtohl(mHeader->header.size); if (dtohs(mHeader->header.headerSize) > mSize || mSize > size) { - LOGW("Bad XML block: header size %d or total size %d is larger than data size %d\n", + ALOGW("Bad XML block: header size %d or total size %d is larger than data size %d\n", (int)dtohs(mHeader->header.headerSize), (int)dtohl(mHeader->header.size), (int)size); mError = BAD_TYPE; @@ -1259,7 +1259,7 @@ status_t ResXMLTree::setTo(const void* data, size_t size, bool copyData) } if (mRootNode == NULL) { - LOGW("Bad XML block: no root element node found\n"); + ALOGW("Bad XML block: no root element node found\n"); mError = BAD_TYPE; goto done; } @@ -1313,12 +1313,12 @@ status_t ResXMLTree::validateNode(const ResXMLTree_node* node) const if ((dtohs(attrExt->attributeStart)+attrSize) <= (size-headerSize)) { return NO_ERROR; } - LOGW("Bad XML block: node attributes use 0x%x bytes, only have 0x%x bytes\n", + ALOGW("Bad XML block: node attributes use 0x%x bytes, only have 0x%x bytes\n", (unsigned int)(dtohs(attrExt->attributeStart)+attrSize), (unsigned int)(size-headerSize)); } else { - LOGW("Bad XML start block: node header size 0x%x, size 0x%x\n", + ALOGW("Bad XML start block: node header size 0x%x, size 0x%x\n", (unsigned int)headerSize, (unsigned int)size); } return BAD_TYPE; @@ -1342,21 +1342,21 @@ status_t ResXMLTree::validateNode(const ResXMLTree_node* node) const <= (size-headerSize)) { return NO_ERROR; } - LOGW("Bad XML block: node attributes use 0x%x bytes, only have 0x%x bytes\n", + ALOGW("Bad XML block: node attributes use 0x%x bytes, only have 0x%x bytes\n", ((int)dtohs(node->attributeSize))*dtohs(node->attributeCount), (int)(size-headerSize)); return BAD_TYPE; } - LOGW("Bad XML block: node at 0x%x extends beyond data end 0x%x\n", + ALOGW("Bad XML block: node at 0x%x extends beyond data end 0x%x\n", (int)(((const uint8_t*)node)-((const uint8_t*)mHeader)), (int)mSize); return BAD_TYPE; } - LOGW("Bad XML block: node at 0x%x header size 0x%x smaller than total size 0x%x\n", + ALOGW("Bad XML block: node at 0x%x header size 0x%x smaller than total size 0x%x\n", (int)(((const uint8_t*)node)-((const uint8_t*)mHeader)), (int)headerSize, (int)size); return BAD_TYPE; } - LOGW("Bad XML block: node at 0x%x header size 0x%x too small\n", + ALOGW("Bad XML block: node at 0x%x header size 0x%x too small\n", (int)(((const uint8_t*)node)-((const uint8_t*)mHeader)), (int)headerSize); return BAD_TYPE; @@ -1574,7 +1574,7 @@ status_t ResTable::Theme::applyStyle(uint32_t resID, bool force) if (curPackage != p) { const ssize_t pidx = mTable.getResourcePackageIndex(attrRes); if (pidx < 0) { - LOGE("Style contains key with bad package: 0x%08x\n", attrRes); + ALOGE("Style contains key with bad package: 0x%08x\n", attrRes); bag++; continue; } @@ -1594,7 +1594,7 @@ status_t ResTable::Theme::applyStyle(uint32_t resID, bool force) } if (curType != t) { if (t >= curPI->numTypes) { - LOGE("Style contains key with bad type: 0x%08x\n", attrRes); + ALOGE("Style contains key with bad type: 0x%08x\n", attrRes); bag++; continue; } @@ -1612,7 +1612,7 @@ status_t ResTable::Theme::applyStyle(uint32_t resID, bool force) numEntries = curPI->types[t].numEntries; } if (e >= numEntries) { - LOGE("Style contains key with bad entry: 0x%08x\n", attrRes); + ALOGE("Style contains key with bad entry: 0x%08x\n", attrRes); bag++; continue; } @@ -1631,7 +1631,7 @@ status_t ResTable::Theme::applyStyle(uint32_t resID, bool force) mTable.unlock(); - //LOGI("Applying style 0x%08x (force=%d) theme %p...\n", resID, force, this); + //ALOGI("Applying style 0x%08x (force=%d) theme %p...\n", resID, force, this); //dumpToLog(); return NO_ERROR; @@ -1639,7 +1639,7 @@ status_t ResTable::Theme::applyStyle(uint32_t resID, bool force) status_t ResTable::Theme::setTo(const Theme& other) { - //LOGI("Setting theme %p from theme %p...\n", this, &other); + //ALOGI("Setting theme %p from theme %p...\n", this, &other); //dumpToLog(); //other.dumpToLog(); @@ -1670,7 +1670,7 @@ status_t ResTable::Theme::setTo(const Theme& other) } } - //LOGI("Final theme:"); + //ALOGI("Final theme:"); //dumpToLog(); return NO_ERROR; @@ -1712,7 +1712,7 @@ ssize_t ResTable::Theme::getAttribute(uint32_t resID, Res_value* outValue, resID = te.value.data; continue; } - LOGW("Too many attribute references, stopped at: 0x%08x\n", resID); + ALOGW("Too many attribute references, stopped at: 0x%08x\n", resID); return BAD_INDEX; } else if (type != Res_value::TYPE_NULL) { *outValue = te.value; @@ -1752,21 +1752,21 @@ ssize_t ResTable::Theme::resolveAttributeReference(Res_value* inOutValue, void ResTable::Theme::dumpToLog() const { - LOGI("Theme %p:\n", this); + ALOGI("Theme %p:\n", this); for (size_t i=0; i<Res_MAXPACKAGE; i++) { package_info* pi = mPackages[i]; if (pi == NULL) continue; - LOGI(" Package #0x%02x:\n", (int)(i+1)); + ALOGI(" Package #0x%02x:\n", (int)(i+1)); for (size_t j=0; j<pi->numTypes; j++) { type_info& ti = pi->types[j]; if (ti.numEntries == 0) continue; - LOGI(" Type #0x%02x:\n", (int)(j+1)); + ALOGI(" Type #0x%02x:\n", (int)(j+1)); for (size_t k=0; k<ti.numEntries; k++) { theme_entry& te = ti.entries[k]; if (te.value.dataType == Res_value::TYPE_NULL) continue; - LOGI(" 0x%08x: t=0x%x, d=0x%08x (block=%d)\n", + ALOGI(" 0x%08x: t=0x%x, d=0x%08x (block=%d)\n", (int)Res_MAKEID(i, j, k), te.value.dataType, (int)te.value.data, (int)te.stringBlock); } @@ -1779,7 +1779,7 @@ ResTable::ResTable() { memset(&mParams, 0, sizeof(mParams)); memset(mPackageMap, 0, sizeof(mPackageMap)); - //LOGI("Creating ResTable %p\n", this); + //ALOGI("Creating ResTable %p\n", this); } ResTable::ResTable(const void* data, size_t size, void* cookie, bool copyData) @@ -1789,12 +1789,12 @@ ResTable::ResTable(const void* data, size_t size, void* cookie, bool copyData) memset(mPackageMap, 0, sizeof(mPackageMap)); add(data, size, cookie, copyData); LOG_FATAL_IF(mError != NO_ERROR, "Error parsing resource table"); - //LOGI("Creating ResTable %p\n", this); + //ALOGI("Creating ResTable %p\n", this); } ResTable::~ResTable() { - //LOGI("Destroying ResTable in %p\n", this); + //ALOGI("Destroying ResTable in %p\n", this); uninit(); } @@ -1813,7 +1813,7 @@ status_t ResTable::add(Asset* asset, void* cookie, bool copyData, const void* id { const void* data = asset->getBuffer(true); if (data == NULL) { - LOGW("Unable to get buffer of resource asset file"); + ALOGW("Unable to get buffer of resource asset file"); return UNKNOWN_ERROR; } size_t size = (size_t)asset->getLength(); @@ -1867,7 +1867,7 @@ status_t ResTable::add(const void* data, size_t size, void* cookie, const bool notDeviceEndian = htods(0xf0) != 0xf0; LOAD_TABLE_NOISY( - LOGV("Adding resources to ResTable: data=%p, size=0x%x, cookie=%p, asset=%p, copy=%d " + ALOGV("Adding resources to ResTable: data=%p, size=0x%x, cookie=%p, asset=%p, copy=%d " "idmap=%p\n", data, size, cookie, asset, copyData, idmap)); if (copyData || notDeviceEndian) { @@ -1881,20 +1881,20 @@ status_t ResTable::add(const void* data, size_t size, void* cookie, header->header = (const ResTable_header*)data; header->size = dtohl(header->header->header.size); - //LOGI("Got size 0x%x, again size 0x%x, raw size 0x%x\n", header->size, + //ALOGI("Got size 0x%x, again size 0x%x, raw size 0x%x\n", header->size, // dtohl(header->header->header.size), header->header->header.size); LOAD_TABLE_NOISY(LOGV("Loading ResTable @%p:\n", header->header)); LOAD_TABLE_NOISY(printHexData(2, header->header, header->size < 256 ? header->size : 256, 16, 16, 0, false, printToLogFunc)); if (dtohs(header->header->header.headerSize) > header->size || header->size > size) { - LOGW("Bad resource table: header size 0x%x or total size 0x%x is larger than data size 0x%x\n", + ALOGW("Bad resource table: header size 0x%x or total size 0x%x is larger than data size 0x%x\n", (int)dtohs(header->header->header.headerSize), (int)header->size, (int)size); return (mError=BAD_TYPE); } if (((dtohs(header->header->header.headerSize)|header->size)&0x3) != 0) { - LOGW("Bad resource table: header size 0x%x or total size 0x%x is not on an integer boundary\n", + ALOGW("Bad resource table: header size 0x%x or total size 0x%x is not on an integer boundary\n", (int)dtohs(header->header->header.headerSize), (int)header->size); return (mError=BAD_TYPE); @@ -1927,11 +1927,11 @@ status_t ResTable::add(const void* data, size_t size, void* cookie, return (mError=err); } } else { - LOGW("Multiple string chunks found in resource table."); + ALOGW("Multiple string chunks found in resource table."); } } else if (ctype == RES_TABLE_PACKAGE_TYPE) { if (curPackage >= dtohl(header->header->packageCount)) { - LOGW("More package chunks were found than the %d declared in the header.", + ALOGW("More package chunks were found than the %d declared in the header.", dtohl(header->header->packageCount)); return (mError=BAD_TYPE); } @@ -1949,7 +1949,7 @@ status_t ResTable::add(const void* data, size_t size, void* cookie, } curPackage++; } else { - LOGW("Unknown chunk type %p in table at %p.\n", + ALOGW("Unknown chunk type %p in table at %p.\n", (void*)(int)(ctype), (void*)(((const uint8_t*)chunk) - ((const uint8_t*)header->header))); } @@ -1958,13 +1958,13 @@ status_t ResTable::add(const void* data, size_t size, void* cookie, } if (curPackage < dtohl(header->header->packageCount)) { - LOGW("Fewer package chunks (%d) were found than the %d declared in the header.", + ALOGW("Fewer package chunks (%d) were found than the %d declared in the header.", (int)curPackage, dtohl(header->header->packageCount)); return (mError=BAD_TYPE); } mError = header->values.getError(); if (mError != NO_ERROR) { - LOGW("No string values found in resource table!"); + ALOGW("No string values found in resource table!"); } TABLE_NOISY(LOGV("Returning from add with mError=%d\n", mError)); @@ -2011,20 +2011,20 @@ bool ResTable::getResourceName(uint32_t resID, resource_name* outName) const if (p < 0) { if (Res_GETPACKAGE(resID)+1 == 0) { - LOGW("No package identifier when getting name for resource number 0x%08x", resID); + ALOGW("No package identifier when getting name for resource number 0x%08x", resID); } else { - LOGW("No known package when getting name for resource number 0x%08x", resID); + ALOGW("No known package when getting name for resource number 0x%08x", resID); } return false; } if (t < 0) { - LOGW("No type identifier when getting name for resource number 0x%08x", resID); + ALOGW("No type identifier when getting name for resource number 0x%08x", resID); return false; } const PackageGroup* const grp = mPackageGroups[p]; if (grp == NULL) { - LOGW("Bad identifier when getting name for resource number 0x%08x", resID); + ALOGW("Bad identifier when getting name for resource number 0x%08x", resID); return false; } if (grp->packages.size() > 0) { @@ -2067,14 +2067,14 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag if (p < 0) { if (Res_GETPACKAGE(resID)+1 == 0) { - LOGW("No package identifier when getting value for resource number 0x%08x", resID); + ALOGW("No package identifier when getting value for resource number 0x%08x", resID); } else { - LOGW("No known package when getting value for resource number 0x%08x", resID); + ALOGW("No known package when getting value for resource number 0x%08x", resID); } return BAD_INDEX; } if (t < 0) { - LOGW("No type identifier when getting value for resource number 0x%08x", resID); + ALOGW("No type identifier when getting value for resource number 0x%08x", resID); return BAD_INDEX; } @@ -2089,7 +2089,7 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag // recently added. const PackageGroup* const grp = mPackageGroups[p]; if (grp == NULL) { - LOGW("Bad identifier when getting value for resource number 0x%08x", resID); + ALOGW("Bad identifier when getting value for resource number 0x%08x", resID); return BAD_INDEX; } @@ -2099,7 +2099,7 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag if (density > 0) { overrideConfig = (ResTable_config*) malloc(sizeof(ResTable_config)); if (overrideConfig == NULL) { - LOGE("Couldn't malloc ResTable_config for overrides: %s", strerror(errno)); + ALOGE("Couldn't malloc ResTable_config for overrides: %s", strerror(errno)); return BAD_INDEX; } memcpy(overrideConfig, &mParams, sizeof(ResTable_config)); @@ -2122,7 +2122,7 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag resID, &overlayResID); if (retval == NO_ERROR && overlayResID != 0x0) { // for this loop iteration, this is the type and entry we really want - LOGV("resource map 0x%08x -> 0x%08x\n", resID, overlayResID); + ALOGV("resource map 0x%08x -> 0x%08x\n", resID, overlayResID); T = Res_GETTYPE(overlayResID); E = Res_GETENTRY(overlayResID); } else { @@ -2141,7 +2141,7 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag // overlay package did not specify a default. // Non-overlay packages are still required to provide a default. if (offset < 0 && ip == 0) { - LOGW("Failure getting entry for 0x%08x (t=%d e=%d) in package %zd (error %d)\n", + ALOGW("Failure getting entry for 0x%08x (t=%d e=%d) in package %zd (error %d)\n", resID, T, E, ip, (int)offset); rc = offset; goto out; @@ -2151,7 +2151,7 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag if ((dtohs(entry->flags)&entry->FLAG_COMPLEX) != 0) { if (!mayBeBag) { - LOGW("Requesting resource %p failed because it is complex\n", + ALOGW("Requesting resource %p failed because it is complex\n", (void*)resID); } continue; @@ -2161,7 +2161,7 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag << HexDump(type, dtohl(type->header.size)) << endl); if ((size_t)offset > (dtohl(type->header.size)-sizeof(Res_value))) { - LOGW("ResTable_item at %d is beyond type chunk data %d", + ALOGW("ResTable_item at %d is beyond type chunk data %d", (int)offset, dtohl(type->header.size)); rc = BAD_TYPE; goto out; @@ -2307,23 +2307,23 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag, const int e = Res_GETENTRY(resID); if (p < 0) { - LOGW("Invalid package identifier when getting bag for resource number 0x%08x", resID); + ALOGW("Invalid package identifier when getting bag for resource number 0x%08x", resID); return BAD_INDEX; } if (t < 0) { - LOGW("No type identifier when getting bag for resource number 0x%08x", resID); + ALOGW("No type identifier when getting bag for resource number 0x%08x", resID); return BAD_INDEX; } //printf("Get bag: id=0x%08x, p=%d, t=%d\n", resID, p, t); PackageGroup* const grp = mPackageGroups[p]; if (grp == NULL) { - LOGW("Bad identifier when getting bag for resource number 0x%08x", resID); + ALOGW("Bad identifier when getting bag for resource number 0x%08x", resID); return false; } if (t >= (int)grp->typeCount) { - LOGW("Type identifier 0x%x is larger than type count 0x%x", + ALOGW("Type identifier 0x%x is larger than type count 0x%x", t+1, (int)grp->typeCount); return BAD_INDEX; } @@ -2334,7 +2334,7 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag, const size_t NENTRY = typeConfigs->entryCount; if (e >= (int)NENTRY) { - LOGW("Entry identifier 0x%x is larger than entry count 0x%x", + ALOGW("Entry identifier 0x%x is larger than entry count 0x%x", e, (int)typeConfigs->entryCount); return BAD_INDEX; } @@ -2350,10 +2350,10 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag, *outTypeSpecFlags = set->typeSpecFlags; } *outBag = (bag_entry*)(set+1); - //LOGI("Found existing bag for: %p\n", (void*)resID); + //ALOGI("Found existing bag for: %p\n", (void*)resID); return set->numAttrs; } - LOGW("Attempt to retrieve bag 0x%08x which is invalid or in a cycle.", + ALOGW("Attempt to retrieve bag 0x%08x which is invalid or in a cycle.", resID); return BAD_INDEX; } @@ -2401,7 +2401,7 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag, resID, &overlayResID); if (retval == NO_ERROR && overlayResID != 0x0) { // for this loop iteration, this is the type and entry we really want - LOGV("resource map 0x%08x -> 0x%08x\n", resID, overlayResID); + ALOGV("resource map 0x%08x -> 0x%08x\n", resID, overlayResID); T = Res_GETTYPE(overlayResID); E = Res_GETENTRY(overlayResID); } else { @@ -2413,9 +2413,9 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag, const ResTable_type* type; const ResTable_entry* entry; const Type* typeClass; - LOGV("Getting entry pkg=%p, t=%d, e=%d\n", package, T, E); + ALOGV("Getting entry pkg=%p, t=%d, e=%d\n", package, T, E); ssize_t offset = getEntry(package, T, E, &mParams, &type, &entry, &typeClass); - LOGV("Resulting offset=%d\n", offset); + ALOGV("Resulting offset=%d\n", offset); if (offset <= 0) { // No {entry, appropriate config} pair found in package. If this // package is an overlay package (ip != 0), this simply means the @@ -2429,7 +2429,7 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag, } if ((dtohs(entry->flags)&entry->FLAG_COMPLEX) == 0) { - LOGW("Skipping entry %p in package table %d because it is not complex!\n", + ALOGW("Skipping entry %p in package table %d because it is not complex!\n", (void*)resID, (int)ip); continue; } @@ -2505,7 +2505,7 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag, TABLE_NOISY(printf("Now at %p\n", (void*)curOff)); if ((size_t)curOff > (dtohl(type->header.size)-sizeof(ResTable_map))) { - LOGW("ResTable_map at %d is beyond type chunk data %d", + ALOGW("ResTable_map at %d is beyond type chunk data %d", (int)curOff, dtohl(type->header.size)); return BAD_TYPE; } @@ -2676,7 +2676,7 @@ nope: && name[6] == '_') { int index = atoi(String8(name + 7, nameLen - 7).string()); if (Res_CHECKID(index)) { - LOGW("Array resource index: %d is too large.", + ALOGW("Array resource index: %d is too large.", index); return 0; } @@ -2792,12 +2792,12 @@ nope: offset += typeOffset; if (offset > (dtohl(ty->header.size)-sizeof(ResTable_entry))) { - LOGW("ResTable_entry at %d is beyond type chunk data %d", + ALOGW("ResTable_entry at %d is beyond type chunk data %d", offset, dtohl(ty->header.size)); return 0; } if ((offset&0x3) != 0) { - LOGW("ResTable_entry at %d (pkg=%d type=%d ent=%d) is not on an integer boundary when looking for %s:%s/%s", + ALOGW("ResTable_entry at %d (pkg=%d type=%d ent=%d) is not on an integer boundary when looking for %s:%s/%s", (int)offset, (int)group->id, (int)ti+1, (int)i, String8(package, packageLen).string(), String8(type, typeLen).string(), @@ -2808,7 +2808,7 @@ nope: const ResTable_entry* const entry = (const ResTable_entry*) (((const uint8_t*)ty) + offset); if (dtohs(entry->size) < sizeof(*entry)) { - LOGW("ResTable_entry size %d is too small", dtohs(entry->size)); + ALOGW("ResTable_entry size %d is too small", dtohs(entry->size)); return BAD_TYPE; } @@ -3898,9 +3898,9 @@ void ResTable::getConfigurations(Vector<ResTable_config>* configs) const void ResTable::getLocales(Vector<String8>* locales) const { Vector<ResTable_config> configs; - LOGV("calling getConfigurations"); + ALOGV("calling getConfigurations"); getConfigurations(&configs); - LOGV("called getConfigurations size=%d", (int)configs.size()); + ALOGV("called getConfigurations size=%d", (int)configs.size()); const size_t I = configs.size(); for (size_t i=0; i<I; i++) { char locale[6]; @@ -3924,18 +3924,18 @@ ssize_t ResTable::getEntry( const ResTable_type** outType, const ResTable_entry** outEntry, const Type** outTypeClass) const { - LOGV("Getting entry from package %p\n", package); + ALOGV("Getting entry from package %p\n", package); const ResTable_package* const pkg = package->package; const Type* allTypes = package->getType(typeIndex); - LOGV("allTypes=%p\n", allTypes); + ALOGV("allTypes=%p\n", allTypes); if (allTypes == NULL) { - LOGV("Skipping entry type index 0x%02x because type is NULL!\n", typeIndex); + ALOGV("Skipping entry type index 0x%02x because type is NULL!\n", typeIndex); return 0; } if ((size_t)entryIndex >= allTypes->entryCount) { - LOGW("getEntry failing because entryIndex %d is beyond type entryCount %d", + ALOGW("getEntry failing because entryIndex %d is beyond type entryCount %d", entryIndex, (int)allTypes->entryCount); return BAD_TYPE; } @@ -4039,12 +4039,12 @@ ssize_t ResTable::getEntry( << ", offset=" << (void*)offset << endl); if (offset > (dtohl(type->header.size)-sizeof(ResTable_entry))) { - LOGW("ResTable_entry at 0x%x is beyond type chunk data 0x%x", + ALOGW("ResTable_entry at 0x%x is beyond type chunk data 0x%x", offset, dtohl(type->header.size)); return BAD_TYPE; } if ((offset&0x3) != 0) { - LOGW("ResTable_entry at 0x%x is not on an integer boundary", + ALOGW("ResTable_entry at 0x%x is not on an integer boundary", offset); return BAD_TYPE; } @@ -4052,7 +4052,7 @@ ssize_t ResTable::getEntry( const ResTable_entry* const entry = (const ResTable_entry*) (((const uint8_t*)type) + offset); if (dtohs(entry->size) < sizeof(*entry)) { - LOGW("ResTable_entry size 0x%x is too small", dtohs(entry->size)); + ALOGW("ResTable_entry size 0x%x is too small", dtohs(entry->size)); return BAD_TYPE; } @@ -4077,22 +4077,22 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg, const size_t pkgSize = dtohl(pkg->header.size); if (dtohl(pkg->typeStrings) >= pkgSize) { - LOGW("ResTable_package type strings at %p are past chunk size %p.", + ALOGW("ResTable_package type strings at %p are past chunk size %p.", (void*)dtohl(pkg->typeStrings), (void*)pkgSize); return (mError=BAD_TYPE); } if ((dtohl(pkg->typeStrings)&0x3) != 0) { - LOGW("ResTable_package type strings at %p is not on an integer boundary.", + ALOGW("ResTable_package type strings at %p is not on an integer boundary.", (void*)dtohl(pkg->typeStrings)); return (mError=BAD_TYPE); } if (dtohl(pkg->keyStrings) >= pkgSize) { - LOGW("ResTable_package key strings at %p are past chunk size %p.", + ALOGW("ResTable_package key strings at %p are past chunk size %p.", (void*)dtohl(pkg->keyStrings), (void*)pkgSize); return (mError=BAD_TYPE); } if ((dtohl(pkg->keyStrings)&0x3) != 0) { - LOGW("ResTable_package key strings at %p is not on an integer boundary.", + ALOGW("ResTable_package key strings at %p is not on an integer boundary.", (void*)dtohl(pkg->keyStrings)); return (mError=BAD_TYPE); } @@ -4195,7 +4195,7 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg, if ((dtohl(typeSpec->entryCount) > (INT32_MAX/sizeof(uint32_t)) || dtohs(typeSpec->header.headerSize)+(sizeof(uint32_t)*dtohl(typeSpec->entryCount)) > typeSpecSize)) { - LOGW("ResTable_typeSpec entry index to %p extends beyond chunk end %p.", + ALOGW("ResTable_typeSpec entry index to %p extends beyond chunk end %p.", (void*)(dtohs(typeSpec->header.headerSize) +(sizeof(uint32_t)*dtohl(typeSpec->entryCount))), (void*)typeSpecSize); @@ -4203,7 +4203,7 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg, } if (typeSpec->id == 0) { - LOGW("ResTable_type has an id of 0."); + ALOGW("ResTable_type has an id of 0."); return (mError=BAD_TYPE); } @@ -4215,7 +4215,7 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg, t = new Type(header, package, dtohl(typeSpec->entryCount)); package->types.editItemAt(typeSpec->id-1) = t; } else if (dtohl(typeSpec->entryCount) != t->entryCount) { - LOGW("ResTable_typeSpec entry count inconsistent: given %d, previously %d", + ALOGW("ResTable_typeSpec entry count inconsistent: given %d, previously %d", (int)dtohl(typeSpec->entryCount), (int)t->entryCount); return (mError=BAD_TYPE); } @@ -4240,7 +4240,7 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg, (void*)typeSize)); if (dtohs(type->header.headerSize)+(sizeof(uint32_t)*dtohl(type->entryCount)) > typeSize) { - LOGW("ResTable_type entry index to %p extends beyond chunk end %p.", + ALOGW("ResTable_type entry index to %p extends beyond chunk end %p.", (void*)(dtohs(type->header.headerSize) +(sizeof(uint32_t)*dtohl(type->entryCount))), (void*)typeSize); @@ -4248,12 +4248,12 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg, } if (dtohl(type->entryCount) != 0 && dtohl(type->entriesStart) > (typeSize-sizeof(ResTable_entry))) { - LOGW("ResTable_type entriesStart at %p extends beyond chunk end %p.", + ALOGW("ResTable_type entriesStart at %p extends beyond chunk end %p.", (void*)dtohl(type->entriesStart), (void*)typeSize); return (mError=BAD_TYPE); } if (type->id == 0) { - LOGW("ResTable_type has an id of 0."); + ALOGW("ResTable_type has an id of 0."); return (mError=BAD_TYPE); } @@ -4265,7 +4265,7 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg, t = new Type(header, package, dtohl(type->entryCount)); package->types.editItemAt(type->id-1) = t; } else if (dtohl(type->entryCount) != t->entryCount) { - LOGW("ResTable_type entry count inconsistent: given %d, previously %d", + ALOGW("ResTable_type entry count inconsistent: given %d, previously %d", (int)dtohl(type->entryCount), (int)t->entryCount); return (mError=BAD_TYPE); } @@ -4273,7 +4273,7 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg, TABLE_GETENTRY( ResTable_config thisConfig; thisConfig.copyFromDtoH(type->config); - LOGI("Adding config to type %d: imsi:%d/%d lang:%c%c cnt:%c%c " + ALOGI("Adding config to type %d: imsi:%d/%d lang:%c%c cnt:%c%c " "orien:%d touch:%d density:%d key:%d inp:%d nav:%d w:%d h:%d " "swdp:%d wdp:%d hdp:%d\n", type->id, @@ -4346,7 +4346,7 @@ status_t ResTable::createIdmap(const ResTable& overlay, uint32_t originalCrc, ui | (0x0000ffff & (entryIndex)); resource_name resName; if (!this->getResourceName(resID, &resName)) { - LOGW("idmap: resource 0x%08x has spec but lacks values, skipping\n", resID); + ALOGW("idmap: resource 0x%08x has spec but lacks values, skipping\n", resID); continue; } @@ -4368,7 +4368,7 @@ status_t ResTable::createIdmap(const ResTable& overlay, uint32_t originalCrc, ui } #if 0 if (overlayResID != 0) { - LOGD("%s/%s 0x%08x -> 0x%08x\n", + ALOGD("%s/%s 0x%08x -> 0x%08x\n", String8(String16(resName.type)).string(), String8(String16(resName.name)).string(), resID, overlayResID); diff --git a/libs/utils/Static.cpp b/libs/utils/Static.cpp index ceca43552b..bfcb2da456 100644 --- a/libs/utils/Static.cpp +++ b/libs/utils/Static.cpp @@ -57,8 +57,8 @@ protected: virtual status_t writeLines(const struct iovec& vec, size_t N) { //android_writevLog(&vec, N); <-- this is now a no-op - if (N != 1) LOGI("WARNING: writeLines N=%d\n", N); - LOGI("%.*s", vec.iov_len, (const char*) vec.iov_base); + if (N != 1) ALOGI("WARNING: writeLines N=%d\n", N); + ALOGI("%.*s", vec.iov_len, (const char*) vec.iov_base); return NO_ERROR; } }; diff --git a/libs/utils/StopWatch.cpp b/libs/utils/StopWatch.cpp index b5dda2facc..595aec359e 100644 --- a/libs/utils/StopWatch.cpp +++ b/libs/utils/StopWatch.cpp @@ -39,11 +39,11 @@ StopWatch::~StopWatch() { nsecs_t elapsed = elapsedTime(); const int n = mNumLaps; - LOGD("StopWatch %s (us): %lld ", mName, ns2us(elapsed)); + ALOGD("StopWatch %s (us): %lld ", mName, ns2us(elapsed)); for (int i=0 ; i<n ; i++) { const nsecs_t soFar = mLaps[i].soFar; const nsecs_t thisLap = mLaps[i].thisLap; - LOGD(" [%d: %lld, %lld]", i, ns2us(soFar), ns2us(thisLap)); + ALOGD(" [%d: %lld, %lld]", i, ns2us(soFar), ns2us(thisLap)); } } diff --git a/libs/utils/StreamingZipInflater.cpp b/libs/utils/StreamingZipInflater.cpp index 00498bd1fc..8512170ae9 100644 --- a/libs/utils/StreamingZipInflater.cpp +++ b/libs/utils/StreamingZipInflater.cpp @@ -77,7 +77,7 @@ StreamingZipInflater::~StreamingZipInflater() { } void StreamingZipInflater::initInflateState() { - LOGV("Initializing inflate state"); + ALOGV("Initializing inflate state"); memset(&mInflateState, 0, sizeof(mInflateState)); mInflateState.zalloc = Z_NULL; @@ -138,7 +138,7 @@ ssize_t StreamingZipInflater::read(void* outBuf, size_t count) { if (mInflateState.avail_in == 0) { int err = readNextChunk(); if (err < 0) { - LOGE("Unable to access asset data: %d", err); + ALOGE("Unable to access asset data: %d", err); if (!mStreamNeedsInit) { ::inflateEnd(&mInflateState); initInflateState(); @@ -152,20 +152,20 @@ ssize_t StreamingZipInflater::read(void* outBuf, size_t count) { mInflateState.avail_out = mOutBufSize; /* - LOGV("Inflating to outbuf: avail_in=%u avail_out=%u next_in=%p next_out=%p", + ALOGV("Inflating to outbuf: avail_in=%u avail_out=%u next_in=%p next_out=%p", mInflateState.avail_in, mInflateState.avail_out, mInflateState.next_in, mInflateState.next_out); */ int result = Z_OK; if (mStreamNeedsInit) { - LOGV("Initializing zlib to inflate"); + ALOGV("Initializing zlib to inflate"); result = inflateInit2(&mInflateState, -MAX_WBITS); mStreamNeedsInit = false; } if (result == Z_OK) result = ::inflate(&mInflateState, Z_SYNC_FLUSH); if (result < 0) { // Whoops, inflation failed - LOGE("Error inflating asset: %d", result); + ALOGE("Error inflating asset: %d", result); ::inflateEnd(&mInflateState); initInflateState(); return -1; @@ -192,10 +192,10 @@ int StreamingZipInflater::readNextChunk() { size_t toRead = min_of(mInBufSize, mInTotalSize - mInNextChunkOffset); if (toRead > 0) { ssize_t didRead = ::read(mFd, mInBuf, toRead); - //LOGV("Reading input chunk, size %08x didread %08x", toRead, didRead); + //ALOGV("Reading input chunk, size %08x didread %08x", toRead, didRead); if (didRead < 0) { // TODO: error - LOGE("Error reading asset data"); + ALOGE("Error reading asset data"); return didRead; } else { mInNextChunkOffset += didRead; diff --git a/libs/utils/SystemClock.cpp b/libs/utils/SystemClock.cpp index 062e6d76bf..8b8ac10315 100644 --- a/libs/utils/SystemClock.cpp +++ b/libs/utils/SystemClock.cpp @@ -64,25 +64,25 @@ int setCurrentTimeMillis(int64_t millis) tv.tv_sec = (time_t) (millis / 1000LL); tv.tv_usec = (suseconds_t) ((millis % 1000LL) * 1000LL); - LOGD("Setting time of day to sec=%d\n", (int) tv.tv_sec); + ALOGD("Setting time of day to sec=%d\n", (int) tv.tv_sec); #ifdef HAVE_ANDROID_OS fd = open("/dev/alarm", O_RDWR); if(fd < 0) { - LOGW("Unable to open alarm driver: %s\n", strerror(errno)); + ALOGW("Unable to open alarm driver: %s\n", strerror(errno)); return -1; } ts.tv_sec = tv.tv_sec; ts.tv_nsec = tv.tv_usec * 1000; res = ioctl(fd, ANDROID_ALARM_SET_RTC, &ts); if(res < 0) { - LOGW("Unable to set rtc to %ld: %s\n", tv.tv_sec, strerror(errno)); + ALOGW("Unable to set rtc to %ld: %s\n", tv.tv_sec, strerror(errno)); ret = -1; } close(fd); #else if (settimeofday(&tv, NULL) != 0) { - LOGW("Unable to set clock to %d.%d: %s\n", + ALOGW("Unable to set clock to %d.%d: %s\n", (int) tv.tv_sec, (int) tv.tv_usec, strerror(errno)); ret = -1; } diff --git a/libs/utils/Threads.cpp b/libs/utils/Threads.cpp index 5dbcb75b06..e343c62352 100644 --- a/libs/utils/Threads.cpp +++ b/libs/utils/Threads.cpp @@ -163,7 +163,7 @@ int androidCreateRawThreadEtc(android_thread_func_t entryFunction, (android_pthread_entry)entryFunction, userData); pthread_attr_destroy(&attr); if (result != 0) { - LOGE("androidCreateRawThreadEtc failed (entry=%p, res=%d, errno=%d)\n" + ALOGE("androidCreateRawThreadEtc failed (entry=%p, res=%d, errno=%d)\n" "(android threadPriority=%d)", entryFunction, result, errno, threadPriority); return 0; @@ -205,7 +205,7 @@ static __stdcall unsigned int threadIntermediary(void* vDetails) delete pDetails; - LOG(LOG_VERBOSE, "thread", "thread exiting\n"); + ALOG(LOG_VERBOSE, "thread", "thread exiting\n"); return (unsigned int) result; } @@ -232,7 +232,7 @@ static bool doCreateThread(android_thread_func_t fn, void* arg, android_thread_i if (hThread == NULL) #endif { - LOG(LOG_WARN, "thread", "WARNING: thread create failed\n"); + ALOG(LOG_WARN, "thread", "WARNING: thread create failed\n"); return false; } @@ -470,7 +470,7 @@ status_t Mutex::lock() void Mutex::unlock() { if (!ReleaseMutex((HANDLE) mState)) - LOG(LOG_WARN, "thread", "WARNING: bad result from unlocking mutex\n"); + ALOG(LOG_WARN, "thread", "WARNING: bad result from unlocking mutex\n"); } status_t Mutex::tryLock() @@ -479,7 +479,7 @@ status_t Mutex::tryLock() dwWaitResult = WaitForSingleObject((HANDLE) mState, 0); if (dwWaitResult != WAIT_OBJECT_0 && dwWaitResult != WAIT_TIMEOUT) - LOG(LOG_WARN, "thread", "WARNING: bad result from try-locking mutex\n"); + ALOG(LOG_WARN, "thread", "WARNING: bad result from try-locking mutex\n"); return (dwWaitResult == WAIT_OBJECT_0) ? 0 : -1; } @@ -870,7 +870,7 @@ status_t Thread::requestExitAndWait() { Mutex::Autolock _l(mLock); if (mThread == getThreadId()) { - LOGW( + ALOGW( "Thread (this=%p): don't call waitForExit() from this " "Thread object's thread. It's a guaranteed deadlock!", this); @@ -894,7 +894,7 @@ status_t Thread::join() { Mutex::Autolock _l(mLock); if (mThread == getThreadId()) { - LOGW( + ALOGW( "Thread (this=%p): don't call join() from this " "Thread object's thread. It's a guaranteed deadlock!", this); diff --git a/libs/utils/Timers.cpp b/libs/utils/Timers.cpp index 64a29f5877..64b470181a 100644 --- a/libs/utils/Timers.cpp +++ b/libs/utils/Timers.cpp @@ -113,7 +113,7 @@ long long DurationTimer::durationUsecs(void) const /*static*/ void DurationTimer::addToTimeval(struct timeval* ptv, long usec) { if (usec < 0) { - LOG(LOG_WARN, "", "Negative values not supported in addToTimeval\n"); + ALOG(LOG_WARN, "", "Negative values not supported in addToTimeval\n"); return; } diff --git a/libs/utils/Tokenizer.cpp b/libs/utils/Tokenizer.cpp index b3445b797f..efda2bfffd 100644 --- a/libs/utils/Tokenizer.cpp +++ b/libs/utils/Tokenizer.cpp @@ -55,12 +55,12 @@ status_t Tokenizer::open(const String8& filename, Tokenizer** outTokenizer) { int fd = ::open(filename.string(), O_RDONLY); if (fd < 0) { result = -errno; - LOGE("Error opening file '%s', %s.", filename.string(), strerror(errno)); + ALOGE("Error opening file '%s', %s.", filename.string(), strerror(errno)); } else { struct stat stat; if (fstat(fd, &stat)) { result = -errno; - LOGE("Error getting size of file '%s', %s.", filename.string(), strerror(errno)); + ALOGE("Error getting size of file '%s', %s.", filename.string(), strerror(errno)); } else { size_t length = size_t(stat.st_size); @@ -80,7 +80,7 @@ status_t Tokenizer::open(const String8& filename, Tokenizer** outTokenizer) { ssize_t nrd = read(fd, buffer, length); if (nrd < 0) { result = -errno; - LOGE("Error reading file '%s', %s.", filename.string(), strerror(errno)); + ALOGE("Error reading file '%s', %s.", filename.string(), strerror(errno)); delete[] buffer; buffer = NULL; } else { @@ -118,7 +118,7 @@ String8 Tokenizer::peekRemainderOfLine() const { String8 Tokenizer::nextToken(const char* delimiters) { #if DEBUG_TOKENIZER - LOGD("nextToken"); + ALOGD("nextToken"); #endif const char* end = getEnd(); const char* tokenStart = mCurrent; @@ -134,7 +134,7 @@ String8 Tokenizer::nextToken(const char* delimiters) { void Tokenizer::nextLine() { #if DEBUG_TOKENIZER - LOGD("nextLine"); + ALOGD("nextLine"); #endif const char* end = getEnd(); while (mCurrent != end) { @@ -148,7 +148,7 @@ void Tokenizer::nextLine() { void Tokenizer::skipDelimiters(const char* delimiters) { #if DEBUG_TOKENIZER - LOGD("skipDelimiters"); + ALOGD("skipDelimiters"); #endif const char* end = getEnd(); while (mCurrent != end) { diff --git a/libs/utils/VectorImpl.cpp b/libs/utils/VectorImpl.cpp index bfb37a60d7..4a9029671c 100644 --- a/libs/utils/VectorImpl.cpp +++ b/libs/utils/VectorImpl.cpp @@ -346,7 +346,7 @@ void VectorImpl::release_storage() void* VectorImpl::_grow(size_t where, size_t amount) { -// LOGV("_grow(this=%p, where=%d, amount=%d) count=%d, capacity=%d", +// ALOGV("_grow(this=%p, where=%d, amount=%d) count=%d, capacity=%d", // this, (int)where, (int)amount, (int)mCount, (int)capacity()); LOG_ASSERT(where <= mCount, @@ -356,7 +356,7 @@ void* VectorImpl::_grow(size_t where, size_t amount) const size_t new_size = mCount + amount; if (capacity() < new_size) { const size_t new_capacity = max(kMinVectorCapacity, ((new_size*3)+1)/2); -// LOGV("grow vector %p, new_capacity=%d", this, (int)new_capacity); +// ALOGV("grow vector %p, new_capacity=%d", this, (int)new_capacity); if ((mStorage) && (mCount==where) && (mFlags & HAS_TRIVIAL_COPY) && @@ -399,7 +399,7 @@ void VectorImpl::_shrink(size_t where, size_t amount) if (!mStorage) return; -// LOGV("_shrink(this=%p, where=%d, amount=%d) count=%d, capacity=%d", +// ALOGV("_shrink(this=%p, where=%d, amount=%d) count=%d, capacity=%d", // this, (int)where, (int)amount, (int)mCount, (int)capacity()); LOG_ASSERT(where + amount <= mCount, @@ -409,7 +409,7 @@ void VectorImpl::_shrink(size_t where, size_t amount) const size_t new_size = mCount - amount; if (new_size*3 < capacity()) { const size_t new_capacity = max(kMinVectorCapacity, new_size*2); -// LOGV("shrink vector %p, new_capacity=%d", this, (int)new_capacity); +// ALOGV("shrink vector %p, new_capacity=%d", this, (int)new_capacity); if ((where == new_size) && (mFlags & HAS_TRIVIAL_COPY) && (mFlags & HAS_TRIVIAL_DTOR)) diff --git a/libs/utils/ZipFileRO.cpp b/libs/utils/ZipFileRO.cpp index b18c383aee..1498aac07e 100644 --- a/libs/utils/ZipFileRO.cpp +++ b/libs/utils/ZipFileRO.cpp @@ -120,7 +120,7 @@ int ZipFileRO::entryToIndex(const ZipEntryRO entry) const { long ent = ((long) entry) - kZipEntryAdj; if (ent < 0 || ent >= mHashTableSize || mHashTable[ent].name == NULL) { - LOGW("Invalid ZipEntryRO %p (%ld)\n", entry, ent); + ALOGW("Invalid ZipEntryRO %p (%ld)\n", entry, ent); return -1; } return ent; @@ -142,7 +142,7 @@ status_t ZipFileRO::open(const char* zipFileName) */ fd = ::open(zipFileName, O_RDONLY | O_BINARY); if (fd < 0) { - LOGW("Unable to open zip '%s': %s\n", zipFileName, strerror(errno)); + ALOGW("Unable to open zip '%s': %s\n", zipFileName, strerror(errno)); return NAME_NOT_FOUND; } @@ -194,7 +194,7 @@ bool ZipFileRO::mapCentralDirectory(void) unsigned char* scanBuf = (unsigned char*) malloc(readAmount); if (scanBuf == NULL) { - LOGW("couldn't allocate scanBuf: %s", strerror(errno)); + ALOGW("couldn't allocate scanBuf: %s", strerror(errno)); free(scanBuf); return false; } @@ -203,14 +203,14 @@ bool ZipFileRO::mapCentralDirectory(void) * Make sure this is a Zip archive. */ if (lseek64(mFd, 0, SEEK_SET) != 0) { - LOGW("seek to start failed: %s", strerror(errno)); + ALOGW("seek to start failed: %s", strerror(errno)); free(scanBuf); return false; } ssize_t actual = TEMP_FAILURE_RETRY(read(mFd, scanBuf, sizeof(int32_t))); if (actual != (ssize_t) sizeof(int32_t)) { - LOGI("couldn't read first signature from zip archive: %s", strerror(errno)); + ALOGI("couldn't read first signature from zip archive: %s", strerror(errno)); free(scanBuf); return false; } @@ -218,11 +218,11 @@ bool ZipFileRO::mapCentralDirectory(void) { unsigned int header = get4LE(scanBuf); if (header == kEOCDSignature) { - LOGI("Found Zip archive, but it looks empty\n"); + ALOGI("Found Zip archive, but it looks empty\n"); free(scanBuf); return false; } else if (header != kLFHSignature) { - LOGV("Not a Zip archive (found 0x%08x)\n", header); + ALOGV("Not a Zip archive (found 0x%08x)\n", header); free(scanBuf); return false; } @@ -243,13 +243,13 @@ bool ZipFileRO::mapCentralDirectory(void) off64_t searchStart = mFileLength - readAmount; if (lseek64(mFd, searchStart, SEEK_SET) != searchStart) { - LOGW("seek %ld failed: %s\n", (long) searchStart, strerror(errno)); + ALOGW("seek %ld failed: %s\n", (long) searchStart, strerror(errno)); free(scanBuf); return false; } actual = TEMP_FAILURE_RETRY(read(mFd, scanBuf, readAmount)); if (actual != (ssize_t) readAmount) { - LOGW("Zip: read " ZD ", expected " ZD ". Failed: %s\n", + ALOGW("Zip: read " ZD ", expected " ZD ". Failed: %s\n", (ZD_TYPE) actual, (ZD_TYPE) readAmount, strerror(errno)); free(scanBuf); return false; @@ -264,12 +264,12 @@ bool ZipFileRO::mapCentralDirectory(void) int i; for (i = readAmount - kEOCDLen; i >= 0; i--) { if (scanBuf[i] == 0x50 && get4LE(&scanBuf[i]) == kEOCDSignature) { - LOGV("+++ Found EOCD at buf+%d\n", i); + ALOGV("+++ Found EOCD at buf+%d\n", i); break; } } if (i < 0) { - LOGD("Zip: EOCD not found, %s is not zip\n", mFileName); + ALOGD("Zip: EOCD not found, %s is not zip\n", mFileName); free(scanBuf); return false; } @@ -290,26 +290,26 @@ bool ZipFileRO::mapCentralDirectory(void) // Verify that they look reasonable. if ((long long) dirOffset + (long long) dirSize > (long long) eocdOffset) { - LOGW("bad offsets (dir %ld, size %u, eocd %ld)\n", + ALOGW("bad offsets (dir %ld, size %u, eocd %ld)\n", (long) dirOffset, dirSize, (long) eocdOffset); return false; } if (numEntries == 0) { - LOGW("empty archive?\n"); + ALOGW("empty archive?\n"); return false; } - LOGV("+++ numEntries=%d dirSize=%d dirOffset=%d\n", + ALOGV("+++ numEntries=%d dirSize=%d dirOffset=%d\n", numEntries, dirSize, dirOffset); mDirectoryMap = new FileMap(); if (mDirectoryMap == NULL) { - LOGW("Unable to create directory map: %s", strerror(errno)); + ALOGW("Unable to create directory map: %s", strerror(errno)); return false; } if (!mDirectoryMap->create(mFileName, mFd, dirOffset, dirSize, true)) { - LOGW("Unable to map '%s' (" ZD " to " ZD "): %s\n", mFileName, + ALOGW("Unable to map '%s' (" ZD " to " ZD "): %s\n", mFileName, (ZD_TYPE) dirOffset, (ZD_TYPE) (dirOffset + dirSize), strerror(errno)); return false; } @@ -341,17 +341,17 @@ bool ZipFileRO::parseZipArchive(void) const unsigned char* ptr = cdPtr; for (int i = 0; i < numEntries; i++) { if (get4LE(ptr) != kCDESignature) { - LOGW("Missed a central dir sig (at %d)\n", i); + ALOGW("Missed a central dir sig (at %d)\n", i); goto bail; } if (ptr + kCDELen > cdPtr + cdLength) { - LOGW("Ran off the end (at %d)\n", i); + ALOGW("Ran off the end (at %d)\n", i); goto bail; } long localHdrOffset = (long) get4LE(ptr + kCDELocalOffset); if (localHdrOffset >= mDirectoryOffset) { - LOGW("bad LFH offset %ld at entry %d\n", localHdrOffset, i); + ALOGW("bad LFH offset %ld at entry %d\n", localHdrOffset, i); goto bail; } @@ -367,12 +367,12 @@ bool ZipFileRO::parseZipArchive(void) ptr += kCDELen + fileNameLen + extraLen + commentLen; if ((size_t)(ptr - cdPtr) > cdLength) { - LOGW("bad CD advance (%d vs " ZD ") at entry %d\n", + ALOGW("bad CD advance (%d vs " ZD ") at entry %d\n", (int) (ptr - cdPtr), (ZD_TYPE) cdLength, i); goto bail; } } - LOGV("+++ zip good scan %d entries\n", numEntries); + ALOGV("+++ zip good scan %d entries\n", numEntries); result = true; bail: @@ -452,7 +452,7 @@ ZipEntryRO ZipFileRO::findEntryByName(const char* fileName) const ZipEntryRO ZipFileRO::findEntryByIndex(int idx) const { if (idx < 0 || idx >= mNumEntries) { - LOGW("Invalid index %d\n", idx); + ALOGW("Invalid index %d\n", idx); return NULL; } @@ -527,7 +527,7 @@ bool ZipFileRO::getEntryInfo(ZipEntryRO entry, int* pMethod, size_t* pUncompLen, if (pOffset != NULL) { long localHdrOffset = get4LE(ptr + kCDELocalOffset); if (localHdrOffset + kLFHLen >= cdOffset) { - LOGE("ERROR: bad local hdr offset in zip\n"); + ALOGE("ERROR: bad local hdr offset in zip\n"); return false; } @@ -544,12 +544,12 @@ bool ZipFileRO::getEntryInfo(ZipEntryRO entry, int* pMethod, size_t* pUncompLen, TEMP_FAILURE_RETRY(pread64(mFd, lfhBuf, sizeof(lfhBuf), localHdrOffset)); if (actual != sizeof(lfhBuf)) { - LOGW("failed reading lfh from offset %ld\n", localHdrOffset); + ALOGW("failed reading lfh from offset %ld\n", localHdrOffset); return false; } if (get4LE(lfhBuf) != kLFHSignature) { - LOGW("didn't find signature at start of lfh; wanted: offset=%ld data=0x%08x; " + ALOGW("didn't find signature at start of lfh; wanted: offset=%ld data=0x%08x; " "got: data=0x%08lx\n", localHdrOffset, kLFHSignature, get4LE(lfhBuf)); return false; @@ -567,20 +567,20 @@ bool ZipFileRO::getEntryInfo(ZipEntryRO entry, int* pMethod, size_t* pUncompLen, AutoMutex _l(mFdLock); if (lseek64(mFd, localHdrOffset, SEEK_SET) != localHdrOffset) { - LOGW("failed seeking to lfh at offset %ld\n", localHdrOffset); + ALOGW("failed seeking to lfh at offset %ld\n", localHdrOffset); return false; } ssize_t actual = TEMP_FAILURE_RETRY(read(mFd, lfhBuf, sizeof(lfhBuf))); if (actual != sizeof(lfhBuf)) { - LOGW("failed reading lfh from offset %ld\n", localHdrOffset); + ALOGW("failed reading lfh from offset %ld\n", localHdrOffset); return false; } if (get4LE(lfhBuf) != kLFHSignature) { off64_t actualOffset = lseek64(mFd, 0, SEEK_CUR); - LOGW("didn't find signature at start of lfh; wanted: offset=%ld data=0x%08x; " + ALOGW("didn't find signature at start of lfh; wanted: offset=%ld data=0x%08x; " "got: offset=" ZD " data=0x%08lx\n", localHdrOffset, kLFHSignature, (ZD_TYPE) actualOffset, get4LE(lfhBuf)); return false; @@ -591,13 +591,13 @@ bool ZipFileRO::getEntryInfo(ZipEntryRO entry, int* pMethod, size_t* pUncompLen, off64_t dataOffset = localHdrOffset + kLFHLen + get2LE(lfhBuf + kLFHNameLen) + get2LE(lfhBuf + kLFHExtraLen); if (dataOffset >= cdOffset) { - LOGW("bad data offset %ld in zip\n", (long) dataOffset); + ALOGW("bad data offset %ld in zip\n", (long) dataOffset); return false; } /* check lengths */ if ((off64_t)(dataOffset + compLen) > cdOffset) { - LOGW("bad compressed length in zip (%ld + " ZD " > %ld)\n", + ALOGW("bad compressed length in zip (%ld + " ZD " > %ld)\n", (long) dataOffset, (ZD_TYPE) compLen, (long) cdOffset); return false; } @@ -605,7 +605,7 @@ bool ZipFileRO::getEntryInfo(ZipEntryRO entry, int* pMethod, size_t* pUncompLen, if (method == kCompressStored && (off64_t)(dataOffset + uncompLen) > cdOffset) { - LOGE("ERROR: bad uncompressed length in zip (%ld + " ZD " > %ld)\n", + ALOGE("ERROR: bad uncompressed length in zip (%ld + " ZD " > %ld)\n", (long) dataOffset, (ZD_TYPE) uncompLen, (long) cdOffset); return false; } @@ -754,14 +754,14 @@ bool ZipFileRO::uncompressEntry(ZipEntryRO entry, int fd) const if (method == kCompressStored) { ssize_t actual = write(fd, ptr, uncompLen); if (actual < 0) { - LOGE("Write failed: %s\n", strerror(errno)); + ALOGE("Write failed: %s\n", strerror(errno)); goto unmap; } else if ((size_t) actual != uncompLen) { - LOGE("Partial write during uncompress (" ZD " of " ZD ")\n", + ALOGE("Partial write during uncompress (" ZD " of " ZD ")\n", (ZD_TYPE) actual, (ZD_TYPE) uncompLen); goto unmap; } else { - LOGI("+++ successful write\n"); + ALOGI("+++ successful write\n"); } } else { if (!inflateBuffer(fd, ptr, uncompLen, compLen)) @@ -806,10 +806,10 @@ bail: zerr = inflateInit2(&zstream, -MAX_WBITS); if (zerr != Z_OK) { if (zerr == Z_VERSION_ERROR) { - LOGE("Installed zlib is not compatible with linked version (%s)\n", + ALOGE("Installed zlib is not compatible with linked version (%s)\n", ZLIB_VERSION); } else { - LOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr); + ALOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr); } goto bail; } @@ -819,7 +819,7 @@ bail: */ zerr = inflate(&zstream, Z_FINISH); if (zerr != Z_STREAM_END) { - LOGW("Zip inflate failed, zerr=%d (nIn=%p aIn=%u nOut=%p aOut=%u)\n", + ALOGW("Zip inflate failed, zerr=%d (nIn=%p aIn=%u nOut=%p aOut=%u)\n", zerr, zstream.next_in, zstream.avail_in, zstream.next_out, zstream.avail_out); goto z_bail; @@ -827,7 +827,7 @@ bail: /* paranoia */ if (zstream.total_out != uncompLen) { - LOGW("Size mismatch on inflated file (%ld vs " ZD ")\n", + ALOGW("Size mismatch on inflated file (%ld vs " ZD ")\n", zstream.total_out, (ZD_TYPE) uncompLen); goto z_bail; } @@ -873,10 +873,10 @@ bail: zerr = inflateInit2(&zstream, -MAX_WBITS); if (zerr != Z_OK) { if (zerr == Z_VERSION_ERROR) { - LOGE("Installed zlib is not compatible with linked version (%s)\n", + ALOGE("Installed zlib is not compatible with linked version (%s)\n", ZLIB_VERSION); } else { - LOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr); + ALOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr); } goto bail; } @@ -890,7 +890,7 @@ bail: */ zerr = inflate(&zstream, Z_NO_FLUSH); if (zerr != Z_OK && zerr != Z_STREAM_END) { - LOGW("zlib inflate: zerr=%d (nIn=%p aIn=%u nOut=%p aOut=%u)\n", + ALOGW("zlib inflate: zerr=%d (nIn=%p aIn=%u nOut=%p aOut=%u)\n", zerr, zstream.next_in, zstream.avail_in, zstream.next_out, zstream.avail_out); goto z_bail; @@ -903,7 +903,7 @@ bail: long writeSize = zstream.next_out - writeBuf; int cc = write(fd, writeBuf, writeSize); if (cc != (int) writeSize) { - LOGW("write failed in inflate (%d vs %ld)\n", cc, writeSize); + ALOGW("write failed in inflate (%d vs %ld)\n", cc, writeSize); goto z_bail; } @@ -916,7 +916,7 @@ bail: /* paranoia */ if (zstream.total_out != uncompLen) { - LOGW("Size mismatch on inflated file (%ld vs " ZD ")\n", + ALOGW("Size mismatch on inflated file (%ld vs " ZD ")\n", zstream.total_out, (ZD_TYPE) uncompLen); goto z_bail; } diff --git a/libs/utils/ZipUtils.cpp b/libs/utils/ZipUtils.cpp index 9138878ff7..2dbdc1d380 100644 --- a/libs/utils/ZipUtils.cpp +++ b/libs/utils/ZipUtils.cpp @@ -77,10 +77,10 @@ using namespace android; zerr = inflateInit2(&zstream, -MAX_WBITS); if (zerr != Z_OK) { if (zerr == Z_VERSION_ERROR) { - LOGE("Installed zlib is not compatible with linked version (%s)\n", + ALOGE("Installed zlib is not compatible with linked version (%s)\n", ZLIB_VERSION); } else { - LOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr); + ALOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr); } goto bail; } @@ -95,12 +95,12 @@ using namespace android; if (zstream.avail_in == 0) { getSize = (compRemaining > kReadBufSize) ? kReadBufSize : compRemaining; - LOGV("+++ reading %ld bytes (%ld left)\n", + ALOGV("+++ reading %ld bytes (%ld left)\n", getSize, compRemaining); int cc = read(fd, readBuf, getSize); if (cc != (int) getSize) { - LOGD("inflate read failed (%d vs %ld)\n", + ALOGD("inflate read failed (%d vs %ld)\n", cc, getSize); goto z_bail; } @@ -114,7 +114,7 @@ using namespace android; /* uncompress the data */ zerr = inflate(&zstream, Z_NO_FLUSH); if (zerr != Z_OK && zerr != Z_STREAM_END) { - LOGD("zlib inflate call failed (zerr=%d)\n", zerr); + ALOGD("zlib inflate call failed (zerr=%d)\n", zerr); goto z_bail; } @@ -124,7 +124,7 @@ using namespace android; assert(zerr == Z_STREAM_END); /* other errors should've been caught */ if ((long) zstream.total_out != uncompressedLen) { - LOGW("Size mismatch on inflated file (%ld vs %ld)\n", + ALOGW("Size mismatch on inflated file (%ld vs %ld)\n", zstream.total_out, uncompressedLen); goto z_bail; } @@ -189,10 +189,10 @@ bail: zerr = inflateInit2(&zstream, -MAX_WBITS); if (zerr != Z_OK) { if (zerr == Z_VERSION_ERROR) { - LOGE("Installed zlib is not compatible with linked version (%s)\n", + ALOGE("Installed zlib is not compatible with linked version (%s)\n", ZLIB_VERSION); } else { - LOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr); + ALOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr); } goto bail; } @@ -207,12 +207,12 @@ bail: if (zstream.avail_in == 0) { getSize = (compRemaining > kReadBufSize) ? kReadBufSize : compRemaining; - LOGV("+++ reading %ld bytes (%ld left)\n", + ALOGV("+++ reading %ld bytes (%ld left)\n", getSize, compRemaining); int cc = fread(readBuf, 1, getSize, fp); if (cc != (int) getSize) { - LOGD("inflate read failed (%d vs %ld)\n", + ALOGD("inflate read failed (%d vs %ld)\n", cc, getSize); goto z_bail; } @@ -226,7 +226,7 @@ bail: /* uncompress the data */ zerr = inflate(&zstream, Z_NO_FLUSH); if (zerr != Z_OK && zerr != Z_STREAM_END) { - LOGD("zlib inflate call failed (zerr=%d)\n", zerr); + ALOGD("zlib inflate call failed (zerr=%d)\n", zerr); goto z_bail; } @@ -236,7 +236,7 @@ bail: assert(zerr == Z_STREAM_END); /* other errors should've been caught */ if ((long) zstream.total_out != uncompressedLen) { - LOGW("Size mismatch on inflated file (%ld vs %ld)\n", + ALOGW("Size mismatch on inflated file (%ld vs %ld)\n", zstream.total_out, uncompressedLen); goto z_bail; } diff --git a/libs/utils/primes.py b/libs/utils/primes.py new file mode 100755 index 0000000000..e161dd801e --- /dev/null +++ b/libs/utils/primes.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python2.6 +# +# 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. +# + +# +# Generates a table of prime numbers for use in BasicHashtable.cpp. +# +# Each prime is chosen such that it is a little more than twice as large as +# the previous prime in the table. This makes it easier to choose a new +# hashtable size when the underlying array is grown by as nominal factor +# of two each time. +# + +def is_odd_prime(n): + limit = (n - 1) / 2 + d = 3 + while d <= limit: + if n % d == 0: + return False + d += 2 + return True + +print "static size_t PRIMES[] = {" + +n = 5 +max = 2**31 - 1 +while n < max: + print " %d," % (n) + n = n * 2 + 1 + while not is_odd_prime(n): + n += 2 + +print " 0," +print "};" diff --git a/libs/utils/tests/Android.mk b/libs/utils/tests/Android.mk index b97f52f5b8..58230f429e 100644 --- a/libs/utils/tests/Android.mk +++ b/libs/utils/tests/Android.mk @@ -4,9 +4,10 @@ include $(CLEAR_VARS) # Build the unit tests. test_src_files := \ + BasicHashtable_test.cpp \ BlobCache_test.cpp \ - ObbFile_test.cpp \ Looper_test.cpp \ + ObbFile_test.cpp \ String8_test.cpp \ Unicode_test.cpp \ ZipFileRO_test.cpp \ diff --git a/libs/utils/tests/BasicHashtable_test.cpp b/libs/utils/tests/BasicHashtable_test.cpp new file mode 100644 index 0000000000..7dcf7509de --- /dev/null +++ b/libs/utils/tests/BasicHashtable_test.cpp @@ -0,0 +1,577 @@ +/* + * 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. + */ + +#define LOG_TAG "BasicHashtable_test" + +#include <utils/BasicHashtable.h> +#include <cutils/log.h> +#include <gtest/gtest.h> +#include <unistd.h> + +namespace android { + +typedef int SimpleKey; +typedef int SimpleValue; +typedef key_value_pair_t<SimpleKey, SimpleValue> SimpleEntry; +typedef BasicHashtable<SimpleKey, SimpleEntry> SimpleHashtable; + +struct ComplexKey { + int k; + + explicit ComplexKey(int k) : k(k) { + instanceCount += 1; + } + + ComplexKey(const ComplexKey& other) : k(other.k) { + instanceCount += 1; + } + + ~ComplexKey() { + instanceCount -= 1; + } + + bool operator ==(const ComplexKey& other) const { + return k == other.k; + } + + bool operator !=(const ComplexKey& other) const { + return k != other.k; + } + + static ssize_t instanceCount; +}; + +ssize_t ComplexKey::instanceCount = 0; + +template<> inline hash_t hash_type(const ComplexKey& value) { + return hash_type(value.k); +} + +struct ComplexValue { + int v; + + explicit ComplexValue(int v) : v(v) { + instanceCount += 1; + } + + ComplexValue(const ComplexValue& other) : v(other.v) { + instanceCount += 1; + } + + ~ComplexValue() { + instanceCount -= 1; + } + + static ssize_t instanceCount; +}; + +ssize_t ComplexValue::instanceCount = 0; + +typedef key_value_pair_t<ComplexKey, ComplexValue> ComplexEntry; +typedef BasicHashtable<ComplexKey, ComplexEntry> ComplexHashtable; + +class BasicHashtableTest : public testing::Test { +protected: + virtual void SetUp() { + ComplexKey::instanceCount = 0; + ComplexValue::instanceCount = 0; + } + + virtual void TearDown() { + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(0, 0)); + } + + void assertInstanceCount(ssize_t keys, ssize_t values) { + if (keys != ComplexKey::instanceCount || values != ComplexValue::instanceCount) { + FAIL() << "Expected " << keys << " keys and " << values << " values " + "but there were actually " << ComplexKey::instanceCount << " keys and " + << ComplexValue::instanceCount << " values"; + } + } + +public: + template <typename TKey, typename TEntry> + static void cookieAt(const BasicHashtable<TKey, TEntry>& h, size_t index, + bool* collision, bool* present, hash_t* hash) { + uint32_t cookie = h.cookieAt(index); + *collision = cookie & BasicHashtable<TKey, TEntry>::Bucket::COLLISION; + *present = cookie & BasicHashtable<TKey, TEntry>::Bucket::PRESENT; + *hash = cookie & BasicHashtable<TKey, TEntry>::Bucket::HASH_MASK; + } + + template <typename TKey, typename TEntry> + static const void* getBuckets(const BasicHashtable<TKey, TEntry>& h) { + return h.mBuckets; + } +}; + +template <typename TKey, typename TValue> +static size_t add(BasicHashtable<TKey, key_value_pair_t<TKey, TValue> >& h, + const TKey& key, const TValue& value) { + return h.add(hash_type(key), key_value_pair_t<TKey, TValue>(key, value)); +} + +template <typename TKey, typename TValue> +static ssize_t find(BasicHashtable<TKey, key_value_pair_t<TKey, TValue> >& h, + ssize_t index, const TKey& key) { + return h.find(index, hash_type(key), key); +} + +template <typename TKey, typename TValue> +static bool remove(BasicHashtable<TKey, key_value_pair_t<TKey, TValue> >& h, + const TKey& key) { + ssize_t index = find(h, -1, key); + if (index >= 0) { + h.removeAt(index); + return true; + } + return false; +} + +template <typename TEntry> +static void getKeyValue(const TEntry& entry, int* key, int* value); + +template <> void getKeyValue(const SimpleEntry& entry, int* key, int* value) { + *key = entry.key; + *value = entry.value; +} + +template <> void getKeyValue(const ComplexEntry& entry, int* key, int* value) { + *key = entry.key.k; + *value = entry.value.v; +} + +template <typename TKey, typename TValue> +static void dump(BasicHashtable<TKey, key_value_pair_t<TKey, TValue> >& h) { + ALOGD("hashtable %p, size=%u, capacity=%u, bucketCount=%u", + &h, h.size(), h.capacity(), h.bucketCount()); + for (size_t i = 0; i < h.bucketCount(); i++) { + bool collision, present; + hash_t hash; + BasicHashtableTest::cookieAt(h, i, &collision, &present, &hash); + if (present) { + int key, value; + getKeyValue(h.entryAt(i), &key, &value); + ALOGD(" [%3u] = collision=%d, present=%d, hash=0x%08x, key=%3d, value=%3d, " + "hash_type(key)=0x%08x", + i, collision, present, hash, key, value, hash_type(key)); + } else { + ALOGD(" [%3u] = collision=%d, present=%d", + i, collision, present); + } + } +} + +TEST_F(BasicHashtableTest, DefaultConstructor_WithDefaultProperties) { + SimpleHashtable h; + + EXPECT_EQ(0U, h.size()); + EXPECT_EQ(3U, h.capacity()); + EXPECT_EQ(5U, h.bucketCount()); + EXPECT_EQ(0.75f, h.loadFactor()); +} + +TEST_F(BasicHashtableTest, Constructor_WithNonUnityLoadFactor) { + SimpleHashtable h(52, 0.8f); + + EXPECT_EQ(0U, h.size()); + EXPECT_EQ(77U, h.capacity()); + EXPECT_EQ(97U, h.bucketCount()); + EXPECT_EQ(0.8f, h.loadFactor()); +} + +TEST_F(BasicHashtableTest, Constructor_WithUnityLoadFactorAndExactCapacity) { + SimpleHashtable h(46, 1.0f); + + EXPECT_EQ(0U, h.size()); + EXPECT_EQ(46U, h.capacity()); // must be one less than bucketCount because loadFactor == 1.0f + EXPECT_EQ(47U, h.bucketCount()); + EXPECT_EQ(1.0f, h.loadFactor()); +} + +TEST_F(BasicHashtableTest, Constructor_WithUnityLoadFactorAndInexactCapacity) { + SimpleHashtable h(42, 1.0f); + + EXPECT_EQ(0U, h.size()); + EXPECT_EQ(46U, h.capacity()); // must be one less than bucketCount because loadFactor == 1.0f + EXPECT_EQ(47U, h.bucketCount()); + EXPECT_EQ(1.0f, h.loadFactor()); +} + +TEST_F(BasicHashtableTest, FindAddFindRemoveFind_OneEntry) { + SimpleHashtable h; + ssize_t index = find(h, -1, 8); + ASSERT_EQ(-1, index); + + index = add(h, 8, 1); + ASSERT_EQ(1U, h.size()); + + ASSERT_EQ(index, find(h, -1, 8)); + ASSERT_EQ(8, h.entryAt(index).key); + ASSERT_EQ(1, h.entryAt(index).value); + + index = find(h, index, 8); + ASSERT_EQ(-1, index); + + ASSERT_TRUE(remove(h, 8)); + ASSERT_EQ(0U, h.size()); + + index = find(h, -1, 8); + ASSERT_EQ(-1, index); +} + +TEST_F(BasicHashtableTest, FindAddFindRemoveFind_MultipleEntryWithUniqueKey) { + const size_t N = 11; + + SimpleHashtable h; + for (size_t i = 0; i < N; i++) { + ssize_t index = find(h, -1, int(i)); + ASSERT_EQ(-1, index); + + index = add(h, int(i), int(i * 10)); + ASSERT_EQ(i + 1, h.size()); + + ASSERT_EQ(index, find(h, -1, int(i))); + ASSERT_EQ(int(i), h.entryAt(index).key); + ASSERT_EQ(int(i * 10), h.entryAt(index).value); + + index = find(h, index, int(i)); + ASSERT_EQ(-1, index); + } + + for (size_t i = N; --i > 0; ) { + ASSERT_TRUE(remove(h, int(i))) << "i = " << i; + ASSERT_EQ(i, h.size()); + + ssize_t index = find(h, -1, int(i)); + ASSERT_EQ(-1, index); + } +} + +TEST_F(BasicHashtableTest, FindAddFindRemoveFind_MultipleEntryWithDuplicateKey) { + const size_t N = 11; + const int K = 1; + + SimpleHashtable h; + for (size_t i = 0; i < N; i++) { + ssize_t index = find(h, -1, K); + if (i == 0) { + ASSERT_EQ(-1, index); + } else { + ASSERT_NE(-1, index); + } + + add(h, K, int(i)); + ASSERT_EQ(i + 1, h.size()); + + index = -1; + int values = 0; + for (size_t j = 0; j <= i; j++) { + index = find(h, index, K); + ASSERT_GE(index, 0); + ASSERT_EQ(K, h.entryAt(index).key); + values |= 1 << h.entryAt(index).value; + } + ASSERT_EQ(values, (1 << (i + 1)) - 1); + + index = find(h, index, K); + ASSERT_EQ(-1, index); + } + + for (size_t i = N; --i > 0; ) { + ASSERT_TRUE(remove(h, K)) << "i = " << i; + ASSERT_EQ(i, h.size()); + + ssize_t index = -1; + for (size_t j = 0; j < i; j++) { + index = find(h, index, K); + ASSERT_GE(index, 0); + ASSERT_EQ(K, h.entryAt(index).key); + } + + index = find(h, index, K); + ASSERT_EQ(-1, index); + } +} + +TEST_F(BasicHashtableTest, Clear_WhenAlreadyEmpty_DoesNothing) { + SimpleHashtable h; + h.clear(); + + EXPECT_EQ(0U, h.size()); + EXPECT_EQ(3U, h.capacity()); + EXPECT_EQ(5U, h.bucketCount()); + EXPECT_EQ(0.75f, h.loadFactor()); +} + +TEST_F(BasicHashtableTest, Clear_AfterElementsAdded_RemovesThem) { + SimpleHashtable h; + add(h, 0, 0); + add(h, 1, 0); + h.clear(); + + EXPECT_EQ(0U, h.size()); + EXPECT_EQ(3U, h.capacity()); + EXPECT_EQ(5U, h.bucketCount()); + EXPECT_EQ(0.75f, h.loadFactor()); +} + +TEST_F(BasicHashtableTest, Clear_AfterElementsAdded_DestroysThem) { + ComplexHashtable h; + add(h, ComplexKey(0), ComplexValue(0)); + add(h, ComplexKey(1), ComplexValue(0)); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2)); + + h.clear(); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(0, 0)); + + EXPECT_EQ(0U, h.size()); + EXPECT_EQ(3U, h.capacity()); + EXPECT_EQ(5U, h.bucketCount()); + EXPECT_EQ(0.75f, h.loadFactor()); +} + +TEST_F(BasicHashtableTest, Remove_AfterElementsAdded_DestroysThem) { + ComplexHashtable h; + add(h, ComplexKey(0), ComplexValue(0)); + add(h, ComplexKey(1), ComplexValue(0)); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2)); + + ASSERT_TRUE(remove(h, ComplexKey(0))); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(1, 1)); + + ASSERT_TRUE(remove(h, ComplexKey(1))); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(0, 0)); + + EXPECT_EQ(0U, h.size()); + EXPECT_EQ(3U, h.capacity()); + EXPECT_EQ(5U, h.bucketCount()); + EXPECT_EQ(0.75f, h.loadFactor()); +} + +TEST_F(BasicHashtableTest, Destructor_AfterElementsAdded_DestroysThem) { + { + ComplexHashtable h; + add(h, ComplexKey(0), ComplexValue(0)); + add(h, ComplexKey(1), ComplexValue(0)); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2)); + } // h is destroyed here + + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(0, 0)); +} + +TEST_F(BasicHashtableTest, Next_WhenEmpty_ReturnsMinusOne) { + SimpleHashtable h; + + ASSERT_EQ(-1, h.next(-1)); +} + +TEST_F(BasicHashtableTest, Next_WhenNonEmpty_IteratesOverAllEntries) { + const int N = 88; + + SimpleHashtable h; + for (int i = 0; i < N; i++) { + add(h, i, i * 10); + } + + bool set[N]; + memset(set, 0, sizeof(bool) * N); + int count = 0; + for (ssize_t index = -1; (index = h.next(index)) != -1; ) { + ASSERT_GE(index, 0); + ASSERT_LT(size_t(index), h.bucketCount()); + + const SimpleEntry& entry = h.entryAt(index); + ASSERT_GE(entry.key, 0); + ASSERT_LT(entry.key, N); + ASSERT_EQ(false, set[entry.key]); + ASSERT_EQ(entry.key * 10, entry.value); + + set[entry.key] = true; + count += 1; + } + ASSERT_EQ(N, count); +} + +TEST_F(BasicHashtableTest, Add_RehashesOnDemand) { + SimpleHashtable h; + size_t initialCapacity = h.capacity(); + size_t initialBucketCount = h.bucketCount(); + + for (size_t i = 0; i < initialCapacity; i++) { + add(h, int(i), 0); + } + + EXPECT_EQ(initialCapacity, h.size()); + EXPECT_EQ(initialCapacity, h.capacity()); + EXPECT_EQ(initialBucketCount, h.bucketCount()); + + add(h, -1, -1); + + EXPECT_EQ(initialCapacity + 1, h.size()); + EXPECT_GT(h.capacity(), initialCapacity); + EXPECT_GT(h.bucketCount(), initialBucketCount); + EXPECT_GT(h.bucketCount(), h.capacity()); +} + +TEST_F(BasicHashtableTest, Rehash_WhenCapacityAndBucketCountUnchanged_DoesNothing) { + ComplexHashtable h; + add(h, ComplexKey(0), ComplexValue(0)); + const void* oldBuckets = getBuckets(h); + ASSERT_NE((void*)NULL, oldBuckets); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(1, 1)); + + h.rehash(h.capacity(), h.loadFactor()); + + ASSERT_EQ(oldBuckets, getBuckets(h)); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(1, 1)); +} + +TEST_F(BasicHashtableTest, Rehash_WhenEmptyAndHasNoBuckets_ButDoesNotAllocateBuckets) { + ComplexHashtable h; + ASSERT_EQ((void*)NULL, getBuckets(h)); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(0, 0)); + + h.rehash(9, 1.0f); + + EXPECT_EQ(0U, h.size()); + EXPECT_EQ(10U, h.capacity()); + EXPECT_EQ(11U, h.bucketCount()); + EXPECT_EQ(1.0f, h.loadFactor()); + EXPECT_EQ((void*)NULL, getBuckets(h)); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(0, 0)); +} + +TEST_F(BasicHashtableTest, Rehash_WhenEmptyAndHasBuckets_ReleasesBucketsAndSetsCapacity) { + ComplexHashtable h(10); + add(h, ComplexKey(0), ComplexValue(0)); + ASSERT_TRUE(remove(h, ComplexKey(0))); + ASSERT_NE((void*)NULL, getBuckets(h)); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(0, 0)); + + h.rehash(0, 0.75f); + + EXPECT_EQ(0U, h.size()); + EXPECT_EQ(3U, h.capacity()); + EXPECT_EQ(5U, h.bucketCount()); + EXPECT_EQ(0.75f, h.loadFactor()); + EXPECT_EQ((void*)NULL, getBuckets(h)); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(0, 0)); +} + +TEST_F(BasicHashtableTest, Rehash_WhenLessThanCurrentCapacity_ShrinksBuckets) { + ComplexHashtable h(10); + add(h, ComplexKey(0), ComplexValue(0)); + add(h, ComplexKey(1), ComplexValue(1)); + const void* oldBuckets = getBuckets(h); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2)); + + h.rehash(0, 0.75f); + + EXPECT_EQ(2U, h.size()); + EXPECT_EQ(3U, h.capacity()); + EXPECT_EQ(5U, h.bucketCount()); + EXPECT_EQ(0.75f, h.loadFactor()); + EXPECT_NE(oldBuckets, getBuckets(h)); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2)); +} + +TEST_F(BasicHashtableTest, CopyOnWrite) { + ComplexHashtable h1; + add(h1, ComplexKey(0), ComplexValue(0)); + add(h1, ComplexKey(1), ComplexValue(1)); + const void* originalBuckets = getBuckets(h1); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2)); + ssize_t index0 = find(h1, -1, ComplexKey(0)); + EXPECT_GE(index0, 0); + + // copy constructor acquires shared reference + ComplexHashtable h2(h1); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2)); + ASSERT_EQ(originalBuckets, getBuckets(h2)); + EXPECT_EQ(h1.size(), h2.size()); + EXPECT_EQ(h1.capacity(), h2.capacity()); + EXPECT_EQ(h1.bucketCount(), h2.bucketCount()); + EXPECT_EQ(h1.loadFactor(), h2.loadFactor()); + EXPECT_EQ(index0, find(h2, -1, ComplexKey(0))); + + // operator= acquires shared reference + ComplexHashtable h3; + h3 = h2; + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2)); + ASSERT_EQ(originalBuckets, getBuckets(h3)); + EXPECT_EQ(h1.size(), h3.size()); + EXPECT_EQ(h1.capacity(), h3.capacity()); + EXPECT_EQ(h1.bucketCount(), h3.bucketCount()); + EXPECT_EQ(h1.loadFactor(), h3.loadFactor()); + EXPECT_EQ(index0, find(h3, -1, ComplexKey(0))); + + // editEntryAt copies shared contents + h1.editEntryAt(index0).value.v = 42; + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(4, 4)); + ASSERT_NE(originalBuckets, getBuckets(h1)); + EXPECT_EQ(42, h1.entryAt(index0).value.v); + EXPECT_EQ(0, h2.entryAt(index0).value.v); + EXPECT_EQ(0, h3.entryAt(index0).value.v); + + // clear releases reference to shared contents + h2.clear(); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(4, 4)); + EXPECT_EQ(0U, h2.size()); + ASSERT_NE(originalBuckets, getBuckets(h2)); + + // operator= acquires shared reference, destroys unshared contents + h1 = h3; + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2)); + ASSERT_EQ(originalBuckets, getBuckets(h1)); + EXPECT_EQ(h3.size(), h1.size()); + EXPECT_EQ(h3.capacity(), h1.capacity()); + EXPECT_EQ(h3.bucketCount(), h1.bucketCount()); + EXPECT_EQ(h3.loadFactor(), h1.loadFactor()); + EXPECT_EQ(index0, find(h1, -1, ComplexKey(0))); + + // add copies shared contents + add(h1, ComplexKey(2), ComplexValue(2)); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(5, 5)); + ASSERT_NE(originalBuckets, getBuckets(h1)); + EXPECT_EQ(3U, h1.size()); + EXPECT_EQ(0U, h2.size()); + EXPECT_EQ(2U, h3.size()); + + // remove copies shared contents + h1 = h3; + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2)); + ASSERT_EQ(originalBuckets, getBuckets(h1)); + h1.removeAt(index0); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(3, 3)); + ASSERT_NE(originalBuckets, getBuckets(h1)); + EXPECT_EQ(1U, h1.size()); + EXPECT_EQ(0U, h2.size()); + EXPECT_EQ(2U, h3.size()); + + // rehash copies shared contents + h1 = h3; + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2)); + ASSERT_EQ(originalBuckets, getBuckets(h1)); + h1.rehash(10, 1.0f); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(4, 4)); + ASSERT_NE(originalBuckets, getBuckets(h1)); + EXPECT_EQ(2U, h1.size()); + EXPECT_EQ(0U, h2.size()); + EXPECT_EQ(2U, h3.size()); +} + +} // namespace android diff --git a/opengl/libagl/TextureObjectManager.cpp b/opengl/libagl/TextureObjectManager.cpp index 022de09ddc..6a006aabfa 100644 --- a/opengl/libagl/TextureObjectManager.cpp +++ b/opengl/libagl/TextureObjectManager.cpp @@ -195,7 +195,7 @@ status_t EGLTextureObject::reallocate( return NO_MEMORY; } - LOGW_IF(level-1 >= mNumExtraLod, + ALOGW_IF(level-1 >= mNumExtraLod, "specifying mipmap level %d, but # of level is %d", level, mNumExtraLod+1); diff --git a/opengl/libagl/Tokenizer.cpp b/opengl/libagl/Tokenizer.cpp index 9b3ea1ac92..eac8d6d768 100644 --- a/opengl/libagl/Tokenizer.cpp +++ b/opengl/libagl/Tokenizer.cpp @@ -163,9 +163,9 @@ void Tokenizer::dump() const { const run_t* ranges = mRanges.array(); const size_t c = mRanges.size(); - LOGD("Tokenizer (%p, size = %u)\n", this, c); + ALOGD("Tokenizer (%p, size = %u)\n", this, c); for (size_t i=0 ; i<c ; i++) { - LOGD("%u: (%u, %u)\n", i, ranges[i].first, ranges[i].length); + ALOGD("%u: (%u, %u)\n", i, ranges[i].first, ranges[i].length); } } diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp index 6d4098c72d..eb55beefd9 100644 --- a/opengl/libagl/egl.cpp +++ b/opengl/libagl/egl.cpp @@ -184,7 +184,7 @@ egl_surface_t::~egl_surface_t() free(depth.data); } bool egl_surface_t::isValid() const { - LOGE_IF(magic != MAGIC, "invalid EGLSurface (%p)", this); + ALOGE_IF(magic != MAGIC, "invalid EGLSurface (%p)", this); return magic == MAGIC; } @@ -263,7 +263,7 @@ private: return (left>=right || top>=bottom); } void dump(char const* what) { - LOGD("%s { %5d, %5d, w=%5d, h=%5d }", + ALOGD("%s { %5d, %5d, w=%5d, h=%5d }", what, left, top, right-left, bottom-top); } @@ -397,7 +397,7 @@ EGLBoolean egl_window_surface_v2_t::connect() // pin the buffer down if (lock(buffer, GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN, &bits) != NO_ERROR) { - LOGE("connect() failed to lock buffer %p (%ux%u)", + ALOGE("connect() failed to lock buffer %p (%ux%u)", buffer, buffer->width, buffer->height); return setError(EGL_BAD_ACCESS, EGL_FALSE); // FIXME: we should make sure we're not accessing the buffer anymore @@ -552,7 +552,7 @@ EGLBoolean egl_window_surface_v2_t::swapBuffers() // finally pin the buffer down if (lock(buffer, GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN, &bits) != NO_ERROR) { - LOGE("eglSwapBuffers() failed to lock buffer %p (%ux%u)", + ALOGE("eglSwapBuffers() failed to lock buffer %p (%ux%u)", buffer, buffer->width, buffer->height); return setError(EGL_BAD_ACCESS, EGL_FALSE); // FIXME: we should make sure we're not accessing the buffer anymore @@ -721,7 +721,7 @@ egl_pbuffer_surface_t::egl_pbuffer_surface_t(EGLDisplay dpy, case GGL_PIXEL_FORMAT_RGBA_8888: size *= 4; break; case GGL_PIXEL_FORMAT_RGBX_8888: size *= 4; break; default: - LOGE("incompatible pixel format for pbuffer (format=%d)", f); + ALOGE("incompatible pixel format for pbuffer (format=%d)", f); pbuffer.data = 0; break; } diff --git a/opengl/libagl/matrix.cpp b/opengl/libagl/matrix.cpp index 9520f044ad..cdeccb3f78 100644 --- a/opengl/libagl/matrix.cpp +++ b/opengl/libagl/matrix.cpp @@ -217,9 +217,9 @@ void mvui_transform_t::picker() void transform_t::dump(const char* what) { GLfixed const * const m = matrix.m; - LOGD("%s:", what); + ALOGD("%s:", what); for (int i=0 ; i<4 ; i++) - LOGD("[%08x %08x %08x %08x] [%f %f %f %f]\n", + ALOGD("[%08x %08x %08x %08x] [%f %f %f %f]\n", m[I(0,i)], m[I(1,i)], m[I(2,i)], m[I(3,i)], fixedToFloat(m[I(0,i)]), fixedToFloat(m[I(1,i)]), @@ -273,11 +273,11 @@ void matrixf_t::multiply(matrixf_t& r, const matrixf_t& lhs, const matrixf_t& rh } void matrixf_t::dump(const char* what) { - LOGD("%s", what); - LOGD("[ %9f %9f %9f %9f ]", m[I(0,0)], m[I(1,0)], m[I(2,0)], m[I(3,0)]); - LOGD("[ %9f %9f %9f %9f ]", m[I(0,1)], m[I(1,1)], m[I(2,1)], m[I(3,1)]); - LOGD("[ %9f %9f %9f %9f ]", m[I(0,2)], m[I(1,2)], m[I(2,2)], m[I(3,2)]); - LOGD("[ %9f %9f %9f %9f ]", m[I(0,3)], m[I(1,3)], m[I(2,3)], m[I(3,3)]); + ALOGD("%s", what); + ALOGD("[ %9f %9f %9f %9f ]", m[I(0,0)], m[I(1,0)], m[I(2,0)], m[I(3,0)]); + ALOGD("[ %9f %9f %9f %9f ]", m[I(0,1)], m[I(1,1)], m[I(2,1)], m[I(3,1)]); + ALOGD("[ %9f %9f %9f %9f ]", m[I(0,2)], m[I(1,2)], m[I(2,2)], m[I(3,2)]); + ALOGD("[ %9f %9f %9f %9f ]", m[I(0,3)], m[I(1,3)], m[I(2,3)], m[I(3,3)]); } void matrixf_t::loadIdentity() { diff --git a/opengl/libagl/mipmap.cpp b/opengl/libagl/mipmap.cpp index ccd77b7dc8..e142a58d00 100644 --- a/opengl/libagl/mipmap.cpp +++ b/opengl/libagl/mipmap.cpp @@ -174,7 +174,7 @@ status_t buildAPyramid(ogles_context_t* c, EGLTextureObject* tex) } } } else { - LOGE("Unsupported format (%d)", base->format); + ALOGE("Unsupported format (%d)", base->format); return BAD_TYPE; } diff --git a/opengl/libs/Android.mk b/opengl/libs/Android.mk index 9c1a10e214..66bc64dd45 100644 --- a/opengl/libs/Android.mk +++ b/opengl/libs/Android.mk @@ -18,7 +18,7 @@ LOCAL_SRC_FILES:= \ EGL/Loader.cpp \ # -LOCAL_SHARED_LIBRARIES += libcutils libutils libGLESv2_dbg +LOCAL_SHARED_LIBRARIES += libcutils libutils libGLES_trace LOCAL_LDLIBS := -lpthread -ldl LOCAL_MODULE:= libEGL LOCAL_LDFLAGS += -Wl,--exclude-libs=ALL diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp index 325193c7f4..2fc612522f 100644 --- a/opengl/libs/EGL/Loader.cpp +++ b/opengl/libs/EGL/Loader.cpp @@ -28,7 +28,7 @@ #include <EGL/egl.h> #include "egldefs.h" -#include "glesv2dbg.h" +#include "glestrace.h" #include "hooks.h" #include "Loader.h" @@ -131,7 +131,7 @@ Loader::Loader() /* Special case for GLES emulation */ if (checkGlesEmulationStatus() == 0) { - LOGD("Emulator without GPU support detected. Fallback to software renderer."); + ALOGD("Emulator without GPU support detected. Fallback to software renderer."); gConfig.add( entry_t(0, 0, "android") ); return; } @@ -140,14 +140,14 @@ Loader::Loader() FILE* cfg = fopen("/system/lib/egl/egl.cfg", "r"); if (cfg == NULL) { // default config - LOGD("egl.cfg not found, using default config"); + ALOGD("egl.cfg not found, using default config"); gConfig.add( entry_t(0, 0, "android") ); } else { while (fgets(line, 256, cfg)) { int dpy; int impl; if (sscanf(line, "%u %u %s", &dpy, &impl, tag) == 3) { - //LOGD(">>> %u %u %s", dpy, impl, tag); + //ALOGD(">>> %u %u %s", dpy, impl, tag); gConfig.add( entry_t(dpy, impl, tag) ); } } @@ -157,7 +157,7 @@ Loader::Loader() Loader::~Loader() { - StopDebugServer(); + GLTrace_stop(); } const char* Loader::getTag(int dpy, int impl) @@ -238,7 +238,7 @@ void Loader::init_api(void* dso, strncpy(scrap, name, index); scrap[index] = 0; f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, scrap); - //LOGD_IF(f, "found <%s> instead", scrap); + //ALOGD_IF(f, "found <%s> instead", scrap); } } if (f == NULL) { @@ -247,11 +247,11 @@ void Loader::init_api(void* dso, if (index>0 && strcmp(name+index, "OES")) { snprintf(scrap, SIZE, "%sOES", name); f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, scrap); - //LOGD_IF(f, "found <%s> instead", scrap); + //ALOGD_IF(f, "found <%s> instead", scrap); } } if (f == NULL) { - //LOGD("%s", name); + //ALOGD("%s", name); f = (__eglMustCastToProperFunctionPointerType)gl_unimplemented; } *curr++ = f; @@ -278,16 +278,16 @@ void *Loader::load_driver(const char* kind, const char *tag, void* dso = dlopen(driver_absolute_path, RTLD_NOW | RTLD_LOCAL); if (dso == 0) { const char* err = dlerror(); - LOGE("load_driver(%s): %s", driver_absolute_path, err?err:"unknown"); + ALOGE("load_driver(%s): %s", driver_absolute_path, err?err:"unknown"); return 0; } - LOGD("loaded %s", driver_absolute_path); + ALOGD("loaded %s", driver_absolute_path); if (mask & EGL) { getProcAddress = (getProcAddressType)dlsym(dso, "eglGetProcAddress"); - LOGE_IF(!getProcAddress, + ALOGE_IF(!getProcAddress, "can't find eglGetProcAddress() in %s", driver_absolute_path); egl_t* egl = &cnx->egl; diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp index 6ad06afff7..e053589a87 100644 --- a/opengl/libs/EGL/egl.cpp +++ b/opengl/libs/EGL/egl.cpp @@ -37,7 +37,7 @@ #include "egldefs.h" #include "egl_impl.h" #include "egl_tls.h" -#include "glesv2dbg.h" +#include "glestrace.h" #include "hooks.h" #include "Loader.h" @@ -67,7 +67,6 @@ static int sEGLTraceLevel; static int sEGLApplicationTraceLevel; extern gl_hooks_t gHooksTrace; -extern gl_hooks_t gHooksDebug; static inline void setGlTraceThreadSpecific(gl_hooks_t const *value) { pthread_setspecific(gGLTraceKey, value); @@ -85,31 +84,27 @@ void initEglTraceLevel() { sEGLTraceLevel = propertyLevel > applicationLevel ? propertyLevel : applicationLevel; property_get("debug.egl.debug_proc", value, ""); + if (strlen(value) == 0) + return; + long pid = getpid(); char procPath[128] = {}; sprintf(procPath, "/proc/%ld/cmdline", pid); FILE * file = fopen(procPath, "r"); - if (file) - { + if (file) { char cmdline[256] = {}; - if (fgets(cmdline, sizeof(cmdline) - 1, file)) - { - if (!strcmp(value, cmdline)) + if (fgets(cmdline, sizeof(cmdline) - 1, file)) { + if (!strncmp(value, cmdline, strlen(value))) { + // set EGL debug if the "debug.egl.debug_proc" property + // matches the prefix of this application's command line gEGLDebugLevel = 1; + } } fclose(file); } - if (gEGLDebugLevel > 0) - { - property_get("debug.egl.debug_port", value, "5039"); - const unsigned short port = (unsigned short)atoi(value); - property_get("debug.egl.debug_forceUseFile", value, "0"); - const bool forceUseFile = (bool)atoi(value); - property_get("debug.egl.debug_maxFileSize", value, "8"); - const unsigned int maxFileSize = atoi(value) << 20; - property_get("debug.egl.debug_filePath", value, "/data/local/tmp/dump.gles2dbg"); - StartDebugServer(port, forceUseFile, maxFileSize, value); + if (gEGLDebugLevel > 0) { + GLTrace_start(); } } @@ -119,7 +114,7 @@ void setGLHooksThreadSpecific(gl_hooks_t const *value) { setGlThreadSpecific(&gHooksTrace); } else if (gEGLDebugLevel > 0 && value != &gHooksNoContext) { setGlTraceThreadSpecific(value); - setGlThreadSpecific(&gHooksDebug); + setGlThreadSpecific(GLTrace_getGLHooks()); } else { setGlThreadSpecific(value); } @@ -146,7 +141,7 @@ void setGLHooksThreadSpecific(gl_hooks_t const *value) { static int gl_no_context() { if (egl_tls_t::logNoContextCall()) { - LOGE("call to OpenGL ES API with no current context " + ALOGE("call to OpenGL ES API with no current context " "(logged once per thread)"); char value[PROPERTY_VALUE_MAX]; property_get("debug.egl.callstack", value, "0"); @@ -270,7 +265,7 @@ static EGLBoolean egl_init_drivers_locked() { cnx->hooks[GLESv2_INDEX] = &gHooks[GLESv2_INDEX][IMPL_HARDWARE]; cnx->dso = loader.open(EGL_DEFAULT_DISPLAY, 1, cnx); } else { - LOGD("3D hardware acceleration is disabled"); + ALOGD("3D hardware acceleration is disabled"); } } @@ -292,7 +287,7 @@ EGLBoolean egl_init_drivers() { } void gl_unimplemented() { - LOGE("called unimplemented OpenGL ES API"); + ALOGE("called unimplemented OpenGL ES API"); } // ---------------------------------------------------------------------------- diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp index 2b0ed5dfd6..664f2582d2 100644 --- a/opengl/libs/EGL/eglApi.cpp +++ b/opengl/libs/EGL/eglApi.cpp @@ -37,7 +37,7 @@ #include "egl_impl.h" #include "egl_tls.h" -#include "glesv2dbg.h" +#include "glestrace.h" #include "hooks.h" #include "egl_display.h" @@ -112,7 +112,6 @@ extern EGLBoolean egl_init_drivers(); extern const __eglMustCastToProperFunctionPointerType gExtensionForwarders[MAX_NUMBER_OF_GL_EXTENSIONS]; extern int gEGLDebugLevel; extern gl_hooks_t gHooksTrace; -extern gl_hooks_t gHooksDebug; } // namespace android; // ---------------------------------------------------------------------------- @@ -353,7 +352,7 @@ EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config, EGLint format; if (native_window_api_connect(window, NATIVE_WINDOW_API_EGL) != OK) { - LOGE("EGLNativeWindowType %p already connected to another API", + ALOGE("EGLNativeWindowType %p already connected to another API", window); return setError(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE); } @@ -364,7 +363,7 @@ EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config, if (format != 0) { int err = native_window_set_buffers_format(window, format); if (err != 0) { - LOGE("error setting native window pixel format: %s (%d)", + ALOGE("error setting native window pixel format: %s (%d)", strerror(-err), err); native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL); return setError(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE); @@ -516,6 +515,10 @@ EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config, } egl_context_t* c = new egl_context_t(dpy, context, config, dp->configs[intptr_t(config)].impl, cnx, version); +#if EGL_TRACE + if (gEGLDebugLevel > 0) + GLTrace_eglCreateContext(version, c); +#endif return c; } } @@ -657,9 +660,10 @@ EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw, if (ctx != EGL_NO_CONTEXT) { setGLHooksThreadSpecific(c->cnx->hooks[c->version]); egl_tls_t::setContext(ctx); - if (gEGLDebugLevel > 0) { - CreateDbgContext(c->version, c->cnx->hooks[c->version]); - } +#if EGL_TRACE + if (gEGLDebugLevel > 0) + GLTrace_eglMakeCurrent(c->version, c->cnx->hooks[c->version], ctx); +#endif _c.acquire(); _r.acquire(); _d.acquire(); @@ -670,7 +674,7 @@ EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw, egl_tls_t::setContext(EGL_NO_CONTEXT); } } else { - // this will LOGE the error + // this will ALOGE the error result = setError(c->cnx->egl.eglGetError(), EGL_FALSE); } return result; @@ -882,10 +886,14 @@ __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname) addr = sGLExtentionMap.valueFor(name); const int slot = sGLExtentionSlot; - LOGE_IF(slot >= MAX_NUMBER_OF_GL_EXTENSIONS, + ALOGE_IF(slot >= MAX_NUMBER_OF_GL_EXTENSIONS, "no more slots for eglGetProcAddress(\"%s\")", procname); +#if EGL_TRACE + gl_hooks_t *debugHooks = GLTrace_getGLHooks(); +#endif + if (!addr && (slot < MAX_NUMBER_OF_GL_EXTENSIONS)) { bool found = false; for (int i=0 ; i<IMPL_NUM_IMPLEMENTATIONS ; i++) { @@ -896,7 +904,7 @@ __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname) cnx->hooks[GLESv1_INDEX]->ext.extensions[slot] = cnx->hooks[GLESv2_INDEX]->ext.extensions[slot] = #if EGL_TRACE - gHooksDebug.ext.extensions[slot] = gHooksTrace.ext.extensions[slot] = + debugHooks->ext.extensions[slot] = gHooksTrace.ext.extensions[slot] = #endif cnx->egl.eglGetProcAddress(procname); } @@ -924,10 +932,6 @@ __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname) EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface draw) { - EGLBoolean Debug_eglSwapBuffers(EGLDisplay dpy, EGLSurface draw); - if (gEGLDebugLevel > 0) - Debug_eglSwapBuffers(dpy, draw); - clearError(); egl_display_t const * const dp = validate_display(dpy); @@ -937,6 +941,11 @@ EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface draw) if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE); +#if EGL_TRACE + if (gEGLDebugLevel > 0) + GLTrace_eglSwapBuffers(dpy, draw); +#endif + egl_surface_t const * const s = get_surface(draw); return s->cnx->egl.eglSwapBuffers(dp->disp[s->impl].dpy, s->surface); } @@ -1162,7 +1171,10 @@ EGLBoolean eglReleaseThread(void) } } egl_tls_t::clearTLS(); - dbgReleaseThread(); +#if EGL_TRACE + if (gEGLDebugLevel > 0) + GLTrace_eglReleaseThread(); +#endif return EGL_TRUE; } diff --git a/opengl/libs/EGL/egl_cache.cpp b/opengl/libs/EGL/egl_cache.cpp index c4a7466ec5..7fd6519c2d 100644 --- a/opengl/libs/EGL/egl_cache.cpp +++ b/opengl/libs/EGL/egl_cache.cpp @@ -101,7 +101,7 @@ void egl_cache_t::initialize(egl_display_t *display) { cnx->egl.eglGetProcAddress( "eglSetBlobCacheFuncsANDROID")); if (eglSetBlobCacheFuncsANDROID == NULL) { - LOGE("EGL_ANDROID_blob_cache advertised by display %d, " + ALOGE("EGL_ANDROID_blob_cache advertised by display %d, " "but unable to get eglSetBlobCacheFuncsANDROID", i); continue; } @@ -110,7 +110,7 @@ void egl_cache_t::initialize(egl_display_t *display) { android::setBlob, android::getBlob); EGLint err = cnx->egl.eglGetError(); if (err != EGL_SUCCESS) { - LOGE("eglSetBlobCacheFuncsANDROID resulted in an error: " + ALOGE("eglSetBlobCacheFuncsANDROID resulted in an error: " "%#x", err); } } @@ -133,7 +133,7 @@ void egl_cache_t::setBlob(const void* key, EGLsizeiANDROID keySize, Mutex::Autolock lock(mMutex); if (keySize < 0 || valueSize < 0) { - LOGW("EGL_ANDROID_blob_cache set: negative sizes are not allowed"); + ALOGW("EGL_ANDROID_blob_cache set: negative sizes are not allowed"); return; } @@ -172,7 +172,7 @@ EGLsizeiANDROID egl_cache_t::getBlob(const void* key, EGLsizeiANDROID keySize, Mutex::Autolock lock(mMutex); if (keySize < 0 || valueSize < 0) { - LOGW("EGL_ANDROID_blob_cache set: negative sizes are not allowed"); + ALOGW("EGL_ANDROID_blob_cache set: negative sizes are not allowed"); return 0; } @@ -226,7 +226,7 @@ void egl_cache_t::saveBlobCacheLocked() { // The file exists, delete it and try again. if (unlink(fname) == -1) { // No point in retrying if the unlink failed. - LOGE("error unlinking cache file %s: %s (%d)", fname, + ALOGE("error unlinking cache file %s: %s (%d)", fname, strerror(errno), errno); return; } @@ -234,7 +234,7 @@ void egl_cache_t::saveBlobCacheLocked() { fd = open(fname, O_CREAT | O_EXCL | O_RDWR, 0); } if (fd == -1) { - LOGE("error creating cache file %s: %s (%d)", fname, + ALOGE("error creating cache file %s: %s (%d)", fname, strerror(errno), errno); return; } @@ -242,7 +242,7 @@ void egl_cache_t::saveBlobCacheLocked() { size_t fileSize = headerSize + cacheSize; if (ftruncate(fd, fileSize) == -1) { - LOGE("error setting cache file size: %s (%d)", strerror(errno), + ALOGE("error setting cache file size: %s (%d)", strerror(errno), errno); close(fd); unlink(fname); @@ -252,7 +252,7 @@ void egl_cache_t::saveBlobCacheLocked() { uint8_t* buf = reinterpret_cast<uint8_t*>(mmap(NULL, fileSize, PROT_WRITE, MAP_SHARED, fd, 0)); if (buf == MAP_FAILED) { - LOGE("error mmaping cache file: %s (%d)", strerror(errno), + ALOGE("error mmaping cache file: %s (%d)", strerror(errno), errno); close(fd); unlink(fname); @@ -262,7 +262,7 @@ void egl_cache_t::saveBlobCacheLocked() { status_t err = mBlobCache->flatten(buf + headerSize, cacheSize, NULL, 0); if (err != OK) { - LOGE("error writing cache contents: %s (%d)", strerror(-err), + ALOGE("error writing cache contents: %s (%d)", strerror(-err), -err); munmap(buf, fileSize); close(fd); @@ -288,7 +288,7 @@ void egl_cache_t::loadBlobCacheLocked() { int fd = open(mFilename.string(), O_RDONLY, 0); if (fd == -1) { if (errno != ENOENT) { - LOGE("error opening cache file %s: %s (%d)", mFilename.string(), + ALOGE("error opening cache file %s: %s (%d)", mFilename.string(), strerror(errno), errno); } return; @@ -296,7 +296,7 @@ void egl_cache_t::loadBlobCacheLocked() { struct stat statBuf; if (fstat(fd, &statBuf) == -1) { - LOGE("error stat'ing cache file: %s (%d)", strerror(errno), errno); + ALOGE("error stat'ing cache file: %s (%d)", strerror(errno), errno); close(fd); return; } @@ -304,7 +304,7 @@ void egl_cache_t::loadBlobCacheLocked() { // Sanity check the size before trying to mmap it. size_t fileSize = statBuf.st_size; if (fileSize > maxTotalSize * 2) { - LOGE("cache file is too large: %#llx", statBuf.st_size); + ALOGE("cache file is too large: %#llx", statBuf.st_size); close(fd); return; } @@ -312,7 +312,7 @@ void egl_cache_t::loadBlobCacheLocked() { uint8_t* buf = reinterpret_cast<uint8_t*>(mmap(NULL, fileSize, PROT_READ, MAP_PRIVATE, fd, 0)); if (buf == MAP_FAILED) { - LOGE("error mmaping cache file: %s (%d)", strerror(errno), + ALOGE("error mmaping cache file: %s (%d)", strerror(errno), errno); close(fd); return; @@ -321,13 +321,13 @@ void egl_cache_t::loadBlobCacheLocked() { // Check the file magic and CRC size_t cacheSize = fileSize - headerSize; if (memcmp(buf, cacheFileMagic, 4) != 0) { - LOGE("cache file has bad mojo"); + ALOGE("cache file has bad mojo"); close(fd); return; } uint32_t* crc = reinterpret_cast<uint32_t*>(buf + 4); if (crc32c(buf + headerSize, cacheSize) != *crc) { - LOGE("cache file failed CRC check"); + ALOGE("cache file failed CRC check"); close(fd); return; } @@ -335,7 +335,7 @@ void egl_cache_t::loadBlobCacheLocked() { status_t err = mBlobCache->unflatten(buf + headerSize, cacheSize, NULL, 0); if (err != OK) { - LOGE("error reading cache contents: %s (%d)", strerror(-err), + ALOGE("error reading cache contents: %s (%d)", strerror(-err), -err); munmap(buf, fileSize); close(fd); diff --git a/opengl/libs/EGL/egl_display.cpp b/opengl/libs/EGL/egl_display.cpp index 31119f9608..53eaf9a136 100644 --- a/opengl/libs/EGL/egl_display.cpp +++ b/opengl/libs/EGL/egl_display.cpp @@ -184,7 +184,7 @@ EGLBoolean egl_display_t::initialize(EGLint *major, EGLint *minor) { EGLDisplay idpy = disp[i].dpy; if (cnx->egl.eglInitialize(idpy, &cnx->major, &cnx->minor)) { - //LOGD("initialized %d dpy=%p, ver=%d.%d, cnx=%p", + //ALOGD("initialized %d dpy=%p, ver=%d.%d, cnx=%p", // i, idpy, cnx->major, cnx->minor, cnx); // display is now initialized @@ -201,7 +201,7 @@ EGLBoolean egl_display_t::initialize(EGLint *major, EGLint *minor) { EGL_CLIENT_APIS); } else { - LOGW("%d: eglInitialize(%p) failed (%s)", i, idpy, + ALOGW("%d: eglInitialize(%p) failed (%s)", i, idpy, egl_tls_t::egl_strerror(cnx->egl.eglGetError())); } } @@ -309,7 +309,7 @@ EGLBoolean egl_display_t::terminate() { egl_connection_t* const cnx = &gEGLImpl[i]; if (cnx->dso && disp[i].state == egl_display_t::INITIALIZED) { if (cnx->egl.eglTerminate(disp[i].dpy) == EGL_FALSE) { - LOGW("%d: eglTerminate(%p) failed (%s)", i, disp[i].dpy, + ALOGW("%d: eglTerminate(%p) failed (%s)", i, disp[i].dpy, egl_tls_t::egl_strerror(cnx->egl.eglGetError())); } // REVISIT: it's unclear what to do if eglTerminate() fails @@ -327,7 +327,7 @@ EGLBoolean egl_display_t::terminate() { // there are no reference to them, it which case, we're free to // delete them. size_t count = objects.size(); - LOGW_IF(count, "eglTerminate() called w/ %d objects remaining", count); + ALOGW_IF(count, "eglTerminate() called w/ %d objects remaining", count); for (size_t i=0 ; i<count ; i++) { egl_object_t* o = objects.itemAt(i); o->destroy(); diff --git a/opengl/libs/EGL/egl_object.cpp b/opengl/libs/EGL/egl_object.cpp index 20cdc7eb40..26e8c3eb10 100644 --- a/opengl/libs/EGL/egl_object.cpp +++ b/opengl/libs/EGL/egl_object.cpp @@ -45,7 +45,7 @@ void egl_object_t::terminate() { display->removeObject(this); if (decRef() == 1) { // shouldn't happen because this is called from LocalRef - LOGE("egl_object_t::terminate() removed the last reference!"); + ALOGE("egl_object_t::terminate() removed the last reference!"); } } diff --git a/opengl/libs/EGL/egl_object.h b/opengl/libs/EGL/egl_object.h index df1b261dd5..7106fa5ebf 100644 --- a/opengl/libs/EGL/egl_object.h +++ b/opengl/libs/EGL/egl_object.h @@ -110,7 +110,7 @@ void egl_object_t::LocalRef<N,T>::release() const { if (ref) { if (ref->decRef() == 1) { // shouldn't happen because this is called from LocalRef - LOGE("LocalRef::release() removed the last reference!"); + ALOGE("LocalRef::release() removed the last reference!"); } } } @@ -131,7 +131,7 @@ protected: if (window != NULL) { native_window_set_buffers_format(window, 0); if (native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL)) { - LOGW("EGLNativeWindowType %p disconnect failed", window); + ALOGW("EGLNativeWindowType %p disconnect failed", window); } } } diff --git a/opengl/libs/EGL/egl_tls.cpp b/opengl/libs/EGL/egl_tls.cpp index b341ddbc79..41cfae1b63 100644 --- a/opengl/libs/EGL/egl_tls.cpp +++ b/opengl/libs/EGL/egl_tls.cpp @@ -33,7 +33,7 @@ pthread_key_t egl_tls_t::sKey = -1; pthread_mutex_t egl_tls_t::sLockKey = PTHREAD_MUTEX_INITIALIZER; egl_tls_t::egl_tls_t() - : error(EGL_SUCCESS), ctx(0), logCallWithNoContext(EGL_TRUE), dbg(0) { + : error(EGL_SUCCESS), ctx(0), logCallWithNoContext(EGL_TRUE) { } const char *egl_tls_t::egl_strerror(EGLint err) { @@ -73,7 +73,7 @@ void egl_tls_t::setErrorEtcImpl( egl_tls_t* tls = getTLS(); if (tls->error != error) { if (!quiet) { - LOGE("%s:%d error %x (%s)", + ALOGE("%s:%d error %x (%s)", caller, line, error, egl_strerror(error)); char value[PROPERTY_VALUE_MAX]; property_get("debug.egl.callstack", value, "0"); diff --git a/opengl/libs/EGL/egl_tls.h b/opengl/libs/EGL/egl_tls.h index 78b0b2fe5c..2442ca0da8 100644 --- a/opengl/libs/EGL/egl_tls.h +++ b/opengl/libs/EGL/egl_tls.h @@ -37,7 +37,6 @@ class egl_tls_t { EGLint error; EGLContext ctx; EGLBoolean logCallWithNoContext; - DbgContext* dbg; egl_tls_t(); static void validateTLSKey(); diff --git a/opengl/libs/EGL/trace.cpp b/opengl/libs/EGL/trace.cpp index 0e934e2d8b..52907c1f1a 100644 --- a/opengl/libs/EGL/trace.cpp +++ b/opengl/libs/EGL/trace.cpp @@ -97,30 +97,30 @@ public: static void TraceGLShaderSource(GLuint shader, GLsizei count, const GLchar** string, const GLint* length) { - LOGD("const char* shaderSrc[] = {"); + ALOGD("const char* shaderSrc[] = {"); for (GLsizei i = 0; i < count; i++) { const char* comma = i < count-1 ? "," : ""; const GLchar* s = string[i]; if (length) { GLint len = length[i]; - LOGD(" \"%*s\"%s", len, s, comma); + ALOGD(" \"%*s\"%s", len, s, comma); } else { - LOGD(" \"%s\"%s", s, comma); + ALOGD(" \"%s\"%s", s, comma); } } - LOGD("};"); + ALOGD("};"); if (length) { - LOGD("const GLint* shaderLength[] = {"); + ALOGD("const GLint* shaderLength[] = {"); for (GLsizei i = 0; i < count; i++) { const char* comma = i < count-1 ? "," : ""; GLint len = length[i]; - LOGD(" \"%d\"%s", len, comma); + ALOGD(" \"%d\"%s", len, comma); } - LOGD("};"); - LOGD("glShaderSource(%u, %u, shaderSrc, shaderLength);", + ALOGD("};"); + ALOGD("glShaderSource(%u, %u, shaderSrc, shaderLength);", shader, count); } else { - LOGD("glShaderSource(%u, %u, shaderSrc, (const GLint*) 0);", + ALOGD("glShaderSource(%u, %u, shaderSrc, (const GLint*) 0);", shader, count); } } @@ -131,7 +131,7 @@ static void TraceValue(int elementCount, char type, GLsizei count = chunkCount * chunkSize; bool isFloat = type == 'f'; const char* typeString = isFloat ? "GLfloat" : "GLint"; - LOGD("const %s value[] = {", typeString); + ALOGD("const %s value[] = {", typeString); for (GLsizei i = 0; i < count; i++) { StringBuilder builder; builder.append(" "); @@ -152,25 +152,25 @@ static void TraceValue(int elementCount, char type, value = (void*) (((GLint*) value) + 1); } } - LOGD("%s", builder.getString()); + ALOGD("%s", builder.getString()); if (chunkSize > 1 && i < count-1 && (i % chunkSize) == (chunkSize-1)) { - LOGD("%s", ""); // Print a blank line. + ALOGD("%s", ""); // Print a blank line. } } - LOGD("};"); + ALOGD("};"); } static void TraceUniformv(int elementCount, char type, GLuint location, GLsizei count, const void* value) { TraceValue(elementCount, type, count, 1, value); - LOGD("glUniform%d%c(%u, %u, value);", elementCount, type, location, count); + ALOGD("glUniform%d%c(%u, %u, value);", elementCount, type, location, count); } static void TraceUniformMatrix(int matrixSideLength, GLuint location, GLsizei count, GLboolean transpose, const void* value) { TraceValue(matrixSideLength, 'f', count, matrixSideLength, value); - LOGD("glUniformMatrix%dfv(%u, %u, %s, value);", matrixSideLength, location, count, + ALOGD("glUniformMatrix%dfv(%u, %u, %s, value);", matrixSideLength, location, count, GLbooleanToString(transpose)); } @@ -310,7 +310,7 @@ static void TraceGL(const char* name, int numArgs, ...) { } } builder.append(");"); - LOGD("%s", builder.getString()); + ALOGD("%s", builder.getString()); va_end(argp); } @@ -375,22 +375,6 @@ extern "C" { #undef TRACE_GL_VOID #undef TRACE_GL -// declare all Debug_gl* functions -#define GL_ENTRY(_r, _api, ...) _r Debug_##_api ( __VA_ARGS__ ); -#include "glesv2dbg_functions.h" -#undef GL_ENTRY - -#define GL_ENTRY(_r, _api, ...) Debug_ ## _api, -EGLAPI gl_hooks_t gHooksDebug = { - { - #include "entries.in" - }, - { - {0} - } -}; -#undef GL_ENTRY - // ---------------------------------------------------------------------------- }; // namespace android // ---------------------------------------------------------------------------- diff --git a/opengl/libs/ETC1/etc1.cpp b/opengl/libs/ETC1/etc1.cpp index 5ed2c3c49f..97d10851de 100644 --- a/opengl/libs/ETC1/etc1.cpp +++ b/opengl/libs/ETC1/etc1.cpp @@ -149,13 +149,13 @@ inline int divideBy255(int d) { static inline int convert8To4(int b) { int c = b & 0xff; - return divideBy255(b * 15); + return divideBy255(c * 15); } static inline int convert8To5(int b) { int c = b & 0xff; - return divideBy255(b * 31); + return divideBy255(c * 31); } static diff --git a/opengl/libs/GLES2/gl2.cpp b/opengl/libs/GLES2/gl2.cpp index fee4609378..df22b968a1 100644 --- a/opengl/libs/GLES2/gl2.cpp +++ b/opengl/libs/GLES2/gl2.cpp @@ -83,7 +83,7 @@ using namespace android; _c->_api(__VA_ARGS__); \ GLenum status = GL_NO_ERROR; \ while ((status = glGetError()) != GL_NO_ERROR) { \ - LOGD("[" #_api "] 0x%x", status); \ + ALOGD("[" #_api "] 0x%x", status); \ } #else diff --git a/opengl/libs/GLES2_dbg/src/caller.cpp b/opengl/libs/GLES2_dbg/src/caller.cpp index 6b72751bd0..70d23d67ca 100644 --- a/opengl/libs/GLES2_dbg/src/caller.cpp +++ b/opengl/libs/GLES2_dbg/src/caller.cpp @@ -103,7 +103,7 @@ static const int * GenerateCall_glVertexAttribPointer(DbgContext * const dbg, const int * GenerateCall(DbgContext * const dbg, const glesv2debugger::Message & cmd, glesv2debugger::Message & msg, const int * const prevRet) { - LOGD("GenerateCall function=%u", cmd.function()); + ALOGD("GenerateCall function=%u", cmd.function()); const int * ret = prevRet; // only some functions have return value nsecs_t c0 = systemTime(timeMode); switch (cmd.function()) { case glesv2debugger::Message_Function_glActiveTexture: diff --git a/opengl/libs/GLES2_dbg/src/dbgcontext.cpp b/opengl/libs/GLES2_dbg/src/dbgcontext.cpp index 41061e1bc6..7bbaa18bc6 100644 --- a/opengl/libs/GLES2_dbg/src/dbgcontext.cpp +++ b/opengl/libs/GLES2_dbg/src/dbgcontext.cpp @@ -100,7 +100,7 @@ unsigned GetBytesPerPixel(const GLenum format, const GLenum type) case GL_UNSIGNED_BYTE: break; default: - LOGE("GetBytesPerPixel: unknown type %x", type); + ALOGE("GetBytesPerPixel: unknown type %x", type); } switch (format) { @@ -115,7 +115,7 @@ unsigned GetBytesPerPixel(const GLenum format, const GLenum type) case 0x80E1: // GL_BGRA_EXT return 4; default: - LOGE("GetBytesPerPixel: unknown format %x", format); + ALOGE("GetBytesPerPixel: unknown format %x", format); } return 1; // in doubt... @@ -242,7 +242,7 @@ unsigned int DbgContext::GetBufferSize() void DbgContext::glUseProgram(GLuint program) { while (GLenum error = hooks->gl.glGetError()) - LOGD("DbgContext::glUseProgram(%u): before glGetError() = 0x%.4X", + ALOGD("DbgContext::glUseProgram(%u): before glGetError() = 0x%.4X", program, error); this->program = program; maxAttrib = 0; @@ -286,7 +286,7 @@ void DbgContext::glUseProgram(GLuint program) } delete name; while (GLenum error = hooks->gl.glGetError()) - LOGD("DbgContext::glUseProgram(%u): after glGetError() = 0x%.4X", + ALOGD("DbgContext::glUseProgram(%u): after glGetError() = 0x%.4X", program, error); } diff --git a/opengl/libs/GLES2_dbg/src/header.h b/opengl/libs/GLES2_dbg/src/header.h index 49f3847f5d..0ab48902b2 100644 --- a/opengl/libs/GLES2_dbg/src/header.h +++ b/opengl/libs/GLES2_dbg/src/header.h @@ -48,9 +48,9 @@ using namespace com::android; #endif #undef assert -#define assert(expr) if (!(expr)) { LOGD("\n*\n*\n* assert: %s at %s \n*\n*", #expr, __location__); int * x = 0; *x = 5; } -//#undef LOGD -//#define LOGD(...) +#define assert(expr) if (!(expr)) { ALOGD("\n*\n*\n* assert: %s at %s \n*\n*", #expr, __location__); int * x = 0; *x = 5; } +//#undef ALOGD +//#define ALOGD(...) namespace android { diff --git a/opengl/libs/GLES2_dbg/src/server.cpp b/opengl/libs/GLES2_dbg/src/server.cpp index 0c711bf200..3e93697074 100644 --- a/opengl/libs/GLES2_dbg/src/server.cpp +++ b/opengl/libs/GLES2_dbg/src/server.cpp @@ -34,7 +34,7 @@ int timeMode = SYSTEM_TIME_THREAD; static void Die(const char * msg) { - LOGD("\n*\n*\n* GLESv2_dbg: Die: %s \n*\n*", msg); + ALOGD("\n*\n*\n* GLESv2_dbg: Die: %s \n*\n*", msg); StopDebugServer(); exit(1); } @@ -44,11 +44,11 @@ void StartDebugServer(const unsigned short port, const bool forceUseFile, { MAX_FILE_SIZE = maxFileSize; - LOGD("GLESv2_dbg: StartDebugServer"); + ALOGD("GLESv2_dbg: StartDebugServer"); if (serverSock >= 0 || file) return; - LOGD("GLESv2_dbg: StartDebugServer create socket"); + ALOGD("GLESv2_dbg: StartDebugServer create socket"); struct sockaddr_in server = {}, client = {}; /* Create the TCP socket */ @@ -75,7 +75,7 @@ void StartDebugServer(const unsigned short port, const bool forceUseFile, Die("Failed to listen on server socket"); } - LOGD("server started on %d \n", server.sin_port); + ALOGD("server started on %d \n", server.sin_port); /* Wait for client connection */ @@ -85,13 +85,13 @@ void StartDebugServer(const unsigned short port, const bool forceUseFile, Die("Failed to accept client connection"); } - LOGD("Client connected: %s\n", inet_ntoa(client.sin_addr)); + ALOGD("Client connected: %s\n", inet_ntoa(client.sin_addr)); // fcntl(clientSock, F_SETFL, O_NONBLOCK); } void StopDebugServer() { - LOGD("GLESv2_dbg: StopDebugServer"); + ALOGD("GLESv2_dbg: StopDebugServer"); if (clientSock > 0) { close(clientSock); clientSock = -1; @@ -115,7 +115,7 @@ void Receive(glesv2debugger::Message & cmd) if (received < 0) Die("Failed to receive response length"); else if (4 != received) { - LOGD("received %dB: %.8X", received, len); + ALOGD("received %dB: %.8X", received, len); Die("Received length mismatch, expected 4"); } static void * buffer = NULL; @@ -150,7 +150,7 @@ bool TryReceive(glesv2debugger::Message & cmd) bool received = false; if (FD_ISSET(clientSock, &readSet)) { - LOGD("TryReceive: avaiable for read"); + ALOGD("TryReceive: avaiable for read"); Receive(cmd); return true; } @@ -190,14 +190,14 @@ float Send(const glesv2debugger::Message & msg, glesv2debugger::Message & cmd) int sent = -1; sent = send(clientSock, &len, sizeof(len), 0); if (sent != sizeof(len)) { - LOGD("actual sent=%d expected=%d clientSock=%d", sent, sizeof(len), clientSock); + ALOGD("actual sent=%d expected=%d clientSock=%d", sent, sizeof(len), clientSock); Die("Failed to send message length"); } nsecs_t c0 = systemTime(timeMode); sent = send(clientSock, str.data(), str.length(), 0); float t = (float)ns2ms(systemTime(timeMode) - c0); if (sent != str.length()) { - LOGD("actual sent=%d expected=%d clientSock=%d", sent, str.length(), clientSock); + ALOGD("actual sent=%d expected=%d clientSock=%d", sent, str.length(), clientSock); Die("Failed to send message"); } // TODO: factor Receive & TryReceive out and into MessageLoop, or add control argument. @@ -210,9 +210,9 @@ float Send(const glesv2debugger::Message & msg, glesv2debugger::Message & cmd) if (!msg.expect_response()) { if (TryReceive(cmd)) { if (glesv2debugger::Message_Function_SETPROP == cmd.function()) - LOGD("Send: TryReceived SETPROP"); + ALOGD("Send: TryReceived SETPROP"); else - LOGD("Send: TryReceived %u", cmd.function()); + ALOGD("Send: TryReceived %u", cmd.function()); } } else Receive(cmd); @@ -223,19 +223,19 @@ void SetProp(DbgContext * const dbg, const glesv2debugger::Message & cmd) { switch (cmd.prop()) { case glesv2debugger::Message_Prop_CaptureDraw: - LOGD("SetProp Message_Prop_CaptureDraw %d", cmd.arg0()); + ALOGD("SetProp Message_Prop_CaptureDraw %d", cmd.arg0()); dbg->captureDraw = cmd.arg0(); break; case glesv2debugger::Message_Prop_TimeMode: - LOGD("SetProp Message_Prop_TimeMode %d", cmd.arg0()); + ALOGD("SetProp Message_Prop_TimeMode %d", cmd.arg0()); timeMode = cmd.arg0(); break; case glesv2debugger::Message_Prop_ExpectResponse: - LOGD("SetProp Message_Prop_ExpectResponse %d=%d", cmd.arg0(), cmd.arg1()); + ALOGD("SetProp Message_Prop_ExpectResponse %d=%d", cmd.arg0(), cmd.arg1()); dbg->expectResponse.Bit((glesv2debugger::Message_Function)cmd.arg0(), cmd.arg1()); break; case glesv2debugger::Message_Prop_CaptureSwap: - LOGD("SetProp CaptureSwap %d", cmd.arg0()); + ALOGD("SetProp CaptureSwap %d", cmd.arg0()); dbg->captureSwap = cmd.arg0(); break; default: @@ -269,7 +269,7 @@ int * MessageLoop(FunctionCall & functionCall, glesv2debugger::Message & msg, case glesv2debugger::Message_Function_CONTINUE: ret = functionCall(&dbg->hooks->gl, msg); while (GLenum error = dbg->hooks->gl.glGetError()) - LOGD("Function=%u glGetError() = 0x%.4X", function, error); + ALOGD("Function=%u glGetError() = 0x%.4X", function, error); if (!msg.has_time()) // some has output data copy, so time inside call msg.set_time((systemTime(timeMode) - c0) * 1e-6f); msg.set_context_id(reinterpret_cast<int>(dbg)); diff --git a/opengl/libs/GLES2_dbg/src/vertex.cpp b/opengl/libs/GLES2_dbg/src/vertex.cpp index 28a24206d6..70c34333db 100644 --- a/opengl/libs/GLES2_dbg/src/vertex.cpp +++ b/opengl/libs/GLES2_dbg/src/vertex.cpp @@ -72,7 +72,7 @@ void Debug_glDrawArrays(GLenum mode, GLint first, GLsizei count) if (dbg->captureDraw > 0) { dbg->captureDraw--; dbg->hooks->gl.glGetIntegerv(GL_VIEWPORT, viewport); -// LOGD("glDrawArrays CAPTURE: x=%d y=%d width=%d height=%d format=0x%.4X type=0x%.4X", +// ALOGD("glDrawArrays CAPTURE: x=%d y=%d width=%d height=%d format=0x%.4X type=0x%.4X", // viewport[0], viewport[1], viewport[2], viewport[3], readFormat, readType); pixels = dbg->GetReadPixelsBuffer(viewport[2] * viewport[3] * dbg->readBytesPerPixel); diff --git a/opengl/libs/GLES_CM/gl.cpp b/opengl/libs/GLES_CM/gl.cpp index ee29f12faf..2d31a35177 100644 --- a/opengl/libs/GLES_CM/gl.cpp +++ b/opengl/libs/GLES_CM/gl.cpp @@ -132,7 +132,7 @@ GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type, #define CHECK_GL_ERRORS(_api) \ do { GLint err = glGetError(); \ - LOGE_IF(err != GL_NO_ERROR, "%s failed (0x%04X)", #_api, err); \ + ALOGE_IF(err != GL_NO_ERROR, "%s failed (0x%04X)", #_api, err); \ } while(false); #else diff --git a/opengl/libs/GLES_trace/.gitignore b/opengl/libs/GLES_trace/.gitignore new file mode 100644 index 0000000000..8df825ed1d --- /dev/null +++ b/opengl/libs/GLES_trace/.gitignore @@ -0,0 +1,4 @@ +java +*.pyc +*.swp +pyratemp.py diff --git a/opengl/libs/GLES2_dbg/Android.mk b/opengl/libs/GLES_trace/Android.mk index 70853d8cff..465b6b2c42 100644 --- a/opengl/libs/GLES2_dbg/Android.mk +++ b/opengl/libs/GLES_trace/Android.mk @@ -3,13 +3,14 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES := \ - src/api.cpp \ - src/caller.cpp \ - src/dbgcontext.cpp \ - src/debugger_message.pb.cpp \ - src/egl.cpp \ - src/server.cpp \ - src/vertex.cpp + src/gltrace_api.cpp \ + src/gltrace_context.cpp \ + src/gltrace_egl.cpp \ + src/gltrace_eglapi.cpp \ + src/gltrace_fixup.cpp \ + src/gltrace_hooks.cpp \ + src/gltrace.pb.cpp \ + src/gltrace_transport.cpp LOCAL_C_INCLUDES := \ $(LOCAL_PATH) \ @@ -19,20 +20,15 @@ LOCAL_C_INCLUDES := \ external \ bionic -#LOCAL_CFLAGS += -O0 -g -DDEBUG -UNDEBUG LOCAL_CFLAGS := -DGOOGLE_PROTOBUF_NO_RTTI LOCAL_STATIC_LIBRARIES := libprotobuf-cpp-2.3.0-lite liblzf LOCAL_SHARED_LIBRARIES := libcutils libutils libstlport -ifeq ($(TARGET_ARCH),arm) - LOCAL_CFLAGS += -fstrict-aliasing -endif ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true) LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER endif -LOCAL_CFLAGS += -DLOG_TAG=\"libGLES2_dbg\" - +LOCAL_CFLAGS += -DLOG_TAG=\"libGLES_trace\" # we need to access the private Bionic header <bionic_tls.h> # on ARM platforms, we need to mirror the ARCH_ARM_HAVE_TLS_REGISTER @@ -42,9 +38,7 @@ ifeq ($(TARGET_ARCH)-$(ARCH_ARM_HAVE_TLS_REGISTER),arm-true) endif LOCAL_C_INCLUDES += bionic/libc/private -LOCAL_MODULE:= libGLESv2_dbg +LOCAL_MODULE:= libGLES_trace LOCAL_MODULE_TAGS := optional include $(BUILD_SHARED_LIBRARY) - -include $(LOCAL_PATH)/test/Android.mk diff --git a/opengl/libs/GLES_trace/DESIGN.txt b/opengl/libs/GLES_trace/DESIGN.txt new file mode 100644 index 0000000000..a189e1d82c --- /dev/null +++ b/opengl/libs/GLES_trace/DESIGN.txt @@ -0,0 +1,51 @@ +Design of the GLES Tracing Library + +Code Runtime Behavior: + + Initialization: + + egl_display_t::initialize() calls initEglTraceLevel() to figure out whether tracing should be + enabled. Currently, the shell properties "debug.egl.trace" and "debug.egl.debug_proc" together + control whether tracing should be enabled for a certain process. If tracing is enabled, this + calls GLTrace_start() to start the trace server. + + Note that initEglTraceLevel() is also called from early_egl_init(), but that happens in the + context of the zygote, so that invocation has no effect. + + egl_display_t::initialize() then calls setGLHooksThreadSpecific() where we set the thread + specific gl_hooks structure to point to the trace implementation. From this point on, every + GLES call is redirected to the trace implementation. + + Application runtime: + + While the application is running, all its GLES calls are directly routed to their corresponding + trace implementation. + + For EGL calls, the trace library provides a bunch of functions that must be explicitly called + from the EGL library. These functions are declared in glestrace.h + + Application shutdown: + + Currently, the application is killed when the user stops tracing from the frontend GUI. We need + to explore if a more graceful method of stopping the application, or detaching tracing from the + application is required. + +Code Structure: + + glestrace.h declares all the hooks exposed by libglestrace. These are used by EGL/egl.cpp and + EGL/eglApi.cpp to initialize the trace library, and to inform the library of EGL calls. + + All GL calls are present in GLES_Trace/src/gltrace_api.cpp. This file is generated by the + GLES_Trace/src/genapi.py script. The structure of all the functions looks like this: + + void GLTrace_glFunction(args) { + // declare a protobuf + // copy arguments into the protobuf + // call the original GLES function + // if there is a return value, save it into the protobuf + // fixup the protobuf if necessary + // transport the protobuf to the host + } + + The fixupGLMessage() call does any custom processing of the protobuf based on the GLES call. + This typically amounts to copying the data corresponding to input or output pointers. diff --git a/opengl/libs/GLES_trace/TODO.txt b/opengl/libs/GLES_trace/TODO.txt new file mode 100644 index 0000000000..f5e6e9518c --- /dev/null +++ b/opengl/libs/GLES_trace/TODO.txt @@ -0,0 +1,14 @@ +TODO: + - Context - Currently, we don't do anything regarding the contexts that are created. + Need to maintain more state regarding contexts, and figure out what happens in the + presence of multiple contexts. + + - Transport: Each GLMessage is sent via a socket as soon as the message is received. + i.e., there is no buffering of messages. Buffering should improve performance. + + - Initialization: On first connection, send some basic information that includes: + 1. version of the trace library + 2. implementation dependent GL state variables such as # of vertex arrays etc. + + - eglSwapBuffers: The images are lzf compressed, but there is no mode that transfers + only the differences from the previous images. diff --git a/opengl/libs/GLES_trace/dev.make b/opengl/libs/GLES_trace/dev.make new file mode 100644 index 0000000000..1d89999e96 --- /dev/null +++ b/opengl/libs/GLES_trace/dev.make @@ -0,0 +1,15 @@ +## NOTE +## This file is used for development purposes only. It is not used by the build system. + +# generate protocol buffer files +genproto: gltrace.proto + aprotoc --cpp_out=src --java_out=java gltrace.proto + mv src/gltrace.pb.cc src/gltrace.pb.cpp + +# NOTE: $OUT should be defined in the shell by doing a "lunch <config>" +# push updated files to device +push: + adb push $(OUT)/system/lib/libGLESv2.so /system/lib/ + adb push $(OUT)/system/lib/libGLESv1_CM.so /system/lib/ + adb push $(OUT)/system/lib/libGLES_trace.so /system/lib/ + adb push $(OUT)/system/lib/libEGL.so /system/lib/ diff --git a/opengl/libs/GLES_trace/gltrace.proto b/opengl/libs/GLES_trace/gltrace.proto new file mode 100644 index 0000000000..7dde69f558 --- /dev/null +++ b/opengl/libs/GLES_trace/gltrace.proto @@ -0,0 +1,491 @@ +/* + * 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. + */ + +package android.gltrace; + +option optimize_for = LITE_RUNTIME; + +option java_package = "com.android.ide.eclipse.gltrace"; +option java_outer_classname = "GLProtoBuf"; + +message GLMessage { + enum Function { + glActiveTexture = 0; + glAlphaFunc = 1; + glAlphaFuncx = 2; + glAlphaFuncxOES = 3; + glAttachShader = 4; + glBeginPerfMonitorAMD = 5; + glBindAttribLocation = 6; + glBindBuffer = 7; + glBindFramebuffer = 8; + glBindFramebufferOES = 9; + glBindRenderbuffer = 10; + glBindRenderbufferOES = 11; + glBindTexture = 12; + glBindVertexArrayOES = 13; + glBlendColor = 14; + glBlendEquation = 15; + glBlendEquationOES = 16; + glBlendEquationSeparate = 17; + glBlendEquationSeparateOES = 18; + glBlendFunc = 19; + glBlendFuncSeparate = 20; + glBlendFuncSeparateOES = 21; + glBufferData = 22; + glBufferSubData = 23; + glCheckFramebufferStatus = 24; + glCheckFramebufferStatusOES = 25; + glClearColor = 26; + glClearColorx = 27; + glClearColorxOES = 28; + glClearDepthf = 29; + glClearDepthfOES = 30; + glClearDepthx = 31; + glClearDepthxOES = 32; + glClear = 33; + glClearStencil = 34; + glClientActiveTexture = 35; + glClipPlanef = 36; + glClipPlanefIMG = 37; + glClipPlanefOES = 38; + glClipPlanex = 39; + glClipPlanexIMG = 40; + glClipPlanexOES = 41; + glColor4f = 42; + glColor4ub = 43; + glColor4x = 44; + glColor4xOES = 45; + glColorMask = 46; + glColorPointer = 47; + glCompileShader = 48; + glCompressedTexImage2D = 49; + glCompressedTexImage3DOES = 50; + glCompressedTexSubImage2D = 51; + glCompressedTexSubImage3DOES = 52; + glCopyTexImage2D = 53; + glCopyTexSubImage2D = 54; + glCopyTexSubImage3DOES = 55; + glCoverageMaskNV = 56; + glCoverageOperationNV = 57; + glCreateProgram = 58; + glCreateShader = 59; + glCullFace = 60; + glCurrentPaletteMatrixOES = 61; + glDeleteBuffers = 62; + glDeleteFencesNV = 63; + glDeleteFramebuffers = 64; + glDeleteFramebuffersOES = 65; + glDeletePerfMonitorsAMD = 66; + glDeleteProgram = 67; + glDeleteRenderbuffers = 68; + glDeleteRenderbuffersOES = 69; + glDeleteShader = 70; + glDeleteTextures = 71; + glDeleteVertexArraysOES = 72; + glDepthFunc = 73; + glDepthMask = 74; + glDepthRangef = 75; + glDepthRangefOES = 76; + glDepthRangex = 77; + glDepthRangexOES = 78; + glDetachShader = 79; + glDisableClientState = 80; + glDisableDriverControlQCOM = 81; + glDisable = 82; + glDisableVertexAttribArray = 83; + glDiscardFramebufferEXT = 84; + glDrawArrays = 85; + glDrawElements = 86; + glDrawTexfOES = 87; + glDrawTexfvOES = 88; + glDrawTexiOES = 89; + glDrawTexivOES = 90; + glDrawTexsOES = 91; + glDrawTexsvOES = 92; + glDrawTexxOES = 93; + glDrawTexxvOES = 94; + glEGLImageTargetRenderbufferStorageOES = 95; + glEGLImageTargetTexture2DOES = 96; + glEnableClientState = 97; + glEnableDriverControlQCOM = 98; + glEnable = 99; + glEnableVertexAttribArray = 100; + glEndPerfMonitorAMD = 101; + glEndTilingQCOM = 102; + glExtGetBufferPointervQCOM = 103; + glExtGetBuffersQCOM = 104; + glExtGetFramebuffersQCOM = 105; + glExtGetProgramBinarySourceQCOM = 106; + glExtGetProgramsQCOM = 107; + glExtGetRenderbuffersQCOM = 108; + glExtGetShadersQCOM = 109; + glExtGetTexLevelParameterivQCOM = 110; + glExtGetTexSubImageQCOM = 111; + glExtGetTexturesQCOM = 112; + glExtIsProgramBinaryQCOM = 113; + glExtTexObjectStateOverrideiQCOM = 114; + glFinishFenceNV = 115; + glFinish = 116; + glFlush = 117; + glFogf = 118; + glFogfv = 119; + glFogx = 120; + glFogxOES = 121; + glFogxv = 122; + glFogxvOES = 123; + glFramebufferRenderbuffer = 124; + glFramebufferRenderbufferOES = 125; + glFramebufferTexture2D = 126; + glFramebufferTexture2DMultisampleIMG = 127; + glFramebufferTexture2DOES = 128; + glFramebufferTexture3DOES = 129; + glFrontFace = 130; + glFrustumf = 131; + glFrustumfOES = 132; + glFrustumx = 133; + glFrustumxOES = 134; + glGenBuffers = 135; + glGenerateMipmap = 136; + glGenerateMipmapOES = 137; + glGenFencesNV = 138; + glGenFramebuffers = 139; + glGenFramebuffersOES = 140; + glGenPerfMonitorsAMD = 141; + glGenRenderbuffers = 142; + glGenRenderbuffersOES = 143; + glGenTextures = 144; + glGenVertexArraysOES = 145; + glGetActiveAttrib = 146; + glGetActiveUniform = 147; + glGetAttachedShaders = 148; + glGetAttribLocation = 149; + glGetBooleanv = 150; + glGetBufferParameteriv = 151; + glGetBufferPointervOES = 152; + glGetClipPlanef = 153; + glGetClipPlanefOES = 154; + glGetClipPlanex = 155; + glGetClipPlanexOES = 156; + glGetDriverControlsQCOM = 157; + glGetDriverControlStringQCOM = 158; + glGetError = 159; + glGetFenceivNV = 160; + glGetFixedv = 161; + glGetFixedvOES = 162; + glGetFloatv = 163; + glGetFramebufferAttachmentParameteriv = 164; + glGetFramebufferAttachmentParameterivOES = 165; + glGetIntegerv = 166; + glGetLightfv = 167; + glGetLightxv = 168; + glGetLightxvOES = 169; + glGetMaterialfv = 170; + glGetMaterialxv = 171; + glGetMaterialxvOES = 172; + glGetPerfMonitorCounterDataAMD = 173; + glGetPerfMonitorCounterInfoAMD = 174; + glGetPerfMonitorCountersAMD = 175; + glGetPerfMonitorCounterStringAMD = 176; + glGetPerfMonitorGroupsAMD = 177; + glGetPerfMonitorGroupStringAMD = 178; + glGetPointerv = 179; + glGetProgramBinaryOES = 180; + glGetProgramInfoLog = 181; + glGetProgramiv = 182; + glGetRenderbufferParameteriv = 183; + glGetRenderbufferParameterivOES = 184; + glGetShaderInfoLog = 185; + glGetShaderiv = 186; + glGetShaderPrecisionFormat = 187; + glGetShaderSource = 188; + glGetString = 189; + glGetTexEnvfv = 190; + glGetTexEnviv = 191; + glGetTexEnvxv = 192; + glGetTexEnvxvOES = 193; + glGetTexGenfvOES = 194; + glGetTexGenivOES = 195; + glGetTexGenxvOES = 196; + glGetTexParameterfv = 197; + glGetTexParameteriv = 198; + glGetTexParameterxv = 199; + glGetTexParameterxvOES = 200; + glGetUniformfv = 201; + glGetUniformiv = 202; + glGetUniformLocation = 203; + glGetVertexAttribfv = 204; + glGetVertexAttribiv = 205; + glGetVertexAttribPointerv = 206; + glHint = 207; + glIsBuffer = 208; + glIsEnabled = 209; + glIsFenceNV = 210; + glIsFramebuffer = 211; + glIsFramebufferOES = 212; + glIsProgram = 213; + glIsRenderbuffer = 214; + glIsRenderbufferOES = 215; + glIsShader = 216; + glIsTexture = 217; + glIsVertexArrayOES = 218; + glLightf = 219; + glLightfv = 220; + glLightModelf = 221; + glLightModelfv = 222; + glLightModelx = 223; + glLightModelxOES = 224; + glLightModelxv = 225; + glLightModelxvOES = 226; + glLightx = 227; + glLightxOES = 228; + glLightxv = 229; + glLightxvOES = 230; + glLineWidth = 231; + glLineWidthx = 232; + glLineWidthxOES = 233; + glLinkProgram = 234; + glLoadIdentity = 235; + glLoadMatrixf = 236; + glLoadMatrixx = 237; + glLoadMatrixxOES = 238; + glLoadPaletteFromModelViewMatrixOES = 239; + glLogicOp = 240; + glMapBufferOES = 241; + glMaterialf = 242; + glMaterialfv = 243; + glMaterialx = 244; + glMaterialxOES = 245; + glMaterialxv = 246; + glMaterialxvOES = 247; + glMatrixIndexPointerOES = 248; + glMatrixMode = 249; + glMultiDrawArraysEXT = 250; + glMultiDrawElementsEXT = 251; + glMultiTexCoord4f = 252; + glMultiTexCoord4x = 253; + glMultiTexCoord4xOES = 254; + glMultMatrixf = 255; + glMultMatrixx = 256; + glMultMatrixxOES = 257; + glNormal3f = 258; + glNormal3x = 259; + glNormal3xOES = 260; + glNormalPointer = 261; + glOrthof = 262; + glOrthofOES = 263; + glOrthox = 264; + glOrthoxOES = 265; + glPixelStorei = 266; + glPointParameterf = 267; + glPointParameterfv = 268; + glPointParameterx = 269; + glPointParameterxOES = 270; + glPointParameterxv = 271; + glPointParameterxvOES = 272; + glPointSize = 273; + glPointSizePointerOES = 274; + glPointSizex = 275; + glPointSizexOES = 276; + glPolygonOffset = 277; + glPolygonOffsetx = 278; + glPolygonOffsetxOES = 279; + glPopMatrix = 280; + glProgramBinaryOES = 281; + glPushMatrix = 282; + glQueryMatrixxOES = 283; + glReadPixels = 284; + glReleaseShaderCompiler = 285; + glRenderbufferStorage = 286; + glRenderbufferStorageMultisampleIMG = 287; + glRenderbufferStorageOES = 288; + glRotatef = 289; + glRotatex = 290; + glRotatexOES = 291; + glSampleCoverage = 292; + glSampleCoveragex = 293; + glSampleCoveragexOES = 294; + glScalef = 295; + glScalex = 296; + glScalexOES = 297; + glScissor = 298; + glSelectPerfMonitorCountersAMD = 299; + glSetFenceNV = 300; + glShadeModel = 301; + glShaderBinary = 302; + glShaderSource = 303; + glStartTilingQCOM = 304; + glStencilFunc = 305; + glStencilFuncSeparate = 306; + glStencilMask = 307; + glStencilMaskSeparate = 308; + glStencilOp = 309; + glStencilOpSeparate = 310; + glTestFenceNV = 311; + glTexCoordPointer = 312; + glTexEnvf = 313; + glTexEnvfv = 314; + glTexEnvi = 315; + glTexEnviv = 316; + glTexEnvx = 317; + glTexEnvxOES = 318; + glTexEnvxv = 319; + glTexEnvxvOES = 320; + glTexGenfOES = 321; + glTexGenfvOES = 322; + glTexGeniOES = 323; + glTexGenivOES = 324; + glTexGenxOES = 325; + glTexGenxvOES = 326; + glTexImage2D = 327; + glTexImage3DOES = 328; + glTexParameterf = 329; + glTexParameterfv = 330; + glTexParameteri = 331; + glTexParameteriv = 332; + glTexParameterx = 333; + glTexParameterxOES = 334; + glTexParameterxv = 335; + glTexParameterxvOES = 336; + glTexSubImage2D = 337; + glTexSubImage3DOES = 338; + glTranslatef = 339; + glTranslatex = 340; + glTranslatexOES = 341; + glUniform1f = 342; + glUniform1fv = 343; + glUniform1i = 344; + glUniform1iv = 345; + glUniform2f = 346; + glUniform2fv = 347; + glUniform2i = 348; + glUniform2iv = 349; + glUniform3f = 350; + glUniform3fv = 351; + glUniform3i = 352; + glUniform3iv = 353; + glUniform4f = 354; + glUniform4fv = 355; + glUniform4i = 356; + glUniform4iv = 357; + glUniformMatrix2fv = 358; + glUniformMatrix3fv = 359; + glUniformMatrix4fv = 360; + glUnmapBufferOES = 361; + glUseProgram = 362; + glValidateProgram = 363; + glVertexAttrib1f = 364; + glVertexAttrib1fv = 365; + glVertexAttrib2f = 366; + glVertexAttrib2fv = 367; + glVertexAttrib3f = 368; + glVertexAttrib3fv = 369; + glVertexAttrib4f = 370; + glVertexAttrib4fv = 371; + glVertexAttribPointer = 372; + glVertexPointer = 373; + glViewport = 374; + glWeightPointerOES = 375; + + eglGetDisplay = 2000; + eglInitialize = 2001; + eglTerminate = 2002; + eglGetConfigs = 2003; + eglChooseConfig = 2004; + eglGetConfigAttrib = 2005; + eglCreateWindowSurface = 2006; + eglCreatePixmapSurface = 2007; + eglCreatePbufferSurface = 2008; + eglDestroySurface = 2009; + eglQuerySurface = 2010; + eglCreateContext = 2011; + eglDestroyContext = 2012; + eglMakeCurrent = 2013; + eglGetCurrentContext = 2014; + eglGetCurrentSurface = 2015; + eglGetCurrentDisplay = 2016; + eglQueryContext = 2017; + eglWaitGL = 2018; + eglWaitNative = 2019; + eglSwapBuffers = 2020; + eglCopyBuffers = 2021; + eglGetError = 2022; + eglQueryString = 2023; + eglGetProcAddress = 2024; + eglSurfaceAttrib = 2025; + eglBindTexImage = 2026; + eglReleaseTexImage = 2027; + eglSwapInterval = 2028; + eglBindAPI = 2029; + eglQueryAPI = 2030; + eglWaitClient = 2031; + eglReleaseThread = 2032; + eglCreatePbufferFromClientBuffer = 2033; + eglLockSurfaceKHR = 2034; + eglUnlockSurfaceKHR = 2035; + eglCreateImageKHR = 2036; + eglDestroyImageKHR = 2037; + eglCreateSyncKHR = 2038; + eglDestroySyncKHR = 2039; + eglClientWaitSyncKHR = 2040; + eglGetSyncAttribKHR = 2041; + eglSetSwapRectangleANDROID = 2042; + eglGetRenderBufferANDROID = 2043; + eglGetSystemTimeFrequencyNV = 2044; + eglGetSystemTimeNV = 2045; + + invalid = 3000; + frameBufferContents = 3001; + } + + // A GL call's return data and arguments are formatted into this DataType + message DataType { + enum Type { + VOID = 1; // GLvoid + CHAR = 2; // GLchar + BYTE = 3; // GLbyte, GLubyte + INT = 4; // GLbitfield, GLshort, GLint, GLsizei, GLushort, GLuint, GLfixed + FLOAT = 5; // GLfloat, GLclampf + BOOL = 6; // GLboolean + ENUM = 7; // GLenum + }; + + required Type type = 1 [default = VOID]; + required bool isArray = 2 [default = false]; + + repeated int32 intValue = 3; + repeated float floatValue = 4; + repeated bytes charValue = 5; + repeated bytes rawBytes = 6; + repeated bool boolValue = 7; + } + + message FrameBuffer { + required int32 width = 1; + required int32 height = 2; + repeated bytes contents = 3; + } + + required int32 context_id = 1; // GL context ID + required int64 start_time = 2; // time when call was invoked + required int32 duration = 3; // duration of the call + + required Function function = 4 [default = invalid]; // GL function called + repeated DataType args = 5; // GL function's arguments + optional DataType returnValue = 6; // GL function's return value + + optional FrameBuffer fb = 7; // contents of the framebuffer +}; diff --git a/opengl/libs/GLES_trace/src/gltrace.pb.cpp b/opengl/libs/GLES_trace/src/gltrace.pb.cpp new file mode 100644 index 0000000000..9a90603e01 --- /dev/null +++ b/opengl/libs/GLES_trace/src/gltrace.pb.cpp @@ -0,0 +1,1925 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! + +#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION +#include "gltrace.pb.h" +#include <google/protobuf/stubs/once.h> +#include <google/protobuf/io/coded_stream.h> +#include <google/protobuf/wire_format_lite_inl.h> +// @@protoc_insertion_point(includes) + +namespace android { +namespace gltrace { + +void protobuf_ShutdownFile_gltrace_2eproto() { + delete GLMessage::default_instance_; + delete GLMessage_DataType::default_instance_; + delete GLMessage_FrameBuffer::default_instance_; +} + +void protobuf_AddDesc_gltrace_2eproto() { + static bool already_here = false; + if (already_here) return; + already_here = true; + GOOGLE_PROTOBUF_VERIFY_VERSION; + + GLMessage::default_instance_ = new GLMessage(); + GLMessage_DataType::default_instance_ = new GLMessage_DataType(); + GLMessage_FrameBuffer::default_instance_ = new GLMessage_FrameBuffer(); + GLMessage::default_instance_->InitAsDefaultInstance(); + GLMessage_DataType::default_instance_->InitAsDefaultInstance(); + GLMessage_FrameBuffer::default_instance_->InitAsDefaultInstance(); + ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_gltrace_2eproto); +} + +// Force AddDescriptors() to be called at static initialization time. +struct StaticDescriptorInitializer_gltrace_2eproto { + StaticDescriptorInitializer_gltrace_2eproto() { + protobuf_AddDesc_gltrace_2eproto(); + } +} static_descriptor_initializer_gltrace_2eproto_; + + +// =================================================================== + +bool GLMessage_Function_IsValid(int value) { + switch(value) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 45: + case 46: + case 47: + case 48: + case 49: + case 50: + case 51: + case 52: + case 53: + case 54: + case 55: + case 56: + case 57: + case 58: + case 59: + case 60: + case 61: + case 62: + case 63: + case 64: + case 65: + case 66: + case 67: + case 68: + case 69: + case 70: + case 71: + case 72: + case 73: + case 74: + case 75: + case 76: + case 77: + case 78: + case 79: + case 80: + case 81: + case 82: + case 83: + case 84: + case 85: + case 86: + case 87: + case 88: + case 89: + case 90: + case 91: + case 92: + case 93: + case 94: + case 95: + case 96: + case 97: + case 98: + case 99: + case 100: + case 101: + case 102: + case 103: + case 104: + case 105: + case 106: + case 107: + case 108: + case 109: + case 110: + case 111: + case 112: + case 113: + case 114: + case 115: + case 116: + case 117: + case 118: + case 119: + case 120: + case 121: + case 122: + case 123: + case 124: + case 125: + case 126: + case 127: + case 128: + case 129: + case 130: + case 131: + case 132: + case 133: + case 134: + case 135: + case 136: + case 137: + case 138: + case 139: + case 140: + case 141: + case 142: + case 143: + case 144: + case 145: + case 146: + case 147: + case 148: + case 149: + case 150: + case 151: + case 152: + case 153: + case 154: + case 155: + case 156: + case 157: + case 158: + case 159: + case 160: + case 161: + case 162: + case 163: + case 164: + case 165: + case 166: + case 167: + case 168: + case 169: + case 170: + case 171: + case 172: + case 173: + case 174: + case 175: + case 176: + case 177: + case 178: + case 179: + case 180: + case 181: + case 182: + case 183: + case 184: + case 185: + case 186: + case 187: + case 188: + case 189: + case 190: + case 191: + case 192: + case 193: + case 194: + case 195: + case 196: + case 197: + case 198: + case 199: + case 200: + case 201: + case 202: + case 203: + case 204: + case 205: + case 206: + case 207: + case 208: + case 209: + case 210: + case 211: + case 212: + case 213: + case 214: + case 215: + case 216: + case 217: + case 218: + case 219: + case 220: + case 221: + case 222: + case 223: + case 224: + case 225: + case 226: + case 227: + case 228: + case 229: + case 230: + case 231: + case 232: + case 233: + case 234: + case 235: + case 236: + case 237: + case 238: + case 239: + case 240: + case 241: + case 242: + case 243: + case 244: + case 245: + case 246: + case 247: + case 248: + case 249: + case 250: + case 251: + case 252: + case 253: + case 254: + case 255: + case 256: + case 257: + case 258: + case 259: + case 260: + case 261: + case 262: + case 263: + case 264: + case 265: + case 266: + case 267: + case 268: + case 269: + case 270: + case 271: + case 272: + case 273: + case 274: + case 275: + case 276: + case 277: + case 278: + case 279: + case 280: + case 281: + case 282: + case 283: + case 284: + case 285: + case 286: + case 287: + case 288: + case 289: + case 290: + case 291: + case 292: + case 293: + case 294: + case 295: + case 296: + case 297: + case 298: + case 299: + case 300: + case 301: + case 302: + case 303: + case 304: + case 305: + case 306: + case 307: + case 308: + case 309: + case 310: + case 311: + case 312: + case 313: + case 314: + case 315: + case 316: + case 317: + case 318: + case 319: + case 320: + case 321: + case 322: + case 323: + case 324: + case 325: + case 326: + case 327: + case 328: + case 329: + case 330: + case 331: + case 332: + case 333: + case 334: + case 335: + case 336: + case 337: + case 338: + case 339: + case 340: + case 341: + case 342: + case 343: + case 344: + case 345: + case 346: + case 347: + case 348: + case 349: + case 350: + case 351: + case 352: + case 353: + case 354: + case 355: + case 356: + case 357: + case 358: + case 359: + case 360: + case 361: + case 362: + case 363: + case 364: + case 365: + case 366: + case 367: + case 368: + case 369: + case 370: + case 371: + case 372: + case 373: + case 374: + case 375: + case 2000: + case 2001: + case 2002: + case 2003: + case 2004: + case 2005: + case 2006: + case 2007: + case 2008: + case 2009: + case 2010: + case 2011: + case 2012: + case 2013: + case 2014: + case 2015: + case 2016: + case 2017: + case 2018: + case 2019: + case 2020: + case 2021: + case 2022: + case 2023: + case 2024: + case 2025: + case 2026: + case 2027: + case 2028: + case 2029: + case 2030: + case 2031: + case 2032: + case 2033: + case 2034: + case 2035: + case 2036: + case 2037: + case 2038: + case 2039: + case 2040: + case 2041: + case 2042: + case 2043: + case 2044: + case 2045: + case 3000: + case 3001: + return true; + default: + return false; + } +} + +#ifndef _MSC_VER +const GLMessage_Function GLMessage::glActiveTexture; +const GLMessage_Function GLMessage::glAlphaFunc; +const GLMessage_Function GLMessage::glAlphaFuncx; +const GLMessage_Function GLMessage::glAlphaFuncxOES; +const GLMessage_Function GLMessage::glAttachShader; +const GLMessage_Function GLMessage::glBeginPerfMonitorAMD; +const GLMessage_Function GLMessage::glBindAttribLocation; +const GLMessage_Function GLMessage::glBindBuffer; +const GLMessage_Function GLMessage::glBindFramebuffer; +const GLMessage_Function GLMessage::glBindFramebufferOES; +const GLMessage_Function GLMessage::glBindRenderbuffer; +const GLMessage_Function GLMessage::glBindRenderbufferOES; +const GLMessage_Function GLMessage::glBindTexture; +const GLMessage_Function GLMessage::glBindVertexArrayOES; +const GLMessage_Function GLMessage::glBlendColor; +const GLMessage_Function GLMessage::glBlendEquation; +const GLMessage_Function GLMessage::glBlendEquationOES; +const GLMessage_Function GLMessage::glBlendEquationSeparate; +const GLMessage_Function GLMessage::glBlendEquationSeparateOES; +const GLMessage_Function GLMessage::glBlendFunc; +const GLMessage_Function GLMessage::glBlendFuncSeparate; +const GLMessage_Function GLMessage::glBlendFuncSeparateOES; +const GLMessage_Function GLMessage::glBufferData; +const GLMessage_Function GLMessage::glBufferSubData; +const GLMessage_Function GLMessage::glCheckFramebufferStatus; +const GLMessage_Function GLMessage::glCheckFramebufferStatusOES; +const GLMessage_Function GLMessage::glClearColor; +const GLMessage_Function GLMessage::glClearColorx; +const GLMessage_Function GLMessage::glClearColorxOES; +const GLMessage_Function GLMessage::glClearDepthf; +const GLMessage_Function GLMessage::glClearDepthfOES; +const GLMessage_Function GLMessage::glClearDepthx; +const GLMessage_Function GLMessage::glClearDepthxOES; +const GLMessage_Function GLMessage::glClear; +const GLMessage_Function GLMessage::glClearStencil; +const GLMessage_Function GLMessage::glClientActiveTexture; +const GLMessage_Function GLMessage::glClipPlanef; +const GLMessage_Function GLMessage::glClipPlanefIMG; +const GLMessage_Function GLMessage::glClipPlanefOES; +const GLMessage_Function GLMessage::glClipPlanex; +const GLMessage_Function GLMessage::glClipPlanexIMG; +const GLMessage_Function GLMessage::glClipPlanexOES; +const GLMessage_Function GLMessage::glColor4f; +const GLMessage_Function GLMessage::glColor4ub; +const GLMessage_Function GLMessage::glColor4x; +const GLMessage_Function GLMessage::glColor4xOES; +const GLMessage_Function GLMessage::glColorMask; +const GLMessage_Function GLMessage::glColorPointer; +const GLMessage_Function GLMessage::glCompileShader; +const GLMessage_Function GLMessage::glCompressedTexImage2D; +const GLMessage_Function GLMessage::glCompressedTexImage3DOES; +const GLMessage_Function GLMessage::glCompressedTexSubImage2D; +const GLMessage_Function GLMessage::glCompressedTexSubImage3DOES; +const GLMessage_Function GLMessage::glCopyTexImage2D; +const GLMessage_Function GLMessage::glCopyTexSubImage2D; +const GLMessage_Function GLMessage::glCopyTexSubImage3DOES; +const GLMessage_Function GLMessage::glCoverageMaskNV; +const GLMessage_Function GLMessage::glCoverageOperationNV; +const GLMessage_Function GLMessage::glCreateProgram; +const GLMessage_Function GLMessage::glCreateShader; +const GLMessage_Function GLMessage::glCullFace; +const GLMessage_Function GLMessage::glCurrentPaletteMatrixOES; +const GLMessage_Function GLMessage::glDeleteBuffers; +const GLMessage_Function GLMessage::glDeleteFencesNV; +const GLMessage_Function GLMessage::glDeleteFramebuffers; +const GLMessage_Function GLMessage::glDeleteFramebuffersOES; +const GLMessage_Function GLMessage::glDeletePerfMonitorsAMD; +const GLMessage_Function GLMessage::glDeleteProgram; +const GLMessage_Function GLMessage::glDeleteRenderbuffers; +const GLMessage_Function GLMessage::glDeleteRenderbuffersOES; +const GLMessage_Function GLMessage::glDeleteShader; +const GLMessage_Function GLMessage::glDeleteTextures; +const GLMessage_Function GLMessage::glDeleteVertexArraysOES; +const GLMessage_Function GLMessage::glDepthFunc; +const GLMessage_Function GLMessage::glDepthMask; +const GLMessage_Function GLMessage::glDepthRangef; +const GLMessage_Function GLMessage::glDepthRangefOES; +const GLMessage_Function GLMessage::glDepthRangex; +const GLMessage_Function GLMessage::glDepthRangexOES; +const GLMessage_Function GLMessage::glDetachShader; +const GLMessage_Function GLMessage::glDisableClientState; +const GLMessage_Function GLMessage::glDisableDriverControlQCOM; +const GLMessage_Function GLMessage::glDisable; +const GLMessage_Function GLMessage::glDisableVertexAttribArray; +const GLMessage_Function GLMessage::glDiscardFramebufferEXT; +const GLMessage_Function GLMessage::glDrawArrays; +const GLMessage_Function GLMessage::glDrawElements; +const GLMessage_Function GLMessage::glDrawTexfOES; +const GLMessage_Function GLMessage::glDrawTexfvOES; +const GLMessage_Function GLMessage::glDrawTexiOES; +const GLMessage_Function GLMessage::glDrawTexivOES; +const GLMessage_Function GLMessage::glDrawTexsOES; +const GLMessage_Function GLMessage::glDrawTexsvOES; +const GLMessage_Function GLMessage::glDrawTexxOES; +const GLMessage_Function GLMessage::glDrawTexxvOES; +const GLMessage_Function GLMessage::glEGLImageTargetRenderbufferStorageOES; +const GLMessage_Function GLMessage::glEGLImageTargetTexture2DOES; +const GLMessage_Function GLMessage::glEnableClientState; +const GLMessage_Function GLMessage::glEnableDriverControlQCOM; +const GLMessage_Function GLMessage::glEnable; +const GLMessage_Function GLMessage::glEnableVertexAttribArray; +const GLMessage_Function GLMessage::glEndPerfMonitorAMD; +const GLMessage_Function GLMessage::glEndTilingQCOM; +const GLMessage_Function GLMessage::glExtGetBufferPointervQCOM; +const GLMessage_Function GLMessage::glExtGetBuffersQCOM; +const GLMessage_Function GLMessage::glExtGetFramebuffersQCOM; +const GLMessage_Function GLMessage::glExtGetProgramBinarySourceQCOM; +const GLMessage_Function GLMessage::glExtGetProgramsQCOM; +const GLMessage_Function GLMessage::glExtGetRenderbuffersQCOM; +const GLMessage_Function GLMessage::glExtGetShadersQCOM; +const GLMessage_Function GLMessage::glExtGetTexLevelParameterivQCOM; +const GLMessage_Function GLMessage::glExtGetTexSubImageQCOM; +const GLMessage_Function GLMessage::glExtGetTexturesQCOM; +const GLMessage_Function GLMessage::glExtIsProgramBinaryQCOM; +const GLMessage_Function GLMessage::glExtTexObjectStateOverrideiQCOM; +const GLMessage_Function GLMessage::glFinishFenceNV; +const GLMessage_Function GLMessage::glFinish; +const GLMessage_Function GLMessage::glFlush; +const GLMessage_Function GLMessage::glFogf; +const GLMessage_Function GLMessage::glFogfv; +const GLMessage_Function GLMessage::glFogx; +const GLMessage_Function GLMessage::glFogxOES; +const GLMessage_Function GLMessage::glFogxv; +const GLMessage_Function GLMessage::glFogxvOES; +const GLMessage_Function GLMessage::glFramebufferRenderbuffer; +const GLMessage_Function GLMessage::glFramebufferRenderbufferOES; +const GLMessage_Function GLMessage::glFramebufferTexture2D; +const GLMessage_Function GLMessage::glFramebufferTexture2DMultisampleIMG; +const GLMessage_Function GLMessage::glFramebufferTexture2DOES; +const GLMessage_Function GLMessage::glFramebufferTexture3DOES; +const GLMessage_Function GLMessage::glFrontFace; +const GLMessage_Function GLMessage::glFrustumf; +const GLMessage_Function GLMessage::glFrustumfOES; +const GLMessage_Function GLMessage::glFrustumx; +const GLMessage_Function GLMessage::glFrustumxOES; +const GLMessage_Function GLMessage::glGenBuffers; +const GLMessage_Function GLMessage::glGenerateMipmap; +const GLMessage_Function GLMessage::glGenerateMipmapOES; +const GLMessage_Function GLMessage::glGenFencesNV; +const GLMessage_Function GLMessage::glGenFramebuffers; +const GLMessage_Function GLMessage::glGenFramebuffersOES; +const GLMessage_Function GLMessage::glGenPerfMonitorsAMD; +const GLMessage_Function GLMessage::glGenRenderbuffers; +const GLMessage_Function GLMessage::glGenRenderbuffersOES; +const GLMessage_Function GLMessage::glGenTextures; +const GLMessage_Function GLMessage::glGenVertexArraysOES; +const GLMessage_Function GLMessage::glGetActiveAttrib; +const GLMessage_Function GLMessage::glGetActiveUniform; +const GLMessage_Function GLMessage::glGetAttachedShaders; +const GLMessage_Function GLMessage::glGetAttribLocation; +const GLMessage_Function GLMessage::glGetBooleanv; +const GLMessage_Function GLMessage::glGetBufferParameteriv; +const GLMessage_Function GLMessage::glGetBufferPointervOES; +const GLMessage_Function GLMessage::glGetClipPlanef; +const GLMessage_Function GLMessage::glGetClipPlanefOES; +const GLMessage_Function GLMessage::glGetClipPlanex; +const GLMessage_Function GLMessage::glGetClipPlanexOES; +const GLMessage_Function GLMessage::glGetDriverControlsQCOM; +const GLMessage_Function GLMessage::glGetDriverControlStringQCOM; +const GLMessage_Function GLMessage::glGetError; +const GLMessage_Function GLMessage::glGetFenceivNV; +const GLMessage_Function GLMessage::glGetFixedv; +const GLMessage_Function GLMessage::glGetFixedvOES; +const GLMessage_Function GLMessage::glGetFloatv; +const GLMessage_Function GLMessage::glGetFramebufferAttachmentParameteriv; +const GLMessage_Function GLMessage::glGetFramebufferAttachmentParameterivOES; +const GLMessage_Function GLMessage::glGetIntegerv; +const GLMessage_Function GLMessage::glGetLightfv; +const GLMessage_Function GLMessage::glGetLightxv; +const GLMessage_Function GLMessage::glGetLightxvOES; +const GLMessage_Function GLMessage::glGetMaterialfv; +const GLMessage_Function GLMessage::glGetMaterialxv; +const GLMessage_Function GLMessage::glGetMaterialxvOES; +const GLMessage_Function GLMessage::glGetPerfMonitorCounterDataAMD; +const GLMessage_Function GLMessage::glGetPerfMonitorCounterInfoAMD; +const GLMessage_Function GLMessage::glGetPerfMonitorCountersAMD; +const GLMessage_Function GLMessage::glGetPerfMonitorCounterStringAMD; +const GLMessage_Function GLMessage::glGetPerfMonitorGroupsAMD; +const GLMessage_Function GLMessage::glGetPerfMonitorGroupStringAMD; +const GLMessage_Function GLMessage::glGetPointerv; +const GLMessage_Function GLMessage::glGetProgramBinaryOES; +const GLMessage_Function GLMessage::glGetProgramInfoLog; +const GLMessage_Function GLMessage::glGetProgramiv; +const GLMessage_Function GLMessage::glGetRenderbufferParameteriv; +const GLMessage_Function GLMessage::glGetRenderbufferParameterivOES; +const GLMessage_Function GLMessage::glGetShaderInfoLog; +const GLMessage_Function GLMessage::glGetShaderiv; +const GLMessage_Function GLMessage::glGetShaderPrecisionFormat; +const GLMessage_Function GLMessage::glGetShaderSource; +const GLMessage_Function GLMessage::glGetString; +const GLMessage_Function GLMessage::glGetTexEnvfv; +const GLMessage_Function GLMessage::glGetTexEnviv; +const GLMessage_Function GLMessage::glGetTexEnvxv; +const GLMessage_Function GLMessage::glGetTexEnvxvOES; +const GLMessage_Function GLMessage::glGetTexGenfvOES; +const GLMessage_Function GLMessage::glGetTexGenivOES; +const GLMessage_Function GLMessage::glGetTexGenxvOES; +const GLMessage_Function GLMessage::glGetTexParameterfv; +const GLMessage_Function GLMessage::glGetTexParameteriv; +const GLMessage_Function GLMessage::glGetTexParameterxv; +const GLMessage_Function GLMessage::glGetTexParameterxvOES; +const GLMessage_Function GLMessage::glGetUniformfv; +const GLMessage_Function GLMessage::glGetUniformiv; +const GLMessage_Function GLMessage::glGetUniformLocation; +const GLMessage_Function GLMessage::glGetVertexAttribfv; +const GLMessage_Function GLMessage::glGetVertexAttribiv; +const GLMessage_Function GLMessage::glGetVertexAttribPointerv; +const GLMessage_Function GLMessage::glHint; +const GLMessage_Function GLMessage::glIsBuffer; +const GLMessage_Function GLMessage::glIsEnabled; +const GLMessage_Function GLMessage::glIsFenceNV; +const GLMessage_Function GLMessage::glIsFramebuffer; +const GLMessage_Function GLMessage::glIsFramebufferOES; +const GLMessage_Function GLMessage::glIsProgram; +const GLMessage_Function GLMessage::glIsRenderbuffer; +const GLMessage_Function GLMessage::glIsRenderbufferOES; +const GLMessage_Function GLMessage::glIsShader; +const GLMessage_Function GLMessage::glIsTexture; +const GLMessage_Function GLMessage::glIsVertexArrayOES; +const GLMessage_Function GLMessage::glLightf; +const GLMessage_Function GLMessage::glLightfv; +const GLMessage_Function GLMessage::glLightModelf; +const GLMessage_Function GLMessage::glLightModelfv; +const GLMessage_Function GLMessage::glLightModelx; +const GLMessage_Function GLMessage::glLightModelxOES; +const GLMessage_Function GLMessage::glLightModelxv; +const GLMessage_Function GLMessage::glLightModelxvOES; +const GLMessage_Function GLMessage::glLightx; +const GLMessage_Function GLMessage::glLightxOES; +const GLMessage_Function GLMessage::glLightxv; +const GLMessage_Function GLMessage::glLightxvOES; +const GLMessage_Function GLMessage::glLineWidth; +const GLMessage_Function GLMessage::glLineWidthx; +const GLMessage_Function GLMessage::glLineWidthxOES; +const GLMessage_Function GLMessage::glLinkProgram; +const GLMessage_Function GLMessage::glLoadIdentity; +const GLMessage_Function GLMessage::glLoadMatrixf; +const GLMessage_Function GLMessage::glLoadMatrixx; +const GLMessage_Function GLMessage::glLoadMatrixxOES; +const GLMessage_Function GLMessage::glLoadPaletteFromModelViewMatrixOES; +const GLMessage_Function GLMessage::glLogicOp; +const GLMessage_Function GLMessage::glMapBufferOES; +const GLMessage_Function GLMessage::glMaterialf; +const GLMessage_Function GLMessage::glMaterialfv; +const GLMessage_Function GLMessage::glMaterialx; +const GLMessage_Function GLMessage::glMaterialxOES; +const GLMessage_Function GLMessage::glMaterialxv; +const GLMessage_Function GLMessage::glMaterialxvOES; +const GLMessage_Function GLMessage::glMatrixIndexPointerOES; +const GLMessage_Function GLMessage::glMatrixMode; +const GLMessage_Function GLMessage::glMultiDrawArraysEXT; +const GLMessage_Function GLMessage::glMultiDrawElementsEXT; +const GLMessage_Function GLMessage::glMultiTexCoord4f; +const GLMessage_Function GLMessage::glMultiTexCoord4x; +const GLMessage_Function GLMessage::glMultiTexCoord4xOES; +const GLMessage_Function GLMessage::glMultMatrixf; +const GLMessage_Function GLMessage::glMultMatrixx; +const GLMessage_Function GLMessage::glMultMatrixxOES; +const GLMessage_Function GLMessage::glNormal3f; +const GLMessage_Function GLMessage::glNormal3x; +const GLMessage_Function GLMessage::glNormal3xOES; +const GLMessage_Function GLMessage::glNormalPointer; +const GLMessage_Function GLMessage::glOrthof; +const GLMessage_Function GLMessage::glOrthofOES; +const GLMessage_Function GLMessage::glOrthox; +const GLMessage_Function GLMessage::glOrthoxOES; +const GLMessage_Function GLMessage::glPixelStorei; +const GLMessage_Function GLMessage::glPointParameterf; +const GLMessage_Function GLMessage::glPointParameterfv; +const GLMessage_Function GLMessage::glPointParameterx; +const GLMessage_Function GLMessage::glPointParameterxOES; +const GLMessage_Function GLMessage::glPointParameterxv; +const GLMessage_Function GLMessage::glPointParameterxvOES; +const GLMessage_Function GLMessage::glPointSize; +const GLMessage_Function GLMessage::glPointSizePointerOES; +const GLMessage_Function GLMessage::glPointSizex; +const GLMessage_Function GLMessage::glPointSizexOES; +const GLMessage_Function GLMessage::glPolygonOffset; +const GLMessage_Function GLMessage::glPolygonOffsetx; +const GLMessage_Function GLMessage::glPolygonOffsetxOES; +const GLMessage_Function GLMessage::glPopMatrix; +const GLMessage_Function GLMessage::glProgramBinaryOES; +const GLMessage_Function GLMessage::glPushMatrix; +const GLMessage_Function GLMessage::glQueryMatrixxOES; +const GLMessage_Function GLMessage::glReadPixels; +const GLMessage_Function GLMessage::glReleaseShaderCompiler; +const GLMessage_Function GLMessage::glRenderbufferStorage; +const GLMessage_Function GLMessage::glRenderbufferStorageMultisampleIMG; +const GLMessage_Function GLMessage::glRenderbufferStorageOES; +const GLMessage_Function GLMessage::glRotatef; +const GLMessage_Function GLMessage::glRotatex; +const GLMessage_Function GLMessage::glRotatexOES; +const GLMessage_Function GLMessage::glSampleCoverage; +const GLMessage_Function GLMessage::glSampleCoveragex; +const GLMessage_Function GLMessage::glSampleCoveragexOES; +const GLMessage_Function GLMessage::glScalef; +const GLMessage_Function GLMessage::glScalex; +const GLMessage_Function GLMessage::glScalexOES; +const GLMessage_Function GLMessage::glScissor; +const GLMessage_Function GLMessage::glSelectPerfMonitorCountersAMD; +const GLMessage_Function GLMessage::glSetFenceNV; +const GLMessage_Function GLMessage::glShadeModel; +const GLMessage_Function GLMessage::glShaderBinary; +const GLMessage_Function GLMessage::glShaderSource; +const GLMessage_Function GLMessage::glStartTilingQCOM; +const GLMessage_Function GLMessage::glStencilFunc; +const GLMessage_Function GLMessage::glStencilFuncSeparate; +const GLMessage_Function GLMessage::glStencilMask; +const GLMessage_Function GLMessage::glStencilMaskSeparate; +const GLMessage_Function GLMessage::glStencilOp; +const GLMessage_Function GLMessage::glStencilOpSeparate; +const GLMessage_Function GLMessage::glTestFenceNV; +const GLMessage_Function GLMessage::glTexCoordPointer; +const GLMessage_Function GLMessage::glTexEnvf; +const GLMessage_Function GLMessage::glTexEnvfv; +const GLMessage_Function GLMessage::glTexEnvi; +const GLMessage_Function GLMessage::glTexEnviv; +const GLMessage_Function GLMessage::glTexEnvx; +const GLMessage_Function GLMessage::glTexEnvxOES; +const GLMessage_Function GLMessage::glTexEnvxv; +const GLMessage_Function GLMessage::glTexEnvxvOES; +const GLMessage_Function GLMessage::glTexGenfOES; +const GLMessage_Function GLMessage::glTexGenfvOES; +const GLMessage_Function GLMessage::glTexGeniOES; +const GLMessage_Function GLMessage::glTexGenivOES; +const GLMessage_Function GLMessage::glTexGenxOES; +const GLMessage_Function GLMessage::glTexGenxvOES; +const GLMessage_Function GLMessage::glTexImage2D; +const GLMessage_Function GLMessage::glTexImage3DOES; +const GLMessage_Function GLMessage::glTexParameterf; +const GLMessage_Function GLMessage::glTexParameterfv; +const GLMessage_Function GLMessage::glTexParameteri; +const GLMessage_Function GLMessage::glTexParameteriv; +const GLMessage_Function GLMessage::glTexParameterx; +const GLMessage_Function GLMessage::glTexParameterxOES; +const GLMessage_Function GLMessage::glTexParameterxv; +const GLMessage_Function GLMessage::glTexParameterxvOES; +const GLMessage_Function GLMessage::glTexSubImage2D; +const GLMessage_Function GLMessage::glTexSubImage3DOES; +const GLMessage_Function GLMessage::glTranslatef; +const GLMessage_Function GLMessage::glTranslatex; +const GLMessage_Function GLMessage::glTranslatexOES; +const GLMessage_Function GLMessage::glUniform1f; +const GLMessage_Function GLMessage::glUniform1fv; +const GLMessage_Function GLMessage::glUniform1i; +const GLMessage_Function GLMessage::glUniform1iv; +const GLMessage_Function GLMessage::glUniform2f; +const GLMessage_Function GLMessage::glUniform2fv; +const GLMessage_Function GLMessage::glUniform2i; +const GLMessage_Function GLMessage::glUniform2iv; +const GLMessage_Function GLMessage::glUniform3f; +const GLMessage_Function GLMessage::glUniform3fv; +const GLMessage_Function GLMessage::glUniform3i; +const GLMessage_Function GLMessage::glUniform3iv; +const GLMessage_Function GLMessage::glUniform4f; +const GLMessage_Function GLMessage::glUniform4fv; +const GLMessage_Function GLMessage::glUniform4i; +const GLMessage_Function GLMessage::glUniform4iv; +const GLMessage_Function GLMessage::glUniformMatrix2fv; +const GLMessage_Function GLMessage::glUniformMatrix3fv; +const GLMessage_Function GLMessage::glUniformMatrix4fv; +const GLMessage_Function GLMessage::glUnmapBufferOES; +const GLMessage_Function GLMessage::glUseProgram; +const GLMessage_Function GLMessage::glValidateProgram; +const GLMessage_Function GLMessage::glVertexAttrib1f; +const GLMessage_Function GLMessage::glVertexAttrib1fv; +const GLMessage_Function GLMessage::glVertexAttrib2f; +const GLMessage_Function GLMessage::glVertexAttrib2fv; +const GLMessage_Function GLMessage::glVertexAttrib3f; +const GLMessage_Function GLMessage::glVertexAttrib3fv; +const GLMessage_Function GLMessage::glVertexAttrib4f; +const GLMessage_Function GLMessage::glVertexAttrib4fv; +const GLMessage_Function GLMessage::glVertexAttribPointer; +const GLMessage_Function GLMessage::glVertexPointer; +const GLMessage_Function GLMessage::glViewport; +const GLMessage_Function GLMessage::glWeightPointerOES; +const GLMessage_Function GLMessage::eglGetDisplay; +const GLMessage_Function GLMessage::eglInitialize; +const GLMessage_Function GLMessage::eglTerminate; +const GLMessage_Function GLMessage::eglGetConfigs; +const GLMessage_Function GLMessage::eglChooseConfig; +const GLMessage_Function GLMessage::eglGetConfigAttrib; +const GLMessage_Function GLMessage::eglCreateWindowSurface; +const GLMessage_Function GLMessage::eglCreatePixmapSurface; +const GLMessage_Function GLMessage::eglCreatePbufferSurface; +const GLMessage_Function GLMessage::eglDestroySurface; +const GLMessage_Function GLMessage::eglQuerySurface; +const GLMessage_Function GLMessage::eglCreateContext; +const GLMessage_Function GLMessage::eglDestroyContext; +const GLMessage_Function GLMessage::eglMakeCurrent; +const GLMessage_Function GLMessage::eglGetCurrentContext; +const GLMessage_Function GLMessage::eglGetCurrentSurface; +const GLMessage_Function GLMessage::eglGetCurrentDisplay; +const GLMessage_Function GLMessage::eglQueryContext; +const GLMessage_Function GLMessage::eglWaitGL; +const GLMessage_Function GLMessage::eglWaitNative; +const GLMessage_Function GLMessage::eglSwapBuffers; +const GLMessage_Function GLMessage::eglCopyBuffers; +const GLMessage_Function GLMessage::eglGetError; +const GLMessage_Function GLMessage::eglQueryString; +const GLMessage_Function GLMessage::eglGetProcAddress; +const GLMessage_Function GLMessage::eglSurfaceAttrib; +const GLMessage_Function GLMessage::eglBindTexImage; +const GLMessage_Function GLMessage::eglReleaseTexImage; +const GLMessage_Function GLMessage::eglSwapInterval; +const GLMessage_Function GLMessage::eglBindAPI; +const GLMessage_Function GLMessage::eglQueryAPI; +const GLMessage_Function GLMessage::eglWaitClient; +const GLMessage_Function GLMessage::eglReleaseThread; +const GLMessage_Function GLMessage::eglCreatePbufferFromClientBuffer; +const GLMessage_Function GLMessage::eglLockSurfaceKHR; +const GLMessage_Function GLMessage::eglUnlockSurfaceKHR; +const GLMessage_Function GLMessage::eglCreateImageKHR; +const GLMessage_Function GLMessage::eglDestroyImageKHR; +const GLMessage_Function GLMessage::eglCreateSyncKHR; +const GLMessage_Function GLMessage::eglDestroySyncKHR; +const GLMessage_Function GLMessage::eglClientWaitSyncKHR; +const GLMessage_Function GLMessage::eglGetSyncAttribKHR; +const GLMessage_Function GLMessage::eglSetSwapRectangleANDROID; +const GLMessage_Function GLMessage::eglGetRenderBufferANDROID; +const GLMessage_Function GLMessage::eglGetSystemTimeFrequencyNV; +const GLMessage_Function GLMessage::eglGetSystemTimeNV; +const GLMessage_Function GLMessage::invalid; +const GLMessage_Function GLMessage::frameBufferContents; +const GLMessage_Function GLMessage::Function_MIN; +const GLMessage_Function GLMessage::Function_MAX; +const int GLMessage::Function_ARRAYSIZE; +#endif // _MSC_VER +bool GLMessage_DataType_Type_IsValid(int value) { + switch(value) { + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + return true; + default: + return false; + } +} + +#ifndef _MSC_VER +const GLMessage_DataType_Type GLMessage_DataType::VOID; +const GLMessage_DataType_Type GLMessage_DataType::CHAR; +const GLMessage_DataType_Type GLMessage_DataType::BYTE; +const GLMessage_DataType_Type GLMessage_DataType::INT; +const GLMessage_DataType_Type GLMessage_DataType::FLOAT; +const GLMessage_DataType_Type GLMessage_DataType::BOOL; +const GLMessage_DataType_Type GLMessage_DataType::ENUM; +const GLMessage_DataType_Type GLMessage_DataType::Type_MIN; +const GLMessage_DataType_Type GLMessage_DataType::Type_MAX; +const int GLMessage_DataType::Type_ARRAYSIZE; +#endif // _MSC_VER +#ifndef _MSC_VER +const int GLMessage_DataType::kTypeFieldNumber; +const int GLMessage_DataType::kIsArrayFieldNumber; +const int GLMessage_DataType::kIntValueFieldNumber; +const int GLMessage_DataType::kFloatValueFieldNumber; +const int GLMessage_DataType::kCharValueFieldNumber; +const int GLMessage_DataType::kRawBytesFieldNumber; +const int GLMessage_DataType::kBoolValueFieldNumber; +#endif // !_MSC_VER + +GLMessage_DataType::GLMessage_DataType() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void GLMessage_DataType::InitAsDefaultInstance() { +} + +GLMessage_DataType::GLMessage_DataType(const GLMessage_DataType& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void GLMessage_DataType::SharedCtor() { + _cached_size_ = 0; + type_ = 1; + isarray_ = false; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +GLMessage_DataType::~GLMessage_DataType() { + SharedDtor(); +} + +void GLMessage_DataType::SharedDtor() { + if (this != default_instance_) { + } +} + +void GLMessage_DataType::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const GLMessage_DataType& GLMessage_DataType::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_gltrace_2eproto(); return *default_instance_; +} + +GLMessage_DataType* GLMessage_DataType::default_instance_ = NULL; + +GLMessage_DataType* GLMessage_DataType::New() const { + return new GLMessage_DataType; +} + +void GLMessage_DataType::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + type_ = 1; + isarray_ = false; + } + intvalue_.Clear(); + floatvalue_.Clear(); + charvalue_.Clear(); + rawbytes_.Clear(); + boolvalue_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool GLMessage_DataType::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // required .android.gltrace.GLMessage.DataType.Type type = 1 [default = VOID]; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + int value; + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( + input, &value))); + if (::android::gltrace::GLMessage_DataType_Type_IsValid(value)) { + set_type(static_cast< ::android::gltrace::GLMessage_DataType_Type >(value)); + } + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(16)) goto parse_isArray; + break; + } + + // required bool isArray = 2 [default = false]; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_isArray: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &isarray_))); + _set_bit(1); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(24)) goto parse_intValue; + break; + } + + // repeated int32 intValue = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_intValue: + DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + 1, 24, input, this->mutable_intvalue()))); + } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) + == ::google::protobuf::internal::WireFormatLite:: + WIRETYPE_LENGTH_DELIMITED) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, this->mutable_intvalue()))); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(24)) goto parse_intValue; + if (input->ExpectTag(37)) goto parse_floatValue; + break; + } + + // repeated float floatValue = 4; + case 4: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED32) { + parse_floatValue: + DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive< + float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>( + 1, 37, input, this->mutable_floatvalue()))); + } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) + == ::google::protobuf::internal::WireFormatLite:: + WIRETYPE_LENGTH_DELIMITED) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline< + float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>( + input, this->mutable_floatvalue()))); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(37)) goto parse_floatValue; + if (input->ExpectTag(42)) goto parse_charValue; + break; + } + + // repeated bytes charValue = 5; + case 5: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_charValue: + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->add_charvalue())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(42)) goto parse_charValue; + if (input->ExpectTag(50)) goto parse_rawBytes; + break; + } + + // repeated bytes rawBytes = 6; + case 6: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_rawBytes: + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->add_rawbytes())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(50)) goto parse_rawBytes; + if (input->ExpectTag(56)) goto parse_boolValue; + break; + } + + // repeated bool boolValue = 7; + case 7: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_boolValue: + DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + 1, 56, input, this->mutable_boolvalue()))); + } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) + == ::google::protobuf::internal::WireFormatLite:: + WIRETYPE_LENGTH_DELIMITED) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, this->mutable_boolvalue()))); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(56)) goto parse_boolValue; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void GLMessage_DataType::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // required .android.gltrace.GLMessage.DataType.Type type = 1 [default = VOID]; + if (_has_bit(0)) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 1, this->type(), output); + } + + // required bool isArray = 2 [default = false]; + if (_has_bit(1)) { + ::google::protobuf::internal::WireFormatLite::WriteBool(2, this->isarray(), output); + } + + // repeated int32 intValue = 3; + for (int i = 0; i < this->intvalue_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteInt32( + 3, this->intvalue(i), output); + } + + // repeated float floatValue = 4; + for (int i = 0; i < this->floatvalue_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteFloat( + 4, this->floatvalue(i), output); + } + + // repeated bytes charValue = 5; + for (int i = 0; i < this->charvalue_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 5, this->charvalue(i), output); + } + + // repeated bytes rawBytes = 6; + for (int i = 0; i < this->rawbytes_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 6, this->rawbytes(i), output); + } + + // repeated bool boolValue = 7; + for (int i = 0; i < this->boolvalue_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteBool( + 7, this->boolvalue(i), output); + } + +} + +int GLMessage_DataType::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // required .android.gltrace.GLMessage.DataType.Type type = 1 [default = VOID]; + if (has_type()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize(this->type()); + } + + // required bool isArray = 2 [default = false]; + if (has_isarray()) { + total_size += 1 + 1; + } + + } + // repeated int32 intValue = 3; + { + int data_size = 0; + for (int i = 0; i < this->intvalue_size(); i++) { + data_size += ::google::protobuf::internal::WireFormatLite:: + Int32Size(this->intvalue(i)); + } + total_size += 1 * this->intvalue_size() + data_size; + } + + // repeated float floatValue = 4; + { + int data_size = 0; + data_size = 4 * this->floatvalue_size(); + total_size += 1 * this->floatvalue_size() + data_size; + } + + // repeated bytes charValue = 5; + total_size += 1 * this->charvalue_size(); + for (int i = 0; i < this->charvalue_size(); i++) { + total_size += ::google::protobuf::internal::WireFormatLite::BytesSize( + this->charvalue(i)); + } + + // repeated bytes rawBytes = 6; + total_size += 1 * this->rawbytes_size(); + for (int i = 0; i < this->rawbytes_size(); i++) { + total_size += ::google::protobuf::internal::WireFormatLite::BytesSize( + this->rawbytes(i)); + } + + // repeated bool boolValue = 7; + { + int data_size = 0; + data_size = 1 * this->boolvalue_size(); + total_size += 1 * this->boolvalue_size() + data_size; + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void GLMessage_DataType::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast<const GLMessage_DataType*>(&from)); +} + +void GLMessage_DataType::MergeFrom(const GLMessage_DataType& from) { + GOOGLE_CHECK_NE(&from, this); + intvalue_.MergeFrom(from.intvalue_); + floatvalue_.MergeFrom(from.floatvalue_); + charvalue_.MergeFrom(from.charvalue_); + rawbytes_.MergeFrom(from.rawbytes_); + boolvalue_.MergeFrom(from.boolvalue_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from._has_bit(0)) { + set_type(from.type()); + } + if (from._has_bit(1)) { + set_isarray(from.isarray()); + } + } +} + +void GLMessage_DataType::CopyFrom(const GLMessage_DataType& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool GLMessage_DataType::IsInitialized() const { + if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false; + + return true; +} + +void GLMessage_DataType::Swap(GLMessage_DataType* other) { + if (other != this) { + std::swap(type_, other->type_); + std::swap(isarray_, other->isarray_); + intvalue_.Swap(&other->intvalue_); + floatvalue_.Swap(&other->floatvalue_); + charvalue_.Swap(&other->charvalue_); + rawbytes_.Swap(&other->rawbytes_); + boolvalue_.Swap(&other->boolvalue_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string GLMessage_DataType::GetTypeName() const { + return "android.gltrace.GLMessage.DataType"; +} + + +// ------------------------------------------------------------------- + +#ifndef _MSC_VER +const int GLMessage_FrameBuffer::kWidthFieldNumber; +const int GLMessage_FrameBuffer::kHeightFieldNumber; +const int GLMessage_FrameBuffer::kContentsFieldNumber; +#endif // !_MSC_VER + +GLMessage_FrameBuffer::GLMessage_FrameBuffer() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void GLMessage_FrameBuffer::InitAsDefaultInstance() { +} + +GLMessage_FrameBuffer::GLMessage_FrameBuffer(const GLMessage_FrameBuffer& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void GLMessage_FrameBuffer::SharedCtor() { + _cached_size_ = 0; + width_ = 0; + height_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +GLMessage_FrameBuffer::~GLMessage_FrameBuffer() { + SharedDtor(); +} + +void GLMessage_FrameBuffer::SharedDtor() { + if (this != default_instance_) { + } +} + +void GLMessage_FrameBuffer::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const GLMessage_FrameBuffer& GLMessage_FrameBuffer::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_gltrace_2eproto(); return *default_instance_; +} + +GLMessage_FrameBuffer* GLMessage_FrameBuffer::default_instance_ = NULL; + +GLMessage_FrameBuffer* GLMessage_FrameBuffer::New() const { + return new GLMessage_FrameBuffer; +} + +void GLMessage_FrameBuffer::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + width_ = 0; + height_ = 0; + } + contents_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool GLMessage_FrameBuffer::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // required int32 width = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &width_))); + _set_bit(0); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(16)) goto parse_height; + break; + } + + // required int32 height = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_height: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &height_))); + _set_bit(1); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(26)) goto parse_contents; + break; + } + + // repeated bytes contents = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_contents: + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->add_contents())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(26)) goto parse_contents; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void GLMessage_FrameBuffer::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // required int32 width = 1; + if (_has_bit(0)) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->width(), output); + } + + // required int32 height = 2; + if (_has_bit(1)) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->height(), output); + } + + // repeated bytes contents = 3; + for (int i = 0; i < this->contents_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 3, this->contents(i), output); + } + +} + +int GLMessage_FrameBuffer::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // required int32 width = 1; + if (has_width()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->width()); + } + + // required int32 height = 2; + if (has_height()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->height()); + } + + } + // repeated bytes contents = 3; + total_size += 1 * this->contents_size(); + for (int i = 0; i < this->contents_size(); i++) { + total_size += ::google::protobuf::internal::WireFormatLite::BytesSize( + this->contents(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void GLMessage_FrameBuffer::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast<const GLMessage_FrameBuffer*>(&from)); +} + +void GLMessage_FrameBuffer::MergeFrom(const GLMessage_FrameBuffer& from) { + GOOGLE_CHECK_NE(&from, this); + contents_.MergeFrom(from.contents_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from._has_bit(0)) { + set_width(from.width()); + } + if (from._has_bit(1)) { + set_height(from.height()); + } + } +} + +void GLMessage_FrameBuffer::CopyFrom(const GLMessage_FrameBuffer& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool GLMessage_FrameBuffer::IsInitialized() const { + if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false; + + return true; +} + +void GLMessage_FrameBuffer::Swap(GLMessage_FrameBuffer* other) { + if (other != this) { + std::swap(width_, other->width_); + std::swap(height_, other->height_); + contents_.Swap(&other->contents_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string GLMessage_FrameBuffer::GetTypeName() const { + return "android.gltrace.GLMessage.FrameBuffer"; +} + + +// ------------------------------------------------------------------- + +#ifndef _MSC_VER +const int GLMessage::kContextIdFieldNumber; +const int GLMessage::kStartTimeFieldNumber; +const int GLMessage::kDurationFieldNumber; +const int GLMessage::kFunctionFieldNumber; +const int GLMessage::kArgsFieldNumber; +const int GLMessage::kReturnValueFieldNumber; +const int GLMessage::kFbFieldNumber; +#endif // !_MSC_VER + +GLMessage::GLMessage() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void GLMessage::InitAsDefaultInstance() { + returnvalue_ = const_cast< ::android::gltrace::GLMessage_DataType*>(&::android::gltrace::GLMessage_DataType::default_instance()); + fb_ = const_cast< ::android::gltrace::GLMessage_FrameBuffer*>(&::android::gltrace::GLMessage_FrameBuffer::default_instance()); +} + +GLMessage::GLMessage(const GLMessage& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void GLMessage::SharedCtor() { + _cached_size_ = 0; + context_id_ = 0; + start_time_ = GOOGLE_LONGLONG(0); + duration_ = 0; + function_ = 3000; + returnvalue_ = NULL; + fb_ = NULL; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +GLMessage::~GLMessage() { + SharedDtor(); +} + +void GLMessage::SharedDtor() { + if (this != default_instance_) { + delete returnvalue_; + delete fb_; + } +} + +void GLMessage::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const GLMessage& GLMessage::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_gltrace_2eproto(); return *default_instance_; +} + +GLMessage* GLMessage::default_instance_ = NULL; + +GLMessage* GLMessage::New() const { + return new GLMessage; +} + +void GLMessage::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + context_id_ = 0; + start_time_ = GOOGLE_LONGLONG(0); + duration_ = 0; + function_ = 3000; + if (_has_bit(5)) { + if (returnvalue_ != NULL) returnvalue_->::android::gltrace::GLMessage_DataType::Clear(); + } + if (_has_bit(6)) { + if (fb_ != NULL) fb_->::android::gltrace::GLMessage_FrameBuffer::Clear(); + } + } + args_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool GLMessage::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // required int32 context_id = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &context_id_))); + _set_bit(0); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(16)) goto parse_start_time; + break; + } + + // required int64 start_time = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_start_time: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( + input, &start_time_))); + _set_bit(1); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(24)) goto parse_duration; + break; + } + + // required int32 duration = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_duration: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &duration_))); + _set_bit(2); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(32)) goto parse_function; + break; + } + + // required .android.gltrace.GLMessage.Function function = 4 [default = invalid]; + case 4: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_function: + int value; + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( + input, &value))); + if (::android::gltrace::GLMessage_Function_IsValid(value)) { + set_function(static_cast< ::android::gltrace::GLMessage_Function >(value)); + } + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(42)) goto parse_args; + break; + } + + // repeated .android.gltrace.GLMessage.DataType args = 5; + case 5: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_args: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_args())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(42)) goto parse_args; + if (input->ExpectTag(50)) goto parse_returnValue; + break; + } + + // optional .android.gltrace.GLMessage.DataType returnValue = 6; + case 6: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_returnValue: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_returnvalue())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(58)) goto parse_fb; + break; + } + + // optional .android.gltrace.GLMessage.FrameBuffer fb = 7; + case 7: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_fb: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_fb())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void GLMessage::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // required int32 context_id = 1; + if (_has_bit(0)) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->context_id(), output); + } + + // required int64 start_time = 2; + if (_has_bit(1)) { + ::google::protobuf::internal::WireFormatLite::WriteInt64(2, this->start_time(), output); + } + + // required int32 duration = 3; + if (_has_bit(2)) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->duration(), output); + } + + // required .android.gltrace.GLMessage.Function function = 4 [default = invalid]; + if (_has_bit(3)) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 4, this->function(), output); + } + + // repeated .android.gltrace.GLMessage.DataType args = 5; + for (int i = 0; i < this->args_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 5, this->args(i), output); + } + + // optional .android.gltrace.GLMessage.DataType returnValue = 6; + if (_has_bit(5)) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 6, this->returnvalue(), output); + } + + // optional .android.gltrace.GLMessage.FrameBuffer fb = 7; + if (_has_bit(6)) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 7, this->fb(), output); + } + +} + +int GLMessage::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // required int32 context_id = 1; + if (has_context_id()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->context_id()); + } + + // required int64 start_time = 2; + if (has_start_time()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->start_time()); + } + + // required int32 duration = 3; + if (has_duration()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->duration()); + } + + // required .android.gltrace.GLMessage.Function function = 4 [default = invalid]; + if (has_function()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize(this->function()); + } + + // optional .android.gltrace.GLMessage.DataType returnValue = 6; + if (has_returnvalue()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->returnvalue()); + } + + // optional .android.gltrace.GLMessage.FrameBuffer fb = 7; + if (has_fb()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->fb()); + } + + } + // repeated .android.gltrace.GLMessage.DataType args = 5; + total_size += 1 * this->args_size(); + for (int i = 0; i < this->args_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->args(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void GLMessage::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast<const GLMessage*>(&from)); +} + +void GLMessage::MergeFrom(const GLMessage& from) { + GOOGLE_CHECK_NE(&from, this); + args_.MergeFrom(from.args_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from._has_bit(0)) { + set_context_id(from.context_id()); + } + if (from._has_bit(1)) { + set_start_time(from.start_time()); + } + if (from._has_bit(2)) { + set_duration(from.duration()); + } + if (from._has_bit(3)) { + set_function(from.function()); + } + if (from._has_bit(5)) { + mutable_returnvalue()->::android::gltrace::GLMessage_DataType::MergeFrom(from.returnvalue()); + } + if (from._has_bit(6)) { + mutable_fb()->::android::gltrace::GLMessage_FrameBuffer::MergeFrom(from.fb()); + } + } +} + +void GLMessage::CopyFrom(const GLMessage& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool GLMessage::IsInitialized() const { + if ((_has_bits_[0] & 0x0000000f) != 0x0000000f) return false; + + for (int i = 0; i < args_size(); i++) { + if (!this->args(i).IsInitialized()) return false; + } + if (has_returnvalue()) { + if (!this->returnvalue().IsInitialized()) return false; + } + if (has_fb()) { + if (!this->fb().IsInitialized()) return false; + } + return true; +} + +void GLMessage::Swap(GLMessage* other) { + if (other != this) { + std::swap(context_id_, other->context_id_); + std::swap(start_time_, other->start_time_); + std::swap(duration_, other->duration_); + std::swap(function_, other->function_); + args_.Swap(&other->args_); + std::swap(returnvalue_, other->returnvalue_); + std::swap(fb_, other->fb_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string GLMessage::GetTypeName() const { + return "android.gltrace.GLMessage"; +} + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace gltrace +} // namespace android + +// @@protoc_insertion_point(global_scope) diff --git a/opengl/libs/GLES_trace/src/gltrace.pb.h b/opengl/libs/GLES_trace/src/gltrace.pb.h new file mode 100644 index 0000000000..5a7a16f148 --- /dev/null +++ b/opengl/libs/GLES_trace/src/gltrace.pb.h @@ -0,0 +1,1749 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: gltrace.proto + +#ifndef PROTOBUF_gltrace_2eproto__INCLUDED +#define PROTOBUF_gltrace_2eproto__INCLUDED + +#include <string> + +#include <google/protobuf/stubs/common.h> + +#if GOOGLE_PROTOBUF_VERSION < 2003000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 2003000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include <google/protobuf/generated_message_util.h> +#include <google/protobuf/repeated_field.h> +#include <google/protobuf/extension_set.h> +// @@protoc_insertion_point(includes) + +namespace android { +namespace gltrace { + +// Internal implementation detail -- do not call these. +void protobuf_AddDesc_gltrace_2eproto(); +void protobuf_AssignDesc_gltrace_2eproto(); +void protobuf_ShutdownFile_gltrace_2eproto(); + +class GLMessage; +class GLMessage_DataType; +class GLMessage_FrameBuffer; + +enum GLMessage_DataType_Type { + GLMessage_DataType_Type_VOID = 1, + GLMessage_DataType_Type_CHAR = 2, + GLMessage_DataType_Type_BYTE = 3, + GLMessage_DataType_Type_INT = 4, + GLMessage_DataType_Type_FLOAT = 5, + GLMessage_DataType_Type_BOOL = 6, + GLMessage_DataType_Type_ENUM = 7 +}; +bool GLMessage_DataType_Type_IsValid(int value); +const GLMessage_DataType_Type GLMessage_DataType_Type_Type_MIN = GLMessage_DataType_Type_VOID; +const GLMessage_DataType_Type GLMessage_DataType_Type_Type_MAX = GLMessage_DataType_Type_ENUM; +const int GLMessage_DataType_Type_Type_ARRAYSIZE = GLMessage_DataType_Type_Type_MAX + 1; + +enum GLMessage_Function { + GLMessage_Function_glActiveTexture = 0, + GLMessage_Function_glAlphaFunc = 1, + GLMessage_Function_glAlphaFuncx = 2, + GLMessage_Function_glAlphaFuncxOES = 3, + GLMessage_Function_glAttachShader = 4, + GLMessage_Function_glBeginPerfMonitorAMD = 5, + GLMessage_Function_glBindAttribLocation = 6, + GLMessage_Function_glBindBuffer = 7, + GLMessage_Function_glBindFramebuffer = 8, + GLMessage_Function_glBindFramebufferOES = 9, + GLMessage_Function_glBindRenderbuffer = 10, + GLMessage_Function_glBindRenderbufferOES = 11, + GLMessage_Function_glBindTexture = 12, + GLMessage_Function_glBindVertexArrayOES = 13, + GLMessage_Function_glBlendColor = 14, + GLMessage_Function_glBlendEquation = 15, + GLMessage_Function_glBlendEquationOES = 16, + GLMessage_Function_glBlendEquationSeparate = 17, + GLMessage_Function_glBlendEquationSeparateOES = 18, + GLMessage_Function_glBlendFunc = 19, + GLMessage_Function_glBlendFuncSeparate = 20, + GLMessage_Function_glBlendFuncSeparateOES = 21, + GLMessage_Function_glBufferData = 22, + GLMessage_Function_glBufferSubData = 23, + GLMessage_Function_glCheckFramebufferStatus = 24, + GLMessage_Function_glCheckFramebufferStatusOES = 25, + GLMessage_Function_glClearColor = 26, + GLMessage_Function_glClearColorx = 27, + GLMessage_Function_glClearColorxOES = 28, + GLMessage_Function_glClearDepthf = 29, + GLMessage_Function_glClearDepthfOES = 30, + GLMessage_Function_glClearDepthx = 31, + GLMessage_Function_glClearDepthxOES = 32, + GLMessage_Function_glClear = 33, + GLMessage_Function_glClearStencil = 34, + GLMessage_Function_glClientActiveTexture = 35, + GLMessage_Function_glClipPlanef = 36, + GLMessage_Function_glClipPlanefIMG = 37, + GLMessage_Function_glClipPlanefOES = 38, + GLMessage_Function_glClipPlanex = 39, + GLMessage_Function_glClipPlanexIMG = 40, + GLMessage_Function_glClipPlanexOES = 41, + GLMessage_Function_glColor4f = 42, + GLMessage_Function_glColor4ub = 43, + GLMessage_Function_glColor4x = 44, + GLMessage_Function_glColor4xOES = 45, + GLMessage_Function_glColorMask = 46, + GLMessage_Function_glColorPointer = 47, + GLMessage_Function_glCompileShader = 48, + GLMessage_Function_glCompressedTexImage2D = 49, + GLMessage_Function_glCompressedTexImage3DOES = 50, + GLMessage_Function_glCompressedTexSubImage2D = 51, + GLMessage_Function_glCompressedTexSubImage3DOES = 52, + GLMessage_Function_glCopyTexImage2D = 53, + GLMessage_Function_glCopyTexSubImage2D = 54, + GLMessage_Function_glCopyTexSubImage3DOES = 55, + GLMessage_Function_glCoverageMaskNV = 56, + GLMessage_Function_glCoverageOperationNV = 57, + GLMessage_Function_glCreateProgram = 58, + GLMessage_Function_glCreateShader = 59, + GLMessage_Function_glCullFace = 60, + GLMessage_Function_glCurrentPaletteMatrixOES = 61, + GLMessage_Function_glDeleteBuffers = 62, + GLMessage_Function_glDeleteFencesNV = 63, + GLMessage_Function_glDeleteFramebuffers = 64, + GLMessage_Function_glDeleteFramebuffersOES = 65, + GLMessage_Function_glDeletePerfMonitorsAMD = 66, + GLMessage_Function_glDeleteProgram = 67, + GLMessage_Function_glDeleteRenderbuffers = 68, + GLMessage_Function_glDeleteRenderbuffersOES = 69, + GLMessage_Function_glDeleteShader = 70, + GLMessage_Function_glDeleteTextures = 71, + GLMessage_Function_glDeleteVertexArraysOES = 72, + GLMessage_Function_glDepthFunc = 73, + GLMessage_Function_glDepthMask = 74, + GLMessage_Function_glDepthRangef = 75, + GLMessage_Function_glDepthRangefOES = 76, + GLMessage_Function_glDepthRangex = 77, + GLMessage_Function_glDepthRangexOES = 78, + GLMessage_Function_glDetachShader = 79, + GLMessage_Function_glDisableClientState = 80, + GLMessage_Function_glDisableDriverControlQCOM = 81, + GLMessage_Function_glDisable = 82, + GLMessage_Function_glDisableVertexAttribArray = 83, + GLMessage_Function_glDiscardFramebufferEXT = 84, + GLMessage_Function_glDrawArrays = 85, + GLMessage_Function_glDrawElements = 86, + GLMessage_Function_glDrawTexfOES = 87, + GLMessage_Function_glDrawTexfvOES = 88, + GLMessage_Function_glDrawTexiOES = 89, + GLMessage_Function_glDrawTexivOES = 90, + GLMessage_Function_glDrawTexsOES = 91, + GLMessage_Function_glDrawTexsvOES = 92, + GLMessage_Function_glDrawTexxOES = 93, + GLMessage_Function_glDrawTexxvOES = 94, + GLMessage_Function_glEGLImageTargetRenderbufferStorageOES = 95, + GLMessage_Function_glEGLImageTargetTexture2DOES = 96, + GLMessage_Function_glEnableClientState = 97, + GLMessage_Function_glEnableDriverControlQCOM = 98, + GLMessage_Function_glEnable = 99, + GLMessage_Function_glEnableVertexAttribArray = 100, + GLMessage_Function_glEndPerfMonitorAMD = 101, + GLMessage_Function_glEndTilingQCOM = 102, + GLMessage_Function_glExtGetBufferPointervQCOM = 103, + GLMessage_Function_glExtGetBuffersQCOM = 104, + GLMessage_Function_glExtGetFramebuffersQCOM = 105, + GLMessage_Function_glExtGetProgramBinarySourceQCOM = 106, + GLMessage_Function_glExtGetProgramsQCOM = 107, + GLMessage_Function_glExtGetRenderbuffersQCOM = 108, + GLMessage_Function_glExtGetShadersQCOM = 109, + GLMessage_Function_glExtGetTexLevelParameterivQCOM = 110, + GLMessage_Function_glExtGetTexSubImageQCOM = 111, + GLMessage_Function_glExtGetTexturesQCOM = 112, + GLMessage_Function_glExtIsProgramBinaryQCOM = 113, + GLMessage_Function_glExtTexObjectStateOverrideiQCOM = 114, + GLMessage_Function_glFinishFenceNV = 115, + GLMessage_Function_glFinish = 116, + GLMessage_Function_glFlush = 117, + GLMessage_Function_glFogf = 118, + GLMessage_Function_glFogfv = 119, + GLMessage_Function_glFogx = 120, + GLMessage_Function_glFogxOES = 121, + GLMessage_Function_glFogxv = 122, + GLMessage_Function_glFogxvOES = 123, + GLMessage_Function_glFramebufferRenderbuffer = 124, + GLMessage_Function_glFramebufferRenderbufferOES = 125, + GLMessage_Function_glFramebufferTexture2D = 126, + GLMessage_Function_glFramebufferTexture2DMultisampleIMG = 127, + GLMessage_Function_glFramebufferTexture2DOES = 128, + GLMessage_Function_glFramebufferTexture3DOES = 129, + GLMessage_Function_glFrontFace = 130, + GLMessage_Function_glFrustumf = 131, + GLMessage_Function_glFrustumfOES = 132, + GLMessage_Function_glFrustumx = 133, + GLMessage_Function_glFrustumxOES = 134, + GLMessage_Function_glGenBuffers = 135, + GLMessage_Function_glGenerateMipmap = 136, + GLMessage_Function_glGenerateMipmapOES = 137, + GLMessage_Function_glGenFencesNV = 138, + GLMessage_Function_glGenFramebuffers = 139, + GLMessage_Function_glGenFramebuffersOES = 140, + GLMessage_Function_glGenPerfMonitorsAMD = 141, + GLMessage_Function_glGenRenderbuffers = 142, + GLMessage_Function_glGenRenderbuffersOES = 143, + GLMessage_Function_glGenTextures = 144, + GLMessage_Function_glGenVertexArraysOES = 145, + GLMessage_Function_glGetActiveAttrib = 146, + GLMessage_Function_glGetActiveUniform = 147, + GLMessage_Function_glGetAttachedShaders = 148, + GLMessage_Function_glGetAttribLocation = 149, + GLMessage_Function_glGetBooleanv = 150, + GLMessage_Function_glGetBufferParameteriv = 151, + GLMessage_Function_glGetBufferPointervOES = 152, + GLMessage_Function_glGetClipPlanef = 153, + GLMessage_Function_glGetClipPlanefOES = 154, + GLMessage_Function_glGetClipPlanex = 155, + GLMessage_Function_glGetClipPlanexOES = 156, + GLMessage_Function_glGetDriverControlsQCOM = 157, + GLMessage_Function_glGetDriverControlStringQCOM = 158, + GLMessage_Function_glGetError = 159, + GLMessage_Function_glGetFenceivNV = 160, + GLMessage_Function_glGetFixedv = 161, + GLMessage_Function_glGetFixedvOES = 162, + GLMessage_Function_glGetFloatv = 163, + GLMessage_Function_glGetFramebufferAttachmentParameteriv = 164, + GLMessage_Function_glGetFramebufferAttachmentParameterivOES = 165, + GLMessage_Function_glGetIntegerv = 166, + GLMessage_Function_glGetLightfv = 167, + GLMessage_Function_glGetLightxv = 168, + GLMessage_Function_glGetLightxvOES = 169, + GLMessage_Function_glGetMaterialfv = 170, + GLMessage_Function_glGetMaterialxv = 171, + GLMessage_Function_glGetMaterialxvOES = 172, + GLMessage_Function_glGetPerfMonitorCounterDataAMD = 173, + GLMessage_Function_glGetPerfMonitorCounterInfoAMD = 174, + GLMessage_Function_glGetPerfMonitorCountersAMD = 175, + GLMessage_Function_glGetPerfMonitorCounterStringAMD = 176, + GLMessage_Function_glGetPerfMonitorGroupsAMD = 177, + GLMessage_Function_glGetPerfMonitorGroupStringAMD = 178, + GLMessage_Function_glGetPointerv = 179, + GLMessage_Function_glGetProgramBinaryOES = 180, + GLMessage_Function_glGetProgramInfoLog = 181, + GLMessage_Function_glGetProgramiv = 182, + GLMessage_Function_glGetRenderbufferParameteriv = 183, + GLMessage_Function_glGetRenderbufferParameterivOES = 184, + GLMessage_Function_glGetShaderInfoLog = 185, + GLMessage_Function_glGetShaderiv = 186, + GLMessage_Function_glGetShaderPrecisionFormat = 187, + GLMessage_Function_glGetShaderSource = 188, + GLMessage_Function_glGetString = 189, + GLMessage_Function_glGetTexEnvfv = 190, + GLMessage_Function_glGetTexEnviv = 191, + GLMessage_Function_glGetTexEnvxv = 192, + GLMessage_Function_glGetTexEnvxvOES = 193, + GLMessage_Function_glGetTexGenfvOES = 194, + GLMessage_Function_glGetTexGenivOES = 195, + GLMessage_Function_glGetTexGenxvOES = 196, + GLMessage_Function_glGetTexParameterfv = 197, + GLMessage_Function_glGetTexParameteriv = 198, + GLMessage_Function_glGetTexParameterxv = 199, + GLMessage_Function_glGetTexParameterxvOES = 200, + GLMessage_Function_glGetUniformfv = 201, + GLMessage_Function_glGetUniformiv = 202, + GLMessage_Function_glGetUniformLocation = 203, + GLMessage_Function_glGetVertexAttribfv = 204, + GLMessage_Function_glGetVertexAttribiv = 205, + GLMessage_Function_glGetVertexAttribPointerv = 206, + GLMessage_Function_glHint = 207, + GLMessage_Function_glIsBuffer = 208, + GLMessage_Function_glIsEnabled = 209, + GLMessage_Function_glIsFenceNV = 210, + GLMessage_Function_glIsFramebuffer = 211, + GLMessage_Function_glIsFramebufferOES = 212, + GLMessage_Function_glIsProgram = 213, + GLMessage_Function_glIsRenderbuffer = 214, + GLMessage_Function_glIsRenderbufferOES = 215, + GLMessage_Function_glIsShader = 216, + GLMessage_Function_glIsTexture = 217, + GLMessage_Function_glIsVertexArrayOES = 218, + GLMessage_Function_glLightf = 219, + GLMessage_Function_glLightfv = 220, + GLMessage_Function_glLightModelf = 221, + GLMessage_Function_glLightModelfv = 222, + GLMessage_Function_glLightModelx = 223, + GLMessage_Function_glLightModelxOES = 224, + GLMessage_Function_glLightModelxv = 225, + GLMessage_Function_glLightModelxvOES = 226, + GLMessage_Function_glLightx = 227, + GLMessage_Function_glLightxOES = 228, + GLMessage_Function_glLightxv = 229, + GLMessage_Function_glLightxvOES = 230, + GLMessage_Function_glLineWidth = 231, + GLMessage_Function_glLineWidthx = 232, + GLMessage_Function_glLineWidthxOES = 233, + GLMessage_Function_glLinkProgram = 234, + GLMessage_Function_glLoadIdentity = 235, + GLMessage_Function_glLoadMatrixf = 236, + GLMessage_Function_glLoadMatrixx = 237, + GLMessage_Function_glLoadMatrixxOES = 238, + GLMessage_Function_glLoadPaletteFromModelViewMatrixOES = 239, + GLMessage_Function_glLogicOp = 240, + GLMessage_Function_glMapBufferOES = 241, + GLMessage_Function_glMaterialf = 242, + GLMessage_Function_glMaterialfv = 243, + GLMessage_Function_glMaterialx = 244, + GLMessage_Function_glMaterialxOES = 245, + GLMessage_Function_glMaterialxv = 246, + GLMessage_Function_glMaterialxvOES = 247, + GLMessage_Function_glMatrixIndexPointerOES = 248, + GLMessage_Function_glMatrixMode = 249, + GLMessage_Function_glMultiDrawArraysEXT = 250, + GLMessage_Function_glMultiDrawElementsEXT = 251, + GLMessage_Function_glMultiTexCoord4f = 252, + GLMessage_Function_glMultiTexCoord4x = 253, + GLMessage_Function_glMultiTexCoord4xOES = 254, + GLMessage_Function_glMultMatrixf = 255, + GLMessage_Function_glMultMatrixx = 256, + GLMessage_Function_glMultMatrixxOES = 257, + GLMessage_Function_glNormal3f = 258, + GLMessage_Function_glNormal3x = 259, + GLMessage_Function_glNormal3xOES = 260, + GLMessage_Function_glNormalPointer = 261, + GLMessage_Function_glOrthof = 262, + GLMessage_Function_glOrthofOES = 263, + GLMessage_Function_glOrthox = 264, + GLMessage_Function_glOrthoxOES = 265, + GLMessage_Function_glPixelStorei = 266, + GLMessage_Function_glPointParameterf = 267, + GLMessage_Function_glPointParameterfv = 268, + GLMessage_Function_glPointParameterx = 269, + GLMessage_Function_glPointParameterxOES = 270, + GLMessage_Function_glPointParameterxv = 271, + GLMessage_Function_glPointParameterxvOES = 272, + GLMessage_Function_glPointSize = 273, + GLMessage_Function_glPointSizePointerOES = 274, + GLMessage_Function_glPointSizex = 275, + GLMessage_Function_glPointSizexOES = 276, + GLMessage_Function_glPolygonOffset = 277, + GLMessage_Function_glPolygonOffsetx = 278, + GLMessage_Function_glPolygonOffsetxOES = 279, + GLMessage_Function_glPopMatrix = 280, + GLMessage_Function_glProgramBinaryOES = 281, + GLMessage_Function_glPushMatrix = 282, + GLMessage_Function_glQueryMatrixxOES = 283, + GLMessage_Function_glReadPixels = 284, + GLMessage_Function_glReleaseShaderCompiler = 285, + GLMessage_Function_glRenderbufferStorage = 286, + GLMessage_Function_glRenderbufferStorageMultisampleIMG = 287, + GLMessage_Function_glRenderbufferStorageOES = 288, + GLMessage_Function_glRotatef = 289, + GLMessage_Function_glRotatex = 290, + GLMessage_Function_glRotatexOES = 291, + GLMessage_Function_glSampleCoverage = 292, + GLMessage_Function_glSampleCoveragex = 293, + GLMessage_Function_glSampleCoveragexOES = 294, + GLMessage_Function_glScalef = 295, + GLMessage_Function_glScalex = 296, + GLMessage_Function_glScalexOES = 297, + GLMessage_Function_glScissor = 298, + GLMessage_Function_glSelectPerfMonitorCountersAMD = 299, + GLMessage_Function_glSetFenceNV = 300, + GLMessage_Function_glShadeModel = 301, + GLMessage_Function_glShaderBinary = 302, + GLMessage_Function_glShaderSource = 303, + GLMessage_Function_glStartTilingQCOM = 304, + GLMessage_Function_glStencilFunc = 305, + GLMessage_Function_glStencilFuncSeparate = 306, + GLMessage_Function_glStencilMask = 307, + GLMessage_Function_glStencilMaskSeparate = 308, + GLMessage_Function_glStencilOp = 309, + GLMessage_Function_glStencilOpSeparate = 310, + GLMessage_Function_glTestFenceNV = 311, + GLMessage_Function_glTexCoordPointer = 312, + GLMessage_Function_glTexEnvf = 313, + GLMessage_Function_glTexEnvfv = 314, + GLMessage_Function_glTexEnvi = 315, + GLMessage_Function_glTexEnviv = 316, + GLMessage_Function_glTexEnvx = 317, + GLMessage_Function_glTexEnvxOES = 318, + GLMessage_Function_glTexEnvxv = 319, + GLMessage_Function_glTexEnvxvOES = 320, + GLMessage_Function_glTexGenfOES = 321, + GLMessage_Function_glTexGenfvOES = 322, + GLMessage_Function_glTexGeniOES = 323, + GLMessage_Function_glTexGenivOES = 324, + GLMessage_Function_glTexGenxOES = 325, + GLMessage_Function_glTexGenxvOES = 326, + GLMessage_Function_glTexImage2D = 327, + GLMessage_Function_glTexImage3DOES = 328, + GLMessage_Function_glTexParameterf = 329, + GLMessage_Function_glTexParameterfv = 330, + GLMessage_Function_glTexParameteri = 331, + GLMessage_Function_glTexParameteriv = 332, + GLMessage_Function_glTexParameterx = 333, + GLMessage_Function_glTexParameterxOES = 334, + GLMessage_Function_glTexParameterxv = 335, + GLMessage_Function_glTexParameterxvOES = 336, + GLMessage_Function_glTexSubImage2D = 337, + GLMessage_Function_glTexSubImage3DOES = 338, + GLMessage_Function_glTranslatef = 339, + GLMessage_Function_glTranslatex = 340, + GLMessage_Function_glTranslatexOES = 341, + GLMessage_Function_glUniform1f = 342, + GLMessage_Function_glUniform1fv = 343, + GLMessage_Function_glUniform1i = 344, + GLMessage_Function_glUniform1iv = 345, + GLMessage_Function_glUniform2f = 346, + GLMessage_Function_glUniform2fv = 347, + GLMessage_Function_glUniform2i = 348, + GLMessage_Function_glUniform2iv = 349, + GLMessage_Function_glUniform3f = 350, + GLMessage_Function_glUniform3fv = 351, + GLMessage_Function_glUniform3i = 352, + GLMessage_Function_glUniform3iv = 353, + GLMessage_Function_glUniform4f = 354, + GLMessage_Function_glUniform4fv = 355, + GLMessage_Function_glUniform4i = 356, + GLMessage_Function_glUniform4iv = 357, + GLMessage_Function_glUniformMatrix2fv = 358, + GLMessage_Function_glUniformMatrix3fv = 359, + GLMessage_Function_glUniformMatrix4fv = 360, + GLMessage_Function_glUnmapBufferOES = 361, + GLMessage_Function_glUseProgram = 362, + GLMessage_Function_glValidateProgram = 363, + GLMessage_Function_glVertexAttrib1f = 364, + GLMessage_Function_glVertexAttrib1fv = 365, + GLMessage_Function_glVertexAttrib2f = 366, + GLMessage_Function_glVertexAttrib2fv = 367, + GLMessage_Function_glVertexAttrib3f = 368, + GLMessage_Function_glVertexAttrib3fv = 369, + GLMessage_Function_glVertexAttrib4f = 370, + GLMessage_Function_glVertexAttrib4fv = 371, + GLMessage_Function_glVertexAttribPointer = 372, + GLMessage_Function_glVertexPointer = 373, + GLMessage_Function_glViewport = 374, + GLMessage_Function_glWeightPointerOES = 375, + GLMessage_Function_eglGetDisplay = 2000, + GLMessage_Function_eglInitialize = 2001, + GLMessage_Function_eglTerminate = 2002, + GLMessage_Function_eglGetConfigs = 2003, + GLMessage_Function_eglChooseConfig = 2004, + GLMessage_Function_eglGetConfigAttrib = 2005, + GLMessage_Function_eglCreateWindowSurface = 2006, + GLMessage_Function_eglCreatePixmapSurface = 2007, + GLMessage_Function_eglCreatePbufferSurface = 2008, + GLMessage_Function_eglDestroySurface = 2009, + GLMessage_Function_eglQuerySurface = 2010, + GLMessage_Function_eglCreateContext = 2011, + GLMessage_Function_eglDestroyContext = 2012, + GLMessage_Function_eglMakeCurrent = 2013, + GLMessage_Function_eglGetCurrentContext = 2014, + GLMessage_Function_eglGetCurrentSurface = 2015, + GLMessage_Function_eglGetCurrentDisplay = 2016, + GLMessage_Function_eglQueryContext = 2017, + GLMessage_Function_eglWaitGL = 2018, + GLMessage_Function_eglWaitNative = 2019, + GLMessage_Function_eglSwapBuffers = 2020, + GLMessage_Function_eglCopyBuffers = 2021, + GLMessage_Function_eglGetError = 2022, + GLMessage_Function_eglQueryString = 2023, + GLMessage_Function_eglGetProcAddress = 2024, + GLMessage_Function_eglSurfaceAttrib = 2025, + GLMessage_Function_eglBindTexImage = 2026, + GLMessage_Function_eglReleaseTexImage = 2027, + GLMessage_Function_eglSwapInterval = 2028, + GLMessage_Function_eglBindAPI = 2029, + GLMessage_Function_eglQueryAPI = 2030, + GLMessage_Function_eglWaitClient = 2031, + GLMessage_Function_eglReleaseThread = 2032, + GLMessage_Function_eglCreatePbufferFromClientBuffer = 2033, + GLMessage_Function_eglLockSurfaceKHR = 2034, + GLMessage_Function_eglUnlockSurfaceKHR = 2035, + GLMessage_Function_eglCreateImageKHR = 2036, + GLMessage_Function_eglDestroyImageKHR = 2037, + GLMessage_Function_eglCreateSyncKHR = 2038, + GLMessage_Function_eglDestroySyncKHR = 2039, + GLMessage_Function_eglClientWaitSyncKHR = 2040, + GLMessage_Function_eglGetSyncAttribKHR = 2041, + GLMessage_Function_eglSetSwapRectangleANDROID = 2042, + GLMessage_Function_eglGetRenderBufferANDROID = 2043, + GLMessage_Function_eglGetSystemTimeFrequencyNV = 2044, + GLMessage_Function_eglGetSystemTimeNV = 2045, + GLMessage_Function_invalid = 3000, + GLMessage_Function_frameBufferContents = 3001 +}; +bool GLMessage_Function_IsValid(int value); +const GLMessage_Function GLMessage_Function_Function_MIN = GLMessage_Function_glActiveTexture; +const GLMessage_Function GLMessage_Function_Function_MAX = GLMessage_Function_frameBufferContents; +const int GLMessage_Function_Function_ARRAYSIZE = GLMessage_Function_Function_MAX + 1; + +// =================================================================== + +class GLMessage_DataType : public ::google::protobuf::MessageLite { + public: + GLMessage_DataType(); + virtual ~GLMessage_DataType(); + + GLMessage_DataType(const GLMessage_DataType& from); + + inline GLMessage_DataType& operator=(const GLMessage_DataType& from) { + CopyFrom(from); + return *this; + } + + static const GLMessage_DataType& default_instance(); + + void Swap(GLMessage_DataType* other); + + // implements Message ---------------------------------------------- + + GLMessage_DataType* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const GLMessage_DataType& from); + void MergeFrom(const GLMessage_DataType& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + typedef GLMessage_DataType_Type Type; + static const Type VOID = GLMessage_DataType_Type_VOID; + static const Type CHAR = GLMessage_DataType_Type_CHAR; + static const Type BYTE = GLMessage_DataType_Type_BYTE; + static const Type INT = GLMessage_DataType_Type_INT; + static const Type FLOAT = GLMessage_DataType_Type_FLOAT; + static const Type BOOL = GLMessage_DataType_Type_BOOL; + static const Type ENUM = GLMessage_DataType_Type_ENUM; + static inline bool Type_IsValid(int value) { + return GLMessage_DataType_Type_IsValid(value); + } + static const Type Type_MIN = + GLMessage_DataType_Type_Type_MIN; + static const Type Type_MAX = + GLMessage_DataType_Type_Type_MAX; + static const int Type_ARRAYSIZE = + GLMessage_DataType_Type_Type_ARRAYSIZE; + + // accessors ------------------------------------------------------- + + // required .android.gltrace.GLMessage.DataType.Type type = 1 [default = VOID]; + inline bool has_type() const; + inline void clear_type(); + static const int kTypeFieldNumber = 1; + inline ::android::gltrace::GLMessage_DataType_Type type() const; + inline void set_type(::android::gltrace::GLMessage_DataType_Type value); + + // required bool isArray = 2 [default = false]; + inline bool has_isarray() const; + inline void clear_isarray(); + static const int kIsArrayFieldNumber = 2; + inline bool isarray() const; + inline void set_isarray(bool value); + + // repeated int32 intValue = 3; + inline int intvalue_size() const; + inline void clear_intvalue(); + static const int kIntValueFieldNumber = 3; + inline ::google::protobuf::int32 intvalue(int index) const; + inline void set_intvalue(int index, ::google::protobuf::int32 value); + inline void add_intvalue(::google::protobuf::int32 value); + inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& + intvalue() const; + inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* + mutable_intvalue(); + + // repeated float floatValue = 4; + inline int floatvalue_size() const; + inline void clear_floatvalue(); + static const int kFloatValueFieldNumber = 4; + inline float floatvalue(int index) const; + inline void set_floatvalue(int index, float value); + inline void add_floatvalue(float value); + inline const ::google::protobuf::RepeatedField< float >& + floatvalue() const; + inline ::google::protobuf::RepeatedField< float >* + mutable_floatvalue(); + + // repeated bytes charValue = 5; + inline int charvalue_size() const; + inline void clear_charvalue(); + static const int kCharValueFieldNumber = 5; + inline const ::std::string& charvalue(int index) const; + inline ::std::string* mutable_charvalue(int index); + inline void set_charvalue(int index, const ::std::string& value); + inline void set_charvalue(int index, const char* value); + inline void set_charvalue(int index, const void* value, size_t size); + inline ::std::string* add_charvalue(); + inline void add_charvalue(const ::std::string& value); + inline void add_charvalue(const char* value); + inline void add_charvalue(const void* value, size_t size); + inline const ::google::protobuf::RepeatedPtrField< ::std::string>& charvalue() const; + inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_charvalue(); + + // repeated bytes rawBytes = 6; + inline int rawbytes_size() const; + inline void clear_rawbytes(); + static const int kRawBytesFieldNumber = 6; + inline const ::std::string& rawbytes(int index) const; + inline ::std::string* mutable_rawbytes(int index); + inline void set_rawbytes(int index, const ::std::string& value); + inline void set_rawbytes(int index, const char* value); + inline void set_rawbytes(int index, const void* value, size_t size); + inline ::std::string* add_rawbytes(); + inline void add_rawbytes(const ::std::string& value); + inline void add_rawbytes(const char* value); + inline void add_rawbytes(const void* value, size_t size); + inline const ::google::protobuf::RepeatedPtrField< ::std::string>& rawbytes() const; + inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_rawbytes(); + + // repeated bool boolValue = 7; + inline int boolvalue_size() const; + inline void clear_boolvalue(); + static const int kBoolValueFieldNumber = 7; + inline bool boolvalue(int index) const; + inline void set_boolvalue(int index, bool value); + inline void add_boolvalue(bool value); + inline const ::google::protobuf::RepeatedField< bool >& + boolvalue() const; + inline ::google::protobuf::RepeatedField< bool >* + mutable_boolvalue(); + + // @@protoc_insertion_point(class_scope:android.gltrace.GLMessage.DataType) + private: + mutable int _cached_size_; + + int type_; + bool isarray_; + ::google::protobuf::RepeatedField< ::google::protobuf::int32 > intvalue_; + ::google::protobuf::RepeatedField< float > floatvalue_; + ::google::protobuf::RepeatedPtrField< ::std::string> charvalue_; + ::google::protobuf::RepeatedPtrField< ::std::string> rawbytes_; + ::google::protobuf::RepeatedField< bool > boolvalue_; + friend void protobuf_AddDesc_gltrace_2eproto(); + friend void protobuf_AssignDesc_gltrace_2eproto(); + friend void protobuf_ShutdownFile_gltrace_2eproto(); + + ::google::protobuf::uint32 _has_bits_[(7 + 31) / 32]; + + // WHY DOES & HAVE LOWER PRECEDENCE THAN != !? + inline bool _has_bit(int index) const { + return (_has_bits_[index / 32] & (1u << (index % 32))) != 0; + } + inline void _set_bit(int index) { + _has_bits_[index / 32] |= (1u << (index % 32)); + } + inline void _clear_bit(int index) { + _has_bits_[index / 32] &= ~(1u << (index % 32)); + } + + void InitAsDefaultInstance(); + static GLMessage_DataType* default_instance_; +}; +// ------------------------------------------------------------------- + +class GLMessage_FrameBuffer : public ::google::protobuf::MessageLite { + public: + GLMessage_FrameBuffer(); + virtual ~GLMessage_FrameBuffer(); + + GLMessage_FrameBuffer(const GLMessage_FrameBuffer& from); + + inline GLMessage_FrameBuffer& operator=(const GLMessage_FrameBuffer& from) { + CopyFrom(from); + return *this; + } + + static const GLMessage_FrameBuffer& default_instance(); + + void Swap(GLMessage_FrameBuffer* other); + + // implements Message ---------------------------------------------- + + GLMessage_FrameBuffer* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const GLMessage_FrameBuffer& from); + void MergeFrom(const GLMessage_FrameBuffer& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // required int32 width = 1; + inline bool has_width() const; + inline void clear_width(); + static const int kWidthFieldNumber = 1; + inline ::google::protobuf::int32 width() const; + inline void set_width(::google::protobuf::int32 value); + + // required int32 height = 2; + inline bool has_height() const; + inline void clear_height(); + static const int kHeightFieldNumber = 2; + inline ::google::protobuf::int32 height() const; + inline void set_height(::google::protobuf::int32 value); + + // repeated bytes contents = 3; + inline int contents_size() const; + inline void clear_contents(); + static const int kContentsFieldNumber = 3; + inline const ::std::string& contents(int index) const; + inline ::std::string* mutable_contents(int index); + inline void set_contents(int index, const ::std::string& value); + inline void set_contents(int index, const char* value); + inline void set_contents(int index, const void* value, size_t size); + inline ::std::string* add_contents(); + inline void add_contents(const ::std::string& value); + inline void add_contents(const char* value); + inline void add_contents(const void* value, size_t size); + inline const ::google::protobuf::RepeatedPtrField< ::std::string>& contents() const; + inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_contents(); + + // @@protoc_insertion_point(class_scope:android.gltrace.GLMessage.FrameBuffer) + private: + mutable int _cached_size_; + + ::google::protobuf::int32 width_; + ::google::protobuf::int32 height_; + ::google::protobuf::RepeatedPtrField< ::std::string> contents_; + friend void protobuf_AddDesc_gltrace_2eproto(); + friend void protobuf_AssignDesc_gltrace_2eproto(); + friend void protobuf_ShutdownFile_gltrace_2eproto(); + + ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; + + // WHY DOES & HAVE LOWER PRECEDENCE THAN != !? + inline bool _has_bit(int index) const { + return (_has_bits_[index / 32] & (1u << (index % 32))) != 0; + } + inline void _set_bit(int index) { + _has_bits_[index / 32] |= (1u << (index % 32)); + } + inline void _clear_bit(int index) { + _has_bits_[index / 32] &= ~(1u << (index % 32)); + } + + void InitAsDefaultInstance(); + static GLMessage_FrameBuffer* default_instance_; +}; +// ------------------------------------------------------------------- + +class GLMessage : public ::google::protobuf::MessageLite { + public: + GLMessage(); + virtual ~GLMessage(); + + GLMessage(const GLMessage& from); + + inline GLMessage& operator=(const GLMessage& from) { + CopyFrom(from); + return *this; + } + + static const GLMessage& default_instance(); + + void Swap(GLMessage* other); + + // implements Message ---------------------------------------------- + + GLMessage* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const GLMessage& from); + void MergeFrom(const GLMessage& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + typedef GLMessage_DataType DataType; + typedef GLMessage_FrameBuffer FrameBuffer; + + typedef GLMessage_Function Function; + static const Function glActiveTexture = GLMessage_Function_glActiveTexture; + static const Function glAlphaFunc = GLMessage_Function_glAlphaFunc; + static const Function glAlphaFuncx = GLMessage_Function_glAlphaFuncx; + static const Function glAlphaFuncxOES = GLMessage_Function_glAlphaFuncxOES; + static const Function glAttachShader = GLMessage_Function_glAttachShader; + static const Function glBeginPerfMonitorAMD = GLMessage_Function_glBeginPerfMonitorAMD; + static const Function glBindAttribLocation = GLMessage_Function_glBindAttribLocation; + static const Function glBindBuffer = GLMessage_Function_glBindBuffer; + static const Function glBindFramebuffer = GLMessage_Function_glBindFramebuffer; + static const Function glBindFramebufferOES = GLMessage_Function_glBindFramebufferOES; + static const Function glBindRenderbuffer = GLMessage_Function_glBindRenderbuffer; + static const Function glBindRenderbufferOES = GLMessage_Function_glBindRenderbufferOES; + static const Function glBindTexture = GLMessage_Function_glBindTexture; + static const Function glBindVertexArrayOES = GLMessage_Function_glBindVertexArrayOES; + static const Function glBlendColor = GLMessage_Function_glBlendColor; + static const Function glBlendEquation = GLMessage_Function_glBlendEquation; + static const Function glBlendEquationOES = GLMessage_Function_glBlendEquationOES; + static const Function glBlendEquationSeparate = GLMessage_Function_glBlendEquationSeparate; + static const Function glBlendEquationSeparateOES = GLMessage_Function_glBlendEquationSeparateOES; + static const Function glBlendFunc = GLMessage_Function_glBlendFunc; + static const Function glBlendFuncSeparate = GLMessage_Function_glBlendFuncSeparate; + static const Function glBlendFuncSeparateOES = GLMessage_Function_glBlendFuncSeparateOES; + static const Function glBufferData = GLMessage_Function_glBufferData; + static const Function glBufferSubData = GLMessage_Function_glBufferSubData; + static const Function glCheckFramebufferStatus = GLMessage_Function_glCheckFramebufferStatus; + static const Function glCheckFramebufferStatusOES = GLMessage_Function_glCheckFramebufferStatusOES; + static const Function glClearColor = GLMessage_Function_glClearColor; + static const Function glClearColorx = GLMessage_Function_glClearColorx; + static const Function glClearColorxOES = GLMessage_Function_glClearColorxOES; + static const Function glClearDepthf = GLMessage_Function_glClearDepthf; + static const Function glClearDepthfOES = GLMessage_Function_glClearDepthfOES; + static const Function glClearDepthx = GLMessage_Function_glClearDepthx; + static const Function glClearDepthxOES = GLMessage_Function_glClearDepthxOES; + static const Function glClear = GLMessage_Function_glClear; + static const Function glClearStencil = GLMessage_Function_glClearStencil; + static const Function glClientActiveTexture = GLMessage_Function_glClientActiveTexture; + static const Function glClipPlanef = GLMessage_Function_glClipPlanef; + static const Function glClipPlanefIMG = GLMessage_Function_glClipPlanefIMG; + static const Function glClipPlanefOES = GLMessage_Function_glClipPlanefOES; + static const Function glClipPlanex = GLMessage_Function_glClipPlanex; + static const Function glClipPlanexIMG = GLMessage_Function_glClipPlanexIMG; + static const Function glClipPlanexOES = GLMessage_Function_glClipPlanexOES; + static const Function glColor4f = GLMessage_Function_glColor4f; + static const Function glColor4ub = GLMessage_Function_glColor4ub; + static const Function glColor4x = GLMessage_Function_glColor4x; + static const Function glColor4xOES = GLMessage_Function_glColor4xOES; + static const Function glColorMask = GLMessage_Function_glColorMask; + static const Function glColorPointer = GLMessage_Function_glColorPointer; + static const Function glCompileShader = GLMessage_Function_glCompileShader; + static const Function glCompressedTexImage2D = GLMessage_Function_glCompressedTexImage2D; + static const Function glCompressedTexImage3DOES = GLMessage_Function_glCompressedTexImage3DOES; + static const Function glCompressedTexSubImage2D = GLMessage_Function_glCompressedTexSubImage2D; + static const Function glCompressedTexSubImage3DOES = GLMessage_Function_glCompressedTexSubImage3DOES; + static const Function glCopyTexImage2D = GLMessage_Function_glCopyTexImage2D; + static const Function glCopyTexSubImage2D = GLMessage_Function_glCopyTexSubImage2D; + static const Function glCopyTexSubImage3DOES = GLMessage_Function_glCopyTexSubImage3DOES; + static const Function glCoverageMaskNV = GLMessage_Function_glCoverageMaskNV; + static const Function glCoverageOperationNV = GLMessage_Function_glCoverageOperationNV; + static const Function glCreateProgram = GLMessage_Function_glCreateProgram; + static const Function glCreateShader = GLMessage_Function_glCreateShader; + static const Function glCullFace = GLMessage_Function_glCullFace; + static const Function glCurrentPaletteMatrixOES = GLMessage_Function_glCurrentPaletteMatrixOES; + static const Function glDeleteBuffers = GLMessage_Function_glDeleteBuffers; + static const Function glDeleteFencesNV = GLMessage_Function_glDeleteFencesNV; + static const Function glDeleteFramebuffers = GLMessage_Function_glDeleteFramebuffers; + static const Function glDeleteFramebuffersOES = GLMessage_Function_glDeleteFramebuffersOES; + static const Function glDeletePerfMonitorsAMD = GLMessage_Function_glDeletePerfMonitorsAMD; + static const Function glDeleteProgram = GLMessage_Function_glDeleteProgram; + static const Function glDeleteRenderbuffers = GLMessage_Function_glDeleteRenderbuffers; + static const Function glDeleteRenderbuffersOES = GLMessage_Function_glDeleteRenderbuffersOES; + static const Function glDeleteShader = GLMessage_Function_glDeleteShader; + static const Function glDeleteTextures = GLMessage_Function_glDeleteTextures; + static const Function glDeleteVertexArraysOES = GLMessage_Function_glDeleteVertexArraysOES; + static const Function glDepthFunc = GLMessage_Function_glDepthFunc; + static const Function glDepthMask = GLMessage_Function_glDepthMask; + static const Function glDepthRangef = GLMessage_Function_glDepthRangef; + static const Function glDepthRangefOES = GLMessage_Function_glDepthRangefOES; + static const Function glDepthRangex = GLMessage_Function_glDepthRangex; + static const Function glDepthRangexOES = GLMessage_Function_glDepthRangexOES; + static const Function glDetachShader = GLMessage_Function_glDetachShader; + static const Function glDisableClientState = GLMessage_Function_glDisableClientState; + static const Function glDisableDriverControlQCOM = GLMessage_Function_glDisableDriverControlQCOM; + static const Function glDisable = GLMessage_Function_glDisable; + static const Function glDisableVertexAttribArray = GLMessage_Function_glDisableVertexAttribArray; + static const Function glDiscardFramebufferEXT = GLMessage_Function_glDiscardFramebufferEXT; + static const Function glDrawArrays = GLMessage_Function_glDrawArrays; + static const Function glDrawElements = GLMessage_Function_glDrawElements; + static const Function glDrawTexfOES = GLMessage_Function_glDrawTexfOES; + static const Function glDrawTexfvOES = GLMessage_Function_glDrawTexfvOES; + static const Function glDrawTexiOES = GLMessage_Function_glDrawTexiOES; + static const Function glDrawTexivOES = GLMessage_Function_glDrawTexivOES; + static const Function glDrawTexsOES = GLMessage_Function_glDrawTexsOES; + static const Function glDrawTexsvOES = GLMessage_Function_glDrawTexsvOES; + static const Function glDrawTexxOES = GLMessage_Function_glDrawTexxOES; + static const Function glDrawTexxvOES = GLMessage_Function_glDrawTexxvOES; + static const Function glEGLImageTargetRenderbufferStorageOES = GLMessage_Function_glEGLImageTargetRenderbufferStorageOES; + static const Function glEGLImageTargetTexture2DOES = GLMessage_Function_glEGLImageTargetTexture2DOES; + static const Function glEnableClientState = GLMessage_Function_glEnableClientState; + static const Function glEnableDriverControlQCOM = GLMessage_Function_glEnableDriverControlQCOM; + static const Function glEnable = GLMessage_Function_glEnable; + static const Function glEnableVertexAttribArray = GLMessage_Function_glEnableVertexAttribArray; + static const Function glEndPerfMonitorAMD = GLMessage_Function_glEndPerfMonitorAMD; + static const Function glEndTilingQCOM = GLMessage_Function_glEndTilingQCOM; + static const Function glExtGetBufferPointervQCOM = GLMessage_Function_glExtGetBufferPointervQCOM; + static const Function glExtGetBuffersQCOM = GLMessage_Function_glExtGetBuffersQCOM; + static const Function glExtGetFramebuffersQCOM = GLMessage_Function_glExtGetFramebuffersQCOM; + static const Function glExtGetProgramBinarySourceQCOM = GLMessage_Function_glExtGetProgramBinarySourceQCOM; + static const Function glExtGetProgramsQCOM = GLMessage_Function_glExtGetProgramsQCOM; + static const Function glExtGetRenderbuffersQCOM = GLMessage_Function_glExtGetRenderbuffersQCOM; + static const Function glExtGetShadersQCOM = GLMessage_Function_glExtGetShadersQCOM; + static const Function glExtGetTexLevelParameterivQCOM = GLMessage_Function_glExtGetTexLevelParameterivQCOM; + static const Function glExtGetTexSubImageQCOM = GLMessage_Function_glExtGetTexSubImageQCOM; + static const Function glExtGetTexturesQCOM = GLMessage_Function_glExtGetTexturesQCOM; + static const Function glExtIsProgramBinaryQCOM = GLMessage_Function_glExtIsProgramBinaryQCOM; + static const Function glExtTexObjectStateOverrideiQCOM = GLMessage_Function_glExtTexObjectStateOverrideiQCOM; + static const Function glFinishFenceNV = GLMessage_Function_glFinishFenceNV; + static const Function glFinish = GLMessage_Function_glFinish; + static const Function glFlush = GLMessage_Function_glFlush; + static const Function glFogf = GLMessage_Function_glFogf; + static const Function glFogfv = GLMessage_Function_glFogfv; + static const Function glFogx = GLMessage_Function_glFogx; + static const Function glFogxOES = GLMessage_Function_glFogxOES; + static const Function glFogxv = GLMessage_Function_glFogxv; + static const Function glFogxvOES = GLMessage_Function_glFogxvOES; + static const Function glFramebufferRenderbuffer = GLMessage_Function_glFramebufferRenderbuffer; + static const Function glFramebufferRenderbufferOES = GLMessage_Function_glFramebufferRenderbufferOES; + static const Function glFramebufferTexture2D = GLMessage_Function_glFramebufferTexture2D; + static const Function glFramebufferTexture2DMultisampleIMG = GLMessage_Function_glFramebufferTexture2DMultisampleIMG; + static const Function glFramebufferTexture2DOES = GLMessage_Function_glFramebufferTexture2DOES; + static const Function glFramebufferTexture3DOES = GLMessage_Function_glFramebufferTexture3DOES; + static const Function glFrontFace = GLMessage_Function_glFrontFace; + static const Function glFrustumf = GLMessage_Function_glFrustumf; + static const Function glFrustumfOES = GLMessage_Function_glFrustumfOES; + static const Function glFrustumx = GLMessage_Function_glFrustumx; + static const Function glFrustumxOES = GLMessage_Function_glFrustumxOES; + static const Function glGenBuffers = GLMessage_Function_glGenBuffers; + static const Function glGenerateMipmap = GLMessage_Function_glGenerateMipmap; + static const Function glGenerateMipmapOES = GLMessage_Function_glGenerateMipmapOES; + static const Function glGenFencesNV = GLMessage_Function_glGenFencesNV; + static const Function glGenFramebuffers = GLMessage_Function_glGenFramebuffers; + static const Function glGenFramebuffersOES = GLMessage_Function_glGenFramebuffersOES; + static const Function glGenPerfMonitorsAMD = GLMessage_Function_glGenPerfMonitorsAMD; + static const Function glGenRenderbuffers = GLMessage_Function_glGenRenderbuffers; + static const Function glGenRenderbuffersOES = GLMessage_Function_glGenRenderbuffersOES; + static const Function glGenTextures = GLMessage_Function_glGenTextures; + static const Function glGenVertexArraysOES = GLMessage_Function_glGenVertexArraysOES; + static const Function glGetActiveAttrib = GLMessage_Function_glGetActiveAttrib; + static const Function glGetActiveUniform = GLMessage_Function_glGetActiveUniform; + static const Function glGetAttachedShaders = GLMessage_Function_glGetAttachedShaders; + static const Function glGetAttribLocation = GLMessage_Function_glGetAttribLocation; + static const Function glGetBooleanv = GLMessage_Function_glGetBooleanv; + static const Function glGetBufferParameteriv = GLMessage_Function_glGetBufferParameteriv; + static const Function glGetBufferPointervOES = GLMessage_Function_glGetBufferPointervOES; + static const Function glGetClipPlanef = GLMessage_Function_glGetClipPlanef; + static const Function glGetClipPlanefOES = GLMessage_Function_glGetClipPlanefOES; + static const Function glGetClipPlanex = GLMessage_Function_glGetClipPlanex; + static const Function glGetClipPlanexOES = GLMessage_Function_glGetClipPlanexOES; + static const Function glGetDriverControlsQCOM = GLMessage_Function_glGetDriverControlsQCOM; + static const Function glGetDriverControlStringQCOM = GLMessage_Function_glGetDriverControlStringQCOM; + static const Function glGetError = GLMessage_Function_glGetError; + static const Function glGetFenceivNV = GLMessage_Function_glGetFenceivNV; + static const Function glGetFixedv = GLMessage_Function_glGetFixedv; + static const Function glGetFixedvOES = GLMessage_Function_glGetFixedvOES; + static const Function glGetFloatv = GLMessage_Function_glGetFloatv; + static const Function glGetFramebufferAttachmentParameteriv = GLMessage_Function_glGetFramebufferAttachmentParameteriv; + static const Function glGetFramebufferAttachmentParameterivOES = GLMessage_Function_glGetFramebufferAttachmentParameterivOES; + static const Function glGetIntegerv = GLMessage_Function_glGetIntegerv; + static const Function glGetLightfv = GLMessage_Function_glGetLightfv; + static const Function glGetLightxv = GLMessage_Function_glGetLightxv; + static const Function glGetLightxvOES = GLMessage_Function_glGetLightxvOES; + static const Function glGetMaterialfv = GLMessage_Function_glGetMaterialfv; + static const Function glGetMaterialxv = GLMessage_Function_glGetMaterialxv; + static const Function glGetMaterialxvOES = GLMessage_Function_glGetMaterialxvOES; + static const Function glGetPerfMonitorCounterDataAMD = GLMessage_Function_glGetPerfMonitorCounterDataAMD; + static const Function glGetPerfMonitorCounterInfoAMD = GLMessage_Function_glGetPerfMonitorCounterInfoAMD; + static const Function glGetPerfMonitorCountersAMD = GLMessage_Function_glGetPerfMonitorCountersAMD; + static const Function glGetPerfMonitorCounterStringAMD = GLMessage_Function_glGetPerfMonitorCounterStringAMD; + static const Function glGetPerfMonitorGroupsAMD = GLMessage_Function_glGetPerfMonitorGroupsAMD; + static const Function glGetPerfMonitorGroupStringAMD = GLMessage_Function_glGetPerfMonitorGroupStringAMD; + static const Function glGetPointerv = GLMessage_Function_glGetPointerv; + static const Function glGetProgramBinaryOES = GLMessage_Function_glGetProgramBinaryOES; + static const Function glGetProgramInfoLog = GLMessage_Function_glGetProgramInfoLog; + static const Function glGetProgramiv = GLMessage_Function_glGetProgramiv; + static const Function glGetRenderbufferParameteriv = GLMessage_Function_glGetRenderbufferParameteriv; + static const Function glGetRenderbufferParameterivOES = GLMessage_Function_glGetRenderbufferParameterivOES; + static const Function glGetShaderInfoLog = GLMessage_Function_glGetShaderInfoLog; + static const Function glGetShaderiv = GLMessage_Function_glGetShaderiv; + static const Function glGetShaderPrecisionFormat = GLMessage_Function_glGetShaderPrecisionFormat; + static const Function glGetShaderSource = GLMessage_Function_glGetShaderSource; + static const Function glGetString = GLMessage_Function_glGetString; + static const Function glGetTexEnvfv = GLMessage_Function_glGetTexEnvfv; + static const Function glGetTexEnviv = GLMessage_Function_glGetTexEnviv; + static const Function glGetTexEnvxv = GLMessage_Function_glGetTexEnvxv; + static const Function glGetTexEnvxvOES = GLMessage_Function_glGetTexEnvxvOES; + static const Function glGetTexGenfvOES = GLMessage_Function_glGetTexGenfvOES; + static const Function glGetTexGenivOES = GLMessage_Function_glGetTexGenivOES; + static const Function glGetTexGenxvOES = GLMessage_Function_glGetTexGenxvOES; + static const Function glGetTexParameterfv = GLMessage_Function_glGetTexParameterfv; + static const Function glGetTexParameteriv = GLMessage_Function_glGetTexParameteriv; + static const Function glGetTexParameterxv = GLMessage_Function_glGetTexParameterxv; + static const Function glGetTexParameterxvOES = GLMessage_Function_glGetTexParameterxvOES; + static const Function glGetUniformfv = GLMessage_Function_glGetUniformfv; + static const Function glGetUniformiv = GLMessage_Function_glGetUniformiv; + static const Function glGetUniformLocation = GLMessage_Function_glGetUniformLocation; + static const Function glGetVertexAttribfv = GLMessage_Function_glGetVertexAttribfv; + static const Function glGetVertexAttribiv = GLMessage_Function_glGetVertexAttribiv; + static const Function glGetVertexAttribPointerv = GLMessage_Function_glGetVertexAttribPointerv; + static const Function glHint = GLMessage_Function_glHint; + static const Function glIsBuffer = GLMessage_Function_glIsBuffer; + static const Function glIsEnabled = GLMessage_Function_glIsEnabled; + static const Function glIsFenceNV = GLMessage_Function_glIsFenceNV; + static const Function glIsFramebuffer = GLMessage_Function_glIsFramebuffer; + static const Function glIsFramebufferOES = GLMessage_Function_glIsFramebufferOES; + static const Function glIsProgram = GLMessage_Function_glIsProgram; + static const Function glIsRenderbuffer = GLMessage_Function_glIsRenderbuffer; + static const Function glIsRenderbufferOES = GLMessage_Function_glIsRenderbufferOES; + static const Function glIsShader = GLMessage_Function_glIsShader; + static const Function glIsTexture = GLMessage_Function_glIsTexture; + static const Function glIsVertexArrayOES = GLMessage_Function_glIsVertexArrayOES; + static const Function glLightf = GLMessage_Function_glLightf; + static const Function glLightfv = GLMessage_Function_glLightfv; + static const Function glLightModelf = GLMessage_Function_glLightModelf; + static const Function glLightModelfv = GLMessage_Function_glLightModelfv; + static const Function glLightModelx = GLMessage_Function_glLightModelx; + static const Function glLightModelxOES = GLMessage_Function_glLightModelxOES; + static const Function glLightModelxv = GLMessage_Function_glLightModelxv; + static const Function glLightModelxvOES = GLMessage_Function_glLightModelxvOES; + static const Function glLightx = GLMessage_Function_glLightx; + static const Function glLightxOES = GLMessage_Function_glLightxOES; + static const Function glLightxv = GLMessage_Function_glLightxv; + static const Function glLightxvOES = GLMessage_Function_glLightxvOES; + static const Function glLineWidth = GLMessage_Function_glLineWidth; + static const Function glLineWidthx = GLMessage_Function_glLineWidthx; + static const Function glLineWidthxOES = GLMessage_Function_glLineWidthxOES; + static const Function glLinkProgram = GLMessage_Function_glLinkProgram; + static const Function glLoadIdentity = GLMessage_Function_glLoadIdentity; + static const Function glLoadMatrixf = GLMessage_Function_glLoadMatrixf; + static const Function glLoadMatrixx = GLMessage_Function_glLoadMatrixx; + static const Function glLoadMatrixxOES = GLMessage_Function_glLoadMatrixxOES; + static const Function glLoadPaletteFromModelViewMatrixOES = GLMessage_Function_glLoadPaletteFromModelViewMatrixOES; + static const Function glLogicOp = GLMessage_Function_glLogicOp; + static const Function glMapBufferOES = GLMessage_Function_glMapBufferOES; + static const Function glMaterialf = GLMessage_Function_glMaterialf; + static const Function glMaterialfv = GLMessage_Function_glMaterialfv; + static const Function glMaterialx = GLMessage_Function_glMaterialx; + static const Function glMaterialxOES = GLMessage_Function_glMaterialxOES; + static const Function glMaterialxv = GLMessage_Function_glMaterialxv; + static const Function glMaterialxvOES = GLMessage_Function_glMaterialxvOES; + static const Function glMatrixIndexPointerOES = GLMessage_Function_glMatrixIndexPointerOES; + static const Function glMatrixMode = GLMessage_Function_glMatrixMode; + static const Function glMultiDrawArraysEXT = GLMessage_Function_glMultiDrawArraysEXT; + static const Function glMultiDrawElementsEXT = GLMessage_Function_glMultiDrawElementsEXT; + static const Function glMultiTexCoord4f = GLMessage_Function_glMultiTexCoord4f; + static const Function glMultiTexCoord4x = GLMessage_Function_glMultiTexCoord4x; + static const Function glMultiTexCoord4xOES = GLMessage_Function_glMultiTexCoord4xOES; + static const Function glMultMatrixf = GLMessage_Function_glMultMatrixf; + static const Function glMultMatrixx = GLMessage_Function_glMultMatrixx; + static const Function glMultMatrixxOES = GLMessage_Function_glMultMatrixxOES; + static const Function glNormal3f = GLMessage_Function_glNormal3f; + static const Function glNormal3x = GLMessage_Function_glNormal3x; + static const Function glNormal3xOES = GLMessage_Function_glNormal3xOES; + static const Function glNormalPointer = GLMessage_Function_glNormalPointer; + static const Function glOrthof = GLMessage_Function_glOrthof; + static const Function glOrthofOES = GLMessage_Function_glOrthofOES; + static const Function glOrthox = GLMessage_Function_glOrthox; + static const Function glOrthoxOES = GLMessage_Function_glOrthoxOES; + static const Function glPixelStorei = GLMessage_Function_glPixelStorei; + static const Function glPointParameterf = GLMessage_Function_glPointParameterf; + static const Function glPointParameterfv = GLMessage_Function_glPointParameterfv; + static const Function glPointParameterx = GLMessage_Function_glPointParameterx; + static const Function glPointParameterxOES = GLMessage_Function_glPointParameterxOES; + static const Function glPointParameterxv = GLMessage_Function_glPointParameterxv; + static const Function glPointParameterxvOES = GLMessage_Function_glPointParameterxvOES; + static const Function glPointSize = GLMessage_Function_glPointSize; + static const Function glPointSizePointerOES = GLMessage_Function_glPointSizePointerOES; + static const Function glPointSizex = GLMessage_Function_glPointSizex; + static const Function glPointSizexOES = GLMessage_Function_glPointSizexOES; + static const Function glPolygonOffset = GLMessage_Function_glPolygonOffset; + static const Function glPolygonOffsetx = GLMessage_Function_glPolygonOffsetx; + static const Function glPolygonOffsetxOES = GLMessage_Function_glPolygonOffsetxOES; + static const Function glPopMatrix = GLMessage_Function_glPopMatrix; + static const Function glProgramBinaryOES = GLMessage_Function_glProgramBinaryOES; + static const Function glPushMatrix = GLMessage_Function_glPushMatrix; + static const Function glQueryMatrixxOES = GLMessage_Function_glQueryMatrixxOES; + static const Function glReadPixels = GLMessage_Function_glReadPixels; + static const Function glReleaseShaderCompiler = GLMessage_Function_glReleaseShaderCompiler; + static const Function glRenderbufferStorage = GLMessage_Function_glRenderbufferStorage; + static const Function glRenderbufferStorageMultisampleIMG = GLMessage_Function_glRenderbufferStorageMultisampleIMG; + static const Function glRenderbufferStorageOES = GLMessage_Function_glRenderbufferStorageOES; + static const Function glRotatef = GLMessage_Function_glRotatef; + static const Function glRotatex = GLMessage_Function_glRotatex; + static const Function glRotatexOES = GLMessage_Function_glRotatexOES; + static const Function glSampleCoverage = GLMessage_Function_glSampleCoverage; + static const Function glSampleCoveragex = GLMessage_Function_glSampleCoveragex; + static const Function glSampleCoveragexOES = GLMessage_Function_glSampleCoveragexOES; + static const Function glScalef = GLMessage_Function_glScalef; + static const Function glScalex = GLMessage_Function_glScalex; + static const Function glScalexOES = GLMessage_Function_glScalexOES; + static const Function glScissor = GLMessage_Function_glScissor; + static const Function glSelectPerfMonitorCountersAMD = GLMessage_Function_glSelectPerfMonitorCountersAMD; + static const Function glSetFenceNV = GLMessage_Function_glSetFenceNV; + static const Function glShadeModel = GLMessage_Function_glShadeModel; + static const Function glShaderBinary = GLMessage_Function_glShaderBinary; + static const Function glShaderSource = GLMessage_Function_glShaderSource; + static const Function glStartTilingQCOM = GLMessage_Function_glStartTilingQCOM; + static const Function glStencilFunc = GLMessage_Function_glStencilFunc; + static const Function glStencilFuncSeparate = GLMessage_Function_glStencilFuncSeparate; + static const Function glStencilMask = GLMessage_Function_glStencilMask; + static const Function glStencilMaskSeparate = GLMessage_Function_glStencilMaskSeparate; + static const Function glStencilOp = GLMessage_Function_glStencilOp; + static const Function glStencilOpSeparate = GLMessage_Function_glStencilOpSeparate; + static const Function glTestFenceNV = GLMessage_Function_glTestFenceNV; + static const Function glTexCoordPointer = GLMessage_Function_glTexCoordPointer; + static const Function glTexEnvf = GLMessage_Function_glTexEnvf; + static const Function glTexEnvfv = GLMessage_Function_glTexEnvfv; + static const Function glTexEnvi = GLMessage_Function_glTexEnvi; + static const Function glTexEnviv = GLMessage_Function_glTexEnviv; + static const Function glTexEnvx = GLMessage_Function_glTexEnvx; + static const Function glTexEnvxOES = GLMessage_Function_glTexEnvxOES; + static const Function glTexEnvxv = GLMessage_Function_glTexEnvxv; + static const Function glTexEnvxvOES = GLMessage_Function_glTexEnvxvOES; + static const Function glTexGenfOES = GLMessage_Function_glTexGenfOES; + static const Function glTexGenfvOES = GLMessage_Function_glTexGenfvOES; + static const Function glTexGeniOES = GLMessage_Function_glTexGeniOES; + static const Function glTexGenivOES = GLMessage_Function_glTexGenivOES; + static const Function glTexGenxOES = GLMessage_Function_glTexGenxOES; + static const Function glTexGenxvOES = GLMessage_Function_glTexGenxvOES; + static const Function glTexImage2D = GLMessage_Function_glTexImage2D; + static const Function glTexImage3DOES = GLMessage_Function_glTexImage3DOES; + static const Function glTexParameterf = GLMessage_Function_glTexParameterf; + static const Function glTexParameterfv = GLMessage_Function_glTexParameterfv; + static const Function glTexParameteri = GLMessage_Function_glTexParameteri; + static const Function glTexParameteriv = GLMessage_Function_glTexParameteriv; + static const Function glTexParameterx = GLMessage_Function_glTexParameterx; + static const Function glTexParameterxOES = GLMessage_Function_glTexParameterxOES; + static const Function glTexParameterxv = GLMessage_Function_glTexParameterxv; + static const Function glTexParameterxvOES = GLMessage_Function_glTexParameterxvOES; + static const Function glTexSubImage2D = GLMessage_Function_glTexSubImage2D; + static const Function glTexSubImage3DOES = GLMessage_Function_glTexSubImage3DOES; + static const Function glTranslatef = GLMessage_Function_glTranslatef; + static const Function glTranslatex = GLMessage_Function_glTranslatex; + static const Function glTranslatexOES = GLMessage_Function_glTranslatexOES; + static const Function glUniform1f = GLMessage_Function_glUniform1f; + static const Function glUniform1fv = GLMessage_Function_glUniform1fv; + static const Function glUniform1i = GLMessage_Function_glUniform1i; + static const Function glUniform1iv = GLMessage_Function_glUniform1iv; + static const Function glUniform2f = GLMessage_Function_glUniform2f; + static const Function glUniform2fv = GLMessage_Function_glUniform2fv; + static const Function glUniform2i = GLMessage_Function_glUniform2i; + static const Function glUniform2iv = GLMessage_Function_glUniform2iv; + static const Function glUniform3f = GLMessage_Function_glUniform3f; + static const Function glUniform3fv = GLMessage_Function_glUniform3fv; + static const Function glUniform3i = GLMessage_Function_glUniform3i; + static const Function glUniform3iv = GLMessage_Function_glUniform3iv; + static const Function glUniform4f = GLMessage_Function_glUniform4f; + static const Function glUniform4fv = GLMessage_Function_glUniform4fv; + static const Function glUniform4i = GLMessage_Function_glUniform4i; + static const Function glUniform4iv = GLMessage_Function_glUniform4iv; + static const Function glUniformMatrix2fv = GLMessage_Function_glUniformMatrix2fv; + static const Function glUniformMatrix3fv = GLMessage_Function_glUniformMatrix3fv; + static const Function glUniformMatrix4fv = GLMessage_Function_glUniformMatrix4fv; + static const Function glUnmapBufferOES = GLMessage_Function_glUnmapBufferOES; + static const Function glUseProgram = GLMessage_Function_glUseProgram; + static const Function glValidateProgram = GLMessage_Function_glValidateProgram; + static const Function glVertexAttrib1f = GLMessage_Function_glVertexAttrib1f; + static const Function glVertexAttrib1fv = GLMessage_Function_glVertexAttrib1fv; + static const Function glVertexAttrib2f = GLMessage_Function_glVertexAttrib2f; + static const Function glVertexAttrib2fv = GLMessage_Function_glVertexAttrib2fv; + static const Function glVertexAttrib3f = GLMessage_Function_glVertexAttrib3f; + static const Function glVertexAttrib3fv = GLMessage_Function_glVertexAttrib3fv; + static const Function glVertexAttrib4f = GLMessage_Function_glVertexAttrib4f; + static const Function glVertexAttrib4fv = GLMessage_Function_glVertexAttrib4fv; + static const Function glVertexAttribPointer = GLMessage_Function_glVertexAttribPointer; + static const Function glVertexPointer = GLMessage_Function_glVertexPointer; + static const Function glViewport = GLMessage_Function_glViewport; + static const Function glWeightPointerOES = GLMessage_Function_glWeightPointerOES; + static const Function eglGetDisplay = GLMessage_Function_eglGetDisplay; + static const Function eglInitialize = GLMessage_Function_eglInitialize; + static const Function eglTerminate = GLMessage_Function_eglTerminate; + static const Function eglGetConfigs = GLMessage_Function_eglGetConfigs; + static const Function eglChooseConfig = GLMessage_Function_eglChooseConfig; + static const Function eglGetConfigAttrib = GLMessage_Function_eglGetConfigAttrib; + static const Function eglCreateWindowSurface = GLMessage_Function_eglCreateWindowSurface; + static const Function eglCreatePixmapSurface = GLMessage_Function_eglCreatePixmapSurface; + static const Function eglCreatePbufferSurface = GLMessage_Function_eglCreatePbufferSurface; + static const Function eglDestroySurface = GLMessage_Function_eglDestroySurface; + static const Function eglQuerySurface = GLMessage_Function_eglQuerySurface; + static const Function eglCreateContext = GLMessage_Function_eglCreateContext; + static const Function eglDestroyContext = GLMessage_Function_eglDestroyContext; + static const Function eglMakeCurrent = GLMessage_Function_eglMakeCurrent; + static const Function eglGetCurrentContext = GLMessage_Function_eglGetCurrentContext; + static const Function eglGetCurrentSurface = GLMessage_Function_eglGetCurrentSurface; + static const Function eglGetCurrentDisplay = GLMessage_Function_eglGetCurrentDisplay; + static const Function eglQueryContext = GLMessage_Function_eglQueryContext; + static const Function eglWaitGL = GLMessage_Function_eglWaitGL; + static const Function eglWaitNative = GLMessage_Function_eglWaitNative; + static const Function eglSwapBuffers = GLMessage_Function_eglSwapBuffers; + static const Function eglCopyBuffers = GLMessage_Function_eglCopyBuffers; + static const Function eglGetError = GLMessage_Function_eglGetError; + static const Function eglQueryString = GLMessage_Function_eglQueryString; + static const Function eglGetProcAddress = GLMessage_Function_eglGetProcAddress; + static const Function eglSurfaceAttrib = GLMessage_Function_eglSurfaceAttrib; + static const Function eglBindTexImage = GLMessage_Function_eglBindTexImage; + static const Function eglReleaseTexImage = GLMessage_Function_eglReleaseTexImage; + static const Function eglSwapInterval = GLMessage_Function_eglSwapInterval; + static const Function eglBindAPI = GLMessage_Function_eglBindAPI; + static const Function eglQueryAPI = GLMessage_Function_eglQueryAPI; + static const Function eglWaitClient = GLMessage_Function_eglWaitClient; + static const Function eglReleaseThread = GLMessage_Function_eglReleaseThread; + static const Function eglCreatePbufferFromClientBuffer = GLMessage_Function_eglCreatePbufferFromClientBuffer; + static const Function eglLockSurfaceKHR = GLMessage_Function_eglLockSurfaceKHR; + static const Function eglUnlockSurfaceKHR = GLMessage_Function_eglUnlockSurfaceKHR; + static const Function eglCreateImageKHR = GLMessage_Function_eglCreateImageKHR; + static const Function eglDestroyImageKHR = GLMessage_Function_eglDestroyImageKHR; + static const Function eglCreateSyncKHR = GLMessage_Function_eglCreateSyncKHR; + static const Function eglDestroySyncKHR = GLMessage_Function_eglDestroySyncKHR; + static const Function eglClientWaitSyncKHR = GLMessage_Function_eglClientWaitSyncKHR; + static const Function eglGetSyncAttribKHR = GLMessage_Function_eglGetSyncAttribKHR; + static const Function eglSetSwapRectangleANDROID = GLMessage_Function_eglSetSwapRectangleANDROID; + static const Function eglGetRenderBufferANDROID = GLMessage_Function_eglGetRenderBufferANDROID; + static const Function eglGetSystemTimeFrequencyNV = GLMessage_Function_eglGetSystemTimeFrequencyNV; + static const Function eglGetSystemTimeNV = GLMessage_Function_eglGetSystemTimeNV; + static const Function invalid = GLMessage_Function_invalid; + static const Function frameBufferContents = GLMessage_Function_frameBufferContents; + static inline bool Function_IsValid(int value) { + return GLMessage_Function_IsValid(value); + } + static const Function Function_MIN = + GLMessage_Function_Function_MIN; + static const Function Function_MAX = + GLMessage_Function_Function_MAX; + static const int Function_ARRAYSIZE = + GLMessage_Function_Function_ARRAYSIZE; + + // accessors ------------------------------------------------------- + + // required int32 context_id = 1; + inline bool has_context_id() const; + inline void clear_context_id(); + static const int kContextIdFieldNumber = 1; + inline ::google::protobuf::int32 context_id() const; + inline void set_context_id(::google::protobuf::int32 value); + + // required int64 start_time = 2; + inline bool has_start_time() const; + inline void clear_start_time(); + static const int kStartTimeFieldNumber = 2; + inline ::google::protobuf::int64 start_time() const; + inline void set_start_time(::google::protobuf::int64 value); + + // required int32 duration = 3; + inline bool has_duration() const; + inline void clear_duration(); + static const int kDurationFieldNumber = 3; + inline ::google::protobuf::int32 duration() const; + inline void set_duration(::google::protobuf::int32 value); + + // required .android.gltrace.GLMessage.Function function = 4 [default = invalid]; + inline bool has_function() const; + inline void clear_function(); + static const int kFunctionFieldNumber = 4; + inline ::android::gltrace::GLMessage_Function function() const; + inline void set_function(::android::gltrace::GLMessage_Function value); + + // repeated .android.gltrace.GLMessage.DataType args = 5; + inline int args_size() const; + inline void clear_args(); + static const int kArgsFieldNumber = 5; + inline const ::android::gltrace::GLMessage_DataType& args(int index) const; + inline ::android::gltrace::GLMessage_DataType* mutable_args(int index); + inline ::android::gltrace::GLMessage_DataType* add_args(); + inline const ::google::protobuf::RepeatedPtrField< ::android::gltrace::GLMessage_DataType >& + args() const; + inline ::google::protobuf::RepeatedPtrField< ::android::gltrace::GLMessage_DataType >* + mutable_args(); + + // optional .android.gltrace.GLMessage.DataType returnValue = 6; + inline bool has_returnvalue() const; + inline void clear_returnvalue(); + static const int kReturnValueFieldNumber = 6; + inline const ::android::gltrace::GLMessage_DataType& returnvalue() const; + inline ::android::gltrace::GLMessage_DataType* mutable_returnvalue(); + + // optional .android.gltrace.GLMessage.FrameBuffer fb = 7; + inline bool has_fb() const; + inline void clear_fb(); + static const int kFbFieldNumber = 7; + inline const ::android::gltrace::GLMessage_FrameBuffer& fb() const; + inline ::android::gltrace::GLMessage_FrameBuffer* mutable_fb(); + + // @@protoc_insertion_point(class_scope:android.gltrace.GLMessage) + private: + mutable int _cached_size_; + + ::google::protobuf::int32 context_id_; + ::google::protobuf::int64 start_time_; + ::google::protobuf::int32 duration_; + int function_; + ::google::protobuf::RepeatedPtrField< ::android::gltrace::GLMessage_DataType > args_; + ::android::gltrace::GLMessage_DataType* returnvalue_; + ::android::gltrace::GLMessage_FrameBuffer* fb_; + friend void protobuf_AddDesc_gltrace_2eproto(); + friend void protobuf_AssignDesc_gltrace_2eproto(); + friend void protobuf_ShutdownFile_gltrace_2eproto(); + + ::google::protobuf::uint32 _has_bits_[(7 + 31) / 32]; + + // WHY DOES & HAVE LOWER PRECEDENCE THAN != !? + inline bool _has_bit(int index) const { + return (_has_bits_[index / 32] & (1u << (index % 32))) != 0; + } + inline void _set_bit(int index) { + _has_bits_[index / 32] |= (1u << (index % 32)); + } + inline void _clear_bit(int index) { + _has_bits_[index / 32] &= ~(1u << (index % 32)); + } + + void InitAsDefaultInstance(); + static GLMessage* default_instance_; +}; +// =================================================================== + + +// =================================================================== + +// GLMessage_DataType + +// required .android.gltrace.GLMessage.DataType.Type type = 1 [default = VOID]; +inline bool GLMessage_DataType::has_type() const { + return _has_bit(0); +} +inline void GLMessage_DataType::clear_type() { + type_ = 1; + _clear_bit(0); +} +inline ::android::gltrace::GLMessage_DataType_Type GLMessage_DataType::type() const { + return static_cast< ::android::gltrace::GLMessage_DataType_Type >(type_); +} +inline void GLMessage_DataType::set_type(::android::gltrace::GLMessage_DataType_Type value) { + GOOGLE_DCHECK(::android::gltrace::GLMessage_DataType_Type_IsValid(value)); + _set_bit(0); + type_ = value; +} + +// required bool isArray = 2 [default = false]; +inline bool GLMessage_DataType::has_isarray() const { + return _has_bit(1); +} +inline void GLMessage_DataType::clear_isarray() { + isarray_ = false; + _clear_bit(1); +} +inline bool GLMessage_DataType::isarray() const { + return isarray_; +} +inline void GLMessage_DataType::set_isarray(bool value) { + _set_bit(1); + isarray_ = value; +} + +// repeated int32 intValue = 3; +inline int GLMessage_DataType::intvalue_size() const { + return intvalue_.size(); +} +inline void GLMessage_DataType::clear_intvalue() { + intvalue_.Clear(); +} +inline ::google::protobuf::int32 GLMessage_DataType::intvalue(int index) const { + return intvalue_.Get(index); +} +inline void GLMessage_DataType::set_intvalue(int index, ::google::protobuf::int32 value) { + intvalue_.Set(index, value); +} +inline void GLMessage_DataType::add_intvalue(::google::protobuf::int32 value) { + intvalue_.Add(value); +} +inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& +GLMessage_DataType::intvalue() const { + return intvalue_; +} +inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* +GLMessage_DataType::mutable_intvalue() { + return &intvalue_; +} + +// repeated float floatValue = 4; +inline int GLMessage_DataType::floatvalue_size() const { + return floatvalue_.size(); +} +inline void GLMessage_DataType::clear_floatvalue() { + floatvalue_.Clear(); +} +inline float GLMessage_DataType::floatvalue(int index) const { + return floatvalue_.Get(index); +} +inline void GLMessage_DataType::set_floatvalue(int index, float value) { + floatvalue_.Set(index, value); +} +inline void GLMessage_DataType::add_floatvalue(float value) { + floatvalue_.Add(value); +} +inline const ::google::protobuf::RepeatedField< float >& +GLMessage_DataType::floatvalue() const { + return floatvalue_; +} +inline ::google::protobuf::RepeatedField< float >* +GLMessage_DataType::mutable_floatvalue() { + return &floatvalue_; +} + +// repeated bytes charValue = 5; +inline int GLMessage_DataType::charvalue_size() const { + return charvalue_.size(); +} +inline void GLMessage_DataType::clear_charvalue() { + charvalue_.Clear(); +} +inline const ::std::string& GLMessage_DataType::charvalue(int index) const { + return charvalue_.Get(index); +} +inline ::std::string* GLMessage_DataType::mutable_charvalue(int index) { + return charvalue_.Mutable(index); +} +inline void GLMessage_DataType::set_charvalue(int index, const ::std::string& value) { + charvalue_.Mutable(index)->assign(value); +} +inline void GLMessage_DataType::set_charvalue(int index, const char* value) { + charvalue_.Mutable(index)->assign(value); +} +inline void GLMessage_DataType::set_charvalue(int index, const void* value, size_t size) { + charvalue_.Mutable(index)->assign( + reinterpret_cast<const char*>(value), size); +} +inline ::std::string* GLMessage_DataType::add_charvalue() { + return charvalue_.Add(); +} +inline void GLMessage_DataType::add_charvalue(const ::std::string& value) { + charvalue_.Add()->assign(value); +} +inline void GLMessage_DataType::add_charvalue(const char* value) { + charvalue_.Add()->assign(value); +} +inline void GLMessage_DataType::add_charvalue(const void* value, size_t size) { + charvalue_.Add()->assign(reinterpret_cast<const char*>(value), size); +} +inline const ::google::protobuf::RepeatedPtrField< ::std::string>& +GLMessage_DataType::charvalue() const { + return charvalue_; +} +inline ::google::protobuf::RepeatedPtrField< ::std::string>* +GLMessage_DataType::mutable_charvalue() { + return &charvalue_; +} + +// repeated bytes rawBytes = 6; +inline int GLMessage_DataType::rawbytes_size() const { + return rawbytes_.size(); +} +inline void GLMessage_DataType::clear_rawbytes() { + rawbytes_.Clear(); +} +inline const ::std::string& GLMessage_DataType::rawbytes(int index) const { + return rawbytes_.Get(index); +} +inline ::std::string* GLMessage_DataType::mutable_rawbytes(int index) { + return rawbytes_.Mutable(index); +} +inline void GLMessage_DataType::set_rawbytes(int index, const ::std::string& value) { + rawbytes_.Mutable(index)->assign(value); +} +inline void GLMessage_DataType::set_rawbytes(int index, const char* value) { + rawbytes_.Mutable(index)->assign(value); +} +inline void GLMessage_DataType::set_rawbytes(int index, const void* value, size_t size) { + rawbytes_.Mutable(index)->assign( + reinterpret_cast<const char*>(value), size); +} +inline ::std::string* GLMessage_DataType::add_rawbytes() { + return rawbytes_.Add(); +} +inline void GLMessage_DataType::add_rawbytes(const ::std::string& value) { + rawbytes_.Add()->assign(value); +} +inline void GLMessage_DataType::add_rawbytes(const char* value) { + rawbytes_.Add()->assign(value); +} +inline void GLMessage_DataType::add_rawbytes(const void* value, size_t size) { + rawbytes_.Add()->assign(reinterpret_cast<const char*>(value), size); +} +inline const ::google::protobuf::RepeatedPtrField< ::std::string>& +GLMessage_DataType::rawbytes() const { + return rawbytes_; +} +inline ::google::protobuf::RepeatedPtrField< ::std::string>* +GLMessage_DataType::mutable_rawbytes() { + return &rawbytes_; +} + +// repeated bool boolValue = 7; +inline int GLMessage_DataType::boolvalue_size() const { + return boolvalue_.size(); +} +inline void GLMessage_DataType::clear_boolvalue() { + boolvalue_.Clear(); +} +inline bool GLMessage_DataType::boolvalue(int index) const { + return boolvalue_.Get(index); +} +inline void GLMessage_DataType::set_boolvalue(int index, bool value) { + boolvalue_.Set(index, value); +} +inline void GLMessage_DataType::add_boolvalue(bool value) { + boolvalue_.Add(value); +} +inline const ::google::protobuf::RepeatedField< bool >& +GLMessage_DataType::boolvalue() const { + return boolvalue_; +} +inline ::google::protobuf::RepeatedField< bool >* +GLMessage_DataType::mutable_boolvalue() { + return &boolvalue_; +} + +// ------------------------------------------------------------------- + +// GLMessage_FrameBuffer + +// required int32 width = 1; +inline bool GLMessage_FrameBuffer::has_width() const { + return _has_bit(0); +} +inline void GLMessage_FrameBuffer::clear_width() { + width_ = 0; + _clear_bit(0); +} +inline ::google::protobuf::int32 GLMessage_FrameBuffer::width() const { + return width_; +} +inline void GLMessage_FrameBuffer::set_width(::google::protobuf::int32 value) { + _set_bit(0); + width_ = value; +} + +// required int32 height = 2; +inline bool GLMessage_FrameBuffer::has_height() const { + return _has_bit(1); +} +inline void GLMessage_FrameBuffer::clear_height() { + height_ = 0; + _clear_bit(1); +} +inline ::google::protobuf::int32 GLMessage_FrameBuffer::height() const { + return height_; +} +inline void GLMessage_FrameBuffer::set_height(::google::protobuf::int32 value) { + _set_bit(1); + height_ = value; +} + +// repeated bytes contents = 3; +inline int GLMessage_FrameBuffer::contents_size() const { + return contents_.size(); +} +inline void GLMessage_FrameBuffer::clear_contents() { + contents_.Clear(); +} +inline const ::std::string& GLMessage_FrameBuffer::contents(int index) const { + return contents_.Get(index); +} +inline ::std::string* GLMessage_FrameBuffer::mutable_contents(int index) { + return contents_.Mutable(index); +} +inline void GLMessage_FrameBuffer::set_contents(int index, const ::std::string& value) { + contents_.Mutable(index)->assign(value); +} +inline void GLMessage_FrameBuffer::set_contents(int index, const char* value) { + contents_.Mutable(index)->assign(value); +} +inline void GLMessage_FrameBuffer::set_contents(int index, const void* value, size_t size) { + contents_.Mutable(index)->assign( + reinterpret_cast<const char*>(value), size); +} +inline ::std::string* GLMessage_FrameBuffer::add_contents() { + return contents_.Add(); +} +inline void GLMessage_FrameBuffer::add_contents(const ::std::string& value) { + contents_.Add()->assign(value); +} +inline void GLMessage_FrameBuffer::add_contents(const char* value) { + contents_.Add()->assign(value); +} +inline void GLMessage_FrameBuffer::add_contents(const void* value, size_t size) { + contents_.Add()->assign(reinterpret_cast<const char*>(value), size); +} +inline const ::google::protobuf::RepeatedPtrField< ::std::string>& +GLMessage_FrameBuffer::contents() const { + return contents_; +} +inline ::google::protobuf::RepeatedPtrField< ::std::string>* +GLMessage_FrameBuffer::mutable_contents() { + return &contents_; +} + +// ------------------------------------------------------------------- + +// GLMessage + +// required int32 context_id = 1; +inline bool GLMessage::has_context_id() const { + return _has_bit(0); +} +inline void GLMessage::clear_context_id() { + context_id_ = 0; + _clear_bit(0); +} +inline ::google::protobuf::int32 GLMessage::context_id() const { + return context_id_; +} +inline void GLMessage::set_context_id(::google::protobuf::int32 value) { + _set_bit(0); + context_id_ = value; +} + +// required int64 start_time = 2; +inline bool GLMessage::has_start_time() const { + return _has_bit(1); +} +inline void GLMessage::clear_start_time() { + start_time_ = GOOGLE_LONGLONG(0); + _clear_bit(1); +} +inline ::google::protobuf::int64 GLMessage::start_time() const { + return start_time_; +} +inline void GLMessage::set_start_time(::google::protobuf::int64 value) { + _set_bit(1); + start_time_ = value; +} + +// required int32 duration = 3; +inline bool GLMessage::has_duration() const { + return _has_bit(2); +} +inline void GLMessage::clear_duration() { + duration_ = 0; + _clear_bit(2); +} +inline ::google::protobuf::int32 GLMessage::duration() const { + return duration_; +} +inline void GLMessage::set_duration(::google::protobuf::int32 value) { + _set_bit(2); + duration_ = value; +} + +// required .android.gltrace.GLMessage.Function function = 4 [default = invalid]; +inline bool GLMessage::has_function() const { + return _has_bit(3); +} +inline void GLMessage::clear_function() { + function_ = 3000; + _clear_bit(3); +} +inline ::android::gltrace::GLMessage_Function GLMessage::function() const { + return static_cast< ::android::gltrace::GLMessage_Function >(function_); +} +inline void GLMessage::set_function(::android::gltrace::GLMessage_Function value) { + GOOGLE_DCHECK(::android::gltrace::GLMessage_Function_IsValid(value)); + _set_bit(3); + function_ = value; +} + +// repeated .android.gltrace.GLMessage.DataType args = 5; +inline int GLMessage::args_size() const { + return args_.size(); +} +inline void GLMessage::clear_args() { + args_.Clear(); +} +inline const ::android::gltrace::GLMessage_DataType& GLMessage::args(int index) const { + return args_.Get(index); +} +inline ::android::gltrace::GLMessage_DataType* GLMessage::mutable_args(int index) { + return args_.Mutable(index); +} +inline ::android::gltrace::GLMessage_DataType* GLMessage::add_args() { + return args_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::android::gltrace::GLMessage_DataType >& +GLMessage::args() const { + return args_; +} +inline ::google::protobuf::RepeatedPtrField< ::android::gltrace::GLMessage_DataType >* +GLMessage::mutable_args() { + return &args_; +} + +// optional .android.gltrace.GLMessage.DataType returnValue = 6; +inline bool GLMessage::has_returnvalue() const { + return _has_bit(5); +} +inline void GLMessage::clear_returnvalue() { + if (returnvalue_ != NULL) returnvalue_->::android::gltrace::GLMessage_DataType::Clear(); + _clear_bit(5); +} +inline const ::android::gltrace::GLMessage_DataType& GLMessage::returnvalue() const { + return returnvalue_ != NULL ? *returnvalue_ : *default_instance_->returnvalue_; +} +inline ::android::gltrace::GLMessage_DataType* GLMessage::mutable_returnvalue() { + _set_bit(5); + if (returnvalue_ == NULL) returnvalue_ = new ::android::gltrace::GLMessage_DataType; + return returnvalue_; +} + +// optional .android.gltrace.GLMessage.FrameBuffer fb = 7; +inline bool GLMessage::has_fb() const { + return _has_bit(6); +} +inline void GLMessage::clear_fb() { + if (fb_ != NULL) fb_->::android::gltrace::GLMessage_FrameBuffer::Clear(); + _clear_bit(6); +} +inline const ::android::gltrace::GLMessage_FrameBuffer& GLMessage::fb() const { + return fb_ != NULL ? *fb_ : *default_instance_->fb_; +} +inline ::android::gltrace::GLMessage_FrameBuffer* GLMessage::mutable_fb() { + _set_bit(6); + if (fb_ == NULL) fb_ = new ::android::gltrace::GLMessage_FrameBuffer; + return fb_; +} + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace gltrace +} // namespace android + +// @@protoc_insertion_point(global_scope) + +#endif // PROTOBUF_gltrace_2eproto__INCLUDED diff --git a/opengl/libs/GLES_trace/src/gltrace_api.cpp b/opengl/libs/GLES_trace/src/gltrace_api.cpp new file mode 100644 index 0000000000..c8e820d823 --- /dev/null +++ b/opengl/libs/GLES_trace/src/gltrace_api.cpp @@ -0,0 +1,12296 @@ +/* + * Copyright 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. + * + * THIS FILE WAS GENERATED BY A SCRIPT. DO NOT EDIT. + */ + +#include <cutils/log.h> +#include <utils/Timers.h> +#include <GLES2/gl2.h> + +#include "gltrace.pb.h" +#include "gltrace_context.h" +#include "gltrace_fixup.h" +#include "gltrace_transport.h" + +namespace android { +namespace gltrace { + +// Definitions for GL2 APIs + +void GLTrace_glActiveTexture(GLenum texture) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glActiveTexture); + + // copy argument texture + GLMessage_DataType *arg_texture = glmsg.add_args(); + arg_texture->set_isarray(false); + arg_texture->set_type(GLMessage::DataType::ENUM); + arg_texture->add_intvalue((int)texture); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glActiveTexture(texture); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glAttachShader(GLuint program, GLuint shader) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glAttachShader); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // copy argument shader + GLMessage_DataType *arg_shader = glmsg.add_args(); + arg_shader->set_isarray(false); + arg_shader->set_type(GLMessage::DataType::INT); + arg_shader->add_intvalue(shader); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glAttachShader(program, shader); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glBindAttribLocation(GLuint program, GLuint index, const GLchar* name) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glBindAttribLocation); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // copy argument index + GLMessage_DataType *arg_index = glmsg.add_args(); + arg_index->set_isarray(false); + arg_index->set_type(GLMessage::DataType::INT); + arg_index->add_intvalue(index); + + // copy argument name + GLMessage_DataType *arg_name = glmsg.add_args(); + arg_name->set_isarray(false); + arg_name->set_type(GLMessage::DataType::INT); + arg_name->add_intvalue((int)name); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glBindAttribLocation(program, index, name); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glBindBuffer(GLenum target, GLuint buffer) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glBindBuffer); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument buffer + GLMessage_DataType *arg_buffer = glmsg.add_args(); + arg_buffer->set_isarray(false); + arg_buffer->set_type(GLMessage::DataType::INT); + arg_buffer->add_intvalue(buffer); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glBindBuffer(target, buffer); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glBindFramebuffer(GLenum target, GLuint framebuffer) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glBindFramebuffer); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument framebuffer + GLMessage_DataType *arg_framebuffer = glmsg.add_args(); + arg_framebuffer->set_isarray(false); + arg_framebuffer->set_type(GLMessage::DataType::INT); + arg_framebuffer->add_intvalue(framebuffer); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glBindFramebuffer(target, framebuffer); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glBindRenderbuffer(GLenum target, GLuint renderbuffer) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glBindRenderbuffer); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument renderbuffer + GLMessage_DataType *arg_renderbuffer = glmsg.add_args(); + arg_renderbuffer->set_isarray(false); + arg_renderbuffer->set_type(GLMessage::DataType::INT); + arg_renderbuffer->add_intvalue(renderbuffer); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glBindRenderbuffer(target, renderbuffer); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glBindTexture(GLenum target, GLuint texture) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glBindTexture); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument texture + GLMessage_DataType *arg_texture = glmsg.add_args(); + arg_texture->set_isarray(false); + arg_texture->set_type(GLMessage::DataType::INT); + arg_texture->add_intvalue(texture); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glBindTexture(target, texture); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glBlendColor); + + // copy argument red + GLMessage_DataType *arg_red = glmsg.add_args(); + arg_red->set_isarray(false); + arg_red->set_type(GLMessage::DataType::FLOAT); + arg_red->add_floatvalue(red); + + // copy argument green + GLMessage_DataType *arg_green = glmsg.add_args(); + arg_green->set_isarray(false); + arg_green->set_type(GLMessage::DataType::FLOAT); + arg_green->add_floatvalue(green); + + // copy argument blue + GLMessage_DataType *arg_blue = glmsg.add_args(); + arg_blue->set_isarray(false); + arg_blue->set_type(GLMessage::DataType::FLOAT); + arg_blue->add_floatvalue(blue); + + // copy argument alpha + GLMessage_DataType *arg_alpha = glmsg.add_args(); + arg_alpha->set_isarray(false); + arg_alpha->set_type(GLMessage::DataType::FLOAT); + arg_alpha->add_floatvalue(alpha); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glBlendColor(red, green, blue, alpha); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glBlendEquation(GLenum mode) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glBlendEquation); + + // copy argument mode + GLMessage_DataType *arg_mode = glmsg.add_args(); + arg_mode->set_isarray(false); + arg_mode->set_type(GLMessage::DataType::ENUM); + arg_mode->add_intvalue((int)mode); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glBlendEquation(mode); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glBlendEquationSeparate); + + // copy argument modeRGB + GLMessage_DataType *arg_modeRGB = glmsg.add_args(); + arg_modeRGB->set_isarray(false); + arg_modeRGB->set_type(GLMessage::DataType::ENUM); + arg_modeRGB->add_intvalue((int)modeRGB); + + // copy argument modeAlpha + GLMessage_DataType *arg_modeAlpha = glmsg.add_args(); + arg_modeAlpha->set_isarray(false); + arg_modeAlpha->set_type(GLMessage::DataType::ENUM); + arg_modeAlpha->add_intvalue((int)modeAlpha); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glBlendEquationSeparate(modeRGB, modeAlpha); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glBlendFunc(GLenum sfactor, GLenum dfactor) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glBlendFunc); + + // copy argument sfactor + GLMessage_DataType *arg_sfactor = glmsg.add_args(); + arg_sfactor->set_isarray(false); + arg_sfactor->set_type(GLMessage::DataType::ENUM); + arg_sfactor->add_intvalue((int)sfactor); + + // copy argument dfactor + GLMessage_DataType *arg_dfactor = glmsg.add_args(); + arg_dfactor->set_isarray(false); + arg_dfactor->set_type(GLMessage::DataType::ENUM); + arg_dfactor->add_intvalue((int)dfactor); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glBlendFunc(sfactor, dfactor); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glBlendFuncSeparate); + + // copy argument srcRGB + GLMessage_DataType *arg_srcRGB = glmsg.add_args(); + arg_srcRGB->set_isarray(false); + arg_srcRGB->set_type(GLMessage::DataType::ENUM); + arg_srcRGB->add_intvalue((int)srcRGB); + + // copy argument dstRGB + GLMessage_DataType *arg_dstRGB = glmsg.add_args(); + arg_dstRGB->set_isarray(false); + arg_dstRGB->set_type(GLMessage::DataType::ENUM); + arg_dstRGB->add_intvalue((int)dstRGB); + + // copy argument srcAlpha + GLMessage_DataType *arg_srcAlpha = glmsg.add_args(); + arg_srcAlpha->set_isarray(false); + arg_srcAlpha->set_type(GLMessage::DataType::ENUM); + arg_srcAlpha->add_intvalue((int)srcAlpha); + + // copy argument dstAlpha + GLMessage_DataType *arg_dstAlpha = glmsg.add_args(); + arg_dstAlpha->set_isarray(false); + arg_dstAlpha->set_type(GLMessage::DataType::ENUM); + arg_dstAlpha->add_intvalue((int)dstAlpha); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glBufferData); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument size + GLMessage_DataType *arg_size = glmsg.add_args(); + arg_size->set_isarray(false); + arg_size->set_type(GLMessage::DataType::INT); + arg_size->add_intvalue((int)size); + + // copy argument data + GLMessage_DataType *arg_data = glmsg.add_args(); + arg_data->set_isarray(false); + arg_data->set_type(GLMessage::DataType::INT); + arg_data->add_intvalue((int)data); + + // copy argument usage + GLMessage_DataType *arg_usage = glmsg.add_args(); + arg_usage->set_isarray(false); + arg_usage->set_type(GLMessage::DataType::ENUM); + arg_usage->add_intvalue((int)usage); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glBufferData(target, size, data, usage); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glBufferSubData); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument offset + GLMessage_DataType *arg_offset = glmsg.add_args(); + arg_offset->set_isarray(false); + arg_offset->set_type(GLMessage::DataType::INT); + arg_offset->add_intvalue((int)offset); + + // copy argument size + GLMessage_DataType *arg_size = glmsg.add_args(); + arg_size->set_isarray(false); + arg_size->set_type(GLMessage::DataType::INT); + arg_size->add_intvalue((int)size); + + // copy argument data + GLMessage_DataType *arg_data = glmsg.add_args(); + arg_data->set_isarray(false); + arg_data->set_type(GLMessage::DataType::INT); + arg_data->add_intvalue((int)data); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glBufferSubData(target, offset, size, data); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +GLenum GLTrace_glCheckFramebufferStatus(GLenum target) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glCheckFramebufferStatus); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // call function + nsecs_t start_time = systemTime(); + GLenum retValue = glContext->hooks->gl.glCheckFramebufferStatus(target); + nsecs_t end_time = systemTime(); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::ENUM); + rt->add_intvalue((int)retValue); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +void GLTrace_glClear(GLbitfield mask) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glClear); + + // copy argument mask + GLMessage_DataType *arg_mask = glmsg.add_args(); + arg_mask->set_isarray(false); + arg_mask->set_type(GLMessage::DataType::INT); + arg_mask->add_intvalue(mask); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glClear(mask); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glClearColor); + + // copy argument red + GLMessage_DataType *arg_red = glmsg.add_args(); + arg_red->set_isarray(false); + arg_red->set_type(GLMessage::DataType::FLOAT); + arg_red->add_floatvalue(red); + + // copy argument green + GLMessage_DataType *arg_green = glmsg.add_args(); + arg_green->set_isarray(false); + arg_green->set_type(GLMessage::DataType::FLOAT); + arg_green->add_floatvalue(green); + + // copy argument blue + GLMessage_DataType *arg_blue = glmsg.add_args(); + arg_blue->set_isarray(false); + arg_blue->set_type(GLMessage::DataType::FLOAT); + arg_blue->add_floatvalue(blue); + + // copy argument alpha + GLMessage_DataType *arg_alpha = glmsg.add_args(); + arg_alpha->set_isarray(false); + arg_alpha->set_type(GLMessage::DataType::FLOAT); + arg_alpha->add_floatvalue(alpha); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glClearColor(red, green, blue, alpha); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glClearDepthf(GLclampf depth) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glClearDepthf); + + // copy argument depth + GLMessage_DataType *arg_depth = glmsg.add_args(); + arg_depth->set_isarray(false); + arg_depth->set_type(GLMessage::DataType::FLOAT); + arg_depth->add_floatvalue(depth); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glClearDepthf(depth); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glClearStencil(GLint s) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glClearStencil); + + // copy argument s + GLMessage_DataType *arg_s = glmsg.add_args(); + arg_s->set_isarray(false); + arg_s->set_type(GLMessage::DataType::INT); + arg_s->add_intvalue(s); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glClearStencil(s); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glColorMask); + + // copy argument red + GLMessage_DataType *arg_red = glmsg.add_args(); + arg_red->set_isarray(false); + arg_red->set_type(GLMessage::DataType::BOOL); + arg_red->add_boolvalue(red); + + // copy argument green + GLMessage_DataType *arg_green = glmsg.add_args(); + arg_green->set_isarray(false); + arg_green->set_type(GLMessage::DataType::BOOL); + arg_green->add_boolvalue(green); + + // copy argument blue + GLMessage_DataType *arg_blue = glmsg.add_args(); + arg_blue->set_isarray(false); + arg_blue->set_type(GLMessage::DataType::BOOL); + arg_blue->add_boolvalue(blue); + + // copy argument alpha + GLMessage_DataType *arg_alpha = glmsg.add_args(); + arg_alpha->set_isarray(false); + arg_alpha->set_type(GLMessage::DataType::BOOL); + arg_alpha->add_boolvalue(alpha); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glColorMask(red, green, blue, alpha); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glCompileShader(GLuint shader) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glCompileShader); + + // copy argument shader + GLMessage_DataType *arg_shader = glmsg.add_args(); + arg_shader->set_isarray(false); + arg_shader->set_type(GLMessage::DataType::INT); + arg_shader->add_intvalue(shader); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glCompileShader(shader); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glCompressedTexImage2D); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument level + GLMessage_DataType *arg_level = glmsg.add_args(); + arg_level->set_isarray(false); + arg_level->set_type(GLMessage::DataType::INT); + arg_level->add_intvalue(level); + + // copy argument internalformat + GLMessage_DataType *arg_internalformat = glmsg.add_args(); + arg_internalformat->set_isarray(false); + arg_internalformat->set_type(GLMessage::DataType::ENUM); + arg_internalformat->add_intvalue((int)internalformat); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); + + // copy argument border + GLMessage_DataType *arg_border = glmsg.add_args(); + arg_border->set_isarray(false); + arg_border->set_type(GLMessage::DataType::INT); + arg_border->add_intvalue(border); + + // copy argument imageSize + GLMessage_DataType *arg_imageSize = glmsg.add_args(); + arg_imageSize->set_isarray(false); + arg_imageSize->set_type(GLMessage::DataType::INT); + arg_imageSize->add_intvalue(imageSize); + + // copy argument data + GLMessage_DataType *arg_data = glmsg.add_args(); + arg_data->set_isarray(false); + arg_data->set_type(GLMessage::DataType::INT); + arg_data->add_intvalue((int)data); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glCompressedTexSubImage2D); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument level + GLMessage_DataType *arg_level = glmsg.add_args(); + arg_level->set_isarray(false); + arg_level->set_type(GLMessage::DataType::INT); + arg_level->add_intvalue(level); + + // copy argument xoffset + GLMessage_DataType *arg_xoffset = glmsg.add_args(); + arg_xoffset->set_isarray(false); + arg_xoffset->set_type(GLMessage::DataType::INT); + arg_xoffset->add_intvalue(xoffset); + + // copy argument yoffset + GLMessage_DataType *arg_yoffset = glmsg.add_args(); + arg_yoffset->set_isarray(false); + arg_yoffset->set_type(GLMessage::DataType::INT); + arg_yoffset->add_intvalue(yoffset); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); + + // copy argument format + GLMessage_DataType *arg_format = glmsg.add_args(); + arg_format->set_isarray(false); + arg_format->set_type(GLMessage::DataType::ENUM); + arg_format->add_intvalue((int)format); + + // copy argument imageSize + GLMessage_DataType *arg_imageSize = glmsg.add_args(); + arg_imageSize->set_isarray(false); + arg_imageSize->set_type(GLMessage::DataType::INT); + arg_imageSize->add_intvalue(imageSize); + + // copy argument data + GLMessage_DataType *arg_data = glmsg.add_args(); + arg_data->set_isarray(false); + arg_data->set_type(GLMessage::DataType::INT); + arg_data->add_intvalue((int)data); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glCopyTexImage2D); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument level + GLMessage_DataType *arg_level = glmsg.add_args(); + arg_level->set_isarray(false); + arg_level->set_type(GLMessage::DataType::INT); + arg_level->add_intvalue(level); + + // copy argument internalformat + GLMessage_DataType *arg_internalformat = glmsg.add_args(); + arg_internalformat->set_isarray(false); + arg_internalformat->set_type(GLMessage::DataType::ENUM); + arg_internalformat->add_intvalue((int)internalformat); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); + + // copy argument border + GLMessage_DataType *arg_border = glmsg.add_args(); + arg_border->set_isarray(false); + arg_border->set_type(GLMessage::DataType::INT); + arg_border->add_intvalue(border); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glCopyTexImage2D(target, level, internalformat, x, y, width, height, border); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glCopyTexSubImage2D); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument level + GLMessage_DataType *arg_level = glmsg.add_args(); + arg_level->set_isarray(false); + arg_level->set_type(GLMessage::DataType::INT); + arg_level->add_intvalue(level); + + // copy argument xoffset + GLMessage_DataType *arg_xoffset = glmsg.add_args(); + arg_xoffset->set_isarray(false); + arg_xoffset->set_type(GLMessage::DataType::INT); + arg_xoffset->add_intvalue(xoffset); + + // copy argument yoffset + GLMessage_DataType *arg_yoffset = glmsg.add_args(); + arg_yoffset->set_isarray(false); + arg_yoffset->set_type(GLMessage::DataType::INT); + arg_yoffset->add_intvalue(yoffset); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +GLuint GLTrace_glCreateProgram(void) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glCreateProgram); + + // call function + nsecs_t start_time = systemTime(); + GLuint retValue = glContext->hooks->gl.glCreateProgram(); + nsecs_t end_time = systemTime(); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::INT); + rt->add_intvalue(retValue); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +GLuint GLTrace_glCreateShader(GLenum type) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glCreateShader); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); + + // call function + nsecs_t start_time = systemTime(); + GLuint retValue = glContext->hooks->gl.glCreateShader(type); + nsecs_t end_time = systemTime(); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::INT); + rt->add_intvalue(retValue); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +void GLTrace_glCullFace(GLenum mode) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glCullFace); + + // copy argument mode + GLMessage_DataType *arg_mode = glmsg.add_args(); + arg_mode->set_isarray(false); + arg_mode->set_type(GLMessage::DataType::ENUM); + arg_mode->add_intvalue((int)mode); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glCullFace(mode); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDeleteBuffers(GLsizei n, const GLuint* buffers) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDeleteBuffers); + + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); + + // copy argument buffers + GLMessage_DataType *arg_buffers = glmsg.add_args(); + arg_buffers->set_isarray(false); + arg_buffers->set_type(GLMessage::DataType::INT); + arg_buffers->add_intvalue((int)buffers); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDeleteBuffers(n, buffers); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDeleteFramebuffers); + + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); + + // copy argument framebuffers + GLMessage_DataType *arg_framebuffers = glmsg.add_args(); + arg_framebuffers->set_isarray(false); + arg_framebuffers->set_type(GLMessage::DataType::INT); + arg_framebuffers->add_intvalue((int)framebuffers); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDeleteFramebuffers(n, framebuffers); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDeleteProgram(GLuint program) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDeleteProgram); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDeleteProgram(program); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDeleteRenderbuffers); + + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); + + // copy argument renderbuffers + GLMessage_DataType *arg_renderbuffers = glmsg.add_args(); + arg_renderbuffers->set_isarray(false); + arg_renderbuffers->set_type(GLMessage::DataType::INT); + arg_renderbuffers->add_intvalue((int)renderbuffers); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDeleteRenderbuffers(n, renderbuffers); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDeleteShader(GLuint shader) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDeleteShader); + + // copy argument shader + GLMessage_DataType *arg_shader = glmsg.add_args(); + arg_shader->set_isarray(false); + arg_shader->set_type(GLMessage::DataType::INT); + arg_shader->add_intvalue(shader); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDeleteShader(shader); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDeleteTextures(GLsizei n, const GLuint* textures) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDeleteTextures); + + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); + + // copy argument textures + GLMessage_DataType *arg_textures = glmsg.add_args(); + arg_textures->set_isarray(false); + arg_textures->set_type(GLMessage::DataType::INT); + arg_textures->add_intvalue((int)textures); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDeleteTextures(n, textures); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDepthFunc(GLenum func) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDepthFunc); + + // copy argument func + GLMessage_DataType *arg_func = glmsg.add_args(); + arg_func->set_isarray(false); + arg_func->set_type(GLMessage::DataType::ENUM); + arg_func->add_intvalue((int)func); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDepthFunc(func); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDepthMask(GLboolean flag) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDepthMask); + + // copy argument flag + GLMessage_DataType *arg_flag = glmsg.add_args(); + arg_flag->set_isarray(false); + arg_flag->set_type(GLMessage::DataType::BOOL); + arg_flag->add_boolvalue(flag); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDepthMask(flag); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDepthRangef(GLclampf zNear, GLclampf zFar) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDepthRangef); + + // copy argument zNear + GLMessage_DataType *arg_zNear = glmsg.add_args(); + arg_zNear->set_isarray(false); + arg_zNear->set_type(GLMessage::DataType::FLOAT); + arg_zNear->add_floatvalue(zNear); + + // copy argument zFar + GLMessage_DataType *arg_zFar = glmsg.add_args(); + arg_zFar->set_isarray(false); + arg_zFar->set_type(GLMessage::DataType::FLOAT); + arg_zFar->add_floatvalue(zFar); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDepthRangef(zNear, zFar); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDetachShader(GLuint program, GLuint shader) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDetachShader); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // copy argument shader + GLMessage_DataType *arg_shader = glmsg.add_args(); + arg_shader->set_isarray(false); + arg_shader->set_type(GLMessage::DataType::INT); + arg_shader->add_intvalue(shader); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDetachShader(program, shader); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDisable(GLenum cap) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDisable); + + // copy argument cap + GLMessage_DataType *arg_cap = glmsg.add_args(); + arg_cap->set_isarray(false); + arg_cap->set_type(GLMessage::DataType::ENUM); + arg_cap->add_intvalue((int)cap); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDisable(cap); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDisableVertexAttribArray(GLuint index) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDisableVertexAttribArray); + + // copy argument index + GLMessage_DataType *arg_index = glmsg.add_args(); + arg_index->set_isarray(false); + arg_index->set_type(GLMessage::DataType::INT); + arg_index->add_intvalue(index); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDisableVertexAttribArray(index); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDrawArrays(GLenum mode, GLint first, GLsizei count) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDrawArrays); + + // copy argument mode + GLMessage_DataType *arg_mode = glmsg.add_args(); + arg_mode->set_isarray(false); + arg_mode->set_type(GLMessage::DataType::ENUM); + arg_mode->add_intvalue((int)mode); + + // copy argument first + GLMessage_DataType *arg_first = glmsg.add_args(); + arg_first->set_isarray(false); + arg_first->set_type(GLMessage::DataType::INT); + arg_first->add_intvalue(first); + + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue(count); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDrawArrays(mode, first, count); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDrawElements); + + // copy argument mode + GLMessage_DataType *arg_mode = glmsg.add_args(); + arg_mode->set_isarray(false); + arg_mode->set_type(GLMessage::DataType::ENUM); + arg_mode->add_intvalue((int)mode); + + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue(count); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); + + // copy argument indices + GLMessage_DataType *arg_indices = glmsg.add_args(); + arg_indices->set_isarray(false); + arg_indices->set_type(GLMessage::DataType::INT); + arg_indices->add_intvalue((int)indices); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDrawElements(mode, count, type, indices); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glEnable(GLenum cap) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glEnable); + + // copy argument cap + GLMessage_DataType *arg_cap = glmsg.add_args(); + arg_cap->set_isarray(false); + arg_cap->set_type(GLMessage::DataType::ENUM); + arg_cap->add_intvalue((int)cap); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glEnable(cap); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glEnableVertexAttribArray(GLuint index) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glEnableVertexAttribArray); + + // copy argument index + GLMessage_DataType *arg_index = glmsg.add_args(); + arg_index->set_isarray(false); + arg_index->set_type(GLMessage::DataType::INT); + arg_index->add_intvalue(index); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glEnableVertexAttribArray(index); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glFinish(void) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glFinish); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glFinish(); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glFlush(void) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glFlush); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glFlush(); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glFramebufferRenderbuffer); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument attachment + GLMessage_DataType *arg_attachment = glmsg.add_args(); + arg_attachment->set_isarray(false); + arg_attachment->set_type(GLMessage::DataType::ENUM); + arg_attachment->add_intvalue((int)attachment); + + // copy argument renderbuffertarget + GLMessage_DataType *arg_renderbuffertarget = glmsg.add_args(); + arg_renderbuffertarget->set_isarray(false); + arg_renderbuffertarget->set_type(GLMessage::DataType::ENUM); + arg_renderbuffertarget->add_intvalue((int)renderbuffertarget); + + // copy argument renderbuffer + GLMessage_DataType *arg_renderbuffer = glmsg.add_args(); + arg_renderbuffer->set_isarray(false); + arg_renderbuffer->set_type(GLMessage::DataType::INT); + arg_renderbuffer->add_intvalue(renderbuffer); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glFramebufferTexture2D); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument attachment + GLMessage_DataType *arg_attachment = glmsg.add_args(); + arg_attachment->set_isarray(false); + arg_attachment->set_type(GLMessage::DataType::ENUM); + arg_attachment->add_intvalue((int)attachment); + + // copy argument textarget + GLMessage_DataType *arg_textarget = glmsg.add_args(); + arg_textarget->set_isarray(false); + arg_textarget->set_type(GLMessage::DataType::ENUM); + arg_textarget->add_intvalue((int)textarget); + + // copy argument texture + GLMessage_DataType *arg_texture = glmsg.add_args(); + arg_texture->set_isarray(false); + arg_texture->set_type(GLMessage::DataType::INT); + arg_texture->add_intvalue(texture); + + // copy argument level + GLMessage_DataType *arg_level = glmsg.add_args(); + arg_level->set_isarray(false); + arg_level->set_type(GLMessage::DataType::INT); + arg_level->add_intvalue(level); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glFramebufferTexture2D(target, attachment, textarget, texture, level); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glFrontFace(GLenum mode) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glFrontFace); + + // copy argument mode + GLMessage_DataType *arg_mode = glmsg.add_args(); + arg_mode->set_isarray(false); + arg_mode->set_type(GLMessage::DataType::ENUM); + arg_mode->add_intvalue((int)mode); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glFrontFace(mode); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGenBuffers(GLsizei n, GLuint* buffers) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGenBuffers); + + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); + + // copy argument buffers + GLMessage_DataType *arg_buffers = glmsg.add_args(); + arg_buffers->set_isarray(false); + arg_buffers->set_type(GLMessage::DataType::INT); + arg_buffers->add_intvalue((int)buffers); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGenBuffers(n, buffers); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGenerateMipmap(GLenum target) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGenerateMipmap); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGenerateMipmap(target); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGenFramebuffers(GLsizei n, GLuint* framebuffers) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGenFramebuffers); + + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); + + // copy argument framebuffers + GLMessage_DataType *arg_framebuffers = glmsg.add_args(); + arg_framebuffers->set_isarray(false); + arg_framebuffers->set_type(GLMessage::DataType::INT); + arg_framebuffers->add_intvalue((int)framebuffers); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGenFramebuffers(n, framebuffers); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGenRenderbuffers(GLsizei n, GLuint* renderbuffers) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGenRenderbuffers); + + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); + + // copy argument renderbuffers + GLMessage_DataType *arg_renderbuffers = glmsg.add_args(); + arg_renderbuffers->set_isarray(false); + arg_renderbuffers->set_type(GLMessage::DataType::INT); + arg_renderbuffers->add_intvalue((int)renderbuffers); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGenRenderbuffers(n, renderbuffers); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGenTextures(GLsizei n, GLuint* textures) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGenTextures); + + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); + + // copy argument textures + GLMessage_DataType *arg_textures = glmsg.add_args(); + arg_textures->set_isarray(false); + arg_textures->set_type(GLMessage::DataType::INT); + arg_textures->add_intvalue((int)textures); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGenTextures(n, textures); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetActiveAttrib); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // copy argument index + GLMessage_DataType *arg_index = glmsg.add_args(); + arg_index->set_isarray(false); + arg_index->set_type(GLMessage::DataType::INT); + arg_index->add_intvalue(index); + + // copy argument bufsize + GLMessage_DataType *arg_bufsize = glmsg.add_args(); + arg_bufsize->set_isarray(false); + arg_bufsize->set_type(GLMessage::DataType::INT); + arg_bufsize->add_intvalue(bufsize); + + // copy argument length + GLMessage_DataType *arg_length = glmsg.add_args(); + arg_length->set_isarray(false); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue((int)length); + + // copy argument size + GLMessage_DataType *arg_size = glmsg.add_args(); + arg_size->set_isarray(false); + arg_size->set_type(GLMessage::DataType::INT); + arg_size->add_intvalue((int)size); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::INT); + arg_type->add_intvalue((int)type); + + // copy argument name + GLMessage_DataType *arg_name = glmsg.add_args(); + arg_name->set_isarray(false); + arg_name->set_type(GLMessage::DataType::INT); + arg_name->add_intvalue((int)name); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetActiveAttrib(program, index, bufsize, length, size, type, name); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetActiveUniform); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // copy argument index + GLMessage_DataType *arg_index = glmsg.add_args(); + arg_index->set_isarray(false); + arg_index->set_type(GLMessage::DataType::INT); + arg_index->add_intvalue(index); + + // copy argument bufsize + GLMessage_DataType *arg_bufsize = glmsg.add_args(); + arg_bufsize->set_isarray(false); + arg_bufsize->set_type(GLMessage::DataType::INT); + arg_bufsize->add_intvalue(bufsize); + + // copy argument length + GLMessage_DataType *arg_length = glmsg.add_args(); + arg_length->set_isarray(false); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue((int)length); + + // copy argument size + GLMessage_DataType *arg_size = glmsg.add_args(); + arg_size->set_isarray(false); + arg_size->set_type(GLMessage::DataType::INT); + arg_size->add_intvalue((int)size); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::INT); + arg_type->add_intvalue((int)type); + + // copy argument name + GLMessage_DataType *arg_name = glmsg.add_args(); + arg_name->set_isarray(false); + arg_name->set_type(GLMessage::DataType::INT); + arg_name->add_intvalue((int)name); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetActiveUniform(program, index, bufsize, length, size, type, name); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetAttachedShaders); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // copy argument maxcount + GLMessage_DataType *arg_maxcount = glmsg.add_args(); + arg_maxcount->set_isarray(false); + arg_maxcount->set_type(GLMessage::DataType::INT); + arg_maxcount->add_intvalue(maxcount); + + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue((int)count); + + // copy argument shaders + GLMessage_DataType *arg_shaders = glmsg.add_args(); + arg_shaders->set_isarray(false); + arg_shaders->set_type(GLMessage::DataType::INT); + arg_shaders->add_intvalue((int)shaders); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetAttachedShaders(program, maxcount, count, shaders); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +int GLTrace_glGetAttribLocation(GLuint program, const GLchar* name) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetAttribLocation); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // copy argument name + GLMessage_DataType *arg_name = glmsg.add_args(); + arg_name->set_isarray(false); + arg_name->set_type(GLMessage::DataType::INT); + arg_name->add_intvalue((int)name); + + // call function + nsecs_t start_time = systemTime(); + int retValue = glContext->hooks->gl.glGetAttribLocation(program, name); + nsecs_t end_time = systemTime(); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::INT); + rt->add_intvalue(retValue); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +void GLTrace_glGetBooleanv(GLenum pname, GLboolean* params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetBooleanv); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetBooleanv(pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetBufferParameteriv); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetBufferParameteriv(target, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +GLenum GLTrace_glGetError(void) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetError); + + // call function + nsecs_t start_time = systemTime(); + GLenum retValue = glContext->hooks->gl.glGetError(); + nsecs_t end_time = systemTime(); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::ENUM); + rt->add_intvalue((int)retValue); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +void GLTrace_glGetFloatv(GLenum pname, GLfloat* params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetFloatv); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetFloatv(pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetFramebufferAttachmentParameteriv); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument attachment + GLMessage_DataType *arg_attachment = glmsg.add_args(); + arg_attachment->set_isarray(false); + arg_attachment->set_type(GLMessage::DataType::ENUM); + arg_attachment->add_intvalue((int)attachment); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetFramebufferAttachmentParameteriv(target, attachment, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetIntegerv(GLenum pname, GLint* params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetIntegerv); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetIntegerv(pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetProgramiv(GLuint program, GLenum pname, GLint* params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetProgramiv); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetProgramiv(program, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetProgramInfoLog); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // copy argument bufsize + GLMessage_DataType *arg_bufsize = glmsg.add_args(); + arg_bufsize->set_isarray(false); + arg_bufsize->set_type(GLMessage::DataType::INT); + arg_bufsize->add_intvalue(bufsize); + + // copy argument length + GLMessage_DataType *arg_length = glmsg.add_args(); + arg_length->set_isarray(false); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue((int)length); + + // copy argument infolog + GLMessage_DataType *arg_infolog = glmsg.add_args(); + arg_infolog->set_isarray(false); + arg_infolog->set_type(GLMessage::DataType::INT); + arg_infolog->add_intvalue((int)infolog); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetProgramInfoLog(program, bufsize, length, infolog); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetRenderbufferParameteriv); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetRenderbufferParameteriv(target, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetShaderiv(GLuint shader, GLenum pname, GLint* params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetShaderiv); + + // copy argument shader + GLMessage_DataType *arg_shader = glmsg.add_args(); + arg_shader->set_isarray(false); + arg_shader->set_type(GLMessage::DataType::INT); + arg_shader->add_intvalue(shader); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetShaderiv(shader, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetShaderInfoLog); + + // copy argument shader + GLMessage_DataType *arg_shader = glmsg.add_args(); + arg_shader->set_isarray(false); + arg_shader->set_type(GLMessage::DataType::INT); + arg_shader->add_intvalue(shader); + + // copy argument bufsize + GLMessage_DataType *arg_bufsize = glmsg.add_args(); + arg_bufsize->set_isarray(false); + arg_bufsize->set_type(GLMessage::DataType::INT); + arg_bufsize->add_intvalue(bufsize); + + // copy argument length + GLMessage_DataType *arg_length = glmsg.add_args(); + arg_length->set_isarray(false); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue((int)length); + + // copy argument infolog + GLMessage_DataType *arg_infolog = glmsg.add_args(); + arg_infolog->set_isarray(false); + arg_infolog->set_type(GLMessage::DataType::INT); + arg_infolog->add_intvalue((int)infolog); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetShaderInfoLog(shader, bufsize, length, infolog); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetShaderPrecisionFormat); + + // copy argument shadertype + GLMessage_DataType *arg_shadertype = glmsg.add_args(); + arg_shadertype->set_isarray(false); + arg_shadertype->set_type(GLMessage::DataType::ENUM); + arg_shadertype->add_intvalue((int)shadertype); + + // copy argument precisiontype + GLMessage_DataType *arg_precisiontype = glmsg.add_args(); + arg_precisiontype->set_isarray(false); + arg_precisiontype->set_type(GLMessage::DataType::ENUM); + arg_precisiontype->add_intvalue((int)precisiontype); + + // copy argument range + GLMessage_DataType *arg_range = glmsg.add_args(); + arg_range->set_isarray(false); + arg_range->set_type(GLMessage::DataType::INT); + arg_range->add_intvalue((int)range); + + // copy argument precision + GLMessage_DataType *arg_precision = glmsg.add_args(); + arg_precision->set_isarray(false); + arg_precision->set_type(GLMessage::DataType::INT); + arg_precision->add_intvalue((int)precision); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetShaderSource); + + // copy argument shader + GLMessage_DataType *arg_shader = glmsg.add_args(); + arg_shader->set_isarray(false); + arg_shader->set_type(GLMessage::DataType::INT); + arg_shader->add_intvalue(shader); + + // copy argument bufsize + GLMessage_DataType *arg_bufsize = glmsg.add_args(); + arg_bufsize->set_isarray(false); + arg_bufsize->set_type(GLMessage::DataType::INT); + arg_bufsize->add_intvalue(bufsize); + + // copy argument length + GLMessage_DataType *arg_length = glmsg.add_args(); + arg_length->set_isarray(false); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue((int)length); + + // copy argument source + GLMessage_DataType *arg_source = glmsg.add_args(); + arg_source->set_isarray(false); + arg_source->set_type(GLMessage::DataType::INT); + arg_source->add_intvalue((int)source); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetShaderSource(shader, bufsize, length, source); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +const GLubyte* GLTrace_glGetString(GLenum name) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetString); + + // copy argument name + GLMessage_DataType *arg_name = glmsg.add_args(); + arg_name->set_isarray(false); + arg_name->set_type(GLMessage::DataType::ENUM); + arg_name->add_intvalue((int)name); + + // call function + nsecs_t start_time = systemTime(); + const GLubyte* retValue = glContext->hooks->gl.glGetString(name); + nsecs_t end_time = systemTime(); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::INT); + rt->add_intvalue((int)retValue); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +void GLTrace_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetTexParameterfv); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetTexParameterfv(target, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetTexParameteriv(GLenum target, GLenum pname, GLint* params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetTexParameteriv); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetTexParameteriv(target, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetUniformfv(GLuint program, GLint location, GLfloat* params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetUniformfv); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetUniformfv(program, location, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetUniformiv(GLuint program, GLint location, GLint* params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetUniformiv); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetUniformiv(program, location, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +int GLTrace_glGetUniformLocation(GLuint program, const GLchar* name) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetUniformLocation); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // copy argument name + GLMessage_DataType *arg_name = glmsg.add_args(); + arg_name->set_isarray(false); + arg_name->set_type(GLMessage::DataType::INT); + arg_name->add_intvalue((int)name); + + // call function + nsecs_t start_time = systemTime(); + int retValue = glContext->hooks->gl.glGetUniformLocation(program, name); + nsecs_t end_time = systemTime(); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::INT); + rt->add_intvalue(retValue); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +void GLTrace_glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetVertexAttribfv); + + // copy argument index + GLMessage_DataType *arg_index = glmsg.add_args(); + arg_index->set_isarray(false); + arg_index->set_type(GLMessage::DataType::INT); + arg_index->add_intvalue(index); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetVertexAttribfv(index, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetVertexAttribiv); + + // copy argument index + GLMessage_DataType *arg_index = glmsg.add_args(); + arg_index->set_isarray(false); + arg_index->set_type(GLMessage::DataType::INT); + arg_index->add_intvalue(index); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetVertexAttribiv(index, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetVertexAttribPointerv); + + // copy argument index + GLMessage_DataType *arg_index = glmsg.add_args(); + arg_index->set_isarray(false); + arg_index->set_type(GLMessage::DataType::INT); + arg_index->add_intvalue(index); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument pointer + GLMessage_DataType *arg_pointer = glmsg.add_args(); + arg_pointer->set_isarray(false); + arg_pointer->set_type(GLMessage::DataType::INT); + arg_pointer->add_intvalue((int)pointer); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetVertexAttribPointerv(index, pname, pointer); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glHint(GLenum target, GLenum mode) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glHint); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument mode + GLMessage_DataType *arg_mode = glmsg.add_args(); + arg_mode->set_isarray(false); + arg_mode->set_type(GLMessage::DataType::ENUM); + arg_mode->add_intvalue((int)mode); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glHint(target, mode); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +GLboolean GLTrace_glIsBuffer(GLuint buffer) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glIsBuffer); + + // copy argument buffer + GLMessage_DataType *arg_buffer = glmsg.add_args(); + arg_buffer->set_isarray(false); + arg_buffer->set_type(GLMessage::DataType::INT); + arg_buffer->add_intvalue(buffer); + + // call function + nsecs_t start_time = systemTime(); + GLboolean retValue = glContext->hooks->gl.glIsBuffer(buffer); + nsecs_t end_time = systemTime(); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::BOOL); + rt->add_boolvalue(retValue); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +GLboolean GLTrace_glIsEnabled(GLenum cap) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glIsEnabled); + + // copy argument cap + GLMessage_DataType *arg_cap = glmsg.add_args(); + arg_cap->set_isarray(false); + arg_cap->set_type(GLMessage::DataType::ENUM); + arg_cap->add_intvalue((int)cap); + + // call function + nsecs_t start_time = systemTime(); + GLboolean retValue = glContext->hooks->gl.glIsEnabled(cap); + nsecs_t end_time = systemTime(); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::BOOL); + rt->add_boolvalue(retValue); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +GLboolean GLTrace_glIsFramebuffer(GLuint framebuffer) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glIsFramebuffer); + + // copy argument framebuffer + GLMessage_DataType *arg_framebuffer = glmsg.add_args(); + arg_framebuffer->set_isarray(false); + arg_framebuffer->set_type(GLMessage::DataType::INT); + arg_framebuffer->add_intvalue(framebuffer); + + // call function + nsecs_t start_time = systemTime(); + GLboolean retValue = glContext->hooks->gl.glIsFramebuffer(framebuffer); + nsecs_t end_time = systemTime(); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::BOOL); + rt->add_boolvalue(retValue); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +GLboolean GLTrace_glIsProgram(GLuint program) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glIsProgram); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // call function + nsecs_t start_time = systemTime(); + GLboolean retValue = glContext->hooks->gl.glIsProgram(program); + nsecs_t end_time = systemTime(); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::BOOL); + rt->add_boolvalue(retValue); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +GLboolean GLTrace_glIsRenderbuffer(GLuint renderbuffer) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glIsRenderbuffer); + + // copy argument renderbuffer + GLMessage_DataType *arg_renderbuffer = glmsg.add_args(); + arg_renderbuffer->set_isarray(false); + arg_renderbuffer->set_type(GLMessage::DataType::INT); + arg_renderbuffer->add_intvalue(renderbuffer); + + // call function + nsecs_t start_time = systemTime(); + GLboolean retValue = glContext->hooks->gl.glIsRenderbuffer(renderbuffer); + nsecs_t end_time = systemTime(); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::BOOL); + rt->add_boolvalue(retValue); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +GLboolean GLTrace_glIsShader(GLuint shader) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glIsShader); + + // copy argument shader + GLMessage_DataType *arg_shader = glmsg.add_args(); + arg_shader->set_isarray(false); + arg_shader->set_type(GLMessage::DataType::INT); + arg_shader->add_intvalue(shader); + + // call function + nsecs_t start_time = systemTime(); + GLboolean retValue = glContext->hooks->gl.glIsShader(shader); + nsecs_t end_time = systemTime(); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::BOOL); + rt->add_boolvalue(retValue); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +GLboolean GLTrace_glIsTexture(GLuint texture) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glIsTexture); + + // copy argument texture + GLMessage_DataType *arg_texture = glmsg.add_args(); + arg_texture->set_isarray(false); + arg_texture->set_type(GLMessage::DataType::INT); + arg_texture->add_intvalue(texture); + + // call function + nsecs_t start_time = systemTime(); + GLboolean retValue = glContext->hooks->gl.glIsTexture(texture); + nsecs_t end_time = systemTime(); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::BOOL); + rt->add_boolvalue(retValue); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +void GLTrace_glLineWidth(GLfloat width) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glLineWidth); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::FLOAT); + arg_width->add_floatvalue(width); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glLineWidth(width); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glLinkProgram(GLuint program) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glLinkProgram); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glLinkProgram(program); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glPixelStorei(GLenum pname, GLint param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glPixelStorei); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glPixelStorei(pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glPolygonOffset(GLfloat factor, GLfloat units) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glPolygonOffset); + + // copy argument factor + GLMessage_DataType *arg_factor = glmsg.add_args(); + arg_factor->set_isarray(false); + arg_factor->set_type(GLMessage::DataType::FLOAT); + arg_factor->add_floatvalue(factor); + + // copy argument units + GLMessage_DataType *arg_units = glmsg.add_args(); + arg_units->set_isarray(false); + arg_units->set_type(GLMessage::DataType::FLOAT); + arg_units->add_floatvalue(units); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glPolygonOffset(factor, units); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glReadPixels); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); + + // copy argument format + GLMessage_DataType *arg_format = glmsg.add_args(); + arg_format->set_isarray(false); + arg_format->set_type(GLMessage::DataType::ENUM); + arg_format->add_intvalue((int)format); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); + + // copy argument pixels + GLMessage_DataType *arg_pixels = glmsg.add_args(); + arg_pixels->set_isarray(false); + arg_pixels->set_type(GLMessage::DataType::INT); + arg_pixels->add_intvalue((int)pixels); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glReadPixels(x, y, width, height, format, type, pixels); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glReleaseShaderCompiler(void) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glReleaseShaderCompiler); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glReleaseShaderCompiler(); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glRenderbufferStorage); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument internalformat + GLMessage_DataType *arg_internalformat = glmsg.add_args(); + arg_internalformat->set_isarray(false); + arg_internalformat->set_type(GLMessage::DataType::ENUM); + arg_internalformat->add_intvalue((int)internalformat); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glRenderbufferStorage(target, internalformat, width, height); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glSampleCoverage(GLclampf value, GLboolean invert) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glSampleCoverage); + + // copy argument value + GLMessage_DataType *arg_value = glmsg.add_args(); + arg_value->set_isarray(false); + arg_value->set_type(GLMessage::DataType::FLOAT); + arg_value->add_floatvalue(value); + + // copy argument invert + GLMessage_DataType *arg_invert = glmsg.add_args(); + arg_invert->set_isarray(false); + arg_invert->set_type(GLMessage::DataType::BOOL); + arg_invert->add_boolvalue(invert); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glSampleCoverage(value, invert); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glScissor(GLint x, GLint y, GLsizei width, GLsizei height) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glScissor); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glScissor(x, y, width, height); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glShaderBinary); + + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); + + // copy argument shaders + GLMessage_DataType *arg_shaders = glmsg.add_args(); + arg_shaders->set_isarray(false); + arg_shaders->set_type(GLMessage::DataType::INT); + arg_shaders->add_intvalue((int)shaders); + + // copy argument binaryformat + GLMessage_DataType *arg_binaryformat = glmsg.add_args(); + arg_binaryformat->set_isarray(false); + arg_binaryformat->set_type(GLMessage::DataType::ENUM); + arg_binaryformat->add_intvalue((int)binaryformat); + + // copy argument binary + GLMessage_DataType *arg_binary = glmsg.add_args(); + arg_binary->set_isarray(false); + arg_binary->set_type(GLMessage::DataType::INT); + arg_binary->add_intvalue((int)binary); + + // copy argument length + GLMessage_DataType *arg_length = glmsg.add_args(); + arg_length->set_isarray(false); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue(length); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glShaderBinary(n, shaders, binaryformat, binary, length); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glShaderSource(GLuint shader, GLsizei count, const GLchar** string, const GLint* length) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glShaderSource); + + // copy argument shader + GLMessage_DataType *arg_shader = glmsg.add_args(); + arg_shader->set_isarray(false); + arg_shader->set_type(GLMessage::DataType::INT); + arg_shader->add_intvalue(shader); + + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue(count); + + // copy argument string + GLMessage_DataType *arg_string = glmsg.add_args(); + arg_string->set_isarray(false); + arg_string->set_type(GLMessage::DataType::INT); + arg_string->add_intvalue((int)string); + + // copy argument length + GLMessage_DataType *arg_length = glmsg.add_args(); + arg_length->set_isarray(false); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue((int)length); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glShaderSource(shader, count, string, length); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glStencilFunc(GLenum func, GLint ref, GLuint mask) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glStencilFunc); + + // copy argument func + GLMessage_DataType *arg_func = glmsg.add_args(); + arg_func->set_isarray(false); + arg_func->set_type(GLMessage::DataType::ENUM); + arg_func->add_intvalue((int)func); + + // copy argument ref + GLMessage_DataType *arg_ref = glmsg.add_args(); + arg_ref->set_isarray(false); + arg_ref->set_type(GLMessage::DataType::INT); + arg_ref->add_intvalue(ref); + + // copy argument mask + GLMessage_DataType *arg_mask = glmsg.add_args(); + arg_mask->set_isarray(false); + arg_mask->set_type(GLMessage::DataType::INT); + arg_mask->add_intvalue(mask); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glStencilFunc(func, ref, mask); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glStencilFuncSeparate); + + // copy argument face + GLMessage_DataType *arg_face = glmsg.add_args(); + arg_face->set_isarray(false); + arg_face->set_type(GLMessage::DataType::ENUM); + arg_face->add_intvalue((int)face); + + // copy argument func + GLMessage_DataType *arg_func = glmsg.add_args(); + arg_func->set_isarray(false); + arg_func->set_type(GLMessage::DataType::ENUM); + arg_func->add_intvalue((int)func); + + // copy argument ref + GLMessage_DataType *arg_ref = glmsg.add_args(); + arg_ref->set_isarray(false); + arg_ref->set_type(GLMessage::DataType::INT); + arg_ref->add_intvalue(ref); + + // copy argument mask + GLMessage_DataType *arg_mask = glmsg.add_args(); + arg_mask->set_isarray(false); + arg_mask->set_type(GLMessage::DataType::INT); + arg_mask->add_intvalue(mask); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glStencilFuncSeparate(face, func, ref, mask); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glStencilMask(GLuint mask) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glStencilMask); + + // copy argument mask + GLMessage_DataType *arg_mask = glmsg.add_args(); + arg_mask->set_isarray(false); + arg_mask->set_type(GLMessage::DataType::INT); + arg_mask->add_intvalue(mask); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glStencilMask(mask); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glStencilMaskSeparate(GLenum face, GLuint mask) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glStencilMaskSeparate); + + // copy argument face + GLMessage_DataType *arg_face = glmsg.add_args(); + arg_face->set_isarray(false); + arg_face->set_type(GLMessage::DataType::ENUM); + arg_face->add_intvalue((int)face); + + // copy argument mask + GLMessage_DataType *arg_mask = glmsg.add_args(); + arg_mask->set_isarray(false); + arg_mask->set_type(GLMessage::DataType::INT); + arg_mask->add_intvalue(mask); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glStencilMaskSeparate(face, mask); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glStencilOp); + + // copy argument fail + GLMessage_DataType *arg_fail = glmsg.add_args(); + arg_fail->set_isarray(false); + arg_fail->set_type(GLMessage::DataType::ENUM); + arg_fail->add_intvalue((int)fail); + + // copy argument zfail + GLMessage_DataType *arg_zfail = glmsg.add_args(); + arg_zfail->set_isarray(false); + arg_zfail->set_type(GLMessage::DataType::ENUM); + arg_zfail->add_intvalue((int)zfail); + + // copy argument zpass + GLMessage_DataType *arg_zpass = glmsg.add_args(); + arg_zpass->set_isarray(false); + arg_zpass->set_type(GLMessage::DataType::ENUM); + arg_zpass->add_intvalue((int)zpass); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glStencilOp(fail, zfail, zpass); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glStencilOpSeparate); + + // copy argument face + GLMessage_DataType *arg_face = glmsg.add_args(); + arg_face->set_isarray(false); + arg_face->set_type(GLMessage::DataType::ENUM); + arg_face->add_intvalue((int)face); + + // copy argument fail + GLMessage_DataType *arg_fail = glmsg.add_args(); + arg_fail->set_isarray(false); + arg_fail->set_type(GLMessage::DataType::ENUM); + arg_fail->add_intvalue((int)fail); + + // copy argument zfail + GLMessage_DataType *arg_zfail = glmsg.add_args(); + arg_zfail->set_isarray(false); + arg_zfail->set_type(GLMessage::DataType::ENUM); + arg_zfail->add_intvalue((int)zfail); + + // copy argument zpass + GLMessage_DataType *arg_zpass = glmsg.add_args(); + arg_zpass->set_isarray(false); + arg_zpass->set_type(GLMessage::DataType::ENUM); + arg_zpass->add_intvalue((int)zpass); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glStencilOpSeparate(face, fail, zfail, zpass); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexImage2D); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument level + GLMessage_DataType *arg_level = glmsg.add_args(); + arg_level->set_isarray(false); + arg_level->set_type(GLMessage::DataType::INT); + arg_level->add_intvalue(level); + + // copy argument internalformat + GLMessage_DataType *arg_internalformat = glmsg.add_args(); + arg_internalformat->set_isarray(false); + arg_internalformat->set_type(GLMessage::DataType::INT); + arg_internalformat->add_intvalue(internalformat); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); + + // copy argument border + GLMessage_DataType *arg_border = glmsg.add_args(); + arg_border->set_isarray(false); + arg_border->set_type(GLMessage::DataType::INT); + arg_border->add_intvalue(border); + + // copy argument format + GLMessage_DataType *arg_format = glmsg.add_args(); + arg_format->set_isarray(false); + arg_format->set_type(GLMessage::DataType::ENUM); + arg_format->add_intvalue((int)format); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); + + // copy argument pixels + GLMessage_DataType *arg_pixels = glmsg.add_args(); + arg_pixels->set_isarray(false); + arg_pixels->set_type(GLMessage::DataType::INT); + arg_pixels->add_intvalue((int)pixels); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexParameterf(GLenum target, GLenum pname, GLfloat param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexParameterf); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::FLOAT); + arg_param->add_floatvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexParameterf(target, pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexParameterfv); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexParameterfv(target, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexParameteri(GLenum target, GLenum pname, GLint param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexParameteri); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexParameteri(target, pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexParameteriv(GLenum target, GLenum pname, const GLint* params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexParameteriv); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexParameteriv(target, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexSubImage2D); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument level + GLMessage_DataType *arg_level = glmsg.add_args(); + arg_level->set_isarray(false); + arg_level->set_type(GLMessage::DataType::INT); + arg_level->add_intvalue(level); + + // copy argument xoffset + GLMessage_DataType *arg_xoffset = glmsg.add_args(); + arg_xoffset->set_isarray(false); + arg_xoffset->set_type(GLMessage::DataType::INT); + arg_xoffset->add_intvalue(xoffset); + + // copy argument yoffset + GLMessage_DataType *arg_yoffset = glmsg.add_args(); + arg_yoffset->set_isarray(false); + arg_yoffset->set_type(GLMessage::DataType::INT); + arg_yoffset->add_intvalue(yoffset); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); + + // copy argument format + GLMessage_DataType *arg_format = glmsg.add_args(); + arg_format->set_isarray(false); + arg_format->set_type(GLMessage::DataType::ENUM); + arg_format->add_intvalue((int)format); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); + + // copy argument pixels + GLMessage_DataType *arg_pixels = glmsg.add_args(); + arg_pixels->set_isarray(false); + arg_pixels->set_type(GLMessage::DataType::INT); + arg_pixels->add_intvalue((int)pixels); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glUniform1f(GLint location, GLfloat x) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glUniform1f); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::FLOAT); + arg_x->add_floatvalue(x); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glUniform1f(location, x); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glUniform1fv(GLint location, GLsizei count, const GLfloat* v) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glUniform1fv); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue(count); + + // copy argument v + GLMessage_DataType *arg_v = glmsg.add_args(); + arg_v->set_isarray(false); + arg_v->set_type(GLMessage::DataType::INT); + arg_v->add_intvalue((int)v); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glUniform1fv(location, count, v); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glUniform1i(GLint location, GLint x) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glUniform1i); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glUniform1i(location, x); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glUniform1iv(GLint location, GLsizei count, const GLint* v) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glUniform1iv); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue(count); + + // copy argument v + GLMessage_DataType *arg_v = glmsg.add_args(); + arg_v->set_isarray(false); + arg_v->set_type(GLMessage::DataType::INT); + arg_v->add_intvalue((int)v); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glUniform1iv(location, count, v); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glUniform2f(GLint location, GLfloat x, GLfloat y) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glUniform2f); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::FLOAT); + arg_x->add_floatvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::FLOAT); + arg_y->add_floatvalue(y); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glUniform2f(location, x, y); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glUniform2fv(GLint location, GLsizei count, const GLfloat* v) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glUniform2fv); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue(count); + + // copy argument v + GLMessage_DataType *arg_v = glmsg.add_args(); + arg_v->set_isarray(false); + arg_v->set_type(GLMessage::DataType::INT); + arg_v->add_intvalue((int)v); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glUniform2fv(location, count, v); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glUniform2i(GLint location, GLint x, GLint y) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glUniform2i); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glUniform2i(location, x, y); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glUniform2iv(GLint location, GLsizei count, const GLint* v) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glUniform2iv); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue(count); + + // copy argument v + GLMessage_DataType *arg_v = glmsg.add_args(); + arg_v->set_isarray(false); + arg_v->set_type(GLMessage::DataType::INT); + arg_v->add_intvalue((int)v); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glUniform2iv(location, count, v); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glUniform3f); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::FLOAT); + arg_x->add_floatvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::FLOAT); + arg_y->add_floatvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::FLOAT); + arg_z->add_floatvalue(z); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glUniform3f(location, x, y, z); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glUniform3fv(GLint location, GLsizei count, const GLfloat* v) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glUniform3fv); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue(count); + + // copy argument v + GLMessage_DataType *arg_v = glmsg.add_args(); + arg_v->set_isarray(false); + arg_v->set_type(GLMessage::DataType::INT); + arg_v->add_intvalue((int)v); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glUniform3fv(location, count, v); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glUniform3i(GLint location, GLint x, GLint y, GLint z) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glUniform3i); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::INT); + arg_z->add_intvalue(z); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glUniform3i(location, x, y, z); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glUniform3iv(GLint location, GLsizei count, const GLint* v) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glUniform3iv); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue(count); + + // copy argument v + GLMessage_DataType *arg_v = glmsg.add_args(); + arg_v->set_isarray(false); + arg_v->set_type(GLMessage::DataType::INT); + arg_v->add_intvalue((int)v); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glUniform3iv(location, count, v); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glUniform4f); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::FLOAT); + arg_x->add_floatvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::FLOAT); + arg_y->add_floatvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::FLOAT); + arg_z->add_floatvalue(z); + + // copy argument w + GLMessage_DataType *arg_w = glmsg.add_args(); + arg_w->set_isarray(false); + arg_w->set_type(GLMessage::DataType::FLOAT); + arg_w->add_floatvalue(w); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glUniform4f(location, x, y, z, w); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glUniform4fv(GLint location, GLsizei count, const GLfloat* v) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glUniform4fv); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue(count); + + // copy argument v + GLMessage_DataType *arg_v = glmsg.add_args(); + arg_v->set_isarray(false); + arg_v->set_type(GLMessage::DataType::INT); + arg_v->add_intvalue((int)v); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glUniform4fv(location, count, v); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glUniform4i); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::INT); + arg_z->add_intvalue(z); + + // copy argument w + GLMessage_DataType *arg_w = glmsg.add_args(); + arg_w->set_isarray(false); + arg_w->set_type(GLMessage::DataType::INT); + arg_w->add_intvalue(w); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glUniform4i(location, x, y, z, w); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glUniform4iv(GLint location, GLsizei count, const GLint* v) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glUniform4iv); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue(count); + + // copy argument v + GLMessage_DataType *arg_v = glmsg.add_args(); + arg_v->set_isarray(false); + arg_v->set_type(GLMessage::DataType::INT); + arg_v->add_intvalue((int)v); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glUniform4iv(location, count, v); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glUniformMatrix2fv); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue(count); + + // copy argument transpose + GLMessage_DataType *arg_transpose = glmsg.add_args(); + arg_transpose->set_isarray(false); + arg_transpose->set_type(GLMessage::DataType::BOOL); + arg_transpose->add_boolvalue(transpose); + + // copy argument value + GLMessage_DataType *arg_value = glmsg.add_args(); + arg_value->set_isarray(false); + arg_value->set_type(GLMessage::DataType::INT); + arg_value->add_intvalue((int)value); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glUniformMatrix2fv(location, count, transpose, value); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glUniformMatrix3fv); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue(count); + + // copy argument transpose + GLMessage_DataType *arg_transpose = glmsg.add_args(); + arg_transpose->set_isarray(false); + arg_transpose->set_type(GLMessage::DataType::BOOL); + arg_transpose->add_boolvalue(transpose); + + // copy argument value + GLMessage_DataType *arg_value = glmsg.add_args(); + arg_value->set_isarray(false); + arg_value->set_type(GLMessage::DataType::INT); + arg_value->add_intvalue((int)value); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glUniformMatrix3fv(location, count, transpose, value); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glUniformMatrix4fv); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue(count); + + // copy argument transpose + GLMessage_DataType *arg_transpose = glmsg.add_args(); + arg_transpose->set_isarray(false); + arg_transpose->set_type(GLMessage::DataType::BOOL); + arg_transpose->add_boolvalue(transpose); + + // copy argument value + GLMessage_DataType *arg_value = glmsg.add_args(); + arg_value->set_isarray(false); + arg_value->set_type(GLMessage::DataType::INT); + arg_value->add_intvalue((int)value); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glUniformMatrix4fv(location, count, transpose, value); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glUseProgram(GLuint program) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glUseProgram); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glUseProgram(program); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glValidateProgram(GLuint program) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glValidateProgram); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glValidateProgram(program); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glVertexAttrib1f(GLuint indx, GLfloat x) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glVertexAttrib1f); + + // copy argument indx + GLMessage_DataType *arg_indx = glmsg.add_args(); + arg_indx->set_isarray(false); + arg_indx->set_type(GLMessage::DataType::INT); + arg_indx->add_intvalue(indx); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::FLOAT); + arg_x->add_floatvalue(x); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glVertexAttrib1f(indx, x); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glVertexAttrib1fv(GLuint indx, const GLfloat* values) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glVertexAttrib1fv); + + // copy argument indx + GLMessage_DataType *arg_indx = glmsg.add_args(); + arg_indx->set_isarray(false); + arg_indx->set_type(GLMessage::DataType::INT); + arg_indx->add_intvalue(indx); + + // copy argument values + GLMessage_DataType *arg_values = glmsg.add_args(); + arg_values->set_isarray(false); + arg_values->set_type(GLMessage::DataType::INT); + arg_values->add_intvalue((int)values); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glVertexAttrib1fv(indx, values); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glVertexAttrib2f); + + // copy argument indx + GLMessage_DataType *arg_indx = glmsg.add_args(); + arg_indx->set_isarray(false); + arg_indx->set_type(GLMessage::DataType::INT); + arg_indx->add_intvalue(indx); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::FLOAT); + arg_x->add_floatvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::FLOAT); + arg_y->add_floatvalue(y); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glVertexAttrib2f(indx, x, y); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glVertexAttrib2fv(GLuint indx, const GLfloat* values) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glVertexAttrib2fv); + + // copy argument indx + GLMessage_DataType *arg_indx = glmsg.add_args(); + arg_indx->set_isarray(false); + arg_indx->set_type(GLMessage::DataType::INT); + arg_indx->add_intvalue(indx); + + // copy argument values + GLMessage_DataType *arg_values = glmsg.add_args(); + arg_values->set_isarray(false); + arg_values->set_type(GLMessage::DataType::INT); + arg_values->add_intvalue((int)values); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glVertexAttrib2fv(indx, values); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glVertexAttrib3f); + + // copy argument indx + GLMessage_DataType *arg_indx = glmsg.add_args(); + arg_indx->set_isarray(false); + arg_indx->set_type(GLMessage::DataType::INT); + arg_indx->add_intvalue(indx); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::FLOAT); + arg_x->add_floatvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::FLOAT); + arg_y->add_floatvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::FLOAT); + arg_z->add_floatvalue(z); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glVertexAttrib3f(indx, x, y, z); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glVertexAttrib3fv(GLuint indx, const GLfloat* values) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glVertexAttrib3fv); + + // copy argument indx + GLMessage_DataType *arg_indx = glmsg.add_args(); + arg_indx->set_isarray(false); + arg_indx->set_type(GLMessage::DataType::INT); + arg_indx->add_intvalue(indx); + + // copy argument values + GLMessage_DataType *arg_values = glmsg.add_args(); + arg_values->set_isarray(false); + arg_values->set_type(GLMessage::DataType::INT); + arg_values->add_intvalue((int)values); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glVertexAttrib3fv(indx, values); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glVertexAttrib4f); + + // copy argument indx + GLMessage_DataType *arg_indx = glmsg.add_args(); + arg_indx->set_isarray(false); + arg_indx->set_type(GLMessage::DataType::INT); + arg_indx->add_intvalue(indx); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::FLOAT); + arg_x->add_floatvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::FLOAT); + arg_y->add_floatvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::FLOAT); + arg_z->add_floatvalue(z); + + // copy argument w + GLMessage_DataType *arg_w = glmsg.add_args(); + arg_w->set_isarray(false); + arg_w->set_type(GLMessage::DataType::FLOAT); + arg_w->add_floatvalue(w); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glVertexAttrib4f(indx, x, y, z, w); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glVertexAttrib4fv(GLuint indx, const GLfloat* values) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glVertexAttrib4fv); + + // copy argument indx + GLMessage_DataType *arg_indx = glmsg.add_args(); + arg_indx->set_isarray(false); + arg_indx->set_type(GLMessage::DataType::INT); + arg_indx->add_intvalue(indx); + + // copy argument values + GLMessage_DataType *arg_values = glmsg.add_args(); + arg_values->set_isarray(false); + arg_values->set_type(GLMessage::DataType::INT); + arg_values->add_intvalue((int)values); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glVertexAttrib4fv(indx, values); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glVertexAttribPointer); + + // copy argument indx + GLMessage_DataType *arg_indx = glmsg.add_args(); + arg_indx->set_isarray(false); + arg_indx->set_type(GLMessage::DataType::INT); + arg_indx->add_intvalue(indx); + + // copy argument size + GLMessage_DataType *arg_size = glmsg.add_args(); + arg_size->set_isarray(false); + arg_size->set_type(GLMessage::DataType::INT); + arg_size->add_intvalue(size); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); + + // copy argument normalized + GLMessage_DataType *arg_normalized = glmsg.add_args(); + arg_normalized->set_isarray(false); + arg_normalized->set_type(GLMessage::DataType::BOOL); + arg_normalized->add_boolvalue(normalized); + + // copy argument stride + GLMessage_DataType *arg_stride = glmsg.add_args(); + arg_stride->set_isarray(false); + arg_stride->set_type(GLMessage::DataType::INT); + arg_stride->add_intvalue(stride); + + // copy argument ptr + GLMessage_DataType *arg_ptr = glmsg.add_args(); + arg_ptr->set_isarray(false); + arg_ptr->set_type(GLMessage::DataType::INT); + arg_ptr->add_intvalue((int)ptr); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glVertexAttribPointer(indx, size, type, normalized, stride, ptr); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glViewport(GLint x, GLint y, GLsizei width, GLsizei height) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glViewport); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glViewport(x, y, width, height); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + + +// Definitions for GL2Ext APIs + +void GLTrace_glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glEGLImageTargetTexture2DOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument image + GLMessage_DataType *arg_image = glmsg.add_args(); + arg_image->set_isarray(false); + arg_image->set_type(GLMessage::DataType::INT); + arg_image->add_intvalue((int)image); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glEGLImageTargetTexture2DOES(target, image); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glEGLImageTargetRenderbufferStorageOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument image + GLMessage_DataType *arg_image = glmsg.add_args(); + arg_image->set_isarray(false); + arg_image->set_type(GLMessage::DataType::INT); + arg_image->add_intvalue((int)image); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glEGLImageTargetRenderbufferStorageOES(target, image); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetProgramBinaryOES); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // copy argument bufSize + GLMessage_DataType *arg_bufSize = glmsg.add_args(); + arg_bufSize->set_isarray(false); + arg_bufSize->set_type(GLMessage::DataType::INT); + arg_bufSize->add_intvalue(bufSize); + + // copy argument length + GLMessage_DataType *arg_length = glmsg.add_args(); + arg_length->set_isarray(false); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue((int)length); + + // copy argument binaryFormat + GLMessage_DataType *arg_binaryFormat = glmsg.add_args(); + arg_binaryFormat->set_isarray(false); + arg_binaryFormat->set_type(GLMessage::DataType::INT); + arg_binaryFormat->add_intvalue((int)binaryFormat); + + // copy argument binary + GLMessage_DataType *arg_binary = glmsg.add_args(); + arg_binary->set_isarray(false); + arg_binary->set_type(GLMessage::DataType::INT); + arg_binary->add_intvalue((int)binary); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetProgramBinaryOES(program, bufSize, length, binaryFormat, binary); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glProgramBinaryOES(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glProgramBinaryOES); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // copy argument binaryFormat + GLMessage_DataType *arg_binaryFormat = glmsg.add_args(); + arg_binaryFormat->set_isarray(false); + arg_binaryFormat->set_type(GLMessage::DataType::ENUM); + arg_binaryFormat->add_intvalue((int)binaryFormat); + + // copy argument binary + GLMessage_DataType *arg_binary = glmsg.add_args(); + arg_binary->set_isarray(false); + arg_binary->set_type(GLMessage::DataType::INT); + arg_binary->add_intvalue((int)binary); + + // copy argument length + GLMessage_DataType *arg_length = glmsg.add_args(); + arg_length->set_isarray(false); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue(length); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glProgramBinaryOES(program, binaryFormat, binary, length); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void* GLTrace_glMapBufferOES(GLenum target, GLenum access) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glMapBufferOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument access + GLMessage_DataType *arg_access = glmsg.add_args(); + arg_access->set_isarray(false); + arg_access->set_type(GLMessage::DataType::ENUM); + arg_access->add_intvalue((int)access); + + // call function + nsecs_t start_time = systemTime(); + void* retValue = glContext->hooks->gl.glMapBufferOES(target, access); + nsecs_t end_time = systemTime(); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::INT); + rt->add_intvalue((int)retValue); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +GLboolean GLTrace_glUnmapBufferOES(GLenum target) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glUnmapBufferOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // call function + nsecs_t start_time = systemTime(); + GLboolean retValue = glContext->hooks->gl.glUnmapBufferOES(target); + nsecs_t end_time = systemTime(); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::BOOL); + rt->add_boolvalue(retValue); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +void GLTrace_glGetBufferPointervOES(GLenum target, GLenum pname, GLvoid** params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetBufferPointervOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetBufferPointervOES(target, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexImage3DOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument level + GLMessage_DataType *arg_level = glmsg.add_args(); + arg_level->set_isarray(false); + arg_level->set_type(GLMessage::DataType::INT); + arg_level->add_intvalue(level); + + // copy argument internalformat + GLMessage_DataType *arg_internalformat = glmsg.add_args(); + arg_internalformat->set_isarray(false); + arg_internalformat->set_type(GLMessage::DataType::ENUM); + arg_internalformat->add_intvalue((int)internalformat); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); + + // copy argument depth + GLMessage_DataType *arg_depth = glmsg.add_args(); + arg_depth->set_isarray(false); + arg_depth->set_type(GLMessage::DataType::INT); + arg_depth->add_intvalue(depth); + + // copy argument border + GLMessage_DataType *arg_border = glmsg.add_args(); + arg_border->set_isarray(false); + arg_border->set_type(GLMessage::DataType::INT); + arg_border->add_intvalue(border); + + // copy argument format + GLMessage_DataType *arg_format = glmsg.add_args(); + arg_format->set_isarray(false); + arg_format->set_type(GLMessage::DataType::ENUM); + arg_format->add_intvalue((int)format); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); + + // copy argument pixels + GLMessage_DataType *arg_pixels = glmsg.add_args(); + arg_pixels->set_isarray(false); + arg_pixels->set_type(GLMessage::DataType::INT); + arg_pixels->add_intvalue((int)pixels); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexImage3DOES(target, level, internalformat, width, height, depth, border, format, type, pixels); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexSubImage3DOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument level + GLMessage_DataType *arg_level = glmsg.add_args(); + arg_level->set_isarray(false); + arg_level->set_type(GLMessage::DataType::INT); + arg_level->add_intvalue(level); + + // copy argument xoffset + GLMessage_DataType *arg_xoffset = glmsg.add_args(); + arg_xoffset->set_isarray(false); + arg_xoffset->set_type(GLMessage::DataType::INT); + arg_xoffset->add_intvalue(xoffset); + + // copy argument yoffset + GLMessage_DataType *arg_yoffset = glmsg.add_args(); + arg_yoffset->set_isarray(false); + arg_yoffset->set_type(GLMessage::DataType::INT); + arg_yoffset->add_intvalue(yoffset); + + // copy argument zoffset + GLMessage_DataType *arg_zoffset = glmsg.add_args(); + arg_zoffset->set_isarray(false); + arg_zoffset->set_type(GLMessage::DataType::INT); + arg_zoffset->add_intvalue(zoffset); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); + + // copy argument depth + GLMessage_DataType *arg_depth = glmsg.add_args(); + arg_depth->set_isarray(false); + arg_depth->set_type(GLMessage::DataType::INT); + arg_depth->add_intvalue(depth); + + // copy argument format + GLMessage_DataType *arg_format = glmsg.add_args(); + arg_format->set_isarray(false); + arg_format->set_type(GLMessage::DataType::ENUM); + arg_format->add_intvalue((int)format); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); + + // copy argument pixels + GLMessage_DataType *arg_pixels = glmsg.add_args(); + arg_pixels->set_isarray(false); + arg_pixels->set_type(GLMessage::DataType::INT); + arg_pixels->add_intvalue((int)pixels); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glCopyTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glCopyTexSubImage3DOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument level + GLMessage_DataType *arg_level = glmsg.add_args(); + arg_level->set_isarray(false); + arg_level->set_type(GLMessage::DataType::INT); + arg_level->add_intvalue(level); + + // copy argument xoffset + GLMessage_DataType *arg_xoffset = glmsg.add_args(); + arg_xoffset->set_isarray(false); + arg_xoffset->set_type(GLMessage::DataType::INT); + arg_xoffset->add_intvalue(xoffset); + + // copy argument yoffset + GLMessage_DataType *arg_yoffset = glmsg.add_args(); + arg_yoffset->set_isarray(false); + arg_yoffset->set_type(GLMessage::DataType::INT); + arg_yoffset->add_intvalue(yoffset); + + // copy argument zoffset + GLMessage_DataType *arg_zoffset = glmsg.add_args(); + arg_zoffset->set_isarray(false); + arg_zoffset->set_type(GLMessage::DataType::INT); + arg_zoffset->add_intvalue(zoffset); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glCopyTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, x, y, width, height); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glCompressedTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glCompressedTexImage3DOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument level + GLMessage_DataType *arg_level = glmsg.add_args(); + arg_level->set_isarray(false); + arg_level->set_type(GLMessage::DataType::INT); + arg_level->add_intvalue(level); + + // copy argument internalformat + GLMessage_DataType *arg_internalformat = glmsg.add_args(); + arg_internalformat->set_isarray(false); + arg_internalformat->set_type(GLMessage::DataType::ENUM); + arg_internalformat->add_intvalue((int)internalformat); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); + + // copy argument depth + GLMessage_DataType *arg_depth = glmsg.add_args(); + arg_depth->set_isarray(false); + arg_depth->set_type(GLMessage::DataType::INT); + arg_depth->add_intvalue(depth); + + // copy argument border + GLMessage_DataType *arg_border = glmsg.add_args(); + arg_border->set_isarray(false); + arg_border->set_type(GLMessage::DataType::INT); + arg_border->add_intvalue(border); + + // copy argument imageSize + GLMessage_DataType *arg_imageSize = glmsg.add_args(); + arg_imageSize->set_isarray(false); + arg_imageSize->set_type(GLMessage::DataType::INT); + arg_imageSize->add_intvalue(imageSize); + + // copy argument data + GLMessage_DataType *arg_data = glmsg.add_args(); + arg_data->set_isarray(false); + arg_data->set_type(GLMessage::DataType::INT); + arg_data->add_intvalue((int)data); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glCompressedTexImage3DOES(target, level, internalformat, width, height, depth, border, imageSize, data); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glCompressedTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glCompressedTexSubImage3DOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument level + GLMessage_DataType *arg_level = glmsg.add_args(); + arg_level->set_isarray(false); + arg_level->set_type(GLMessage::DataType::INT); + arg_level->add_intvalue(level); + + // copy argument xoffset + GLMessage_DataType *arg_xoffset = glmsg.add_args(); + arg_xoffset->set_isarray(false); + arg_xoffset->set_type(GLMessage::DataType::INT); + arg_xoffset->add_intvalue(xoffset); + + // copy argument yoffset + GLMessage_DataType *arg_yoffset = glmsg.add_args(); + arg_yoffset->set_isarray(false); + arg_yoffset->set_type(GLMessage::DataType::INT); + arg_yoffset->add_intvalue(yoffset); + + // copy argument zoffset + GLMessage_DataType *arg_zoffset = glmsg.add_args(); + arg_zoffset->set_isarray(false); + arg_zoffset->set_type(GLMessage::DataType::INT); + arg_zoffset->add_intvalue(zoffset); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); + + // copy argument depth + GLMessage_DataType *arg_depth = glmsg.add_args(); + arg_depth->set_isarray(false); + arg_depth->set_type(GLMessage::DataType::INT); + arg_depth->add_intvalue(depth); + + // copy argument format + GLMessage_DataType *arg_format = glmsg.add_args(); + arg_format->set_isarray(false); + arg_format->set_type(GLMessage::DataType::ENUM); + arg_format->add_intvalue((int)format); + + // copy argument imageSize + GLMessage_DataType *arg_imageSize = glmsg.add_args(); + arg_imageSize->set_isarray(false); + arg_imageSize->set_type(GLMessage::DataType::INT); + arg_imageSize->add_intvalue(imageSize); + + // copy argument data + GLMessage_DataType *arg_data = glmsg.add_args(); + arg_data->set_isarray(false); + arg_data->set_type(GLMessage::DataType::INT); + arg_data->add_intvalue((int)data); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glCompressedTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glFramebufferTexture3DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glFramebufferTexture3DOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument attachment + GLMessage_DataType *arg_attachment = glmsg.add_args(); + arg_attachment->set_isarray(false); + arg_attachment->set_type(GLMessage::DataType::ENUM); + arg_attachment->add_intvalue((int)attachment); + + // copy argument textarget + GLMessage_DataType *arg_textarget = glmsg.add_args(); + arg_textarget->set_isarray(false); + arg_textarget->set_type(GLMessage::DataType::ENUM); + arg_textarget->add_intvalue((int)textarget); + + // copy argument texture + GLMessage_DataType *arg_texture = glmsg.add_args(); + arg_texture->set_isarray(false); + arg_texture->set_type(GLMessage::DataType::INT); + arg_texture->add_intvalue(texture); + + // copy argument level + GLMessage_DataType *arg_level = glmsg.add_args(); + arg_level->set_isarray(false); + arg_level->set_type(GLMessage::DataType::INT); + arg_level->add_intvalue(level); + + // copy argument zoffset + GLMessage_DataType *arg_zoffset = glmsg.add_args(); + arg_zoffset->set_isarray(false); + arg_zoffset->set_type(GLMessage::DataType::INT); + arg_zoffset->add_intvalue(zoffset); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glFramebufferTexture3DOES(target, attachment, textarget, texture, level, zoffset); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glBindVertexArrayOES(GLuint array) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glBindVertexArrayOES); + + // copy argument array + GLMessage_DataType *arg_array = glmsg.add_args(); + arg_array->set_isarray(false); + arg_array->set_type(GLMessage::DataType::INT); + arg_array->add_intvalue(array); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glBindVertexArrayOES(array); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDeleteVertexArraysOES(GLsizei n, const GLuint *arrays) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDeleteVertexArraysOES); + + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); + + // copy argument arrays + GLMessage_DataType *arg_arrays = glmsg.add_args(); + arg_arrays->set_isarray(false); + arg_arrays->set_type(GLMessage::DataType::INT); + arg_arrays->add_intvalue((int)arrays); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDeleteVertexArraysOES(n, arrays); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGenVertexArraysOES(GLsizei n, GLuint *arrays) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGenVertexArraysOES); + + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); + + // copy argument arrays + GLMessage_DataType *arg_arrays = glmsg.add_args(); + arg_arrays->set_isarray(false); + arg_arrays->set_type(GLMessage::DataType::INT); + arg_arrays->add_intvalue((int)arrays); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGenVertexArraysOES(n, arrays); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +GLboolean GLTrace_glIsVertexArrayOES(GLuint array) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glIsVertexArrayOES); + + // copy argument array + GLMessage_DataType *arg_array = glmsg.add_args(); + arg_array->set_isarray(false); + arg_array->set_type(GLMessage::DataType::INT); + arg_array->add_intvalue(array); + + // call function + nsecs_t start_time = systemTime(); + GLboolean retValue = glContext->hooks->gl.glIsVertexArrayOES(array); + nsecs_t end_time = systemTime(); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::BOOL); + rt->add_boolvalue(retValue); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +void GLTrace_glGetPerfMonitorGroupsAMD(GLint *numGroups, GLsizei groupsSize, GLuint *groups) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetPerfMonitorGroupsAMD); + + // copy argument numGroups + GLMessage_DataType *arg_numGroups = glmsg.add_args(); + arg_numGroups->set_isarray(false); + arg_numGroups->set_type(GLMessage::DataType::INT); + arg_numGroups->add_intvalue((int)numGroups); + + // copy argument groupsSize + GLMessage_DataType *arg_groupsSize = glmsg.add_args(); + arg_groupsSize->set_isarray(false); + arg_groupsSize->set_type(GLMessage::DataType::INT); + arg_groupsSize->add_intvalue(groupsSize); + + // copy argument groups + GLMessage_DataType *arg_groups = glmsg.add_args(); + arg_groups->set_isarray(false); + arg_groups->set_type(GLMessage::DataType::INT); + arg_groups->add_intvalue((int)groups); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetPerfMonitorGroupsAMD(numGroups, groupsSize, groups); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetPerfMonitorCountersAMD(GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetPerfMonitorCountersAMD); + + // copy argument group + GLMessage_DataType *arg_group = glmsg.add_args(); + arg_group->set_isarray(false); + arg_group->set_type(GLMessage::DataType::INT); + arg_group->add_intvalue(group); + + // copy argument numCounters + GLMessage_DataType *arg_numCounters = glmsg.add_args(); + arg_numCounters->set_isarray(false); + arg_numCounters->set_type(GLMessage::DataType::INT); + arg_numCounters->add_intvalue((int)numCounters); + + // copy argument maxActiveCounters + GLMessage_DataType *arg_maxActiveCounters = glmsg.add_args(); + arg_maxActiveCounters->set_isarray(false); + arg_maxActiveCounters->set_type(GLMessage::DataType::INT); + arg_maxActiveCounters->add_intvalue((int)maxActiveCounters); + + // copy argument counterSize + GLMessage_DataType *arg_counterSize = glmsg.add_args(); + arg_counterSize->set_isarray(false); + arg_counterSize->set_type(GLMessage::DataType::INT); + arg_counterSize->add_intvalue(counterSize); + + // copy argument counters + GLMessage_DataType *arg_counters = glmsg.add_args(); + arg_counters->set_isarray(false); + arg_counters->set_type(GLMessage::DataType::INT); + arg_counters->add_intvalue((int)counters); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetPerfMonitorCountersAMD(group, numCounters, maxActiveCounters, counterSize, counters); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetPerfMonitorGroupStringAMD(GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetPerfMonitorGroupStringAMD); + + // copy argument group + GLMessage_DataType *arg_group = glmsg.add_args(); + arg_group->set_isarray(false); + arg_group->set_type(GLMessage::DataType::INT); + arg_group->add_intvalue(group); + + // copy argument bufSize + GLMessage_DataType *arg_bufSize = glmsg.add_args(); + arg_bufSize->set_isarray(false); + arg_bufSize->set_type(GLMessage::DataType::INT); + arg_bufSize->add_intvalue(bufSize); + + // copy argument length + GLMessage_DataType *arg_length = glmsg.add_args(); + arg_length->set_isarray(false); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue((int)length); + + // copy argument groupString + GLMessage_DataType *arg_groupString = glmsg.add_args(); + arg_groupString->set_isarray(false); + arg_groupString->set_type(GLMessage::DataType::INT); + arg_groupString->add_intvalue((int)groupString); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetPerfMonitorGroupStringAMD(group, bufSize, length, groupString); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetPerfMonitorCounterStringAMD(GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetPerfMonitorCounterStringAMD); + + // copy argument group + GLMessage_DataType *arg_group = glmsg.add_args(); + arg_group->set_isarray(false); + arg_group->set_type(GLMessage::DataType::INT); + arg_group->add_intvalue(group); + + // copy argument counter + GLMessage_DataType *arg_counter = glmsg.add_args(); + arg_counter->set_isarray(false); + arg_counter->set_type(GLMessage::DataType::INT); + arg_counter->add_intvalue(counter); + + // copy argument bufSize + GLMessage_DataType *arg_bufSize = glmsg.add_args(); + arg_bufSize->set_isarray(false); + arg_bufSize->set_type(GLMessage::DataType::INT); + arg_bufSize->add_intvalue(bufSize); + + // copy argument length + GLMessage_DataType *arg_length = glmsg.add_args(); + arg_length->set_isarray(false); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue((int)length); + + // copy argument counterString + GLMessage_DataType *arg_counterString = glmsg.add_args(); + arg_counterString->set_isarray(false); + arg_counterString->set_type(GLMessage::DataType::INT); + arg_counterString->add_intvalue((int)counterString); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetPerfMonitorCounterStringAMD(group, counter, bufSize, length, counterString); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetPerfMonitorCounterInfoAMD(GLuint group, GLuint counter, GLenum pname, GLvoid *data) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetPerfMonitorCounterInfoAMD); + + // copy argument group + GLMessage_DataType *arg_group = glmsg.add_args(); + arg_group->set_isarray(false); + arg_group->set_type(GLMessage::DataType::INT); + arg_group->add_intvalue(group); + + // copy argument counter + GLMessage_DataType *arg_counter = glmsg.add_args(); + arg_counter->set_isarray(false); + arg_counter->set_type(GLMessage::DataType::INT); + arg_counter->add_intvalue(counter); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument data + GLMessage_DataType *arg_data = glmsg.add_args(); + arg_data->set_isarray(false); + arg_data->set_type(GLMessage::DataType::INT); + arg_data->add_intvalue((int)data); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetPerfMonitorCounterInfoAMD(group, counter, pname, data); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGenPerfMonitorsAMD(GLsizei n, GLuint *monitors) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGenPerfMonitorsAMD); + + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); + + // copy argument monitors + GLMessage_DataType *arg_monitors = glmsg.add_args(); + arg_monitors->set_isarray(false); + arg_monitors->set_type(GLMessage::DataType::INT); + arg_monitors->add_intvalue((int)monitors); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGenPerfMonitorsAMD(n, monitors); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDeletePerfMonitorsAMD(GLsizei n, GLuint *monitors) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDeletePerfMonitorsAMD); + + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); + + // copy argument monitors + GLMessage_DataType *arg_monitors = glmsg.add_args(); + arg_monitors->set_isarray(false); + arg_monitors->set_type(GLMessage::DataType::INT); + arg_monitors->add_intvalue((int)monitors); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDeletePerfMonitorsAMD(n, monitors); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glSelectPerfMonitorCountersAMD(GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glSelectPerfMonitorCountersAMD); + + // copy argument monitor + GLMessage_DataType *arg_monitor = glmsg.add_args(); + arg_monitor->set_isarray(false); + arg_monitor->set_type(GLMessage::DataType::INT); + arg_monitor->add_intvalue(monitor); + + // copy argument enable + GLMessage_DataType *arg_enable = glmsg.add_args(); + arg_enable->set_isarray(false); + arg_enable->set_type(GLMessage::DataType::BOOL); + arg_enable->add_boolvalue(enable); + + // copy argument group + GLMessage_DataType *arg_group = glmsg.add_args(); + arg_group->set_isarray(false); + arg_group->set_type(GLMessage::DataType::INT); + arg_group->add_intvalue(group); + + // copy argument numCounters + GLMessage_DataType *arg_numCounters = glmsg.add_args(); + arg_numCounters->set_isarray(false); + arg_numCounters->set_type(GLMessage::DataType::INT); + arg_numCounters->add_intvalue(numCounters); + + // copy argument countersList + GLMessage_DataType *arg_countersList = glmsg.add_args(); + arg_countersList->set_isarray(false); + arg_countersList->set_type(GLMessage::DataType::INT); + arg_countersList->add_intvalue((int)countersList); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glSelectPerfMonitorCountersAMD(monitor, enable, group, numCounters, countersList); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glBeginPerfMonitorAMD(GLuint monitor) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glBeginPerfMonitorAMD); + + // copy argument monitor + GLMessage_DataType *arg_monitor = glmsg.add_args(); + arg_monitor->set_isarray(false); + arg_monitor->set_type(GLMessage::DataType::INT); + arg_monitor->add_intvalue(monitor); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glBeginPerfMonitorAMD(monitor); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glEndPerfMonitorAMD(GLuint monitor) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glEndPerfMonitorAMD); + + // copy argument monitor + GLMessage_DataType *arg_monitor = glmsg.add_args(); + arg_monitor->set_isarray(false); + arg_monitor->set_type(GLMessage::DataType::INT); + arg_monitor->add_intvalue(monitor); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glEndPerfMonitorAMD(monitor); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetPerfMonitorCounterDataAMD(GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetPerfMonitorCounterDataAMD); + + // copy argument monitor + GLMessage_DataType *arg_monitor = glmsg.add_args(); + arg_monitor->set_isarray(false); + arg_monitor->set_type(GLMessage::DataType::INT); + arg_monitor->add_intvalue(monitor); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument dataSize + GLMessage_DataType *arg_dataSize = glmsg.add_args(); + arg_dataSize->set_isarray(false); + arg_dataSize->set_type(GLMessage::DataType::INT); + arg_dataSize->add_intvalue(dataSize); + + // copy argument data + GLMessage_DataType *arg_data = glmsg.add_args(); + arg_data->set_isarray(false); + arg_data->set_type(GLMessage::DataType::INT); + arg_data->add_intvalue((int)data); + + // copy argument bytesWritten + GLMessage_DataType *arg_bytesWritten = glmsg.add_args(); + arg_bytesWritten->set_isarray(false); + arg_bytesWritten->set_type(GLMessage::DataType::INT); + arg_bytesWritten->add_intvalue((int)bytesWritten); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetPerfMonitorCounterDataAMD(monitor, pname, dataSize, data, bytesWritten); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDiscardFramebufferEXT); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument numAttachments + GLMessage_DataType *arg_numAttachments = glmsg.add_args(); + arg_numAttachments->set_isarray(false); + arg_numAttachments->set_type(GLMessage::DataType::INT); + arg_numAttachments->add_intvalue(numAttachments); + + // copy argument attachments + GLMessage_DataType *arg_attachments = glmsg.add_args(); + arg_attachments->set_isarray(false); + arg_attachments->set_type(GLMessage::DataType::INT); + arg_attachments->add_intvalue((int)attachments); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDiscardFramebufferEXT(target, numAttachments, attachments); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glMultiDrawArraysEXT(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glMultiDrawArraysEXT); + + // copy argument mode + GLMessage_DataType *arg_mode = glmsg.add_args(); + arg_mode->set_isarray(false); + arg_mode->set_type(GLMessage::DataType::ENUM); + arg_mode->add_intvalue((int)mode); + + // copy argument first + GLMessage_DataType *arg_first = glmsg.add_args(); + arg_first->set_isarray(false); + arg_first->set_type(GLMessage::DataType::INT); + arg_first->add_intvalue((int)first); + + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue((int)count); + + // copy argument primcount + GLMessage_DataType *arg_primcount = glmsg.add_args(); + arg_primcount->set_isarray(false); + arg_primcount->set_type(GLMessage::DataType::INT); + arg_primcount->add_intvalue(primcount); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glMultiDrawArraysEXT(mode, first, count, primcount); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glMultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glMultiDrawElementsEXT); + + // copy argument mode + GLMessage_DataType *arg_mode = glmsg.add_args(); + arg_mode->set_isarray(false); + arg_mode->set_type(GLMessage::DataType::ENUM); + arg_mode->add_intvalue((int)mode); + + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue((int)count); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); + + // copy argument indices + GLMessage_DataType *arg_indices = glmsg.add_args(); + arg_indices->set_isarray(false); + arg_indices->set_type(GLMessage::DataType::INT); + arg_indices->add_intvalue((int)indices); + + // copy argument primcount + GLMessage_DataType *arg_primcount = glmsg.add_args(); + arg_primcount->set_isarray(false); + arg_primcount->set_type(GLMessage::DataType::INT); + arg_primcount->add_intvalue(primcount); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glMultiDrawElementsEXT(mode, count, type, indices, primcount); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glRenderbufferStorageMultisampleIMG(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glRenderbufferStorageMultisampleIMG); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument samples + GLMessage_DataType *arg_samples = glmsg.add_args(); + arg_samples->set_isarray(false); + arg_samples->set_type(GLMessage::DataType::INT); + arg_samples->add_intvalue(samples); + + // copy argument internalformat + GLMessage_DataType *arg_internalformat = glmsg.add_args(); + arg_internalformat->set_isarray(false); + arg_internalformat->set_type(GLMessage::DataType::ENUM); + arg_internalformat->add_intvalue((int)internalformat); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glRenderbufferStorageMultisampleIMG(target, samples, internalformat, width, height); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glFramebufferTexture2DMultisampleIMG(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glFramebufferTexture2DMultisampleIMG); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument attachment + GLMessage_DataType *arg_attachment = glmsg.add_args(); + arg_attachment->set_isarray(false); + arg_attachment->set_type(GLMessage::DataType::ENUM); + arg_attachment->add_intvalue((int)attachment); + + // copy argument textarget + GLMessage_DataType *arg_textarget = glmsg.add_args(); + arg_textarget->set_isarray(false); + arg_textarget->set_type(GLMessage::DataType::ENUM); + arg_textarget->add_intvalue((int)textarget); + + // copy argument texture + GLMessage_DataType *arg_texture = glmsg.add_args(); + arg_texture->set_isarray(false); + arg_texture->set_type(GLMessage::DataType::INT); + arg_texture->add_intvalue(texture); + + // copy argument level + GLMessage_DataType *arg_level = glmsg.add_args(); + arg_level->set_isarray(false); + arg_level->set_type(GLMessage::DataType::INT); + arg_level->add_intvalue(level); + + // copy argument samples + GLMessage_DataType *arg_samples = glmsg.add_args(); + arg_samples->set_isarray(false); + arg_samples->set_type(GLMessage::DataType::INT); + arg_samples->add_intvalue(samples); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glFramebufferTexture2DMultisampleIMG(target, attachment, textarget, texture, level, samples); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDeleteFencesNV(GLsizei n, const GLuint *fences) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDeleteFencesNV); + + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); + + // copy argument fences + GLMessage_DataType *arg_fences = glmsg.add_args(); + arg_fences->set_isarray(false); + arg_fences->set_type(GLMessage::DataType::INT); + arg_fences->add_intvalue((int)fences); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDeleteFencesNV(n, fences); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGenFencesNV(GLsizei n, GLuint *fences) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGenFencesNV); + + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); + + // copy argument fences + GLMessage_DataType *arg_fences = glmsg.add_args(); + arg_fences->set_isarray(false); + arg_fences->set_type(GLMessage::DataType::INT); + arg_fences->add_intvalue((int)fences); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGenFencesNV(n, fences); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +GLboolean GLTrace_glIsFenceNV(GLuint fence) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glIsFenceNV); + + // copy argument fence + GLMessage_DataType *arg_fence = glmsg.add_args(); + arg_fence->set_isarray(false); + arg_fence->set_type(GLMessage::DataType::INT); + arg_fence->add_intvalue(fence); + + // call function + nsecs_t start_time = systemTime(); + GLboolean retValue = glContext->hooks->gl.glIsFenceNV(fence); + nsecs_t end_time = systemTime(); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::BOOL); + rt->add_boolvalue(retValue); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +GLboolean GLTrace_glTestFenceNV(GLuint fence) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTestFenceNV); + + // copy argument fence + GLMessage_DataType *arg_fence = glmsg.add_args(); + arg_fence->set_isarray(false); + arg_fence->set_type(GLMessage::DataType::INT); + arg_fence->add_intvalue(fence); + + // call function + nsecs_t start_time = systemTime(); + GLboolean retValue = glContext->hooks->gl.glTestFenceNV(fence); + nsecs_t end_time = systemTime(); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::BOOL); + rt->add_boolvalue(retValue); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +void GLTrace_glGetFenceivNV(GLuint fence, GLenum pname, GLint *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetFenceivNV); + + // copy argument fence + GLMessage_DataType *arg_fence = glmsg.add_args(); + arg_fence->set_isarray(false); + arg_fence->set_type(GLMessage::DataType::INT); + arg_fence->add_intvalue(fence); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetFenceivNV(fence, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glFinishFenceNV(GLuint fence) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glFinishFenceNV); + + // copy argument fence + GLMessage_DataType *arg_fence = glmsg.add_args(); + arg_fence->set_isarray(false); + arg_fence->set_type(GLMessage::DataType::INT); + arg_fence->add_intvalue(fence); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glFinishFenceNV(fence); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glSetFenceNV(GLuint fence, GLenum condition) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glSetFenceNV); + + // copy argument fence + GLMessage_DataType *arg_fence = glmsg.add_args(); + arg_fence->set_isarray(false); + arg_fence->set_type(GLMessage::DataType::INT); + arg_fence->add_intvalue(fence); + + // copy argument condition + GLMessage_DataType *arg_condition = glmsg.add_args(); + arg_condition->set_isarray(false); + arg_condition->set_type(GLMessage::DataType::ENUM); + arg_condition->add_intvalue((int)condition); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glSetFenceNV(fence, condition); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glCoverageMaskNV(GLboolean mask) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glCoverageMaskNV); + + // copy argument mask + GLMessage_DataType *arg_mask = glmsg.add_args(); + arg_mask->set_isarray(false); + arg_mask->set_type(GLMessage::DataType::BOOL); + arg_mask->add_boolvalue(mask); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glCoverageMaskNV(mask); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glCoverageOperationNV(GLenum operation) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glCoverageOperationNV); + + // copy argument operation + GLMessage_DataType *arg_operation = glmsg.add_args(); + arg_operation->set_isarray(false); + arg_operation->set_type(GLMessage::DataType::ENUM); + arg_operation->add_intvalue((int)operation); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glCoverageOperationNV(operation); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetDriverControlsQCOM(GLint *num, GLsizei size, GLuint *driverControls) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetDriverControlsQCOM); + + // copy argument num + GLMessage_DataType *arg_num = glmsg.add_args(); + arg_num->set_isarray(false); + arg_num->set_type(GLMessage::DataType::INT); + arg_num->add_intvalue((int)num); + + // copy argument size + GLMessage_DataType *arg_size = glmsg.add_args(); + arg_size->set_isarray(false); + arg_size->set_type(GLMessage::DataType::INT); + arg_size->add_intvalue(size); + + // copy argument driverControls + GLMessage_DataType *arg_driverControls = glmsg.add_args(); + arg_driverControls->set_isarray(false); + arg_driverControls->set_type(GLMessage::DataType::INT); + arg_driverControls->add_intvalue((int)driverControls); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetDriverControlsQCOM(num, size, driverControls); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetDriverControlStringQCOM(GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetDriverControlStringQCOM); + + // copy argument driverControl + GLMessage_DataType *arg_driverControl = glmsg.add_args(); + arg_driverControl->set_isarray(false); + arg_driverControl->set_type(GLMessage::DataType::INT); + arg_driverControl->add_intvalue(driverControl); + + // copy argument bufSize + GLMessage_DataType *arg_bufSize = glmsg.add_args(); + arg_bufSize->set_isarray(false); + arg_bufSize->set_type(GLMessage::DataType::INT); + arg_bufSize->add_intvalue(bufSize); + + // copy argument length + GLMessage_DataType *arg_length = glmsg.add_args(); + arg_length->set_isarray(false); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue((int)length); + + // copy argument driverControlString + GLMessage_DataType *arg_driverControlString = glmsg.add_args(); + arg_driverControlString->set_isarray(false); + arg_driverControlString->set_type(GLMessage::DataType::INT); + arg_driverControlString->add_intvalue((int)driverControlString); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetDriverControlStringQCOM(driverControl, bufSize, length, driverControlString); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glEnableDriverControlQCOM(GLuint driverControl) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glEnableDriverControlQCOM); + + // copy argument driverControl + GLMessage_DataType *arg_driverControl = glmsg.add_args(); + arg_driverControl->set_isarray(false); + arg_driverControl->set_type(GLMessage::DataType::INT); + arg_driverControl->add_intvalue(driverControl); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glEnableDriverControlQCOM(driverControl); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDisableDriverControlQCOM(GLuint driverControl) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDisableDriverControlQCOM); + + // copy argument driverControl + GLMessage_DataType *arg_driverControl = glmsg.add_args(); + arg_driverControl->set_isarray(false); + arg_driverControl->set_type(GLMessage::DataType::INT); + arg_driverControl->add_intvalue(driverControl); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDisableDriverControlQCOM(driverControl); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glExtGetTexturesQCOM(GLuint *textures, GLint maxTextures, GLint *numTextures) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glExtGetTexturesQCOM); + + // copy argument textures + GLMessage_DataType *arg_textures = glmsg.add_args(); + arg_textures->set_isarray(false); + arg_textures->set_type(GLMessage::DataType::INT); + arg_textures->add_intvalue((int)textures); + + // copy argument maxTextures + GLMessage_DataType *arg_maxTextures = glmsg.add_args(); + arg_maxTextures->set_isarray(false); + arg_maxTextures->set_type(GLMessage::DataType::INT); + arg_maxTextures->add_intvalue(maxTextures); + + // copy argument numTextures + GLMessage_DataType *arg_numTextures = glmsg.add_args(); + arg_numTextures->set_isarray(false); + arg_numTextures->set_type(GLMessage::DataType::INT); + arg_numTextures->add_intvalue((int)numTextures); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glExtGetTexturesQCOM(textures, maxTextures, numTextures); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glExtGetBuffersQCOM(GLuint *buffers, GLint maxBuffers, GLint *numBuffers) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glExtGetBuffersQCOM); + + // copy argument buffers + GLMessage_DataType *arg_buffers = glmsg.add_args(); + arg_buffers->set_isarray(false); + arg_buffers->set_type(GLMessage::DataType::INT); + arg_buffers->add_intvalue((int)buffers); + + // copy argument maxBuffers + GLMessage_DataType *arg_maxBuffers = glmsg.add_args(); + arg_maxBuffers->set_isarray(false); + arg_maxBuffers->set_type(GLMessage::DataType::INT); + arg_maxBuffers->add_intvalue(maxBuffers); + + // copy argument numBuffers + GLMessage_DataType *arg_numBuffers = glmsg.add_args(); + arg_numBuffers->set_isarray(false); + arg_numBuffers->set_type(GLMessage::DataType::INT); + arg_numBuffers->add_intvalue((int)numBuffers); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glExtGetBuffersQCOM(buffers, maxBuffers, numBuffers); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glExtGetRenderbuffersQCOM(GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glExtGetRenderbuffersQCOM); + + // copy argument renderbuffers + GLMessage_DataType *arg_renderbuffers = glmsg.add_args(); + arg_renderbuffers->set_isarray(false); + arg_renderbuffers->set_type(GLMessage::DataType::INT); + arg_renderbuffers->add_intvalue((int)renderbuffers); + + // copy argument maxRenderbuffers + GLMessage_DataType *arg_maxRenderbuffers = glmsg.add_args(); + arg_maxRenderbuffers->set_isarray(false); + arg_maxRenderbuffers->set_type(GLMessage::DataType::INT); + arg_maxRenderbuffers->add_intvalue(maxRenderbuffers); + + // copy argument numRenderbuffers + GLMessage_DataType *arg_numRenderbuffers = glmsg.add_args(); + arg_numRenderbuffers->set_isarray(false); + arg_numRenderbuffers->set_type(GLMessage::DataType::INT); + arg_numRenderbuffers->add_intvalue((int)numRenderbuffers); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glExtGetRenderbuffersQCOM(renderbuffers, maxRenderbuffers, numRenderbuffers); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glExtGetFramebuffersQCOM(GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glExtGetFramebuffersQCOM); + + // copy argument framebuffers + GLMessage_DataType *arg_framebuffers = glmsg.add_args(); + arg_framebuffers->set_isarray(false); + arg_framebuffers->set_type(GLMessage::DataType::INT); + arg_framebuffers->add_intvalue((int)framebuffers); + + // copy argument maxFramebuffers + GLMessage_DataType *arg_maxFramebuffers = glmsg.add_args(); + arg_maxFramebuffers->set_isarray(false); + arg_maxFramebuffers->set_type(GLMessage::DataType::INT); + arg_maxFramebuffers->add_intvalue(maxFramebuffers); + + // copy argument numFramebuffers + GLMessage_DataType *arg_numFramebuffers = glmsg.add_args(); + arg_numFramebuffers->set_isarray(false); + arg_numFramebuffers->set_type(GLMessage::DataType::INT); + arg_numFramebuffers->add_intvalue((int)numFramebuffers); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glExtGetFramebuffersQCOM(framebuffers, maxFramebuffers, numFramebuffers); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glExtGetTexLevelParameterivQCOM(GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glExtGetTexLevelParameterivQCOM); + + // copy argument texture + GLMessage_DataType *arg_texture = glmsg.add_args(); + arg_texture->set_isarray(false); + arg_texture->set_type(GLMessage::DataType::INT); + arg_texture->add_intvalue(texture); + + // copy argument face + GLMessage_DataType *arg_face = glmsg.add_args(); + arg_face->set_isarray(false); + arg_face->set_type(GLMessage::DataType::ENUM); + arg_face->add_intvalue((int)face); + + // copy argument level + GLMessage_DataType *arg_level = glmsg.add_args(); + arg_level->set_isarray(false); + arg_level->set_type(GLMessage::DataType::INT); + arg_level->add_intvalue(level); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glExtGetTexLevelParameterivQCOM(texture, face, level, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glExtTexObjectStateOverrideiQCOM(GLenum target, GLenum pname, GLint param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glExtTexObjectStateOverrideiQCOM); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glExtTexObjectStateOverrideiQCOM(target, pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glExtGetTexSubImageQCOM(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glExtGetTexSubImageQCOM); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument level + GLMessage_DataType *arg_level = glmsg.add_args(); + arg_level->set_isarray(false); + arg_level->set_type(GLMessage::DataType::INT); + arg_level->add_intvalue(level); + + // copy argument xoffset + GLMessage_DataType *arg_xoffset = glmsg.add_args(); + arg_xoffset->set_isarray(false); + arg_xoffset->set_type(GLMessage::DataType::INT); + arg_xoffset->add_intvalue(xoffset); + + // copy argument yoffset + GLMessage_DataType *arg_yoffset = glmsg.add_args(); + arg_yoffset->set_isarray(false); + arg_yoffset->set_type(GLMessage::DataType::INT); + arg_yoffset->add_intvalue(yoffset); + + // copy argument zoffset + GLMessage_DataType *arg_zoffset = glmsg.add_args(); + arg_zoffset->set_isarray(false); + arg_zoffset->set_type(GLMessage::DataType::INT); + arg_zoffset->add_intvalue(zoffset); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); + + // copy argument depth + GLMessage_DataType *arg_depth = glmsg.add_args(); + arg_depth->set_isarray(false); + arg_depth->set_type(GLMessage::DataType::INT); + arg_depth->add_intvalue(depth); + + // copy argument format + GLMessage_DataType *arg_format = glmsg.add_args(); + arg_format->set_isarray(false); + arg_format->set_type(GLMessage::DataType::ENUM); + arg_format->add_intvalue((int)format); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); + + // copy argument texels + GLMessage_DataType *arg_texels = glmsg.add_args(); + arg_texels->set_isarray(false); + arg_texels->set_type(GLMessage::DataType::INT); + arg_texels->add_intvalue((int)texels); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glExtGetTexSubImageQCOM(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, texels); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glExtGetBufferPointervQCOM(GLenum target, GLvoid **params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glExtGetBufferPointervQCOM); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glExtGetBufferPointervQCOM(target, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glExtGetShadersQCOM(GLuint *shaders, GLint maxShaders, GLint *numShaders) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glExtGetShadersQCOM); + + // copy argument shaders + GLMessage_DataType *arg_shaders = glmsg.add_args(); + arg_shaders->set_isarray(false); + arg_shaders->set_type(GLMessage::DataType::INT); + arg_shaders->add_intvalue((int)shaders); + + // copy argument maxShaders + GLMessage_DataType *arg_maxShaders = glmsg.add_args(); + arg_maxShaders->set_isarray(false); + arg_maxShaders->set_type(GLMessage::DataType::INT); + arg_maxShaders->add_intvalue(maxShaders); + + // copy argument numShaders + GLMessage_DataType *arg_numShaders = glmsg.add_args(); + arg_numShaders->set_isarray(false); + arg_numShaders->set_type(GLMessage::DataType::INT); + arg_numShaders->add_intvalue((int)numShaders); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glExtGetShadersQCOM(shaders, maxShaders, numShaders); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glExtGetProgramsQCOM(GLuint *programs, GLint maxPrograms, GLint *numPrograms) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glExtGetProgramsQCOM); + + // copy argument programs + GLMessage_DataType *arg_programs = glmsg.add_args(); + arg_programs->set_isarray(false); + arg_programs->set_type(GLMessage::DataType::INT); + arg_programs->add_intvalue((int)programs); + + // copy argument maxPrograms + GLMessage_DataType *arg_maxPrograms = glmsg.add_args(); + arg_maxPrograms->set_isarray(false); + arg_maxPrograms->set_type(GLMessage::DataType::INT); + arg_maxPrograms->add_intvalue(maxPrograms); + + // copy argument numPrograms + GLMessage_DataType *arg_numPrograms = glmsg.add_args(); + arg_numPrograms->set_isarray(false); + arg_numPrograms->set_type(GLMessage::DataType::INT); + arg_numPrograms->add_intvalue((int)numPrograms); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glExtGetProgramsQCOM(programs, maxPrograms, numPrograms); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +GLboolean GLTrace_glExtIsProgramBinaryQCOM(GLuint program) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glExtIsProgramBinaryQCOM); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // call function + nsecs_t start_time = systemTime(); + GLboolean retValue = glContext->hooks->gl.glExtIsProgramBinaryQCOM(program); + nsecs_t end_time = systemTime(); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::BOOL); + rt->add_boolvalue(retValue); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +void GLTrace_glExtGetProgramBinarySourceQCOM(GLuint program, GLenum shadertype, GLchar *source, GLint *length) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glExtGetProgramBinarySourceQCOM); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // copy argument shadertype + GLMessage_DataType *arg_shadertype = glmsg.add_args(); + arg_shadertype->set_isarray(false); + arg_shadertype->set_type(GLMessage::DataType::ENUM); + arg_shadertype->add_intvalue((int)shadertype); + + // copy argument source + GLMessage_DataType *arg_source = glmsg.add_args(); + arg_source->set_isarray(false); + arg_source->set_type(GLMessage::DataType::INT); + arg_source->add_intvalue((int)source); + + // copy argument length + GLMessage_DataType *arg_length = glmsg.add_args(); + arg_length->set_isarray(false); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue((int)length); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glExtGetProgramBinarySourceQCOM(program, shadertype, source, length); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glStartTilingQCOM(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glStartTilingQCOM); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); + + // copy argument preserveMask + GLMessage_DataType *arg_preserveMask = glmsg.add_args(); + arg_preserveMask->set_isarray(false); + arg_preserveMask->set_type(GLMessage::DataType::INT); + arg_preserveMask->add_intvalue(preserveMask); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glStartTilingQCOM(x, y, width, height, preserveMask); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glEndTilingQCOM(GLbitfield preserveMask) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glEndTilingQCOM); + + // copy argument preserveMask + GLMessage_DataType *arg_preserveMask = glmsg.add_args(); + arg_preserveMask->set_isarray(false); + arg_preserveMask->set_type(GLMessage::DataType::INT); + arg_preserveMask->add_intvalue(preserveMask); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glEndTilingQCOM(preserveMask); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + + +// Definitions for GL1 APIs + +void GLTrace_glAlphaFunc(GLenum func, GLclampf ref) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glAlphaFunc); + + // copy argument func + GLMessage_DataType *arg_func = glmsg.add_args(); + arg_func->set_isarray(false); + arg_func->set_type(GLMessage::DataType::ENUM); + arg_func->add_intvalue((int)func); + + // copy argument ref + GLMessage_DataType *arg_ref = glmsg.add_args(); + arg_ref->set_isarray(false); + arg_ref->set_type(GLMessage::DataType::FLOAT); + arg_ref->add_floatvalue(ref); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glAlphaFunc(func, ref); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glClipPlanef(GLenum plane, const GLfloat *equation) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glClipPlanef); + + // copy argument plane + GLMessage_DataType *arg_plane = glmsg.add_args(); + arg_plane->set_isarray(false); + arg_plane->set_type(GLMessage::DataType::ENUM); + arg_plane->add_intvalue((int)plane); + + // copy argument equation + GLMessage_DataType *arg_equation = glmsg.add_args(); + arg_equation->set_isarray(false); + arg_equation->set_type(GLMessage::DataType::INT); + arg_equation->add_intvalue((int)equation); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glClipPlanef(plane, equation); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glColor4f); + + // copy argument red + GLMessage_DataType *arg_red = glmsg.add_args(); + arg_red->set_isarray(false); + arg_red->set_type(GLMessage::DataType::FLOAT); + arg_red->add_floatvalue(red); + + // copy argument green + GLMessage_DataType *arg_green = glmsg.add_args(); + arg_green->set_isarray(false); + arg_green->set_type(GLMessage::DataType::FLOAT); + arg_green->add_floatvalue(green); + + // copy argument blue + GLMessage_DataType *arg_blue = glmsg.add_args(); + arg_blue->set_isarray(false); + arg_blue->set_type(GLMessage::DataType::FLOAT); + arg_blue->add_floatvalue(blue); + + // copy argument alpha + GLMessage_DataType *arg_alpha = glmsg.add_args(); + arg_alpha->set_isarray(false); + arg_alpha->set_type(GLMessage::DataType::FLOAT); + arg_alpha->add_floatvalue(alpha); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glColor4f(red, green, blue, alpha); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glFogf(GLenum pname, GLfloat param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glFogf); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::FLOAT); + arg_param->add_floatvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glFogf(pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glFogfv(GLenum pname, const GLfloat *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glFogfv); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glFogfv(pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glFrustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glFrustumf); + + // copy argument left + GLMessage_DataType *arg_left = glmsg.add_args(); + arg_left->set_isarray(false); + arg_left->set_type(GLMessage::DataType::FLOAT); + arg_left->add_floatvalue(left); + + // copy argument right + GLMessage_DataType *arg_right = glmsg.add_args(); + arg_right->set_isarray(false); + arg_right->set_type(GLMessage::DataType::FLOAT); + arg_right->add_floatvalue(right); + + // copy argument bottom + GLMessage_DataType *arg_bottom = glmsg.add_args(); + arg_bottom->set_isarray(false); + arg_bottom->set_type(GLMessage::DataType::FLOAT); + arg_bottom->add_floatvalue(bottom); + + // copy argument top + GLMessage_DataType *arg_top = glmsg.add_args(); + arg_top->set_isarray(false); + arg_top->set_type(GLMessage::DataType::FLOAT); + arg_top->add_floatvalue(top); + + // copy argument zNear + GLMessage_DataType *arg_zNear = glmsg.add_args(); + arg_zNear->set_isarray(false); + arg_zNear->set_type(GLMessage::DataType::FLOAT); + arg_zNear->add_floatvalue(zNear); + + // copy argument zFar + GLMessage_DataType *arg_zFar = glmsg.add_args(); + arg_zFar->set_isarray(false); + arg_zFar->set_type(GLMessage::DataType::FLOAT); + arg_zFar->add_floatvalue(zFar); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glFrustumf(left, right, bottom, top, zNear, zFar); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetClipPlanef(GLenum pname, GLfloat eqn[4]) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetClipPlanef); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument eqn + GLMessage_DataType *arg_eqn = glmsg.add_args(); + arg_eqn->set_isarray(false); + arg_eqn->set_type(GLMessage::DataType::INT); + arg_eqn->add_intvalue((int)eqn); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetClipPlanef(pname, eqn); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetLightfv(GLenum light, GLenum pname, GLfloat *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetLightfv); + + // copy argument light + GLMessage_DataType *arg_light = glmsg.add_args(); + arg_light->set_isarray(false); + arg_light->set_type(GLMessage::DataType::ENUM); + arg_light->add_intvalue((int)light); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetLightfv(light, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetMaterialfv); + + // copy argument face + GLMessage_DataType *arg_face = glmsg.add_args(); + arg_face->set_isarray(false); + arg_face->set_type(GLMessage::DataType::ENUM); + arg_face->add_intvalue((int)face); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetMaterialfv(face, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetTexEnvfv(GLenum env, GLenum pname, GLfloat *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetTexEnvfv); + + // copy argument env + GLMessage_DataType *arg_env = glmsg.add_args(); + arg_env->set_isarray(false); + arg_env->set_type(GLMessage::DataType::ENUM); + arg_env->add_intvalue((int)env); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetTexEnvfv(env, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glLightModelf(GLenum pname, GLfloat param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glLightModelf); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::FLOAT); + arg_param->add_floatvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glLightModelf(pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glLightModelfv(GLenum pname, const GLfloat *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glLightModelfv); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glLightModelfv(pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glLightf(GLenum light, GLenum pname, GLfloat param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glLightf); + + // copy argument light + GLMessage_DataType *arg_light = glmsg.add_args(); + arg_light->set_isarray(false); + arg_light->set_type(GLMessage::DataType::ENUM); + arg_light->add_intvalue((int)light); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::FLOAT); + arg_param->add_floatvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glLightf(light, pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glLightfv(GLenum light, GLenum pname, const GLfloat *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glLightfv); + + // copy argument light + GLMessage_DataType *arg_light = glmsg.add_args(); + arg_light->set_isarray(false); + arg_light->set_type(GLMessage::DataType::ENUM); + arg_light->add_intvalue((int)light); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glLightfv(light, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glLoadMatrixf(const GLfloat *m) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glLoadMatrixf); + + // copy argument m + GLMessage_DataType *arg_m = glmsg.add_args(); + arg_m->set_isarray(false); + arg_m->set_type(GLMessage::DataType::INT); + arg_m->add_intvalue((int)m); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glLoadMatrixf(m); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glMaterialf(GLenum face, GLenum pname, GLfloat param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glMaterialf); + + // copy argument face + GLMessage_DataType *arg_face = glmsg.add_args(); + arg_face->set_isarray(false); + arg_face->set_type(GLMessage::DataType::ENUM); + arg_face->add_intvalue((int)face); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::FLOAT); + arg_param->add_floatvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glMaterialf(face, pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glMaterialfv(GLenum face, GLenum pname, const GLfloat *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glMaterialfv); + + // copy argument face + GLMessage_DataType *arg_face = glmsg.add_args(); + arg_face->set_isarray(false); + arg_face->set_type(GLMessage::DataType::ENUM); + arg_face->add_intvalue((int)face); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glMaterialfv(face, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glMultMatrixf(const GLfloat *m) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glMultMatrixf); + + // copy argument m + GLMessage_DataType *arg_m = glmsg.add_args(); + arg_m->set_isarray(false); + arg_m->set_type(GLMessage::DataType::INT); + arg_m->add_intvalue((int)m); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glMultMatrixf(m); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glMultiTexCoord4f); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument s + GLMessage_DataType *arg_s = glmsg.add_args(); + arg_s->set_isarray(false); + arg_s->set_type(GLMessage::DataType::FLOAT); + arg_s->add_floatvalue(s); + + // copy argument t + GLMessage_DataType *arg_t = glmsg.add_args(); + arg_t->set_isarray(false); + arg_t->set_type(GLMessage::DataType::FLOAT); + arg_t->add_floatvalue(t); + + // copy argument r + GLMessage_DataType *arg_r = glmsg.add_args(); + arg_r->set_isarray(false); + arg_r->set_type(GLMessage::DataType::FLOAT); + arg_r->add_floatvalue(r); + + // copy argument q + GLMessage_DataType *arg_q = glmsg.add_args(); + arg_q->set_isarray(false); + arg_q->set_type(GLMessage::DataType::FLOAT); + arg_q->add_floatvalue(q); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glMultiTexCoord4f(target, s, t, r, q); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glNormal3f); + + // copy argument nx + GLMessage_DataType *arg_nx = glmsg.add_args(); + arg_nx->set_isarray(false); + arg_nx->set_type(GLMessage::DataType::FLOAT); + arg_nx->add_floatvalue(nx); + + // copy argument ny + GLMessage_DataType *arg_ny = glmsg.add_args(); + arg_ny->set_isarray(false); + arg_ny->set_type(GLMessage::DataType::FLOAT); + arg_ny->add_floatvalue(ny); + + // copy argument nz + GLMessage_DataType *arg_nz = glmsg.add_args(); + arg_nz->set_isarray(false); + arg_nz->set_type(GLMessage::DataType::FLOAT); + arg_nz->add_floatvalue(nz); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glNormal3f(nx, ny, nz); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glOrthof); + + // copy argument left + GLMessage_DataType *arg_left = glmsg.add_args(); + arg_left->set_isarray(false); + arg_left->set_type(GLMessage::DataType::FLOAT); + arg_left->add_floatvalue(left); + + // copy argument right + GLMessage_DataType *arg_right = glmsg.add_args(); + arg_right->set_isarray(false); + arg_right->set_type(GLMessage::DataType::FLOAT); + arg_right->add_floatvalue(right); + + // copy argument bottom + GLMessage_DataType *arg_bottom = glmsg.add_args(); + arg_bottom->set_isarray(false); + arg_bottom->set_type(GLMessage::DataType::FLOAT); + arg_bottom->add_floatvalue(bottom); + + // copy argument top + GLMessage_DataType *arg_top = glmsg.add_args(); + arg_top->set_isarray(false); + arg_top->set_type(GLMessage::DataType::FLOAT); + arg_top->add_floatvalue(top); + + // copy argument zNear + GLMessage_DataType *arg_zNear = glmsg.add_args(); + arg_zNear->set_isarray(false); + arg_zNear->set_type(GLMessage::DataType::FLOAT); + arg_zNear->add_floatvalue(zNear); + + // copy argument zFar + GLMessage_DataType *arg_zFar = glmsg.add_args(); + arg_zFar->set_isarray(false); + arg_zFar->set_type(GLMessage::DataType::FLOAT); + arg_zFar->add_floatvalue(zFar); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glOrthof(left, right, bottom, top, zNear, zFar); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glPointParameterf(GLenum pname, GLfloat param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glPointParameterf); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::FLOAT); + arg_param->add_floatvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glPointParameterf(pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glPointParameterfv(GLenum pname, const GLfloat *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glPointParameterfv); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glPointParameterfv(pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glPointSize(GLfloat size) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glPointSize); + + // copy argument size + GLMessage_DataType *arg_size = glmsg.add_args(); + arg_size->set_isarray(false); + arg_size->set_type(GLMessage::DataType::FLOAT); + arg_size->add_floatvalue(size); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glPointSize(size); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glRotatef); + + // copy argument angle + GLMessage_DataType *arg_angle = glmsg.add_args(); + arg_angle->set_isarray(false); + arg_angle->set_type(GLMessage::DataType::FLOAT); + arg_angle->add_floatvalue(angle); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::FLOAT); + arg_x->add_floatvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::FLOAT); + arg_y->add_floatvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::FLOAT); + arg_z->add_floatvalue(z); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glRotatef(angle, x, y, z); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glScalef(GLfloat x, GLfloat y, GLfloat z) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glScalef); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::FLOAT); + arg_x->add_floatvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::FLOAT); + arg_y->add_floatvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::FLOAT); + arg_z->add_floatvalue(z); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glScalef(x, y, z); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexEnvf(GLenum target, GLenum pname, GLfloat param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexEnvf); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::FLOAT); + arg_param->add_floatvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexEnvf(target, pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexEnvfv); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexEnvfv(target, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTranslatef(GLfloat x, GLfloat y, GLfloat z) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTranslatef); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::FLOAT); + arg_x->add_floatvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::FLOAT); + arg_y->add_floatvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::FLOAT); + arg_z->add_floatvalue(z); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTranslatef(x, y, z); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glAlphaFuncx(GLenum func, GLclampx ref) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glAlphaFuncx); + + // copy argument func + GLMessage_DataType *arg_func = glmsg.add_args(); + arg_func->set_isarray(false); + arg_func->set_type(GLMessage::DataType::ENUM); + arg_func->add_intvalue((int)func); + + // copy argument ref + GLMessage_DataType *arg_ref = glmsg.add_args(); + arg_ref->set_isarray(false); + arg_ref->set_type(GLMessage::DataType::INT); + arg_ref->add_intvalue(ref); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glAlphaFuncx(func, ref); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glClearColorx); + + // copy argument red + GLMessage_DataType *arg_red = glmsg.add_args(); + arg_red->set_isarray(false); + arg_red->set_type(GLMessage::DataType::INT); + arg_red->add_intvalue(red); + + // copy argument green + GLMessage_DataType *arg_green = glmsg.add_args(); + arg_green->set_isarray(false); + arg_green->set_type(GLMessage::DataType::INT); + arg_green->add_intvalue(green); + + // copy argument blue + GLMessage_DataType *arg_blue = glmsg.add_args(); + arg_blue->set_isarray(false); + arg_blue->set_type(GLMessage::DataType::INT); + arg_blue->add_intvalue(blue); + + // copy argument alpha + GLMessage_DataType *arg_alpha = glmsg.add_args(); + arg_alpha->set_isarray(false); + arg_alpha->set_type(GLMessage::DataType::INT); + arg_alpha->add_intvalue(alpha); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glClearColorx(red, green, blue, alpha); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glClearDepthx(GLclampx depth) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glClearDepthx); + + // copy argument depth + GLMessage_DataType *arg_depth = glmsg.add_args(); + arg_depth->set_isarray(false); + arg_depth->set_type(GLMessage::DataType::INT); + arg_depth->add_intvalue(depth); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glClearDepthx(depth); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glClientActiveTexture(GLenum texture) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glClientActiveTexture); + + // copy argument texture + GLMessage_DataType *arg_texture = glmsg.add_args(); + arg_texture->set_isarray(false); + arg_texture->set_type(GLMessage::DataType::ENUM); + arg_texture->add_intvalue((int)texture); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glClientActiveTexture(texture); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glClipPlanex(GLenum plane, const GLfixed *equation) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glClipPlanex); + + // copy argument plane + GLMessage_DataType *arg_plane = glmsg.add_args(); + arg_plane->set_isarray(false); + arg_plane->set_type(GLMessage::DataType::ENUM); + arg_plane->add_intvalue((int)plane); + + // copy argument equation + GLMessage_DataType *arg_equation = glmsg.add_args(); + arg_equation->set_isarray(false); + arg_equation->set_type(GLMessage::DataType::INT); + arg_equation->add_intvalue((int)equation); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glClipPlanex(plane, equation); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glColor4ub); + + // copy argument red + GLMessage_DataType *arg_red = glmsg.add_args(); + arg_red->set_isarray(false); + arg_red->set_type(GLMessage::DataType::BYTE); + arg_red->add_intvalue((int)red); + + // copy argument green + GLMessage_DataType *arg_green = glmsg.add_args(); + arg_green->set_isarray(false); + arg_green->set_type(GLMessage::DataType::BYTE); + arg_green->add_intvalue((int)green); + + // copy argument blue + GLMessage_DataType *arg_blue = glmsg.add_args(); + arg_blue->set_isarray(false); + arg_blue->set_type(GLMessage::DataType::BYTE); + arg_blue->add_intvalue((int)blue); + + // copy argument alpha + GLMessage_DataType *arg_alpha = glmsg.add_args(); + arg_alpha->set_isarray(false); + arg_alpha->set_type(GLMessage::DataType::BYTE); + arg_alpha->add_intvalue((int)alpha); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glColor4ub(red, green, blue, alpha); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glColor4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glColor4x); + + // copy argument red + GLMessage_DataType *arg_red = glmsg.add_args(); + arg_red->set_isarray(false); + arg_red->set_type(GLMessage::DataType::INT); + arg_red->add_intvalue(red); + + // copy argument green + GLMessage_DataType *arg_green = glmsg.add_args(); + arg_green->set_isarray(false); + arg_green->set_type(GLMessage::DataType::INT); + arg_green->add_intvalue(green); + + // copy argument blue + GLMessage_DataType *arg_blue = glmsg.add_args(); + arg_blue->set_isarray(false); + arg_blue->set_type(GLMessage::DataType::INT); + arg_blue->add_intvalue(blue); + + // copy argument alpha + GLMessage_DataType *arg_alpha = glmsg.add_args(); + arg_alpha->set_isarray(false); + arg_alpha->set_type(GLMessage::DataType::INT); + arg_alpha->add_intvalue(alpha); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glColor4x(red, green, blue, alpha); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glColorPointer); + + // copy argument size + GLMessage_DataType *arg_size = glmsg.add_args(); + arg_size->set_isarray(false); + arg_size->set_type(GLMessage::DataType::INT); + arg_size->add_intvalue(size); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); + + // copy argument stride + GLMessage_DataType *arg_stride = glmsg.add_args(); + arg_stride->set_isarray(false); + arg_stride->set_type(GLMessage::DataType::INT); + arg_stride->add_intvalue(stride); + + // copy argument pointer + GLMessage_DataType *arg_pointer = glmsg.add_args(); + arg_pointer->set_isarray(false); + arg_pointer->set_type(GLMessage::DataType::INT); + arg_pointer->add_intvalue((int)pointer); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glColorPointer(size, type, stride, pointer); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDepthRangex(GLclampx zNear, GLclampx zFar) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDepthRangex); + + // copy argument zNear + GLMessage_DataType *arg_zNear = glmsg.add_args(); + arg_zNear->set_isarray(false); + arg_zNear->set_type(GLMessage::DataType::INT); + arg_zNear->add_intvalue(zNear); + + // copy argument zFar + GLMessage_DataType *arg_zFar = glmsg.add_args(); + arg_zFar->set_isarray(false); + arg_zFar->set_type(GLMessage::DataType::INT); + arg_zFar->add_intvalue(zFar); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDepthRangex(zNear, zFar); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDisableClientState(GLenum array) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDisableClientState); + + // copy argument array + GLMessage_DataType *arg_array = glmsg.add_args(); + arg_array->set_isarray(false); + arg_array->set_type(GLMessage::DataType::ENUM); + arg_array->add_intvalue((int)array); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDisableClientState(array); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glEnableClientState(GLenum array) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glEnableClientState); + + // copy argument array + GLMessage_DataType *arg_array = glmsg.add_args(); + arg_array->set_isarray(false); + arg_array->set_type(GLMessage::DataType::ENUM); + arg_array->add_intvalue((int)array); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glEnableClientState(array); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glFogx(GLenum pname, GLfixed param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glFogx); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glFogx(pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glFogxv(GLenum pname, const GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glFogxv); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glFogxv(pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glFrustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glFrustumx); + + // copy argument left + GLMessage_DataType *arg_left = glmsg.add_args(); + arg_left->set_isarray(false); + arg_left->set_type(GLMessage::DataType::INT); + arg_left->add_intvalue(left); + + // copy argument right + GLMessage_DataType *arg_right = glmsg.add_args(); + arg_right->set_isarray(false); + arg_right->set_type(GLMessage::DataType::INT); + arg_right->add_intvalue(right); + + // copy argument bottom + GLMessage_DataType *arg_bottom = glmsg.add_args(); + arg_bottom->set_isarray(false); + arg_bottom->set_type(GLMessage::DataType::INT); + arg_bottom->add_intvalue(bottom); + + // copy argument top + GLMessage_DataType *arg_top = glmsg.add_args(); + arg_top->set_isarray(false); + arg_top->set_type(GLMessage::DataType::INT); + arg_top->add_intvalue(top); + + // copy argument zNear + GLMessage_DataType *arg_zNear = glmsg.add_args(); + arg_zNear->set_isarray(false); + arg_zNear->set_type(GLMessage::DataType::INT); + arg_zNear->add_intvalue(zNear); + + // copy argument zFar + GLMessage_DataType *arg_zFar = glmsg.add_args(); + arg_zFar->set_isarray(false); + arg_zFar->set_type(GLMessage::DataType::INT); + arg_zFar->add_intvalue(zFar); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glFrustumx(left, right, bottom, top, zNear, zFar); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetClipPlanex(GLenum pname, GLfixed eqn[4]) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetClipPlanex); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument eqn + GLMessage_DataType *arg_eqn = glmsg.add_args(); + arg_eqn->set_isarray(false); + arg_eqn->set_type(GLMessage::DataType::INT); + arg_eqn->add_intvalue((int)eqn); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetClipPlanex(pname, eqn); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetFixedv(GLenum pname, GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetFixedv); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetFixedv(pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetLightxv(GLenum light, GLenum pname, GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetLightxv); + + // copy argument light + GLMessage_DataType *arg_light = glmsg.add_args(); + arg_light->set_isarray(false); + arg_light->set_type(GLMessage::DataType::ENUM); + arg_light->add_intvalue((int)light); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetLightxv(light, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetMaterialxv(GLenum face, GLenum pname, GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetMaterialxv); + + // copy argument face + GLMessage_DataType *arg_face = glmsg.add_args(); + arg_face->set_isarray(false); + arg_face->set_type(GLMessage::DataType::ENUM); + arg_face->add_intvalue((int)face); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetMaterialxv(face, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetPointerv(GLenum pname, GLvoid **params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetPointerv); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetPointerv(pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetTexEnviv(GLenum env, GLenum pname, GLint *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetTexEnviv); + + // copy argument env + GLMessage_DataType *arg_env = glmsg.add_args(); + arg_env->set_isarray(false); + arg_env->set_type(GLMessage::DataType::ENUM); + arg_env->add_intvalue((int)env); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetTexEnviv(env, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetTexEnvxv(GLenum env, GLenum pname, GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetTexEnvxv); + + // copy argument env + GLMessage_DataType *arg_env = glmsg.add_args(); + arg_env->set_isarray(false); + arg_env->set_type(GLMessage::DataType::ENUM); + arg_env->add_intvalue((int)env); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetTexEnvxv(env, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetTexParameterxv(GLenum target, GLenum pname, GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetTexParameterxv); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetTexParameterxv(target, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glLightModelx(GLenum pname, GLfixed param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glLightModelx); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glLightModelx(pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glLightModelxv(GLenum pname, const GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glLightModelxv); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glLightModelxv(pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glLightx(GLenum light, GLenum pname, GLfixed param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glLightx); + + // copy argument light + GLMessage_DataType *arg_light = glmsg.add_args(); + arg_light->set_isarray(false); + arg_light->set_type(GLMessage::DataType::ENUM); + arg_light->add_intvalue((int)light); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glLightx(light, pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glLightxv(GLenum light, GLenum pname, const GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glLightxv); + + // copy argument light + GLMessage_DataType *arg_light = glmsg.add_args(); + arg_light->set_isarray(false); + arg_light->set_type(GLMessage::DataType::ENUM); + arg_light->add_intvalue((int)light); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glLightxv(light, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glLineWidthx(GLfixed width) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glLineWidthx); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glLineWidthx(width); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glLoadIdentity(void) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glLoadIdentity); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glLoadIdentity(); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glLoadMatrixx(const GLfixed *m) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glLoadMatrixx); + + // copy argument m + GLMessage_DataType *arg_m = glmsg.add_args(); + arg_m->set_isarray(false); + arg_m->set_type(GLMessage::DataType::INT); + arg_m->add_intvalue((int)m); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glLoadMatrixx(m); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glLogicOp(GLenum opcode) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glLogicOp); + + // copy argument opcode + GLMessage_DataType *arg_opcode = glmsg.add_args(); + arg_opcode->set_isarray(false); + arg_opcode->set_type(GLMessage::DataType::ENUM); + arg_opcode->add_intvalue((int)opcode); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glLogicOp(opcode); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glMaterialx(GLenum face, GLenum pname, GLfixed param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glMaterialx); + + // copy argument face + GLMessage_DataType *arg_face = glmsg.add_args(); + arg_face->set_isarray(false); + arg_face->set_type(GLMessage::DataType::ENUM); + arg_face->add_intvalue((int)face); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glMaterialx(face, pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glMaterialxv(GLenum face, GLenum pname, const GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glMaterialxv); + + // copy argument face + GLMessage_DataType *arg_face = glmsg.add_args(); + arg_face->set_isarray(false); + arg_face->set_type(GLMessage::DataType::ENUM); + arg_face->add_intvalue((int)face); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glMaterialxv(face, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glMatrixMode(GLenum mode) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glMatrixMode); + + // copy argument mode + GLMessage_DataType *arg_mode = glmsg.add_args(); + arg_mode->set_isarray(false); + arg_mode->set_type(GLMessage::DataType::ENUM); + arg_mode->add_intvalue((int)mode); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glMatrixMode(mode); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glMultMatrixx(const GLfixed *m) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glMultMatrixx); + + // copy argument m + GLMessage_DataType *arg_m = glmsg.add_args(); + arg_m->set_isarray(false); + arg_m->set_type(GLMessage::DataType::INT); + arg_m->add_intvalue((int)m); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glMultMatrixx(m); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glMultiTexCoord4x(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glMultiTexCoord4x); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument s + GLMessage_DataType *arg_s = glmsg.add_args(); + arg_s->set_isarray(false); + arg_s->set_type(GLMessage::DataType::INT); + arg_s->add_intvalue(s); + + // copy argument t + GLMessage_DataType *arg_t = glmsg.add_args(); + arg_t->set_isarray(false); + arg_t->set_type(GLMessage::DataType::INT); + arg_t->add_intvalue(t); + + // copy argument r + GLMessage_DataType *arg_r = glmsg.add_args(); + arg_r->set_isarray(false); + arg_r->set_type(GLMessage::DataType::INT); + arg_r->add_intvalue(r); + + // copy argument q + GLMessage_DataType *arg_q = glmsg.add_args(); + arg_q->set_isarray(false); + arg_q->set_type(GLMessage::DataType::INT); + arg_q->add_intvalue(q); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glMultiTexCoord4x(target, s, t, r, q); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glNormal3x(GLfixed nx, GLfixed ny, GLfixed nz) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glNormal3x); + + // copy argument nx + GLMessage_DataType *arg_nx = glmsg.add_args(); + arg_nx->set_isarray(false); + arg_nx->set_type(GLMessage::DataType::INT); + arg_nx->add_intvalue(nx); + + // copy argument ny + GLMessage_DataType *arg_ny = glmsg.add_args(); + arg_ny->set_isarray(false); + arg_ny->set_type(GLMessage::DataType::INT); + arg_ny->add_intvalue(ny); + + // copy argument nz + GLMessage_DataType *arg_nz = glmsg.add_args(); + arg_nz->set_isarray(false); + arg_nz->set_type(GLMessage::DataType::INT); + arg_nz->add_intvalue(nz); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glNormal3x(nx, ny, nz); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glNormalPointer); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); + + // copy argument stride + GLMessage_DataType *arg_stride = glmsg.add_args(); + arg_stride->set_isarray(false); + arg_stride->set_type(GLMessage::DataType::INT); + arg_stride->add_intvalue(stride); + + // copy argument pointer + GLMessage_DataType *arg_pointer = glmsg.add_args(); + arg_pointer->set_isarray(false); + arg_pointer->set_type(GLMessage::DataType::INT); + arg_pointer->add_intvalue((int)pointer); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glNormalPointer(type, stride, pointer); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glOrthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glOrthox); + + // copy argument left + GLMessage_DataType *arg_left = glmsg.add_args(); + arg_left->set_isarray(false); + arg_left->set_type(GLMessage::DataType::INT); + arg_left->add_intvalue(left); + + // copy argument right + GLMessage_DataType *arg_right = glmsg.add_args(); + arg_right->set_isarray(false); + arg_right->set_type(GLMessage::DataType::INT); + arg_right->add_intvalue(right); + + // copy argument bottom + GLMessage_DataType *arg_bottom = glmsg.add_args(); + arg_bottom->set_isarray(false); + arg_bottom->set_type(GLMessage::DataType::INT); + arg_bottom->add_intvalue(bottom); + + // copy argument top + GLMessage_DataType *arg_top = glmsg.add_args(); + arg_top->set_isarray(false); + arg_top->set_type(GLMessage::DataType::INT); + arg_top->add_intvalue(top); + + // copy argument zNear + GLMessage_DataType *arg_zNear = glmsg.add_args(); + arg_zNear->set_isarray(false); + arg_zNear->set_type(GLMessage::DataType::INT); + arg_zNear->add_intvalue(zNear); + + // copy argument zFar + GLMessage_DataType *arg_zFar = glmsg.add_args(); + arg_zFar->set_isarray(false); + arg_zFar->set_type(GLMessage::DataType::INT); + arg_zFar->add_intvalue(zFar); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glOrthox(left, right, bottom, top, zNear, zFar); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glPointParameterx(GLenum pname, GLfixed param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glPointParameterx); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glPointParameterx(pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glPointParameterxv(GLenum pname, const GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glPointParameterxv); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glPointParameterxv(pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glPointSizex(GLfixed size) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glPointSizex); + + // copy argument size + GLMessage_DataType *arg_size = glmsg.add_args(); + arg_size->set_isarray(false); + arg_size->set_type(GLMessage::DataType::INT); + arg_size->add_intvalue(size); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glPointSizex(size); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glPolygonOffsetx(GLfixed factor, GLfixed units) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glPolygonOffsetx); + + // copy argument factor + GLMessage_DataType *arg_factor = glmsg.add_args(); + arg_factor->set_isarray(false); + arg_factor->set_type(GLMessage::DataType::INT); + arg_factor->add_intvalue(factor); + + // copy argument units + GLMessage_DataType *arg_units = glmsg.add_args(); + arg_units->set_isarray(false); + arg_units->set_type(GLMessage::DataType::INT); + arg_units->add_intvalue(units); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glPolygonOffsetx(factor, units); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glPopMatrix(void) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glPopMatrix); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glPopMatrix(); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glPushMatrix(void) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glPushMatrix); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glPushMatrix(); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glRotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glRotatex); + + // copy argument angle + GLMessage_DataType *arg_angle = glmsg.add_args(); + arg_angle->set_isarray(false); + arg_angle->set_type(GLMessage::DataType::INT); + arg_angle->add_intvalue(angle); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::INT); + arg_z->add_intvalue(z); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glRotatex(angle, x, y, z); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glSampleCoveragex(GLclampx value, GLboolean invert) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glSampleCoveragex); + + // copy argument value + GLMessage_DataType *arg_value = glmsg.add_args(); + arg_value->set_isarray(false); + arg_value->set_type(GLMessage::DataType::INT); + arg_value->add_intvalue(value); + + // copy argument invert + GLMessage_DataType *arg_invert = glmsg.add_args(); + arg_invert->set_isarray(false); + arg_invert->set_type(GLMessage::DataType::BOOL); + arg_invert->add_boolvalue(invert); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glSampleCoveragex(value, invert); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glScalex(GLfixed x, GLfixed y, GLfixed z) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glScalex); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::INT); + arg_z->add_intvalue(z); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glScalex(x, y, z); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glShadeModel(GLenum mode) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glShadeModel); + + // copy argument mode + GLMessage_DataType *arg_mode = glmsg.add_args(); + arg_mode->set_isarray(false); + arg_mode->set_type(GLMessage::DataType::ENUM); + arg_mode->add_intvalue((int)mode); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glShadeModel(mode); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexCoordPointer); + + // copy argument size + GLMessage_DataType *arg_size = glmsg.add_args(); + arg_size->set_isarray(false); + arg_size->set_type(GLMessage::DataType::INT); + arg_size->add_intvalue(size); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); + + // copy argument stride + GLMessage_DataType *arg_stride = glmsg.add_args(); + arg_stride->set_isarray(false); + arg_stride->set_type(GLMessage::DataType::INT); + arg_stride->add_intvalue(stride); + + // copy argument pointer + GLMessage_DataType *arg_pointer = glmsg.add_args(); + arg_pointer->set_isarray(false); + arg_pointer->set_type(GLMessage::DataType::INT); + arg_pointer->add_intvalue((int)pointer); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexCoordPointer(size, type, stride, pointer); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexEnvi(GLenum target, GLenum pname, GLint param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexEnvi); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexEnvi(target, pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexEnvx(GLenum target, GLenum pname, GLfixed param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexEnvx); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexEnvx(target, pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexEnviv(GLenum target, GLenum pname, const GLint *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexEnviv); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexEnviv(target, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexEnvxv(GLenum target, GLenum pname, const GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexEnvxv); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexEnvxv(target, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexParameterx(GLenum target, GLenum pname, GLfixed param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexParameterx); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexParameterx(target, pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexParameterxv(GLenum target, GLenum pname, const GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexParameterxv); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexParameterxv(target, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTranslatex(GLfixed x, GLfixed y, GLfixed z) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTranslatex); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::INT); + arg_z->add_intvalue(z); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTranslatex(x, y, z); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glVertexPointer); + + // copy argument size + GLMessage_DataType *arg_size = glmsg.add_args(); + arg_size->set_isarray(false); + arg_size->set_type(GLMessage::DataType::INT); + arg_size->add_intvalue(size); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); + + // copy argument stride + GLMessage_DataType *arg_stride = glmsg.add_args(); + arg_stride->set_isarray(false); + arg_stride->set_type(GLMessage::DataType::INT); + arg_stride->add_intvalue(stride); + + // copy argument pointer + GLMessage_DataType *arg_pointer = glmsg.add_args(); + arg_pointer->set_isarray(false); + arg_pointer->set_type(GLMessage::DataType::INT); + arg_pointer->add_intvalue((int)pointer); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glVertexPointer(size, type, stride, pointer); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glPointSizePointerOES(GLenum type, GLsizei stride, const GLvoid *pointer) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glPointSizePointerOES); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); + + // copy argument stride + GLMessage_DataType *arg_stride = glmsg.add_args(); + arg_stride->set_isarray(false); + arg_stride->set_type(GLMessage::DataType::INT); + arg_stride->add_intvalue(stride); + + // copy argument pointer + GLMessage_DataType *arg_pointer = glmsg.add_args(); + arg_pointer->set_isarray(false); + arg_pointer->set_type(GLMessage::DataType::INT); + arg_pointer->add_intvalue((int)pointer); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glPointSizePointerOES(type, stride, pointer); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + + +// Definitions for GL1Ext APIs + +void GLTrace_glBlendEquationSeparateOES(GLenum modeRGB, GLenum modeAlpha) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glBlendEquationSeparateOES); + + // copy argument modeRGB + GLMessage_DataType *arg_modeRGB = glmsg.add_args(); + arg_modeRGB->set_isarray(false); + arg_modeRGB->set_type(GLMessage::DataType::ENUM); + arg_modeRGB->add_intvalue((int)modeRGB); + + // copy argument modeAlpha + GLMessage_DataType *arg_modeAlpha = glmsg.add_args(); + arg_modeAlpha->set_isarray(false); + arg_modeAlpha->set_type(GLMessage::DataType::ENUM); + arg_modeAlpha->add_intvalue((int)modeAlpha); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glBlendEquationSeparateOES(modeRGB, modeAlpha); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glBlendFuncSeparateOES(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glBlendFuncSeparateOES); + + // copy argument srcRGB + GLMessage_DataType *arg_srcRGB = glmsg.add_args(); + arg_srcRGB->set_isarray(false); + arg_srcRGB->set_type(GLMessage::DataType::ENUM); + arg_srcRGB->add_intvalue((int)srcRGB); + + // copy argument dstRGB + GLMessage_DataType *arg_dstRGB = glmsg.add_args(); + arg_dstRGB->set_isarray(false); + arg_dstRGB->set_type(GLMessage::DataType::ENUM); + arg_dstRGB->add_intvalue((int)dstRGB); + + // copy argument srcAlpha + GLMessage_DataType *arg_srcAlpha = glmsg.add_args(); + arg_srcAlpha->set_isarray(false); + arg_srcAlpha->set_type(GLMessage::DataType::ENUM); + arg_srcAlpha->add_intvalue((int)srcAlpha); + + // copy argument dstAlpha + GLMessage_DataType *arg_dstAlpha = glmsg.add_args(); + arg_dstAlpha->set_isarray(false); + arg_dstAlpha->set_type(GLMessage::DataType::ENUM); + arg_dstAlpha->add_intvalue((int)dstAlpha); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glBlendFuncSeparateOES(srcRGB, dstRGB, srcAlpha, dstAlpha); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glBlendEquationOES(GLenum mode) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glBlendEquationOES); + + // copy argument mode + GLMessage_DataType *arg_mode = glmsg.add_args(); + arg_mode->set_isarray(false); + arg_mode->set_type(GLMessage::DataType::ENUM); + arg_mode->add_intvalue((int)mode); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glBlendEquationOES(mode); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDrawTexsOES(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDrawTexsOES); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::INT); + arg_z->add_intvalue(z); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDrawTexsOES(x, y, z, width, height); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDrawTexiOES); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::INT); + arg_z->add_intvalue(z); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDrawTexiOES(x, y, z, width, height); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDrawTexxOES); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::INT); + arg_z->add_intvalue(z); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDrawTexxOES(x, y, z, width, height); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDrawTexsvOES(const GLshort *coords) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDrawTexsvOES); + + // copy argument coords + GLMessage_DataType *arg_coords = glmsg.add_args(); + arg_coords->set_isarray(false); + arg_coords->set_type(GLMessage::DataType::INT); + arg_coords->add_intvalue((int)coords); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDrawTexsvOES(coords); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDrawTexivOES(const GLint *coords) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDrawTexivOES); + + // copy argument coords + GLMessage_DataType *arg_coords = glmsg.add_args(); + arg_coords->set_isarray(false); + arg_coords->set_type(GLMessage::DataType::INT); + arg_coords->add_intvalue((int)coords); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDrawTexivOES(coords); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDrawTexxvOES(const GLfixed *coords) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDrawTexxvOES); + + // copy argument coords + GLMessage_DataType *arg_coords = glmsg.add_args(); + arg_coords->set_isarray(false); + arg_coords->set_type(GLMessage::DataType::INT); + arg_coords->add_intvalue((int)coords); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDrawTexxvOES(coords); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDrawTexfOES(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDrawTexfOES); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::FLOAT); + arg_x->add_floatvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::FLOAT); + arg_y->add_floatvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::FLOAT); + arg_z->add_floatvalue(z); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::FLOAT); + arg_width->add_floatvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::FLOAT); + arg_height->add_floatvalue(height); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDrawTexfOES(x, y, z, width, height); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDrawTexfvOES(const GLfloat *coords) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDrawTexfvOES); + + // copy argument coords + GLMessage_DataType *arg_coords = glmsg.add_args(); + arg_coords->set_isarray(false); + arg_coords->set_type(GLMessage::DataType::INT); + arg_coords->add_intvalue((int)coords); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDrawTexfvOES(coords); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glAlphaFuncxOES(GLenum func, GLclampx ref) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glAlphaFuncxOES); + + // copy argument func + GLMessage_DataType *arg_func = glmsg.add_args(); + arg_func->set_isarray(false); + arg_func->set_type(GLMessage::DataType::ENUM); + arg_func->add_intvalue((int)func); + + // copy argument ref + GLMessage_DataType *arg_ref = glmsg.add_args(); + arg_ref->set_isarray(false); + arg_ref->set_type(GLMessage::DataType::INT); + arg_ref->add_intvalue(ref); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glAlphaFuncxOES(func, ref); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glClearColorxOES(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glClearColorxOES); + + // copy argument red + GLMessage_DataType *arg_red = glmsg.add_args(); + arg_red->set_isarray(false); + arg_red->set_type(GLMessage::DataType::INT); + arg_red->add_intvalue(red); + + // copy argument green + GLMessage_DataType *arg_green = glmsg.add_args(); + arg_green->set_isarray(false); + arg_green->set_type(GLMessage::DataType::INT); + arg_green->add_intvalue(green); + + // copy argument blue + GLMessage_DataType *arg_blue = glmsg.add_args(); + arg_blue->set_isarray(false); + arg_blue->set_type(GLMessage::DataType::INT); + arg_blue->add_intvalue(blue); + + // copy argument alpha + GLMessage_DataType *arg_alpha = glmsg.add_args(); + arg_alpha->set_isarray(false); + arg_alpha->set_type(GLMessage::DataType::INT); + arg_alpha->add_intvalue(alpha); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glClearColorxOES(red, green, blue, alpha); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glClearDepthxOES(GLclampx depth) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glClearDepthxOES); + + // copy argument depth + GLMessage_DataType *arg_depth = glmsg.add_args(); + arg_depth->set_isarray(false); + arg_depth->set_type(GLMessage::DataType::INT); + arg_depth->add_intvalue(depth); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glClearDepthxOES(depth); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glClipPlanexOES(GLenum plane, const GLfixed *equation) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glClipPlanexOES); + + // copy argument plane + GLMessage_DataType *arg_plane = glmsg.add_args(); + arg_plane->set_isarray(false); + arg_plane->set_type(GLMessage::DataType::ENUM); + arg_plane->add_intvalue((int)plane); + + // copy argument equation + GLMessage_DataType *arg_equation = glmsg.add_args(); + arg_equation->set_isarray(false); + arg_equation->set_type(GLMessage::DataType::INT); + arg_equation->add_intvalue((int)equation); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glClipPlanexOES(plane, equation); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glColor4xOES(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glColor4xOES); + + // copy argument red + GLMessage_DataType *arg_red = glmsg.add_args(); + arg_red->set_isarray(false); + arg_red->set_type(GLMessage::DataType::INT); + arg_red->add_intvalue(red); + + // copy argument green + GLMessage_DataType *arg_green = glmsg.add_args(); + arg_green->set_isarray(false); + arg_green->set_type(GLMessage::DataType::INT); + arg_green->add_intvalue(green); + + // copy argument blue + GLMessage_DataType *arg_blue = glmsg.add_args(); + arg_blue->set_isarray(false); + arg_blue->set_type(GLMessage::DataType::INT); + arg_blue->add_intvalue(blue); + + // copy argument alpha + GLMessage_DataType *arg_alpha = glmsg.add_args(); + arg_alpha->set_isarray(false); + arg_alpha->set_type(GLMessage::DataType::INT); + arg_alpha->add_intvalue(alpha); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glColor4xOES(red, green, blue, alpha); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDepthRangexOES(GLclampx zNear, GLclampx zFar) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDepthRangexOES); + + // copy argument zNear + GLMessage_DataType *arg_zNear = glmsg.add_args(); + arg_zNear->set_isarray(false); + arg_zNear->set_type(GLMessage::DataType::INT); + arg_zNear->add_intvalue(zNear); + + // copy argument zFar + GLMessage_DataType *arg_zFar = glmsg.add_args(); + arg_zFar->set_isarray(false); + arg_zFar->set_type(GLMessage::DataType::INT); + arg_zFar->add_intvalue(zFar); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDepthRangexOES(zNear, zFar); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glFogxOES(GLenum pname, GLfixed param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glFogxOES); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glFogxOES(pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glFogxvOES(GLenum pname, const GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glFogxvOES); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glFogxvOES(pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glFrustumxOES(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glFrustumxOES); + + // copy argument left + GLMessage_DataType *arg_left = glmsg.add_args(); + arg_left->set_isarray(false); + arg_left->set_type(GLMessage::DataType::INT); + arg_left->add_intvalue(left); + + // copy argument right + GLMessage_DataType *arg_right = glmsg.add_args(); + arg_right->set_isarray(false); + arg_right->set_type(GLMessage::DataType::INT); + arg_right->add_intvalue(right); + + // copy argument bottom + GLMessage_DataType *arg_bottom = glmsg.add_args(); + arg_bottom->set_isarray(false); + arg_bottom->set_type(GLMessage::DataType::INT); + arg_bottom->add_intvalue(bottom); + + // copy argument top + GLMessage_DataType *arg_top = glmsg.add_args(); + arg_top->set_isarray(false); + arg_top->set_type(GLMessage::DataType::INT); + arg_top->add_intvalue(top); + + // copy argument zNear + GLMessage_DataType *arg_zNear = glmsg.add_args(); + arg_zNear->set_isarray(false); + arg_zNear->set_type(GLMessage::DataType::INT); + arg_zNear->add_intvalue(zNear); + + // copy argument zFar + GLMessage_DataType *arg_zFar = glmsg.add_args(); + arg_zFar->set_isarray(false); + arg_zFar->set_type(GLMessage::DataType::INT); + arg_zFar->add_intvalue(zFar); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glFrustumxOES(left, right, bottom, top, zNear, zFar); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetClipPlanexOES(GLenum pname, GLfixed eqn[4]) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetClipPlanexOES); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument eqn + GLMessage_DataType *arg_eqn = glmsg.add_args(); + arg_eqn->set_isarray(false); + arg_eqn->set_type(GLMessage::DataType::INT); + arg_eqn->add_intvalue((int)eqn); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetClipPlanexOES(pname, eqn); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetFixedvOES(GLenum pname, GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetFixedvOES); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetFixedvOES(pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetLightxvOES(GLenum light, GLenum pname, GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetLightxvOES); + + // copy argument light + GLMessage_DataType *arg_light = glmsg.add_args(); + arg_light->set_isarray(false); + arg_light->set_type(GLMessage::DataType::ENUM); + arg_light->add_intvalue((int)light); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetLightxvOES(light, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetMaterialxvOES(GLenum face, GLenum pname, GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetMaterialxvOES); + + // copy argument face + GLMessage_DataType *arg_face = glmsg.add_args(); + arg_face->set_isarray(false); + arg_face->set_type(GLMessage::DataType::ENUM); + arg_face->add_intvalue((int)face); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetMaterialxvOES(face, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetTexEnvxvOES(GLenum env, GLenum pname, GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetTexEnvxvOES); + + // copy argument env + GLMessage_DataType *arg_env = glmsg.add_args(); + arg_env->set_isarray(false); + arg_env->set_type(GLMessage::DataType::ENUM); + arg_env->add_intvalue((int)env); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetTexEnvxvOES(env, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetTexParameterxvOES(GLenum target, GLenum pname, GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetTexParameterxvOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetTexParameterxvOES(target, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glLightModelxOES(GLenum pname, GLfixed param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glLightModelxOES); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glLightModelxOES(pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glLightModelxvOES(GLenum pname, const GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glLightModelxvOES); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glLightModelxvOES(pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glLightxOES(GLenum light, GLenum pname, GLfixed param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glLightxOES); + + // copy argument light + GLMessage_DataType *arg_light = glmsg.add_args(); + arg_light->set_isarray(false); + arg_light->set_type(GLMessage::DataType::ENUM); + arg_light->add_intvalue((int)light); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glLightxOES(light, pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glLightxvOES(GLenum light, GLenum pname, const GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glLightxvOES); + + // copy argument light + GLMessage_DataType *arg_light = glmsg.add_args(); + arg_light->set_isarray(false); + arg_light->set_type(GLMessage::DataType::ENUM); + arg_light->add_intvalue((int)light); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glLightxvOES(light, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glLineWidthxOES(GLfixed width) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glLineWidthxOES); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glLineWidthxOES(width); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glLoadMatrixxOES(const GLfixed *m) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glLoadMatrixxOES); + + // copy argument m + GLMessage_DataType *arg_m = glmsg.add_args(); + arg_m->set_isarray(false); + arg_m->set_type(GLMessage::DataType::INT); + arg_m->add_intvalue((int)m); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glLoadMatrixxOES(m); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glMaterialxOES(GLenum face, GLenum pname, GLfixed param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glMaterialxOES); + + // copy argument face + GLMessage_DataType *arg_face = glmsg.add_args(); + arg_face->set_isarray(false); + arg_face->set_type(GLMessage::DataType::ENUM); + arg_face->add_intvalue((int)face); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glMaterialxOES(face, pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glMaterialxvOES(GLenum face, GLenum pname, const GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glMaterialxvOES); + + // copy argument face + GLMessage_DataType *arg_face = glmsg.add_args(); + arg_face->set_isarray(false); + arg_face->set_type(GLMessage::DataType::ENUM); + arg_face->add_intvalue((int)face); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glMaterialxvOES(face, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glMultMatrixxOES(const GLfixed *m) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glMultMatrixxOES); + + // copy argument m + GLMessage_DataType *arg_m = glmsg.add_args(); + arg_m->set_isarray(false); + arg_m->set_type(GLMessage::DataType::INT); + arg_m->add_intvalue((int)m); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glMultMatrixxOES(m); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glMultiTexCoord4xOES(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glMultiTexCoord4xOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument s + GLMessage_DataType *arg_s = glmsg.add_args(); + arg_s->set_isarray(false); + arg_s->set_type(GLMessage::DataType::INT); + arg_s->add_intvalue(s); + + // copy argument t + GLMessage_DataType *arg_t = glmsg.add_args(); + arg_t->set_isarray(false); + arg_t->set_type(GLMessage::DataType::INT); + arg_t->add_intvalue(t); + + // copy argument r + GLMessage_DataType *arg_r = glmsg.add_args(); + arg_r->set_isarray(false); + arg_r->set_type(GLMessage::DataType::INT); + arg_r->add_intvalue(r); + + // copy argument q + GLMessage_DataType *arg_q = glmsg.add_args(); + arg_q->set_isarray(false); + arg_q->set_type(GLMessage::DataType::INT); + arg_q->add_intvalue(q); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glMultiTexCoord4xOES(target, s, t, r, q); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glNormal3xOES(GLfixed nx, GLfixed ny, GLfixed nz) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glNormal3xOES); + + // copy argument nx + GLMessage_DataType *arg_nx = glmsg.add_args(); + arg_nx->set_isarray(false); + arg_nx->set_type(GLMessage::DataType::INT); + arg_nx->add_intvalue(nx); + + // copy argument ny + GLMessage_DataType *arg_ny = glmsg.add_args(); + arg_ny->set_isarray(false); + arg_ny->set_type(GLMessage::DataType::INT); + arg_ny->add_intvalue(ny); + + // copy argument nz + GLMessage_DataType *arg_nz = glmsg.add_args(); + arg_nz->set_isarray(false); + arg_nz->set_type(GLMessage::DataType::INT); + arg_nz->add_intvalue(nz); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glNormal3xOES(nx, ny, nz); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glOrthoxOES(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glOrthoxOES); + + // copy argument left + GLMessage_DataType *arg_left = glmsg.add_args(); + arg_left->set_isarray(false); + arg_left->set_type(GLMessage::DataType::INT); + arg_left->add_intvalue(left); + + // copy argument right + GLMessage_DataType *arg_right = glmsg.add_args(); + arg_right->set_isarray(false); + arg_right->set_type(GLMessage::DataType::INT); + arg_right->add_intvalue(right); + + // copy argument bottom + GLMessage_DataType *arg_bottom = glmsg.add_args(); + arg_bottom->set_isarray(false); + arg_bottom->set_type(GLMessage::DataType::INT); + arg_bottom->add_intvalue(bottom); + + // copy argument top + GLMessage_DataType *arg_top = glmsg.add_args(); + arg_top->set_isarray(false); + arg_top->set_type(GLMessage::DataType::INT); + arg_top->add_intvalue(top); + + // copy argument zNear + GLMessage_DataType *arg_zNear = glmsg.add_args(); + arg_zNear->set_isarray(false); + arg_zNear->set_type(GLMessage::DataType::INT); + arg_zNear->add_intvalue(zNear); + + // copy argument zFar + GLMessage_DataType *arg_zFar = glmsg.add_args(); + arg_zFar->set_isarray(false); + arg_zFar->set_type(GLMessage::DataType::INT); + arg_zFar->add_intvalue(zFar); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glOrthoxOES(left, right, bottom, top, zNear, zFar); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glPointParameterxOES(GLenum pname, GLfixed param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glPointParameterxOES); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glPointParameterxOES(pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glPointParameterxvOES(GLenum pname, const GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glPointParameterxvOES); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glPointParameterxvOES(pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glPointSizexOES(GLfixed size) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glPointSizexOES); + + // copy argument size + GLMessage_DataType *arg_size = glmsg.add_args(); + arg_size->set_isarray(false); + arg_size->set_type(GLMessage::DataType::INT); + arg_size->add_intvalue(size); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glPointSizexOES(size); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glPolygonOffsetxOES(GLfixed factor, GLfixed units) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glPolygonOffsetxOES); + + // copy argument factor + GLMessage_DataType *arg_factor = glmsg.add_args(); + arg_factor->set_isarray(false); + arg_factor->set_type(GLMessage::DataType::INT); + arg_factor->add_intvalue(factor); + + // copy argument units + GLMessage_DataType *arg_units = glmsg.add_args(); + arg_units->set_isarray(false); + arg_units->set_type(GLMessage::DataType::INT); + arg_units->add_intvalue(units); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glPolygonOffsetxOES(factor, units); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glRotatexOES(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glRotatexOES); + + // copy argument angle + GLMessage_DataType *arg_angle = glmsg.add_args(); + arg_angle->set_isarray(false); + arg_angle->set_type(GLMessage::DataType::INT); + arg_angle->add_intvalue(angle); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::INT); + arg_z->add_intvalue(z); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glRotatexOES(angle, x, y, z); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glSampleCoveragexOES(GLclampx value, GLboolean invert) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glSampleCoveragexOES); + + // copy argument value + GLMessage_DataType *arg_value = glmsg.add_args(); + arg_value->set_isarray(false); + arg_value->set_type(GLMessage::DataType::INT); + arg_value->add_intvalue(value); + + // copy argument invert + GLMessage_DataType *arg_invert = glmsg.add_args(); + arg_invert->set_isarray(false); + arg_invert->set_type(GLMessage::DataType::BOOL); + arg_invert->add_boolvalue(invert); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glSampleCoveragexOES(value, invert); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glScalexOES(GLfixed x, GLfixed y, GLfixed z) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glScalexOES); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::INT); + arg_z->add_intvalue(z); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glScalexOES(x, y, z); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexEnvxOES(GLenum target, GLenum pname, GLfixed param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexEnvxOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexEnvxOES(target, pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexEnvxvOES(GLenum target, GLenum pname, const GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexEnvxvOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexEnvxvOES(target, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexParameterxOES(GLenum target, GLenum pname, GLfixed param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexParameterxOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexParameterxOES(target, pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexParameterxvOES(GLenum target, GLenum pname, const GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexParameterxvOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexParameterxvOES(target, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTranslatexOES(GLfixed x, GLfixed y, GLfixed z) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTranslatexOES); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::INT); + arg_z->add_intvalue(z); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTranslatexOES(x, y, z); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +GLboolean GLTrace_glIsRenderbufferOES(GLuint renderbuffer) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glIsRenderbufferOES); + + // copy argument renderbuffer + GLMessage_DataType *arg_renderbuffer = glmsg.add_args(); + arg_renderbuffer->set_isarray(false); + arg_renderbuffer->set_type(GLMessage::DataType::INT); + arg_renderbuffer->add_intvalue(renderbuffer); + + // call function + nsecs_t start_time = systemTime(); + GLboolean retValue = glContext->hooks->gl.glIsRenderbufferOES(renderbuffer); + nsecs_t end_time = systemTime(); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::BOOL); + rt->add_boolvalue(retValue); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +void GLTrace_glBindRenderbufferOES(GLenum target, GLuint renderbuffer) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glBindRenderbufferOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument renderbuffer + GLMessage_DataType *arg_renderbuffer = glmsg.add_args(); + arg_renderbuffer->set_isarray(false); + arg_renderbuffer->set_type(GLMessage::DataType::INT); + arg_renderbuffer->add_intvalue(renderbuffer); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glBindRenderbufferOES(target, renderbuffer); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDeleteRenderbuffersOES(GLsizei n, const GLuint* renderbuffers) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDeleteRenderbuffersOES); + + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); + + // copy argument renderbuffers + GLMessage_DataType *arg_renderbuffers = glmsg.add_args(); + arg_renderbuffers->set_isarray(false); + arg_renderbuffers->set_type(GLMessage::DataType::INT); + arg_renderbuffers->add_intvalue((int)renderbuffers); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDeleteRenderbuffersOES(n, renderbuffers); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGenRenderbuffersOES(GLsizei n, GLuint* renderbuffers) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGenRenderbuffersOES); + + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); + + // copy argument renderbuffers + GLMessage_DataType *arg_renderbuffers = glmsg.add_args(); + arg_renderbuffers->set_isarray(false); + arg_renderbuffers->set_type(GLMessage::DataType::INT); + arg_renderbuffers->add_intvalue((int)renderbuffers); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGenRenderbuffersOES(n, renderbuffers); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glRenderbufferStorageOES(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glRenderbufferStorageOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument internalformat + GLMessage_DataType *arg_internalformat = glmsg.add_args(); + arg_internalformat->set_isarray(false); + arg_internalformat->set_type(GLMessage::DataType::ENUM); + arg_internalformat->add_intvalue((int)internalformat); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glRenderbufferStorageOES(target, internalformat, width, height); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint* params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetRenderbufferParameterivOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetRenderbufferParameterivOES(target, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +GLboolean GLTrace_glIsFramebufferOES(GLuint framebuffer) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glIsFramebufferOES); + + // copy argument framebuffer + GLMessage_DataType *arg_framebuffer = glmsg.add_args(); + arg_framebuffer->set_isarray(false); + arg_framebuffer->set_type(GLMessage::DataType::INT); + arg_framebuffer->add_intvalue(framebuffer); + + // call function + nsecs_t start_time = systemTime(); + GLboolean retValue = glContext->hooks->gl.glIsFramebufferOES(framebuffer); + nsecs_t end_time = systemTime(); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::BOOL); + rt->add_boolvalue(retValue); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +void GLTrace_glBindFramebufferOES(GLenum target, GLuint framebuffer) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glBindFramebufferOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument framebuffer + GLMessage_DataType *arg_framebuffer = glmsg.add_args(); + arg_framebuffer->set_isarray(false); + arg_framebuffer->set_type(GLMessage::DataType::INT); + arg_framebuffer->add_intvalue(framebuffer); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glBindFramebufferOES(target, framebuffer); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glDeleteFramebuffersOES(GLsizei n, const GLuint* framebuffers) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDeleteFramebuffersOES); + + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); + + // copy argument framebuffers + GLMessage_DataType *arg_framebuffers = glmsg.add_args(); + arg_framebuffers->set_isarray(false); + arg_framebuffers->set_type(GLMessage::DataType::INT); + arg_framebuffers->add_intvalue((int)framebuffers); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDeleteFramebuffersOES(n, framebuffers); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGenFramebuffersOES(GLsizei n, GLuint* framebuffers) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGenFramebuffersOES); + + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); + + // copy argument framebuffers + GLMessage_DataType *arg_framebuffers = glmsg.add_args(); + arg_framebuffers->set_isarray(false); + arg_framebuffers->set_type(GLMessage::DataType::INT); + arg_framebuffers->add_intvalue((int)framebuffers); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGenFramebuffersOES(n, framebuffers); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +GLenum GLTrace_glCheckFramebufferStatusOES(GLenum target) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glCheckFramebufferStatusOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // call function + nsecs_t start_time = systemTime(); + GLenum retValue = glContext->hooks->gl.glCheckFramebufferStatusOES(target); + nsecs_t end_time = systemTime(); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::ENUM); + rt->add_intvalue((int)retValue); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +void GLTrace_glFramebufferRenderbufferOES(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glFramebufferRenderbufferOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument attachment + GLMessage_DataType *arg_attachment = glmsg.add_args(); + arg_attachment->set_isarray(false); + arg_attachment->set_type(GLMessage::DataType::ENUM); + arg_attachment->add_intvalue((int)attachment); + + // copy argument renderbuffertarget + GLMessage_DataType *arg_renderbuffertarget = glmsg.add_args(); + arg_renderbuffertarget->set_isarray(false); + arg_renderbuffertarget->set_type(GLMessage::DataType::ENUM); + arg_renderbuffertarget->add_intvalue((int)renderbuffertarget); + + // copy argument renderbuffer + GLMessage_DataType *arg_renderbuffer = glmsg.add_args(); + arg_renderbuffer->set_isarray(false); + arg_renderbuffer->set_type(GLMessage::DataType::INT); + arg_renderbuffer->add_intvalue(renderbuffer); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glFramebufferRenderbufferOES(target, attachment, renderbuffertarget, renderbuffer); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glFramebufferTexture2DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glFramebufferTexture2DOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument attachment + GLMessage_DataType *arg_attachment = glmsg.add_args(); + arg_attachment->set_isarray(false); + arg_attachment->set_type(GLMessage::DataType::ENUM); + arg_attachment->add_intvalue((int)attachment); + + // copy argument textarget + GLMessage_DataType *arg_textarget = glmsg.add_args(); + arg_textarget->set_isarray(false); + arg_textarget->set_type(GLMessage::DataType::ENUM); + arg_textarget->add_intvalue((int)textarget); + + // copy argument texture + GLMessage_DataType *arg_texture = glmsg.add_args(); + arg_texture->set_isarray(false); + arg_texture->set_type(GLMessage::DataType::INT); + arg_texture->add_intvalue(texture); + + // copy argument level + GLMessage_DataType *arg_level = glmsg.add_args(); + arg_level->set_isarray(false); + arg_level->set_type(GLMessage::DataType::INT); + arg_level->add_intvalue(level); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glFramebufferTexture2DOES(target, attachment, textarget, texture, level); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint* params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetFramebufferAttachmentParameterivOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument attachment + GLMessage_DataType *arg_attachment = glmsg.add_args(); + arg_attachment->set_isarray(false); + arg_attachment->set_type(GLMessage::DataType::ENUM); + arg_attachment->add_intvalue((int)attachment); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetFramebufferAttachmentParameterivOES(target, attachment, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGenerateMipmapOES(GLenum target) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGenerateMipmapOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGenerateMipmapOES(target); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glCurrentPaletteMatrixOES(GLuint matrixpaletteindex) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glCurrentPaletteMatrixOES); + + // copy argument matrixpaletteindex + GLMessage_DataType *arg_matrixpaletteindex = glmsg.add_args(); + arg_matrixpaletteindex->set_isarray(false); + arg_matrixpaletteindex->set_type(GLMessage::DataType::INT); + arg_matrixpaletteindex->add_intvalue(matrixpaletteindex); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glCurrentPaletteMatrixOES(matrixpaletteindex); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glLoadPaletteFromModelViewMatrixOES(void) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glLoadPaletteFromModelViewMatrixOES); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glLoadPaletteFromModelViewMatrixOES(); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glMatrixIndexPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glMatrixIndexPointerOES); + + // copy argument size + GLMessage_DataType *arg_size = glmsg.add_args(); + arg_size->set_isarray(false); + arg_size->set_type(GLMessage::DataType::INT); + arg_size->add_intvalue(size); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); + + // copy argument stride + GLMessage_DataType *arg_stride = glmsg.add_args(); + arg_stride->set_isarray(false); + arg_stride->set_type(GLMessage::DataType::INT); + arg_stride->add_intvalue(stride); + + // copy argument pointer + GLMessage_DataType *arg_pointer = glmsg.add_args(); + arg_pointer->set_isarray(false); + arg_pointer->set_type(GLMessage::DataType::INT); + arg_pointer->add_intvalue((int)pointer); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glMatrixIndexPointerOES(size, type, stride, pointer); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glWeightPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glWeightPointerOES); + + // copy argument size + GLMessage_DataType *arg_size = glmsg.add_args(); + arg_size->set_isarray(false); + arg_size->set_type(GLMessage::DataType::INT); + arg_size->add_intvalue(size); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); + + // copy argument stride + GLMessage_DataType *arg_stride = glmsg.add_args(); + arg_stride->set_isarray(false); + arg_stride->set_type(GLMessage::DataType::INT); + arg_stride->add_intvalue(stride); + + // copy argument pointer + GLMessage_DataType *arg_pointer = glmsg.add_args(); + arg_pointer->set_isarray(false); + arg_pointer->set_type(GLMessage::DataType::INT); + arg_pointer->add_intvalue((int)pointer); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glWeightPointerOES(size, type, stride, pointer); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +GLbitfield GLTrace_glQueryMatrixxOES(GLfixed mantissa[16], GLint exponent[16]) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glQueryMatrixxOES); + + // copy argument mantissa + GLMessage_DataType *arg_mantissa = glmsg.add_args(); + arg_mantissa->set_isarray(false); + arg_mantissa->set_type(GLMessage::DataType::INT); + arg_mantissa->add_intvalue((int)mantissa); + + // copy argument exponent + GLMessage_DataType *arg_exponent = glmsg.add_args(); + arg_exponent->set_isarray(false); + arg_exponent->set_type(GLMessage::DataType::INT); + arg_exponent->add_intvalue((int)exponent); + + // call function + nsecs_t start_time = systemTime(); + GLbitfield retValue = glContext->hooks->gl.glQueryMatrixxOES(mantissa, exponent); + nsecs_t end_time = systemTime(); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::INT); + rt->add_intvalue(retValue); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +void GLTrace_glDepthRangefOES(GLclampf zNear, GLclampf zFar) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glDepthRangefOES); + + // copy argument zNear + GLMessage_DataType *arg_zNear = glmsg.add_args(); + arg_zNear->set_isarray(false); + arg_zNear->set_type(GLMessage::DataType::FLOAT); + arg_zNear->add_floatvalue(zNear); + + // copy argument zFar + GLMessage_DataType *arg_zFar = glmsg.add_args(); + arg_zFar->set_isarray(false); + arg_zFar->set_type(GLMessage::DataType::FLOAT); + arg_zFar->add_floatvalue(zFar); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glDepthRangefOES(zNear, zFar); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glFrustumfOES(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glFrustumfOES); + + // copy argument left + GLMessage_DataType *arg_left = glmsg.add_args(); + arg_left->set_isarray(false); + arg_left->set_type(GLMessage::DataType::FLOAT); + arg_left->add_floatvalue(left); + + // copy argument right + GLMessage_DataType *arg_right = glmsg.add_args(); + arg_right->set_isarray(false); + arg_right->set_type(GLMessage::DataType::FLOAT); + arg_right->add_floatvalue(right); + + // copy argument bottom + GLMessage_DataType *arg_bottom = glmsg.add_args(); + arg_bottom->set_isarray(false); + arg_bottom->set_type(GLMessage::DataType::FLOAT); + arg_bottom->add_floatvalue(bottom); + + // copy argument top + GLMessage_DataType *arg_top = glmsg.add_args(); + arg_top->set_isarray(false); + arg_top->set_type(GLMessage::DataType::FLOAT); + arg_top->add_floatvalue(top); + + // copy argument zNear + GLMessage_DataType *arg_zNear = glmsg.add_args(); + arg_zNear->set_isarray(false); + arg_zNear->set_type(GLMessage::DataType::FLOAT); + arg_zNear->add_floatvalue(zNear); + + // copy argument zFar + GLMessage_DataType *arg_zFar = glmsg.add_args(); + arg_zFar->set_isarray(false); + arg_zFar->set_type(GLMessage::DataType::FLOAT); + arg_zFar->add_floatvalue(zFar); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glFrustumfOES(left, right, bottom, top, zNear, zFar); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glOrthofOES(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glOrthofOES); + + // copy argument left + GLMessage_DataType *arg_left = glmsg.add_args(); + arg_left->set_isarray(false); + arg_left->set_type(GLMessage::DataType::FLOAT); + arg_left->add_floatvalue(left); + + // copy argument right + GLMessage_DataType *arg_right = glmsg.add_args(); + arg_right->set_isarray(false); + arg_right->set_type(GLMessage::DataType::FLOAT); + arg_right->add_floatvalue(right); + + // copy argument bottom + GLMessage_DataType *arg_bottom = glmsg.add_args(); + arg_bottom->set_isarray(false); + arg_bottom->set_type(GLMessage::DataType::FLOAT); + arg_bottom->add_floatvalue(bottom); + + // copy argument top + GLMessage_DataType *arg_top = glmsg.add_args(); + arg_top->set_isarray(false); + arg_top->set_type(GLMessage::DataType::FLOAT); + arg_top->add_floatvalue(top); + + // copy argument zNear + GLMessage_DataType *arg_zNear = glmsg.add_args(); + arg_zNear->set_isarray(false); + arg_zNear->set_type(GLMessage::DataType::FLOAT); + arg_zNear->add_floatvalue(zNear); + + // copy argument zFar + GLMessage_DataType *arg_zFar = glmsg.add_args(); + arg_zFar->set_isarray(false); + arg_zFar->set_type(GLMessage::DataType::FLOAT); + arg_zFar->add_floatvalue(zFar); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glOrthofOES(left, right, bottom, top, zNear, zFar); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glClipPlanefOES(GLenum plane, const GLfloat *equation) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glClipPlanefOES); + + // copy argument plane + GLMessage_DataType *arg_plane = glmsg.add_args(); + arg_plane->set_isarray(false); + arg_plane->set_type(GLMessage::DataType::ENUM); + arg_plane->add_intvalue((int)plane); + + // copy argument equation + GLMessage_DataType *arg_equation = glmsg.add_args(); + arg_equation->set_isarray(false); + arg_equation->set_type(GLMessage::DataType::INT); + arg_equation->add_intvalue((int)equation); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glClipPlanefOES(plane, equation); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetClipPlanefOES(GLenum pname, GLfloat eqn[4]) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetClipPlanefOES); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument eqn + GLMessage_DataType *arg_eqn = glmsg.add_args(); + arg_eqn->set_isarray(false); + arg_eqn->set_type(GLMessage::DataType::INT); + arg_eqn->add_intvalue((int)eqn); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetClipPlanefOES(pname, eqn); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glClearDepthfOES(GLclampf depth) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glClearDepthfOES); + + // copy argument depth + GLMessage_DataType *arg_depth = glmsg.add_args(); + arg_depth->set_isarray(false); + arg_depth->set_type(GLMessage::DataType::FLOAT); + arg_depth->add_floatvalue(depth); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glClearDepthfOES(depth); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexGenfOES(GLenum coord, GLenum pname, GLfloat param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexGenfOES); + + // copy argument coord + GLMessage_DataType *arg_coord = glmsg.add_args(); + arg_coord->set_isarray(false); + arg_coord->set_type(GLMessage::DataType::ENUM); + arg_coord->add_intvalue((int)coord); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::FLOAT); + arg_param->add_floatvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexGenfOES(coord, pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexGenfvOES(GLenum coord, GLenum pname, const GLfloat *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexGenfvOES); + + // copy argument coord + GLMessage_DataType *arg_coord = glmsg.add_args(); + arg_coord->set_isarray(false); + arg_coord->set_type(GLMessage::DataType::ENUM); + arg_coord->add_intvalue((int)coord); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexGenfvOES(coord, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexGeniOES(GLenum coord, GLenum pname, GLint param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexGeniOES); + + // copy argument coord + GLMessage_DataType *arg_coord = glmsg.add_args(); + arg_coord->set_isarray(false); + arg_coord->set_type(GLMessage::DataType::ENUM); + arg_coord->add_intvalue((int)coord); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexGeniOES(coord, pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexGenivOES(GLenum coord, GLenum pname, const GLint *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexGenivOES); + + // copy argument coord + GLMessage_DataType *arg_coord = glmsg.add_args(); + arg_coord->set_isarray(false); + arg_coord->set_type(GLMessage::DataType::ENUM); + arg_coord->add_intvalue((int)coord); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexGenivOES(coord, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexGenxOES(GLenum coord, GLenum pname, GLfixed param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexGenxOES); + + // copy argument coord + GLMessage_DataType *arg_coord = glmsg.add_args(); + arg_coord->set_isarray(false); + arg_coord->set_type(GLMessage::DataType::ENUM); + arg_coord->add_intvalue((int)coord); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexGenxOES(coord, pname, param); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexGenxvOES(GLenum coord, GLenum pname, const GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexGenxvOES); + + // copy argument coord + GLMessage_DataType *arg_coord = glmsg.add_args(); + arg_coord->set_isarray(false); + arg_coord->set_type(GLMessage::DataType::ENUM); + arg_coord->add_intvalue((int)coord); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glTexGenxvOES(coord, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetTexGenfvOES(GLenum coord, GLenum pname, GLfloat *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetTexGenfvOES); + + // copy argument coord + GLMessage_DataType *arg_coord = glmsg.add_args(); + arg_coord->set_isarray(false); + arg_coord->set_type(GLMessage::DataType::ENUM); + arg_coord->add_intvalue((int)coord); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetTexGenfvOES(coord, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetTexGenivOES(GLenum coord, GLenum pname, GLint *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetTexGenivOES); + + // copy argument coord + GLMessage_DataType *arg_coord = glmsg.add_args(); + arg_coord->set_isarray(false); + arg_coord->set_type(GLMessage::DataType::ENUM); + arg_coord->add_intvalue((int)coord); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetTexGenivOES(coord, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetTexGenxvOES); + + // copy argument coord + GLMessage_DataType *arg_coord = glmsg.add_args(); + arg_coord->set_isarray(false); + arg_coord->set_type(GLMessage::DataType::ENUM); + arg_coord->add_intvalue((int)coord); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glGetTexGenxvOES(coord, pname, params); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glClipPlanefIMG(GLenum p, const GLfloat *eqn) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glClipPlanefIMG); + + // copy argument p + GLMessage_DataType *arg_p = glmsg.add_args(); + arg_p->set_isarray(false); + arg_p->set_type(GLMessage::DataType::ENUM); + arg_p->add_intvalue((int)p); + + // copy argument eqn + GLMessage_DataType *arg_eqn = glmsg.add_args(); + arg_eqn->set_isarray(false); + arg_eqn->set_type(GLMessage::DataType::INT); + arg_eqn->add_intvalue((int)eqn); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glClipPlanefIMG(p, eqn); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glClipPlanexIMG(GLenum p, const GLfixed *eqn) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glClipPlanexIMG); + + // copy argument p + GLMessage_DataType *arg_p = glmsg.add_args(); + arg_p->set_isarray(false); + arg_p->set_type(GLMessage::DataType::ENUM); + arg_p->add_intvalue((int)p); + + // copy argument eqn + GLMessage_DataType *arg_eqn = glmsg.add_args(); + arg_eqn->set_isarray(false); + arg_eqn->set_type(GLMessage::DataType::INT); + arg_eqn->add_intvalue((int)eqn); + + // call function + nsecs_t start_time = systemTime(); + glContext->hooks->gl.glClipPlanexIMG(p, eqn); + nsecs_t end_time = systemTime(); + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +} + + +}; // namespace gltrace +}; // namespace android diff --git a/opengl/libs/GLES_trace/src/gltrace_api.h b/opengl/libs/GLES_trace/src/gltrace_api.h new file mode 100644 index 0000000000..71b5a5849f --- /dev/null +++ b/opengl/libs/GLES_trace/src/gltrace_api.h @@ -0,0 +1,411 @@ +/* + * Copyright 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. + * + * THIS FILE WAS GENERATED BY A SCRIPT. DO NOT EDIT. + */ + +namespace android { +namespace gltrace { + +// Declarations for GL2 APIs + +void GLTrace_glActiveTexture(GLenum texture); +void GLTrace_glAttachShader(GLuint program, GLuint shader); +void GLTrace_glBindAttribLocation(GLuint program, GLuint index, const GLchar* name); +void GLTrace_glBindBuffer(GLenum target, GLuint buffer); +void GLTrace_glBindFramebuffer(GLenum target, GLuint framebuffer); +void GLTrace_glBindRenderbuffer(GLenum target, GLuint renderbuffer); +void GLTrace_glBindTexture(GLenum target, GLuint texture); +void GLTrace_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +void GLTrace_glBlendEquation(GLenum mode); +void GLTrace_glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); +void GLTrace_glBlendFunc(GLenum sfactor, GLenum dfactor); +void GLTrace_glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +void GLTrace_glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage); +void GLTrace_glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data); +GLenum GLTrace_glCheckFramebufferStatus(GLenum target); +void GLTrace_glClear(GLbitfield mask); +void GLTrace_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +void GLTrace_glClearDepthf(GLclampf depth); +void GLTrace_glClearStencil(GLint s); +void GLTrace_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +void GLTrace_glCompileShader(GLuint shader); +void GLTrace_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data); +void GLTrace_glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data); +void GLTrace_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +void GLTrace_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLuint GLTrace_glCreateProgram(void); +GLuint GLTrace_glCreateShader(GLenum type); +void GLTrace_glCullFace(GLenum mode); +void GLTrace_glDeleteBuffers(GLsizei n, const GLuint* buffers); +void GLTrace_glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers); +void GLTrace_glDeleteProgram(GLuint program); +void GLTrace_glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers); +void GLTrace_glDeleteShader(GLuint shader); +void GLTrace_glDeleteTextures(GLsizei n, const GLuint* textures); +void GLTrace_glDepthFunc(GLenum func); +void GLTrace_glDepthMask(GLboolean flag); +void GLTrace_glDepthRangef(GLclampf zNear, GLclampf zFar); +void GLTrace_glDetachShader(GLuint program, GLuint shader); +void GLTrace_glDisable(GLenum cap); +void GLTrace_glDisableVertexAttribArray(GLuint index); +void GLTrace_glDrawArrays(GLenum mode, GLint first, GLsizei count); +void GLTrace_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices); +void GLTrace_glEnable(GLenum cap); +void GLTrace_glEnableVertexAttribArray(GLuint index); +void GLTrace_glFinish(void); +void GLTrace_glFlush(void); +void GLTrace_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +void GLTrace_glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +void GLTrace_glFrontFace(GLenum mode); +void GLTrace_glGenBuffers(GLsizei n, GLuint* buffers); +void GLTrace_glGenerateMipmap(GLenum target); +void GLTrace_glGenFramebuffers(GLsizei n, GLuint* framebuffers); +void GLTrace_glGenRenderbuffers(GLsizei n, GLuint* renderbuffers); +void GLTrace_glGenTextures(GLsizei n, GLuint* textures); +void GLTrace_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); +void GLTrace_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); +void GLTrace_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); +int GLTrace_glGetAttribLocation(GLuint program, const GLchar* name); +void GLTrace_glGetBooleanv(GLenum pname, GLboolean* params); +void GLTrace_glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params); +GLenum GLTrace_glGetError(void); +void GLTrace_glGetFloatv(GLenum pname, GLfloat* params); +void GLTrace_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params); +void GLTrace_glGetIntegerv(GLenum pname, GLint* params); +void GLTrace_glGetProgramiv(GLuint program, GLenum pname, GLint* params); +void GLTrace_glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog); +void GLTrace_glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params); +void GLTrace_glGetShaderiv(GLuint shader, GLenum pname, GLint* params); +void GLTrace_glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog); +void GLTrace_glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); +void GLTrace_glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source); +const GLubyte* GLTrace_glGetString(GLenum name); +void GLTrace_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params); +void GLTrace_glGetTexParameteriv(GLenum target, GLenum pname, GLint* params); +void GLTrace_glGetUniformfv(GLuint program, GLint location, GLfloat* params); +void GLTrace_glGetUniformiv(GLuint program, GLint location, GLint* params); +int GLTrace_glGetUniformLocation(GLuint program, const GLchar* name); +void GLTrace_glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params); +void GLTrace_glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params); +void GLTrace_glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer); +void GLTrace_glHint(GLenum target, GLenum mode); +GLboolean GLTrace_glIsBuffer(GLuint buffer); +GLboolean GLTrace_glIsEnabled(GLenum cap); +GLboolean GLTrace_glIsFramebuffer(GLuint framebuffer); +GLboolean GLTrace_glIsProgram(GLuint program); +GLboolean GLTrace_glIsRenderbuffer(GLuint renderbuffer); +GLboolean GLTrace_glIsShader(GLuint shader); +GLboolean GLTrace_glIsTexture(GLuint texture); +void GLTrace_glLineWidth(GLfloat width); +void GLTrace_glLinkProgram(GLuint program); +void GLTrace_glPixelStorei(GLenum pname, GLint param); +void GLTrace_glPolygonOffset(GLfloat factor, GLfloat units); +void GLTrace_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); +void GLTrace_glReleaseShaderCompiler(void); +void GLTrace_glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +void GLTrace_glSampleCoverage(GLclampf value, GLboolean invert); +void GLTrace_glScissor(GLint x, GLint y, GLsizei width, GLsizei height); +void GLTrace_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length); +void GLTrace_glShaderSource(GLuint shader, GLsizei count, const GLchar** string, const GLint* length); +void GLTrace_glStencilFunc(GLenum func, GLint ref, GLuint mask); +void GLTrace_glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); +void GLTrace_glStencilMask(GLuint mask); +void GLTrace_glStencilMaskSeparate(GLenum face, GLuint mask); +void GLTrace_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass); +void GLTrace_glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); +void GLTrace_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels); +void GLTrace_glTexParameterf(GLenum target, GLenum pname, GLfloat param); +void GLTrace_glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params); +void GLTrace_glTexParameteri(GLenum target, GLenum pname, GLint param); +void GLTrace_glTexParameteriv(GLenum target, GLenum pname, const GLint* params); +void GLTrace_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels); +void GLTrace_glUniform1f(GLint location, GLfloat x); +void GLTrace_glUniform1fv(GLint location, GLsizei count, const GLfloat* v); +void GLTrace_glUniform1i(GLint location, GLint x); +void GLTrace_glUniform1iv(GLint location, GLsizei count, const GLint* v); +void GLTrace_glUniform2f(GLint location, GLfloat x, GLfloat y); +void GLTrace_glUniform2fv(GLint location, GLsizei count, const GLfloat* v); +void GLTrace_glUniform2i(GLint location, GLint x, GLint y); +void GLTrace_glUniform2iv(GLint location, GLsizei count, const GLint* v); +void GLTrace_glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z); +void GLTrace_glUniform3fv(GLint location, GLsizei count, const GLfloat* v); +void GLTrace_glUniform3i(GLint location, GLint x, GLint y, GLint z); +void GLTrace_glUniform3iv(GLint location, GLsizei count, const GLint* v); +void GLTrace_glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +void GLTrace_glUniform4fv(GLint location, GLsizei count, const GLfloat* v); +void GLTrace_glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w); +void GLTrace_glUniform4iv(GLint location, GLsizei count, const GLint* v); +void GLTrace_glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +void GLTrace_glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +void GLTrace_glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +void GLTrace_glUseProgram(GLuint program); +void GLTrace_glValidateProgram(GLuint program); +void GLTrace_glVertexAttrib1f(GLuint indx, GLfloat x); +void GLTrace_glVertexAttrib1fv(GLuint indx, const GLfloat* values); +void GLTrace_glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y); +void GLTrace_glVertexAttrib2fv(GLuint indx, const GLfloat* values); +void GLTrace_glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z); +void GLTrace_glVertexAttrib3fv(GLuint indx, const GLfloat* values); +void GLTrace_glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +void GLTrace_glVertexAttrib4fv(GLuint indx, const GLfloat* values); +void GLTrace_glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr); +void GLTrace_glViewport(GLint x, GLint y, GLsizei width, GLsizei height); + +// Declarations for GL2Ext APIs + +void GLTrace_glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image); +void GLTrace_glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image); +void GLTrace_glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); +void GLTrace_glProgramBinaryOES(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); +void* GLTrace_glMapBufferOES(GLenum target, GLenum access); +GLboolean GLTrace_glUnmapBufferOES(GLenum target); +void GLTrace_glGetBufferPointervOES(GLenum target, GLenum pname, GLvoid** params); +void GLTrace_glTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); +void GLTrace_glTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); +void GLTrace_glCopyTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +void GLTrace_glCompressedTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data); +void GLTrace_glCompressedTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data); +void GLTrace_glFramebufferTexture3DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +void GLTrace_glBindVertexArrayOES(GLuint array); +void GLTrace_glDeleteVertexArraysOES(GLsizei n, const GLuint *arrays); +void GLTrace_glGenVertexArraysOES(GLsizei n, GLuint *arrays); +GLboolean GLTrace_glIsVertexArrayOES(GLuint array); +void GLTrace_glGetPerfMonitorGroupsAMD(GLint *numGroups, GLsizei groupsSize, GLuint *groups); +void GLTrace_glGetPerfMonitorCountersAMD(GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +void GLTrace_glGetPerfMonitorGroupStringAMD(GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +void GLTrace_glGetPerfMonitorCounterStringAMD(GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +void GLTrace_glGetPerfMonitorCounterInfoAMD(GLuint group, GLuint counter, GLenum pname, GLvoid *data); +void GLTrace_glGenPerfMonitorsAMD(GLsizei n, GLuint *monitors); +void GLTrace_glDeletePerfMonitorsAMD(GLsizei n, GLuint *monitors); +void GLTrace_glSelectPerfMonitorCountersAMD(GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList); +void GLTrace_glBeginPerfMonitorAMD(GLuint monitor); +void GLTrace_glEndPerfMonitorAMD(GLuint monitor); +void GLTrace_glGetPerfMonitorCounterDataAMD(GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); +void GLTrace_glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments); +void GLTrace_glMultiDrawArraysEXT(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +void GLTrace_glMultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +void GLTrace_glRenderbufferStorageMultisampleIMG(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +void GLTrace_glFramebufferTexture2DMultisampleIMG(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +void GLTrace_glDeleteFencesNV(GLsizei n, const GLuint *fences); +void GLTrace_glGenFencesNV(GLsizei n, GLuint *fences); +GLboolean GLTrace_glIsFenceNV(GLuint fence); +GLboolean GLTrace_glTestFenceNV(GLuint fence); +void GLTrace_glGetFenceivNV(GLuint fence, GLenum pname, GLint *params); +void GLTrace_glFinishFenceNV(GLuint fence); +void GLTrace_glSetFenceNV(GLuint fence, GLenum condition); +void GLTrace_glCoverageMaskNV(GLboolean mask); +void GLTrace_glCoverageOperationNV(GLenum operation); +void GLTrace_glGetDriverControlsQCOM(GLint *num, GLsizei size, GLuint *driverControls); +void GLTrace_glGetDriverControlStringQCOM(GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); +void GLTrace_glEnableDriverControlQCOM(GLuint driverControl); +void GLTrace_glDisableDriverControlQCOM(GLuint driverControl); +void GLTrace_glExtGetTexturesQCOM(GLuint *textures, GLint maxTextures, GLint *numTextures); +void GLTrace_glExtGetBuffersQCOM(GLuint *buffers, GLint maxBuffers, GLint *numBuffers); +void GLTrace_glExtGetRenderbuffersQCOM(GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); +void GLTrace_glExtGetFramebuffersQCOM(GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); +void GLTrace_glExtGetTexLevelParameterivQCOM(GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); +void GLTrace_glExtTexObjectStateOverrideiQCOM(GLenum target, GLenum pname, GLint param); +void GLTrace_glExtGetTexSubImageQCOM(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); +void GLTrace_glExtGetBufferPointervQCOM(GLenum target, GLvoid **params); +void GLTrace_glExtGetShadersQCOM(GLuint *shaders, GLint maxShaders, GLint *numShaders); +void GLTrace_glExtGetProgramsQCOM(GLuint *programs, GLint maxPrograms, GLint *numPrograms); +GLboolean GLTrace_glExtIsProgramBinaryQCOM(GLuint program); +void GLTrace_glExtGetProgramBinarySourceQCOM(GLuint program, GLenum shadertype, GLchar *source, GLint *length); +void GLTrace_glStartTilingQCOM(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); +void GLTrace_glEndTilingQCOM(GLbitfield preserveMask); + +// Declarations for GL1 APIs + +void GLTrace_glAlphaFunc(GLenum func, GLclampf ref); +void GLTrace_glClipPlanef(GLenum plane, const GLfloat *equation); +void GLTrace_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +void GLTrace_glFogf(GLenum pname, GLfloat param); +void GLTrace_glFogfv(GLenum pname, const GLfloat *params); +void GLTrace_glFrustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +void GLTrace_glGetClipPlanef(GLenum pname, GLfloat eqn[4]); +void GLTrace_glGetLightfv(GLenum light, GLenum pname, GLfloat *params); +void GLTrace_glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params); +void GLTrace_glGetTexEnvfv(GLenum env, GLenum pname, GLfloat *params); +void GLTrace_glLightModelf(GLenum pname, GLfloat param); +void GLTrace_glLightModelfv(GLenum pname, const GLfloat *params); +void GLTrace_glLightf(GLenum light, GLenum pname, GLfloat param); +void GLTrace_glLightfv(GLenum light, GLenum pname, const GLfloat *params); +void GLTrace_glLoadMatrixf(const GLfloat *m); +void GLTrace_glMaterialf(GLenum face, GLenum pname, GLfloat param); +void GLTrace_glMaterialfv(GLenum face, GLenum pname, const GLfloat *params); +void GLTrace_glMultMatrixf(const GLfloat *m); +void GLTrace_glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +void GLTrace_glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz); +void GLTrace_glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +void GLTrace_glPointParameterf(GLenum pname, GLfloat param); +void GLTrace_glPointParameterfv(GLenum pname, const GLfloat *params); +void GLTrace_glPointSize(GLfloat size); +void GLTrace_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +void GLTrace_glScalef(GLfloat x, GLfloat y, GLfloat z); +void GLTrace_glTexEnvf(GLenum target, GLenum pname, GLfloat param); +void GLTrace_glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params); +void GLTrace_glTranslatef(GLfloat x, GLfloat y, GLfloat z); +void GLTrace_glAlphaFuncx(GLenum func, GLclampx ref); +void GLTrace_glClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); +void GLTrace_glClearDepthx(GLclampx depth); +void GLTrace_glClientActiveTexture(GLenum texture); +void GLTrace_glClipPlanex(GLenum plane, const GLfixed *equation); +void GLTrace_glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); +void GLTrace_glColor4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +void GLTrace_glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +void GLTrace_glDepthRangex(GLclampx zNear, GLclampx zFar); +void GLTrace_glDisableClientState(GLenum array); +void GLTrace_glEnableClientState(GLenum array); +void GLTrace_glFogx(GLenum pname, GLfixed param); +void GLTrace_glFogxv(GLenum pname, const GLfixed *params); +void GLTrace_glFrustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +void GLTrace_glGetClipPlanex(GLenum pname, GLfixed eqn[4]); +void GLTrace_glGetFixedv(GLenum pname, GLfixed *params); +void GLTrace_glGetLightxv(GLenum light, GLenum pname, GLfixed *params); +void GLTrace_glGetMaterialxv(GLenum face, GLenum pname, GLfixed *params); +void GLTrace_glGetPointerv(GLenum pname, GLvoid **params); +void GLTrace_glGetTexEnviv(GLenum env, GLenum pname, GLint *params); +void GLTrace_glGetTexEnvxv(GLenum env, GLenum pname, GLfixed *params); +void GLTrace_glGetTexParameterxv(GLenum target, GLenum pname, GLfixed *params); +void GLTrace_glLightModelx(GLenum pname, GLfixed param); +void GLTrace_glLightModelxv(GLenum pname, const GLfixed *params); +void GLTrace_glLightx(GLenum light, GLenum pname, GLfixed param); +void GLTrace_glLightxv(GLenum light, GLenum pname, const GLfixed *params); +void GLTrace_glLineWidthx(GLfixed width); +void GLTrace_glLoadIdentity(void); +void GLTrace_glLoadMatrixx(const GLfixed *m); +void GLTrace_glLogicOp(GLenum opcode); +void GLTrace_glMaterialx(GLenum face, GLenum pname, GLfixed param); +void GLTrace_glMaterialxv(GLenum face, GLenum pname, const GLfixed *params); +void GLTrace_glMatrixMode(GLenum mode); +void GLTrace_glMultMatrixx(const GLfixed *m); +void GLTrace_glMultiTexCoord4x(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q); +void GLTrace_glNormal3x(GLfixed nx, GLfixed ny, GLfixed nz); +void GLTrace_glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer); +void GLTrace_glOrthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +void GLTrace_glPointParameterx(GLenum pname, GLfixed param); +void GLTrace_glPointParameterxv(GLenum pname, const GLfixed *params); +void GLTrace_glPointSizex(GLfixed size); +void GLTrace_glPolygonOffsetx(GLfixed factor, GLfixed units); +void GLTrace_glPopMatrix(void); +void GLTrace_glPushMatrix(void); +void GLTrace_glRotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z); +void GLTrace_glSampleCoveragex(GLclampx value, GLboolean invert); +void GLTrace_glScalex(GLfixed x, GLfixed y, GLfixed z); +void GLTrace_glShadeModel(GLenum mode); +void GLTrace_glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +void GLTrace_glTexEnvi(GLenum target, GLenum pname, GLint param); +void GLTrace_glTexEnvx(GLenum target, GLenum pname, GLfixed param); +void GLTrace_glTexEnviv(GLenum target, GLenum pname, const GLint *params); +void GLTrace_glTexEnvxv(GLenum target, GLenum pname, const GLfixed *params); +void GLTrace_glTexParameterx(GLenum target, GLenum pname, GLfixed param); +void GLTrace_glTexParameterxv(GLenum target, GLenum pname, const GLfixed *params); +void GLTrace_glTranslatex(GLfixed x, GLfixed y, GLfixed z); +void GLTrace_glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +void GLTrace_glPointSizePointerOES(GLenum type, GLsizei stride, const GLvoid *pointer); + +// Declarations for GL1Ext APIs + +void GLTrace_glBlendEquationSeparateOES(GLenum modeRGB, GLenum modeAlpha); +void GLTrace_glBlendFuncSeparateOES(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +void GLTrace_glBlendEquationOES(GLenum mode); +void GLTrace_glDrawTexsOES(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height); +void GLTrace_glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height); +void GLTrace_glDrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height); +void GLTrace_glDrawTexsvOES(const GLshort *coords); +void GLTrace_glDrawTexivOES(const GLint *coords); +void GLTrace_glDrawTexxvOES(const GLfixed *coords); +void GLTrace_glDrawTexfOES(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height); +void GLTrace_glDrawTexfvOES(const GLfloat *coords); +void GLTrace_glAlphaFuncxOES(GLenum func, GLclampx ref); +void GLTrace_glClearColorxOES(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); +void GLTrace_glClearDepthxOES(GLclampx depth); +void GLTrace_glClipPlanexOES(GLenum plane, const GLfixed *equation); +void GLTrace_glColor4xOES(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +void GLTrace_glDepthRangexOES(GLclampx zNear, GLclampx zFar); +void GLTrace_glFogxOES(GLenum pname, GLfixed param); +void GLTrace_glFogxvOES(GLenum pname, const GLfixed *params); +void GLTrace_glFrustumxOES(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +void GLTrace_glGetClipPlanexOES(GLenum pname, GLfixed eqn[4]); +void GLTrace_glGetFixedvOES(GLenum pname, GLfixed *params); +void GLTrace_glGetLightxvOES(GLenum light, GLenum pname, GLfixed *params); +void GLTrace_glGetMaterialxvOES(GLenum face, GLenum pname, GLfixed *params); +void GLTrace_glGetTexEnvxvOES(GLenum env, GLenum pname, GLfixed *params); +void GLTrace_glGetTexParameterxvOES(GLenum target, GLenum pname, GLfixed *params); +void GLTrace_glLightModelxOES(GLenum pname, GLfixed param); +void GLTrace_glLightModelxvOES(GLenum pname, const GLfixed *params); +void GLTrace_glLightxOES(GLenum light, GLenum pname, GLfixed param); +void GLTrace_glLightxvOES(GLenum light, GLenum pname, const GLfixed *params); +void GLTrace_glLineWidthxOES(GLfixed width); +void GLTrace_glLoadMatrixxOES(const GLfixed *m); +void GLTrace_glMaterialxOES(GLenum face, GLenum pname, GLfixed param); +void GLTrace_glMaterialxvOES(GLenum face, GLenum pname, const GLfixed *params); +void GLTrace_glMultMatrixxOES(const GLfixed *m); +void GLTrace_glMultiTexCoord4xOES(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q); +void GLTrace_glNormal3xOES(GLfixed nx, GLfixed ny, GLfixed nz); +void GLTrace_glOrthoxOES(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +void GLTrace_glPointParameterxOES(GLenum pname, GLfixed param); +void GLTrace_glPointParameterxvOES(GLenum pname, const GLfixed *params); +void GLTrace_glPointSizexOES(GLfixed size); +void GLTrace_glPolygonOffsetxOES(GLfixed factor, GLfixed units); +void GLTrace_glRotatexOES(GLfixed angle, GLfixed x, GLfixed y, GLfixed z); +void GLTrace_glSampleCoveragexOES(GLclampx value, GLboolean invert); +void GLTrace_glScalexOES(GLfixed x, GLfixed y, GLfixed z); +void GLTrace_glTexEnvxOES(GLenum target, GLenum pname, GLfixed param); +void GLTrace_glTexEnvxvOES(GLenum target, GLenum pname, const GLfixed *params); +void GLTrace_glTexParameterxOES(GLenum target, GLenum pname, GLfixed param); +void GLTrace_glTexParameterxvOES(GLenum target, GLenum pname, const GLfixed *params); +void GLTrace_glTranslatexOES(GLfixed x, GLfixed y, GLfixed z); +GLboolean GLTrace_glIsRenderbufferOES(GLuint renderbuffer); +void GLTrace_glBindRenderbufferOES(GLenum target, GLuint renderbuffer); +void GLTrace_glDeleteRenderbuffersOES(GLsizei n, const GLuint* renderbuffers); +void GLTrace_glGenRenderbuffersOES(GLsizei n, GLuint* renderbuffers); +void GLTrace_glRenderbufferStorageOES(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +void GLTrace_glGetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint* params); +GLboolean GLTrace_glIsFramebufferOES(GLuint framebuffer); +void GLTrace_glBindFramebufferOES(GLenum target, GLuint framebuffer); +void GLTrace_glDeleteFramebuffersOES(GLsizei n, const GLuint* framebuffers); +void GLTrace_glGenFramebuffersOES(GLsizei n, GLuint* framebuffers); +GLenum GLTrace_glCheckFramebufferStatusOES(GLenum target); +void GLTrace_glFramebufferRenderbufferOES(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +void GLTrace_glFramebufferTexture2DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +void GLTrace_glGetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint* params); +void GLTrace_glGenerateMipmapOES(GLenum target); +void GLTrace_glCurrentPaletteMatrixOES(GLuint matrixpaletteindex); +void GLTrace_glLoadPaletteFromModelViewMatrixOES(void); +void GLTrace_glMatrixIndexPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +void GLTrace_glWeightPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLbitfield GLTrace_glQueryMatrixxOES(GLfixed mantissa[16], GLint exponent[16]); +void GLTrace_glDepthRangefOES(GLclampf zNear, GLclampf zFar); +void GLTrace_glFrustumfOES(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +void GLTrace_glOrthofOES(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +void GLTrace_glClipPlanefOES(GLenum plane, const GLfloat *equation); +void GLTrace_glGetClipPlanefOES(GLenum pname, GLfloat eqn[4]); +void GLTrace_glClearDepthfOES(GLclampf depth); +void GLTrace_glTexGenfOES(GLenum coord, GLenum pname, GLfloat param); +void GLTrace_glTexGenfvOES(GLenum coord, GLenum pname, const GLfloat *params); +void GLTrace_glTexGeniOES(GLenum coord, GLenum pname, GLint param); +void GLTrace_glTexGenivOES(GLenum coord, GLenum pname, const GLint *params); +void GLTrace_glTexGenxOES(GLenum coord, GLenum pname, GLfixed param); +void GLTrace_glTexGenxvOES(GLenum coord, GLenum pname, const GLfixed *params); +void GLTrace_glGetTexGenfvOES(GLenum coord, GLenum pname, GLfloat *params); +void GLTrace_glGetTexGenivOES(GLenum coord, GLenum pname, GLint *params); +void GLTrace_glGetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params); +void GLTrace_glClipPlanefIMG(GLenum p, const GLfloat *eqn); +void GLTrace_glClipPlanexIMG(GLenum p, const GLfixed *eqn); + +}; // namespace gltrace +}; // namespace android diff --git a/opengl/libs/GLES_trace/src/gltrace_context.cpp b/opengl/libs/GLES_trace/src/gltrace_context.cpp new file mode 100644 index 0000000000..65b7662e64 --- /dev/null +++ b/opengl/libs/GLES_trace/src/gltrace_context.cpp @@ -0,0 +1,212 @@ +/* + * Copyright 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. + */ + +#include <pthread.h> +#include <cutils/log.h> + +extern "C" { +#include "liblzf/lzf.h" +} + +#include "gltrace_context.h" + +namespace android { +namespace gltrace { + +using ::android::gl_hooks_t; + +static pthread_key_t sTLSKey = -1; +static pthread_once_t sPthreadOnceKey = PTHREAD_ONCE_INIT; + +void createTLSKey() { + pthread_key_create(&sTLSKey, NULL); +} + +GLTraceContext *getGLTraceContext() { + return (GLTraceContext*) pthread_getspecific(sTLSKey); +} + +void setGLTraceContext(GLTraceContext *c) { + pthread_setspecific(sTLSKey, c); +} + +void setupTraceContextThreadSpecific(GLTraceContext *context) { + pthread_once(&sPthreadOnceKey, createTLSKey); + setGLTraceContext(context); +} + +void releaseContext() { + GLTraceContext *c = getGLTraceContext(); + if (c != NULL) { + delete c; + setGLTraceContext(NULL); + } +} + +GLTraceState::GLTraceState(TCPStream *stream) { + mTraceContextIds = 0; + mStream = stream; + + mCollectFbOnEglSwap = false; + mCollectFbOnGlDraw = false; + mCollectTextureDataOnGlTexImage = false; + pthread_rwlock_init(&mTraceOptionsRwLock, NULL); +} + +GLTraceState::~GLTraceState() { + if (mStream) { + mStream->closeStream(); + mStream = NULL; + } +} + +TCPStream *GLTraceState::getStream() { + return mStream; +} + +void GLTraceState::safeSetValue(bool *ptr, bool value, pthread_rwlock_t *lock) { + pthread_rwlock_wrlock(lock); + *ptr = value; + pthread_rwlock_unlock(lock); +} + +bool GLTraceState::safeGetValue(bool *ptr, pthread_rwlock_t *lock) { + pthread_rwlock_rdlock(lock); + bool value = *ptr; + pthread_rwlock_unlock(lock); + return value; +} + +void GLTraceState::setCollectFbOnEglSwap(bool en) { + safeSetValue(&mCollectFbOnEglSwap, en, &mTraceOptionsRwLock); +} + +void GLTraceState::setCollectFbOnGlDraw(bool en) { + safeSetValue(&mCollectFbOnGlDraw, en, &mTraceOptionsRwLock); +} + +void GLTraceState::setCollectTextureDataOnGlTexImage(bool en) { + safeSetValue(&mCollectTextureDataOnGlTexImage, en, &mTraceOptionsRwLock); +} + +bool GLTraceState::shouldCollectFbOnEglSwap() { + return safeGetValue(&mCollectFbOnEglSwap, &mTraceOptionsRwLock); +} + +bool GLTraceState::shouldCollectFbOnGlDraw() { + return safeGetValue(&mCollectFbOnGlDraw, &mTraceOptionsRwLock); +} + +bool GLTraceState::shouldCollectTextureDataOnGlTexImage() { + return safeGetValue(&mCollectTextureDataOnGlTexImage, &mTraceOptionsRwLock); +} + +GLTraceContext *GLTraceState::createTraceContext(int version, EGLContext eglContext) { + int id = __sync_fetch_and_add(&mTraceContextIds, 1); + + const size_t DEFAULT_BUFFER_SIZE = 8192; + BufferedOutputStream *stream = new BufferedOutputStream(mStream, DEFAULT_BUFFER_SIZE); + GLTraceContext *traceContext = new GLTraceContext(id, this, stream); + mPerContextState[eglContext] = traceContext; + + return traceContext; +} + +GLTraceContext *GLTraceState::getTraceContext(EGLContext c) { + return mPerContextState[c]; +} + +GLTraceContext::GLTraceContext(int id, GLTraceState *state, BufferedOutputStream *stream) { + mId = id; + mState = state; + + fbcontents = fbcompressed = NULL; + fbcontentsSize = 0; + mBufferedOutputStream = stream; +} + +int GLTraceContext::getId() { + return mId; +} + +GLTraceState *GLTraceContext::getGlobalTraceState() { + return mState; +} + +void GLTraceContext::resizeFBMemory(unsigned minSize) { + if (fbcontentsSize >= minSize) { + return; + } + + if (fbcontents != NULL) { + free(fbcontents); + free(fbcompressed); + } + + fbcontents = malloc(minSize); + fbcompressed = malloc(minSize); + + fbcontentsSize = minSize; +} + +/** obtain a pointer to the compressed framebuffer image */ +void GLTraceContext::getCompressedFB(void **fb, unsigned *fbsize, unsigned *fbwidth, + unsigned *fbheight, FBBinding fbToRead) { + int viewport[4] = {}; + hooks->gl.glGetIntegerv(GL_VIEWPORT, viewport); + unsigned fbContentsSize = viewport[2] * viewport[3] * 4; + + resizeFBMemory(fbContentsSize); + + // switch current framebuffer binding if necessary + GLint currentFb = -1; + bool fbSwitched = false; + if (fbToRead != CURRENTLY_BOUND_FB) { + hooks->gl.glGetIntegerv(GL_FRAMEBUFFER_BINDING, ¤tFb); + + if (currentFb != 0) { + hooks->gl.glBindFramebuffer(GL_FRAMEBUFFER, 0); + fbSwitched = true; + } + } + + hooks->gl.glReadPixels(viewport[0], viewport[1], viewport[2], viewport[3], + GL_RGBA, GL_UNSIGNED_BYTE, fbcontents); + + // switch back to previously bound buffer if necessary + if (fbSwitched) { + hooks->gl.glBindFramebuffer(GL_FRAMEBUFFER, currentFb); + } + + *fbsize = lzf_compress(fbcontents, fbContentsSize, fbcompressed, fbContentsSize); + *fb = fbcompressed; + *fbwidth = viewport[2]; + *fbheight = viewport[3]; +} + +void GLTraceContext::traceGLMessage(GLMessage *msg) { + mBufferedOutputStream->send(msg); + + GLMessage_Function func = msg->function(); + if (func == GLMessage::eglSwapBuffers + || func == GLMessage::glDrawArrays + || func == GLMessage::glDrawElements) { + mBufferedOutputStream->flush(); + } +} + +}; // namespace gltrace +}; // namespace android diff --git a/opengl/libs/GLES_trace/src/gltrace_context.h b/opengl/libs/GLES_trace/src/gltrace_context.h new file mode 100644 index 0000000000..129116a1dd --- /dev/null +++ b/opengl/libs/GLES_trace/src/gltrace_context.h @@ -0,0 +1,102 @@ +/* + * Copyright 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 __GLTRACE_CONTEXT_H_ +#define __GLTRACE_CONTEXT_H_ + +#include <map> +#include <pthread.h> + +#include "hooks.h" +#include "gltrace_transport.h" + +namespace android { +namespace gltrace { + +using ::android::gl_hooks_t; + +enum FBBinding {CURRENTLY_BOUND_FB, FB0}; + +class GLTraceState; + +/** GL Trace Context info associated with each EGLContext */ +class GLTraceContext { + int mId; /* unique context id */ + GLTraceState *mState; /* parent GL Trace state (for per process GL Trace State Info) */ + + void *fbcontents; /* memory area to read framebuffer contents */ + void *fbcompressed; /* destination for lzf compressed framebuffer */ + unsigned fbcontentsSize; /* size of fbcontents & fbcompressed buffers */ + + BufferedOutputStream *mBufferedOutputStream; /* stream where trace info is sent */ + + void resizeFBMemory(unsigned minSize); +public: + gl_hooks_t *hooks; + + GLTraceContext(int id, GLTraceState *state, BufferedOutputStream *stream); + int getId(); + GLTraceState *getGlobalTraceState(); + void getCompressedFB(void **fb, unsigned *fbsize, + unsigned *fbwidth, unsigned *fbheight, + FBBinding fbToRead); + void traceGLMessage(GLMessage *msg); +}; + +/** Per process trace state. */ +class GLTraceState { + int mTraceContextIds; + TCPStream *mStream; + std::map<EGLContext, GLTraceContext*> mPerContextState; + + /* Options controlling additional data to be collected on + certain trace calls. */ + bool mCollectFbOnEglSwap; + bool mCollectFbOnGlDraw; + bool mCollectTextureDataOnGlTexImage; + pthread_rwlock_t mTraceOptionsRwLock; + + /* helper methods to get/set values using provided lock for mutual exclusion. */ + void safeSetValue(bool *ptr, bool value, pthread_rwlock_t *lock); + bool safeGetValue(bool *ptr, pthread_rwlock_t *lock); +public: + GLTraceState(TCPStream *stream); + ~GLTraceState(); + + GLTraceContext *createTraceContext(int version, EGLContext c); + GLTraceContext *getTraceContext(EGLContext c); + + TCPStream *getStream(); + + /* Methods to set trace options. */ + void setCollectFbOnEglSwap(bool en); + void setCollectFbOnGlDraw(bool en); + void setCollectTextureDataOnGlTexImage(bool en); + + /* Methods to retrieve trace options. */ + bool shouldCollectFbOnEglSwap(); + bool shouldCollectFbOnGlDraw(); + bool shouldCollectTextureDataOnGlTexImage(); +}; + +void setupTraceContextThreadSpecific(GLTraceContext *context); +GLTraceContext *getGLTraceContext(); +void releaseContext(); + +}; +}; + +#endif diff --git a/opengl/libs/GLES_trace/src/gltrace_egl.cpp b/opengl/libs/GLES_trace/src/gltrace_egl.cpp new file mode 100644 index 0000000000..9d1682a59f --- /dev/null +++ b/opengl/libs/GLES_trace/src/gltrace_egl.cpp @@ -0,0 +1,94 @@ +/* + * Copyright 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. + */ + +#include <cutils/log.h> +#include <utils/Timers.h> + +#include "gltrace.pb.h" +#include "gltrace_context.h" +#include "gltrace_fixup.h" +#include "gltrace_transport.h" + +namespace android { +namespace gltrace { + +void GLTrace_eglCreateContext(int version, int contextId) { + GLMessage glmessage; + GLTraceContext *glContext = getGLTraceContext(); + + glmessage.set_context_id(contextId); + glmessage.set_function(GLMessage::eglCreateContext); + + // copy argument version + GLMessage_DataType *arg_version = glmessage.add_args(); + arg_version->set_isarray(false); + arg_version->set_type(GLMessage::DataType::INT); + arg_version->add_intvalue(version); + + // copy argument context + GLMessage_DataType *arg_context = glmessage.add_args(); + arg_context->set_isarray(false); + arg_context->set_type(GLMessage::DataType::INT); + arg_context->add_intvalue(contextId); + + // set start time and duration + glmessage.set_start_time(systemTime()); + glmessage.set_duration(0); + + glContext->traceGLMessage(&glmessage); +} + +void GLTrace_eglMakeCurrent(int contextId) { + GLMessage glmessage; + GLTraceContext *glContext = getGLTraceContext(); + + glmessage.set_context_id(contextId); + glmessage.set_function(GLMessage::eglMakeCurrent); + + // copy argument context + GLMessage_DataType *arg_context = glmessage.add_args(); + arg_context->set_isarray(false); + arg_context->set_type(GLMessage::DataType::INT); + arg_context->add_intvalue(contextId); + + // set start time and duration + glmessage.set_start_time(systemTime()); + glmessage.set_duration(0); + + glContext->traceGLMessage(&glmessage); +} + +void GLTrace_eglSwapBuffers(void *dpy, void *draw) { + GLMessage glmessage; + GLTraceContext *glContext = getGLTraceContext(); + + glmessage.set_context_id(glContext->getId()); + glmessage.set_function(GLMessage::eglSwapBuffers); + + if (glContext->getGlobalTraceState()->shouldCollectFbOnEglSwap()) { + // read FB0 since that is what is displayed on the screen + fixup_addFBContents(glContext, &glmessage, FB0); + } + + // set start time and duration + glmessage.set_start_time(systemTime()); + glmessage.set_duration(0); + + glContext->traceGLMessage(&glmessage); +} + +}; +}; diff --git a/opengl/libs/GLES_trace/src/gltrace_egl.h b/opengl/libs/GLES_trace/src/gltrace_egl.h new file mode 100644 index 0000000000..f4684c5a3f --- /dev/null +++ b/opengl/libs/GLES_trace/src/gltrace_egl.h @@ -0,0 +1,30 @@ +/* + * Copyright 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 __GLTRACE_EGL_H_ +#define __GLTRACE_EGL_H_ + +namespace android { +namespace gltrace { + +void GLTrace_eglCreateContext(int version, int contextId); +void GLTrace_eglMakeCurrent(int contextId); +void GLTrace_eglSwapBuffers(void *dpy, void *draw); + +}; +}; + +#endif diff --git a/opengl/libs/GLES_trace/src/gltrace_eglapi.cpp b/opengl/libs/GLES_trace/src/gltrace_eglapi.cpp new file mode 100644 index 0000000000..c237d75fcd --- /dev/null +++ b/opengl/libs/GLES_trace/src/gltrace_eglapi.cpp @@ -0,0 +1,136 @@ +/* + * Copyright 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. + */ + +#include <arpa/inet.h> +#include <stdlib.h> +#include <cutils/log.h> +#include <cutils/properties.h> + +#include "hooks.h" +#include "glestrace.h" + +#include "gltrace_context.h" +#include "gltrace_egl.h" +#include "gltrace_hooks.h" +#include "gltrace_transport.h" + +namespace android { + +using gltrace::GLTraceState; +using gltrace::GLTraceContext; +using gltrace::TCPStream; + +static GLTraceState *sGLTraceState; +static pthread_t sReceiveThreadId; + +/** + * Task that monitors the control stream from the host and updates + * the trace status according to commands received from the host. + */ +static void *commandReceiveTask(void *arg) { + GLTraceState *state = (GLTraceState *)arg; + TCPStream *stream = state->getStream(); + + // Currently, there are very few user configurable settings. + // As a result, they can be encoded in a single integer. + int cmd; + enum TraceSettingsMasks { + READ_FB_ON_EGLSWAP_MASK = 1 << 0, + READ_FB_ON_GLDRAW_MASK = 1 << 1, + READ_TEXTURE_DATA_ON_GLTEXIMAGE_MASK = 1 << 2, + }; + + while (true) { + int n = stream->receive(&cmd, 4); + if (n != 4) { + break; + } + + cmd = ntohl(cmd); + + bool collectFbOnEglSwap = (cmd & READ_FB_ON_EGLSWAP_MASK) != 0; + bool collectFbOnGlDraw = (cmd & READ_FB_ON_GLDRAW_MASK) != 0; + bool collectTextureData = (cmd & READ_TEXTURE_DATA_ON_GLTEXIMAGE_MASK) != 0; + + state->setCollectFbOnEglSwap(collectFbOnEglSwap); + state->setCollectFbOnGlDraw(collectFbOnGlDraw); + state->setCollectTextureDataOnGlTexImage(collectTextureData); + + ALOGD("trace options: eglswap: %d, gldraw: %d, texImage: %d", + collectFbOnEglSwap, collectFbOnGlDraw, collectTextureData); + } + + return NULL; +} + +void GLTrace_start() { + char value[PROPERTY_VALUE_MAX]; + + property_get("debug.egl.debug_port", value, "5039"); + const unsigned short port = (unsigned short)atoi(value); + + int clientSocket = gltrace::acceptClientConnection(port); + if (clientSocket < 0) { + ALOGE("Error creating GLTrace server socket. Quitting application."); + exit(-1); + } + + // create communication channel to the host + TCPStream *stream = new TCPStream(clientSocket); + + // initialize tracing state + sGLTraceState = new GLTraceState(stream); + + pthread_create(&sReceiveThreadId, NULL, commandReceiveTask, sGLTraceState); +} + +void GLTrace_stop() { + delete sGLTraceState; + sGLTraceState = NULL; +} + +void GLTrace_eglCreateContext(int version, EGLContext c) { + // update trace state for new EGL context + GLTraceContext *traceContext = sGLTraceState->createTraceContext(version, c); + gltrace::setupTraceContextThreadSpecific(traceContext); + + // trace command through to the host + gltrace::GLTrace_eglCreateContext(version, traceContext->getId()); +} + +void GLTrace_eglMakeCurrent(const unsigned version, gl_hooks_t *hooks, EGLContext c) { + // setup per context state + GLTraceContext *traceContext = sGLTraceState->getTraceContext(c); + traceContext->hooks = hooks; + gltrace::setupTraceContextThreadSpecific(traceContext); + + // trace command through to the host + gltrace::GLTrace_eglMakeCurrent(traceContext->getId()); +} + +void GLTrace_eglReleaseThread() { + gltrace::releaseContext(); +} + +void GLTrace_eglSwapBuffers(void *dpy, void *draw) { + gltrace::GLTrace_eglSwapBuffers(dpy, draw); +} + +gl_hooks_t *GLTrace_getGLHooks() { + return gltrace::getGLHooks(); +} + +} diff --git a/opengl/libs/GLES_trace/src/gltrace_fixup.cpp b/opengl/libs/GLES_trace/src/gltrace_fixup.cpp new file mode 100644 index 0000000000..5220aa41e6 --- /dev/null +++ b/opengl/libs/GLES_trace/src/gltrace_fixup.cpp @@ -0,0 +1,326 @@ +/* + * Copyright 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. + */ + +#include <cutils/log.h> +#include <GLES2/gl2.h> + +#include "gltrace.pb.h" +#include "gltrace_context.h" +#include "gltrace_fixup.h" + +namespace android { +namespace gltrace { + +unsigned getBytesPerTexel(const GLenum format, const GLenum type) { + /* + Description from glTexImage2D spec: + + Data is read from data as a sequence of unsigned bytes or shorts, depending on type. + When type is GL_UNSIGNED_BYTE, each of the bytes is interpreted as one color component. + When type is one of GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_4_4_4_4, or + GL_UNSIGNED_SHORT_5_5_5_1, each unsigned short value is interpreted as containing all + the components for a single texel, with the color components arranged according to + format. Color components are treated as groups of one, two, three, or four values, + again based on format. Groups of components are referred to as texels. + + width × height texels are read from memory, starting at location data. By default, + these texels are taken from adjacent memory locations, except that after all width + texels are read, the read pointer is advanced to the next four-byte boundary. + The four-byte row alignment is specified by glPixelStorei with argument + GL_UNPACK_ALIGNMENT, and it can be set to one, two, four, or eight bytes. + */ + + switch (type) { + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_5_5_5_1: + return 2; + case GL_UNSIGNED_BYTE: + break; + default: + ALOGE("GetBytesPerPixel: unknown type %x", type); + } + + switch (format) { + case GL_ALPHA: + case GL_LUMINANCE: + return 1; + case GL_LUMINANCE_ALPHA: + return 2; + case GL_RGB: + return 3; + case GL_RGBA: + case 0x80E1: // GL_BGRA_EXT + return 4; + default: + ALOGE("GetBytesPerPixel: unknown format %x", format); + } + + return 1; // in doubt... +} + +/** Generic helper function: extract pointer at argIndex and + replace it with the C style string at *pointer */ +void fixup_CStringPtr(int argIndex, GLMessage *glmsg) { + GLMessage_DataType *arg = glmsg->mutable_args(argIndex); + GLchar *ptr = (GLchar *)arg->intvalue(0); + + arg->set_type(GLMessage::DataType::CHAR); + arg->set_isarray(true); + arg->add_charvalue(ptr); +} + +void fixup_glGetString(GLMessage *glmsg) { + /* const GLubyte* GLTrace_glGetString(GLenum name) */ + GLMessage_DataType *ret = glmsg->mutable_returnvalue(); + GLchar *ptr = (GLchar *)ret->intvalue(0); + + if (ptr != NULL) { + ret->set_type(GLMessage::DataType::CHAR); + ret->set_isarray(true); + ret->add_charvalue(ptr); + } +} + +/* Add the contents of the framebuffer to the protobuf message */ +void fixup_addFBContents(GLTraceContext *context, GLMessage *glmsg, FBBinding fbToRead) { + void *fbcontents; + unsigned fbsize, fbwidth, fbheight; + context->getCompressedFB(&fbcontents, &fbsize, &fbwidth, &fbheight, fbToRead); + + GLMessage_FrameBuffer *fb = glmsg->mutable_fb(); + fb->set_width(fbwidth); + fb->set_height(fbheight); + fb->add_contents(fbcontents, fbsize); +} + +void fixup_glTexImage2D(GLMessage *glmsg) { + /* void glTexImage2D(GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + const GLvoid *data); + */ + GLMessage_DataType arg_width = glmsg->args(3); + GLMessage_DataType arg_height = glmsg->args(4); + GLMessage_DataType arg_format = glmsg->args(6); + GLMessage_DataType arg_type = glmsg->args(7); + GLMessage_DataType *arg_data = glmsg->mutable_args(8); + + GLsizei width = arg_width.intvalue(0); + GLsizei height = arg_height.intvalue(0); + GLenum format = arg_format.intvalue(0); + GLenum type = arg_type.intvalue(0); + void *data = (void *)arg_data->intvalue(0); + + int bytesPerTexel = getBytesPerTexel(format, type); + + arg_data->set_type(GLMessage::DataType::BYTE); + arg_data->set_isarray(true); + arg_data->clear_rawbytes(); + + if (data != NULL) { + arg_data->add_rawbytes(data, bytesPerTexel * width * height); + } else { + ALOGE("fixup_glTexImage2D: image data is NULL.\n"); + arg_data->set_type(GLMessage::DataType::VOID); + // FIXME: + // This will create the texture, but it will be uninitialized. + // It can later be initialized with glTexSubImage2D or by + // attaching an FBO to it and rendering into the FBO. + } +} + +void fixup_glShaderSource(GLMessage *glmsg) { + /* void glShaderSource(GLuint shader, GLsizei count, const GLchar** string, + const GLint* length) */ + GLMessage_DataType arg_count = glmsg->args(1); + GLMessage_DataType arg_lenp = glmsg->args(3); + GLMessage_DataType *arg_strpp = glmsg->mutable_args(2); + + GLsizei count = arg_count.intvalue(0); + GLchar **stringpp = (GLchar **)arg_strpp->intvalue(0); + GLint *lengthp = (GLint *)arg_lenp.intvalue(0); + + arg_strpp->set_type(GLMessage::DataType::CHAR); + arg_strpp->set_isarray(true); + arg_strpp->clear_charvalue(); + + ::std::string src = ""; + for (int i = 0; i < count; i++) { + if (lengthp != NULL) + src.append(*stringpp, *lengthp); + else + src.append(*stringpp); // assume null terminated + stringpp++; + lengthp++; + } + + arg_strpp->add_charvalue(src); +} + +void fixup_glUniformGeneric(int argIndex, int nFloats, GLMessage *glmsg) { + GLMessage_DataType *arg_values = glmsg->mutable_args(argIndex); + GLfloat *src = (GLfloat*)arg_values->intvalue(0); + + arg_values->set_type(GLMessage::DataType::FLOAT); + arg_values->set_isarray(true); + arg_values->clear_floatvalue(); + + for (int i = 0; i < nFloats; i++) { + arg_values->add_floatvalue(*src++); + } +} + +void fixup_glUniformMatrixGeneric(int matrixSize, GLMessage *glmsg) { + /* void glUniformMatrix?fv(GLint location, GLsizei count, GLboolean transpose, + const GLfloat* value) */ + GLMessage_DataType arg_count = glmsg->args(1); + int n_matrices = arg_count.intvalue(0); + fixup_glUniformGeneric(3, matrixSize * matrixSize * n_matrices, glmsg); +} + +void fixup_GenericIntArray(int argIndex, int nInts, GLMessage *glmsg) { + GLMessage_DataType *arg_intarray = glmsg->mutable_args(argIndex); + GLint *intp = (GLint *)arg_intarray->intvalue(0); + + arg_intarray->set_type(GLMessage::DataType::INT); + arg_intarray->set_isarray(true); + arg_intarray->clear_intvalue(); + + for (int i = 0; i < nInts; i++, intp++) { + arg_intarray->add_intvalue(*intp); + } +} + +void fixup_glGenGeneric(GLMessage *glmsg) { + /* void glGen*(GLsizei n, GLuint * buffers); */ + GLMessage_DataType arg_n = glmsg->args(0); + GLsizei n = arg_n.intvalue(0); + + fixup_GenericIntArray(1, n, glmsg); +} + +void fixup_glGetBooleanv(GLMessage *glmsg) { + /* void glGetBooleanv(GLenum pname, GLboolean *params); */ + GLMessage_DataType *arg_params = glmsg->mutable_args(1); + GLboolean *src = (GLboolean*)arg_params->intvalue(0); + + arg_params->set_type(GLMessage::DataType::BOOL); + arg_params->set_isarray(true); + arg_params->clear_boolvalue(); + arg_params->add_boolvalue(*src); +} + +void fixup_glGetFloatv(GLMessage *glmsg) { + /* void glGetFloatv(GLenum pname, GLfloat *params); */ + GLMessage_DataType *arg_params = glmsg->mutable_args(1); + GLfloat *src = (GLfloat*)arg_params->intvalue(0); + + arg_params->set_type(GLMessage::DataType::FLOAT); + arg_params->set_isarray(true); + arg_params->clear_floatvalue(); + arg_params->add_floatvalue(*src); +} + +void fixupGLMessage(GLTraceContext *context, nsecs_t start, nsecs_t end, GLMessage *glmsg) { + // for all messages, set the current context id + glmsg->set_context_id(context->getId()); + + // set start time and duration + glmsg->set_start_time(start); + glmsg->set_duration((unsigned)(end - start)); + + // do any custom message dependent processing + switch (glmsg->function()) { + case GLMessage::glGenBuffers: /* void glGenBuffers(GLsizei n, GLuint * buffers); */ + case GLMessage::glGenFramebuffers: /* void glGenFramebuffers(GLsizei n, GLuint * buffers); */ + case GLMessage::glGenRenderbuffers: /* void glGenFramebuffers(GLsizei n, GLuint * buffers); */ + case GLMessage::glGenTextures: /* void glGenTextures(GLsizei n, GLuint * buffers); */ + fixup_glGenGeneric(glmsg); + break; + case GLMessage::glGetAttribLocation: + case GLMessage::glGetUniformLocation: + /* int glGetAttribLocation(GLuint program, const GLchar* name) */ + /* int glGetUniformLocation(GLuint program, const GLchar* name) */ + fixup_CStringPtr(1, glmsg); + break; + case GLMessage::glGetBooleanv: + fixup_glGetBooleanv(glmsg); + break; + case GLMessage::glGetFloatv: + fixup_glGetFloatv(glmsg); + break; + case GLMessage::glGetIntegerv: /* void glGetIntegerv(GLenum pname, GLint *params); */ + fixup_GenericIntArray(1, 1, glmsg); + break; + case GLMessage::glGetProgramiv: + case GLMessage::glGetRenderbufferParameteriv: + case GLMessage::glGetShaderiv: + /* void glGetProgramiv(GLuint program, GLenum pname, GLint* params) */ + /* void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) */ + /* void glGetShaderiv(GLuint shader, GLenum pname, GLint* params) */ + fixup_GenericIntArray(2, 1, glmsg); + break; + case GLMessage::glGetString: + fixup_glGetString(glmsg); + break; + case GLMessage::glTexImage2D: + if (context->getGlobalTraceState()->shouldCollectTextureDataOnGlTexImage()) { + fixup_glTexImage2D(glmsg); + } + break; + case GLMessage::glShaderSource: + fixup_glShaderSource(glmsg); + break; + case GLMessage::glUniformMatrix2fv: + /* void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, + const GLfloat* value) */ + fixup_glUniformMatrixGeneric(2, glmsg); + break; + case GLMessage::glUniformMatrix3fv: + /* void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, + const GLfloat* value) */ + fixup_glUniformMatrixGeneric(3, glmsg); + break; + case GLMessage::glUniformMatrix4fv: + /* void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, + const GLfloat* value) */ + fixup_glUniformMatrixGeneric(4, glmsg); + break; + case GLMessage::glDrawArrays: + /* void glDrawArrays(GLenum mode, GLint first, GLsizei count) */ + if (context->getGlobalTraceState()->shouldCollectFbOnGlDraw()) { + fixup_addFBContents(context, glmsg, CURRENTLY_BOUND_FB); + } + break; + case GLMessage::glDrawElements: + /* void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) */ + if (context->getGlobalTraceState()->shouldCollectFbOnGlDraw()) { + fixup_addFBContents(context, glmsg, CURRENTLY_BOUND_FB); + } + break; + default: + break; + } +} + +}; +}; diff --git a/opengl/libs/GLES_trace/src/gltrace_fixup.h b/opengl/libs/GLES_trace/src/gltrace_fixup.h new file mode 100644 index 0000000000..64f75458df --- /dev/null +++ b/opengl/libs/GLES_trace/src/gltrace_fixup.h @@ -0,0 +1,34 @@ +/* + * Copyright 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 __GLTRACE_FIXUP_H_ +#define __GLTRACE_FIXUP_H_ + +#include <utils/Timers.h> + +#include "gltrace.pb.h" +#include "gltrace_context.h" + +namespace android { +namespace gltrace { + +void fixupGLMessage(GLTraceContext *curContext, nsecs_t start, nsecs_t end, GLMessage *message); +void fixup_addFBContents(GLTraceContext *curContext, GLMessage *message, FBBinding fbToRead); + +}; +}; + +#endif diff --git a/opengl/libs/GLES_trace/src/gltrace_hooks.cpp b/opengl/libs/GLES_trace/src/gltrace_hooks.cpp new file mode 100644 index 0000000000..de8d463036 --- /dev/null +++ b/opengl/libs/GLES_trace/src/gltrace_hooks.cpp @@ -0,0 +1,41 @@ +/* + * Copyright 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. + */ + +#include "hooks.h" +#include "gltrace_api.h" +#include "gltrace_hooks.h" + +namespace android { +namespace gltrace { + +// Hook up all the GLTrace functions +#define GL_ENTRY(_r, _api, ...) GLTrace_ ## _api, +EGLAPI gl_hooks_t gHooksDebug = { + { + #include "entries.in" + }, + { + {0} + } +}; +#undef GL_ENTRY + +gl_hooks_t *getGLHooks() { + return &gHooksDebug; +} + +}; +}; diff --git a/opengl/libs/GLES_trace/src/gltrace_hooks.h b/opengl/libs/GLES_trace/src/gltrace_hooks.h new file mode 100644 index 0000000000..c946a09244 --- /dev/null +++ b/opengl/libs/GLES_trace/src/gltrace_hooks.h @@ -0,0 +1,32 @@ +/* + * Copyright 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 __GLD_HOOKS_H_ +#define __GLD_HOOKS_H_ + +#include "hooks.h" + +namespace android { +namespace gltrace { + +using ::android::gl_hooks_t; + +gl_hooks_t *getGLHooks(); + +}; +}; + +#endif diff --git a/opengl/libs/GLES_trace/src/gltrace_transport.cpp b/opengl/libs/GLES_trace/src/gltrace_transport.cpp new file mode 100644 index 0000000000..ce3fae59a1 --- /dev/null +++ b/opengl/libs/GLES_trace/src/gltrace_transport.cpp @@ -0,0 +1,147 @@ +/* + * Copyright 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. + */ + +#include <stdlib.h> +#include <unistd.h> + +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> + +#include <cutils/log.h> + +#include "gltrace_transport.h" + +namespace android { +namespace gltrace { + +int acceptClientConnection(int serverPort) { + int serverSocket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); + if (serverSocket < 0) { + ALOGE("Error (%d) while creating socket. Check if app has network permissions.", + serverSocket); + return -1; + } + + struct sockaddr_in server, client; + + server.sin_family = AF_INET; + server.sin_addr.s_addr = htonl(INADDR_ANY); + server.sin_port = htons(serverPort); + + socklen_t sockaddr_len = sizeof(sockaddr_in); + if (bind(serverSocket, (struct sockaddr *) &server, sizeof(server)) < 0) { + close(serverSocket); + ALOGE("Failed to bind the server socket"); + return -1; + } + + if (listen(serverSocket, 1) < 0) { + close(serverSocket); + ALOGE("Failed to listen on server socket"); + return -1; + } + + ALOGD("gltrace::waitForClientConnection: server listening @ port %d", serverPort); + + int clientSocket = accept(serverSocket, (struct sockaddr *)&client, &sockaddr_len); + if (clientSocket < 0) { + close(serverSocket); + ALOGE("Failed to accept client connection"); + return -1; + } + + ALOGD("gltrace::waitForClientConnection: client connected: %s", inet_ntoa(client.sin_addr)); + + // do not accept any more incoming connections + close(serverSocket); + + return clientSocket; +} + +TCPStream::TCPStream(int socket) { + mSocket = socket; + pthread_mutex_init(&mSocketWriteMutex, NULL); +} + +TCPStream::~TCPStream() { + pthread_mutex_destroy(&mSocketWriteMutex); +} + +void TCPStream::closeStream() { + if (mSocket > 0) { + close(mSocket); + mSocket = 0; + } +} + +int TCPStream::send(void *buf, size_t len) { + if (mSocket <= 0) { + return -1; + } + + pthread_mutex_lock(&mSocketWriteMutex); + int n = write(mSocket, buf, len); + pthread_mutex_unlock(&mSocketWriteMutex); + + return n; +} + +int TCPStream::receive(void *data, size_t len) { + if (mSocket <= 0) { + return -1; + } + + return read(mSocket, data, len); +} + +BufferedOutputStream::BufferedOutputStream(TCPStream *stream, size_t bufferSize) { + mStream = stream; + + mBufferSize = bufferSize; + mStringBuffer = ""; + mStringBuffer.reserve(bufferSize); +} + +int BufferedOutputStream::flush() { + if (mStringBuffer.size() == 0) { + return 0; + } + + int n = mStream->send((void *)mStringBuffer.data(), mStringBuffer.size()); + mStringBuffer.clear(); + return n; +} + +void BufferedOutputStream::enqueueMessage(GLMessage *msg) { + const uint32_t len = msg->ByteSize(); + + mStringBuffer.append((const char *)&len, sizeof(len)); // append header + msg->AppendToString(&mStringBuffer); // append message +} + +int BufferedOutputStream::send(GLMessage *msg) { + enqueueMessage(msg); + + if (mStringBuffer.size() > mBufferSize) { + return flush(); + } + + return 0; +} + +}; // namespace gltrace +}; // namespace android diff --git a/opengl/libs/GLES_trace/src/gltrace_transport.h b/opengl/libs/GLES_trace/src/gltrace_transport.h new file mode 100644 index 0000000000..d31df7b739 --- /dev/null +++ b/opengl/libs/GLES_trace/src/gltrace_transport.h @@ -0,0 +1,87 @@ +/* + * Copyright 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 __GLTRACE_TRANSPORT_H_ +#define __GLTRACE_TRANSPORT_H_ + +#include <pthread.h> + +#include "gltrace.pb.h" + +namespace android { +namespace gltrace { + +/** + * TCPStream provides a TCP based communication channel from the device to + * the host for transferring GLMessages. + */ +class TCPStream { + int mSocket; + pthread_mutex_t mSocketWriteMutex; +public: + /** Create a TCP based communication channel over @socket */ + TCPStream(int socket); + ~TCPStream(); + + /** Close the channel. */ + void closeStream(); + + /** Send @data of size @len to host. . Returns -1 on error, 0 on success. */ + int send(void *data, size_t len); + + /** Receive data into @buf from the remote end. This is a blocking call. */ + int receive(void *buf, size_t size); +}; + +/** + * BufferedOutputStream provides buffering of data sent to the underlying + * unbuffered channel. + */ +class BufferedOutputStream { + TCPStream *mStream; + + size_t mBufferSize; + std::string mStringBuffer; + + /** Enqueue message into internal buffer. */ + void enqueueMessage(GLMessage *msg); +public: + /** + * Construct a Buffered stream of size @bufferSize, using @stream as + * its underlying channel for transport. + */ + BufferedOutputStream(TCPStream *stream, size_t bufferSize); + + /** + * Send @msg. The message could be buffered and sent later with a + * subsequent message. Returns -1 on error, 0 on success. + */ + int send(GLMessage *msg); + + /** Send any buffered messages, returns -1 on error, 0 on success. */ + int flush(); +}; + +/** + * Utility method: start a server at @serverPort, and wait for a client + * connection. Returns the connected client socket on success, or -1 on failure. + */ +int acceptClientConnection(int serverPort); + +}; +}; + +#endif diff --git a/opengl/libs/GLES_trace/tools/genapi.py b/opengl/libs/GLES_trace/tools/genapi.py new file mode 100755 index 0000000000..9b7a1cfe45 --- /dev/null +++ b/opengl/libs/GLES_trace/tools/genapi.py @@ -0,0 +1,393 @@ +#!/usr/bin/env python +# +# Copyright (C) 2011 Google Inc. +# +# 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. +# +# ABOUT +# This script is used to generate the trace implementations of all +# OpenGL calls. When executed, it reads the specs for the OpenGL calls +# from the files GLES2/gl2_api.in, GLES2/gl2ext_api.in, GLES_CM/gl_api.in, +# and GLES_CM/glext_api.in, and generates trace versions for all the +# defined functions. +# +# PREREQUISITES +# To generate C++ files, this script uses the 'pyratemp' template +# module. The only reason to use pyratemp is that it is extremly +# simple to install: +# $ wget http://www.simple-is-better.org/template/pyratemp-current/pyratemp.py +# Put the file in the GLES2_trace/tools folder, or update PYTHONPATH +# to point to wherever it was downloaded. +# +# USAGE +# $ cd GLES2_trace - run the program from GLES2_trace folder +# $ ./tools/genapi.py - generates a .cpp and .h file +# $ mv *.cpp *.h src/ - move the generated files into the src folder + +import sys +import re +import pyratemp + +# Constants corresponding to the protobuf DataType.Type +class DataType: + def __init__(self, name): + self.name = name + + def __str__(self): + if self.name == "pointer": # pointers map to the INT DataType + return "INT" + return self.name.upper() + + def getProtobufCall(self): + if self.name == "void": + raise ValueError("Attempt to set void value") + elif self.name == "char" or self.name == "byte" \ + or self.name == "pointer" or self.name == "enum": + return "add_intvalue((int)" + elif self.name == "int": + return "add_intvalue(" + elif self.name == "float": + return "add_floatvalue(" + elif self.name == "bool": + return "add_boolvalue(" + else: + raise ValueError("Unknown value type %s" % self.name) + +DataType.VOID = DataType("void") +DataType.CHAR = DataType("char") +DataType.BYTE = DataType("byte") +DataType.ENUM = DataType("enum") +DataType.BOOL = DataType("bool") +DataType.INT = DataType("int") +DataType.FLOAT = DataType("float") +DataType.POINTER = DataType("pointer") + +# mapping of GL types to protobuf DataType +GL2PROTOBUF_TYPE_MAP = { + "GLvoid":DataType.VOID, + "void":DataType.VOID, + "GLchar":DataType.CHAR, + "GLenum":DataType.ENUM, + "GLboolean":DataType.BOOL, + "GLbitfield":DataType.INT, + "GLbyte":DataType.BYTE, + "GLshort":DataType.INT, + "GLint":DataType.INT, + "int":DataType.INT, + "GLsizei":DataType.INT, + "GLubyte":DataType.BYTE, + "GLushort":DataType.INT, + "GLuint":DataType.INT, + "GLfloat":DataType.FLOAT, + "GLclampf":DataType.FLOAT, + "GLfixed":DataType.INT, + "GLclampx":DataType.INT, + "GLsizeiptr":DataType.POINTER, + "GLintptr":DataType.POINTER, + "GLeglImageOES":DataType.POINTER, +} + +API_SPECS = [ + ('GL2','../GLES2/gl2_api.in'), + ('GL2Ext','../GLES2/gl2ext_api.in'), + ('GL1','../GLES_CM/gl_api.in'), + ('GL1Ext','../GLES_CM/glext_api.in'), +] + +HEADER_LICENSE = """/* + * Copyright 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. + * + * THIS FILE WAS GENERATED BY A SCRIPT. DO NOT EDIT. + */ +""" + +HEADER_INCLUDES = """ +#include <cutils/log.h> +#include <utils/Timers.h> +#include <GLES2/gl2.h> + +#include "gltrace.pb.h" +#include "gltrace_context.h" +#include "gltrace_fixup.h" +#include "gltrace_transport.h" +""" + +HEADER_NAMESPACE_START = """ +namespace android { +namespace gltrace { +""" + +FOOTER_TEXT = """ +}; // namespace gltrace +}; // namespace android +""" + +TRACE_CALL_TEMPLATE = pyratemp.Template( +"""$!retType!$ GLTrace_$!func!$($!inputArgList!$) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::$!func!$); +<!--(if len(parsedArgs) > 0)--> + <!--(for argname, argtype in parsedArgs)--> + + // copy argument $!argname!$ + GLMessage_DataType *arg_$!argname!$ = glmsg.add_args(); + arg_$!argname!$->set_isarray(false); + arg_$!argname!$->set_type(GLMessage::DataType::$!argtype!$); + arg_$!argname!$->$!argtype.getProtobufCall()!$$!argname!$); + <!--(end)--> +<!--(end)--> + + // call function + nsecs_t start_time = systemTime(); +<!--(if retType != "void")--> + $!retType!$ retValue = glContext->hooks->gl.$!callsite!$; +<!--(else)--> + glContext->hooks->gl.$!callsite!$; +<!--(end)--> + nsecs_t end_time = systemTime(); +<!--(if retType != "void")--> + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::$!retDataType!$); + rt->$!retDataType.getProtobufCall()!$retValue); +<!--(end)--> + + fixupGLMessage(glContext, start_time, end_time, &glmsg); + glContext->traceGLMessage(&glmsg); +<!--(if retType != "void")--> + + return retValue; +<!--(end)--> +} +""") + +def getDataTypeFromKw(kw): + """ Get the data type given declaration. + All pointer declarations are of type DataType.POINTER + + e.g.: GLvoid -> DataType.VOID""" + + if kw.count('*') > 0: + return DataType.POINTER + return GL2PROTOBUF_TYPE_MAP.get(kw) + +def getNameTypePair(decl): + """ Split declaration of a variable to a tuple of (variable name, DataType). + e.g. "const GLChar* varName" -> (varName, POINTER) """ + elements = decl.strip().split(' ') + name = None + if len(elements) > 1: + name = " ".join(elements[-1:]).strip() # last element is the name + dataType = " ".join(elements[:-1]).strip() # everything else is the data type + + # if name is a pointer (e.g. "*ptr"), then remove the "*" from the name + # and add it to the data type + pointersInName = name.count("*") + if pointersInName > 0: + name = name.replace("*", "") + dataType += "*" * pointersInName + + # if name is an array (e.g. "array[10]"), then remove the "[X]" from the name + # and make the datatype to be a pointer + arraysInName = name.count("[") + if arraysInName > 0: + name = name.split('[')[0] + dataType += "*" + else: + dataType = elements[0] + return (name, getDataTypeFromKw(dataType)) + +def parseArgs(arglist): + """ Parse the argument list into a list of (var name, DataType) tuples """ + args = arglist.split(',') + args = map(lambda x: x.strip(), args) # remove unnecessary whitespaces + argtypelist = map(getNameTypePair, args) # split arg into arg type and arg name + if len(argtypelist) == 1: + (name, argtype) = argtypelist[0] + if argtype == DataType.VOID: + return [] + + return argtypelist + +class ApiCall(object): + """An ApiCall models all information about a single OpenGL API""" + + # Regex to match API_ENTRY specification: + # e.g. void API_ENTRY(glActiveTexture)(GLenum texture) { + # the regex uses a non greedy match (?) to match the first closing paren + API_ENTRY_REGEX = "(.*)API_ENTRY\(.*?\)\((.*?)\)" + + # Regex to match CALL_GL_API specification: + # e.g. CALL_GL_API(glCullFace, mode); + # CALL_GL_API_RETURN(glCreateProgram); + CALL_GL_API_REGEX = "CALL_GL_API(_RETURN)?\((.*)\);" + + def __init__(self, prefix, apientry, callsite): + """Construct an ApiCall from its specification. + + The specification is provided by the two arguments: + prefix: prefix to use for function names + defn: specification line containing API_ENTRY macro + e.g: void API_ENTRY(glActiveTexture)(GLenum texture) { + callsite: specification line containing CALL_GL_API macro + e.g: CALL_GL_API(glActiveTexture, texture); + """ + self.prefix = prefix + self.ret = self.getReturnType(apientry) + self.arglist = self.getArgList(apientry) + + # some functions (e.g. __glEGLImageTargetRenderbufferStorageOES), define their + # names one way in the API_ENTRY and another way in the CALL_GL_API macros. + # so self.func is reassigned based on what is there in the call site + self.func = self.getFunc(callsite) + self.callsite = self.getCallSite(callsite) + + def getReturnType(self, apientry): + '''Extract the return type from the API_ENTRY specification''' + m = re.search(self.API_ENTRY_REGEX, apientry) + if not m: + raise ValueError("%s does not match API_ENTRY specification %s" + % (apientry, self.API_ENTRY_REGEX)) + + return m.group(1).strip() + + def getArgList(self, apientry): + '''Extract the argument list from the API_ENTRY specification''' + m = re.search(self.API_ENTRY_REGEX, apientry) + if not m: + raise ValueError("%s does not match API_ENTRY specification %s" + % (apientry, self.API_ENTRY_REGEX)) + + return m.group(2).strip() + + def parseCallSite(self, callsite): + m = re.search(self.CALL_GL_API_REGEX, callsite) + if not m: + raise ValueError("%s does not match CALL_GL_API specification (%s)" + % (callsite, self.CALL_GL_API_REGEX)) + + arglist = m.group(2) + args = arglist.split(',') + args = map(lambda x: x.strip(), args) + + return args + + def getCallSite(self, callsite): + '''Extract the callsite from the CALL_GL_API specification''' + args = self.parseCallSite(callsite) + return "%s(%s)" % (args[0], ", ".join(args[1:])) + + def getFunc(self, callsite): + '''Extract the function name from the CALL_GL_API specification''' + args = self.parseCallSite(callsite) + return args[0] + + def genDeclaration(self): + return "%s GLTrace_%s(%s);" % (self.ret, self.func, self.arglist) + + def genCode(self): + return TRACE_CALL_TEMPLATE(func = self.func, + retType = self.ret, + retDataType = getDataTypeFromKw(self.ret), + inputArgList = self.arglist, + callsite = self.callsite, + parsedArgs = parseArgs(self.arglist), + DataType=DataType) + +def getApis(apiEntryFile, prefix): + '''Get a list of all ApiCalls in provided specification file''' + lines = open(apiEntryFile).readlines() + + apis = [] + for i in range(0, len(lines)/3): + apis.append(ApiCall(prefix, lines[i*3], lines[i*3+1])) + + return apis + +def parseAllSpecs(specs): + apis = [] + for name, specfile in specs: + a = getApis(specfile, name) + print 'Parsed %s APIs from %s, # of entries = %d' % (name, specfile, len(a)) + apis.extend(a) + return apis + +def removeDuplicates(apis): + '''Remove all duplicate function entries. + + The input list contains functions declared in GL1 and GL2 APIs. + This will return a list that contains only the first function if there are + multiple functions with the same name.''' + uniqs = [] + funcs = set() + for api in apis: + if api.func not in funcs: + uniqs.append(api) + funcs.add(api.func) + + return uniqs + +def genHeaders(apis, fname): + lines = [] + lines.append(HEADER_LICENSE) + lines.append(HEADER_NAMESPACE_START) + prefix = "" + for api in apis: + if prefix != api.prefix: + lines.append("\n// Declarations for %s APIs\n\n" % api.prefix) + prefix = api.prefix + lines.append(api.genDeclaration()) + lines.append("\n") + lines.append(FOOTER_TEXT) + + with open(fname, "w") as f: + f.writelines(lines) + +def genSrcs(apis, fname): + lines = [] + lines.append(HEADER_LICENSE) + lines.append(HEADER_INCLUDES) + lines.append(HEADER_NAMESPACE_START) + prefix = "" + for api in apis: + if prefix != api.prefix: + lines.append("\n// Definitions for %s APIs\n\n" % api.prefix) + prefix = api.prefix + lines.append(api.genCode()) + lines.append("\n") + lines.append(FOOTER_TEXT) + + with open(fname, "w") as f: + f.writelines(lines) + +if __name__ == '__main__': + apis = parseAllSpecs(API_SPECS) # read in all the specfiles + apis = removeDuplicates(apis) # remove duplication of functions common to GL1 and GL2 + genHeaders(apis, 'gltrace_api.h') # generate header file + genSrcs(apis, 'gltrace_api.cpp') # generate source file diff --git a/opengl/libs/GLES_trace/tools/testgenapi.py b/opengl/libs/GLES_trace/tools/testgenapi.py new file mode 100644 index 0000000000..58a12a8e5a --- /dev/null +++ b/opengl/libs/GLES_trace/tools/testgenapi.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python +# +# Copyright (C) 2011 Google Inc. +# +# 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. +# +# USAGE +# $ cd GLES2_trace/tools +# $ python testgenapi.py + +import unittest +from genapi import DataType, ApiCall, getApis, parseArgs + +class TestApiCall(unittest.TestCase): + def test_parsing(self): + apientry = 'void API_ENTRY(glCopyTexSubImage2D)(GLenum target, GLint level, ' \ + 'GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, ' \ + 'GLsizei height) {' + callsite = 'CALL_GL_API(glCopyTexImage2D, target, level, internalformat, x, y,' \ + 'width, height, border);' + + api = ApiCall("GL", apientry, callsite) + self.assertEqual(api.func, "glCopyTexImage2D") + self.assertEqual(api.callsite, 'glCopyTexImage2D(target, level, internalformat, ' \ + 'x, y, width, height, border)') + self.assertEqual(api.ret, 'void') + self.assertEqual(api.arglist, 'GLenum target, GLint level, ' \ + 'GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, ' \ + 'GLsizei height') + + def test_num_functions_parsed(self): + gl2_apis = getApis('../../GLES2/gl2_api.in', 'GL2') + gl2ext_apis = getApis('../../GLES2/gl2ext_api.in', 'GL2Ext') + gl_apis = getApis('../../GLES_CM/gl_api.in', "GL1") + glext_apis = getApis('../../GLES_CM/glext_api.in', 'GL1Ext') + + self.assertEqual(len(gl2_apis), 142) + self.assertEqual(len(gl2ext_apis), 60) + self.assertEqual(len(gl_apis), 145) + self.assertEqual(len(glext_apis), 126) + + def test_parseArgs(self): + args = parseArgs("void") + self.assertEqual(len(args), 0) + + args = parseArgs("GLchar a") + self.assertEqual(args, [("a", DataType.CHAR)]) + + args = parseArgs("GLchar *a") + self.assertEqual(args, [("a", DataType.POINTER)]) + + args = parseArgs("GLint exponent[16]") + self.assertEqual(args, [("exponent", DataType.POINTER)]) + +if __name__ == '__main__': + unittest.main() diff --git a/opengl/libs/glestrace.h b/opengl/libs/glestrace.h new file mode 100644 index 0000000000..a08f97bfb2 --- /dev/null +++ b/opengl/libs/glestrace.h @@ -0,0 +1,41 @@ +/* + * Copyright 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. + * + * This file declares the API provided by the glestrace library. + */ + +#ifndef _GLES_TRACE_H_ +#define _GLES_TRACE_H_ + +#include "hooks.h" + +namespace android { + +/* Hooks to be called by "interesting" EGL functions. */ +void GLTrace_eglCreateContext(int version, EGLContext c); +void GLTrace_eglMakeCurrent(unsigned version, gl_hooks_t *hooks, EGLContext c); +void GLTrace_eglReleaseThread(); +void GLTrace_eglSwapBuffers(void*, void*); + +/* Start and stop GL Tracing. */ +void GLTrace_start(); +void GLTrace_stop(); + +/* Obtain the gl_hooks structure filled with the trace implementation for all GL functions. */ +gl_hooks_t *GLTrace_getGLHooks(); + +}; + +#endif diff --git a/opengl/libs/glesv2dbg.h b/opengl/libs/glesv2dbg.h deleted file mode 100644 index 44bc288d1d..0000000000 --- a/opengl/libs/glesv2dbg.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - ** Copyright 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 _GLESV2_DBG_H_ -#define _GLESV2_DBG_H_ - -#include <pthread.h> - -namespace android -{ -struct DbgContext; - -DbgContext* CreateDbgContext(const unsigned version, const gl_hooks_t * const hooks); - -void dbgReleaseThread(); - -// create and bind socket if haven't already, if failed to create socket or -// forceUseFile, then open /data/local/tmp/dump.gles2dbg, exit when size reached -void StartDebugServer(const unsigned short port, const bool forceUseFile, - const unsigned int maxFileSize, const char * const filePath); -void StopDebugServer(); // close socket if open - -}; // namespace android - -#endif // #ifndef _GLESV2_DBG_H_ diff --git a/opengl/libs/glesv2dbg_functions.h b/opengl/libs/glesv2dbg_functions.h deleted file mode 100644 index 2d70032df7..0000000000 --- a/opengl/libs/glesv2dbg_functions.h +++ /dev/null @@ -1,381 +0,0 @@ -extern "C" -{ -GL_ENTRY(void, glActiveTexture, GLenum texture) -GL_ENTRY(void, glAlphaFunc, GLenum func, GLclampf ref) -GL_ENTRY(void, glAlphaFuncx, GLenum func, GLclampx ref) -GL_ENTRY(void, glAlphaFuncxOES, GLenum func, GLclampx ref) -GL_ENTRY(void, glAttachShader, GLuint program, GLuint shader) -GL_ENTRY(void, glBeginPerfMonitorAMD, GLuint monitor) -GL_ENTRY(void, glBindAttribLocation, GLuint program, GLuint index, const GLchar* name) -GL_ENTRY(void, glBindBuffer, GLenum target, GLuint buffer) -GL_ENTRY(void, glBindFramebuffer, GLenum target, GLuint framebuffer) -GL_ENTRY(void, glBindFramebufferOES, GLenum target, GLuint framebuffer) -GL_ENTRY(void, glBindRenderbuffer, GLenum target, GLuint renderbuffer) -GL_ENTRY(void, glBindRenderbufferOES, GLenum target, GLuint renderbuffer) -GL_ENTRY(void, glBindTexture, GLenum target, GLuint texture) -GL_ENTRY(void, glBindVertexArrayOES, GLuint array) -GL_ENTRY(void, glBlendColor, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) -GL_ENTRY(void, glBlendEquation, GLenum mode ) -GL_ENTRY(void, glBlendEquationOES, GLenum mode) -GL_ENTRY(void, glBlendEquationSeparate, GLenum modeRGB, GLenum modeAlpha) -GL_ENTRY(void, glBlendEquationSeparateOES, GLenum modeRGB, GLenum modeAlpha) -GL_ENTRY(void, glBlendFunc, GLenum sfactor, GLenum dfactor) -GL_ENTRY(void, glBlendFuncSeparate, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) -GL_ENTRY(void, glBlendFuncSeparateOES, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) -GL_ENTRY(void, glBufferData, GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage) -GL_ENTRY(void, glBufferSubData, GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data) -GL_ENTRY(GLenum, glCheckFramebufferStatus, GLenum target) -GL_ENTRY(GLenum, glCheckFramebufferStatusOES, GLenum target) -GL_ENTRY(void, glClear, GLbitfield mask) -GL_ENTRY(void, glClearColor, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) -GL_ENTRY(void, glClearColorx, GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) -GL_ENTRY(void, glClearColorxOES, GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) -GL_ENTRY(void, glClearDepthf, GLclampf depth) -GL_ENTRY(void, glClearDepthfOES, GLclampf depth) -GL_ENTRY(void, glClearDepthx, GLclampx depth) -GL_ENTRY(void, glClearDepthxOES, GLclampx depth) -GL_ENTRY(void, glClearStencil, GLint s) -GL_ENTRY(void, glClientActiveTexture, GLenum texture) -GL_ENTRY(void, glClipPlanef, GLenum plane, const GLfloat *equation) -GL_ENTRY(void, glClipPlanefIMG, GLenum p, const GLfloat *eqn) -GL_ENTRY(void, glClipPlanefOES, GLenum plane, const GLfloat *equation) -GL_ENTRY(void, glClipPlanex, GLenum plane, const GLfixed *equation) -GL_ENTRY(void, glClipPlanexIMG, GLenum p, const GLfixed *eqn) -GL_ENTRY(void, glClipPlanexOES, GLenum plane, const GLfixed *equation) -GL_ENTRY(void, glColor4f, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) -GL_ENTRY(void, glColor4ub, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) -GL_ENTRY(void, glColor4x, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) -GL_ENTRY(void, glColor4xOES, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) -GL_ENTRY(void, glColorMask, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) -GL_ENTRY(void, glColorPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) -GL_ENTRY(void, glCompileShader, GLuint shader) -GL_ENTRY(void, glCompressedTexImage2D, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) -GL_ENTRY(void, glCompressedTexImage3DOES, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data) -GL_ENTRY(void, glCompressedTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) -GL_ENTRY(void, glCompressedTexSubImage3DOES, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data) -GL_ENTRY(void, glCopyTexImage2D, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) -GL_ENTRY(void, glCopyTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) -GL_ENTRY(void, glCopyTexSubImage3DOES, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) -GL_ENTRY(void, glCoverageMaskNV, GLboolean mask) -GL_ENTRY(void, glCoverageOperationNV, GLenum operation) -GL_ENTRY(GLuint, glCreateProgram, void) -GL_ENTRY(GLuint, glCreateShader, GLenum type) -GL_ENTRY(void, glCullFace, GLenum mode) -GL_ENTRY(void, glCurrentPaletteMatrixOES, GLuint matrixpaletteindex) -GL_ENTRY(void, glDeleteBuffers, GLsizei n, const GLuint *buffers) -GL_ENTRY(void, glDeleteFencesNV, GLsizei n, const GLuint *fences) -GL_ENTRY(void, glDeleteFramebuffers, GLsizei n, const GLuint* framebuffers) -GL_ENTRY(void, glDeleteFramebuffersOES, GLsizei n, const GLuint* framebuffers) -GL_ENTRY(void, glDeletePerfMonitorsAMD, GLsizei n, GLuint *monitors) -GL_ENTRY(void, glDeleteProgram, GLuint program) -GL_ENTRY(void, glDeleteRenderbuffers, GLsizei n, const GLuint* renderbuffers) -GL_ENTRY(void, glDeleteRenderbuffersOES, GLsizei n, const GLuint* renderbuffers) -GL_ENTRY(void, glDeleteShader, GLuint shader) -GL_ENTRY(void, glDeleteTextures, GLsizei n, const GLuint *textures) -GL_ENTRY(void, glDeleteVertexArraysOES, GLsizei n, const GLuint *arrays) -GL_ENTRY(void, glDepthFunc, GLenum func) -GL_ENTRY(void, glDepthMask, GLboolean flag) -GL_ENTRY(void, glDepthRangef, GLclampf zNear, GLclampf zFar) -GL_ENTRY(void, glDepthRangefOES, GLclampf zNear, GLclampf zFar) -GL_ENTRY(void, glDepthRangex, GLclampx zNear, GLclampx zFar) -GL_ENTRY(void, glDepthRangexOES, GLclampx zNear, GLclampx zFar) -GL_ENTRY(void, glDetachShader, GLuint program, GLuint shader) -GL_ENTRY(void, glDisable, GLenum cap) -GL_ENTRY(void, glDisableClientState, GLenum array) -GL_ENTRY(void, glDisableDriverControlQCOM, GLuint driverControl) -GL_ENTRY(void, glDisableVertexAttribArray, GLuint index) -GL_ENTRY(void, glDiscardFramebufferEXT, GLenum target, GLsizei numAttachments, const GLenum *attachments) -GL_ENTRY(void, glDrawArrays, GLenum mode, GLint first, GLsizei count) -GL_ENTRY(void, glDrawElements, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) -GL_ENTRY(void, glDrawTexfOES, GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height) -GL_ENTRY(void, glDrawTexfvOES, const GLfloat *coords) -GL_ENTRY(void, glDrawTexiOES, GLint x, GLint y, GLint z, GLint width, GLint height) -GL_ENTRY(void, glDrawTexivOES, const GLint *coords) -GL_ENTRY(void, glDrawTexsOES, GLshort x, GLshort y, GLshort z, GLshort width, GLshort height) -GL_ENTRY(void, glDrawTexsvOES, const GLshort *coords) -GL_ENTRY(void, glDrawTexxOES, GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height) -GL_ENTRY(void, glDrawTexxvOES, const GLfixed *coords) -GL_ENTRY(void, glEGLImageTargetRenderbufferStorageOES, GLenum target, GLeglImageOES image) -GL_ENTRY(void, glEGLImageTargetTexture2DOES, GLenum target, GLeglImageOES image) -GL_ENTRY(void, glEnable, GLenum cap) -GL_ENTRY(void, glEnableClientState, GLenum array) -GL_ENTRY(void, glEnableDriverControlQCOM, GLuint driverControl) -GL_ENTRY(void, glEnableVertexAttribArray, GLuint index) -GL_ENTRY(void, glEndPerfMonitorAMD, GLuint monitor) -GL_ENTRY(void, glEndTilingQCOM, GLbitfield preserveMask) -GL_ENTRY(void, glExtGetBufferPointervQCOM, GLenum target, GLvoid **params) -GL_ENTRY(void, glExtGetBuffersQCOM, GLuint *buffers, GLint maxBuffers, GLint *numBuffers) -GL_ENTRY(void, glExtGetFramebuffersQCOM, GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers) -GL_ENTRY(void, glExtGetProgramBinarySourceQCOM, GLuint program, GLenum shadertype, GLchar *source, GLint *length) -GL_ENTRY(void, glExtGetProgramsQCOM, GLuint *programs, GLint maxPrograms, GLint *numPrograms) -GL_ENTRY(void, glExtGetRenderbuffersQCOM, GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers) -GL_ENTRY(void, glExtGetShadersQCOM, GLuint *shaders, GLint maxShaders, GLint *numShaders) -GL_ENTRY(void, glExtGetTexLevelParameterivQCOM, GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params) -GL_ENTRY(void, glExtGetTexSubImageQCOM, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels) -GL_ENTRY(void, glExtGetTexturesQCOM, GLuint *textures, GLint maxTextures, GLint *numTextures) -GL_ENTRY(GLboolean, glExtIsProgramBinaryQCOM, GLuint program) -GL_ENTRY(void, glExtTexObjectStateOverrideiQCOM, GLenum target, GLenum pname, GLint param) -GL_ENTRY(void, glFinish, void) -GL_ENTRY(void, glFinishFenceNV, GLuint fence) -GL_ENTRY(void, glFlush, void) -GL_ENTRY(void, glFogf, GLenum pname, GLfloat param) -GL_ENTRY(void, glFogfv, GLenum pname, const GLfloat *params) -GL_ENTRY(void, glFogx, GLenum pname, GLfixed param) -GL_ENTRY(void, glFogxOES, GLenum pname, GLfixed param) -GL_ENTRY(void, glFogxv, GLenum pname, const GLfixed *params) -GL_ENTRY(void, glFogxvOES, GLenum pname, const GLfixed *params) -GL_ENTRY(void, glFramebufferRenderbuffer, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) -GL_ENTRY(void, glFramebufferRenderbufferOES, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) -GL_ENTRY(void, glFramebufferTexture2D, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) -GL_ENTRY(void, glFramebufferTexture2DMultisampleIMG, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) -GL_ENTRY(void, glFramebufferTexture2DOES, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) -GL_ENTRY(void, glFramebufferTexture3DOES, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) -GL_ENTRY(void, glFrontFace, GLenum mode) -GL_ENTRY(void, glFrustumf, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) -GL_ENTRY(void, glFrustumfOES, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) -GL_ENTRY(void, glFrustumx, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) -GL_ENTRY(void, glFrustumxOES, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) -GL_ENTRY(void, glGenBuffers, GLsizei n, GLuint *buffers) -GL_ENTRY(void, glGenFencesNV, GLsizei n, GLuint *fences) -GL_ENTRY(void, glGenFramebuffers, GLsizei n, GLuint* framebuffers) -GL_ENTRY(void, glGenFramebuffersOES, GLsizei n, GLuint* framebuffers) -GL_ENTRY(void, glGenPerfMonitorsAMD, GLsizei n, GLuint *monitors) -GL_ENTRY(void, glGenRenderbuffers, GLsizei n, GLuint* renderbuffers) -GL_ENTRY(void, glGenRenderbuffersOES, GLsizei n, GLuint* renderbuffers) -GL_ENTRY(void, glGenTextures, GLsizei n, GLuint *textures) -GL_ENTRY(void, glGenVertexArraysOES, GLsizei n, GLuint *arrays) -GL_ENTRY(void, glGenerateMipmap, GLenum target) -GL_ENTRY(void, glGenerateMipmapOES, GLenum target) -GL_ENTRY(void, glGetActiveAttrib, GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) -GL_ENTRY(void, glGetActiveUniform, GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) -GL_ENTRY(void, glGetAttachedShaders, GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) -GL_ENTRY(int, glGetAttribLocation, GLuint program, const GLchar* name) -GL_ENTRY(void, glGetBooleanv, GLenum pname, GLboolean *params) -GL_ENTRY(void, glGetBufferParameteriv, GLenum target, GLenum pname, GLint *params) -GL_ENTRY(void, glGetBufferPointervOES, GLenum target, GLenum pname, GLvoid ** params) -GL_ENTRY(void, glGetClipPlanef, GLenum pname, GLfloat eqn[4]) -GL_ENTRY(void, glGetClipPlanefOES, GLenum pname, GLfloat eqn[4]) -GL_ENTRY(void, glGetClipPlanex, GLenum pname, GLfixed eqn[4]) -GL_ENTRY(void, glGetClipPlanexOES, GLenum pname, GLfixed eqn[4]) -GL_ENTRY(void, glGetDriverControlStringQCOM, GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString) -GL_ENTRY(void, glGetDriverControlsQCOM, GLint *num, GLsizei size, GLuint *driverControls) -GL_ENTRY(GLenum, glGetError, void) -GL_ENTRY(void, glGetFenceivNV, GLuint fence, GLenum pname, GLint *params) -GL_ENTRY(void, glGetFixedv, GLenum pname, GLfixed *params) -GL_ENTRY(void, glGetFixedvOES, GLenum pname, GLfixed *params) -GL_ENTRY(void, glGetFloatv, GLenum pname, GLfloat *params) -GL_ENTRY(void, glGetFramebufferAttachmentParameteriv, GLenum target, GLenum attachment, GLenum pname, GLint* params) -GL_ENTRY(void, glGetFramebufferAttachmentParameterivOES, GLenum target, GLenum attachment, GLenum pname, GLint* params) -GL_ENTRY(void, glGetIntegerv, GLenum pname, GLint *params) -GL_ENTRY(void, glGetLightfv, GLenum light, GLenum pname, GLfloat *params) -GL_ENTRY(void, glGetLightxv, GLenum light, GLenum pname, GLfixed *params) -GL_ENTRY(void, glGetLightxvOES, GLenum light, GLenum pname, GLfixed *params) -GL_ENTRY(void, glGetMaterialfv, GLenum face, GLenum pname, GLfloat *params) -GL_ENTRY(void, glGetMaterialxv, GLenum face, GLenum pname, GLfixed *params) -GL_ENTRY(void, glGetMaterialxvOES, GLenum face, GLenum pname, GLfixed *params) -GL_ENTRY(void, glGetPerfMonitorCounterDataAMD, GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten) -GL_ENTRY(void, glGetPerfMonitorCounterInfoAMD, GLuint group, GLuint counter, GLenum pname, GLvoid *data) -GL_ENTRY(void, glGetPerfMonitorCounterStringAMD, GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString) -GL_ENTRY(void, glGetPerfMonitorCountersAMD, GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters) -GL_ENTRY(void, glGetPerfMonitorGroupStringAMD, GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString) -GL_ENTRY(void, glGetPerfMonitorGroupsAMD, GLint *numGroups, GLsizei groupsSize, GLuint *groups) -GL_ENTRY(void, glGetPointerv, GLenum pname, GLvoid **params) -GL_ENTRY(void, glGetProgramBinaryOES, GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary) -GL_ENTRY(void, glGetProgramInfoLog, GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog) -GL_ENTRY(void, glGetProgramiv, GLuint program, GLenum pname, GLint* params) -GL_ENTRY(void, glGetRenderbufferParameteriv, GLenum target, GLenum pname, GLint* params) -GL_ENTRY(void, glGetRenderbufferParameterivOES, GLenum target, GLenum pname, GLint* params) -GL_ENTRY(void, glGetShaderInfoLog, GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog) -GL_ENTRY(void, glGetShaderPrecisionFormat, GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) -GL_ENTRY(void, glGetShaderSource, GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) -GL_ENTRY(void, glGetShaderiv, GLuint shader, GLenum pname, GLint* params) -GL_ENTRY(const GLubyte *, glGetString, GLenum name) -GL_ENTRY(void, glGetTexEnvfv, GLenum env, GLenum pname, GLfloat *params) -GL_ENTRY(void, glGetTexEnviv, GLenum env, GLenum pname, GLint *params) -GL_ENTRY(void, glGetTexEnvxv, GLenum env, GLenum pname, GLfixed *params) -GL_ENTRY(void, glGetTexEnvxvOES, GLenum env, GLenum pname, GLfixed *params) -GL_ENTRY(void, glGetTexGenfvOES, GLenum coord, GLenum pname, GLfloat *params) -GL_ENTRY(void, glGetTexGenivOES, GLenum coord, GLenum pname, GLint *params) -GL_ENTRY(void, glGetTexGenxvOES, GLenum coord, GLenum pname, GLfixed *params) -GL_ENTRY(void, glGetTexParameterfv, GLenum target, GLenum pname, GLfloat *params) -GL_ENTRY(void, glGetTexParameteriv, GLenum target, GLenum pname, GLint *params) -GL_ENTRY(void, glGetTexParameterxv, GLenum target, GLenum pname, GLfixed *params) -GL_ENTRY(void, glGetTexParameterxvOES, GLenum target, GLenum pname, GLfixed *params) -GL_ENTRY(int, glGetUniformLocation, GLuint program, const GLchar* name) -GL_ENTRY(void, glGetUniformfv, GLuint program, GLint location, GLfloat* params) -GL_ENTRY(void, glGetUniformiv, GLuint program, GLint location, GLint* params) -GL_ENTRY(void, glGetVertexAttribPointerv, GLuint index, GLenum pname, GLvoid** pointer) -GL_ENTRY(void, glGetVertexAttribfv, GLuint index, GLenum pname, GLfloat* params) -GL_ENTRY(void, glGetVertexAttribiv, GLuint index, GLenum pname, GLint* params) -GL_ENTRY(void, glHint, GLenum target, GLenum mode) -GL_ENTRY(GLboolean, glIsBuffer, GLuint buffer) -GL_ENTRY(GLboolean, glIsEnabled, GLenum cap) -GL_ENTRY(GLboolean, glIsFenceNV, GLuint fence) -GL_ENTRY(GLboolean, glIsFramebuffer, GLuint framebuffer) -GL_ENTRY(GLboolean, glIsFramebufferOES, GLuint framebuffer) -GL_ENTRY(GLboolean, glIsProgram, GLuint program) -GL_ENTRY(GLboolean, glIsRenderbuffer, GLuint renderbuffer) -GL_ENTRY(GLboolean, glIsRenderbufferOES, GLuint renderbuffer) -GL_ENTRY(GLboolean, glIsShader, GLuint shader) -GL_ENTRY(GLboolean, glIsTexture, GLuint texture) -GL_ENTRY(GLboolean, glIsVertexArrayOES, GLuint array) -GL_ENTRY(void, glLightModelf, GLenum pname, GLfloat param) -GL_ENTRY(void, glLightModelfv, GLenum pname, const GLfloat *params) -GL_ENTRY(void, glLightModelx, GLenum pname, GLfixed param) -GL_ENTRY(void, glLightModelxOES, GLenum pname, GLfixed param) -GL_ENTRY(void, glLightModelxv, GLenum pname, const GLfixed *params) -GL_ENTRY(void, glLightModelxvOES, GLenum pname, const GLfixed *params) -GL_ENTRY(void, glLightf, GLenum light, GLenum pname, GLfloat param) -GL_ENTRY(void, glLightfv, GLenum light, GLenum pname, const GLfloat *params) -GL_ENTRY(void, glLightx, GLenum light, GLenum pname, GLfixed param) -GL_ENTRY(void, glLightxOES, GLenum light, GLenum pname, GLfixed param) -GL_ENTRY(void, glLightxv, GLenum light, GLenum pname, const GLfixed *params) -GL_ENTRY(void, glLightxvOES, GLenum light, GLenum pname, const GLfixed *params) -GL_ENTRY(void, glLineWidth, GLfloat width) -GL_ENTRY(void, glLineWidthx, GLfixed width) -GL_ENTRY(void, glLineWidthxOES, GLfixed width) -GL_ENTRY(void, glLinkProgram, GLuint program) -GL_ENTRY(void, glLoadIdentity, void) -GL_ENTRY(void, glLoadMatrixf, const GLfloat *m) -GL_ENTRY(void, glLoadMatrixx, const GLfixed *m) -GL_ENTRY(void, glLoadMatrixxOES, const GLfixed *m) -GL_ENTRY(void, glLoadPaletteFromModelViewMatrixOES, void) -GL_ENTRY(void, glLogicOp, GLenum opcode) -GL_ENTRY(void*, glMapBufferOES, GLenum target, GLenum access) -GL_ENTRY(void, glMaterialf, GLenum face, GLenum pname, GLfloat param) -GL_ENTRY(void, glMaterialfv, GLenum face, GLenum pname, const GLfloat *params) -GL_ENTRY(void, glMaterialx, GLenum face, GLenum pname, GLfixed param) -GL_ENTRY(void, glMaterialxOES, GLenum face, GLenum pname, GLfixed param) -GL_ENTRY(void, glMaterialxv, GLenum face, GLenum pname, const GLfixed *params) -GL_ENTRY(void, glMaterialxvOES, GLenum face, GLenum pname, const GLfixed *params) -GL_ENTRY(void, glMatrixIndexPointerOES, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) -GL_ENTRY(void, glMatrixMode, GLenum mode) -GL_ENTRY(void, glMultMatrixf, const GLfloat *m) -GL_ENTRY(void, glMultMatrixx, const GLfixed *m) -GL_ENTRY(void, glMultMatrixxOES, const GLfixed *m) -GL_ENTRY(void, glMultiDrawArraysEXT, GLenum mode, GLint *first, GLsizei *count, GLsizei primcount) -GL_ENTRY(void, glMultiDrawElementsEXT, GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount) -GL_ENTRY(void, glMultiTexCoord4f, GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) -GL_ENTRY(void, glMultiTexCoord4x, GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) -GL_ENTRY(void, glMultiTexCoord4xOES, GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) -GL_ENTRY(void, glNormal3f, GLfloat nx, GLfloat ny, GLfloat nz) -GL_ENTRY(void, glNormal3x, GLfixed nx, GLfixed ny, GLfixed nz) -GL_ENTRY(void, glNormal3xOES, GLfixed nx, GLfixed ny, GLfixed nz) -GL_ENTRY(void, glNormalPointer, GLenum type, GLsizei stride, const GLvoid *pointer) -GL_ENTRY(void, glOrthof, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) -GL_ENTRY(void, glOrthofOES, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) -GL_ENTRY(void, glOrthox, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) -GL_ENTRY(void, glOrthoxOES, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) -GL_ENTRY(void, glPixelStorei, GLenum pname, GLint param) -GL_ENTRY(void, glPointParameterf, GLenum pname, GLfloat param) -GL_ENTRY(void, glPointParameterfv, GLenum pname, const GLfloat *params) -GL_ENTRY(void, glPointParameterx, GLenum pname, GLfixed param) -GL_ENTRY(void, glPointParameterxOES, GLenum pname, GLfixed param) -GL_ENTRY(void, glPointParameterxv, GLenum pname, const GLfixed *params) -GL_ENTRY(void, glPointParameterxvOES, GLenum pname, const GLfixed *params) -GL_ENTRY(void, glPointSize, GLfloat size) -GL_ENTRY(void, glPointSizePointerOES, GLenum type, GLsizei stride, const GLvoid *pointer) -GL_ENTRY(void, glPointSizex, GLfixed size) -GL_ENTRY(void, glPointSizexOES, GLfixed size) -GL_ENTRY(void, glPolygonOffset, GLfloat factor, GLfloat units) -GL_ENTRY(void, glPolygonOffsetx, GLfixed factor, GLfixed units) -GL_ENTRY(void, glPolygonOffsetxOES, GLfixed factor, GLfixed units) -GL_ENTRY(void, glPopMatrix, void) -GL_ENTRY(void, glProgramBinaryOES, GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length) -GL_ENTRY(void, glPushMatrix, void) -GL_ENTRY(GLbitfield, glQueryMatrixxOES, GLfixed mantissa[16], GLint exponent[16]) -GL_ENTRY(void, glReadPixels, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels) -GL_ENTRY(void, glReleaseShaderCompiler, void) -GL_ENTRY(void, glRenderbufferStorage, GLenum target, GLenum internalformat, GLsizei width, GLsizei height) -GL_ENTRY(void, glRenderbufferStorageMultisampleIMG, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) -GL_ENTRY(void, glRenderbufferStorageOES, GLenum target, GLenum internalformat, GLsizei width, GLsizei height) -GL_ENTRY(void, glRotatef, GLfloat angle, GLfloat x, GLfloat y, GLfloat z) -GL_ENTRY(void, glRotatex, GLfixed angle, GLfixed x, GLfixed y, GLfixed z) -GL_ENTRY(void, glRotatexOES, GLfixed angle, GLfixed x, GLfixed y, GLfixed z) -GL_ENTRY(void, glSampleCoverage, GLclampf value, GLboolean invert) -GL_ENTRY(void, glSampleCoveragex, GLclampx value, GLboolean invert) -GL_ENTRY(void, glSampleCoveragexOES, GLclampx value, GLboolean invert) -GL_ENTRY(void, glScalef, GLfloat x, GLfloat y, GLfloat z) -GL_ENTRY(void, glScalex, GLfixed x, GLfixed y, GLfixed z) -GL_ENTRY(void, glScalexOES, GLfixed x, GLfixed y, GLfixed z) -GL_ENTRY(void, glScissor, GLint x, GLint y, GLsizei width, GLsizei height) -GL_ENTRY(void, glSelectPerfMonitorCountersAMD, GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList) -GL_ENTRY(void, glSetFenceNV, GLuint fence, GLenum condition) -GL_ENTRY(void, glShadeModel, GLenum mode) -GL_ENTRY(void, glShaderBinary, GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length) -GL_ENTRY(void, glShaderSource, GLuint shader, GLsizei count, const GLchar** string, const GLint* length) -GL_ENTRY(void, glStartTilingQCOM, GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask) -GL_ENTRY(void, glStencilFunc, GLenum func, GLint ref, GLuint mask) -GL_ENTRY(void, glStencilFuncSeparate, GLenum face, GLenum func, GLint ref, GLuint mask) -GL_ENTRY(void, glStencilMask, GLuint mask) -GL_ENTRY(void, glStencilMaskSeparate, GLenum face, GLuint mask) -GL_ENTRY(void, glStencilOp, GLenum fail, GLenum zfail, GLenum zpass) -GL_ENTRY(void, glStencilOpSeparate, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) -GL_ENTRY(GLboolean, glTestFenceNV, GLuint fence) -GL_ENTRY(void, glTexCoordPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) -GL_ENTRY(void, glTexEnvf, GLenum target, GLenum pname, GLfloat param) -GL_ENTRY(void, glTexEnvfv, GLenum target, GLenum pname, const GLfloat *params) -GL_ENTRY(void, glTexEnvi, GLenum target, GLenum pname, GLint param) -GL_ENTRY(void, glTexEnviv, GLenum target, GLenum pname, const GLint *params) -GL_ENTRY(void, glTexEnvx, GLenum target, GLenum pname, GLfixed param) -GL_ENTRY(void, glTexEnvxOES, GLenum target, GLenum pname, GLfixed param) -GL_ENTRY(void, glTexEnvxv, GLenum target, GLenum pname, const GLfixed *params) -GL_ENTRY(void, glTexEnvxvOES, GLenum target, GLenum pname, const GLfixed *params) -GL_ENTRY(void, glTexGenfOES, GLenum coord, GLenum pname, GLfloat param) -GL_ENTRY(void, glTexGenfvOES, GLenum coord, GLenum pname, const GLfloat *params) -GL_ENTRY(void, glTexGeniOES, GLenum coord, GLenum pname, GLint param) -GL_ENTRY(void, glTexGenivOES, GLenum coord, GLenum pname, const GLint *params) -GL_ENTRY(void, glTexGenxOES, GLenum coord, GLenum pname, GLfixed param) -GL_ENTRY(void, glTexGenxvOES, GLenum coord, GLenum pname, const GLfixed *params) -GL_ENTRY(void, glTexImage2D, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) -GL_ENTRY(void, glTexImage3DOES, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels) -GL_ENTRY(void, glTexParameterf, GLenum target, GLenum pname, GLfloat param) -GL_ENTRY(void, glTexParameterfv, GLenum target, GLenum pname, const GLfloat *params) -GL_ENTRY(void, glTexParameteri, GLenum target, GLenum pname, GLint param) -GL_ENTRY(void, glTexParameteriv, GLenum target, GLenum pname, const GLint *params) -GL_ENTRY(void, glTexParameterx, GLenum target, GLenum pname, GLfixed param) -GL_ENTRY(void, glTexParameterxOES, GLenum target, GLenum pname, GLfixed param) -GL_ENTRY(void, glTexParameterxv, GLenum target, GLenum pname, const GLfixed *params) -GL_ENTRY(void, glTexParameterxvOES, GLenum target, GLenum pname, const GLfixed *params) -GL_ENTRY(void, glTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) -GL_ENTRY(void, glTexSubImage3DOES, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels) -GL_ENTRY(void, glTranslatef, GLfloat x, GLfloat y, GLfloat z) -GL_ENTRY(void, glTranslatex, GLfixed x, GLfixed y, GLfixed z) -GL_ENTRY(void, glTranslatexOES, GLfixed x, GLfixed y, GLfixed z) -GL_ENTRY(void, glUniform1f, GLint location, GLfloat x) -GL_ENTRY(void, glUniform1fv, GLint location, GLsizei count, const GLfloat* v) -GL_ENTRY(void, glUniform1i, GLint location, GLint x) -GL_ENTRY(void, glUniform1iv, GLint location, GLsizei count, const GLint* v) -GL_ENTRY(void, glUniform2f, GLint location, GLfloat x, GLfloat y) -GL_ENTRY(void, glUniform2fv, GLint location, GLsizei count, const GLfloat* v) -GL_ENTRY(void, glUniform2i, GLint location, GLint x, GLint y) -GL_ENTRY(void, glUniform2iv, GLint location, GLsizei count, const GLint* v) -GL_ENTRY(void, glUniform3f, GLint location, GLfloat x, GLfloat y, GLfloat z) -GL_ENTRY(void, glUniform3fv, GLint location, GLsizei count, const GLfloat* v) -GL_ENTRY(void, glUniform3i, GLint location, GLint x, GLint y, GLint z) -GL_ENTRY(void, glUniform3iv, GLint location, GLsizei count, const GLint* v) -GL_ENTRY(void, glUniform4f, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) -GL_ENTRY(void, glUniform4fv, GLint location, GLsizei count, const GLfloat* v) -GL_ENTRY(void, glUniform4i, GLint location, GLint x, GLint y, GLint z, GLint w) -GL_ENTRY(void, glUniform4iv, GLint location, GLsizei count, const GLint* v) -GL_ENTRY(void, glUniformMatrix2fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) -GL_ENTRY(void, glUniformMatrix3fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) -GL_ENTRY(void, glUniformMatrix4fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) -GL_ENTRY(GLboolean, glUnmapBufferOES, GLenum target) -GL_ENTRY(void, glUseProgram, GLuint program) -GL_ENTRY(void, glValidateProgram, GLuint program) -GL_ENTRY(void, glVertexAttrib1f, GLuint indx, GLfloat x) -GL_ENTRY(void, glVertexAttrib1fv, GLuint indx, const GLfloat* values) -GL_ENTRY(void, glVertexAttrib2f, GLuint indx, GLfloat x, GLfloat y) -GL_ENTRY(void, glVertexAttrib2fv, GLuint indx, const GLfloat* values) -GL_ENTRY(void, glVertexAttrib3f, GLuint indx, GLfloat x, GLfloat y, GLfloat z) -GL_ENTRY(void, glVertexAttrib3fv, GLuint indx, const GLfloat* values) -GL_ENTRY(void, glVertexAttrib4f, GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) -GL_ENTRY(void, glVertexAttrib4fv, GLuint indx, const GLfloat* values) -GL_ENTRY(void, glVertexAttribPointer, GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr) -GL_ENTRY(void, glVertexPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) -GL_ENTRY(void, glViewport, GLint x, GLint y, GLsizei width, GLsizei height) -GL_ENTRY(void, glWeightPointerOES, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) - - -} diff --git a/opengl/tests/gl2_jni/jni/gl_code.cpp b/opengl/tests/gl2_jni/jni/gl_code.cpp index c2fabe6c30..fa6bd93ead 100644 --- a/opengl/tests/gl2_jni/jni/gl_code.cpp +++ b/opengl/tests/gl2_jni/jni/gl_code.cpp @@ -14,13 +14,13 @@ static void printGLString(const char *name, GLenum s) { const char *v = (const char *) glGetString(s); - LOGI("GL %s = %s\n", name, v); + ALOGI("GL %s = %s\n", name, v); } static void checkGlError(const char* op) { for (GLint error = glGetError(); error; error = glGetError()) { - LOGI("after %s() glError (0x%x)\n", op, error); + ALOGI("after %s() glError (0x%x)\n", op, error); } } @@ -48,7 +48,7 @@ GLuint loadShader(GLenum shaderType, const char* pSource) { char* buf = (char*) malloc(infoLen); if (buf) { glGetShaderInfoLog(shader, infoLen, NULL, buf); - LOGE("Could not compile shader %d:\n%s\n", + ALOGE("Could not compile shader %d:\n%s\n", shaderType, buf); free(buf); } @@ -87,7 +87,7 @@ GLuint createProgram(const char* pVertexSource, const char* pFragmentSource) { char* buf = (char*) malloc(bufLength); if (buf) { glGetProgramInfoLog(program, bufLength, NULL, buf); - LOGE("Could not link program:\n%s\n", buf); + ALOGE("Could not link program:\n%s\n", buf); free(buf); } } @@ -107,15 +107,15 @@ bool setupGraphics(int w, int h) { printGLString("Renderer", GL_RENDERER); printGLString("Extensions", GL_EXTENSIONS); - LOGI("setupGraphics(%d, %d)", w, h); + ALOGI("setupGraphics(%d, %d)", w, h); gProgram = createProgram(gVertexShader, gFragmentShader); if (!gProgram) { - LOGE("Could not create program."); + ALOGE("Could not create program."); return false; } gvPositionHandle = glGetAttribLocation(gProgram, "vPosition"); checkGlError("glGetAttribLocation"); - LOGI("glGetAttribLocation(\"vPosition\") = %d\n", + ALOGI("glGetAttribLocation(\"vPosition\") = %d\n", gvPositionHandle); glViewport(0, 0, w, h); diff --git a/opengl/tests/gl_jni/jni/gl_code.cpp b/opengl/tests/gl_jni/jni/gl_code.cpp index ef66841f27..cf86020a3d 100644 --- a/opengl/tests/gl_jni/jni/gl_code.cpp +++ b/opengl/tests/gl_jni/jni/gl_code.cpp @@ -18,7 +18,7 @@ GLfloat background; static void printGLString(const char *name, GLenum s) { const char *v = (const char *) glGetString(s); - LOGI("GL %s = %s\n", name, v); + ALOGI("GL %s = %s\n", name, v); } static void gluLookAt(float eyeX, float eyeY, float eyeZ, diff --git a/opengl/tests/gl_perf/fill_common.cpp b/opengl/tests/gl_perf/fill_common.cpp index a069f67ac8..389381fb32 100644 --- a/opengl/tests/gl_perf/fill_common.cpp +++ b/opengl/tests/gl_perf/fill_common.cpp @@ -26,7 +26,7 @@ static uint32_t gHeight = 0; static void checkGlError(const char* op) { for (GLint error = glGetError(); error; error = glGetError()) { - LOGE("after %s() glError (0x%x)\n", op, error); + ALOGE("after %s() glError (0x%x)\n", op, error); } } @@ -44,7 +44,7 @@ GLuint loadShader(GLenum shaderType, const char* pSource) { char* buf = (char*) malloc(infoLen); if (buf) { glGetShaderInfoLog(shader, infoLen, NULL, buf); - LOGE("Could not compile shader %d:\n%s\n", shaderType, buf); + ALOGE("Could not compile shader %d:\n%s\n", shaderType, buf); free(buf); } glDeleteShader(shader); @@ -94,7 +94,7 @@ GLuint createProgram(const char* pVertexSource, const char* pFragmentSource) { char* buf = (char*) malloc(bufLength); if (buf) { glGetProgramInfoLog(program, bufLength, NULL, buf); - LOGE("Could not link program:\n%s\n", buf); + ALOGE("Could not link program:\n%s\n", buf); free(buf); } } @@ -132,7 +132,7 @@ static void endTimer(int count) { } else { printf("%s, %f, %f\n", gCurrentTestName, mpps, dc60); } - LOGI("%s, %f, %f\r\n", gCurrentTestName, mpps, dc60); + ALOGI("%s, %f, %f\r\n", gCurrentTestName, mpps, dc60); } diff --git a/opengl/tests/gl_perfapp/jni/gl_code.cpp b/opengl/tests/gl_perfapp/jni/gl_code.cpp index f99337152c..2f0418373a 100644 --- a/opengl/tests/gl_perfapp/jni/gl_code.cpp +++ b/opengl/tests/gl_perfapp/jni/gl_code.cpp @@ -43,7 +43,7 @@ void doTest() { int texSize = ((stateClock >> 1) & 0x1) + 1; if (testNum >= gFragmentTestCount) { - LOGI("done\n"); + ALOGI("done\n"); if (fOut) { fclose(fOut); fOut = NULL; @@ -52,7 +52,7 @@ void doTest() { return; } - // LOGI("doTest %d %d %d\n", texCount, extraMath, testSubState); + // ALOGI("doTest %d %d %d\n", texCount, extraMath, testSubState); // for (uint32_t num = 0; num < gFragmentTestCount; num++) { doSingleTest(testNum, texSize); @@ -74,17 +74,17 @@ JNIEXPORT void JNICALL Java_com_android_glperf_GLPerfLib_init(JNIEnv * env, jobj genTextures(); const char* fileName = "/sdcard/glperf.csv"; if (fOut != NULL) { - LOGI("Closing partially written output.n"); + ALOGI("Closing partially written output.n"); fclose(fOut); fOut = NULL; } - LOGI("Writing to: %s\n",fileName); + ALOGI("Writing to: %s\n",fileName); fOut = fopen(fileName, "w"); if (fOut == NULL) { - LOGE("Could not open: %s\n", fileName); + ALOGE("Could not open: %s\n", fileName); } - LOGI("\nvarColor, texCount, modulate, extraMath, texSize, blend, Mpps, DC60\n"); + ALOGI("\nvarColor, texCount, modulate, extraMath, texSize, blend, Mpps, DC60\n"); if (fOut) fprintf(fOut,"varColor, texCount, modulate, extraMath, texSize, blend, Mpps, DC60\r\n"); } } diff --git a/opengl/tests/gldual/jni/gl_code.cpp b/opengl/tests/gldual/jni/gl_code.cpp index f1f0a1f754..22867ed6ba 100644 --- a/opengl/tests/gldual/jni/gl_code.cpp +++ b/opengl/tests/gldual/jni/gl_code.cpp @@ -14,13 +14,13 @@ static void printGLString(const char *name, GLenum s) { const char *v = (const char *) glGetString(s); - LOGI("GL %s = %s\n", name, v); + ALOGI("GL %s = %s\n", name, v); } static void checkGlError(const char* op) { for (GLint error = glGetError(); error; error = glGetError()) { - LOGI("after %s() glError (0x%x)\n", op, error); + ALOGI("after %s() glError (0x%x)\n", op, error); } } @@ -48,7 +48,7 @@ GLuint loadShader(GLenum shaderType, const char* pSource) { char* buf = (char*) malloc(infoLen); if (buf) { glGetShaderInfoLog(shader, infoLen, NULL, buf); - LOGE("Could not compile shader %d:\n%s\n", + ALOGE("Could not compile shader %d:\n%s\n", shaderType, buf); free(buf); } @@ -87,7 +87,7 @@ GLuint createProgram(const char* pVertexSource, const char* pFragmentSource) { char* buf = (char*) malloc(bufLength); if (buf) { glGetProgramInfoLog(program, bufLength, NULL, buf); - LOGE("Could not link program:\n%s\n", buf); + ALOGE("Could not link program:\n%s\n", buf); free(buf); } } @@ -107,15 +107,15 @@ bool setupGraphics(int w, int h) { printGLString("Renderer", GL_RENDERER); printGLString("Extensions", GL_EXTENSIONS); - LOGI("setupGraphics(%d, %d)", w, h); + ALOGI("setupGraphics(%d, %d)", w, h); gProgram = createProgram(gVertexShader, gFragmentShader); if (!gProgram) { - LOGE("Could not create program."); + ALOGE("Could not create program."); return false; } gvPositionHandle = glGetAttribLocation(gProgram, "vPosition"); checkGlError("glGetAttribLocation"); - LOGI("glGetAttribLocation(\"vPosition\") = %d\n", + ALOGI("glGetAttribLocation(\"vPosition\") = %d\n", gvPositionHandle); glViewport(0, 0, w, h); diff --git a/services/surfaceflinger/Android.mk b/services/surfaceflinger/Android.mk index f63c0c12c2..95d651acc2 100644 --- a/services/surfaceflinger/Android.mk +++ b/services/surfaceflinger/Android.mk @@ -2,19 +2,22 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES:= \ - Layer.cpp \ - LayerBase.cpp \ - LayerDim.cpp \ - LayerScreenshot.cpp \ - DdmConnection.cpp \ - DisplayHardware/DisplayHardware.cpp \ + EventThread.cpp \ + Layer.cpp \ + LayerBase.cpp \ + LayerDim.cpp \ + LayerScreenshot.cpp \ + DdmConnection.cpp \ + DisplayHardware/DisplayHardware.cpp \ DisplayHardware/DisplayHardwareBase.cpp \ - DisplayHardware/HWComposer.cpp \ - GLExtensions.cpp \ - MessageQueue.cpp \ - SurfaceFlinger.cpp \ - SurfaceTextureLayer.cpp \ - Transform.cpp \ + DisplayHardware/HWComposer.cpp \ + DisplayHardware/VSyncBarrier.cpp \ + DisplayEventConnection.cpp \ + GLExtensions.cpp \ + MessageQueue.cpp \ + SurfaceFlinger.cpp \ + SurfaceTextureLayer.cpp \ + Transform.cpp \ LOCAL_CFLAGS:= -DLOG_TAG=\"SurfaceFlinger\" diff --git a/services/surfaceflinger/DisplayEventConnection.cpp b/services/surfaceflinger/DisplayEventConnection.cpp new file mode 100644 index 0000000000..77ecbd280e --- /dev/null +++ b/services/surfaceflinger/DisplayEventConnection.cpp @@ -0,0 +1,71 @@ +/* + * 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. + */ + +#include <stdint.h> +#include <sys/types.h> + +#include <gui/IDisplayEventConnection.h> +#include <gui/BitTube.h> +#include <gui/DisplayEventReceiver.h> + +#include <utils/Errors.h> + +#include "SurfaceFlinger.h" +#include "DisplayEventConnection.h" +#include "EventThread.h" + +// --------------------------------------------------------------------------- + +namespace android { + +// --------------------------------------------------------------------------- + +DisplayEventConnection::DisplayEventConnection( + const sp<EventThread>& eventThread) + : mEventThread(eventThread), mChannel(new BitTube()) +{ +} + +DisplayEventConnection::~DisplayEventConnection() { + mEventThread->unregisterDisplayEventConnection(this); +} + +void DisplayEventConnection::onFirstRef() { + // NOTE: mEventThread doesn't hold a strong reference on us + mEventThread->registerDisplayEventConnection(this); +} + +sp<BitTube> DisplayEventConnection::getDataChannel() const { + return mChannel; +} + +void DisplayEventConnection::setVsyncRate(uint32_t count) { + mEventThread->setVsyncRate(count, this); +} + +void DisplayEventConnection::requestNextVsync() { + mEventThread->requestNextVsync(this); +} + +status_t DisplayEventConnection::postEvent(const DisplayEventReceiver::Event& event) +{ + ssize_t size = mChannel->write(&event, sizeof(DisplayEventReceiver::Event)); + return size < 0 ? status_t(size) : status_t(NO_ERROR); +} + +// --------------------------------------------------------------------------- + +}; // namespace android diff --git a/services/surfaceflinger/DisplayEventConnection.h b/services/surfaceflinger/DisplayEventConnection.h new file mode 100644 index 0000000000..cc3ee3659e --- /dev/null +++ b/services/surfaceflinger/DisplayEventConnection.h @@ -0,0 +1,62 @@ +/* + * 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_SURFACE_FLINGER_DISPLAY_EVENT_CONNECTION_H +#define ANDROID_SURFACE_FLINGER_DISPLAY_EVENT_CONNECTION_H + +#include <stdint.h> +#include <sys/types.h> + +#include <gui/IDisplayEventConnection.h> + +#include <utils/Errors.h> +#include <gui/DisplayEventReceiver.h> + +// --------------------------------------------------------------------------- + +namespace android { + +// --------------------------------------------------------------------------- + +class BitTube; +class EventThread; + +// --------------------------------------------------------------------------- + +class DisplayEventConnection : public BnDisplayEventConnection { +public: + DisplayEventConnection(const sp<EventThread>& flinger); + + status_t postEvent(const DisplayEventReceiver::Event& event); + +private: + virtual ~DisplayEventConnection(); + virtual void onFirstRef(); + virtual sp<BitTube> getDataChannel() const; + virtual void setVsyncRate(uint32_t count); + virtual void requestNextVsync(); // asynchronous + + sp<EventThread> const mEventThread; + sp<BitTube> const mChannel; +}; + +// --------------------------------------------------------------------------- + +}; // namespace android + +// --------------------------------------------------------------------------- + +#endif /* ANDROID_SURFACE_FLINGER_DISPLAY_EVENT_CONNECTION_H */ diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp b/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp index f94d32149b..cf131b11db 100644 --- a/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp +++ b/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp @@ -53,7 +53,7 @@ void checkGLErrors() GLenum error = glGetError(); if (error == GL_NO_ERROR) break; - LOGE("GL error 0x%04x", int(error)); + ALOGE("GL error 0x%04x", int(error)); } while(true); } @@ -62,7 +62,7 @@ void checkEGLErrors(const char* token) { EGLint error = eglGetError(); if (error && error != EGL_SUCCESS) { - LOGE("%s: EGL error 0x%04x (%s)", + ALOGE("%s: EGL error 0x%04x (%s)", token, int(error), EGLUtils::strerror(error)); } } @@ -130,7 +130,7 @@ void DisplayHardware::init(uint32_t dpy) mNativeWindow = new FramebufferNativeWindow(); framebuffer_device_t const * fbDev = mNativeWindow->getDevice(); if (!fbDev) { - LOGE("Display subsystem failed to initialize. check logs. exiting..."); + ALOGE("Display subsystem failed to initialize. check logs. exiting..."); exit(0); } @@ -140,6 +140,7 @@ void DisplayHardware::init(uint32_t dpy) mDpiX = mNativeWindow->xdpi; mDpiY = mNativeWindow->ydpi; mRefreshRate = fbDev->fps; + mNextFakeVSync = 0; /* FIXME: this is a temporary HACK until we are able to report the refresh rate @@ -152,6 +153,8 @@ void DisplayHardware::init(uint32_t dpy) #warning "refresh rate set via makefile to REFRESH_RATE" #endif + mRefreshPeriod = nsecs_t(1e9 / mRefreshRate); + EGLint w, h, dummy; EGLint numConfigs=0; EGLSurface surface; @@ -170,7 +173,7 @@ void DisplayHardware::init(uint32_t dpy) char property[PROPERTY_VALUE_MAX]; if (property_get("debug.sf.hw", property, NULL) > 0) { if (atoi(property) == 0) { - LOGW("H/W composition disabled"); + ALOGW("H/W composition disabled"); attribs[2] = EGL_CONFIG_CAVEAT; attribs[3] = EGL_SLOW_CONFIG; } @@ -185,7 +188,7 @@ void DisplayHardware::init(uint32_t dpy) EGLConfig config = NULL; err = selectConfigForPixelFormat(display, attribs, format, &config); - LOGE_IF(err, "couldn't find an EGLConfig matching the screen format"); + ALOGE_IF(err, "couldn't find an EGLConfig matching the screen format"); EGLint r,g,b,a; eglGetConfigAttrib(display, config, EGL_RED_SIZE, &r); @@ -228,7 +231,7 @@ void DisplayHardware::init(uint32_t dpy) */ if (property_get("qemu.sf.lcd_density", property, NULL) <= 0) { if (property_get("ro.sf.lcd_density", property, NULL) <= 0) { - LOGW("ro.sf.lcd_density not defined, using 160 dpi by default."); + ALOGW("ro.sf.lcd_density not defined, using 160 dpi by default."); strcpy(property, "160"); } } else { @@ -267,7 +270,7 @@ void DisplayHardware::init(uint32_t dpy) result = eglMakeCurrent(display, surface, surface, context); if (!result) { - LOGE("Couldn't create a working GLES context. check logs. exiting..."); + ALOGE("Couldn't create a working GLES context. check logs. exiting..."); exit(0); } @@ -284,22 +287,22 @@ void DisplayHardware::init(uint32_t dpy) glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize); glGetIntegerv(GL_MAX_VIEWPORT_DIMS, mMaxViewportDims); - LOGI("EGL informations:"); - LOGI("# of configs : %d", numConfigs); - LOGI("vendor : %s", extensions.getEglVendor()); - LOGI("version : %s", extensions.getEglVersion()); - LOGI("extensions: %s", extensions.getEglExtension()); - LOGI("Client API: %s", eglQueryString(display, EGL_CLIENT_APIS)?:"Not Supported"); - LOGI("EGLSurface: %d-%d-%d-%d, config=%p", r, g, b, a, config); - - LOGI("OpenGL informations:"); - LOGI("vendor : %s", extensions.getVendor()); - LOGI("renderer : %s", extensions.getRenderer()); - LOGI("version : %s", extensions.getVersion()); - LOGI("extensions: %s", extensions.getExtension()); - LOGI("GL_MAX_TEXTURE_SIZE = %d", mMaxTextureSize); - LOGI("GL_MAX_VIEWPORT_DIMS = %d x %d", mMaxViewportDims[0], mMaxViewportDims[1]); - LOGI("flags = %08x", mFlags); + ALOGI("EGL informations:"); + ALOGI("# of configs : %d", numConfigs); + ALOGI("vendor : %s", extensions.getEglVendor()); + ALOGI("version : %s", extensions.getEglVersion()); + ALOGI("extensions: %s", extensions.getEglExtension()); + ALOGI("Client API: %s", eglQueryString(display, EGL_CLIENT_APIS)?:"Not Supported"); + ALOGI("EGLSurface: %d-%d-%d-%d, config=%p", r, g, b, a, config); + + ALOGI("OpenGL informations:"); + ALOGI("vendor : %s", extensions.getVendor()); + ALOGI("renderer : %s", extensions.getRenderer()); + ALOGI("version : %s", extensions.getVersion()); + ALOGI("extensions: %s", extensions.getExtension()); + ALOGI("GL_MAX_TEXTURE_SIZE = %d", mMaxTextureSize); + ALOGI("GL_MAX_VIEWPORT_DIMS = %d x %d", mMaxViewportDims[0], mMaxViewportDims[1]); + ALOGI("flags = %08x", mFlags); // Unbind the context from this thread eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); @@ -346,6 +349,37 @@ uint32_t DisplayHardware::getPageFlipCount() const { return mPageFlipCount; } +// this needs to be thread safe +nsecs_t DisplayHardware::waitForVSync() const { + nsecs_t timestamp; + if (mVSync.wait(×tamp) < 0) { + // vsync not supported! + usleep( getDelayToNextVSyncUs(×tamp) ); + } + return timestamp; +} + +int32_t DisplayHardware::getDelayToNextVSyncUs(nsecs_t* timestamp) const { + Mutex::Autolock _l(mFakeVSyncMutex); + const nsecs_t period = mRefreshPeriod; + const nsecs_t now = systemTime(CLOCK_MONOTONIC); + nsecs_t next_vsync = mNextFakeVSync; + nsecs_t sleep = next_vsync - now; + if (sleep < 0) { + // we missed, find where the next vsync should be + sleep = (period - ((now - next_vsync) % period)); + next_vsync = now + sleep; + } + mNextFakeVSync = next_vsync + period; + timestamp[0] = next_vsync; + + // round to next microsecond + int32_t sleep_us = (sleep + 999LL) / 1000LL; + + // guaranteed to be > 0 + return sleep_us; +} + status_t DisplayHardware::compositionComplete() const { return mNativeWindow->compositionComplete(); } diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardware.h b/services/surfaceflinger/DisplayHardware/DisplayHardware.h index f02c95414f..45d4b45ad9 100644 --- a/services/surfaceflinger/DisplayHardware/DisplayHardware.h +++ b/services/surfaceflinger/DisplayHardware/DisplayHardware.h @@ -32,6 +32,7 @@ #include "GLExtensions.h" #include "DisplayHardware/DisplayHardwareBase.h" +#include "DisplayHardware/VSyncBarrier.h" namespace android { @@ -74,6 +75,9 @@ public: uint32_t getMaxTextureSize() const; uint32_t getMaxViewportDims() const; + // waits for the next vsync and returns the timestamp of when it happened + nsecs_t waitForVSync() const; + uint32_t getPageFlipCount() const; EGLDisplay getEGLDisplay() const { return mDisplay; } @@ -95,6 +99,7 @@ public: private: void init(uint32_t displayIndex) __attribute__((noinline)); void fini() __attribute__((noinline)); + int32_t getDelayToNextVSyncUs(nsecs_t* timestamp) const; sp<SurfaceFlinger> mFlinger; EGLDisplay mDisplay; @@ -112,7 +117,12 @@ private: mutable uint32_t mPageFlipCount; GLint mMaxViewportDims[2]; GLint mMaxTextureSize; - + VSyncBarrier mVSync; + + mutable Mutex mFakeVSyncMutex; + mutable nsecs_t mNextFakeVSync; + nsecs_t mRefreshPeriod; + HWComposer* mHwc; sp<FramebufferNativeWindow> mNativeWindow; diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp b/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp index 3b7c09e80a..f4afeeaa0a 100644 --- a/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp +++ b/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp @@ -76,10 +76,10 @@ bool DisplayHardwareBase::DisplayEventThread::threadLoop() err = read(fd, &buf, 1); } while (err < 0 && errno == EINTR); close(fd); - LOGW_IF(err<0, "ANDROID_WAIT_FOR_FB_SLEEP failed (%s)", strerror(errno)); + ALOGW_IF(err<0, "ANDROID_WAIT_FOR_FB_SLEEP failed (%s)", strerror(errno)); if (err >= 0) { sp<SurfaceFlinger> flinger = mFlinger.promote(); - LOGD("About to give-up screen, flinger = %p", flinger.get()); + ALOGD("About to give-up screen, flinger = %p", flinger.get()); if (flinger != 0) { mBarrier.close(); flinger->screenReleased(0); @@ -91,10 +91,10 @@ bool DisplayHardwareBase::DisplayEventThread::threadLoop() err = read(fd, &buf, 1); } while (err < 0 && errno == EINTR); close(fd); - LOGW_IF(err<0, "ANDROID_WAIT_FOR_FB_WAKE failed (%s)", strerror(errno)); + ALOGW_IF(err<0, "ANDROID_WAIT_FOR_FB_WAKE failed (%s)", strerror(errno)); if (err >= 0) { sp<SurfaceFlinger> flinger = mFlinger.promote(); - LOGD("Screen about to return, flinger = %p", flinger.get()); + ALOGD("Screen about to return, flinger = %p", flinger.get()); if (flinger != 0) flinger->screenAcquired(0); } diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp index be9b2265c7..f17bf43bfc 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp +++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp @@ -44,10 +44,10 @@ HWComposer::HWComposer(const sp<SurfaceFlinger>& flinger) mDpy(EGL_NO_DISPLAY), mSur(EGL_NO_SURFACE) { int err = hw_get_module(HWC_HARDWARE_MODULE_ID, &mModule); - LOGW_IF(err, "%s module not found", HWC_HARDWARE_MODULE_ID); + ALOGW_IF(err, "%s module not found", HWC_HARDWARE_MODULE_ID); if (err == 0) { err = hwc_open(mModule, &mHwc); - LOGE_IF(err, "%s device failed to initialize (%s)", + ALOGE_IF(err, "%s device failed to initialize (%s)", HWC_HARDWARE_COMPOSER, strerror(-err)); if (err == 0) { if (mHwc->registerProcs) { diff --git a/services/surfaceflinger/DisplayHardware/VSyncBarrier.cpp b/services/surfaceflinger/DisplayHardware/VSyncBarrier.cpp new file mode 100644 index 0000000000..187da203c5 --- /dev/null +++ b/services/surfaceflinger/DisplayHardware/VSyncBarrier.cpp @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#include <stdint.h> +#include <sys/types.h> + +#include <utils/Errors.h> + +#include <fcntl.h> +#include <sys/ioctl.h> +#include <linux/fb.h> + +#include "DisplayHardware/VSyncBarrier.h" + +#ifndef FBIO_WAITFORVSYNC +#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) +#endif + +namespace android { +// --------------------------------------------------------------------------- + +VSyncBarrier::VSyncBarrier() : mFd(-EINVAL) { +#if HAS_WAITFORVSYNC + mFd = open("/dev/graphics/fb0", O_RDWR); + if (mFd < 0) { + mFd = -errno; + } + // try to see if FBIO_WAITFORVSYNC is supported + uint32_t crt = 0; + int err = ioctl(mFd, FBIO_WAITFORVSYNC, &crt); + if (err < 0) { + close(mFd); + mFd = -EINVAL; + } +#endif +} + +VSyncBarrier::~VSyncBarrier() { + if (mFd >= 0) { + close(mFd); + } +} + +status_t VSyncBarrier::initCheck() const { + return mFd < 0 ? mFd : status_t(NO_ERROR); +} + +// this must be thread-safe +status_t VSyncBarrier::wait(nsecs_t* timestamp) const { + if (mFd < 0) { + return mFd; + } + + int err; + uint32_t crt = 0; + do { + err = ioctl(mFd, FBIO_WAITFORVSYNC, &crt); + } while (err<0 && errno==EINTR); + if (err < 0) { + return -errno; + } + // ideally this would come from the driver + timestamp[0] = systemTime(); + return NO_ERROR; +} + +// --------------------------------------------------------------------------- +}; // namespace android diff --git a/services/surfaceflinger/DisplayHardware/VSyncBarrier.h b/services/surfaceflinger/DisplayHardware/VSyncBarrier.h new file mode 100644 index 0000000000..3c3295050a --- /dev/null +++ b/services/surfaceflinger/DisplayHardware/VSyncBarrier.h @@ -0,0 +1,41 @@ +/* + * 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_SURFACE_FLINGER_VSYNCBARRIER_H_ +#define ANDROID_SURFACE_FLINGER_VSYNCBARRIER_H_ + +#include <stdint.h> +#include <sys/types.h> + +#include <utils/Errors.h> +#include <utils/Timers.h> + +namespace android { +// --------------------------------------------------------------------------- + +class VSyncBarrier { + int mFd; +public: + VSyncBarrier(); + ~VSyncBarrier(); + status_t initCheck() const; + status_t wait(nsecs_t* timestamp) const; +}; + +// --------------------------------------------------------------------------- +}; // namespace android + +#endif /* ANDROID_SURFACE_FLINGER_VSYNCBARRIER_H_ */ diff --git a/services/surfaceflinger/EventThread.cpp b/services/surfaceflinger/EventThread.cpp new file mode 100644 index 0000000000..92457811e5 --- /dev/null +++ b/services/surfaceflinger/EventThread.cpp @@ -0,0 +1,226 @@ +/* + * 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. + */ + +#include <stdint.h> +#include <sys/types.h> + +#include <gui/IDisplayEventConnection.h> +#include <gui/DisplayEventReceiver.h> + +#include <utils/Errors.h> + +#include "DisplayHardware/DisplayHardware.h" +#include "DisplayEventConnection.h" +#include "EventThread.h" +#include "SurfaceFlinger.h" + +// --------------------------------------------------------------------------- + +namespace android { + +// --------------------------------------------------------------------------- + +EventThread::EventThread(const sp<SurfaceFlinger>& flinger) + : mFlinger(flinger), + mHw(flinger->graphicPlane(0).displayHardware()), + mDeliveredEvents(0) +{ +} + +void EventThread::onFirstRef() { + run("EventThread", PRIORITY_URGENT_DISPLAY + PRIORITY_MORE_FAVORABLE); +} + +status_t EventThread::registerDisplayEventConnection( + const sp<DisplayEventConnection>& connection) { + Mutex::Autolock _l(mLock); + ConnectionInfo info; + mDisplayEventConnections.add(connection, info); + mCondition.signal(); + return NO_ERROR; +} + +status_t EventThread::unregisterDisplayEventConnection( + const wp<DisplayEventConnection>& connection) { + Mutex::Autolock _l(mLock); + mDisplayEventConnections.removeItem(connection); + mCondition.signal(); + return NO_ERROR; +} + +void EventThread::removeDisplayEventConnection( + const wp<DisplayEventConnection>& connection) { + Mutex::Autolock _l(mLock); + mDisplayEventConnections.removeItem(connection); +} + +EventThread::ConnectionInfo* EventThread::getConnectionInfoLocked( + const wp<DisplayEventConnection>& connection) { + ssize_t index = mDisplayEventConnections.indexOfKey(connection); + if (index < 0) return NULL; + return &mDisplayEventConnections.editValueAt(index); +} + +void EventThread::setVsyncRate(uint32_t count, + const wp<DisplayEventConnection>& connection) { + if (int32_t(count) >= 0) { // server must protect against bad params + Mutex::Autolock _l(mLock); + ConnectionInfo* info = getConnectionInfoLocked(connection); + if (info) { + info->count = (count == 0) ? -1 : count; + mCondition.signal(); + } + } +} + +void EventThread::requestNextVsync( + const wp<DisplayEventConnection>& connection) { + Mutex::Autolock _l(mLock); + ConnectionInfo* info = getConnectionInfoLocked(connection); + if (info) { + if (info->count < 0) { + info->count = 0; + } + mCondition.signal(); + } +} + +bool EventThread::threadLoop() { + + nsecs_t timestamp; + DisplayEventReceiver::Event vsync; + KeyedVector< wp<DisplayEventConnection>, ConnectionInfo > displayEventConnections; + + { // scope for the lock + Mutex::Autolock _l(mLock); + do { + // wait for listeners + do { + bool waitForNextVsync = false; + size_t count = mDisplayEventConnections.size(); + for (size_t i=0 ; i<count ; i++) { + const ConnectionInfo& info( + mDisplayEventConnections.valueAt(i)); + if (info.count >= 1) { + // continuous mode + waitForNextVsync = true; + } else { + // one-shot event + if (info.count >= -1) { + ConnectionInfo& info( + mDisplayEventConnections.editValueAt(i)); + info.count--; + if (info.count == -1) { + // fired this time around + waitForNextVsync = true; + } + } + } + } + + if (waitForNextVsync) + break; + + mCondition.wait(mLock); + } while(true); + + // wait for vsync + mLock.unlock(); + timestamp = mHw.waitForVSync(); + mLock.lock(); + mDeliveredEvents++; + + // make sure we still have some listeners + } while (!mDisplayEventConnections.size()); + + // dispatch vsync events to listeners... + vsync.header.type = DisplayEventReceiver::DISPLAY_EVENT_VSYNC; + vsync.header.timestamp = timestamp; + vsync.vsync.count = mDeliveredEvents; + + // make a copy of our connection list, so we can + // dispatch events without holding mLock + displayEventConnections = mDisplayEventConnections; + } + + const size_t count = displayEventConnections.size(); + for (size_t i=0 ; i<count ; i++) { + sp<DisplayEventConnection> conn(displayEventConnections.keyAt(i).promote()); + // make sure the connection didn't die + if (conn != NULL) { + + const ConnectionInfo& info( + displayEventConnections.valueAt(i)); + + if ((info.count > 1) && (mDeliveredEvents % info.count)) { + // continuous event, but not time to send this event yet + continue; + } else if (info.count < -1) { + // disabled event + continue; + } else if (info.count == 0) { + // impossible by construction. but we prefer to be safe. + continue; + } + + // here, either: + // count = -1 : one-shot scheduled this time around + // count = 1 : continuous not rate-limited + // count > 1 : continuous, rate-limited + // Note: count == 0 is not possible by construction + + status_t err = conn->postEvent(vsync); + if (err == -EAGAIN || err == -EWOULDBLOCK) { + // The destination doesn't accept events anymore, it's probably + // full. For now, we just drop the events on the floor. + // Note that some events cannot be dropped and would have to be + // re-sent later. Right-now we don't have the ability to do + // this, but it doesn't matter for VSYNC. + } else if (err < 0) { + // handle any other error on the pipe as fatal. the only + // reasonable thing to do is to clean-up this connection. + // The most common error we'll get here is -EPIPE. + removeDisplayEventConnection(displayEventConnections.keyAt(i)); + } + } else { + // somehow the connection is dead, but we still have it in our list + // just clean the list. + removeDisplayEventConnection(displayEventConnections.keyAt(i)); + } + } + + // clear all our references without holding mLock + displayEventConnections.clear(); + + return true; +} + +status_t EventThread::readyToRun() { + ALOGI("EventThread ready to run."); + return NO_ERROR; +} + +void EventThread::dump(String8& result, char* buffer, size_t SIZE) const { + Mutex::Autolock _l(mLock); + result.append("VSYNC state:\n"); + snprintf(buffer, SIZE, " numListeners=%u, events-delivered: %u\n", + mDisplayEventConnections.size(), mDeliveredEvents); + result.append(buffer); +} + +// --------------------------------------------------------------------------- + +}; // namespace android diff --git a/services/surfaceflinger/EventThread.h b/services/surfaceflinger/EventThread.h new file mode 100644 index 0000000000..35bd299a86 --- /dev/null +++ b/services/surfaceflinger/EventThread.h @@ -0,0 +1,102 @@ +/* + * 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_SURFACE_FLINGER_EVENT_THREAD_H +#define ANDROID_SURFACE_FLINGER_EVENT_THREAD_H + +#include <stdint.h> +#include <sys/types.h> + +#include <gui/IDisplayEventConnection.h> + +#include <utils/Errors.h> +#include <utils/threads.h> +#include <utils/KeyedVector.h> + +#include "DisplayEventConnection.h" + +// --------------------------------------------------------------------------- + +namespace android { + +// --------------------------------------------------------------------------- + +class SurfaceFlinger; +class DisplayHardware; + +// --------------------------------------------------------------------------- + +class EventThread : public Thread { + friend class DisplayEventConnection; + +public: + EventThread(const sp<SurfaceFlinger>& flinger); + + status_t registerDisplayEventConnection( + const sp<DisplayEventConnection>& connection); + + status_t unregisterDisplayEventConnection( + const wp<DisplayEventConnection>& connection); + + void setVsyncRate(uint32_t count, + const wp<DisplayEventConnection>& connection); + + void requestNextVsync(const wp<DisplayEventConnection>& connection); + + void dump(String8& result, char* buffer, size_t SIZE) const; + +private: + virtual bool threadLoop(); + virtual status_t readyToRun(); + virtual void onFirstRef(); + + struct ConnectionInfo { + ConnectionInfo() : count(-1) { } + + // count >= 1 : continuous event. count is the vsync rate + // count == 0 : one-shot event that has not fired + // count ==-1 : one-shot event that fired this round / disabled + // count ==-2 : one-shot event that fired the round before + int32_t count; + }; + + void removeDisplayEventConnection( + const wp<DisplayEventConnection>& connection); + + ConnectionInfo* getConnectionInfoLocked( + const wp<DisplayEventConnection>& connection); + + // constants + sp<SurfaceFlinger> mFlinger; + const DisplayHardware& mHw; + + mutable Mutex mLock; + mutable Condition mCondition; + + // protected by mLock + KeyedVector< wp<DisplayEventConnection>, ConnectionInfo > mDisplayEventConnections; + + // main thread only + size_t mDeliveredEvents; +}; + +// --------------------------------------------------------------------------- + +}; // namespace android + +// --------------------------------------------------------------------------- + +#endif /* ANDROID_SURFACE_FLINGER_EVENT_THREAD_H */ diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index d3b0dbfe9a..d4c4b1f936 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -350,7 +350,7 @@ uint32_t Layer::doTransaction(uint32_t flags) if (sizeChanged) { // the size changed, we need to ask our client to request a new buffer - LOGD_IF(DEBUG_RESIZE, + ALOGD_IF(DEBUG_RESIZE, "doTransaction: " "resize (layer=%p), requested (%dx%d), drawing (%d,%d), " "scalingMode=%d", @@ -485,7 +485,7 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions) recomputeVisibleRegions = true; } - LOGD_IF(DEBUG_RESIZE, + ALOGD_IF(DEBUG_RESIZE, "lockPageFlip : " " (layer=%p), buffer (%ux%u, tr=%02x), " "requested (%dx%d)", diff --git a/services/surfaceflinger/LayerBase.cpp b/services/surfaceflinger/LayerBase.cpp index f04add148c..37879f1a47 100644 --- a/services/surfaceflinger/LayerBase.cpp +++ b/services/surfaceflinger/LayerBase.cpp @@ -240,7 +240,7 @@ void LayerBase::validateVisibility(const Transform& planeTransform) for (size_t i=0 ; i<4 ; i++) mVertices[i][1] = hw_h - mVertices[i][1]; - if (UNLIKELY(transformed)) { + if (CC_UNLIKELY(transformed)) { // NOTE: here we could also punt if we have too many rectangles // in the transparent region if (tr.preserveRects()) { @@ -416,7 +416,7 @@ void LayerBase::drawWithOpenGL(const Region& clip) const const State& s(drawingState()); GLenum src = mPremultipliedAlpha ? GL_ONE : GL_SRC_ALPHA; - if (UNLIKELY(s.alpha < 0xFF)) { + if (CC_UNLIKELY(s.alpha < 0xFF)) { const GLfloat alpha = s.alpha * (1.0f/255.0f); if (mPremultipliedAlpha) { glColor4f(alpha, alpha, alpha, alpha); diff --git a/services/surfaceflinger/LayerScreenshot.cpp b/services/surfaceflinger/LayerScreenshot.cpp index 68e66606ed..c127fa621f 100644 --- a/services/surfaceflinger/LayerScreenshot.cpp +++ b/services/surfaceflinger/LayerScreenshot.cpp @@ -93,7 +93,7 @@ uint32_t LayerScreenshot::doTransaction(uint32_t flags) // we're going from hidden to visible status_t err = captureLocked(); if (err != NO_ERROR) { - LOGW("createScreenshotSurface failed (%s)", strerror(-err)); + ALOGW("createScreenshotSurface failed (%s)", strerror(-err)); } } } else if (curr.flags & ISurfaceComposer::eLayerHidden) { diff --git a/services/surfaceflinger/MessageQueue.cpp b/services/surfaceflinger/MessageQueue.cpp index aebe1b82d2..cbd530c822 100644 --- a/services/surfaceflinger/MessageQueue.cpp +++ b/services/surfaceflinger/MessageQueue.cpp @@ -29,167 +29,75 @@ namespace android { // --------------------------------------------------------------------------- -void MessageList::insert(const sp<MessageBase>& node) -{ - LIST::iterator cur(mList.begin()); - LIST::iterator end(mList.end()); - while (cur != end) { - if (*node < **cur) { - mList.insert(cur, node); - return; - } - ++cur; - } - mList.insert(++end, node); +MessageBase::MessageBase() + : MessageHandler() { } -void MessageList::remove(MessageList::LIST::iterator pos) -{ - mList.erase(pos); +MessageBase::~MessageBase() { } +void MessageBase::handleMessage(const Message&) { + this->handler(); + barrier.open(); +}; + // --------------------------------------------------------------------------- MessageQueue::MessageQueue() - : mInvalidate(false) + : mLooper(new Looper(true)), mWorkPending(0) { - mInvalidateMessage = new MessageBase(INVALIDATE); } -MessageQueue::~MessageQueue() -{ +MessageQueue::~MessageQueue() { } -sp<MessageBase> MessageQueue::waitMessage(nsecs_t timeout) -{ - sp<MessageBase> result; - - bool again; +void MessageQueue::waitMessage() { do { - const nsecs_t timeoutTime = systemTime() + timeout; - while (true) { - Mutex::Autolock _l(mLock); - nsecs_t now = systemTime(); - nsecs_t nextEventTime = -1; - - LIST::iterator cur(mMessages.begin()); - if (cur != mMessages.end()) { - result = *cur; - } - - if (result != 0) { - if (result->when <= now) { - // there is a message to deliver - mMessages.remove(cur); - break; - } - nextEventTime = result->when; - result = 0; - } - - // see if we have an invalidate message - if (mInvalidate) { - mInvalidate = false; - mInvalidateMessage->when = now; - result = mInvalidateMessage; - break; - } - - if (timeout >= 0) { - if (timeoutTime < now) { - // we timed-out, return a NULL message - result = 0; - break; - } - if (nextEventTime > 0) { - if (nextEventTime > timeoutTime) { - nextEventTime = timeoutTime; - } - } else { - nextEventTime = timeoutTime; - } - } - - if (nextEventTime >= 0) { - //LOGD("nextEventTime = %lld ms", nextEventTime); - if (nextEventTime > 0) { - // we're about to wait, flush the binder command buffer - IPCThreadState::self()->flushCommands(); - const nsecs_t reltime = nextEventTime - systemTime(); - if (reltime > 0) { - mCondition.waitRelative(mLock, reltime); - } + IPCThreadState::self()->flushCommands(); + + int32_t ret = mLooper->pollOnce(-1); + switch (ret) { + case ALOOPER_POLL_WAKE: + case ALOOPER_POLL_CALLBACK: + // callback and/or wake + if (android_atomic_and(0, &mWorkPending)) { + return; } - } else { - //LOGD("going to wait"); - // we're about to wait, flush the binder command buffer - IPCThreadState::self()->flushCommands(); - mCondition.wait(mLock); - } - } - // here we're not holding the lock anymore - - if (result == 0) - break; - - again = result->handler(); - if (again) { - // the message has been processed. release our reference to it - // without holding the lock. - result->notify(); - result = 0; - } - - } while (again); + continue; - return result; -} + case ALOOPER_POLL_TIMEOUT: + // timeout (should not happen) + continue; -status_t MessageQueue::postMessage( - const sp<MessageBase>& message, nsecs_t relTime, uint32_t flags) -{ - return queueMessage(message, relTime, flags); -} + case ALOOPER_POLL_ERROR: + ALOGE("ALOOPER_POLL_ERROR"); + continue; -status_t MessageQueue::invalidate() { - Mutex::Autolock _l(mLock); - mInvalidate = true; - mCondition.signal(); - return NO_ERROR; + default: + // should not happen + ALOGE("Looper::pollOnce() returned unknown status %d", ret); + continue; + } + } while (true); } -status_t MessageQueue::queueMessage( - const sp<MessageBase>& message, nsecs_t relTime, uint32_t flags) +status_t MessageQueue::postMessage( + const sp<MessageBase>& messageHandler, nsecs_t relTime) { - Mutex::Autolock _l(mLock); - message->when = systemTime() + relTime; - mMessages.insert(message); - - //LOGD("MessageQueue::queueMessage time = %lld ms", message->when); - //dumpLocked(message); - - mCondition.signal(); + const Message dummyMessage; + if (relTime > 0) { + mLooper->sendMessageDelayed(relTime, messageHandler, dummyMessage); + } else { + mLooper->sendMessage(messageHandler, dummyMessage); + } return NO_ERROR; } -void MessageQueue::dump(const sp<MessageBase>& message) -{ - Mutex::Autolock _l(mLock); - dumpLocked(message); -} - -void MessageQueue::dumpLocked(const sp<MessageBase>& message) -{ - LIST::const_iterator cur(mMessages.begin()); - LIST::const_iterator end(mMessages.end()); - int c = 0; - while (cur != end) { - const char tick = (*cur == message) ? '>' : ' '; - LOGD("%c %d: msg{.what=%08x, when=%lld}", - tick, c, (*cur)->what, (*cur)->when); - ++cur; - c++; +status_t MessageQueue::invalidate() { + if (android_atomic_or(1, &mWorkPending) == 0) { + mLooper->wake(); } + return NO_ERROR; } // --------------------------------------------------------------------------- diff --git a/services/surfaceflinger/MessageQueue.h b/services/surfaceflinger/MessageQueue.h index 890f809a3b..2317d81ab8 100644 --- a/services/surfaceflinger/MessageQueue.h +++ b/services/surfaceflinger/MessageQueue.h @@ -23,7 +23,7 @@ #include <utils/threads.h> #include <utils/Timers.h> -#include <utils/List.h> +#include <utils/Looper.h> #include "Barrier.h" @@ -31,92 +31,39 @@ namespace android { // --------------------------------------------------------------------------- -class MessageBase; - -class MessageList -{ - List< sp<MessageBase> > mList; - typedef List< sp<MessageBase> > LIST; -public: - inline LIST::iterator begin() { return mList.begin(); } - inline LIST::const_iterator begin() const { return mList.begin(); } - inline LIST::iterator end() { return mList.end(); } - inline LIST::const_iterator end() const { return mList.end(); } - inline bool isEmpty() const { return mList.empty(); } - void insert(const sp<MessageBase>& node); - void remove(LIST::iterator pos); -}; - -// ============================================================================ - -class MessageBase : - public LightRefBase<MessageBase> +class MessageBase : public MessageHandler { public: - nsecs_t when; - uint32_t what; - int32_t arg0; - - MessageBase() : when(0), what(0), arg0(0) { } - MessageBase(uint32_t what, int32_t arg0=0) - : when(0), what(what), arg0(arg0) { } + MessageBase(); // return true if message has a handler - virtual bool handler() { return false; } + virtual bool handler() = 0; // waits for the handler to be processed void wait() const { barrier.wait(); } - - // releases all waiters. this is done automatically if - // handler returns true - void notify() const { barrier.open(); } protected: - virtual ~MessageBase() { } + virtual ~MessageBase(); private: + virtual void handleMessage(const Message& message); + mutable Barrier barrier; - friend class LightRefBase<MessageBase>; }; -inline bool operator < (const MessageBase& lhs, const MessageBase& rhs) { - return lhs.when < rhs.when; -} - // --------------------------------------------------------------------------- -class MessageQueue -{ - typedef List< sp<MessageBase> > LIST; -public: +class MessageQueue { + sp<Looper> mLooper; + volatile int32_t mWorkPending; +public: MessageQueue(); ~MessageQueue(); - // pre-defined messages - enum { - INVALIDATE = '_upd' - }; - - sp<MessageBase> waitMessage(nsecs_t timeout = -1); - - status_t postMessage(const sp<MessageBase>& message, - nsecs_t reltime=0, uint32_t flags = 0); - + void waitMessage(); + status_t postMessage(const sp<MessageBase>& message, nsecs_t reltime=0); status_t invalidate(); - - void dump(const sp<MessageBase>& message); - -private: - status_t queueMessage(const sp<MessageBase>& message, - nsecs_t reltime, uint32_t flags); - void dumpLocked(const sp<MessageBase>& message); - - Mutex mLock; - Condition mCondition; - MessageList mMessages; - bool mInvalidate; - sp<MessageBase> mInvalidateMessage; }; // --------------------------------------------------------------------------- diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 24bd2a63ed..bbb30b0296 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -34,6 +34,8 @@ #include <binder/MemoryHeapBase.h> #include <binder/PermissionCache.h> +#include <gui/IDisplayEventConnection.h> + #include <utils/String8.h> #include <utils/String16.h> #include <utils/StopWatch.h> @@ -46,6 +48,8 @@ #include <GLES/gl.h> #include "clz.h" +#include "DisplayEventConnection.h" +#include "EventThread.h" #include "GLExtensions.h" #include "DdmConnection.h" #include "Layer.h" @@ -106,7 +110,7 @@ SurfaceFlinger::SurfaceFlinger() void SurfaceFlinger::init() { - LOGI("SurfaceFlinger is starting"); + ALOGI("SurfaceFlinger is starting"); // debugging stuff... char value[PROPERTY_VALUE_MAX]; @@ -123,9 +127,9 @@ void SurfaceFlinger::init() DdmConnection::start(getServiceName()); } - LOGI_IF(mDebugRegion, "showupdates enabled"); - LOGI_IF(mDebugBackground, "showbackground enabled"); - LOGI_IF(mDebugDDMS, "DDMS debugging enabled"); + ALOGI_IF(mDebugRegion, "showupdates enabled"); + ALOGI_IF(mDebugBackground, "showbackground enabled"); + ALOGI_IF(mDebugDDMS, "DDMS debugging enabled"); } SurfaceFlinger::~SurfaceFlinger() @@ -157,7 +161,7 @@ sp<IGraphicBufferAlloc> SurfaceFlinger::createGraphicBufferAlloc() const GraphicPlane& SurfaceFlinger::graphicPlane(int dpy) const { - LOGE_IF(uint32_t(dpy) >= DISPLAY_COUNT, "Invalid DisplayID %d", dpy); + ALOGE_IF(uint32_t(dpy) >= DISPLAY_COUNT, "Invalid DisplayID %d", dpy); const GraphicPlane& plane(mGraphicPlanes[dpy]); return plane; } @@ -172,7 +176,7 @@ void SurfaceFlinger::bootFinished() { const nsecs_t now = systemTime(); const nsecs_t duration = now - mBootTime; - LOGI("Boot is finished (%ld ms)", long(ns2ms(duration)) ); + ALOGI("Boot is finished (%ld ms)", long(ns2ms(duration)) ); mBootFinished = true; // wait patiently for the window manager death @@ -211,7 +215,7 @@ static inline uint16_t pack565(int r, int g, int b) { status_t SurfaceFlinger::readyToRun() { - LOGI( "SurfaceFlinger's main thread ready to run. " + ALOGI( "SurfaceFlinger's main thread ready to run. " "Initializing graphics H/W..."); // we only support one display currently @@ -227,10 +231,10 @@ status_t SurfaceFlinger::readyToRun() // create the shared control-block mServerHeap = new MemoryHeapBase(4096, MemoryHeapBase::READ_ONLY, "SurfaceFlinger read-only heap"); - LOGE_IF(mServerHeap==0, "can't create shared memory dealer"); + ALOGE_IF(mServerHeap==0, "can't create shared memory dealer"); mServerCblk = static_cast<surface_flinger_cblk_t*>(mServerHeap->getBase()); - LOGE_IF(mServerCblk==0, "can't get to shared control block's address"); + ALOGE_IF(mServerCblk==0, "can't get to shared control block's address"); new(mServerCblk) surface_flinger_cblk_t; @@ -295,12 +299,16 @@ status_t SurfaceFlinger::readyToRun() // put the origin in the left-bottom corner glOrthof(0, w, 0, h, 0, 1); // l=0, r=w ; b=0, t=h - mReadyToRunBarrier.open(); + + // start the EventThread + mEventThread = new EventThread(this); /* * We're now ready to accept clients... */ + mReadyToRunBarrier.open(); + // start boot animation property_set("ctl.start", "bootanim"); @@ -313,25 +321,30 @@ status_t SurfaceFlinger::readyToRun() #pragma mark Events Handler #endif -void SurfaceFlinger::waitForEvent() -{ - while (true) { - nsecs_t timeout = -1; - sp<MessageBase> msg = mEventQueue.waitMessage(timeout); - if (msg != 0) { - switch (msg->what) { - case MessageQueue::INVALIDATE: - // invalidate message, just return to the main loop - return; - } - } - } +void SurfaceFlinger::waitForEvent() { + mEventQueue.waitMessage(); } void SurfaceFlinger::signalEvent() { mEventQueue.invalidate(); } +status_t SurfaceFlinger::postMessageAsync(const sp<MessageBase>& msg, + nsecs_t reltime, uint32_t flags) { + return mEventQueue.postMessage(msg, reltime); +} + +status_t SurfaceFlinger::postMessageSync(const sp<MessageBase>& msg, + nsecs_t reltime, uint32_t flags) { + status_t res = mEventQueue.postMessage(msg, reltime); + if (res == NO_ERROR) { + msg->wait(); + } + return res; +} + +// ---------------------------------------------------------------------------- + bool SurfaceFlinger::authenticateSurfaceTexture( const sp<ISurfaceTexture>& surfaceTexture) const { Mutex::Autolock _l(mStateLock); @@ -373,20 +386,11 @@ bool SurfaceFlinger::authenticateSurfaceTexture( return false; } -status_t SurfaceFlinger::postMessageAsync(const sp<MessageBase>& msg, - nsecs_t reltime, uint32_t flags) -{ - return mEventQueue.postMessage(msg, reltime, flags); -} +// ---------------------------------------------------------------------------- -status_t SurfaceFlinger::postMessageSync(const sp<MessageBase>& msg, - nsecs_t reltime, uint32_t flags) -{ - status_t res = mEventQueue.postMessage(msg, reltime, flags); - if (res == NO_ERROR) { - msg->wait(); - } - return res; +sp<IDisplayEventConnection> SurfaceFlinger::createDisplayEventConnection() { + sp<DisplayEventConnection> result(new DisplayEventConnection(mEventThread)); + return result; } // ---------------------------------------------------------------------------- @@ -400,14 +404,14 @@ bool SurfaceFlinger::threadLoop() waitForEvent(); // check for transactions - if (UNLIKELY(mConsoleSignals)) { + if (CC_UNLIKELY(mConsoleSignals)) { handleConsoleEvents(); } // if we're in a global transaction, don't do anything. const uint32_t mask = eTransactionNeeded | eTraversalNeeded; uint32_t transactionFlags = peekTransactionFlags(mask); - if (UNLIKELY(transactionFlags)) { + if (CC_UNLIKELY(transactionFlags)) { handleTransaction(transactionFlags); } @@ -419,13 +423,13 @@ bool SurfaceFlinger::threadLoop() return true; } - if (UNLIKELY(mHwWorkListDirty)) { + if (CC_UNLIKELY(mHwWorkListDirty)) { // build the h/w work list handleWorkList(); } const DisplayHardware& hw(graphicPlane(0).displayHardware()); - if (LIKELY(hw.canDraw())) { + if (CC_LIKELY(hw.canDraw())) { // repaint the framebuffer (if needed) const int index = hw.getCurrentBufferIndex(); @@ -445,7 +449,7 @@ bool SurfaceFlinger::threadLoop() } else { // pretend we did the post hw.compositionComplete(); - usleep(16667); // 60 fps period + hw.waitForVSync(); } return true; } @@ -454,7 +458,7 @@ void SurfaceFlinger::postFramebuffer() { // this should never happen. we do the flip anyways so we don't // risk to cause a deadlock with hwc - LOGW_IF(mSwapRegion.isEmpty(), "mSwapRegion is empty"); + ALOGW_IF(mSwapRegion.isEmpty(), "mSwapRegion is empty"); const DisplayHardware& hw(graphicPlane(0).displayHardware()); const nsecs_t now = systemTime(); mDebugInSwapBuffers = now; @@ -625,7 +629,7 @@ void SurfaceFlinger::computeVisibleRegions( // handle hidden surfaces by setting the visible region to empty - if (LIKELY(!(s.flags & ISurfaceComposer::eLayerHidden) && s.alpha)) { + if (CC_LIKELY(!(s.flags & ISurfaceComposer::eLayerHidden) && s.alpha)) { const bool translucent = !layer->isOpaque(); const Rect bounds(layer->visibleBounds()); visibleRegion.set(bounds); @@ -810,7 +814,7 @@ void SurfaceFlinger::handleRepaint() // compute the invalid region mSwapRegion.orSelf(mDirtyRegion); - if (UNLIKELY(mDebugRegion)) { + if (CC_UNLIKELY(mDebugRegion)) { debugFlashRegions(); } @@ -870,7 +874,7 @@ void SurfaceFlinger::setupHardwareComposer(Region& dirtyInOut) const Vector< sp<LayerBase> >& layers(mVisibleLayersSortedByZ); size_t count = layers.size(); - LOGE_IF(hwc.getNumLayers() != count, + ALOGE_IF(hwc.getNumLayers() != count, "HAL number of layers (%d) doesn't match surfaceflinger (%d)", hwc.getNumLayers(), count); @@ -889,7 +893,7 @@ void SurfaceFlinger::setupHardwareComposer(Region& dirtyInOut) } const size_t fbLayerCount = hwc.getLayerCount(HWC_FRAMEBUFFER); status_t err = hwc.prepare(); - LOGE_IF(err, "HWComposer::prepare failed (%s)", strerror(-err)); + ALOGE_IF(err, "HWComposer::prepare failed (%s)", strerror(-err)); if (err == NO_ERROR) { // what's happening here is tricky. @@ -964,7 +968,7 @@ void SurfaceFlinger::composeSurfaces(const Region& dirty) HWComposer& hwc(hw.getHwComposer()); const size_t fbLayerCount = hwc.getLayerCount(HWC_FRAMEBUFFER); - if (UNLIKELY(fbLayerCount && !mWormholeRegion.isEmpty())) { + if (CC_UNLIKELY(fbLayerCount && !mWormholeRegion.isEmpty())) { // should never happen unless the window manager has a bug // draw something... drawWormhole(); @@ -1049,7 +1053,7 @@ void SurfaceFlinger::drawWormhole() const const int32_t width = hw.getWidth(); const int32_t height = hw.getHeight(); - if (LIKELY(!mDebugBackground)) { + if (CC_LIKELY(!mDebugBackground)) { glClearColor(0,0,0,0); Region::const_iterator it = region.begin(); Region::const_iterator const end = region.end(); @@ -1216,7 +1220,7 @@ void SurfaceFlinger::setTransactionState(const Vector<ComposerState>& state, mCurrentState.orientation = orientation; transactionFlags |= eTransactionNeeded; } else if (orientation != eOrientationUnchanged) { - LOGW("setTransactionState: ignoring unrecognized orientation: %d", + ALOGW("setTransactionState: ignoring unrecognized orientation: %d", orientation); } } @@ -1242,7 +1246,7 @@ void SurfaceFlinger::setTransactionState(const Vector<ComposerState>& state, if (CC_UNLIKELY(err != NO_ERROR)) { // just in case something goes wrong in SF, return to the // called after a few seconds. - LOGW_IF(err == TIMED_OUT, "closeGlobalTransaction timed out!"); + ALOGW_IF(err == TIMED_OUT, "closeGlobalTransaction timed out!"); mTransationPending = false; break; } @@ -1253,7 +1257,7 @@ void SurfaceFlinger::setTransactionState(const Vector<ComposerState>& state, int SurfaceFlinger::setOrientation(DisplayID dpy, int orientation, uint32_t flags) { - if (UNLIKELY(uint32_t(dpy) >= DISPLAY_COUNT)) + if (CC_UNLIKELY(uint32_t(dpy) >= DISPLAY_COUNT)) return BAD_VALUE; Mutex::Autolock _l(mStateLock); @@ -1281,12 +1285,12 @@ sp<ISurface> SurfaceFlinger::createSurface( sp<ISurface> surfaceHandle; if (int32_t(w|h) < 0) { - LOGE("createSurface() failed, w or h is negative (w=%d, h=%d)", + ALOGE("createSurface() failed, w or h is negative (w=%d, h=%d)", int(w), int(h)); return surfaceHandle; } - //LOGD("createSurface for pid %d (%d x %d)", pid, w, h); + //ALOGD("createSurface for pid %d (%d x %d)", pid, w, h); sp<Layer> normalLayer; switch (flags & eFXSurfaceMask) { case eFXSurfaceNormal: @@ -1352,8 +1356,8 @@ sp<Layer> SurfaceFlinger::createNormalSurface( sp<Layer> layer = new Layer(this, display, client); status_t err = layer->setBuffers(w, h, format, flags); - if (LIKELY(err != NO_ERROR)) { - LOGE("createNormalSurfaceLocked() failed (%s)", strerror(-err)); + if (CC_LIKELY(err != NO_ERROR)) { + ALOGE("createNormalSurfaceLocked() failed (%s)", strerror(-err)); layer.clear(); } return layer; @@ -1411,10 +1415,10 @@ status_t SurfaceFlinger::destroySurface(const wp<LayerBaseClient>& layer) // removed already, which means it is in the purgatory, // and need to be removed from there. ssize_t idx = mLayerPurgatory.remove(l); - LOGE_IF(idx < 0, + ALOGE_IF(idx < 0, "layer=%p is not in the purgatory list", l.get()); } - LOGE_IF(err<0 && err != NAME_NOT_FOUND, + ALOGE_IF(err<0 && err != NAME_NOT_FOUND, "error removing layer=%p (%s)", l.get(), strerror(-err)); } return err; @@ -1599,9 +1603,16 @@ status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args) } /* + * VSYNC state + */ + mEventThread->dump(result, buffer, SIZE); + + /* * Dump HWComposer state */ HWComposer& hwc(hw.getHwComposer()); + snprintf(buffer, SIZE, "h/w composer state:\n"); + result.append(buffer); snprintf(buffer, SIZE, " h/w composer %s and %s\n", hwc.initCheck()==NO_ERROR ? "present" : "not present", (mDebugDisableHWC || mDebugRegion) ? "disabled" : "enabled"); @@ -1640,7 +1651,7 @@ status_t SurfaceFlinger::onTransact( const int uid = ipc->getCallingUid(); if ((uid != AID_GRAPHICS) && !PermissionCache::checkPermission(sAccessSurfaceFlinger, pid, uid)) { - LOGE("Permission Denial: " + ALOGE("Permission Denial: " "can't access SurfaceFlinger pid=%d, uid=%d", pid, uid); return PERMISSION_DENIED; } @@ -1654,7 +1665,7 @@ status_t SurfaceFlinger::onTransact( const int uid = ipc->getCallingUid(); if ((uid != AID_GRAPHICS) && !PermissionCache::checkPermission(sReadFramebuffer, pid, uid)) { - LOGE("Permission Denial: " + ALOGE("Permission Denial: " "can't read framebuffer pid=%d, uid=%d", pid, uid); return PERMISSION_DENIED; } @@ -1665,11 +1676,11 @@ status_t SurfaceFlinger::onTransact( status_t err = BnSurfaceComposer::onTransact(code, data, reply, flags); if (err == UNKNOWN_TRANSACTION || err == PERMISSION_DENIED) { CHECK_INTERFACE(ISurfaceComposer, data, reply); - if (UNLIKELY(!PermissionCache::checkCallingPermission(sHardwareTest))) { + if (CC_UNLIKELY(!PermissionCache::checkCallingPermission(sHardwareTest))) { IPCThreadState* ipc = IPCThreadState::self(); const int pid = ipc->getCallingPid(); const int uid = ipc->getCallingUid(); - LOGE("Permission Denial: " + ALOGE("Permission Denial: " "can't access SurfaceFlinger pid=%d, uid=%d", pid, uid); return PERMISSION_DENIED; } @@ -2250,7 +2261,7 @@ status_t SurfaceFlinger::captureScreenImplLocked(DisplayID dpy, status_t result = PERMISSION_DENIED; // only one display supported for now - if (UNLIKELY(uint32_t(dpy) >= DISPLAY_COUNT)) + if (CC_UNLIKELY(uint32_t(dpy) >= DISPLAY_COUNT)) return BAD_VALUE; if (!GLExtensions::getInstance().haveFramebufferObject()) @@ -2268,7 +2279,7 @@ status_t SurfaceFlinger::captureScreenImplLocked(DisplayID dpy, sh = (!sh) ? hw_h : sh; const size_t size = sw * sh * 4; - //LOGD("screenshot: sw=%d, sh=%d, minZ=%d, maxZ=%d", + //ALOGD("screenshot: sw=%d, sh=%d, minZ=%d, maxZ=%d", // sw, sh, minLayerZ, maxLayerZ); // make sure to clear all GL error flags @@ -2359,7 +2370,7 @@ status_t SurfaceFlinger::captureScreenImplLocked(DisplayID dpy, hw.compositionComplete(); - // LOGD("screenshot: result = %s", result<0 ? strerror(result) : "OK"); + // ALOGD("screenshot: result = %s", result<0 ? strerror(result) : "OK"); return result; } @@ -2372,7 +2383,7 @@ status_t SurfaceFlinger::captureScreen(DisplayID dpy, uint32_t minLayerZ, uint32_t maxLayerZ) { // only one display supported for now - if (UNLIKELY(uint32_t(dpy) >= DISPLAY_COUNT)) + if (CC_UNLIKELY(uint32_t(dpy) >= DISPLAY_COUNT)) return BAD_VALUE; if (!GLExtensions::getInstance().haveFramebufferObject()) @@ -2486,7 +2497,7 @@ sp<LayerBaseClient> Client::getLayerUser(int32_t i) const wp<LayerBaseClient> layer(mLayers.valueFor(i)); if (layer != 0) { lbc = layer.promote(); - LOGE_IF(lbc==0, "getLayerUser(name=%d) is dead", int(i)); + ALOGE_IF(lbc==0, "getLayerUser(name=%d) is dead", int(i)); } return lbc; } @@ -2500,11 +2511,11 @@ status_t Client::onTransact( const int pid = ipc->getCallingPid(); const int uid = ipc->getCallingUid(); const int self_pid = getpid(); - if (UNLIKELY(pid != self_pid && uid != AID_GRAPHICS && uid != 0)) { + if (CC_UNLIKELY(pid != self_pid && uid != AID_GRAPHICS && uid != 0)) { // we're called from a different process, do the real check if (!PermissionCache::checkCallingPermission(sAccessSurfaceFlinger)) { - LOGE("Permission Denial: " + ALOGE("Permission Denial: " "can't openGlobalTransaction pid=%d, uid=%d", pid, uid); return PERMISSION_DENIED; } @@ -2576,7 +2587,7 @@ sp<GraphicBuffer> GraphicBufferAlloc::createGraphicBuffer(uint32_t w, uint32_t h if (err == NO_MEMORY) { GraphicBuffer::dumpAllocationsToSystemLog(); } - LOGE("GraphicBufferAlloc::createGraphicBuffer(w=%d, h=%d) " + ALOGE("GraphicBufferAlloc::createGraphicBuffer(w=%d, h=%d) " "failed (%s), handle=%p", w, h, strerror(-err), graphicBuffer->handle); return 0; diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index 17b80a6ed2..ffd3ac9658 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -20,6 +20,8 @@ #include <stdint.h> #include <sys/types.h> +#include <cutils/compiler.h> + #include <utils/Atomic.h> #include <utils/Errors.h> #include <utils/KeyedVector.h> @@ -46,14 +48,13 @@ namespace android { class Client; class DisplayHardware; +class DisplayEventConnection; +class EventThread; class Layer; class LayerDim; class LayerScreenshot; struct surface_flinger_cblk_t; -#define LIKELY( exp ) (__builtin_expect( (exp) != 0, true )) -#define UNLIKELY( exp ) (__builtin_expect( (exp) != 0, false )) - // --------------------------------------------------------------------------- class Client : public BnSurfaceComposerClient @@ -171,6 +172,7 @@ public: int orientation, uint32_t flags); virtual int setOrientation(DisplayID dpy, int orientation, uint32_t flags); virtual bool authenticateSurfaceTexture(const sp<ISurfaceTexture>& surface) const; + virtual sp<IDisplayEventConnection> createDisplayEventConnection(); virtual status_t captureScreen(DisplayID dpy, sp<IMemoryHeap>* heap, @@ -222,6 +224,7 @@ private: private: friend class Client; + friend class DisplayEventConnection; friend class LayerBase; friend class LayerBaseClient; friend class Layer; @@ -362,6 +365,7 @@ private: GLuint mWormholeTexName; GLuint mProtectedTexName; nsecs_t mBootTime; + sp<EventThread> mEventThread; // Can only accessed from the main thread, these members // don't need synchronization diff --git a/services/surfaceflinger/SurfaceTextureLayer.cpp b/services/surfaceflinger/SurfaceTextureLayer.cpp index 5020e0007a..259b93766a 100644 --- a/services/surfaceflinger/SurfaceTextureLayer.cpp +++ b/services/surfaceflinger/SurfaceTextureLayer.cpp @@ -37,7 +37,7 @@ SurfaceTextureLayer::~SurfaceTextureLayer() { status_t SurfaceTextureLayer::setDefaultBufferSize(uint32_t w, uint32_t h) { - //LOGD("%s, w=%u, h=%u", __PRETTY_FUNCTION__, w, h); + //ALOGD("%s, w=%u, h=%u", __PRETTY_FUNCTION__, w, h); return SurfaceTexture::setDefaultBufferSize(w, h); } @@ -73,7 +73,7 @@ status_t SurfaceTextureLayer::dequeueBuffer(int *buf, if (format == 0) format = mDefaultFormat; uint32_t effectiveUsage = layer->getEffectiveUsage(usage); - //LOGD("%s, w=%u, h=%u, format=%u, usage=%08x, effectiveUsage=%08x", + //ALOGD("%s, w=%u, h=%u, format=%u, usage=%08x, effectiveUsage=%08x", // __PRETTY_FUNCTION__, w, h, format, usage, effectiveUsage); res = SurfaceTexture::dequeueBuffer(buf, w, h, format, effectiveUsage); } diff --git a/services/surfaceflinger/Transform.cpp b/services/surfaceflinger/Transform.cpp index ba345ce45b..ca3fa6eefc 100644 --- a/services/surfaceflinger/Transform.cpp +++ b/services/surfaceflinger/Transform.cpp @@ -344,10 +344,10 @@ void Transform::dump(const char* name) const if (mType&TRANSLATE) type.append("TRANSLATE "); - LOGD("%s 0x%08x (%s, %s)", name, mType, flags.string(), type.string()); - LOGD("%.4f %.4f %.4f", m[0][0], m[1][0], m[2][0]); - LOGD("%.4f %.4f %.4f", m[0][1], m[1][1], m[2][1]); - LOGD("%.4f %.4f %.4f", m[0][2], m[1][2], m[2][2]); + ALOGD("%s 0x%08x (%s, %s)", name, mType, flags.string(), type.string()); + ALOGD("%.4f %.4f %.4f", m[0][0], m[1][0], m[2][0]); + ALOGD("%.4f %.4f %.4f", m[0][1], m[1][1], m[2][1]); + ALOGD("%.4f %.4f %.4f", m[0][2], m[1][2], m[2][2]); } // --------------------------------------------------------------------------- diff --git a/services/surfaceflinger/tests/Transaction_test.cpp b/services/surfaceflinger/tests/Transaction_test.cpp index afafd8ac35..396a3fdf2b 100644 --- a/services/surfaceflinger/tests/Transaction_test.cpp +++ b/services/surfaceflinger/tests/Transaction_test.cpp @@ -204,11 +204,11 @@ TEST_F(LayerUpdateTest, LayerResizeWorks) { sc->checkPixel(145, 145, 63, 63, 195); } - LOGD("resizing"); + ALOGD("resizing"); SurfaceComposerClient::openGlobalTransaction(); ASSERT_EQ(NO_ERROR, mFGSurfaceControl->setSize(128, 128)); SurfaceComposerClient::closeGlobalTransaction(true); - LOGD("resized"); + ALOGD("resized"); { // This should not reflect the new size or color because SurfaceFlinger // has not yet received a buffer of the correct size. @@ -219,10 +219,10 @@ TEST_F(LayerUpdateTest, LayerResizeWorks) { sc->checkPixel(145, 145, 63, 63, 195); } - LOGD("drawing"); + ALOGD("drawing"); fillSurfaceRGBA8(mFGSurfaceControl, 63, 195, 63); waitForPostedBuffers(); - LOGD("drawn"); + ALOGD("drawn"); { // This should reflect the new size and the new color. SCOPED_TRACE("after redraw"); diff --git a/services/surfaceflinger/tests/vsync/Android.mk b/services/surfaceflinger/tests/vsync/Android.mk new file mode 100644 index 0000000000..9181760453 --- /dev/null +++ b/services/surfaceflinger/tests/vsync/Android.mk @@ -0,0 +1,18 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_SRC_FILES:= \ + vsync.cpp + +LOCAL_SHARED_LIBRARIES := \ + libcutils \ + libutils \ + libbinder \ + libui \ + libgui + +LOCAL_MODULE:= test-vsync-events + +LOCAL_MODULE_TAGS := tests + +include $(BUILD_EXECUTABLE) diff --git a/services/surfaceflinger/tests/vsync/vsync.cpp b/services/surfaceflinger/tests/vsync/vsync.cpp new file mode 100644 index 0000000000..4f79080253 --- /dev/null +++ b/services/surfaceflinger/tests/vsync/vsync.cpp @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#include <gui/DisplayEventReceiver.h> +#include <utils/Looper.h> + +using namespace android; + +int receiver(int fd, int events, void* data) +{ + DisplayEventReceiver* q = (DisplayEventReceiver*)data; + + ssize_t n; + DisplayEventReceiver::Event buffer[1]; + + static nsecs_t oldTimeStamp = 0; + + while ((n = q->getEvents(buffer, 1)) > 0) { + for (int i=0 ; i<n ; i++) { + if (buffer[i].header.type == DisplayEventReceiver::DISPLAY_EVENT_VSYNC) { + printf("event vsync: count=%d\t", buffer[i].vsync.count); + } + if (oldTimeStamp) { + float t = float(buffer[i].header.timestamp - oldTimeStamp) / s2ns(1); + printf("%f ms (%f Hz)\n", t*1000, 1.0/t); + } + oldTimeStamp = buffer[i].header.timestamp; + } + } + if (n<0) { + printf("error reading events (%s)\n", strerror(-n)); + } + return 1; +} + +int main(int argc, char** argv) +{ + DisplayEventReceiver myDisplayEvent; + + + sp<Looper> loop = new Looper(false); + loop->addFd(myDisplayEvent.getFd(), 0, ALOOPER_EVENT_INPUT, receiver, + &myDisplayEvent); + + do { + //printf("about to poll...\n"); + int32_t ret = loop->pollOnce(-1); + switch (ret) { + case ALOOPER_POLL_WAKE: + //("ALOOPER_POLL_WAKE\n"); + break; + case ALOOPER_POLL_CALLBACK: + //("ALOOPER_POLL_CALLBACK\n"); + break; + case ALOOPER_POLL_TIMEOUT: + printf("ALOOPER_POLL_TIMEOUT\n"); + break; + case ALOOPER_POLL_ERROR: + printf("ALOOPER_POLL_TIMEOUT\n"); + break; + default: + printf("ugh? poll returned %d\n", ret); + break; + } + } while (1); + + return 0; +} diff --git a/services/surfaceflinger/tests/waitforvsync/Android.mk b/services/surfaceflinger/tests/waitforvsync/Android.mk new file mode 100644 index 0000000000..c25f5ab083 --- /dev/null +++ b/services/surfaceflinger/tests/waitforvsync/Android.mk @@ -0,0 +1,14 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_SRC_FILES:= \ + waitforvsync.cpp + +LOCAL_SHARED_LIBRARIES := \ + libcutils \ + +LOCAL_MODULE:= test-waitforvsync + +LOCAL_MODULE_TAGS := tests + +include $(BUILD_EXECUTABLE) diff --git a/services/surfaceflinger/tests/waitforvsync/waitforvsync.cpp b/services/surfaceflinger/tests/waitforvsync/waitforvsync.cpp new file mode 100644 index 0000000000..279b88b059 --- /dev/null +++ b/services/surfaceflinger/tests/waitforvsync/waitforvsync.cpp @@ -0,0 +1,45 @@ +/* + * 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. + */ + +#include <stdint.h> +#include <sys/types.h> + +#include <fcntl.h> +#include <sys/ioctl.h> +#include <linux/fb.h> +#include <errno.h> +#include <string.h> +#include <stdio.h> + +#ifndef FBIO_WAITFORVSYNC +#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) +#endif + +int main(int argc, char** argv) { + int fd = open("/dev/graphics/fb0", O_RDWR); + if (fd >= 0) { + do { + uint32_t crt = 0; + int err = ioctl(fd, FBIO_WAITFORVSYNC, &crt); + if (err < 0) { + printf("FBIO_WAITFORVSYNC error: %s\n", strerror(errno)); + break; + } + } while(1); + close(fd); + } + return 0; +} |