New issue
Advanced search Search tips

Issue 776876 link

Starred by 0 users

Issue metadata

Status: Started
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Feature



Sign in to add a comment

Skip TLS lookups in gpu service code

Project Member Reported by piman@chromium.org, Oct 20 2017

Issue description

Our gl macro wrappers in gl_bindings.h look up the GLApi from the TLS. However, the current GLApi is the one from the current context, which is a known quantity in the command decoders. We can skip the TLS lookup on every gl call by caching the GLApi in the decoders and calling it directly. Yields 5-10% improvement in DecoderPerfTests when stubbing out driver (probably about 1-2% with driver on). Also reduces code size a bit (got ~8k on linux official).
 

Comment 1 by piman@chromium.org, Oct 23 2017

Components: Internals>GPU>Internals
Project Member

Comment 2 by bugdroid1@chromium.org, Oct 24 2017

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

commit 2c1ad96a990daabb8640ab33abf7afd7823e413f
Author: Antoine Labour <piman@chromium.org>
Date: Tue Oct 24 23:32:56 2017

gpu: bypass TLS when making gl calls on the gpu service

The GLApi is kept as a pointer on the TLS, but it uniquely corresponds
to a context, so the decoders can cache the pointer to avoid a TLS
lookup.
This CL replaces all GL calls in the passthrough decoder, and a large
portion (but not all) in the validating decoder to explicitly use the
cached GLApi. Gives about 5-10% improvement on DecoderPerfTest when
stubbing out GL (1-2%).

Bug: 776876
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: Ia305fd511434d02d36bf86c80e40ea737b2519d5
Reviewed-on: https://chromium-review.googlesource.com/729641
Commit-Queue: Antoine Labour <piman@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Victor Miura <vmiura@chromium.org>
Cr-Commit-Position: refs/heads/master@{#511303}
[modify] https://crrev.com/2c1ad96a990daabb8640ab33abf7afd7823e413f/gpu/command_buffer/build_gles2_cmd_buffer.py
[modify] https://crrev.com/2c1ad96a990daabb8640ab33abf7afd7823e413f/gpu/command_buffer/service/context_group.cc
[modify] https://crrev.com/2c1ad96a990daabb8640ab33abf7afd7823e413f/gpu/command_buffer/service/context_state.cc
[modify] https://crrev.com/2c1ad96a990daabb8640ab33abf7afd7823e413f/gpu/command_buffer/service/context_state.h
[modify] https://crrev.com/2c1ad96a990daabb8640ab33abf7afd7823e413f/gpu/command_buffer/service/context_state_autogen.h
[modify] https://crrev.com/2c1ad96a990daabb8640ab33abf7afd7823e413f/gpu/command_buffer/service/context_state_impl_autogen.h
[modify] https://crrev.com/2c1ad96a990daabb8640ab33abf7afd7823e413f/gpu/command_buffer/service/gles2_cmd_decoder.cc
[modify] https://crrev.com/2c1ad96a990daabb8640ab33abf7afd7823e413f/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
[modify] https://crrev.com/2c1ad96a990daabb8640ab33abf7afd7823e413f/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc
[modify] https://crrev.com/2c1ad96a990daabb8640ab33abf7afd7823e413f/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h
[modify] https://crrev.com/2c1ad96a990daabb8640ab33abf7afd7823e413f/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc

Sign in to add a comment