|
14 | 14 | */
|
15 | 15 |
|
16 | 16 | #include "GonkDisplayJB.h"
|
| 17 | +#if ANDROID_VERSION == 17 |
| 18 | +#include <gui/SurfaceTextureClient.h> |
| 19 | +#else |
17 | 20 | #include <gui/Surface.h>
|
| 21 | +#endif |
18 | 22 |
|
19 | 23 | #include <hardware/hardware.h>
|
20 | 24 | #include <hardware/hwcomposer.h>
|
@@ -99,7 +103,11 @@ GonkDisplayJB::GonkDisplayJB()
|
99 | 103 | mAlloc = new GraphicBufferAlloc();
|
100 | 104 | mFBSurface = new FramebufferSurface(0, mWidth, mHeight, surfaceformat, mAlloc);
|
101 | 105 |
|
| 106 | +#if ANDROID_VERSION == 17 |
| 107 | + sp<SurfaceTextureClient> stc = new SurfaceTextureClient(static_cast<sp<ISurfaceTexture> >(mFBSurface->getBufferQueue())); |
| 108 | +#else |
102 | 109 | sp<Surface> stc = new Surface(static_cast<sp<IGraphicBufferProducer> >(mFBSurface->getBufferQueue()));
|
| 110 | +#endif |
103 | 111 | mSTClient = stc;
|
104 | 112 |
|
105 | 113 | 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)
|
173 | 181 | if (mFBDevice && mFBDevice->compositionComplete) {
|
174 | 182 | mFBDevice->compositionComplete(mFBDevice);
|
175 | 183 | }
|
| 184 | + |
| 185 | +#if ANDROID_VERSION == 17 |
| 186 | + mList->dpy = dpy; |
| 187 | + mList->sur = sur; |
| 188 | +#else |
176 | 189 | mList->outbuf = nullptr;
|
177 | 190 | mList->outbufAcquireFenceFd = -1;
|
| 191 | +#endif |
178 | 192 | eglSwapBuffers(dpy, sur);
|
179 | 193 | return Post(mFBSurface->lastHandle, mFBSurface->lastFenceFD);
|
180 | 194 | }
|
@@ -213,7 +227,9 @@ GonkDisplayJB::Post(buffer_handle_t buf, int fence)
|
213 | 227 | mList->hwLayers[1].visibleRegionScreen.rects = &mList->hwLayers[1].sourceCrop;
|
214 | 228 | mList->hwLayers[1].acquireFenceFd = fence;
|
215 | 229 | mList->hwLayers[1].releaseFenceFd = -1;
|
| 230 | +#if ANDROID_VERSION == 18 |
216 | 231 | mList->hwLayers[1].planeAlpha = 0xFF;
|
| 232 | +#endif |
217 | 233 | mHwc->prepare(mHwc, HWC_NUM_DISPLAY_TYPES, displays);
|
218 | 234 | int err = mHwc->set(mHwc, HWC_NUM_DISPLAY_TYPES, displays);
|
219 | 235 | mFBSurface->setReleaseFenceFd(mList->hwLayers[1].releaseFenceFd);
|
|
0 commit comments