Android系统_Surface绘制流程

目录

一,框架图

二,核心代码


一,框架图

对上面这张图的总结

二,核心代码

/Volumes/aosp/android-8.1.0_r52/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp

void SurfaceFlinger::onMessageReceived(int32_t what) {ATRACE_CALL();switch (what) {case MessageQueue::INVALIDATE: {bool frameMissed = !mHadClientComposition &&mPreviousPresentFence != Fence::NO_FENCE &&(mPreviousPresentFence->getSignalTime() ==Fence::SIGNAL_TIME_PENDING);ATRACE_INT("FrameMissed", static_cast<int>(frameMissed));if (mPropagateBackpressure && frameMissed) {signalLayerUpdate();break;}// Now that we're going to make it to the handleMessageTransaction()// call below it's safe to call updateVrFlinger(), which will// potentially trigger a display handoff.updateVrFlinger();bool refreshNeeded = handleMessageTransaction();refreshNeeded |= handleMessageInvalidate();refreshNeeded |= mRepaintEverything;if (refreshNeeded) {// Signal a refresh if a transaction modified the window state,// a new buffer was latched, or if HWC has requested a full// repaintsignalRefresh();}break;}case MessageQueue::REFRESH: {handleMessageRefresh();break;}}

bool SurfaceFlinger::handleMessageInvalidate() {ATRACE_CALL();return handlePageFlip();
}
bool SurfaceFlinger::handlePageFlip()
{ALOGV("handlePageFlip");nsecs_t latchTime = systemTime();bool visibleRegions = false;bool frameQueued = false;bool newDataLatched = false;// Store the set of layers that need updates. This set must not change as// buffers are being latched, as this could result in a deadlock.// Example: Two producers share the same command stream and:// 1.) Layer 0 is latched// 2.) Layer 0 gets a new frame// 2.) Layer 1 gets a new frame// 3.) Layer 1 is latched.// Display is now waiting on Layer 1's frame, which is behind layer 0's// second frame. But layer 0's second frame could be waiting on display.mDrawingState.traverseInZOrder([&](Layer* layer) {if (layer->hasQueuedFrame()) {frameQueued = true;if (layer->shouldPresentNow(mPrimaryDispSync)) {mLayersWithQueuedFrames.push_back(layer);} else {layer->useEmptyDamage();}} else {layer->useEmptyDamage();}});for (auto& layer : mLayersWithQueuedFrames) {const Region dirty(layer->latchBuffer(visibleRegions, latchTime));layer->useSurfaceDamage();invalidateLayerStack(layer, dirty);if (layer->isBufferLatched()) {newDataLatched = true;}}mVisibleRegionsDirty |= visibleRegions;// If we will need to wake up at some time in the future to deal with a// queued frame that shouldn't be displayed during this vsync period, wake// up during the next vsync period to check again.if (frameQueued && (mLayersWithQueuedFrames.empty() || !newDataLatched)) {signalLayerUpdate();}// Only continue with the refresh if there is actually new work to doreturn !mLayersWithQueuedFrames.empty() && newDataLatched;
}
void SurfaceFlinger::handleMessageRefresh() {ATRACE_CALL();mRefreshPending = false;nsecs_t refreshStartTime = systemTime(SYSTEM_TIME_MONOTONIC);preComposition(refreshStartTime);rebuildLayerStacks();setUpHWComposer();doDebugFlashRegions();doComposition();postComposition(refreshStartTime);mPreviousPresentFence = mHwc->getPresentFence(HWC_DISPLAY_PRIMARY);mHadClientComposition = false;for (size_t displayId = 0; displayId < mDisplays.size(); ++displayId) {const sp<DisplayDevice>& displayDevice = mDisplays[displayId];mHadClientComposition = mHadClientComposition ||mHwc->hasClientComposition(displayDevice->getHwcDisplayId());}mLayersWithQueuedFrames.clear();
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/27429.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

CDefView::_OnFSNotify函数分析

进入CDefView::_OnFSNotify函数时状态栏 _UpdateStatusBar函数之后增加一个对象&#xff0c;变成7个对象。 LRESULT CDefView::_OnFSNotify(LONG lNotification, LPCITEMIDLIST* ppidl) { LPITEMIDLIST pidl; LPCITEMIDLIST pidlItem; // we may be registered for no…

KVMOVS组网配置案例-4

0.配置要求 1.使用ovs创建一个网桥&#xff0c;网桥上添加宿主机eth0接口&#xff0c;接口为trunk,可转发所有vlan的数据2.使用KVM创建并图形安装两个linux虚拟机vm1,vm2。3.vm1关联ovs的vlan10接口&#xff0c;vm2关联ovs的vlan20接口。4.vm1获取vlan10的IP地址&#xff0c;v…

C#—Settings配置详解

C#—Settings配置详解 在C#项目中&#xff0c;全局配置通常指的是应用程序的设置&#xff08;settings&#xff09;&#xff0c;这些设置可以跨多个类或组件使用&#xff0c;并且通常用于存储应用程序的配置信息&#xff0c;如数据库连接字符串、用户偏好设置等。 Settings配置…

Redis 哨兵模式

哨兵模式&#xff08;Sentinel&#xff09; 是 Redis 提供的一种高可用性&#xff08;High Availability, HA&#xff09;解决方案&#xff0c;用于监控和管理 Redis 主从架构中的主节点&#xff08;Master&#xff09;和从节点&#xff08;Slave&#xff09;。当主节点出现故障…

【大厂AI实践】美团:美团智能客服核心技术与实践

【大厂AI实践】美团&#xff1a;美团智能客服核心技术与实践 &#x1f31f; 嗨&#xff0c;你好&#xff0c;我是 青松 &#xff01; &#x1f308; 自小刺头深草里&#xff0c;而今渐觉出蓬蒿。 NLP Github 项目推荐&#xff1a; 【AI 藏经阁】&#xff1a;https://gitee.com…

linux离线安装miniconda环境

1 下载安装包 可以在官网下载最新版 https://www.anaconda.com/download/success#miniconda 或者在软件目录选择合适的版本 https://repo.anaconda.com/miniconda/ 安装包传入离线服务器 ./Miniconda3-py311_24.9.2-0-Linux-x86_64.sh2 运行安装包 ./Miniconda3-py311_24…

线程相关八股

1. 线程和进程的区别&#xff1f; 进程&#xff1a;进程可以简单理解为进行一个程序&#xff0c;比如说我们打开一个浏览器&#xff0c;打开一个文本&#xff0c;这就是开启了一个进程&#xff0c;一个进程想要在计算机中运行&#xff0c;需要将程序交给CPU&#xff0c;将数据…

水仙花数(华为OD)

题目描述 所谓水仙花数&#xff0c;是指一个n位的正整数&#xff0c;其各位数字的n次方和等于该数本身。 例如153是水仙花数&#xff0c;153是一个3位数&#xff0c;并且153 13 53 33。 输入描述 第一行输入一个整数n&#xff0c;表示一个n位的正整数。n在3到7之间&#x…

写一写idea中使用tomcat启动activiti过程

一 环境 tomcat 9.0.62 activiti的war包版本 7.1.0.M6 二 操作 官网下载&#xff1a;https://www.activiti.org/get-started 2.1 先在idea中编辑配置 2.2 点击加号然后选择tomcat本地进行确认 2.3 点击部署之后下边小加号 选择第二个之后就是选择自己想要使用tomcat启动的…

【每日一题 | 2025】2.24 ~ 3.2

个人主页&#xff1a;Guiat 归属专栏&#xff1a;每日一题 文章目录 1. 【2.24】P10424 [蓝桥杯 2024 省 B] 好数2. 【2.25】P8665 [蓝桥杯 2018 省 A] 航班时间3. 【2.26】P10905 [蓝桥杯 2024 省 C] 回文字符串4. 【2.27】P10425 [蓝桥杯 2024 省 B] R 格式5. 【2.28】P10426…

11.【线性代数】——矩阵空间,秩1矩阵,小世界图

十一 矩阵空间&#xff0c;秩1矩阵&#xff0c;小世界图 1. 矩阵空间交集 和 和集 2. 所有解空间3. r 1 r1 r1的矩阵4. 题目5. 小世界图 空间&#xff1a;组成空间的元素的线性组合都在这个空间中。 1. 矩阵空间 举例&#xff1a;矩阵空间&#xff08; M M M 所有3x3的矩阵&…

我代表中国受邀在亚马逊云科技全球云计算大会re:Invent中技术演讲

大家好我是小李哥&#xff0c;本名叫李少奕&#xff0c;目前在一家金融行业公司担任首席云计算工程师。去年5月很荣幸在全球千万名开发者中被选为了全球亚马逊云科技认证技术专家&#xff08;AWS Hero&#xff09;&#xff0c;是近10年来大陆地区仅有的第9名大陆专家。同时作为…

【Linux学习笔记】Linux基本指令及其发展史分析

【Linux学习笔记】Linux基本指令及其发展史分析 &#x1f525;个人主页&#xff1a;大白的编程日记 &#x1f525;专栏&#xff1a;Linux学习笔记 文章目录 【Linux学习笔记】Linux基本指令及其发展史分析前言一. Linux发展史1.1 UNIX发展的历史1.2 Linux发展历史1.3 开源1.4…

gradle libs.versions.toml文件

1.libs.versions.toml介绍2.创建libs.versions.toml文件3.libraries5.versions6.plugins7.bundles 1.libs.versions.toml介绍 下图是官网介绍 意思就是说项目所有插件和库的依赖版本都统一在这个文件配置。 文件中有以下四个部分 versions, 申明要使用的插件和库的版本号的…

【Git】Ubuntu 安装 Git Large File Storage(LFS)以及使用 Git LFS 下载

【Git】Ubuntu 安装 Git Large File Storage&#xff08;LFS&#xff09;以及使用 Git LFS 下载 1 安装1.1 使用脚本安装1.2 使用 packagecloud 安装 2 使用2.1 下载 1 安装 1.1 使用脚本安装 参考文档: Link 下载安装包: Link 解压安装包 tar -xzvf git-lfs-linux-amd64-v3.…

c++进阶--多态

大家好&#xff0c;今天我们来学习c进阶的第二课&#xff1a;多态。c的三大特性就是封装&#xff0c;继承和多态。那么今天我们就来学习一下多态。 目录 1. 多态的概念 2. 多态的定义及实现 2.1 多态的构成条件 2.1.1 实现多态还有两个必须重要条件 2.2 虚函数 2.3 虚函…

2月28日,三极管测量,水利-51单片机

众所周知&#xff0c;三极管&#xff08;BJT&#xff09;有三个管脚&#xff0c;基极&#xff08;B&#xff09;、集电极&#xff08;C&#xff09;、发射极&#xff08;E&#xff09;&#xff0c;在实际应用中&#xff0c;不可避免地会遇到引脚辨别的问题。接下来就讲下三极管…

解决git clone下载慢或者超时问题

在网上找了很多办法&#xff0c;直接最简单的使用镜像网站下载。 国内可用的镜像网站有&#xff1a; https://github.com.cnpmjs.org # 服务器位于香港https://gitclone.com # 服务器位于杭州https://doc.fastgit.org # 服务器位于香港 例如&#xff1a;将 git clone https:…

SQL 全面指南:从基础语法到高级查询与权限控制

SQL&#xff1a;全称 Structured Query Language&#xff0c;结构化查询语言。操作关系型数据库的编程语言&#xff0c;定义了一套操作关系型数据库统一标准 。 一、SQL通用语法 在学习具体的SQL语句之前&#xff0c;先来了解一下SQL语言的同于语法。 1). SQL语句可以单行或多…

【AD】4-8 AD集成库的创建与安装

集成库&#xff1a;集成好元件信息、元件原理图库、PCB封装库、3D模型等的元件库&#xff0c;直接调用器件不可修改。 AD集成库创建 1.文件—新的—库&#xff0c;选择库工程&#xff0c;右键保存 2.将原理图库和PCB封装库复制到创建的集成库文件夹&#xff0c;并右键单击库工…