Continuously re-uploading textures while on Fennec homescreen

RESOLVED FIXED in mozilla14

Status

()

Core
Graphics
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: bjacob, Assigned: ajuma)

Tracking

unspecified
mozilla14
ARM
Android
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

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
(Assignee)

Comment 1

5 years ago
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().
Attachment #611946 - Flags: review?(chrislord.net)
(Reporter)

Updated

5 years ago
Blocks: 736436

Comment 2

5 years ago
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.
Attachment #611946 - Flags: review?(chrislord.net) → review+
(Assignee)

Comment 3

5 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/b070d9dafc84
Assignee: nobody → ajuma
Target Milestone: --- → mozilla14
(Reporter)

Comment 4

5 years ago
Confirming: This patch does fix the problem (2) for me.

Updated

5 years ago
Blocks: 740778
(Assignee)

Updated

5 years ago
Duplicate of this bug: 740778
https://hg.mozilla.org/mozilla-central/rev/b070d9dafc84
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.