SlideShare a Scribd company logo
T
S
@pati_gallardo
Isolating GPU Access
in its own process
Patricia Aas, T S
NDC TechTown 2018
T
S
@pati_gallardo
Patricia Aas - Consultant
C++ Programmer, Application Security
Currently : T S
Previously : Vivaldi, Cisco Systems, Knowit, Opera Software
Master in Computer Science - main language Java
Pronouns: she/her T
S
@pati_gallardo
- What is Chromium?
- Communication Architecture
- Passing A Video Frame
- Why have a GPU process?
- Can I Use?
@pati_gallardo
Some Browser Trivia @pati_gallardo
Konqueror Safari Chrome
Brave
Vivaldi
Opera
KHTML Webkit Blink
KDE Apple Google
Composition
The Browser Window is
composed of many views
produced by many
cooperating processes
@pati_gallardo
Demo of Composition
...I might have made a browser...
...I might have decided to have a demo last night...
@pati_gallardo
T
S
Renderer Process
Webkit
Browser Process
Software
Composition
Original Chromium Software Composition Architecture
GUI
Renderer Process
Webkit
Browser Process
GUI
Gpu Process
Hardware
Composition
Moving Composition to
the GPU Process
- What is Chromium?
- Communication Architecture
- Passing A Video Frame
- Why have a GPU process?
- Can I Use?
@pati_gallardo
Communication Architecture
@pati_gallardo
Process Architecture
Browser
Gpu BrokerZygote
Renderer
GpuZygote Init
Renderer
Renderer
Process
Relationships
Tabs
IPC &
Commands
Components of Communication
Renderer
Gpu Process
Browser Renderer
IPC Channels
Shared Memory
Gpu Memory
Buffers
Command Buffers
(Ring buffer)
Gpu Memory
Buffers
Gpu Memory
BuffersCommand
Command
Command
Faking OpenGL ES 2 (for fun and profit?)
Command CommandCommand Command
Render/Browser Process Gpu Process
Client Encoder/Proxy ServerDecoder/Validator
Shared
Memory
OpenGL ES 2
Interface
- Write Commands to
Command Buffer in Shared
Memory
- Update ‘put’ pointer
- Signal GPU process
@pati_gallardo
Client
Renderer / Browser
- Read Commands from
Command Buffer in Shared
Memory
- Validate Command and
arguments
- Make actual call@pati_gallardo
Server
GPU Process
Server
(Gpu
Process)
IPC Channel
Command
Client
(Renderer /
Browser
process)
CommandCommandCommand Command
Command Stream Command BufferCommand
Conceptual Model
Synchronization Architecture
@pati_gallardo
- Inserts a synchronization
fence into the command
stream
- Can be attached to a
resource (texture) that
cannot be used before all
previous commands have
been processed
@pati_gallardo
Sync Token
SyncToken
@pati_gallardo
SyncToken
CommandBufferNamespace
release_count_
CommandBufferId
Gpu
Process
Command Buffer
IPC Channel
Command Stream
Ordering
Barrier
Unverified Sync Token
Wait Sync Token
Wait Sync TokenCommandCommand
Command
Command
Command Command
CommandVerified Sync TokenBrowser
Renderer
Renderer
Command
Command
CommandCommand
CommandCommand
- What is Chromium?
- Communication Architecture
- Passing A Video Frame
- Why have a GPU process?
- Can I Use?
@pati_gallardo
Getting a Video Frame into the Page
@pati_gallardo
Software Decoded Video Frame
- Decoded Frame in Memory in RENDERER PROCESS
- GPU Composition is done in the GPU PROCESS
- The Frame needs to be uploaded to the GPU as a
Texture BEFORE it can be composed
@pati_gallardo
Decode Frame into
Renderer Memory
Copy Frame to GPU
Memory Buffer
Issue Draw
Commands to GPU
Wait
SyncToken
Using the SyncToken to
Reorder
Insert Some Hand Waving
The full architecture is
massive
We will follow one path
A software decoded video
frame
@pati_gallardo
“At a high enough level of abstraction,
everything looks the same.”
Law of PowerPoint Architecture
Patricia Aas, 2018
@pati_gallardo
Decode
@pati_gallardo
Decoding Video
Browser Process
Network
stack
Renderer
Decoder*
VideoFrame
Memory Buffer
Y Plane
U Plane
V Plane
Internet
* Sometimes decoding is done in the GPU process
@pati_gallardo
“Texturize”
1. Mailbox - unique name
2. SyncToken - fence
3. Texture Target Type (if
texture backed)
@pati_gallardo
Mailbox Holder
VideoFrame VideoFrame
Memory Buffer
V Plane
Y Plane
U Plane
Shared Memory Gpu ProcessRenderer
Transform the Video Frame into a GPU Resource
Y Plane Texture
UV Plane Texture
Plane Resources
Y Plane
GpuMemoryBuffer
UV Planes
GpuMemoryBuffer
MailboxHolder
SyncToken
MailboxMailbox
MailboxHolder
Prepare
@pati_gallardo
VideoFrame
Shared Memory
Gpu ProcessRenderer
Y Plane Texture
UV Plane Texture
Plane Resources
Y Plane
GpuMemoryBufferUV Planes
GpuMemoryBuffer
MailboxHolder
SyncToken
Mailbox
Mailbox
MailboxHolder
Transferrable
Resource
Texture filter
GL_LINEAR
Texture target
GL_TEXTURE_2D
Transferrable
Resource
Texture filter
GL_LINEAR
Texture target
GL_TEXTURE_2D
Id: 0
Id: 1
Move into a Transferrable Resource
Add to Render
@pati_gallardo
YUVVideoDrawQuad
Gpu ProcessRenderer
Y Plane Texture
UV Plane Texture
MailboxHolder
SyncToken
Mailbox
MailboxHolder
Mailbox
RenderPass
Resources
Id: 0 Id: 1
Transferrable
Resource
Texture filter
GL_LINEAR
Texture target
GL_TEXTURE_2D
Transferrable
Resource
Texture filter
GL_LINEAR
Texture target
GL_TEXTURE_2D
Id: 0
Id: 1
LayerTreeResourceProvider
Render!
@pati_gallardo
YUVVideoDrawQuad
Resources
Id: 0 Id: 1
Render The Frame!
GLRenderer::DrawYUVVideoQuad
clip_region
Gpu
Process
Wait Sync Token
Command
Command
Verified Sync Token
Browser
Renderer
CommandCommand
Command
GLES2 Extensions
@pati_gallardo
Examples : Chromium GLES2 Extensions
● CHROMIUM_image
● CHROMIUM_texture_mailbox
● CHROMIUM_sync_point
@pati_gallardo
VideoFrame
FrameResources
gfx::Size
PlaneResource
Mailbox
Unique Name
SyncToken
MailboxHolder
PlaneResource
PlaneResource
2. CreateImageCHROMIUM
GpuMemoryBuffer
GpuMemoryBufferVideoFramePool
Resource lifetime
ownership
MailboxHolder
MailboxHolder
3. BindTexImage2DCHROMIUM
image_id
1. BindTexture
texture_target
texture_id
1 to 3
1 to 3
- What is Chromium?
- Communication Architecture
- Passing A Video Frame
- Why have a GPU process?
- Can I Use?
@pati_gallardo
@pati_gallardo
Why Not Do GPU Composition in The Browser Process?
Well, Actually… On Android It Does… But I Digress…
@pati_gallardo
1. Security
2. Robustness
3. Dependency Separation
4. Performance ?
@pati_gallardo
Security
@pati_gallardo
Gives Fine Grained Control
Texture memory being leaked across processes
- From Other Programs on the Users Machine
- From Other Tabs
- From the Browser @pati_gallardo
User : Lxgr
security.stackexchange.com
Isolating GPU Access in its Own Process
Robustness
@pati_gallardo
Graphics Drivers Crashing the Browser
- Prevent bugs in GPU drivers from crashing the browser
- Make sure graphics code in WebGL can’t crash the browser
- Compensate for Graphics Driver Bugs/Inconsistencies
@pati_gallardo
Dependency Separation
@pati_gallardo
Keep GPU Process Dependencies Out
of the Renderer process
- Minimize the renderer sandbox
- Can Have Different Dependencies
@pati_gallardo
Performance? ¯_(ツ)_/¯
@pati_gallardo
“We can solve any problem by introducing an extra
level of indirection.
…except for the problem of too many levels of
indirection”
Fundamental theorem of software engineering
Andrew Koenig/Butler Lampson/David J. Wheeler
@pati_gallardo
- What is Chromium?
- Communication Architecture
- Passing A Video Frame
- Why have a GPU process?
- Can I Use?
@pati_gallardo
- Ok, but… Can I Use?
- Hm, don’t know…
Maybe? ¯_(ツ)_/¯
@pati_gallardo
Not Exactly Cut And Paste
@pati_gallardo
Check : <chrome>://gpu
@pati_gallardo
Three APIs are in use in the renderer
1. Opengl ES2
2. Chromium GL ES2 Extensions
3. Chromium APIs
@pati_gallardo
“All non-trivial abstractions, to
some degree, are leaky.”
Law of Leaky Abstractions
Joel Spolsky, 2002
@pati_gallardo
- Ok, ok, but… Can I Use?
@pati_gallardo
...I’d probably advice against it
@pati_gallardo
But knowing that it can be done
has value. It makes giving it a go
less crazy.
@pati_gallardo
So… maybe? ¯_(ツ)_/¯
@pati_gallardo
Patricia Aas, Consultant
T S
C++ and Application Security
T
S
@pati_gallardo
T
SD P
@pati_gallardo
T
S
Appendix / Some Notes
@pati_gallardo
High Level Design
Client - Server Architecture
Emulates OpenGl ES2.0
Actual Graphics Implementation is Platform Specific
Composition in GPU Process
Page Composition Controlled From Renderer
@pati_gallardo
Copy Video Frame To GPU Memory Buffer
Interesting Code
- CopyVideoFrameToGpuMemoryBuffers
- OutputFormat::NV12_SINGLE_GMB
- CopyRowsToNV12Buffer
- libyuv::I420ToNV12
- GpuMemoryBufferImplSharedMemory
@pati_gallardo
VideoFrame
FrameResources
gfx::Size
PlaneResource
Mailbox
Unique Name
SyncToken
MailboxHolder
PlaneResource
PlaneResource
2. CreateImageCHROMIUM
GpuMemoryBuffer
GpuMemoryBufferVideoFramePool
Resource lifetime
ownership
MailboxHolder
MailboxHolder
3. BindTexImage2DCHROMIUM
image_id
1. BindTexture
texture_target
texture_id
1 to 3
1 to 3
texture_target
Mac
GL_TEXTURE_RECTANGLE_ARB
Android/Linux
GL_TEXTURE_EXTERNAL_OES
Fallback
GL_TEXTURE_2D
@pati_gallardo
OES_EGL_image_external
Extension that creates EGLImage texture targets from EGLImages
“Each TEXTURE_EXTERNAL_OES texture object may require up to 3
texture image units for each texture unit to which it is bound.”
@pati_gallardo
CHROMIUM_image
CreateImageCHROMIUM
ReleaseTexImage2DCHROMIUM
BindTexImage2DCHROMIUM
DestroyImageCHROMIUM
@pati_gallardo
Share Group
- Command Buffers in the same share group
must be in the same Command Stream
- gl::GLFence
- eglFenceSyncKHR (EGL_KHR_fence_sync)
- eglWaitSyncKHR (EGL_KHR_wait_sync)
@pati_gallardo
VideoFrameProvider
Client
VideoFrameController
Client
InputHandler
Client
LayerTreeHostImpl VideoFrameCompositor
VideoRendererSink
OnBeginFrame
DidDrawFrame
UpdateCurrentFrame
GetCurrentFrame
PutCurrentFrame
VideoRendererImpl
Render
OnFrameDropped
VideoFrameProviderClientImplVideoFrameProviderClientImplVideoFrameProviderClientImpl
Video Frame Painting
VideoFrame
current_frame_
VideoLayerImpl
active_video_layer_
DecodersVideoResourceUpdater
Useful files to read
gpu_memory_buffer_video_frame_pool.cc
video_resource_updater.cc
gl_renderer.cc (GLRenderer::DrawYUVVideoQuad)
program_binding.cc (ProgramKey::YUVVideo)
@pati_gallardo
P f .
Patricia Aas, T S
@pati_gallardo
T
S
@pati_gallardo
T
S

More Related Content

PDF
NDC2017 언리얼엔진4 디버깅 101 - 게임 기획자, 프로그래머가 버그와 만났을 때 사용할 수 있는 지침들
PDF
〈야생의 땅: 듀랑고〉 서버 아키텍처 Vol. 3
PDF
MMOG Server-Side 충돌 및 이동처리 설계와 구현
PPTX
[0903 구경원] recast 네비메쉬
PDF
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버
PPTX
Quic을 이용한 네트워크 성능 개선
PPTX
UI아트 작업자를 위한 언리얼엔진4 UMG #1
PDF
게임을 위한 최적의 AWS DB 서비스 선정 퀘스트 깨기::최유정::AWS Summit Seoul 2018
NDC2017 언리얼엔진4 디버깅 101 - 게임 기획자, 프로그래머가 버그와 만났을 때 사용할 수 있는 지침들
〈야생의 땅: 듀랑고〉 서버 아키텍처 Vol. 3
MMOG Server-Side 충돌 및 이동처리 설계와 구현
[0903 구경원] recast 네비메쉬
[야생의 땅: 듀랑고] 서버 아키텍처 - SPOF 없는 분산 MMORPG 서버
Quic을 이용한 네트워크 성능 개선
UI아트 작업자를 위한 언리얼엔진4 UMG #1
게임을 위한 최적의 AWS DB 서비스 선정 퀘스트 깨기::최유정::AWS Summit Seoul 2018

What's hot (20)

PDF
임태현, MMO 서버 개발 포스트 모템, NDC2012
PDF
Multiplayer Game Sync Techniques through CAP theorem
PDF
심예람, <프로젝트DH> AI 내비게이션 시스템, NDC2018
PPTX
Ndc14 분산 서버 구축의 ABC
PPTX
Next-generation MMORPG service architecture
PDF
NDC12_Lockless게임서버설계와구현
PDF
이승재, 사례로 배우는 디스어셈블리 디버깅, NDC2014
PDF
Fault Tolerance 패턴
PDF
Python 게임서버 안녕하십니까 : RPC framework 편
PDF
실시간 게임 서버 최적화 전략
PDF
UI드자이너의 짧은 언리얼 UMG 사용기
PDF
NDC14 범용 게임 서버 프레임워크 디자인 및 테크닉
PPTX
191221 unreal engine 4 editor 확장하기
PDF
게임 서버 성능 분석하기
PDF
[NDC07] 게임 개발에서의 클라이언트 보안 - 송창규
PDF
양승명, 다음 세대 크로스플랫폼 MMORPG 아키텍처, NDC2012
PDF
클라우드 기반 Unity 게임 서버 구축, 60분이면 충분하다
PPTX
NDC 11 자이언트 서버의 비밀
PDF
테라로 살펴본 MMORPG의 논타겟팅 시스템
PDF
Android Chromium Rendering Pipeline
임태현, MMO 서버 개발 포스트 모템, NDC2012
Multiplayer Game Sync Techniques through CAP theorem
심예람, <프로젝트DH> AI 내비게이션 시스템, NDC2018
Ndc14 분산 서버 구축의 ABC
Next-generation MMORPG service architecture
NDC12_Lockless게임서버설계와구현
이승재, 사례로 배우는 디스어셈블리 디버깅, NDC2014
Fault Tolerance 패턴
Python 게임서버 안녕하십니까 : RPC framework 편
실시간 게임 서버 최적화 전략
UI드자이너의 짧은 언리얼 UMG 사용기
NDC14 범용 게임 서버 프레임워크 디자인 및 테크닉
191221 unreal engine 4 editor 확장하기
게임 서버 성능 분석하기
[NDC07] 게임 개발에서의 클라이언트 보안 - 송창규
양승명, 다음 세대 크로스플랫폼 MMORPG 아키텍처, NDC2012
클라우드 기반 Unity 게임 서버 구축, 60분이면 충분하다
NDC 11 자이언트 서버의 비밀
테라로 살펴본 MMORPG의 논타겟팅 시스템
Android Chromium Rendering Pipeline
Ad

Similar to Isolating GPU Access in its Own Process (20)

PDF
Isolating GPU Access in its Own Process (Foss-North 2018)
PDF
Linux Security and How Web Browser Sandboxes Really Work (NDC Oslo 2017)
PDF
WebRTC Standards & Implementation Q&A - getDisplayMedia 1.0
PDF
Multimedia in WebKitGtk+, past/present/future
PPTX
AI Workloads running on Cloud Run with GPUs
PPTX
Html5 Game Development with Canvas
PDF
Trying to build an Open Source browser in 2020
PDF
[workshop] The Revolutionary WebRTC
PDF
GDG DevFest Romania - Architecting for the Google Cloud Platform
PPTX
Webrtc plugins for Desktop Browsers
PPTX
Golang 101 for IT-Pros - Cisco Live Orlando 2018 - DEVNET-1808
PPT
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
PDF
Quick Review of Desktop and Native Apps using Javascript
PDF
Html5 Open Video Tutorial
PDF
Jason Anderson From Dirt Roads to Highways: Simplifying DevOps and Cloud Inf...
PDF
From Mediasoup WebRTC to Livekit Self-Hosted .pdf
PDF
WPE, a New WebKit Port Optimised for Embedded (IBC 2017)
PDF
Flowframes
PDF
Docker in Production: Reality, Not Hype - DevOps Chicago
PDF
Flutter Vikings 2022 - End to end IoT with Dart and Flutter
Isolating GPU Access in its Own Process (Foss-North 2018)
Linux Security and How Web Browser Sandboxes Really Work (NDC Oslo 2017)
WebRTC Standards & Implementation Q&A - getDisplayMedia 1.0
Multimedia in WebKitGtk+, past/present/future
AI Workloads running on Cloud Run with GPUs
Html5 Game Development with Canvas
Trying to build an Open Source browser in 2020
[workshop] The Revolutionary WebRTC
GDG DevFest Romania - Architecting for the Google Cloud Platform
Webrtc plugins for Desktop Browsers
Golang 101 for IT-Pros - Cisco Live Orlando 2018 - DEVNET-1808
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
Quick Review of Desktop and Native Apps using Javascript
Html5 Open Video Tutorial
Jason Anderson From Dirt Roads to Highways: Simplifying DevOps and Cloud Inf...
From Mediasoup WebRTC to Livekit Self-Hosted .pdf
WPE, a New WebKit Port Optimised for Embedded (IBC 2017)
Flowframes
Docker in Production: Reality, Not Hype - DevOps Chicago
Flutter Vikings 2022 - End to end IoT with Dart and Flutter
Ad

More from Patricia Aas (20)

PDF
The fundamental misunderstanding in Team Topologies
PDF
NDC TechTown 2023_ Return Oriented Programming an introduction.pdf
PDF
Telling a story
PDF
Return Oriented Programming, an introduction
PDF
I can't work like this (KDE Academy Keynote 2021)
PDF
Dependency Management in C++ (NDC TechTown 2021)
PDF
Introduction to Memory Exploitation (Meeting C++ 2021)
PDF
Classic Vulnerabilities (MUCplusplus2022).pdf
PDF
Classic Vulnerabilities (ACCU Keynote 2022)
PDF
Introduction to Memory Exploitation (CppEurope 2021)
PDF
Thoughts On Learning A New Programming Language
PDF
Trying to build an Open Source browser in 2020
PDF
DevSecOps for Developers, How To Start (ETC 2020)
PDF
The Anatomy of an Exploit (NDC TechTown 2019)
PDF
Elections: Trust and Critical Infrastructure (NDC TechTown 2019)
PDF
The Anatomy of an Exploit (NDC TechTown 2019))
PDF
Elections, Trust and Critical Infrastructure (NDC TechTown)
PDF
Survival Tips for Women in Tech (JavaZone 2019)
PDF
Embedded Ethics (EuroBSDcon 2019)
PDF
Chromium Sandbox on Linux (NDC Security 2019)
The fundamental misunderstanding in Team Topologies
NDC TechTown 2023_ Return Oriented Programming an introduction.pdf
Telling a story
Return Oriented Programming, an introduction
I can't work like this (KDE Academy Keynote 2021)
Dependency Management in C++ (NDC TechTown 2021)
Introduction to Memory Exploitation (Meeting C++ 2021)
Classic Vulnerabilities (MUCplusplus2022).pdf
Classic Vulnerabilities (ACCU Keynote 2022)
Introduction to Memory Exploitation (CppEurope 2021)
Thoughts On Learning A New Programming Language
Trying to build an Open Source browser in 2020
DevSecOps for Developers, How To Start (ETC 2020)
The Anatomy of an Exploit (NDC TechTown 2019)
Elections: Trust and Critical Infrastructure (NDC TechTown 2019)
The Anatomy of an Exploit (NDC TechTown 2019))
Elections, Trust and Critical Infrastructure (NDC TechTown)
Survival Tips for Women in Tech (JavaZone 2019)
Embedded Ethics (EuroBSDcon 2019)
Chromium Sandbox on Linux (NDC Security 2019)

Recently uploaded (20)

PPTX
Online Work Permit System for Fast Permit Processing
PPT
Introduction Database Management System for Course Database
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Digital Strategies for Manufacturing Companies
PDF
medical staffing services at VALiNTRY
PPTX
ai tools demonstartion for schools and inter college
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Understanding Forklifts - TECH EHS Solution
PDF
AI in Product Development-omnex systems
PDF
System and Network Administration Chapter 2
Online Work Permit System for Fast Permit Processing
Introduction Database Management System for Course Database
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
ISO 45001 Occupational Health and Safety Management System
How to Choose the Right IT Partner for Your Business in Malaysia
CHAPTER 2 - PM Management and IT Context
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
2025 Textile ERP Trends: SAP, Odoo & Oracle
Design an Analysis of Algorithms II-SECS-1021-03
How Creative Agencies Leverage Project Management Software.pdf
Digital Strategies for Manufacturing Companies
medical staffing services at VALiNTRY
ai tools demonstartion for schools and inter college
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Navsoft: AI-Powered Business Solutions & Custom Software Development
Odoo POS Development Services by CandidRoot Solutions
Understanding Forklifts - TECH EHS Solution
AI in Product Development-omnex systems
System and Network Administration Chapter 2

Isolating GPU Access in its Own Process