Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Issue 553050: Windows now uses the TLS API instead of __declspec(thread) for client side co... (Closed)

Created:
10 years, 11 months ago by apatrick_chromium
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com, pam+watch_chromium.org
Visibility:
Public.

Description

Windows now uses the TLS API instead of __declspec(thread) for client side command buffer code compiled into DLLs. Other platforms use the pthreads API. This is because the __declspec(thread) approach does not on some platforms, including Windows XP and Mac. This is used for thread local pointers to the GL and PGL contexts. This unfortunate because the PGL and GL APIs do not generally explicitly reference a context. The current context is set with a call to pglMakeCurrent. An unfortunate consequence is that now in Pepper plugins, every call to a GL function will call TlsGetValue to get the thread's current context, which could have performance issues. I can't use base::ThreadLocalPointer because this code is compiled into an untrusted NaCl module and we don't want Chromium dependencies. TEST=try BUG=none Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=37300

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Patch Set 4 : '' #

Total comments: 4

Patch Set 5 : '' #

Patch Set 6 : '' #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+164 lines, -24 lines) Patch
M gpu/command_buffer/client/gles2_demo.cc View 3 4 1 chunk +5 lines, -4 lines 0 comments Download
M gpu/command_buffer/client/gles2_lib.h View 1 2 3 4 1 chunk +9 lines, -13 lines 0 comments Download
M gpu/command_buffer/client/gles2_lib.cc View 1 2 3 4 1 chunk +19 lines, -1 line 0 comments Download
A gpu/command_buffer/common/thread_local.h View 5 1 chunk +61 lines, -0 lines 0 comments Download
M gpu/command_buffer/service/gles2_cmd_decoder_mock.h View 3 4 1 chunk +2 lines, -1 line 0 comments Download
M gpu/demos/framework/main_pepper.cc View 2 chunks +3 lines, -0 lines 0 comments Download
M gpu/demos/framework/plugin.cc View 1 chunk +4 lines, -0 lines 1 comment Download
M gpu/demos/framework/window.cc View 1 chunk +1 line, -0 lines 0 comments Download
M gpu/gpu.gyp View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M gpu/pgl/pgl.h View 1 2 3 4 1 chunk +8 lines, -0 lines 0 comments Download
M gpu/pgl/pgl.cc View 1 2 3 4 5 chunks +43 lines, -5 lines 2 comments Download
M webkit/tools/pepper_test_plugin/main.cc View 1 2 3 4 3 chunks +8 lines, -0 lines 0 comments Download

Messages

Total messages: 18 (0 generated)
apatrick_chromium
10 years, 11 months ago (2010-01-22 00:11:58 UTC) #1
alokp
LGTM A couple of things: 1. Should you add a TODO to remove this workaround ...
10 years, 11 months ago (2010-01-22 00:40:05 UTC) #2
apatrick_chromium
cpu, any thoughts before I commit this atrocity? See description for the issue.
10 years, 11 months ago (2010-01-22 19:50:33 UTC) #3
apatrick_chromium
I reimplemented TlsGetValue and TlsSetValue in inline assembly. Somebody stop me!
10 years, 11 months ago (2010-01-22 23:57:55 UTC) #4
cpu_(ooo_6.6-7.5)
Wow sweet baby jesus, gimme a day to digest this! On 2010/01/22 23:57:55, apatrick_chromium wrote: ...
10 years, 11 months ago (2010-01-23 00:19:11 UTC) #5
cpu_(ooo_6.6-7.5)
http://codereview.chromium.org/553050/diff/7002/8008 File gpu/command_buffer/client/gles2_lib.h (right): http://codereview.chromium.org/553050/diff/7002/8008#newcode15 gpu/command_buffer/client/gles2_lib.h:15: extern THREAD_LOCAL gpu::ThreadLocalPointer<gpu::gles2::GLES2Implementation> I am soo confused about this, ...
10 years, 11 months ago (2010-01-23 02:12:57 UTC) #6
apatrick
It's a mess right now. I'm trying to explore the options. I wish __declspec(thread) would ...
10 years, 11 months ago (2010-01-23 02:30:01 UTC) #7
apatrick
Oh no :( There is: unsigned long __readfsdword( unsigned long Offset ); http://msdn.microsoft.com/en-us/library/3887zk1s(VS.80).aspx And the ...
10 years, 11 months ago (2010-01-23 02:45:33 UTC) #8
rvargas (doing something else)
On 2010/01/23 02:45:33, apatrick wrote: > Oh no :( There is: > > unsigned long ...
10 years, 11 months ago (2010-01-23 03:26:20 UTC) #9
cpu_(ooo_6.6-7.5)
As Rick confirmed the overhead of TlsGetValue() is near zero. On 2010/01/23 03:26:20, rvargas wrote: ...
10 years, 11 months ago (2010-01-25 20:32:12 UTC) #10
apatrick_chromium
I compared the performance of TlsGetValue against my own implementation. A tight loop calling TlsGetValue ...
10 years, 11 months ago (2010-01-26 22:14:47 UTC) #11
cpu_(ooo_6.6-7.5)
lgtm on the TLS stuff. I did not check the rest I assume the others ...
10 years, 11 months ago (2010-01-27 00:26:13 UTC) #12
alokp
lgtm http://codereview.chromium.org/553050/diff/47/1037 File gpu/demos/framework/plugin.cc (right): http://codereview.chromium.org/553050/diff/47/1037#newcode97 gpu/demos/framework/plugin.cc:97: demo_.reset(); may be demo_.release() is clearer.
10 years, 11 months ago (2010-01-27 05:30:19 UTC) #13
darin (slow to review)
Is there some reason why base/thread_local.h was not used? Are we trying to avoid a ...
10 years, 11 months ago (2010-01-27 07:36:30 UTC) #14
apatrick
Yes I am avoiding a dependency on base. This will be built as a NaCl ...
10 years, 11 months ago (2010-01-27 07:56:15 UTC) #15
rvargas (doing something else)
http://codereview.chromium.org/553050/diff/47/1029 File gpu/pgl/pgl.cc (right): http://codereview.chromium.org/553050/diff/47/1029#newcode147 gpu/pgl/pgl.cc:147: PGLContext pglCreateContext(NPP npp, Out of curiosity, what's the reason ...
10 years, 11 months ago (2010-01-27 19:45:17 UTC) #16
apatrick_chromium
http://codereview.chromium.org/553050/diff/47/1029 File gpu/pgl/pgl.cc (right): http://codereview.chromium.org/553050/diff/47/1029#newcode147 gpu/pgl/pgl.cc:147: PGLContext pglCreateContext(NPP npp, On 2010/01/27 19:45:18, rvargas wrote: > ...
10 years, 11 months ago (2010-01-27 19:55:09 UTC) #17
darin (slow to review)
10 years, 11 months ago (2010-01-27 20:57:25 UTC) #18
OK.  By the way, I don't think it is completely unreasonable to compile and
link base/ into a plugin.  We do that for other ordinary test plugins.

-Darin



On Tue, Jan 26, 2010 at 11:56 PM, Alastair Patrick <apatrick@google.com>wrote:

> Yes I am avoiding a dependency on base. This will be built as a NaCl
> untrusted library and linked with NaCl modules so they can use OpenGL on top
> of the NPDevice3D interface. The prevailing idea is that this should not be
> dependent on base. I am beginning to question it.

Powered by Google App Engine
This is Rietveld 408576698