Last Comment Bug 741984 - Continuously re-uploading textures while on Fennec homescreen
: Continuously re-uploading textures while on Fennec homescreen
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Graphics (show other bugs)
: unspecified
: ARM Android
: -- normal (vote)
: mozilla14
Assigned To: Ali Juma [:ajuma]
:
Mentors:
: 740778 (view as bug list)
Depends on:
Blocks: 736436 740778
  Show dependency treegraph
 
Reported: 2012-04-03 11:32 PDT by Benoit Jacob [:bjacob] (mostly away)
Modified: 2012-04-05 10:49 PDT (History)
6 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Prevent tiled texture upload from going into an infinite loop (1.37 KB, patch)
2012-04-03 12:59 PDT, Ali Juma [:ajuma]
chrislord.net: review+
Details | Diff | Splinter Review

Description Benoit Jacob [:bjacob] (mostly away) 2012-04-03 11:32:46 PDT
On my Nexus S, Fennec off mozilla-central will continuously do ProgressiveUploads while I'm on the home tab.

Steps to reproduce:

1. use a debug build of fennec
2. adb shell am start -a android.activity.MAIN -n org.mozilla.fennec_bjacob/.App --es env0 MOZ_GL_DEBUG_VERBOSE=1
3. launch moz-gdb
4. b mozilla::gl::GLContext::fTexSubImage2D
5. continue
6. if you don't get your breakpoint hit right away, tap the location bar and select Firefox Start / about:home
7. with MOZ_GL_DEBUG_VERBOSE you should see this pattern:

adb| [egl] > void* mozilla::gl::GLLibraryEGL::fGetCurrentContext()
adb| [egl] < void* mozilla::gl::GLLibraryEGL::fGetCurrentContext()
adb| [gl:0x4a3f3c00] > void mozilla::gl::GLContext::fActiveTexture(GLenum)
adb| [gl:0x4a3f3c00] < void mozilla::gl::GLContext::fActiveTexture(GLenum) [0...
adb| [gl:0x4a3f3c00] > void mozilla::gl::GLContext::fBindTexture(GLenum, GLuint)
adb| [gl:0x4a3f3c00] < void mozilla::gl::GLContext::fBindTexture(GLenum, GLui...
adb| [gl:0x4a3f3c00] > void mozilla::gl::GLContext::fTexImage2D(GLenum, GLint...
adb| [gl:0x4a3f3c00] < void mozilla::gl::GLContext::fTexImage2D(GLenum, GLint...
adb| [gl:0x4a3f3c00] > void mozilla::gl::GLContext::fPixelStorei(GLenum, GLint)
adb| [gl:0x4a3f3c00] < void mozilla::gl::GLContext::fPixelStorei(GLenum, GLin...

8. when the breakpoint is hit, a backtrace gives:

Breakpoint 1, mozilla::gl::GLContext::fTexSubImage2D (this=0x4a3f3c00, 
    target=3553, level=0, xoffset=0, yoffset=0, width=224, height=179, 
    format=6408, type=5121, pixels=0x4a30f000)
    at ../../../dist/include/GLContext.h:2425
2425	        BEFORE_GL_CALL;
(gdb) bt
#0  mozilla::gl::GLContext::fTexSubImage2D (this=0x4a3f3c00, target=3553, 
    level=0, xoffset=0, yoffset=0, width=224, height=179, format=6408, 
    type=5121, pixels=0x4a30f000) at ../../../dist/include/GLContext.h:2425
#1  0x4c179a8a in mozilla::gl::GLContext::TexSubImage2DWithoutUnpackSubimage (
    this=0x4a3f3c00, target=3553, level=0, xoffset=0, yoffset=0, width=224, 
    height=179, stride=896, pixelsize=4, format=6408, type=5121, 
    pixels=0x50f7c400)
    at /home/bjacob/mozilla-central/gfx/gl/GLContext.cpp:2589
#2  0x4c1798c0 in mozilla::gl::GLContext::TexSubImage2D (this=0x4a3f3c00, 
    target=3553, level=0, xoffset=0, yoffset=0, width=224, height=179, 
    stride=1920, pixelsize=4, format=6408, type=5121, pixels=0x50f7c400)
    at /home/bjacob/mozilla-central/gfx/gl/GLContext.cpp:2494
#3  0x4c1797b8 in mozilla::gl::GLContext::TexImage2D (this=0x4a3f3c00, 
    target=3553, level=0, internalformat=6408, width=224, height=179, 
    stride=1920, pixelsize=4, border=0, format=6408, type=5121, 
    pixels=0x50f7c400)
    at /home/bjacob/mozilla-central/gfx/gl/GLContext.cpp:2442
#4  0x4c1794fe in mozilla::gl::GLContext::UploadSurfaceToTexture (
    this=0x4a3f3c00, aSurface=0x476f3b80, aDstRegion=..., 
    aTexture=@0x49476e6c, aOverwrite=false, aSrcPoint=..., aPixelBuffer=false)
    at /home/bjacob/mozilla-central/gfx/gl/GLContext.cpp:2339
#5  0x4c17f278 in mozilla::gl::TextureImageEGL::DirectUpdate (this=0x49476e20, 
    aSurf=0x476f3b80, aRegion=..., aFrom=...)
    at /home/bjacob/mozilla-central/gfx/gl/GLContextProviderEGL.cpp:1059
#6  0x4c175cfa in mozilla::gl::TiledTextureImage::DirectUpdate (
    this=0x474db1a0, aSurf=0x476f3b80, aRegion=..., aFrom=...)
    at /home/bjacob/mozilla-central/gfx/gl/GLContext.cpp:949
#7  0x4c16325e in mozilla::layers::ShadowBufferOGL::DirectUpdate (
    this=0x476f3bc0, aUpdate=0x476f3b80, aRegion=...)
    at /home/bjacob/mozilla-central/gfx/layers/opengl/ThebesLayerOGL.cpp:959
#8  0x4c163d98 in mozilla::layers::ShadowThebesLayerOGL::ProgressiveUpload (
    this=0x4a30bc00)
    at /home/bjacob/mozilla-central/gfx/layers/opengl/ThebesLayerOGL.cpp:1171
#9  0x4c165106 in DispatchToMethod<mozilla::layers::ShadowThebesLayerOGL, void (mozilla::layers::ShadowThebesLayerOGL::*)()> (obj=0x4a30bc00, 
    method=&virtual table offset 52, arg=...)
    at /home/bjacob/mozilla-central/ipc/chromium/src/base/tuple.h:383
#10 0x4c165078 in RunnableMethod<mozilla::layers::ShadowThebesLayerOGL, void (mozilla::layers::ShadowThebesLayerOGL::*)(), Tuple0>::Run (this=0x474dfb20)
    at /home/bjacob/mozilla-central/ipc/chromium/src/base/task.h:307
#11 0x4c0875b8 in MessageLoop::RunTask (this=0x4a4ffdf0, task=0x474dfb20)
    at /home/bjacob/mozilla-central/ipc/chromium/src/base/message_loop.cc:318
#12 0x4c08760e in MessageLoop::DeferOrRunPendingTask (this=0x4a4ffdf0, 
    pending_task=...)
    at /home/bjacob/mozilla-central/ipc/chromium/src/base/message_loop.cc:326
#13 0x4c087ab2 in MessageLoop::DoDelayedWork (this=0x4a4ffdf0, 
---Type <return> to continue, or q <return> to quit---
    next_delayed_work_time=0x4a1d0c70)
    at /home/bjacob/mozilla-central/ipc/chromium/src/base/message_loop.cc:453
#14 0x4c08c950 in base::MessagePumpDefault::Run (this=0x4a1d0c60, 
    delegate=0x4a4ffdf0)
    at /home/bjacob/mozilla-central/ipc/chromium/src/base/message_pump_default.cc:27
#15 0x4c0871d8 in MessageLoop::RunInternal (this=0x4a4ffdf0)
    at /home/bjacob/mozilla-central/ipc/chromium/src/base/message_loop.cc:208
#16 0x4c087172 in MessageLoop::RunHandler (this=0x4a4ffdf0)
    at /home/bjacob/mozilla-central/ipc/chromium/src/base/message_loop.cc:201
#17 0x4c08711a in MessageLoop::Run (this=0x4a4ffdf0)
    at /home/bjacob/mozilla-central/ipc/chromium/src/base/message_loop.cc:175
#18 0x4c0a665e in base::Thread::ThreadMain (this=0x476f1c70)
    at /home/bjacob/mozilla-central/ipc/chromium/src/base/thread.cc:156
#19 0x4c0d2d5e in ThreadFunc (closure=0x476f1c70)
    at /home/bjacob/mozilla-central/ipc/chromium/src/base/platform_thread_posix.cc:26
#20 0xafd118e8 in __thread_entry ()
   from /home/bjacob/moz-gdb/lib/3834B8993E6B00EC/system/lib/libc.so
#21 0xafd114b4 in pthread_create ()
   from /home/bjacob/moz-gdb/lib/3834B8993E6B00EC/system/lib/libc.so
#22 0x0038bee8 in ?? ()
Cannot access memory at address 0x408
Comment 1 Ali Juma [:ajuma] 2012-04-03 12:59:32 PDT
Created attachment 611946 [details] [diff] [review]
Prevent tiled texture upload from going into an infinite loop

There are two issues here: 1) why are we uploading while on the homescreen? 2) why are we uploading continuously?

This patch addresses the second issue. It turns out that when an upload involves the final tile of a TiledTextureImage, we're not subtracting the region uploaded to the final tile from the region that needs to be uploaded, meaning we always think there's something left to upload, so we repeatedly schedule uploads.

This is happening because NextTile() isn't getting called for the final tile, and hence mIterationCallback (which updates the region needing to be uploaded) isn't getting called.

This patch adds the missing call to NextTile().
Comment 2 Chris Lord [:cwiiis] 2012-04-04 05:16:41 PDT
Comment on attachment 611946 [details] [diff] [review]
Prevent tiled texture upload from going into an infinite loop

Review of attachment 611946 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good to me.
Comment 4 Benoit Jacob [:bjacob] (mostly away) 2012-04-04 11:32:41 PDT
Confirming: This patch does fix the problem (2) for me.
Comment 5 Ali Juma [:ajuma] 2012-04-05 07:34:32 PDT
*** Bug 740778 has been marked as a duplicate of this bug. ***
Comment 6 :Ehsan Akhgari (away Aug 1-5) 2012-04-05 10:49:50 PDT
https://hg.mozilla.org/mozilla-central/rev/b070d9dafc84

Note You need to log in before you can comment on or make changes to this bug.