Bug 1032180 - [dolphin] No boot animation when restart the phone. r=mwu

This commit is contained in:
chiajung hung 2014-08-20 18:57:00 -04:00
parent 7850669903
commit 558a69ff23
2 changed files with 11 additions and 16 deletions

View File

@ -106,13 +106,6 @@ GonkDisplayJB::GonkDisplayJB()
mAlloc = new GraphicBufferAlloc();
status_t error;
uint32_t usage = GRALLOC_USAGE_HW_FB | GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_COMPOSER;
mBootAnimBuffer = mAlloc->createGraphicBuffer(mWidth, mHeight, surfaceformat, usage, &error);
if (error != NO_ERROR || !mBootAnimBuffer.get()) {
ALOGI("Trying to create BRGA format framebuffer");
surfaceformat = HAL_PIXEL_FORMAT_BGRA_8888;
mBootAnimBuffer = mAlloc->createGraphicBuffer(mWidth, mHeight, surfaceformat, usage, &error);
}
#if ANDROID_VERSION >= 19
sp<BufferQueue> bq = new BufferQueue(mAlloc);
@ -127,12 +120,14 @@ GonkDisplayJB::GonkDisplayJB()
sp<Surface> stc = new Surface(static_cast<sp<IGraphicBufferProducer> >(bq));
#endif
mSTClient = stc;
mSTClient->perform(mSTClient.get(), NATIVE_WINDOW_SET_BUFFER_COUNT, 2);
mSTClient->perform(mSTClient.get(), NATIVE_WINDOW_SET_USAGE, GRALLOC_USAGE_HW_FB | GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_COMPOSER);
mList = (hwc_display_contents_1_t *)malloc(sizeof(*mList) + (sizeof(hwc_layer_1_t)*2));
if (mHwc)
mHwc->blank(mHwc, HWC_DISPLAY_PRIMARY, 0);
if (error == NO_ERROR && mBootAnimBuffer.get()) {
if (error == NO_ERROR) {
ALOGI("Starting bootanimation with (%d) format framebuffer", surfaceformat);
StartBootAnimation();
} else
@ -151,6 +146,7 @@ GonkDisplayJB::~GonkDisplayJB()
ANativeWindow*
GonkDisplayJB::GetNativeWindow()
{
StopBootAnimation();
return mSTClient.get();
}
@ -197,9 +193,6 @@ GonkDisplayJB::GetFBSurface()
bool
GonkDisplayJB::SwapBuffers(EGLDisplay dpy, EGLSurface sur)
{
StopBootAnimation();
mBootAnimBuffer = nullptr;
// Should be called when composition rendering is complete for a frame.
// Only HWC v1.0 needs this call.
// HWC > v1.0 case, do not call compositionComplete().
@ -280,21 +273,23 @@ GonkDisplayJB::Post(buffer_handle_t buf, int fence)
ANativeWindowBuffer*
GonkDisplayJB::DequeueBuffer()
{
return static_cast<ANativeWindowBuffer*>(mBootAnimBuffer.get());
ANativeWindowBuffer *buf;
mSTClient->dequeueBuffer(mSTClient.get(), &buf, &mFence);
return buf;
}
bool
GonkDisplayJB::QueueBuffer(ANativeWindowBuffer* buf)
{
bool success = Post(buf->handle, -1);
return success;
int error = mSTClient->queueBuffer(mSTClient.get(), buf, mFence);
return error == 0 && success;
}
void
GonkDisplayJB::UpdateFBSurface(EGLDisplay dpy, EGLSurface sur)
{
StopBootAnimation();
mBootAnimBuffer = nullptr;
eglSwapBuffers(dpy, sur);
}

View File

@ -63,7 +63,7 @@ private:
android::sp<android::FramebufferSurface> mFBSurface;
android::sp<ANativeWindow> mSTClient;
android::sp<android::IGraphicBufferAlloc> mAlloc;
android::sp<android::GraphicBuffer> mBootAnimBuffer;
int mFence;
hwc_display_contents_1_t* mList;
uint32_t mWidth;
uint32_t mHeight;