what’s surface cc chromium

Goals

Surfaces are a concept to allow graphical embedding of heterogeneous untrusting clients efficiently into one scene.

  • embedding – the core concept of a surface is that it may contain references to surfaces from the same client or different clients
  • heterogeneous – rendering to a surface does not require that a client use a specific library or toolkit, only that it be able to speak the surface protocol
  • untrusting – a client does not have to trust its embedding or embedded clients in order to render into a surface. Having access to a surface from another client does not provide any access to that surface’s contents.

  • efficiently – rendering to a surface should have minimal overhead compared to rendering directly to the native screen and should be equally efficient regardless of the embedding depth.

Use cases

In Chromium, we can use surfaces for many of the embedding cases we have today:

  • embedding a blink-rendered tab in the browser’s UI
  • embedding a plugin or video within a page
  • embedding an iframe rendered from one process into an iframe rendered in a different process

Concepts

A Surface is a fixed size rectangle that can be rendered into by submitting frames. A client can create a surface by asking the SurfaceManager to construct one for a client (possibly itself) to render into. A Surface can be identified by two IDs generated by the SurfaceManager – one for identifying the surface when issuing frames to render to the surface, one to identify the surface when rendering from it to embed.

A Frame is a series of quads to draw, some of which may reference other surfaces. A frame also contains a set of resources and associated synchronization points. Here’s a (rough) outline of the structure of a frame:

  • List of prerequisite sequence numbers for the frame
  • List of resources with associated synchronization points
  • List of passes, each of which contains
  • Transform of the pass
  • Damage and output rects
  • List of quads within the pass, each of which has
    • Transform / rect / clip state / opacity / blend mode / etc (may be shared with other quads)
    • Material – maybe solid color, texture, surface, etc
    • Material-specific properties such as color, texture ID, surface ID

The act of submitting a frame generates an implicit sequence number that can be used to synchronize presentation with other frames, potentially submitted by other clients. A surface identifier + sequence number tuple unique identifies a frame for all clients of an instance of the service (and there will typically only be one surface service in the system).

A Display is a physical display (when Chromium is the operating system) or a native OS window object (when Chromium is running inside another operating system). The surface service provides a surface for each display for a designated client to issue frames to. In the case of Chromium running on windows, for example, the surface service would generate a surface identifier for each top-level HWND and provide them to the browser UI code to render into.

Of particular note is that on Mac we can construct a display wrapping an IOSurface for each tab and let CoreAnimation composite the tabs with the browser UI. This does not provide the bandwidth benefits of ÜberCompositor but it does allow everything outside of the browser process to use the same presentation path as platforms using Aura/ÜberCompositor and reduce a lot of platform-specific complexity in our code.

Processing model

For clients:

Whenever a client wants to update the rendering of a surface it owns, it generates a new frame and submits it to the SurfaceManager. This frame may contain quads that references surfaces being embedded by this client. A client does not have to issue a new frame whenever a surface it embeds updates its rendering. Issuing a frame also transfers ownership of resources (GL textures, software shared memory buffers).

Whenever a client wants to start embedding another client, it first generates an appropriately sized surface through the SurfaceManager and then sends it to the client. The embedding client can start immediately issuing frames referencing the new surface or it may wait to receive an acknowledgement from the embedded client that the surface is ready, depending on the desired application semantics.

Resizing is analogous to creating a new surface.

For the service:

Whenever the manager receives a new frame, it performs some sanity checks on the frame (i.e. making sure it only references frames that the client should be referencing) and then saves it in the surface’s potential frame list along. Whenever this frame’s prerequisites are satisfied, it is moved into the eligible frame list for the surface. Only one frame can be rendered for a given surface at a time, but a client is allowed to pipeline multiple frames.

Whenever a display is ready for a new frame and something has changed, the service aggregates frames from the surfaces that contribute to that display and then renders them. The aggregation algorithm is simple:

When the service knows that it will never render from a given frame again – for instance if it has started rendering a newer frame for a given surface or if the embedding client has told the manager that it wants to destroy a surface – the service sends an acknowledgement to the client with a set of resources to return to the client along with associated synchronization points.

SurfaceService structure

The SurfaceManager keeps track of all surfaces created in the system. For each surface, it keeps track of:

  • The client that created the surface and will be embedding (rendering from) the surface
  • The client that will be rendering into the surface (may be the same as the creator)
  • List of submitted frames for the given surface

The ResourceProvider keeps track of resources that the service has ownership of and how to return ownership to clients. For GL textures, for instance, this means managing mailboxes.

The DisplayManager keeps track of all displays that the surface service is responsible for rendering into. For each display, the DisplayManager owns a surface used to render into the display as well as some state for hit testing against surfaces and determining which surfaces contributed to the display’s last produced frame.

There is only one instance of each of the Manager types in an instance of the service.

A SurfaceAggregator implements the aggregation algorithm and knows how to submit an aggregated frame to a renderer. Aggregators are (nearly) stateless and can be created whenever necessary.

A Renderer translates an aggregated frame into draw commands appropriate for a given display. In GPU rendering mode, this means GL draw calls and a swap into the display. In software rendering mode, this means skia calls into the appropriate SkCanvas.

Synchronization

Resource synchronization is the same as it is with ÜberCompositor, with the slight simplification that the pipeline depth is not influenced by the nesting level of the embedding.

Clients can optionally synchronize frames with each other using the prerequisite / postrequisite synchronization points. This has to be done with care but can be useful to do things like prevent resize guttering. 99% of the use cases in Chromium will not require any explicit synchronization between different surfaces – in nearly all cases it’s perfectly fine (and desirable) to let clients render independently of each other.

Here’s an example of a possible gutter prevention algorithm. Assume that client Alice is embedding client Bob and wants to resize its surface for Bob from 100×100 to 200×200. If Bob responds fast enough to Alice’s resize message, Alice wants to make sure that Bob shows up at 200×200 in the same frame as Alice’s decorations.

Start conditions:

Alice is embedding Bob. Alice owns a 100×100 surface that Bob is rendering into. Alice and Bob both have pending frames referencing the 100×100 surface.

Sequence for Alice:

  • Alice decides to resize Bob to 200×200 and change decorations that Alice is rendering.

  • Alice requests a new 200×200 surface from the SurfaceManager

  • Alice sends Bob a resize request and a handle to the new 200×200 surface
  • Alice starts a timeout
  • If Bob responds to the resize message before the timeout:
    • Alice issues the first frame referencing the 200×200 surface with a prerequisite sequence number that it got from Bob
  • If Bob doesn’t respond before the timeout:
    • Alice issues a frame referencing the 100×100 surface and appropriate quads to stretch or gutter as appropriate
  • Regardless of when the resize response comes in, Alice issues a destroy call for the 100×100 surface to the SurfaceManager after starting to issues frames referencing the 200×200 surface.

Sequence for Bob:

  • Bob receives a resize message with the new surface identifier
  • Bob issues a new frame appropriate for a 200×200 surface which generates a sequence number for the frame
  • Bob sends a resize response to Alice with this sequence number

End conditions:

Alice and Bob are referencing a 200×200 surface

The SurfaceManager knows that the 100×100 surface can be destroyed as soon as the service no longer needs it.

If Bob is slow to respond, Alice may stall or submit one or more frames that gutter. However if Bob responds fast enough the service can guarantee using the sequence numbers that the new frame from Bob and the new decorations from Alice show up on screen at the same time.

Original: https://www.cnblogs.com/bigben0123/p/15234500.html
Author: Bigben
Title: what’s surface cc chromium

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/551293/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

  • delphi和go以及其他语言基于结构的数据序列和还原

    delphi和go以及其他语言基于结构的数据序列和还原 数据序列基于结构,是跨语言、平台能够实现数据标准的基础。 GO基于结构的序列 DELPHI基于结构的序列 Original:…

    技术杂谈 2023年5月30日
    092
  • IPV6折腾小计——(下)

    继上文一番相关知识整理后,便开始了ipv6折腾之旅。 电脑支持Ipv6 现在的路由器和光猫基本都支持ipv6,开启设置即可 开启ipv6后,便可以查看到ipv6的地址了: 此时可以…

    技术杂谈 2023年5月30日
    094
  • java内存区域模型和详解

    一,概述 java虚拟机运行时数据区模型图: 主要包括:程序计数器,java虚拟机栈,本地方法栈,java 堆,方法区(元空间)。 其中堆和方法区由所有线程共享的数据区;程序计数器…

    技术杂谈 2023年7月11日
    074
  • git学习(一)-fork操作

    fork操作 对于某一个项目来说,如果自己不属于开发者中的一员,那么只能先fork别人的代码,然后将代码拉取到本地进行修改之后,再向原来的项目发起pull request。 for…

    技术杂谈 2023年7月24日
    091
  • 测试左移和测试右移,我们为何要“上下求索”?

    转载请注明出处❤️ 作者:测试蔡坨坨 原文链接:caituotuo.top/7b9ad46d.html 你好,我是测试蔡坨坨。 今天,我们来聊一聊测试左移和测试右移。 传统测试流程…

    技术杂谈 2023年7月11日
    079
  • 常用开发工具的安装和使用

    常用开发工具的安装和使用 IntelliJ IDEA的安装和使用 安装教程 1.教育优惠 JetBrains开发的众多开发工具提供教育优惠,可以方便在校学生使用。通过学校提供的教育…

    技术杂谈 2023年7月23日
    087
  • 面试中关于字符串及常量池的一些考点

    字符串及常量池在面试中很容易被问到,前2天在为公司做校招面试时,发现很多同学对相关细节不太清楚,在此梳理一下: 先回顾一下java中字符串的设计,大家都知道jvm中有所谓的&#82…

    技术杂谈 2023年5月31日
    085
  • rocketmq 精华

    介绍 rocket mq 翻译成中文就是火箭消息队列,从名字就可以看出来,它是一个很快的消息队列… rocket mq 是 阿里巴巴研制的后面贡献给 apache 基金…

    技术杂谈 2023年7月25日
    079
  • sliderView海报滑动轮播

    sliderView为容器型元素,与container非常类似,其包含私有styleBinding元素如下: 属性 值 说明 isPointHide false 是否隐藏轮播的圆点…

    技术杂谈 2023年6月1日
    089
  • Docker Manager for Docker Swarm deploy

    一、Swarm概述 Swarm是Docker公司在2014年12月初发布的一套较为简单的工具,用来管理Docker集群,它将一群Docker宿主机变成一个单一的,虚拟的主机。Swa…

    技术杂谈 2023年7月10日
    098
  • 参加胶东开发者技术大会有感

    2015年的时候,也是在12月,我和Bob去北京参加了”全球架构师峰会”,在那次会议上,来自百度、腾讯、阿里巴巴、京东、美团、新浪微博、Twitter等公司…

    技术杂谈 2023年5月31日
    0113
  • 三、DOS命令

    常用的DOS命令 #盘符切换 D: #查看当前目录下的所有文件 dir #切换目录 cd+空格+/d+空格+路径 #返回上一级 cd+空格+.. #清理屏幕 cls #退出终端 e…

    技术杂谈 2023年6月21日
    093
  • 树莓派远程连接工具VNC使用教程

    树莓派远程连接工具VNC使用教程 背景故事 树莓派作为一款迷你小主机,大部分的使用场景都会用到远程调试,远程调试用到最多的方式一般就是VNC和SSH,VNC是远程桌面型的远程方式,…

    技术杂谈 2023年7月23日
    092
  • Git 不识别文件名字母大小写变化

    问题 今天为一个项目撰写持续构建计划,撰写 Jenkinsfile 之后进行构建时报错: [2022-05-23 16:54:21] unable to prepare conte…

    技术杂谈 2023年7月11日
    067
  • 学到了_SpringBoot项目整合ElasticSearch7.8.1(增删改查索引,增删改查文档)

    创建SpringBoot工程,更改pom文件 以下依赖全部使用到了,所以务必全部添加 <?xml version="1.0" encoding=&quot…

    技术杂谈 2023年7月25日
    099
  • Mysql 事务(标贝科技)

    @ 事务 InnoDB对ACID的支持 隔离级别 + 不同隔离级别下读读取数据可能出现的情况 不可重复读和幻读区别 redo log (共享表空间) redo log block …

    技术杂谈 2023年7月25日
    099
亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球