I know how to get CPU info inside /proc/
, but is there any way to get GPU info? Something like the CPU one?
Asked
Active
Viewed 3.0k times
24

Peter O.
- 32,158
- 14
- 82
- 96

Rotary Heart
- 1,899
- 3
- 29
- 44
-
Seriously you down voted without saying nothing? – Rotary Heart Apr 04 '13 at 06:54
4 Answers
20
Simpler way: adb shell dumpsys | grep GLES

user2742196
- 219
- 2
- 2
-
5A slightly modified version `adb shell dumpsys SurfaceFlinger |grep GLES` take less time to run – alijandro Oct 09 '19 at 07:44
-
One thing to note though is that this `dumpsys` command runs only within a command-line ADB shell and does not run programmatically because only system apps have access to it. – Abdul Mateen Jan 30 '23 at 13:12
-
`adb shell dumpsys SurfaceFlinger | grep GLES` in PowerShell (Windows 10) – Languoguang Jun 02 '23 at 03:00
19
There is, you can get GPU information by using OpenGL:
Log.d("GL", "GL_RENDERER = " + gl.glGetString( GL10.GL_RENDERER ));
Log.d("GL", "GL_VENDOR = " + gl.glGetString( GL10.GL_VENDOR ));
Log.d("GL", "GL_VERSION = " + gl.glGetString( GL10.GL_VERSION ));
Log.i("GL", "GL_EXTENSIONS = " + gl.glGetString( GL10.GL_EXTENSIONS ));
For more information see: https://developer.android.com/guide/topics/graphics/opengl.html

Tschallacka
- 27,901
- 14
- 88
- 133

Buda Gavril
- 21,409
- 40
- 127
- 196
-
here it is: http://developer.android.com/reference/javax/microedition/khronos/opengles/GL10.html – Buda Gavril Apr 04 '13 at 07:04
-
I'm sorry but, could you please explain how to declare that gl in an `Activity`? – Rotary Heart Apr 04 '13 at 07:23
-
4
Here is a SampleActivity to get GPU info:
public class MainActivity extends Activity implements GLSurfaceView.Renderer{
private TextView textView;
private GLSurfaceView glSurfaceView;
private StringBuilder sb;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView = (TextView) findViewById(R.id.textView);
final ActivityManager activityManager = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
final ConfigurationInfo configurationInfo = activityManager
.getDeviceConfigurationInfo();
sb=new StringBuilder();
sb.append("GL version:").append(configurationInfo.getGlEsVersion()).append("\n");
textView.setText(sb.toString());
this.glSurfaceView = new GLSurfaceView(this);
this.glSurfaceView.setRenderer(this);
((ViewGroup)textView.getParent()).addView(this.glSurfaceView);
}
@Override
public void onClick(View v) {
}
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
sb.append("RENDERER").append(gl.glGetString(GL10.GL_RENDERER)).append("\n");
sb.append("VENDOR").append( gl.glGetString(GL10.GL_VENDOR)).append("\n");
sb.append("VERSION").append(gl.glGetString(GL10.GL_VERSION)).append("\n");
sb.append("EXTENSIONS").append(gl.glGetString(GL10.GL_EXTENSIONS));
runOnUiThread(new Runnable() {
@Override
public void run() {
textView.setText(sb.toString());
glSurfaceView.setVisibility(View.GONE);
}
});
}
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
}
@Override
public void onDrawFrame(GL10 gl) {
}
}
-
Perfect example to get GPU information. How can I implement the same in a java library project which is being included as jar file in android application. – Udit Trivedi Jul 20 '17 at 20:15
-
You can't do it with JAR (Java archive) because it requires Android SDK. you can develop it as an Android Library module (AAR) instead. – Vinay Jul 25 '17 at 08:30
-
I implemented this. It works. But on some devices, it gives this error. Fatal Exception: java.lang.RuntimeException createContext failed: EGL_BAD_ALLOC – Yasiru Nayanajith Sep 08 '20 at 13:50
3
I hope its useful useful to you.. First This code check if device is support the GPU or Not.
// Check if the system supports OpenGL ES 2.0.
final ActivityManager activityManager = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
final ConfigurationInfo configurationInfo = activityManager
.getDeviceConfigurationInfo();
final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;
if (supportsEs2) {
Log.i("JO", "configurationInfo.reqGlEsVersion:"
+ configurationInfo.reqGlEsVersion + "supportsEs2:"
+ supportsEs2);
// Request an OpenGL ES 2.0 compatible context.
myGlsurfaceView.setEGLContextClientVersion(2);
final DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
// Set the renderer to our demo renderer, defined below.
myRenderer = new MyRenderer(this, myGlsurfaceView);
myGlsurfaceView.setRenderer(myRenderer, displayMetrics.density);
myGlsurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
} else {
// This is where you could create an OpenGL ES 1.x compatible
// renderer if you wanted to support both ES 1 and ES 2.
return;
}
Second One : This code give the GPU Information..
Put It in this code inside MyRenderer Class..
public void determineGraphicSupport(GL10 gl){
int _graphicEngine = GRAPHICS_CANVAS;
String extensions = gl.glGetString(GLES20.GL_EXTENSIONS);
//String version = GLES10.glGetString(GL10.GL_VERSION);
String version = GLES20.glGetString(GLES20.GL_VERSION);
//String renderer = gl.glGetString(GL10.GL_RENDERER);
String renderer = GLES20.glGetString(GLES20.GL_RENDERER);
boolean isSoftwareRenderer = renderer.contains("PixelFlinger");
boolean supportsDrawTexture = extensions.contains("draw_texture");
int[] arGlMaxTextureSize = new int[1];
gl.glGetIntegerv( GLES20.GL_MAX_TEXTURE_SIZE, arGlMaxTextureSize, 0 );
if( !isSoftwareRenderer && supportsDrawTexture && _width >= 480 && _height >= 800
&& arGlMaxTextureSize[0] >= 4096 )
_graphicEngine = GRAPHICS_OPENGL_DRAW_TEXTURE;
else
_graphicEngine = GRAPHICS_CANVAS;
}

Gunhan
- 6,807
- 3
- 43
- 37

harikrishnan
- 1,985
- 4
- 32
- 63