New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 752528 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Nov 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Feature



Sign in to add a comment

gpu TraceOutputter is not thread safe

Project Member Reported by boliu@chromium.org, Aug 4 2017

Issue description

TraceOutputter::Create creates a global instance in a thread-unsafe way, and TraceOutputter itself is RefCounted and not thread safe. I did any further for more thread unsafe behavior.

This is a problem on android webview which runs gpu service on two different threads in the same process.

It's not clear to me if the right fix is to make TraceOutputter thread safe, or make it one-per-thread rather than global.

TraceOutputter does seem like a heavy object with a base::Thread so maybe sharing is better, but then that thread is started and immediately stopped in the constructor so maybe not?
 

Comment 1 by piman@chromium.org, Aug 4 2017

IIRC TraceOutputter just creates a thread to generate a "fake" thread ID for tracing purposes. Since it's intended to represent the GPU timeline, a single one of these is really the best. But agreed, TraceOutputter doesn't account for multiple GL threads tracing at the same time, we need a bunch more logic. The simplest is absolutely one TraceOutputter per thread - it'll look like separate GPU timelines, but they should hopefully not overlap.

Comment 2 by boliu@chromium.org, Aug 4 2017

Then best option would be to make it similar to MailboxManager, have GpuChannelManager and InProcessCommandBuffer::Service own TraceOutputter and plumbing it through to where it's needed. Assuming TraceOutputter doesn't need to outlive these objects?

Comment 3 by piman@chromium.org, Aug 4 2017

I don't think it needs to outlive those. I believe it's only called while decoding commands. So having one TraceOutputter for each of GpuChannelManager and InProcessCommandBuffer::Service seems like it would work.

Comment 4 by enne@chromium.org, Aug 24 2017

Labels: -Type-Bug Type-Feature
Status: Available (was: Untriaged)

Comment 5 by c.pa...@samsung.com, Sep 13 2017

piman@chromium.org: If nobody is working on this, can I take this one up?

Comment 6 by piman@chromium.org, Sep 13 2017

Owner: c.pa...@samsung.com
Sure! I don't think anyone is working on this at the moment.

Comment 7 by c.pa...@samsung.com, Sep 15 2017

Status: Assigned (was: Available)
Project Member

Comment 8 by bugdroid1@chromium.org, Sep 19 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3

commit 07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3
Author: Chandan Padhi <c.padhi@samsung.com>
Date: Tue Sep 19 02:52:53 2017

Create one gpu:gles2::TraceOutputter per thread

Currently, TraceOutputter is a global instance created in a
thread-unsafe way. This is a problem on android webview which
runs gpu service on two different threads in the same process.

With this CL, one TraceOutputter is created per thread for each
of GpuChannelManager and InProcessCommandBuffer::Service.
It also makes TraceOutputter non-ref-counted.

Bug:  752528 
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I32758531c7ed7fbaf5dd24b3349c5e24c149b7cc
Reviewed-on: https://chromium-review.googlesource.com/667296
Reviewed-by: Chris Watkins <watk@chromium.org>
Reviewed-by: Antoine Labour <piman@chromium.org>
Commit-Queue: Chandan Padhi <c.padhi@samsung.com>
Cr-Commit-Position: refs/heads/master@{#502766}
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/command_buffer/service/context_group_unittest.cc
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/command_buffer/service/framebuffer_manager_unittest.cc
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/command_buffer/service/gl_context_virtual_unittest.cc
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/command_buffer/service/gles2_cmd_decoder.cc
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/command_buffer/service/gles2_cmd_decoder.h
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/command_buffer/service/gles2_cmd_decoder_mock.cc
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/command_buffer/service/gles2_cmd_decoder_mock.h
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/command_buffer/service/gpu_tracer.cc
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/command_buffer/service/gpu_tracer.h
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/command_buffer/service/gpu_tracer_unittest.cc
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/command_buffer/service/query_manager_unittest.cc
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/command_buffer/service/service_discardable_manager_unittest.cc
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/command_buffer/service/texture_manager_unittest.cc
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/command_buffer/tests/fuzzer_main.cc
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/command_buffer/tests/gl_manager.cc
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/command_buffer/tests/gl_manager.h
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/gles2_conform_support/egl/context.cc
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/gles2_conform_support/egl/context.h
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/ipc/in_process_command_buffer.cc
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/ipc/in_process_command_buffer.h
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/ipc/service/gpu_channel_manager.cc
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/ipc/service/gpu_channel_manager.h
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/gpu/ipc/service/gpu_command_buffer_stub.cc
[modify] https://crrev.com/07f05c09aec5a9a8299bfcb2dd0c97746e73e1f3/media/gpu/android/android_video_decode_accelerator_unittest.cc

Comment 9 by c.pa...@samsung.com, Nov 10 2017

piman@chromium.org: Is there anything else to do w.r.t this bug? Shall we close this one?

Comment 10 by piman@chromium.org, Nov 10 2017

Status: Fixed (was: Assigned)
Yes, I think we can close this. Thanks!

Sign in to add a comment