Skip to content

Commit 8457407

Browse files
author
Vincent Lin
committed
Bug 914544 - Update GonkDisplayJB to support JB MR1. r=mwu
1 parent 9529c35 commit 8457407

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

widget/gonk/libdisplay/FramebufferSurface.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
#include <EGL/egl.h>
3030

3131
#include <hardware/hardware.h>
32+
#if ANDROID_VERSION == 17
33+
#include <gui/SurfaceTextureClient.h>
34+
#endif
3235
#include <ui/GraphicBuffer.h>
3336

3437
#include "FramebufferSurface.h"

widget/gonk/libdisplay/GonkDisplayJB.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
*/
1515

1616
#include "GonkDisplayJB.h"
17+
#if ANDROID_VERSION == 17
18+
#include <gui/SurfaceTextureClient.h>
19+
#else
1720
#include <gui/Surface.h>
21+
#endif
1822

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

106+
#if ANDROID_VERSION == 17
107+
sp<SurfaceTextureClient> stc = new SurfaceTextureClient(static_cast<sp<ISurfaceTexture> >(mFBSurface->getBufferQueue()));
108+
#else
102109
sp<Surface> stc = new Surface(static_cast<sp<IGraphicBufferProducer> >(mFBSurface->getBufferQueue()));
110+
#endif
103111
mSTClient = stc;
104112

105113
mList = (hwc_display_contents_1_t *)malloc(sizeof(*mList) + (sizeof(hwc_layer_1_t)*2));
@@ -173,8 +181,14 @@ GonkDisplayJB::SwapBuffers(EGLDisplay dpy, EGLSurface sur)
173181
if (mFBDevice && mFBDevice->compositionComplete) {
174182
mFBDevice->compositionComplete(mFBDevice);
175183
}
184+
185+
#if ANDROID_VERSION == 17
186+
mList->dpy = dpy;
187+
mList->sur = sur;
188+
#else
176189
mList->outbuf = nullptr;
177190
mList->outbufAcquireFenceFd = -1;
191+
#endif
178192
eglSwapBuffers(dpy, sur);
179193
return Post(mFBSurface->lastHandle, mFBSurface->lastFenceFD);
180194
}
@@ -213,7 +227,9 @@ GonkDisplayJB::Post(buffer_handle_t buf, int fence)
213227
mList->hwLayers[1].visibleRegionScreen.rects = &mList->hwLayers[1].sourceCrop;
214228
mList->hwLayers[1].acquireFenceFd = fence;
215229
mList->hwLayers[1].releaseFenceFd = -1;
230+
#if ANDROID_VERSION == 18
216231
mList->hwLayers[1].planeAlpha = 0xFF;
232+
#endif
217233
mHwc->prepare(mHwc, HWC_NUM_DISPLAY_TYPES, displays);
218234
int err = mHwc->set(mHwc, HWC_NUM_DISPLAY_TYPES, displays);
219235
mFBSurface->setReleaseFenceFd(mList->hwLayers[1].releaseFenceFd);

widget/gonk/libdisplay/moz.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ CPP_SOURCES += [
2020
'BootAnimation.cpp',
2121
]
2222

23-
if CONFIG['ANDROID_VERSION'] == '18':
23+
if CONFIG['ANDROID_VERSION'] >= '17':
2424
CPP_SOURCES += [
2525
'FramebufferSurface.cpp',
2626
'GraphicBufferAlloc.cpp',

0 commit comments

Comments
 (0)