{"action":"created","issue":{"url":"https://api.github.com/repos/javafxports/openjdk-jfx/issues/51","repository_url":"https://api.github.com/repos/javafxports/openjdk-jfx","labels_url":"https://api.github.com/repos/javafxports/openjdk-jfx/issues/51/labels{/name}","comments_url":"https://api.github.com/repos/javafxports/openjdk-jfx/issues/51/comments","events_url":"https://api.github.com/repos/javafxports/openjdk-jfx/issues/51/events","html_url":"https://github.com/javafxports/openjdk-jfx/pull/51","id":310434284,"node_id":"MDExOlB1bGxSZXF1ZXN0MTc4ODAxNDc5","number":51,"title":"JDK-8148129: Implement Accelerated composition for WebView","user":{"login":"ararunprasad","id":3874763,"node_id":"MDQ6VXNlcjM4NzQ3NjM=","avatar_url":"https://avatars2.githubusercontent.com/u/3874763?v=4","gravatar_id":"","url":"https://api.github.com/users/ararunprasad","html_url":"https://github.com/ararunprasad","followers_url":"https://api.github.com/users/ararunprasad/followers","following_url":"https://api.github.com/users/ararunprasad/following{/other_user}","gists_url":"https://api.github.com/users/ararunprasad/gists{/gist_id}","starred_url":"https://api.github.com/users/ararunprasad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ararunprasad/subscriptions","organizations_url":"https://api.github.com/users/ararunprasad/orgs","repos_url":"https://api.github.com/users/ararunprasad/repos","events_url":"https://api.github.com/users/ararunprasad/events{/privacy}","received_events_url":"https://api.github.com/users/ararunprasad/received_events","type":"User","site_admin":false},"labels":[{"id":837099838,"node_id":"MDU6TGFiZWw4MzcwOTk4Mzg=","url":"https://api.github.com/repos/javafxports/openjdk-jfx/labels/enhancement","name":"enhancement","color":"a2eeef","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":18,"created_at":"2018-04-02T09:01:25Z","updated_at":"2018-08-27T12:43:16Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/javafxports/openjdk-jfx/pulls/51","html_url":"https://github.com/javafxports/openjdk-jfx/pull/51","diff_url":"https://github.com/javafxports/openjdk-jfx/pull/51.diff","patch_url":"https://github.com/javafxports/openjdk-jfx/pull/51.patch"},"body":"This pull request is related to https://bugs.openjdk.java.net/browse/JDK-8148129.\r\n\r\n## How does WebKit paint?\r\n\r\nIn WebKit, each HTML element on a web page is stored as a tree of Node objects called the DOM tree.\r\n\r\nThen, each Node that produces visual output has a corresponding RenderObject, and they are stored in another tree, called the Render Tree.\r\n\r\nFinally, each RenderObject is associated with a RenderLayer. These RenderLayers exist so that the elements of the page are composited in the correct order to properly display overlapping content, semi-transparent elements, etc.\r\n\r\nIt is worth to mention that there is not a one-to-one correspondence between RenderObjects and RenderLayers, and that there is a RenderLayer tree as well.\r\n\r\nWebKit fundamentally renders a web page by traversing the RenderLayer tree.\r\n\r\n## What is the accelerated compositing?\r\n\r\nWebKit has two paths for rendering the contents of a web page: the software path and hardware accelerated path.\r\n\r\nThe software path is the traditional model, where all the work is done in the main CPU. In this mode, RenderObjects paint themselves into the final bitmap, compositing a final layer which is presented to the user.\r\n\r\nIn the hardware accelerated path, some of the RenderLayers get their own backing surface into which they paint. Then, all the backing surfaces are composited onto the destination bitmap, and this task is responsibility of the compositor.\r\n\r\nWith the introduction of compositing an additional conceptual tree is added: the GraphicsLayer tree, where each RenderLayer may have its own GraphicsLayer.\r\n\r\nIn the hardware accelerated path, it is used the GPU for compositing some of the RenderLayer contents.\r\n\r\nThe accelerated compositing involves offloading the compositing of the GraphicLayers onto the GPU, since it does the compositing very fast, releasing that burden to the CPU for delivering a better and more responsive user experience.\r\n\r\nAlthough there are other options, typically, OpenGL is used to render computing graphics, interacting with the GPU to achieve hardware acceleration. And WebKit provides cross-platform implementation to render with OpenGL.\r\n\r\n## How does WebKit paint using OpenGL?\r\n\r\nIdeally, we could go from the GraphicsLayer tree directly to OpenGL, traversing it and drawing the texture-backed layers with a common WebKit implementation.\r\n\r\nBut an abstraction layer was needed because different GPUs may behave differently, they may offer different extensions, and we still want to use the software path if hardware acceleration is not available.\r\n\r\nThis abstraction layer is known as the Texture Mapper, which is a light-weight scene-graph implementation, which is specially attuned for an efficient usage of the GPU.\r\n\r\nIt is a combination of a specialized accelerated drawing context (TextureMapper) and a scene-graph (TextureMapperLayer):\r\n\r\nThe TextureMapper is an abstract class that provides the necessary drawing primitives for the scene-graph. Its purpose is to abstract different implementations of the drawing primitives from the scene-graph.\r\n\r\nOne of the implementations is the TextureMapperGL, which provides a GPU-accelerated implementation of the drawing primitives, using shaders compatible with GL/ES 2.0.\r\n\r\nThere is a TextureMapperLayer which may represent a GraphicsLayer node in the GPU-renderable layer tree. The TextureMapperLayer tree is equivalent to the GraphicsLayer tree.\r\n\r\nCourtesy: https://blogs.igalia.com/vjaquez/2013/07/26/composited-video-support-in-webkitgtk/\r\n\r\n## JavaFX WebKit\r\n\r\nRight now we are disabling Accelerated Composition feature due to missing platform implementation.\r\n\r\nThere are three possible ways to implement Accelerated Composition,\r\n\r\n1. Implement GraphicsLayer interface for JavaFX platform using FX Scene Graph API. (~100 methods need to implemented)\r\n2. Reuse texture mapper - Directly implemented on top of OpenGL [ES2] - Plug few texture creation APIs (~10)\r\n3. Reuse texture mapper - Implement TextureMapper and BitmapTexture interfaces for JavaFX.\r\n\r\n### Approach 1 \r\nIt is going to be hard because of the amount of work involved in it. As of now Mac only platform reimplemented a GraphicsLayer for it's platform on top of CoreAnimation. QtWebKit folks attempted the same few years back, but they failed to do so due to scalability issues[1].\r\n\r\n### Approach 2 \r\nIt is used by all WebKit2 platforms (GTK, EFL, Mac, AppleWin). It uses OpenGL[ES2] [APIs directly](http://qtwebkit.blogspot.in/2010/10/texture-mapper-accelerated-compositing.html). Few GraphicsContext3D methods need to be implemented to create Textures and FBOs.\r\n\r\n### Approach 3\r\nTextureMapper and BitmapTexture interfaces need to be implemented on top of Prism's GraphicsContext\r\n\r\nThis pull request is based on `Approach 3`\r\n\r\n### Testing\r\nFollowing web pages has CSS 3D demonstration,\r\n\r\nhttps://webkit.org/blog-files/3d-transforms/poster-circle.html\r\nhttp://is-real.net/experiments/css3/wonder-webkit/\r\nhttps://webkit.org/blog-files/leaves \r\nhttps://desandro.github.io/3dtransforms/examples/cube-02-show-sides.html \r\nhttps://webkit.org/blog-files/3d-transforms/morphing-cubes.html \r\nhttps://davidwalsh.name/demo/css-cube.php \r\nhttps://www.smashingmagazine.com/2016/07/front-end-challenge-accepted-css-3d-cube"},"comment":{"url":"https://api.github.com/repos/javafxports/openjdk-jfx/issues/comments/416213921","html_url":"https://github.com/javafxports/openjdk-jfx/pull/51#issuecomment-416213921","issue_url":"https://api.github.com/repos/javafxports/openjdk-jfx/issues/51","id":416213921,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNjIxMzkyMQ==","user":{"login":"ararunprasad","id":3874763,"node_id":"MDQ6VXNlcjM4NzQ3NjM=","avatar_url":"https://avatars2.githubusercontent.com/u/3874763?v=4","gravatar_id":"","url":"https://api.github.com/users/ararunprasad","html_url":"https://github.com/ararunprasad","followers_url":"https://api.github.com/users/ararunprasad/followers","following_url":"https://api.github.com/users/ararunprasad/following{/other_user}","gists_url":"https://api.github.com/users/ararunprasad/gists{/gist_id}","starred_url":"https://api.github.com/users/ararunprasad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ararunprasad/subscriptions","organizations_url":"https://api.github.com/users/ararunprasad/orgs","repos_url":"https://api.github.com/users/ararunprasad/repos","events_url":"https://api.github.com/users/ararunprasad/events{/privacy}","received_events_url":"https://api.github.com/users/ararunprasad/received_events","type":"User","site_admin":false},"created_at":"2018-08-27T12:43:16Z","updated_at":"2018-08-27T12:43:16Z","author_association":"CONTRIBUTOR","body":"Hi @kevinrushforth, Shall I merge the change to develop branch?"}}
{"actor":{"display_login":"ararunprasad"}}