@@ -116,7 +116,7 @@ SurfaceTexture::SurfaceTexture(GLuint tex, bool allowSynchronousMode,
116116 // Choose a name using the PID and a process-unique ID.
117117 mName = String8::format (" unnamed-%d-%d" , getpid (), createProcessUniqueId ());
118118
119- ST_LOGV (" SurfaceTexture::SurfaceTexture " );
119+ ST_LOGV (" SurfaceTexture" );
120120 sp<ISurfaceComposer> composer (ComposerService::getComposerService ());
121121 mGraphicBufferAlloc = composer->createGraphicBufferAlloc ();
122122 mNextCrop .makeInvalid ();
@@ -125,7 +125,7 @@ SurfaceTexture::SurfaceTexture(GLuint tex, bool allowSynchronousMode,
125125}
126126
127127SurfaceTexture::~SurfaceTexture () {
128- ST_LOGV (" SurfaceTexture:: ~SurfaceTexture" );
128+ ST_LOGV (" ~SurfaceTexture" );
129129 freeAllBuffersLocked ();
130130}
131131
@@ -169,7 +169,7 @@ status_t SurfaceTexture::setBufferCountServer(int bufferCount) {
169169}
170170
171171status_t SurfaceTexture::setBufferCount (int bufferCount) {
172- ST_LOGV (" SurfaceTexture:: setBufferCount" );
172+ ST_LOGV (" setBufferCount: count=%d " , bufferCount );
173173 Mutex::Autolock lock (mMutex );
174174
175175 if (mAbandoned ) {
@@ -217,6 +217,7 @@ status_t SurfaceTexture::setBufferCount(int bufferCount) {
217217
218218status_t SurfaceTexture::setDefaultBufferSize (uint32_t w, uint32_t h)
219219{
220+ ST_LOGV (" setDefaultBufferSize: w=%d, h=%d" , w, h);
220221 if (!w || !h) {
221222 ST_LOGE (" setDefaultBufferSize: dimensions cannot be 0 (w=%d, h=%d)" ,
222223 w, h);
@@ -230,7 +231,7 @@ status_t SurfaceTexture::setDefaultBufferSize(uint32_t w, uint32_t h)
230231}
231232
232233status_t SurfaceTexture::requestBuffer (int slot, sp<GraphicBuffer>* buf) {
233- ST_LOGV (" SurfaceTexture:: requestBuffer" );
234+ ST_LOGV (" requestBuffer: slot=%d " , slot );
234235 Mutex::Autolock lock (mMutex );
235236 if (mAbandoned ) {
236237 ST_LOGE (" requestBuffer: SurfaceTexture has been abandoned!" );
@@ -248,7 +249,7 @@ status_t SurfaceTexture::requestBuffer(int slot, sp<GraphicBuffer>* buf) {
248249
249250status_t SurfaceTexture::dequeueBuffer (int *outBuf, uint32_t w, uint32_t h,
250251 uint32_t format, uint32_t usage) {
251- ST_LOGV (" SurfaceTexture:: dequeueBuffer" );
252+ ST_LOGV (" dequeueBuffer: w=%d h=%d fmt=%#x usage=%#x " , w, h, format, usage );
252253
253254 if ((w && !h) || (!w && h)) {
254255 ST_LOGE (" dequeueBuffer: invalid size: w=%u, h=%u" , w, h);
@@ -342,6 +343,8 @@ status_t SurfaceTexture::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h,
342343 // clients are not allowed to dequeue more than one buffer
343344 // if they didn't set a buffer count.
344345 if (!mClientBufferCount && dequeuedCount) {
346+ ST_LOGE (" dequeueBuffer: can't dequeue multiple buffers without "
347+ " setting the buffer count" );
345348 return -EINVAL;
346349 }
347350
@@ -375,6 +378,8 @@ status_t SurfaceTexture::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h,
375378 }
376379
377380 if (found == INVALID_BUFFER_SLOT) {
381+ // This should not happen.
382+ ST_LOGE (" dequeueBuffer: no available buffer slots" );
378383 return -EBUSY;
379384 }
380385
@@ -427,10 +432,13 @@ status_t SurfaceTexture::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h,
427432 }
428433 returnFlags |= ISurfaceTexture::BUFFER_NEEDS_REALLOCATION;
429434 }
435+ ST_LOGV (" dequeueBuffer: returning slot=%d buf=%p flags=%#x" , buf,
436+ mSlots [buf].mGraphicBuffer ->handle , returnFlags);
430437 return returnFlags;
431438}
432439
433440status_t SurfaceTexture::setSynchronousMode (bool enabled) {
441+ ST_LOGV (" setSynchronousMode: enabled=%d" , enabled);
434442 Mutex::Autolock lock (mMutex );
435443
436444 if (mAbandoned ) {
@@ -462,7 +470,7 @@ status_t SurfaceTexture::setSynchronousMode(bool enabled) {
462470
463471status_t SurfaceTexture::queueBuffer (int buf, int64_t timestamp,
464472 uint32_t * outWidth, uint32_t * outHeight, uint32_t * outTransform) {
465- ST_LOGV (" SurfaceTexture:: queueBuffer" );
473+ ST_LOGV (" queueBuffer: slot=%d time=%lld " , buf, timestamp );
466474
467475 sp<FrameAvailableListener> listener;
468476
@@ -534,7 +542,7 @@ status_t SurfaceTexture::queueBuffer(int buf, int64_t timestamp,
534542}
535543
536544void SurfaceTexture::cancelBuffer (int buf) {
537- ST_LOGV (" SurfaceTexture:: cancelBuffer" );
545+ ST_LOGV (" cancelBuffer: slot=%d " , buf );
538546 Mutex::Autolock lock (mMutex );
539547
540548 if (mAbandoned ) {
@@ -556,7 +564,9 @@ void SurfaceTexture::cancelBuffer(int buf) {
556564}
557565
558566status_t SurfaceTexture::setCrop (const Rect& crop) {
559- ST_LOGV (" SurfaceTexture::setCrop" );
567+ ST_LOGV (" setCrop: crop=[%d,%d,%d,%d]" , crop.left , crop.top , crop.right ,
568+ crop.bottom );
569+
560570 Mutex::Autolock lock (mMutex );
561571 if (mAbandoned ) {
562572 ST_LOGE (" setCrop: SurfaceTexture has been abandoned!" );
@@ -567,7 +577,7 @@ status_t SurfaceTexture::setCrop(const Rect& crop) {
567577}
568578
569579status_t SurfaceTexture::setTransform (uint32_t transform) {
570- ST_LOGV (" SurfaceTexture:: setTransform" );
580+ ST_LOGV (" setTransform: xform=%#x " , transform );
571581 Mutex::Autolock lock (mMutex );
572582 if (mAbandoned ) {
573583 ST_LOGE (" setTransform: SurfaceTexture has been abandoned!" );
@@ -579,7 +589,7 @@ status_t SurfaceTexture::setTransform(uint32_t transform) {
579589
580590status_t SurfaceTexture::connect (int api,
581591 uint32_t * outWidth, uint32_t * outHeight, uint32_t * outTransform) {
582- ST_LOGV (" SurfaceTexture:: connect(this=%p, %d) " , this , api);
592+ ST_LOGV (" connect: api=%d " , api);
583593 Mutex::Autolock lock (mMutex );
584594
585595 if (mAbandoned ) {
@@ -612,7 +622,7 @@ status_t SurfaceTexture::connect(int api,
612622}
613623
614624status_t SurfaceTexture::disconnect (int api) {
615- ST_LOGV (" SurfaceTexture:: disconnect(this=%p, %d) " , this , api);
625+ ST_LOGV (" disconnect: api=%d " , api);
616626 Mutex::Autolock lock (mMutex );
617627
618628 if (mAbandoned ) {
@@ -640,20 +650,22 @@ status_t SurfaceTexture::disconnect(int api) {
640650 }
641651 break ;
642652 default :
653+ ST_LOGE (" disconnect: unknown API %d" , api);
643654 err = -EINVAL;
644655 break ;
645656 }
646657 return err;
647658}
648659
649660status_t SurfaceTexture::setScalingMode (int mode) {
650- ST_LOGV (" SurfaceTexture:: setScalingMode(%d) " , mode);
661+ ST_LOGV (" setScalingMode: mode=%d " , mode);
651662
652663 switch (mode) {
653664 case NATIVE_WINDOW_SCALING_MODE_FREEZE:
654665 case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW:
655666 break ;
656667 default :
668+ ST_LOGE (" unknown scaling mode: %d" , mode);
657669 return BAD_VALUE;
658670 }
659671
@@ -663,7 +675,7 @@ status_t SurfaceTexture::setScalingMode(int mode) {
663675}
664676
665677status_t SurfaceTexture::updateTexImage () {
666- ST_LOGV (" SurfaceTexture:: updateTexImage" );
678+ ST_LOGV (" updateTexImage" );
667679 Mutex::Autolock lock (mMutex );
668680
669681 if (mAbandoned ) {
@@ -713,6 +725,10 @@ status_t SurfaceTexture::updateTexImage() {
713725 return -EINVAL;
714726 }
715727
728+ ST_LOGV (" updateTexImage: (slot=%d buf=%p) -> (slot=%d buf=%p)" , mCurrentTexture ,
729+ mCurrentTextureBuf != NULL ? mCurrentTextureBuf ->handle : 0 , buf,
730+ mSlots [buf].mGraphicBuffer ->handle );
731+
716732 if (mCurrentTexture != INVALID_BUFFER_SLOT) {
717733 // The current buffer becomes FREE if it was still in the queued
718734 // state. If it has already been given to the client
@@ -771,7 +787,7 @@ void SurfaceTexture::getTransformMatrix(float mtx[16]) {
771787}
772788
773789void SurfaceTexture::computeCurrentTransformMatrix () {
774- ST_LOGV (" SurfaceTexture:: computeCurrentTransformMatrix" );
790+ ST_LOGV (" computeCurrentTransformMatrix" );
775791
776792 float xform[16 ];
777793 for (int i = 0 ; i < 16 ; i++) {
@@ -862,14 +878,14 @@ void SurfaceTexture::computeCurrentTransformMatrix() {
862878}
863879
864880nsecs_t SurfaceTexture::getTimestamp () {
865- ST_LOGV (" SurfaceTexture:: getTimestamp" );
881+ ST_LOGV (" getTimestamp" );
866882 Mutex::Autolock lock (mMutex );
867883 return mCurrentTimestamp ;
868884}
869885
870886void SurfaceTexture::setFrameAvailableListener (
871887 const sp<FrameAvailableListener>& listener) {
872- ST_LOGV (" SurfaceTexture:: setFrameAvailableListener" );
888+ ST_LOGV (" setFrameAvailableListener" );
873889 Mutex::Autolock lock (mMutex );
874890 mFrameAvailableListener = listener;
875891}
0 commit comments