본문 바로가기

공부/안드로이드

[Android][Core] Hardware acceleration

1. 정의

(1) Hardware acceleration


Beginning in Android 3.0 (API level 11), the Android 2D rendering pipeline supports hardware acceleration, meaning that all drawing operations that are performed on a View's canvas use the GPU. Because of the increased resources required to enable hardware acceleration, your app will consume more RAM.

Hardware acceleration is enabled by default if your Target API level is >=14, but can also be explicitly enabled. If your application uses only standard views and Drawables, turning it on globally should not cause any adverse drawing effects. However, because hardware acceleration is not supported for all of the 2D drawing operations, turning it on might affect some of your custom views or drawing calls. Problems usually manifest themselves as invisible elements, exceptions, or wrongly rendered pixels. To remedy this, Android gives you the option to enable or disable hardware acceleration at multiple levels. See Control hardware acceleration.

If your application performs custom drawing, test your application on actual hardware devices with hardware acceleration turned on to find any problems.
  • 안드로이드 3.0이 되면서 2D 렌더링 파이프라인은 '하드웨어 가속'을 지원하는데, View의 Canvas상에 그려지는 모든 drawing 들이 GPU를 사용함을 뜻한다. 왜냐하면 하드웨어 가속을 활성화하는 데 필요한 리소스가 증가하기 때문에 앱은 더 많은 RAM을 소비한다.
  • Target API Level 14 이상이면, 하드웨어 가속은 자동으로 사용된다.(default : true). 내 애플리케이션에서 기본적인 View나 drawble 소스들을 사용할 때는, 하드웨워 가속을 켜놓는 것은 어떠한 불리한 drawing 효과를 가져오지 않는다. 그러나, 하드웨어 가속이 모든 2D drawing 동작들을 지원하는 것은 아니기 때문에 기능을 활성화 해놓은 것이 가끔 영향을 줄 수는 있다. 문제는 일반적으로 보이지 않는 요소, 예외 또는 잘못 렌더링 된 픽셀로 나타납니다. 해결책으로, 안드로이드에서는 Multiple level수준에서 하드웨어 가속을 활성화 또는 비활성화 방식으로 가능하다.
  • 내 애플리케이션이 custom drawing을 하고 있을 때, 문제를 찾기위해서는 하드웨어 가속을 해놓은 상태에서 실질 하드웨어 디바이스를 사용하여 테스트해봐야 안다.

 

2. 그래서?

(1) 주의할 사항이나 알고 있어야하는 것은?

  • Multiple level에서 하드웨어 가속을 조정할 수 있다. App/Activity/Window/View 레벨에서 가능함.
  • 하드웨어 가속이 되어 있는 지 체크를 할 수가 있다.
  • Drawing Models에는 software-basd와 hardware-based model이 있다.