Use an explicit attribute to signal that a context prefers to use a discrete GPU
authorjamesr@google.com <jamesr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Mar 2012 23:52:56 +0000 (23:52 +0000)
committerjamesr@google.com <jamesr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Mar 2012 23:52:56 +0000 (23:52 +0000)
commit696d8f1a5e6f3757ad6d5728f886799b453fc9c3
treeddce65cb6b9d0c7b9a109036ca43ccd70d912e9f
parenta347ffbfe5a4b413143a8a669bf81bae95999e36
Use an explicit attribute to signal that a context prefers to use a discrete GPU
https://bugs.webkit.org/show_bug.cgi?id=80639

Reviewed by Stephen White.

Source/Platform:

Adds preferDiscreteGPU attribute to WebGraphicsContext3D::Attributes. Also remove the forUseOnAnotherThread
attribute, this has been dead code for a while now.

* chromium/public/WebGraphicsContext3D.h:
(WebKit::WebGraphicsContext3D::Attributes::Attributes):
(Attributes):

Source/WebCore:

On platforms that support both integrated and discrete GPUs and can dynamically switch between the two, we
sometimes have a specific preference for a given context. Specifically, contexts used for WebGL and canvas 2d
acceleration should use the discrete GPU if available, but compositor contexts can run fine on an integrated
GPU. Instead of attempting to infer the intent from examining other context attributes, this adds an explicit
attribute to control this behavior.

* html/canvas/WebGLRenderingContext.cpp:
(WebCore):
(WebCore::WebGLRenderingContext::create):
* platform/graphics/GraphicsContext3D.h:
(WebCore::GraphicsContext3D::Attributes::Attributes):
(Attributes):
* platform/graphics/gpu/SharedGraphicsContext3D.cpp:
(WebCore::SharedGraphicsContext3D::get):

Source/WebKit/chromium:

* src/GraphicsContext3DChromium.cpp:
(WebCore::GraphicsContext3DPrivate::getContextAttributes):
(WebCore::GraphicsContext3D::create):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::createCompositorGraphicsContext3D):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@110227 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/Platform/ChangeLog
Source/Platform/chromium/public/WebGraphicsContext3D.h
Source/WebCore/ChangeLog
Source/WebCore/html/canvas/WebGLRenderingContext.cpp
Source/WebCore/platform/graphics/GraphicsContext3D.h
Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp
Source/WebKit/chromium/src/WebViewImpl.cpp