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. (转载)C# 编程 使用可空类型

    转载出处为://https://msdn.microsoft.com/zh-cn/library/2cf62fcy(vs.90).aspx#Anchor_1 C#可以为 null 的类型可以表示基础类 ...

  2. Android网络框架比较

    今天,公司需要为一个安卓app选择一个合适的网络框架,具体我了解,主要的安卓网络框架有okhttp,retrofit,android-async-http,volley. 查找网上的资料,大致可以得到 ...

  3. uc/os 笔记(转)

    1.uC/OS-II中使用互斥信号对象应该注意 互斥信号对象(Mutual Exclusion Semaphore)简称Mutex,是uC/OS-II的内核对象之一,用于管理那些需要独占访问的资源,并 ...

  4. MySQL锁等待分析【2】

    MySQL锁等待分析[1]中对锁等待的分析是一步一步来的.虽然最后是分析出来了,可是用时是比较长的:理清各个表之间的关系后,得到如下SQL语句,方便以后使用 select block_trx.trx_ ...

  5. [SQL注入1]From SQL injection to Shell

    第一次写,希望大神们多指点. 对于刚接触WEB渗透测试这块的朋友们,很希望能有个平台可以练习.网络上有不少,十大渗透测试演练系统,我这里推荐一个在10以外,适合初学者一步一步进步的平台PENTESTE ...

  6. QDialog 模态对话框与事件循环(exec其实就是调用了show和eventLoop.exec)

    起源 qtcn中文论坛中有网友问到: 假设程序正常运行时,只有一个简单的窗体A,此时只有一个GUI主线程,在这个主线程中有一个事件循环处理窗体上的事件.当此程序运行到某阶段时,弹出一个模态窗体B(书上 ...

  7. smarty 从配置文件读取变量

    smarty变量分3种: Variables [变量] Variables assigned from PHP [从PHP分配的变量] Variables loaded from config fil ...

  8. linux磁盘限额配置:quota命令

    LINUX下也有类似WINDOWS NTFS所用的磁盘限额,用的是quota来实现通过rpm -q quota确定是否已安装用quota只能对patation做限额,要做到针对某个目录来做只能靠ln ...

  9. BZOJ1108: [POI2007]天然气管道Gaz

    1108: [POI2007]天然气管道Gaz Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 410  Solved: 211[Submit][Sta ...

  10. Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile 解决办法

    Maven install失败 Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (d ...