status_t SurfaceFlinger::readyToRun() { LOGI("SurfaceFlinger's main thread ready to run. " "Initializing graphics H/W..."); // we only support one display currently intdpy=0; { // initialize the main display GraphicPlane&plane(graphicPlane(dpy)); DisplayHardware* const hw = new DisplayHardware(this, dpy); plane.setDisplayHardware(hw); } // create the shared control-block mServerHeap=newMemoryHeapBase(4096, MemoryHeapBase::READ_ONLY,"SurfaceFlinger read-only heap"); LOGE_IF(mServerHeap==0,"can't create shared memory dealer");
mServerCblk=static_cast<surface_flinger_cblk_t*>(mServerHeap->getBase()); LOGE_IF(mServerCblk==0,"can't get to shared control block's address"); new(mServerCblk)surface_flinger_cblk_t; // initialize primary screen // (other display should be initialized in the same manner, but // asynchronously, as they could come and go. None of this is supported // yet). constGraphicPlane&plane(graphicPlane(dpy)); constDisplayHardware&hw=plane.displayHardware(); constuint32_tw=hw.getWidth(); constuint32_th=hw.getHeight(); constuint32_tf=hw.getFormat(); hw.makeCurrent(); // initialize the shared control block
mServerCblk->connected|=1<<dpy; display_cblk_t*dcblk=mServerCblk->displays+dpy; memset(dcblk,0,sizeof(display_cblk_t)); dcblk->w=plane.getWidth(); dcblk->h=plane.getHeight(); dcblk->format=f; dcblk->orientation=ISurfaceComposer::eOrientationDefault; dcblk->xdpi=hw.getDpiX(); dcblk->ydpi=hw.getDpiY(); dcblk->fps=hw.getRefreshRate(); dcblk->density=hw.getDensity(); asmvolatile("":::"memory"); // Initialize OpenGL|ES
glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D,0); glTexParameterx(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE); glTexParameterx(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE); glTexParameterx(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameterx(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexEnvx(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE); glPixelStorei(GL_UNPACK_ALIGNMENT,4); glPixelStorei(GL_PACK_ALIGNMENT,4); glEnableClientState(GL_VERTEX_ARRAY); glEnable(GL_SCISSOR_TEST); glShadeModel(GL_FLAT); glDisable(GL_DITHER); glDisable(GL_CULL_FACE);
constuint16_tg0=pack565(0x0F,0x1F,0x0F); constuint16_tg1=pack565(0x17,0x2f,0x17); constuint16_ttextureData[4]={g0,g1,g1,g0}; glGenTextures(1,&mWormholeTexName); glBindTexture(GL_TEXTURE_2D,mWormholeTexName); glTexParameterx(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameterx(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexParameterx(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); glTexParameterx(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,2,2,0, GL_RGB,GL_UNSIGNED_SHORT_5_6_5,textureData); glViewport(0,0,w,h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrthof(0,w,h,0,0,1); LayerDim::initDimmer(this,w,h); mReadyToRunBarrier.open(); /* * We're now ready to accept clients... */ // start boot animation property_set("ctl.start","bootanim"); returnNO_ERROR; } |