Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Hardware and Software rendering in Android

Can anyone tell me what is hardware rendering and what is software rendering in Android?

Also how these are related to normal view and opengl views?

like image 351
AndroDev Avatar asked Dec 19 '22 20:12

AndroDev


1 Answers

HW and SW rendering is related to 2D drawing (views).

When you're using HW rendering:

  • The drawing operations (lines, circles, texts, bitmaps, transformations, etc.) performed on the Canvas object will be executed by the "graphics card" of the device.
  • These operation are recorded before the actual drawing happens.

In contrast, when you're using software rendering:

  • Drawing operations are executed by the CPU, which's much slower.
  • Operations are performed immediately. No recording happens.

Note that hardware acceleration support was added in API level 11 (3.0, Honeycomb). It's enabled by default on API level 14 (ICS) and higher.

Edit: That is, on ICS and higher android versions, every view (including buttons, etc.) is drawn by the graphics hardware by default. However you can turn off HW acceleration. Below API level 14, you have to turn it ON explicitly. Although HW acceleration may sound unnecessary for simple views, its effect becomes very noticeable when you make animations.

Hardware acceleration can be controlled at application, activity, window, and view level. So you can turn it off for the whole app, or turn on/off for specific views, etc.

Also you can check if HW acceleration is turned on:

View.isHardwareAccelerated()
Canvas.isHardwareAccelerated()

3D graphics use OpenGL, which of course needs appropriate hardware support.

You can find more info on this topic here: http://developer.android.com/guide/topics/graphics/hardware-accel.html

like image 192
Aron Lorincz Avatar answered Feb 23 '23 04:02

Aron Lorincz