Is There Any Way To Get Gpu Information?
I know how to get CPU info inside /proc/, but is there any way to get GPU info? Something like the CPU one?
Solution 1:
Simpler way: adb shell dumpsys | grep GLES
Solution 2:
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
Solution 3:
Here is a SampleActivity to get GPU info:
publicclassMainActivityextendsActivityimplementsGLSurfaceView.Renderer{
private TextView textView;
private GLSurfaceView glSurfaceView;
private StringBuilder sb;
@OverrideprotectedvoidonCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView = (TextView) findViewById(R.id.textView);
finalActivityManageractivityManager= (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
finalConfigurationInfoconfigurationInfo= activityManager
.getDeviceConfigurationInfo();
sb=newStringBuilder();
sb.append("GL version:").append(configurationInfo.getGlEsVersion()).append("\n");
textView.setText(sb.toString());
this.glSurfaceView = newGLSurfaceView(this);
this.glSurfaceView.setRenderer(this);
((ViewGroup)textView.getParent()).addView(this.glSurfaceView);
}
@OverridepublicvoidonClick(View v) {
}
@OverridepublicvoidonSurfaceCreated(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(newRunnable() {
@Overridepublicvoidrun() {
textView.setText(sb.toString());
glSurfaceView.setVisibility(View.GONE);
}
});
}
@OverridepublicvoidonSurfaceChanged(GL10 gl, int width, int height) {
}
@OverridepublicvoidonDrawFrame(GL10 gl) {
}
}
Solution 4:
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.finalActivityManageractivityManager= (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
finalConfigurationInfoconfigurationInfo= activityManager
.getDeviceConfigurationInfo();
finalbooleansupportsEs2= 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);
finalDisplayMetricsdisplayMetrics=newDisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
// Set the renderer to our demo renderer, defined below.
myRenderer = newMyRenderer(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..
publicvoiddetermineGraphicSupport(GL10 gl){
int_graphicEngine= GRAPHICS_CANVAS;
Stringextensions= gl.glGetString(GLES20.GL_EXTENSIONS);
//String version = GLES10.glGetString(GL10.GL_VERSION);Stringversion= GLES20.glGetString(GLES20.GL_VERSION);
//String renderer = gl.glGetString(GL10.GL_RENDERER);Stringrenderer= GLES20.glGetString(GLES20.GL_RENDERER);
booleanisSoftwareRenderer= renderer.contains("PixelFlinger");
booleansupportsDrawTexture= extensions.contains("draw_texture");
int[] arGlMaxTextureSize = newint[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;
}
Post a Comment for "Is There Any Way To Get Gpu Information?"