D:\linux\ubuntu\touch\libhybris\libhybris_0.1.0+git20130606+c5d897a.orig\libhybris-0.1.0+git20130606+c5d897a\compat\surface_flinger\surface_flinger_compatibility_layer.cpp
SfSurface* sf_surface_create(SfClient* client, SfSurfaceCreationParameters* params)
{
 assert(client);
 assert(params);

SfSurface* surface = new SfSurface();
 surface->client = client;
 surface->surface_control = surface->client->client->createSurface(
     android::String8(params->name),
     params->w,
     params->h,
     android::PIXEL_FORMAT_RGBA_8888,
     0x300);

if (surface->surface_control == NULL) {
  report_surface_control_is_null_during_creation();
  delete(surface);
  return NULL;
 }
void report_surface_control_is_null_during_creation()
{
 printf("Could not acquire surface control object during surface creation");
}
SfClient* sf_client_create()
{
 return sf_client_create_full(true);
}
SfClient* sf_client_create_full(bool egl_support)
{
 SfClient* client = new SfClient();

client->client = new android::SurfaceComposerClient();
D:\linux\ubuntu\touch\libhybris\libhybris_0.1.0+git20130606+c5d897a.orig\libhybris-0.1.0+git20130606+c5d897a\compat\surface_flinger\direct_sf_test.cpp
int main(int argc, char** argv)
{
 SfClient* sf_client = sf_client_create();
 SfSurface* sf_surface = sf_surface_create(sf_client, &params);
D:\linux\ubuntu\touch\libhybris\libhybris_0.1.0+git20130606+c5d897a.orig\surface_flinger_compatibility_layer_internal.h
struct SfClient
{
 android::sp<android::SurfaceComposerClient> client;
 EGLDisplay egl_display;
 EGLConfig egl_config;
 EGLContext egl_context;
 bool egl_support;
};
F:\linux\phablet-ubuntu-20130618\frameworks\native\libs\gui\SurfaceComposerClient.cpp
sp<SurfaceControl> SurfaceComposerClient::createSurface(
        const String8& name,
        uint32_t w,
        uint32_t h,
        PixelFormat format,
        uint32_t flags)
{
    sp<SurfaceControl> result;
    if (mStatus == NO_ERROR) {
        ISurfaceComposerClient::surface_data_t data;
        sp<ISurface> surface = mClient->createSurface(&data, name,
                w, h, format, flags);
        if (surface != 0) {
            result = new SurfaceControl(this, surface, data);
        }
    }
    return result;
}
void SurfaceComposerClient::onFirstRef() {
    sp<ISurfaceComposer> sm(ComposerService::getComposerService());
    if (sm != 0) {
        sp<ISurfaceComposerClient> conn = sm->createConnection();
        if (conn != 0) {
            mClient = conn;
            mStatus = NO_ERROR;
        }
    }
}
F:\linux\phablet-ubuntu-20130618\frameworks\native\include\binder\Binder.h
class BpRefBase : public virtual RefBase
{
    inline  IBinder*        remote()                { return mRemote; }
    inline  IBinder*        remote() const          { return mRemote; }
******************************
http://www.cnblogs.com/innost/archive/2011/01/09/1931456.html
http://blog.csdn.net/myarrow/article/details/7180561
F:\linux\phablet-ubuntu-20130618\frameworks\native\libs\gui\ISurfaceComposerClient.cpp
class BpSurfaceComposerClient : public BpInterface<ISurfaceComposerClient>
{
    virtual sp<ISurface> createSurface( surface_data_t* params,
                                        const String8& name,
                                        uint32_t w,
                                        uint32_t h,
                                        PixelFormat format,
                                        uint32_t flags)
    {
        remote()->transact(CREATE_SURFACE, data, &reply);
status_t BnSurfaceComposerClient::onTransact(
    uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
            sp<ISurface> s = createSurface(&params, name, w, h,
                    format, flags);
f:\linux\phablet-ubuntu-20130618\frameworks\native\services\surfaceflinger\Client.cpp
sp<ISurface> Client::createSurface(
        ISurfaceComposerClient::surface_data_t* params,
        const String8& name,
        uint32_t w, uint32_t h, PixelFormat format,
        uint32_t flags)
{
    mFlinger->postMessageSync(msg);  //segfault
\\192.168.1.101\1\touch\export\phablet-ubuntu-20130618\frameworks\native\services\surfaceflinger\SurfaceFlinger.cpp
status_t SurfaceFlinger::postMessageSync(const sp<MessageBase>& msg,
        nsecs_t reltime, uint32_t flags) {
    status_t res = mEventQueue.postMessage(msg, reltime);
    if (res == NO_ERROR) {
        msg->wait();   //segfault
    }
    return res;
}
sp<ISurface> SurfaceFlinger::createLayer(
        ISurfaceComposerClient::surface_data_t* params,
        const String8& name,
        const sp<Client>& client,
       uint32_t w, uint32_t h, PixelFormat format,
        uint32_t flags)
{
    switch (flags & ISurfaceComposerClient::eFXSurfaceMask) {
        case ISurfaceComposerClient::eFXSurfaceNormal:
            layer = createNormalLayer(client, w, h, flags, format);  //segfault
            break;
sp<Layer> SurfaceFlinger::createNormalLayer(
        const sp<Client>& client,
        uint32_t w, uint32_t h, uint32_t flags,
        PixelFormat& format)
{
 sp<Layer> layer = new Layer(this, client);  //segfault
\\192.168.1.101\1\touch\export\phablet-ubuntu-20130618\frameworks\native\services\surfaceflinger\Layer.cpp
void Layer::onFirstRef()
{
    // Creates a custom BufferQueue for SurfaceTexture to use
    sp<BufferQueue> bq = new SurfaceTextureLayer();  //segfault
\\192.168.1.101\1\touch\export\phablet-ubuntu-20130618\frameworks\native\libs\gui\BufferQueue.cpp
BufferQueue::BufferQueue(bool allowSynchronousMode,
        const sp<IGraphicBufferAlloc>& allocator) :
    mDefaultWidth(1),
    mDefaultHeight(1),
    mMaxAcquiredBufferCount(1),
    mDefaultMaxBufferCount(2),
    mOverrideMaxBufferCount(0),
    mSynchronousMode(false),
    mAllowSynchronousMode(allowSynchronousMode),
    mConnectedApi(NO_CONNECTED_API),
    mAbandoned(false),
    mFrameCounter(0),
    mBufferHasBeenQueued(false),
    mDefaultBufferFormat(PIXEL_FORMAT_RGBA_8888),
    mConsumerUsageBits(0),
    mTransformHint(0)
{
        sp<ISurfaceComposer> composer(ComposerService::getComposerService());  //segfault
\\192.168.1.101\1\touch\export\phablet-ubuntu-20130618\frameworks\native\libs\gui\SurfaceComposerClient.cpp
/*static*/ sp<ISurfaceComposer> ComposerService::getComposerService() {
 ALOGD("ComposerService::getComposerService");
    ComposerService& instance = ComposerService::getInstance();  //segfault
F:\linux\phablet-ubuntu-20130618\frameworks\native\include\private\gui\ComposerService.h
frameworks/base/include/utils/Singleton.h
ANDROID_SINGLETON_STATIC_INSTANCE(ComposerService);
\\192.168.1.101\1\touch\export\phablet-ubuntu-20130618\frameworks\native\libs\gui\SurfaceComposerClient.cpp
ComposerService::ComposerService()
: Singleton<ComposerService>() {
    Mutex::Autolock _l(mLock);
    connectLocked();  //segfault
void ComposerService::connectLocked() {
    const String16 name("SurfaceFlinger");
    while (getService(name, &mComposerService) != NO_ERROR) {   //segfault
        usleep(250000);
    }
\\192.168.1.101\1\touch\export\phablet-ubuntu-20130618\frameworks\native\include\binder\IServiceManager.h
template<typename INTERFACE>
status_t getService(const String16& name, sp<INTERFACE>* outService)
{
        *outService = interface_cast<INTERFACE>(sm->getService(name));     //segfault
\\192.168.1.101\1\touch\export\phablet-ubuntu-20130618\frameworks\native\libs\binder\IServiceManager.cpp
class BpServiceManager : public BpInterface<IServiceManager>
{
    virtual sp<IBinder> getService(const String16& name) const
    {
            sp<IBinder> svc = checkService(name);  //segfault
    virtual sp<IBinder> checkService( const String16& name) const
    {
        remote()->transact(CHECK_SERVICE_TRANSACTION, data, &reply);     //segfault
\\192.168.1.101\1\touch\export\phablet-ubuntu-20130618\frameworks\native\libs\binder\BpBinder.cpp
status_t BpBinder::transact(
    uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
        status_t status = IPCThreadState::self()->transact(
            mHandle, code, data, reply, flags);                 //segfault
\\192.168.1.101\1\touch\export\phablet-ubuntu-20130618\frameworks\native\libs\binder\IPCThreadState.cpp
status_t IPCThreadState::transact(int32_t handle,
                                  uint32_t code, const Parcel& data,
                                  Parcel* reply, uint32_t flags)
{
        err = writeTransactionData(BC_TRANSACTION, flags, handle, code, data, NULL);     //segfault
status_t IPCThreadState::writeTransactionData(int32_t cmd, uint32_t binderFlags,
    int32_t handle, uint32_t code, const Parcel& data, status_t* statusBuffer)
{
    mOut.writeInt32(cmd);           //segfault
\\192.168.1.101\1\touch\export\phablet-ubuntu-20130618\frameworks\native\libs\binder\Parcel.cpp
template<class T>
status_t Parcel::writeAligned(T val) {
 if ((mDataPos+sizeof(val)) <= mDataCapacity) {
restart_write:
        *reinterpret_cast<T*>(mData+mDataPos) = val;          //segfault

f:\linux\phablet-ubuntu-20130618\frameworks\native\services\surfaceflinger\Client.h
class Client : public BnSurfaceComposerClient
{
    // ISurfaceComposerClient interface
    virtual sp<ISurface> createSurface(
            surface_data_t* params, const String8& name,
            uint32_t w, uint32_t h,PixelFormat format,
            uint32_t flags);
f:\linux\phablet-ubuntu-20130618\frameworks\native\include\binder\BpBinder.h
F:\linux\phablet-ubuntu-20130618\frameworks\native\libs\binder\BpBinder.cpp
status_t BpBinder::transact(
    uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
        status_t status = IPCThreadState::self()->transact(
            mHandle, code, data, reply, flags);
F:\linux\phablet-ubuntu-20130618\frameworks\native\libs\binder\IPCThreadState.cpp
status_t IPCThreadState::transact(int32_t handle,
                                  uint32_t code, const Parcel& data,
                                  Parcel* reply, uint32_t flags)
{
        err = writeTransactionData(BC_TRANSACTION, flags, handle, code, data, NULL);
status_t IPCThreadState::writeTransactionData(int32_t cmd, uint32_t binderFlags,
    int32_t handle, uint32_t code, const Parcel& data, status_t* statusBuffer)
{
    mOut.writeInt32(cmd);
    mOut.write(&tr, sizeof(tr));
F:\linux\phablet-ubuntu-20130618\frameworks\native\libs\binder\Parcel.cpp
status_t Parcel::writeInt32(int32_t val)
{
    return writeAligned(val);
}
status_t Parcel::writeAligned(T val) {

SurfaceFlinger的更多相关文章

  1. android Gui系统之SurfaceFlinger(5)---Vsync(2)

    9.Vsync第二部分 在上一篇中我们讲到,视图的刷新需要很多步骤, void SurfaceFlinger::handleMessageRefresh() { ATRACE_CALL(); preC ...

  2. android Gui系统之SurfaceFlinger(4)---Vsync(1)

    8.Vsync 8.1概论 VSYNC(Vertical Synchronization)是一个相当古老的概念,对于游戏玩家,它有一个更加大名鼎鼎的中文名字—-垂直同步. “垂直同步(vsync)”指 ...

  3. android Gui系统之SurfaceFlinger(3)---SurfaceFlinger

    7.SurfaceFlinger SurfaceFlinger在前面的篇幅了,多有涉及. SurfaceFlinger是GUI刷新UI的核心,所以任何关于SurfaceFlinger的改进都会对and ...

  4. android Gui系统之SurfaceFlinger(2)---BufferQueue

    6 BufferQueue 上一篇已经说到,BufferQueue是SurfaceFlinger管理和消费surface的中介,我们就开始分析bufferqueue. 每个应用 可以由几个Buffer ...

  5. android Gui系统之SurfaceFlinger(1)---SurfaceFlinger概论

    GUI 是任何系统都很重要的一块. android GUI大体分为4大块. 1)SurfaceFlinger 2)WMS 3)View机制 4)InputMethod 这块内容非常之多,但是理解后,可 ...

  6. Android系统Surface机制的SurfaceFlinger服务渲染应用程序UI的过程分析

    参考:Android系统Surface机制的SurfaceFlinger服务渲染应用程序UI的过程分析 一句话概括一下Android应用程序显示的过程:Android应用程序调用SurfaceFlin ...

  7. [转]Android系统Surface机制的SurfaceFlinger服务简要介绍和学习计划

    转自:Android系统Surface机制的SurfaceFlinger服务简要介绍和学习计划 前面我们从Android应用程序与SurfaceFlinger服务的关系出发,从侧面简单学习了Surfa ...

  8. [转] Android应用程序与SurfaceFlinger服务的关系概述和学习计划

    转自:Android应用程序与SurfaceFlinger服务的关系概述和学习计划 SurfaceFlinger服务负责绘制Android应用程序的UI,它的实现相当复杂,要从正面分析它的实现不是一件 ...

  9. Android核心分析之二十七Android GDI 之SurfaceFlinger之动态结构示

           SurfaceFlinger对象建立过程示意 1 SurfaceSession的建立 客户端请求建立Surface时,首先在要与SurfaceFlinger建立一个Session,然后再 ...

  10. Android核心分析之二十六Android GDI之SurfaceFlinger

    Android GDI之SurfaceFlinger SurfaceFinger按英文翻译过来就是Surface投递者.SufaceFlinger的构成并不是太复杂,复杂的是他的客户端建构.Sufac ...

随机推荐

  1. HTML元素遮挡Flash之梦

    wmode参数: transparent模式:可用z-index控制层级 opaque模式:可用z-index控制层级 window模式:flash层级在浏览器核心显示窗口之上,flash会盖住与他重 ...

  2. twemproxy 安装

    twemproxy 安装 1. 获取安装包 shell> wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz shell> ...

  3. python 微信推送模板消息

    #!/usr/bin/env python #-*- coding: utf-8 -*- import httplib import json import MySQLdb #从数据库中获取acces ...

  4. odoo10会计期间

    从odoo9,会计模块重构之后,去掉了account.fiscalyear 以及 account.period 这两个模型, 但不表示 odoo 从此就没有 "会计年度"和&quo ...

  5. 怎样在Word中插入代码并保持代码原始样式不变

    怎样在Word中插入代码并保持样式不变 我们有时候需要在word中添加一段我们写的代码,但是把代码粘贴到word文档中之后就发现所有的代码的样子都变了,我们可以采用下边的方法来实现保持代码原来的样式和 ...

  6. Netbeans 注释模板配置

    工具->模板->展开Java 选中Java类->在编辑器中打开 修改如下: <#if package?? && package != ""& ...

  7. GridView 中Item项居中显示

    直接在GridView中设置 android:gravity="center"这个属性是不起作用的.要在你adapter中的布局文件中设 置android:layout_gravi ...

  8. KEIL 伪指令

    //为了大家查找方便,命令按字母排序:0.ALTNAME 功能: 这一伪指令用来自定义名字,以替换源程序中原来的保留字,替换的保留字均可等效地用于子程序中. 格式: ALTNAME 保留字 自定义名 ...

  9. 伟福与Keil的比较--51汇编提高篇

    [写在前面] 本文适合有一定汇编水平的人(了解大半的汇编语句,能区分全角与半角符号,能够独立编写流水灯.数码管等程序),传授51单片机的汇编语言经验.如果您发现不少指令不知道意思,请从网上搜索入门教程 ...

  10. QTabWidget添加自定义样式

    一.参考文章:http://bbs.csdn.net/topics/390632657?page=1 setStyleSheet("QTabWidget::pane{border-width ...