Merge "add set thread count"
diff --git a/include/gui/SurfaceTexture.h b/include/gui/SurfaceTexture.h
index 1a0d779..3699cdf 100644
--- a/include/gui/SurfaceTexture.h
+++ b/include/gui/SurfaceTexture.h
@@ -257,6 +257,12 @@
     // before the outstanding accesses have completed.
     status_t syncForReleaseLocked(EGLDisplay dpy);
 
+    // The default consumer usage flags that SurfaceTexture always sets on its
+    // BufferQueue instance; these will be OR:d with any additional flags passed
+    // from the SurfaceTexture user. In particular, SurfaceTexture will always
+    // consume buffers as hardware textures.
+    static const uint32_t DEFAULT_USAGE_FLAGS = GraphicBuffer::USAGE_HW_TEXTURE;
+
     // mCurrentTextureBuf is the graphic buffer of the current texture. It's
     // possible that this buffer is not associated with any buffer slot, so we
     // must track it separately in order to support the getCurrentBuffer method.
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp
index ece0494..a6403d4 100644
--- a/libs/gui/BufferQueue.cpp
+++ b/libs/gui/BufferQueue.cpp
@@ -450,7 +450,6 @@
             (uint32_t(buffer->format) != format) ||
             ((uint32_t(buffer->usage) & usage) != usage))
         {
-            usage |= GraphicBuffer::USAGE_HW_TEXTURE;
             status_t error;
             sp<GraphicBuffer> graphicBuffer(
                     mGraphicBufferAlloc->createGraphicBuffer(
@@ -534,8 +533,12 @@
     ATRACE_CALL();
     ATRACE_BUFFER_INDEX(buf);
 
-    ST_LOGV("queueBuffer: slot=%d time=%lld crop=[%d,%d,%d,%d]", buf, timestamp,
-        crop.left, crop.top, crop.right, crop.bottom);
+    ST_LOGV("queueBuffer: slot=%d time=%lld crop=[%d,%d,%d,%d]", buf,
+            mSlots[buf].mTimestamp,
+            mSlots[buf].mCrop.left,
+            mSlots[buf].mCrop.top,
+            mSlots[buf].mCrop.right,
+            mSlots[buf].mCrop.bottom);
 
     sp<ConsumerListener> listener;
 
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp
index a6ee971..a6e8dbf 100644
--- a/libs/gui/SurfaceTexture.cpp
+++ b/libs/gui/SurfaceTexture.cpp
@@ -150,6 +150,7 @@
                 strerror(-err), err);
     } else {
         mBufferQueue->setConsumerName(mName);
+        mBufferQueue->setConsumerUsageBits(DEFAULT_USAGE_FLAGS);
     }
 }
 
@@ -720,6 +721,7 @@
 
 status_t SurfaceTexture::setConsumerUsageBits(uint32_t usage) {
     Mutex::Autolock lock(mMutex);
+    usage |= DEFAULT_USAGE_FLAGS;
     return mBufferQueue->setConsumerUsageBits(usage);
 }