diff options
Diffstat (limited to 'indra/llimage')
| -rw-r--r-- | indra/llimage/llimageworker.cpp | 31 | ||||
| -rw-r--r-- | indra/llimage/llimageworker.h | 4 | 
2 files changed, 21 insertions, 14 deletions
| diff --git a/indra/llimage/llimageworker.cpp b/indra/llimage/llimageworker.cpp index c1ee052997..fd59daad3d 100644 --- a/indra/llimage/llimageworker.cpp +++ b/indra/llimage/llimageworker.cpp @@ -35,8 +35,10 @@ class ImageRequest  {  public:  	ImageRequest(const LLPointer<LLImageFormatted>& image, -				 S32 discard, BOOL needs_aux, -				 const LLPointer<LLImageDecodeThread::Responder>& responder); +                 S32 discard, +                 BOOL needs_aux, +                 const LLPointer<LLImageDecodeThread::Responder>& responder, +                 U32 request_id);  	virtual ~ImageRequest();  	/*virtual*/ bool processRequest(); @@ -48,6 +50,7 @@ private:  	// input  	LLPointer<LLImageFormatted> mFormattedImage;  	S32 mDiscardLevel; +    U32 mRequestId;  	BOOL mNeedsAux;  	// output  	LLPointer<LLImageRaw> mDecodedImageRaw; @@ -62,6 +65,7 @@ private:  // MAIN THREAD  LLImageDecodeThread::LLImageDecodeThread(bool /*threaded*/) +    : mDecodeCount(0)  {      mThreadPool.reset(new LL::ThreadPool("ImageDecode", 8));      mThreadPool->start(); @@ -92,9 +96,10 @@ LLImageDecodeThread::handle_t LLImageDecodeThread::decodeImage(  {      LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; +    U32 decode_id = ++mDecodeCount;      // Instantiate the ImageRequest right in the lambda, why not?      bool posted = mThreadPool->getQueue().post( -        [req = ImageRequest(image, discard, needs_aux, responder)] +        [req = ImageRequest(image, discard, needs_aux, responder, decode_id)]          () mutable          {              auto done = req.processRequest(); @@ -103,13 +108,10 @@ LLImageDecodeThread::handle_t LLImageDecodeThread::decodeImage(      if (! posted)      {          LL_DEBUGS() << "Tried to start decoding on shutdown" << LL_ENDL; -        // should this return 0? +        return 0;      } -    // It's important to our consumer (LLTextureFetchWorker) that we return a -    // nonzero handle. It is NOT important that the nonzero handle be unique: -    // nothing is ever done with it except to compare it to zero, or zero it. -    return 17; +    return decode_id;  }  void LLImageDecodeThread::shutdown() @@ -123,15 +125,18 @@ LLImageDecodeThread::Responder::~Responder()  //---------------------------------------------------------------------------- -ImageRequest::ImageRequest(const LLPointer<LLImageFormatted>& image,  -							S32 discard, BOOL needs_aux, -							const LLPointer<LLImageDecodeThread::Responder>& responder) +ImageRequest::ImageRequest(const LLPointer<LLImageFormatted>& image, +                           S32 discard, +                           BOOL needs_aux, +                           const LLPointer<LLImageDecodeThread::Responder>& responder, +                           U32 request_id)  	: mFormattedImage(image),  	  mDiscardLevel(discard),  	  mNeedsAux(needs_aux),  	  mDecodedRaw(FALSE),  	  mDecodedAux(FALSE), -	  mResponder(responder) +	  mResponder(responder), +	  mRequestId(request_id)  {  } @@ -199,7 +204,7 @@ void ImageRequest::finishRequest(bool completed)  	if (mResponder.notNull())  	{  		bool success = completed && mDecodedRaw && (!mNeedsAux || mDecodedAux); -		mResponder->completed(success, mDecodedImageRaw, mDecodedImageAux); +		mResponder->completed(success, mDecodedImageRaw, mDecodedImageAux, mRequestId);  	}  	// Will automatically be deleted  } diff --git a/indra/llimage/llimageworker.h b/indra/llimage/llimageworker.h index ca4c0d93d0..b4ab9432e6 100644 --- a/indra/llimage/llimageworker.h +++ b/indra/llimage/llimageworker.h @@ -39,7 +39,7 @@ public:  	protected:  		virtual ~Responder();  	public: -		virtual void completed(bool success, LLImageRaw* raw, LLImageRaw* aux) = 0; +		virtual void completed(bool success, LLImageRaw* raw, LLImageRaw* aux, U32 request_id) = 0;  	};  public: @@ -53,6 +53,7 @@ public:  						 const LLPointer<Responder>& responder);  	size_t getPending();  	size_t update(F32 max_time_ms); +    S32 getTotalDecodeCount() { return mDecodeCount; }  	void shutdown();  private: @@ -60,6 +61,7 @@ private:  	// LLQueuedThread - instead this is the API by which we submit work to the  	// "ImageDecode" ThreadPool.  	std::unique_ptr<LL::ThreadPool> mThreadPool; +    LLAtomicU32 mDecodeCount;  };  #endif | 
