Skip to content

Commit

Permalink
Bug 914544 - Update GonkDisplayJB to support JB MR1. r=mwu
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Lin committed Sep 12, 2013
1 parent 9529c35 commit 8457407
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions widget/gonk/libdisplay/FramebufferSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
#include <EGL/egl.h>

#include <hardware/hardware.h>
#if ANDROID_VERSION == 17
#include <gui/SurfaceTextureClient.h>
#endif
#include <ui/GraphicBuffer.h>

#include "FramebufferSurface.h"
Expand Down
16 changes: 16 additions & 0 deletions widget/gonk/libdisplay/GonkDisplayJB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
*/

#include "GonkDisplayJB.h"
#if ANDROID_VERSION == 17
#include <gui/SurfaceTextureClient.h>
#else
#include <gui/Surface.h>
#endif

#include <hardware/hardware.h>
#include <hardware/hwcomposer.h>
Expand Down Expand Up @@ -99,7 +103,11 @@ GonkDisplayJB::GonkDisplayJB()
mAlloc = new GraphicBufferAlloc();
mFBSurface = new FramebufferSurface(0, mWidth, mHeight, surfaceformat, mAlloc);

#if ANDROID_VERSION == 17
sp<SurfaceTextureClient> stc = new SurfaceTextureClient(static_cast<sp<ISurfaceTexture> >(mFBSurface->getBufferQueue()));
#else
sp<Surface> stc = new Surface(static_cast<sp<IGraphicBufferProducer> >(mFBSurface->getBufferQueue()));
#endif
mSTClient = stc;

mList = (hwc_display_contents_1_t *)malloc(sizeof(*mList) + (sizeof(hwc_layer_1_t)*2));
Expand Down Expand Up @@ -173,8 +181,14 @@ GonkDisplayJB::SwapBuffers(EGLDisplay dpy, EGLSurface sur)
if (mFBDevice && mFBDevice->compositionComplete) {
mFBDevice->compositionComplete(mFBDevice);
}

#if ANDROID_VERSION == 17
mList->dpy = dpy;
mList->sur = sur;
#else
mList->outbuf = nullptr;
mList->outbufAcquireFenceFd = -1;
#endif
eglSwapBuffers(dpy, sur);
return Post(mFBSurface->lastHandle, mFBSurface->lastFenceFD);
}
Expand Down Expand Up @@ -213,7 +227,9 @@ GonkDisplayJB::Post(buffer_handle_t buf, int fence)
mList->hwLayers[1].visibleRegionScreen.rects = &mList->hwLayers[1].sourceCrop;
mList->hwLayers[1].acquireFenceFd = fence;
mList->hwLayers[1].releaseFenceFd = -1;
#if ANDROID_VERSION == 18
mList->hwLayers[1].planeAlpha = 0xFF;
#endif
mHwc->prepare(mHwc, HWC_NUM_DISPLAY_TYPES, displays);
int err = mHwc->set(mHwc, HWC_NUM_DISPLAY_TYPES, displays);
mFBSurface->setReleaseFenceFd(mList->hwLayers[1].releaseFenceFd);
Expand Down
2 changes: 1 addition & 1 deletion widget/gonk/libdisplay/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ CPP_SOURCES += [
'BootAnimation.cpp',
]

if CONFIG['ANDROID_VERSION'] == '18':
if CONFIG['ANDROID_VERSION'] >= '17':
CPP_SOURCES += [
'FramebufferSurface.cpp',
'GraphicBufferAlloc.cpp',
Expand Down

0 comments on commit 8457407

Please sign in to comment.