5

For fast transfer of texels to/from an EGL surface, we have successfully used GraphicBuffer buffer as described in this thread: How to use GraphicBuffer in android ndk

However on Android 7.0 that is not an option. As GraphicBuffer uses the private libary libui.so. So what replaces it? What is the Google-approved method of doing a fast transfer to/from an EGL surface?

Community
  • 1
  • 1
griffin2000
  • 709
  • 9
  • 26

1 Answers1

4

In Android 8 (API level 26), the upcoming Oreo release, they have introduced a Hardware Buffer wrapper. I've compared the HardwareBuffer and GraphicBuffer classes, both provide an interface to create and access a shared buffer object, where the new HardwareBuffer is a generalised version of the GraphicBuffer. Therefore you will no longer need to link against the non-public libraries from API 26+.

The only alternative I have seen for Android 7 is to manually provide all required libraries with the apk for a project.

We will have to wait until Android 8 is released following it's beta testing phase. The roadmap for release can be found here, anticipated release is some time before the end of 2017. If you plan on updating your project with the new API features before the release date and want to test it out, you can use the Android O preview version on a Google device.

sparkitny
  • 1,503
  • 4
  • 18
  • 23
  • Thanks, that is good to know. Though in this new API what is the equivalent of GraphicBuffer::getNativeBuffer? How do you get something you can pass to eglCreateImageKHR or any of the GL/EGL texture creation functions? – griffin2000 Aug 21 '17 at 19:25
  • According to the documentation for the NDK: "You can allocate a AHardwareBuffer struct and use it to obtain an EGLClientBuffer resource type via the eglGetNativeClientBufferANDROID extension. You can pass that buffer to eglCreateImageKHR to create an EGLImage resource type ..." See: https://developer.android.com/ndk/guides/stable_apis.html for further details. Hope this helps. – sparkitny Aug 22 '17 at 10:35