Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
ba7995fc
Commit
ba7995fc
authored
14 years ago
by
Xiaohong Bao
Browse files
Options
Downloads
Patches
Plain Diff
Automated merge with
ssh://hg.lindenlab.com/q/viewer-release
parent
0b09d660
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/newview/lltexturefetch.cpp
+34
-95
34 additions, 95 deletions
indra/newview/lltexturefetch.cpp
indra/newview/lltexturefetch.h
+2
-12
2 additions, 12 deletions
indra/newview/lltexturefetch.h
with
36 additions
and
107 deletions
indra/newview/lltexturefetch.cpp
+
34
−
95
View file @
ba7995fc
...
@@ -54,6 +54,7 @@
...
@@ -54,6 +54,7 @@
#include
"llviewertexturelist.h"
#include
"llviewertexturelist.h"
#include
"llviewertexture.h"
#include
"llviewertexture.h"
#include
"llviewerregion.h"
#include
"llviewerregion.h"
#include
"llviewerstats.h"
#include
"llworld.h"
#include
"llworld.h"
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
...
@@ -150,7 +151,7 @@ class LLTextureFetchWorker : public LLWorkerClass
...
@@ -150,7 +151,7 @@ class LLTextureFetchWorker : public LLWorkerClass
~
LLTextureFetchWorker
();
~
LLTextureFetchWorker
();
void
relese
()
{
--
mActiveCount
;
}
void
relese
()
{
--
mActiveCount
;
}
void
callbackHttpGet
(
const
LLChannelDescriptors
&
channels
,
S32
callbackHttpGet
(
const
LLChannelDescriptors
&
channels
,
const
LLIOPipe
::
buffer_ptr_t
&
buffer
,
const
LLIOPipe
::
buffer_ptr_t
&
buffer
,
bool
partial
,
bool
success
);
bool
partial
,
bool
success
);
void
callbackCacheRead
(
bool
success
,
LLImageFormatted
*
image
,
void
callbackCacheRead
(
bool
success
,
LLImageFormatted
*
image
,
...
@@ -335,8 +336,9 @@ class HTTPGetResponder : public LLCurl::Responder
...
@@ -335,8 +336,9 @@ class HTTPGetResponder : public LLCurl::Responder
worker
->
setGetStatus
(
status
,
reason
);
worker
->
setGetStatus
(
status
,
reason
);
// llwarns << "CURL GET FAILED, status:" << status << " reason:" << reason << llendl;
// llwarns << "CURL GET FAILED, status:" << status << " reason:" << reason << llendl;
}
}
mFetcher
->
removeFromHTTPQueue
(
mID
);
worker
->
callbackHttpGet
(
channels
,
buffer
,
partial
,
success
);
S32
data_size
=
worker
->
callbackHttpGet
(
channels
,
buffer
,
partial
,
success
);
mFetcher
->
removeFromHTTPQueue
(
mID
,
data_size
);
}
}
else
else
{
{
...
@@ -850,19 +852,10 @@ bool LLTextureFetchWorker::doWork(S32 param)
...
@@ -850,19 +852,10 @@ bool LLTextureFetchWorker::doWork(S32 param)
{
{
if
(
mCanUseHTTP
)
if
(
mCanUseHTTP
)
{
{
// *TODO: Integrate this with llviewerthrottle
//NOTE:
// Note: LLViewerThrottle uses dynamic throttling which makes sense for UDP,
//it seems ok to let sim control the UDP traffic
// but probably not for Textures.
//so there is no throttle for http here.
// Set the throttle to the entire bandwidth, assuming UDP packets will get priority
//
// when they are needed
//F32 max_bandwidth = mFetcher->mMaxBandwidth;
if
(
mFetcher
->
isHTTPThrottled
(
mDesiredSize
))
// ||
//mFetcher->getTextureBandwidth() > max_bandwidth)
{
// Make normal priority and return (i.e. wait until there is room in the queue)
setPriority
(
LLWorkerThread
::
PRIORITY_NORMAL
|
mWorkPriority
);
return
false
;
}
mFetcher
->
removeFromNetworkQueue
(
this
,
false
);
mFetcher
->
removeFromNetworkQueue
(
this
,
false
);
...
@@ -979,6 +972,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
...
@@ -979,6 +972,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
else
else
{
{
resetFormattedData
();
resetFormattedData
();
mState
=
DONE
;
return
true
;
// failed
return
true
;
// failed
}
}
}
}
...
@@ -1271,8 +1265,7 @@ bool LLTextureFetchWorker::deleteOK()
...
@@ -1271,8 +1265,7 @@ bool LLTextureFetchWorker::deleteOK()
if
((
haveWork
()
&&
if
((
haveWork
()
&&
// not ok to delete from these states
// not ok to delete from these states
((
mState
==
WAIT_HTTP_REQ
)
||
((
mState
>=
WRITE_TO_CACHE
&&
mState
<=
WAIT_ON_WRITE
))))
(
mState
>=
WRITE_TO_CACHE
&&
mState
<=
WAIT_ON_WRITE
))))
{
{
delete_ok
=
false
;
delete_ok
=
false
;
}
}
...
@@ -1351,29 +1344,29 @@ bool LLTextureFetchWorker::processSimulatorPackets()
...
@@ -1351,29 +1344,29 @@ bool LLTextureFetchWorker::processSimulatorPackets()
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
void
LLTextureFetchWorker
::
callbackHttpGet
(
const
LLChannelDescriptors
&
channels
,
S32
LLTextureFetchWorker
::
callbackHttpGet
(
const
LLChannelDescriptors
&
channels
,
const
LLIOPipe
::
buffer_ptr_t
&
buffer
,
const
LLIOPipe
::
buffer_ptr_t
&
buffer
,
bool
partial
,
bool
success
)
bool
partial
,
bool
success
)
{
{
S32
data_size
=
0
;
LLMutexLock
lock
(
&
mWorkMutex
);
LLMutexLock
lock
(
&
mWorkMutex
);
if
(
mState
!=
WAIT_HTTP_REQ
)
if
(
mState
!=
WAIT_HTTP_REQ
)
{
{
llwarns
<<
"callbackHttpGet for unrequested fetch worker: "
<<
mID
llwarns
<<
"callbackHttpGet for unrequested fetch worker: "
<<
mID
<<
" req="
<<
mSentRequest
<<
" state= "
<<
mState
<<
llendl
;
<<
" req="
<<
mSentRequest
<<
" state= "
<<
mState
<<
llendl
;
return
;
return
data_size
;
}
}
if
(
mLoaded
)
if
(
mLoaded
)
{
{
llwarns
<<
"Duplicate callback for "
<<
mID
.
asString
()
<<
llendl
;
llwarns
<<
"Duplicate callback for "
<<
mID
.
asString
()
<<
llendl
;
return
;
// ignore duplicate callback
return
data_size
;
// ignore duplicate callback
}
}
if
(
success
)
if
(
success
)
{
{
// get length of stream:
// get length of stream:
S32
data_size
=
buffer
->
countAfter
(
channels
.
in
(),
NULL
);
data_size
=
buffer
->
countAfter
(
channels
.
in
(),
NULL
);
gTextureList
.
sTextureBits
+=
data_size
*
8
;
// Approximate - does not include header bits
LL_DEBUGS
(
"Texture"
)
<<
"HTTP RECEIVED: "
<<
mID
.
asString
()
<<
" Bytes: "
<<
data_size
<<
LL_ENDL
;
LL_DEBUGS
(
"Texture"
)
<<
"HTTP RECEIVED: "
<<
mID
.
asString
()
<<
" Bytes: "
<<
data_size
<<
LL_ENDL
;
if
(
data_size
>
0
)
if
(
data_size
>
0
)
...
@@ -1410,6 +1403,8 @@ void LLTextureFetchWorker::callbackHttpGet(const LLChannelDescriptors& channels,
...
@@ -1410,6 +1403,8 @@ void LLTextureFetchWorker::callbackHttpGet(const LLChannelDescriptors& channels,
}
}
mLoaded
=
TRUE
;
mLoaded
=
TRUE
;
setPriority
(
LLWorkerThread
::
PRIORITY_HIGH
|
mWorkPriority
);
setPriority
(
LLWorkerThread
::
PRIORITY_HIGH
|
mWorkPriority
);
return
data_size
;
}
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
...
@@ -1528,15 +1523,11 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image
...
@@ -1528,15 +1523,11 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image
mTextureCache
(
cache
),
mTextureCache
(
cache
),
mImageDecodeThread
(
imagedecodethread
),
mImageDecodeThread
(
imagedecodethread
),
mTextureBandwidth
(
0
),
mTextureBandwidth
(
0
),
mHTTPTextureBits
(
0
),
mCurlGetRequest
(
NULL
)
mCurlGetRequest
(
NULL
)
{
{
mMaxBandwidth
=
gSavedSettings
.
getF32
(
"ThrottleBandwidthKBPS"
);
mMaxBandwidth
=
gSavedSettings
.
getF32
(
"ThrottleBandwidthKBPS"
);
mTextureInfo
.
setUpLogging
(
gSavedSettings
.
getBOOL
(
"LogTextureDownloadsToViewerLog"
),
gSavedSettings
.
getBOOL
(
"LogTextureDownloadsToSimulator"
),
gSavedSettings
.
getU32
(
"TextureLoggingThreshold"
));
mTextureInfo
.
setUpLogging
(
gSavedSettings
.
getBOOL
(
"LogTextureDownloadsToViewerLog"
),
gSavedSettings
.
getBOOL
(
"LogTextureDownloadsToSimulator"
),
gSavedSettings
.
getU32
(
"TextureLoggingThreshold"
));
for
(
S32
i
=
0
;
i
<
TOTAL_TEXTURE_TYPES
;
i
++
)
{
mHTTPThrottleFlag
[
i
]
=
FALSE
;
}
}
}
LLTextureFetch
::~
LLTextureFetch
()
LLTextureFetch
::~
LLTextureFetch
()
...
@@ -1678,69 +1669,11 @@ void LLTextureFetch::addToHTTPQueue(const LLUUID& id)
...
@@ -1678,69 +1669,11 @@ void LLTextureFetch::addToHTTPQueue(const LLUUID& id)
mHTTPTextureQueue
.
insert
(
id
);
mHTTPTextureQueue
.
insert
(
id
);
}
}
void
LLTextureFetch
::
removeFromHTTPQueue
(
const
LLUUID
&
id
)
void
LLTextureFetch
::
removeFromHTTPQueue
(
const
LLUUID
&
id
,
S32
received_size
)
{
{
LLMutexLock
lock
(
&
mNetworkQueueMutex
);
LLMutexLock
lock
(
&
mNetworkQueueMutex
);
mHTTPTextureQueue
.
erase
(
id
);
mHTTPTextureQueue
.
erase
(
id
);
}
mHTTPTextureBits
+=
received_size
*
8
;
// Approximate - does not include header bits
void
LLTextureFetch
::
clearHTTPThrottleFlag
()
{
static
const
F32
WAIT_TIME
=
0.3
f
;
//seconds.
static
LLFrameTimer
timer
;
if
(
timer
.
getElapsedTimeF32
()
<
WAIT_TIME
)
//wait for WAIT_TIME
{
return
;
}
timer
.
reset
()
;
LLMutexLock
lock
(
&
mNetworkQueueMutex
);
for
(
S32
i
=
0
;
i
<
TOTAL_TEXTURE_TYPES
;
i
++
)
//reset the http throttle flags.
{
mHTTPThrottleFlag
[
i
]
=
FALSE
;
}
}
//check if need to throttle this fetching request.
//rule: if a request can not be inserted into the http queue due to a full queue,
// block all future insertions of requests with larger fetching size requirement.
//because:
// later insertions are usually at lower priorities; and
// small textures need chance to be fetched.
bool
LLTextureFetch
::
isHTTPThrottled
(
S32
requested_size
)
{
static
const
S32
SMALL_TEXTURE_MAX_SIZE
=
64
*
64
*
4
;
static
const
S32
MEDIUM_TEXTURE_MAX_SIZE
=
256
*
256
*
4
;
static
const
U32
MAX_HTTP_QUEUE_SIZE
=
8
;
//determine the class of the texture: SMALL, MEDIUM, or LARGE.
S32
type
=
LARGE_TEXTURE
;
if
(
requested_size
<=
SMALL_TEXTURE_MAX_SIZE
)
{
type
=
SMALL_TEXTURE
;
}
else
if
(
requested_size
<=
MEDIUM_TEXTURE_MAX_SIZE
)
{
type
=
MEDIUM_TEXTURE
;
}
LLMutexLock
lock
(
&
mNetworkQueueMutex
);
if
(
mHTTPTextureQueue
.
size
()
>=
MAX_HTTP_QUEUE_SIZE
)
//if the http queue is full.
{
if
(
!
mHTTPThrottleFlag
[
type
+
1
])
{
for
(
S32
i
=
type
+
1
;
i
<
TOTAL_TEXTURE_TYPES
;
i
++
)
//block all requests with fetching size larger than this request.
{
mHTTPThrottleFlag
[
i
]
=
TRUE
;
}
}
return
true
;
}
return
mHTTPThrottleFlag
[
type
]
;
//true if this request can not be inserted to the http queue.
}
}
void
LLTextureFetch
::
deleteRequest
(
const
LLUUID
&
id
,
bool
cancel
)
void
LLTextureFetch
::
deleteRequest
(
const
LLUUID
&
id
,
bool
cancel
)
...
@@ -1888,12 +1821,19 @@ bool LLTextureFetch::updateRequestPriority(const LLUUID& id, F32 priority)
...
@@ -1888,12 +1821,19 @@ bool LLTextureFetch::updateRequestPriority(const LLUUID& id, F32 priority)
//virtual
//virtual
S32
LLTextureFetch
::
update
(
U32
max_time_ms
)
S32
LLTextureFetch
::
update
(
U32
max_time_ms
)
{
{
S32
res
;
static
LLCachedControl
<
F32
>
band_width
(
gSavedSettings
,
"ThrottleBandwidthKBPS"
);
static
LLCachedControl
<
F32
>
band_width
(
gSavedSettings
,
"ThrottleBandwidthKBPS"
);
mMaxBandwidth
=
band_width
;
{
res
=
LLWorkerThread
::
update
(
max_time_ms
);
mNetworkQueueMutex
.
lock
()
;
mMaxBandwidth
=
band_width
;
gTextureList
.
sTextureBits
+=
mHTTPTextureBits
;
mHTTPTextureBits
=
0
;
mNetworkQueueMutex
.
unlock
()
;
}
S32
res
=
LLWorkerThread
::
update
(
max_time_ms
);
if
(
!
mDebugPause
)
if
(
!
mDebugPause
)
{
{
...
@@ -1909,7 +1849,6 @@ S32 LLTextureFetch::update(U32 max_time_ms)
...
@@ -1909,7 +1849,6 @@ S32 LLTextureFetch::update(U32 max_time_ms)
lldebugs
<<
"processed: "
<<
processed
<<
" messages."
<<
llendl
;
lldebugs
<<
"processed: "
<<
processed
<<
" messages."
<<
llendl
;
}
}
}
}
clearHTTPThrottleFlag
();
return
res
;
return
res
;
}
}
...
...
This diff is collapsed.
Click to expand it.
indra/newview/lltexturefetch.h
+
2
−
12
View file @
ba7995fc
...
@@ -94,9 +94,7 @@ class LLTextureFetch : public LLWorkerThread
...
@@ -94,9 +94,7 @@ class LLTextureFetch : public LLWorkerThread
void
addToNetworkQueue
(
LLTextureFetchWorker
*
worker
);
void
addToNetworkQueue
(
LLTextureFetchWorker
*
worker
);
void
removeFromNetworkQueue
(
LLTextureFetchWorker
*
worker
,
bool
cancel
);
void
removeFromNetworkQueue
(
LLTextureFetchWorker
*
worker
,
bool
cancel
);
void
addToHTTPQueue
(
const
LLUUID
&
id
);
void
addToHTTPQueue
(
const
LLUUID
&
id
);
void
removeFromHTTPQueue
(
const
LLUUID
&
id
);
void
removeFromHTTPQueue
(
const
LLUUID
&
id
,
S32
received_size
=
0
);
bool
isHTTPThrottled
(
S32
requested_size
);
void
clearHTTPThrottleFlag
();
void
removeRequest
(
LLTextureFetchWorker
*
worker
,
bool
cancel
);
void
removeRequest
(
LLTextureFetchWorker
*
worker
,
bool
cancel
);
// Called from worker thread (during doWork)
// Called from worker thread (during doWork)
void
processCurlRequests
();
void
processCurlRequests
();
...
@@ -136,15 +134,7 @@ class LLTextureFetch : public LLWorkerThread
...
@@ -136,15 +134,7 @@ class LLTextureFetch : public LLWorkerThread
F32
mMaxBandwidth
;
F32
mMaxBandwidth
;
LLTextureInfo
mTextureInfo
;
LLTextureInfo
mTextureInfo
;
enum
U32
mHTTPTextureBits
;
{
SMALL_TEXTURE
=
0
,
//size <= 64 * 64
MEDIUM_TEXTURE
,
//size <= 256 * 256
LARGE_TEXTURE
,
//size > 256 * 256
DUMMY
,
TOTAL_TEXTURE_TYPES
};
BOOL
mHTTPThrottleFlag
[
TOTAL_TEXTURE_TYPES
];
};
};
#endif // LL_LLTEXTUREFETCH_H
#endif // LL_LLTEXTUREFETCH_H
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment