summaryrefslogtreecommitdiffstats
path: root/libs/gui
diff options
context:
space:
mode:
Diffstat (limited to 'libs/gui')
-rw-r--r--libs/gui/Android.mk4
-rw-r--r--libs/gui/BitTube.cpp (renamed from libs/gui/SensorChannel.cpp)61
-rw-r--r--libs/gui/DisplayEventReceiver.cpp83
-rw-r--r--libs/gui/IDisplayEventConnection.cpp73
-rw-r--r--libs/gui/ISensorEventConnection.cpp8
-rw-r--r--libs/gui/ISurfaceComposer.cpp32
-rw-r--r--libs/gui/SensorEventQueue.cpp4
-rw-r--r--libs/gui/SurfaceComposerClient.cpp1
-rw-r--r--libs/gui/SurfaceTexture.cpp4
-rw-r--r--libs/gui/SurfaceTextureClient.cpp36
-rw-r--r--libs/gui/tests/SurfaceTexture_test.cpp36
-rw-r--r--libs/gui/tests/Surface_test.cpp2
12 files changed, 284 insertions, 60 deletions
diff --git a/libs/gui/Android.mk b/libs/gui/Android.mk
index 9767568..b8be67d 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 147e1c2..fa8d0ea 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;
+ LOGE("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;
+ LOGE("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 0000000..3b29a11
--- /dev/null
+++ b/libs/gui/DisplayEventReceiver.cpp
@@ -0,0 +1,83 @@
+/*
+ * 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();
+}
+
+ssize_t DisplayEventReceiver::getEvents(DisplayEventReceiver::Event* events,
+ size_t count) {
+ ssize_t size = mDataChannel->read(events, sizeof(events[0])*count);
+ LOGE_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 0000000..44127fb
--- /dev/null
+++ b/libs/gui/IDisplayEventConnection.cpp
@@ -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.
+ */
+
+#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,
+};
+
+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);
+ }
+};
+
+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;
+ }
+ return BBinder::onTransact(code, data, reply, flags);
+}
+
+// ----------------------------------------------------------------------------
+}; // namespace android
diff --git a/libs/gui/ISensorEventConnection.cpp b/libs/gui/ISensorEventConnection.cpp
index a5083fe..0e51e8e 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 86bc62a..db32827 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>
@@ -44,6 +47,8 @@
namespace android {
+class IDisplayEventConnection;
+
class BpSurfaceComposer : public BpInterface<ISurfaceComposer>
{
public:
@@ -174,6 +179,27 @@ public:
}
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) {
+ LOGE("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 +280,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/SensorEventQueue.cpp b/libs/gui/SensorEventQueue.cpp
index f935524..ee21c45 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>
@@ -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);
+ LOGE("SensorEventQueue::waitForEvent error (errno=%d)", errno);
result = -EPIPE; // unknown error, so we make up one
break;
}
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 4ad6c22..699438c 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 fcd287c..6f3051a 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,7 +62,7 @@
#endif
// Macros for including the SurfaceTexture name in log messages
-#define ST_LOGV(x, ...) LOGV("[%s] "x, mName.string(), ##__VA_ARGS__)
+#define ST_LOGV(x, ...) ALOGV("[%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__)
diff --git a/libs/gui/SurfaceTextureClient.cpp b/libs/gui/SurfaceTextureClient.cpp
index 48070d6..691b52d 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;
@@ -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) {
@@ -205,18 +207,18 @@ int SurfaceTextureClient::getSlotFromBufferLocked(
}
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;
@@ -234,7 +236,7 @@ int SurfaceTextureClient::queueBuffer(android_native_buffer_t* buffer) {
}
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;
@@ -457,7 +459,7 @@ int SurfaceTextureClient::setCrop(Rect const* rect)
int SurfaceTextureClient::setBufferCount(int bufferCount)
{
- LOGV("SurfaceTextureClient::setBufferCount");
+ ALOGV("SurfaceTextureClient::setBufferCount");
Mutex::Autolock lock(mMutex);
status_t err = mSurfaceTexture->setBufferCount(bufferCount);
@@ -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)
@@ -493,7 +495,7 @@ int SurfaceTextureClient::setBuffersDimensions(int w, int h)
int SurfaceTextureClient::setBuffersFormat(int format)
{
- LOGV("SurfaceTextureClient::setBuffersFormat");
+ ALOGV("SurfaceTextureClient::setBuffersFormat");
Mutex::Autolock lock(mMutex);
if (format<0)
@@ -506,7 +508,7 @@ 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);
@@ -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;
diff --git a/libs/gui/tests/SurfaceTexture_test.cpp b/libs/gui/tests/SurfaceTexture_test.cpp
index c313904..b18e7b0 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 693b7b8..ea52750 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 {