summaryrefslogtreecommitdiffstats
path: root/ui/gfx/gl/gl_context.h
Commit message (Collapse)AuthorAgeFilesLines
* ui: Move gl/ directory out of gfx/, up to ui/.tfarina@chromium.org2012-05-121-93/+0
| | | | | | | | | | BUG=104040 R=ben@chromium.org TBR=tony@chromium.org Review URL: https://chromiumcodereview.appspot.com/10392068 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136777 0039d316-1c4b-4281-b951-d872f2087c98
* Split GL binding init into core and extension partjoth@chromium.org2011-10-271-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change splits the GL binding initialization into to phases: core functions and extension functions. This is motivated by two peculiarities of the EGL window binding layer: 1. Pointers to core GL entry points may not be queried through eglGetProcAddress(). 2. The return value of eglGetProcAddress() is not specified to be NULL for unsupported functions. In light of these limitations, the current strategy of blindly querying all GL entry points from eglGetProcAddress() and falling back to dlsym() results in bogus function pointers on some EGL implementations. This patch fixes the problem as follows: 1. Add GetGLCoreProcAddress() that only queries dlsym() and use it to initialize pointers to all entry points. On EGL based platforms pointers to extension functions will most likely be NULL at this point. 2. When a context is first made current, look up the set of supported extensions and use GetGLProcAddress() to populate the remaining extension function pointers. The reworked GL bindings generator uses the standard Khronos headers to recognize the extension functions and produce appropriate initialization code. Note that the patch also updates gl2ext.h to match the upstream Khronos version and corrects some minor errors in the downstream changes. BUG=5427391 TEST= Review URL: http://codereview.chromium.org/8381001 Patch from Sami Kyostila <skyostil@chromium.org>. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107602 0039d316-1c4b-4281-b951-d872f2087c98
* Support dynamic switching between integrated and discrete GPUs on Mac OS X.kbr@chromium.org2011-10-131-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change Chrome to allocate most OpenGL contexts with the kCGLPFAAllowOfflineRenderers flag, and specify NSSupportsAutomaticGraphicsSwitching in the Info.plist for the main executable and helper apps. This keeps Chrome on the integrated GPU except when using WebGL, accelerated 2D Canvas, Pepper 3D, and Core Animation-based plugins (except Flash). Chrome shares resources between OpenGL contexts in order to display WebGL and other content in the compositor, and resource sharing doesn't work between contexts allocated on different GPUs. Therefore, when the first context for a given renderer requests the discrete GPU, the channel is dropped and all contexts are reallocated on the discrete GPU. Similarly, when the last context requesting the discrete GPU for a given renderer is shut down, all contexts are dropped and reallocated on the integrated GPU. Currently dynamic GPU switching is only supported on the latest Mac OS X 10.7 update and MacBook Pros with dual AMD / Intel GPUs, though this will improve in future OS updates. Tested with WebGL, CSS 3D, Flash and Unity3D content and observed desired GPU switching behavior. Also added a layout test to WebKit under https://bugs.webkit.org/show_bug.cgi?id=69776 which when run in Chrome catches an assertion failure related to the destruction of contexts. The intent is to add it as a UI layout test on the GPU bots. BUG=88788 TEST=none Review URL: http://codereview.chromium.org/8233027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105399 0039d316-1c4b-4281-b951-d872f2087c98
* Keep track of the current per-thread context and surface. Addkbr@google.com2011-09-091-0/+3
| | | | | | | | | | | | | | | | ScopedMakeCurrent to make it easier to briefly make another context current. Use it in AcceleratedSurface implementation and verify in the caller that it is working. This infrastructure would have made it possible to catch http://crbug.com/95492 and similar bugs where the wrong context was current. BUG=95962 TEST=ran CSS 3D example poster-circle; no assertion failures Review URL: http://codereview.chromium.org/7787022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100528 0039d316-1c4b-4281-b951-d872f2087c98
* Add gl.dll, compositor.dll, and surface.dll.darin@chromium.org2011-08-181-1/+1
| | | | | | | | | | | | | | | | | | | I considered merging these into ui.dll, but the respective GYP files are pretty customized, and merging all of the special casing into ui.gyp seemed like it would just make things messy. Plus, some components only need to link to surface and not all of ui. One thing that I'm not entirely sure about is the naming convention. In this case the modules are named gl, compositor and surface instead of ui_gfx_gl, and so on. I thought about declaring UI_GFX_GL_EXPORT, but I opted for the shorter GL_EXPORT instead. I think Ben has been thinking about moving these directories out of ui/gfx/ anyways since it is a bit odd for them to live there. R=rvargas Originally reviewed at http://codereview.chromium.org/7645004 Review URL: http://codereview.chromium.org/7659017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97325 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 96982 - Add gl.dll, compositor.dll, and surface.dll.rvargas@google.com2011-08-161-1/+1
| | | | | | | | | | | | | | | | | | | | | I considered merging these into ui.dll, but the respective GYP files are pretty customized, and merging all of the special casing into ui.gyp seemed like it would just make things messy. Plus, some components only need to link to surface and not all of ui. One thing that I'm not entirely sure about is the naming convention. In this case the modules are named gl, compositor and surface instead of ui_gfx_gl, and so on. I thought about declaring UI_GFX_GL_EXPORT, but I opted for the shorter GL_EXPORT instead. I think Ben has been thinking about moving these directories out of ui/gfx/ anyways since it is a bit odd for them to live there. R=rvargas Review URL: http://codereview.chromium.org/7645004 TBR=darin@chromium.org Review URL: http://codereview.chromium.org/7659015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96997 0039d316-1c4b-4281-b951-d872f2087c98
* Add gl.dll, compositor.dll, and surface.dll.darin@chromium.org2011-08-161-1/+1
| | | | | | | | | | | | | | | | | | I considered merging these into ui.dll, but the respective GYP files are pretty customized, and merging all of the special casing into ui.gyp seemed like it would just make things messy. Plus, some components only need to link to surface and not all of ui. One thing that I'm not entirely sure about is the naming convention. In this case the modules are named gl, compositor and surface instead of ui_gfx_gl, and so on. I thought about declaring UI_GFX_GL_EXPORT, but I opted for the shorter GL_EXPORT instead. I think Ben has been thinking about moving these directories out of ui/gfx/ anyways since it is a bit odd for them to live there. R=rvargas Review URL: http://codereview.chromium.org/7645004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96982 0039d316-1c4b-4281-b951-d872f2087c98
* Detect and expose loss of OpenGL context using GL_ARB_robustness.kbr@chromium.org2011-07-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (This CL was originally reviewed under http://codereview.chromium.org/7331020/ . The only difference is the removal of an #include from command_buffer.h that was accidentally left in and which caused a significant increase in the number of files containing static initializers, presumably because of the dependent #include of <iostream>.) This initial patch changes the Linux port to use GLX_ARB_create_context_robustness when available, and tests periodically whether the context has been lost after each draw call and when making the context current. The detection of context loss also works with EGL and ANGLE, although it always reports an unknown reset status. WebKit changes will follow which test the reset status and determine what to do in response; for example, the policy might be to never restore a WebGL context which was lost (due to a GPU reset) and which was determined to be the guilty context. Tested manually with WebGL stress tests and verified on Linux and Windows that in at least some situations it is possible to detect guilty contexts and shut down the associated WebGL application. Some precision of this detection was recently lost and will need to be fixed in following CLs. Also updated and ran GPU unit tests. BUG=88106 TEST=none (tested manually; try servers) R=gman,apatrick,piman Review URL: http://codereview.chromium.org/7362005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92453 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 92429 - Detect and expose loss of OpenGL context using ↵kbr@chromium.org2011-07-131-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GL_ARB_robustness. (Regressed static initalizer size on Linux -- will need to reexamine code to understand why.) This initial patch changes the Linux port to use GLX_ARB_create_context_robustness when available, and tests periodically whether the context has been lost after each draw call and when making the context current. The detection of context loss also works with EGL and ANGLE, although it always reports an unknown reset status. WebKit changes will follow which test the reset status and determine what to do in response; for example, the policy might be to never restore a WebGL context which was lost (due to a GPU reset) and which was determined to be the guilty context. Tested manually with WebGL stress tests and verified on Linux and Windows that in at least some situations it is possible to detect guilty contexts and shut down the associated WebGL application. Some precision of this detection was recently lost and will need to be fixed in following CLs. Also updated and ran GPU unit tests. BUG=88106 TEST=none (tested manually; try servers) Review URL: http://codereview.chromium.org/7331020 TBR=kbr@chromium.org Review URL: http://codereview.chromium.org/7346032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92434 0039d316-1c4b-4281-b951-d872f2087c98
* Detect and expose loss of OpenGL context using GL_ARB_robustness.kbr@chromium.org2011-07-131-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This initial patch changes the Linux port to use GLX_ARB_create_context_robustness when available, and tests periodically whether the context has been lost after each draw call and when making the context current. The detection of context loss also works with EGL and ANGLE, although it always reports an unknown reset status. WebKit changes will follow which test the reset status and determine what to do in response; for example, the policy might be to never restore a WebGL context which was lost (due to a GPU reset) and which was determined to be the guilty context. Tested manually with WebGL stress tests and verified on Linux and Windows that in at least some situations it is possible to detect guilty contexts and shut down the associated WebGL application. Some precision of this detection was recently lost and will need to be fixed in following CLs. Also updated and ran GPU unit tests. BUG=88106 TEST=none (tested manually; try servers) Review URL: http://codereview.chromium.org/7331020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92429 0039d316-1c4b-4281-b951-d872f2087c98
* Automatically put all GL contexts associated with a particular GPU channel ↵apatrick@chromium.org2011-06-161-5/+8
| | | | | | | | | | | | | (and renderer process) in the same share group. This is work towards allowing offscreen canvas contexts to be allocated before compositor view contexts are created. This is a problem because a canvas might be created before the window it will be displayed in exists. This does not fix the bug on its own. BUG=80703 Review URL: http://codereview.chromium.org/7104148 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89395 0039d316-1c4b-4281-b951-d872f2087c98
* Reland 87371 - Support for glSetSurfaceCHROMIUM.apatrick@chromium.org2011-06-011-5/+10
| | | | | | | | This command allows a previously created GPU surface to be made current for a command buffer. There are no surfaces registered at this point so this command is currently a no-op. Review URL: http://codereview.chromium.org/7077001 Review URL: http://codereview.chromium.org/7006019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87408 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 87371 - Broke Compile - Support for glSetSurfaceCHROMIUM.rsesek@chromium.org2011-05-311-10/+5
| | | | | | | | | | This command allows a previously created GPU surface to be made current for a command buffer. There are no surfaces registered at this point so this command is currently a no-op. Review URL: http://codereview.chromium.org/7077001 TBR=apatrick@chromium.org Review URL: http://codereview.chromium.org/7027008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87373 0039d316-1c4b-4281-b951-d872f2087c98
* Support for glSetSurfaceCHROMIUM.apatrick@chromium.org2011-05-311-5/+10
| | | | | | | This command allows a previously created GPU surface to be made current for a command buffer. There are no surfaces registered at this point so this command is currently a no-op. Review URL: http://codereview.chromium.org/7077001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87371 0039d316-1c4b-4281-b951-d872f2087c98
* GLContext no longer holds a pointer to a GLSurface.apatrick@chromium.org2011-05-231-36/+17
| | | | | | | | | | This is part of an ongoing effort to treat GL contexts and GL surfaces as independent entities. TEST=run WebGL on mac, windows and linux, trybots BUG=none Review URL: http://codereview.chromium.org/7021014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86332 0039d316-1c4b-4281-b951-d872f2087c98
* Reland 85013 - Split GLContext::Create*GLContext into ↵apatrick@chromium.org2011-05-121-13/+8
| | | | | | | | | | | | GLSurface::Create*GLSurface plus a surface type independent GLContext::CreateGLContext TEST=try, including layout tests BUG=none Review URL: http://codereview.chromium.org/7013037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85207 0039d316-1c4b-4281-b951-d872f2087c98
* Revert "Reland 85013 - Split GLContext::Create*GLContext into ↵antonm@chromium.org2011-05-121-8/+13
| | | | | | | | | GLSurface::Create*GLSurface plus a surface type independent GLContext::CreateGLContext". git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85124 0039d316-1c4b-4281-b951-d872f2087c98
* Reland 85013 - Split GLContext::Create*GLContext into ↵apatrick@chromium.org2011-05-121-13/+8
| | | | | | | | | | | GLSurface::Create*GLSurface plus a surface type independent GLContext::CreateGLContext. TEST=webgl on windows and mac, trybots BUG=none Review URL: http://codereview.chromium.org/6997003 Review URL: http://codereview.chromium.org/7015016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85081 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 85013 - Split GLContext::Create*GLContext into ↵apatrick@chromium.org2011-05-111-8/+13
| | | | | | | | | | | | | GLSurface::Create*GLSurface plus a surface type independent GLContext::CreateGLContext. TEST=webgl on windows and mac, trybots BUG=none Review URL: http://codereview.chromium.org/6997003 TBR=apatrick@chromium.org Review URL: http://codereview.chromium.org/7015003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85016 0039d316-1c4b-4281-b951-d872f2087c98
* Split GLContext::Create*GLContext into GLSurface::Create*GLSurface plus a ↵apatrick@chromium.org2011-05-111-13/+8
| | | | | | | | | | surface type independent GLContext::CreateGLContext. TEST=webgl on windows and mac, trybots BUG=none Review URL: http://codereview.chromium.org/6997003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85013 0039d316-1c4b-4281-b951-d872f2087c98
* Removed "compositor" child window that was created by the GPU ↵apatrick@chromium.org2011-04-271-0/+10
| | | | | | | | process.Removed the sync IPC that it used to ask the browser process to resize on Linux. Adapted windows to use the same mechanism.TEST=test webgl pages on windows (ANGLE and GL), linux and mac, run try job on windows, linux, mac. checkdeps failure look unrelated to patch.BUG=77536 Review URL: http://codereview.chromium.org/6880218 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83248 0039d316-1c4b-4281-b951-d872f2087c98
* Adds GLContext::LosesAllContextsOnContextLost.amarinichev@chromium.org2011-04-131-0/+2
| | | | | | | | | | | | | | | GLContext::LosesAllContextsOnContextLost specifies whether or not all contexts need to be destroyed when recovering from lost context condition. GpuCommandBufferStub::OnFlush and GpuCommandBufferStub::OnAsyncFlush will instruct soon-to-be-renamed GpuRenderThread to close all channels when the context is lost and LosesAllContextsOnContextLost returns true. From the EGL 1.4 spec: "...On detection of this error, the application must destroy all contexts (by calling eglDestroyContext for each context). To continue rendering the application must recreate any contexts it requires, and subsequently restore any client API state and objects it wishes to use." However even with this change Angle still doesn't recover correctly. BUG=76753 TEST=breakpoint on eglDestroyContext Review URL: http://codereview.chromium.org/6813010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81437 0039d316-1c4b-4281-b951-d872f2087c98
* Refactor: Move app/gfx/gl ==> ui/gfx/glbacker@chromium.org2011-03-281-0/+82
This is the final patch in the sequence. Note that gl.gyp is introduced because dependency checking on the Mac is done on a per file (rather than per target) basis. BUG=none TEST=trybots Review URL: http://codereview.chromium.org/6722026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79599 0039d316-1c4b-4281-b951-d872f2087c98