OSDN Git Service

[hwc2] Add surfaceInterface/goldfishHwc2
authorLingfeng Yang <lfy@google.com>
Tue, 21 Mar 2017 21:46:26 +0000 (14:46 -0700)
committerLingfeng Yang <lfy@google.com>
Wed, 22 Mar 2017 18:47:28 +0000 (11:47 -0700)
commit596e8dec5700d2976d3b40ae498dbbf479c4abb6
tree9a016f2f315f3fe58ad1d10579567d39116621fc
parent8767533b1ba7f39d7e92d88486bc95ca74809672
[hwc2] Add surfaceInterface/goldfishHwc2

bug: 36439031
bug: 36375335

When HWC2 is used (even the HWC2on1 adapter), one of the most fundamental
changes is that acquireBuffer/releaseBuffer by BufferQueue consumers
is coarsened, delaying releaseBuffer until the app has finished
with its eglSwapBuffers operation and handling releaseBuffer as part of
a post process (mPendingRelease/releasePendingBuffer/et al).

This would be OK, except for the fact that an acquired, unreleased buffer
takes up a free buffer slot.

Emulator uses GLES composition currently, so each eglSwapBuffers by an app
directly causes another eglSwapBuffers, each of which attempts to
dequeueBuffer, taking up 2 slots right there. This was usually OK, since
releaseBuffer would be interleaved, but now, with the delayed releaseBuffer,
there are no free buffer slots and we have a deadlock situation.

Fortunately, we can set the swapped-to Surface to "async mode", which takes
exactly this situation into account. Async mode, which is for Surfaces but
really affects the BufferQueueCore queue size, makes it so that there
is an extra buffer slot so that dequeueBuffer doesn't have to block.

This CL adds a small static library for setting the swapped-to Surface
to async mode. Note that one does not simply add libgui to the shared
libraries of system/egl/Android.mk, since libgui itself includes EGL/GLES2
as dependencies, putting us into DLL hell and causing all sorts of trouble!

Change-Id: I6ee4f0e6d0b668d60573887751ec6b02839df5c3
Android.mk
system/OpenglSystemCommon/Android.mk
system/OpenglSystemCommon/goldfishHwc2.cpp [new file with mode: 0644]
system/OpenglSystemCommon/goldfishHwc2.h [new file with mode: 0644]
system/egl/Android.mk
system/egl/egl.cpp
system/egl/eglDisplay.cpp
system/surfaceInterface/Android.mk [new file with mode: 0644]
system/surfaceInterface/surfaceInterface.cpp [new file with mode: 0644]
system/surfaceInterface/surfaceInterface.h [new file with mode: 0644]