Enable GPU for OpenGL ES Android

I am trying to setup an Android app that Uses OpenGL ES 2.0 which uses the GPU for rendering.

I have created a sample app that uses OpenGL to render a spinning pyramid. I followed all the steps in the following tutorial to get started: https://developer.android.com/training/graphics/opengl/environment.

The app runs on my device which is connected through USB. I enabled Show GPU view updates in android developer settings but my sample app does not flash to indicate that there is any GPU updates happening.

I enabled Enable OpenGL traces to logcat. Upon startup of the app, I see the following:

01-01 00:06:00.211 8040-8040/? I/art: Late-enabling -Xcheck:jni
01-01 00:06:00.272 8040-8040/com.example.openglhelloworld W/System: ClassLoader referenced unknown path: /data/app/com.example.openglhelloworld-2/lib/arm
01-01 00:06:00.332 8040-8054/com.example.openglhelloworld D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
01-01 00:06:00.337 8040-8040/com.example.openglhelloworld I/imx6.gralloc: open gpu gralloc module!
01-01 00:06:00.429 8040-8054/com.example.openglhelloworld I/OpenGLRenderer: Initialized EGL, version 1.4

In my GLSurfaceView I log this.isHardwareAccelerated() after a call to setRenderer and get this as a result:

01-01 00:06:00.304 8040-8040/com.example.openglhelloworld D/View: isHardwareAccelerated: false

In my AndroidManifest.xml I have enabled hardwareAcceleration in both the application and activity tags.

In my GLRenderer I log some extra information:

01-01 00:06:00.632 8040-8053/com.example.openglhelloworld D/GL: GL_RENDERER = Vivante GC2000
01-01 00:06:00.632 8040-8053/com.example.openglhelloworld D/GL: GL_VENDOR = Vivante Corporation
01-01 00:06:00.632 8040-8053/com.example.openglhelloworld D/GL: GL_VERSION = OpenGL ES 3.0 V5.0.11.p8.41671
01-01 00:06:00.632 8040-8053/com.example.openglhelloworld I/GL: GL_EXTENSIONS = GL_EXT_debug_marker GL_OES_vertex_type_10_10_10_2 GL_OES_vertex_half_float GL_OES_element_index_uint GL_OES_mapbuffer GL_OES_vertex_array_object GL_OES_compressed_ETC1_RGB8_texture GL_OES_compressed_paletted_texture GL_OES_texture_npot GL_OES_rgb8_rgba8 GL_OES_depth_texture GL_OES_depth_texture_cube_map GL_OES_depth24 GL_OES_depth32 GL_OES_packed_depth_stencil GL_OES_fbo_render_mipmap GL_OES_get_program_binary GL_OES_fragment_precision_high GL_OES_standard_derivatives GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_required_internalformat GL_OES_surfaceless_context GL_EXT_texture_type_2_10_10_10_REV GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_EXT_read_format_bgra GL_EXT_multi_draw_arrays GL_EXT_frag_depth GL_EXT_discard_framebuffer GL_EXT_blend_minmax GL_EXT_multisampled_render_to_texture GL_EXT_robustness GL_VIV_direct_texture 

I read the manual for the Vivante GPU and says that it supports OpenGL

If I run mmdc GPU3D in an adb shell, I do see that there is utilization of the device, a bus load, and byte acces (as well as a bunch of byte counts). If I run mmdc ARM I do get a very similar output which makes me wonder if its the same device being profiled.

So my question is am I using the GPU? What can I do to verify that I am using the GPU? And if you don’t think I’m using the GPU what can I do to use the GPU?

I am pretty sure you are hardware accelarated, I cannot imagine any phone on the market equipped with a GPU that would have such a basic thing screwed up, even one from one of the minor GPU players such as Vivante.

Maybe calling this.isHardwareAccelerated() just after a call to setRenderer() is too early a place to do it as not a single frame has been rendered yet at that time?

Try calling it later, like in onDraw() function in your class that implements GLSurfaceView.Renderer and see if it then returns ‘true’.


sheds some light on this and confirms my suspicions that ‘isHardwareAccelerated’ needs to be called sufficiantly ‘late’ in the lifetime of the View in order to return a real result.

It’s often like this in Android - various APIs need to be called ‘late enough’ and don’t work when one calls them in the constructor or in onCreate().

Marking this as the solution. Thank you!

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.