surfaceflinger

Android系统显示原理

核能气质少年 提交于 2019-12-18 05:13:17
一.Android系统显示原理 Android的显示过程简单概括为:Android 应用程序把经过测量、布局、绘制后的surface缓存数据,通过surfaceFlinger把数据渲染到显示屏幕上,通过Android的刷新机制来刷新数据。也就是说应用层负责绘制,系统层负责渲染,通过进程间通信把应用层需要绘制的数据传递给系统层服务,系统层服务通过刷新机智把数据刷新到屏幕。 通过阅读Android系统的源码可以了解显示的流程,Android的图形显示系统采用的是client/server架构。SurfaceFlinger(server)由C++代码编写。Client端代码分为两部分,一部分是由java提供给应用使用的API,另一部分是由C++写成的底层具体实现。 二.绘制原理 绘制任务是由应用层发起的,最终通过系统层绘制到硬件屏幕上显示的。 1.应用层: 图1.1 如上图,这是一个UI界面,有很多不同层次的基本元素(view)构成,整体是一个树形结构,不同的镶嵌,存在不同的父子关系,这是一个递归的渲染过程。在Android 中,iew绘制有三个核心的步骤,,如图1.2,通过measure来绘制view的大小,通过layout确定view的位置,最后通过draw绘制到surface,在Android源码中,viewRootImp类的performTraversals()方法中

What does “SurfaceView” represent in systrace result?

邮差的信 提交于 2019-12-13 03:01:23
问题 When investigating an game play stuttering issue, I found that bewteen eglSwapBuffer() from the game and postFramebuffer() in surfaceflinger, there is always a delay in "SurfaceView" lasts from 0.5ms to 10ms which seems pretty random and irrelevant to CPU load. What does this really represents? Does it has anything to do with VSYNC point of display? http://i.stack.imgur.com/n8MvG.png 回答1: That row represents a BufferQueue. The height of the element (0 or 1 in the visible portion of your trace

how to show an image without surfaceflinger on android

China☆狼群 提交于 2019-12-12 01:45:49
问题 How to draw some stuff before surfacefligner start on android? In this situation, it's some kind of traditional Linux with framebuffer device, so directly access framebuffer should be OK. How about to use HWComposer directly and how about to use egl directly? 回答1: If SurfaceFlinger isn't running, you can just open the framebuffer device and write to it (assuming you're on a device that has a framebuffer device). For an example of this, see the implementation of the "recovery" UI. The key file

surfaceflinger test program

和自甴很熟 提交于 2019-12-07 19:30:03
问题 I want to write a native application in Android for testing surfaceflinger. Is there any simple program that shows how to create surface, register buffers and post buffers on Surfaceflinger. 回答1: frameworks/base/libs/surfaceflinger/tests/resize/resize.cpp is a good place to start. But my version (Eclair from vendor) of the test app is out-dated, some Surface API has been moved to SurfaceControl and you have to: SurfaceComposerClient::createSurface() => SurfaceControl SurfaceControl-

Error android SurfaceFlinger

自作多情 提交于 2019-12-07 02:48:41
问题 I have this error message: SurfaceFlinger translucent=0 isOpaque=1 isExternalDisplayLayer=0 isExternalBlockLayer0 i'm using android 4.1.1 I'm not capable to say which part of my code is generating this message I would like to know if someone had the same message, it's meaning and potentially the way to solve this issue. thanks 回答1: I am also getting this error. I believe it is to do with Samsung's TouchWiz and not part of your code, are you running it on a Samsung device? 来源: https:/

How do I use Android’s “Surface” classes?

自闭症网瘾萝莉.ら 提交于 2019-12-03 04:23:17
问题 Is there a detailed explanation of Surface, SurfaceHolder, EGLSurface, SurfaceView, GLSurfaceView, SurfaceTexture, and TextureView? In particular: What’s the difference between SurfaceView and TextureView? Do I need to use GLSurfaceView to use OpenGL ES? How do Surface and EGLSurface interact? What does SurfaceTexture do? Why does the stuff I draw on a SurfaceView have to go above or below everything else? What is SurfaceFlinger? How does composition of the status and navigation bars work?

Android SurfaceFlinger

早过忘川 提交于 2019-12-03 02:44:32
问题 I would just like to ask if SurfaceFlinger is always called for any type of drawing into the screen? Example, displaying of JPG file to the screen. 回答1: SurfaceFlinger is not what draws your window. It allocates a frame buffer for your window, which the framework running in your application draws directly to without interacting with SurfaceFlinger. The only interaction SurfaceFlinger is involved with when you draw your window is to composite the final new frame buffer to the screen once you

Android SurfaceFlinger服务(八) ----- 图像的输出

匿名 (未验证) 提交于 2019-12-03 00:43:02
SurfaceFlinger合成后就进行图像的输出的工作。在图像输出时,存在硬件合成器与不存在的情况有些差别。软件合成时用到图像缓冲区生产者与消费者模型。首先来看看图像缓冲区的初始化。 void SurfaceFlinger::init() { ALOGI( "SurfaceFlinger‘s main thread ready to run. " "Initializing graphics H/W..."); ...... // initialize our non-virtual displays for (size_t i=0 ; i<DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES ; i++) { DisplayDevice::DisplayType type((DisplayDevice::DisplayType)i); // set-up the displays that are already connected if (mHwc->isConnected(i) || type==DisplayDevice::DISPLAY_PRIMARY) { // All non-virtual displays are currently considered secure. bool isSecure = true;

How do I use Android’s “Surface” classes?

旧时模样 提交于 2019-12-02 17:38:36
Is there a detailed explanation of Surface, SurfaceHolder, EGLSurface, SurfaceView, GLSurfaceView, SurfaceTexture, and TextureView? In particular: What’s the difference between SurfaceView and TextureView? Do I need to use GLSurfaceView to use OpenGL ES? How do Surface and EGLSurface interact? What does SurfaceTexture do? Why does the stuff I draw on a SurfaceView have to go above or below everything else? What is SurfaceFlinger? How does composition of the status and navigation bars work? While we’re at it, what’s the right way to structure a game loop on Android? The answers to these and

android rendering using CPU but not GPU?

可紊 提交于 2019-11-30 15:25:48
It's really weird that in systrace tool when I saw the execution of drawing command and window composition by surfaceflinger, this is running on CPU but not on GPU. But as per google talk by Romain Guy, they told that this composition and execution of drawing commands are executed on GPU. My device having GPU, even then they are using CPU core. I think if CPU cores are free then it uses CPU core otherwise it uses GPU. fadden There's three ways to do surface composition: Using "overlay" planes. Most recent devices will compose up to four planes as the pixels are being sent to the display. This