logo资料库

i.MX_Graphics_User's_Guide_Android.pdf

第1页 / 共170页
第2页 / 共170页
第3页 / 共170页
第4页 / 共170页
第5页 / 共170页
第6页 / 共170页
第7页 / 共170页
第8页 / 共170页
资料共170页,剩余部分请下载后查看
Chapter 1 Introduction
Chapter 2 i.MX G2D API
2.1 Overview
2.2 Enumerations and structures
2.2.1 g2d_format enumeration
2.2.2 g2d_blend_func enumeration
2.2.3 g2d_cap_mode enumeration
2.2.4 g2d_rotation enumeration
2.2.5 g2d_cache_mode enumeration
2.2.6 g2d_hardware_type enumeration
2.2.7 g2d_surface structure
2.2.8 g2d_buf structure
2.2.9 g2d_surface_pair structure
2.2.10 g2d_feature enumeration
2.3 G2D function descriptions
2.3.1 g2d_open
2.3.2 g2d_close
2.3.3 g2d_make_current
2.3.4 g2d_clear
2.3.5 g2d_blit
2.3.6 g2d_copy
2.3.7 g2d_query_cap
2.3.8 g2d_enable
2.3.9 g2d_disable
2.3.10 g2d_cache_op
2.3.11 g2d_alloc
2.3.12 g2d_free
2.3.13 g2d_flush
2.3.14 g2d_finish
2.3.15 g2d_multi_blit
2.3.16 g2d_query_hardware
2.3.17 g2d_query_feature
2.4 Support of new operating system in G2D
2.5 Sample code for G2D API usage
2.5.1 Color space conversion from YUV to RGB
2.5.2 Alpha blend in source over mode
2.5.3 Source cropping and destination rotation
2.5.4 Multi source blit
2.6 Feature list on multiple platforms
Chapter 3 i.MX EGL and OGL Extension Support
3.1 Introduction
3.2 EGL extension support
3.3 OpenGL ES extension support
3.4 Extension GL_VIV_direct_texture
Name
Name strings
IPStatus
Status
Version
Number
Dependencies
Overview
New Procedures and Functions
glTexDirectVIV
GlTexDirectVIVMap
GlTexDirectInvalidateVIV
New Tokens
Error codes
Example 1.
Example 2.
Issues
3.5 Extension GL_VIV_texture_border_clamp
Name
Name Strings
Status
Version
Number
Dependencies
Overview
Issues
New Tokens
Errors
New State
Chapter 4 i.MX Framebuffer API
4.1 Overview
4.2 API data types and environment variables
4.2.1 Data types
4.2.2 Environment variables
4.3 API description and syntax
Chapter 5 OpenCL
5.1 Overview
5.1.1 General description
5.1.2 OpenCL framework
5.1.2.1 OpenCL execution model: kernels and work elements
5.1.2.2 OpenCL command queues
5.1.2.3 OpenCL memory model
5.1.2.4 Host to GPGPU compute device data transfers
5.1.3 OpenCL profiles
5.1.4 Vivante OpenCL embedded compatible IP
5.1.5 Vivante OpenCL full profile hardware model
5.2 Vivante OpenCL implementation
5.2.1 OpenCL pipeline
5.2.2 Front end
5.2.3 The OpenCL compute unit
5.2.4 Memory hierarchy
5.3 Optimization for OpenCL embedded profile
5.3.1 Using preferred multiple of work-group size
5.3.2 Using multiple work-groups of reduced size
5.3.3 Packing work-item data
5.3.4 Improving locality
5.3.5 Minimizing use of 1 KB local memory
5.3.6 Using 16 byte memory Read/Write size
5.3.7 Useing _RTZ rounding mode
5.3.8 Using native functions
5.3.8.1 Using native_function() for increased performance
5.3.8.2 Using native_divide and native_reciprocal for faster floating point calculations
5.3.8.3 Using compile option for native functions
5.3.9 Using buffers instead of images
5.4 OpenCL Debug messages
5.4.1 OCL-007005: (clCreateKernel) cannot link kernel
5.4.2 Not enough register memory
5.4.3 Not enough instruction memory
5.4.4 GlobalWorkSize over hardware limit
Chapter 6 OpenVX Introduction
6.1 Overview
6.2 Designing framework of OpenVX
6.2.1 Software landscape
6.2.2 Object-oriented behaviors
6.2.3 Graphs concepts
6.2.4 User kernels
6.3 OpenVX extension implementation
6.3.1 Hardware requirements
6.3.2 EVIS instruction interface
6.3.3 Extended language features
6.3.4 Packed types
6.3.5 Initializing constants on load
6.3.6 Inline assembly
6.4 OpenCL functions compatible with Vivante vision
6.4.1 Read_Imagef,i,ui
6.4.2 Write_Imagef,i,ui
6.4.3 Query Image Dimensions
6.4.4 Channel Data Types Supported
6.4.5 Image Channel Orders Supported
Chapter 7 Vulkan
7.1 OverView
7.2 Vivante Extension Support for Vulkan
Chapter 8 Multiple GPUs and Virtualization
8.1 Overview
8.2 Multi-GPU configurations
8.3 GPU affinity configuration
8.4 OpenCL on multi-GPU device
8.5 GPU virtualization configuration
Chapter 9 G2D compositor on Weston
9.1 Overview
9.2 Enabe G2D compositor
9.2.1 Open the file: /etc/default/Weston in the Release image.
9.2.2 Add the parameters in the OPTARGS, and disable EXT_RESOLVE feature in compositor.
9.2.3 Restart Weston by this command:
9.2.4 Disable EXT_RESOLVE feature before running the client application.
Chapter 10 XServer Video Driver
10.1 EXA driver
10.1.1 EXA driver options
10.1.2 24 bpp pixmap
10.1.3 Shared pixmap extension
10.1.4 How to disable XRandR
10.1.5 Cursor
10.1.6 DRI
10.1.7 Tearing
10.2 XRandR
10.2.1 Useful commands
10.2.2 Rendering the desktop on overlay
10.2.3 Process of selecting the HDMI default resolution
10.2.4 Performance
10.2.5 Memory consumption
Chapter 11 Advanced GPU Configuration
11.1 GPU Scaling Governor
11.2 GPU Device Cooling
Chapter 12 Vivante Software Tool Kit
12.1 Vivante Tool Kit overview
12.1.1 VTK component overview
12.1.2 VTK operating system requirements
12.1.3 VTK installation
12.1.4 Software release compatibility
12.2 vEmulator
12.2.1 Supported operating systems and graphics hardware
12.2.1.1 Specifying platform mode for Windows OS
12.2.2 vEmulator components
12.2.3 vEmulator for OpenCL
12.2.4 Supported extensions
12.2.5 vEmulator environment variable setup
12.2.6 Sample code overview
12.2.7 Building and running the code examples
12.2.8 OpenGL ES 1.1 examples
12.2.8.1 Tutorial1: rotating three-color triangle
12.2.8.2 Tutorial2: rotating six-color cube
12.2.8.3 Tutorial3: rotating multi-textured cube
12.2.8.4 Tutorial4: lighting and fog
12.2.8.5 Tutorial5: blending and bit-mapped fonts
12.2.8.6 Tutorial6: particles using point sprites
12.2.8.7 Tutorial7: vertex buffer objects
12.2.9 OpenGL ES 2.0 examples
12.2.9.1 Tutorial1: rotating three-color triangle
12.2.9.2 Tutorial2: rotating six-color cube
12.2.9.3 Tutorial3: rotating reflecting ball
12.2.9.4 Tutorial4: rotating refracting ball
12.3 vShader
12.3.1 vShader components
12.3.2 Getting started with vShader
12.3.2.1 Creating a new project
12.3.2.2 Opening an existing project
12.3.2.3 Saving a project
12.3.3 vShaderNavigation
12.3.3.1 vShader menu bar
12.3.3.2 vShader Window OS panes
12.3.3.2.1 Preview
12.3.3.3 Project explorer
12.3.3.3.1 Shader editor
12.3.3.3.2 Info log
12.3.4 vShader project resources
12.3.4.1 Header
12.3.4.2 Fixed states
12.3.4.3 Mesh
12.3.4.4 Shaders
12.3.4.5 Attributes
12.3.4.6 Uniforms
12.3.4.7 Textures
12.4 vCompiler
12.4.1 vCompiler command line syntax
12.4.1.1 Syntax:
12.4.1.2 Input parameters (required):
12.4.1.3 Input parameters (optional):
12.4.1.4 vCompiler output
12.4.1.5 vCompiler syntax examples
12.4.2 vCompiler core-specific configuration
12.5 vTexture
12.5.1 Formats
12.5.1.1 Supported formats
12.5.1.2 Supported formats for tile and de-tile conversions
12.5.1.3 vTexture output formats
12.5.1.4 vTexture RAW output file format definition
12.5.2 Set vTexture environment variable
12.5.3 Command line syntax
12.5.4 Syntax
12.5.4.1 General Parameters
12.5.4.2 Compression/Decompression parameters
12.5.4.3 Tile/De-Tile parameters
12.5.4.4 vTexture syntax examples
12.6 vProfiler and vAnalyzer
12.6.1 Fundamentals of performance optimization
12.6.2 vProfiler setup for the Linux OS
12.6.2.1 Enable vProfiler option in kernel
12.6.2.2 Enable vProfiler option in U-Boot
12.6.2.3 Set vProfiler environment variables
12.6.2.3.1 VIV_PROFILE
12.6.2.3.2 VP_OUTPUT
12.6.2.3.3 VP_SYNC_MODE
12.6.3 vProfiler setup for the Android platform
12.6.3.1 Enable vProfiler option in kernel
12.6.3.2 Setting property options for vProfiler
12.6.4 vProfiler setup for the QNX OS
12.6.4.1 Enable vProfiler option
12.6.4.2 Setting property options for vProfiler
12.6.5 vProfiler collecting performance data
12.6.5.1 Performance counters
12.6.6 vAnalyzer viewing and analyzing a run-time profile
12.6.6.1 Loading profile files
12.6.6.2 vAnalyzer menu bar
12.6.7 vAnalyzer charts
12.6.7.1 vAnalyzer upper left pane: chart tab and menu options
12.6.7.2 Chart customization
12.6.7.2.1 Chart components and navigation
12.6.7.2.2 Data export
12.6.7.3 vAnalyzer lower left pane: frame number slider bar
12.6.7.4 vAnalyzer left pane: System Info tab
12.6.7.5 vAnalyzer upper right pane: Frame Analysis
12.6.7.5.1 Summary tab
12.6.7.5.2 Detail tab
12.6.7.6 vAnalyzer lower right pane: Frame Selection
12.6.7.6.1 Slow Frames tab
12.6.7.6.2 Critical Frames tab
12.6.8 vAnalyzer viewers
12.6.8.1 OpenGL Function Call viewer
12.6.8.2 Program viewer
12.7 Debug and performance counters
12.7.1 AXI bandwidth
12.7.2 Overall
12.7.3 OpenGL
12.7.4 Pixel processing
12.7.5 Shader processing
12.7.6 Texturing
12.7.7 Vertex processing
12.7.8 Vertex shader and fragment shader
Chapter 13 GPU Tools
13.1 gpuinfo tool
13.1.1 Introduction
13.1.2 Usage
13.1.3 Sample log information
13.1.3.1 GPU hardware information
13.1.3.2 Total memory information
13.1.3.3 Process user space GPU memory usage information
13.1.3.4 GPU idle percentage
13.2 gmem_info tool
13.3 Apitrace user guide
13.3.1 Introduction
13.3.2 Install
13.3.2.1 Yocto
13.3.2.2 Android Platform
13.3.2.3 PC
13.3.3 Usage
13.3.3.1 Trace OpenGL ES1.1/2.0/3.0 application
13.3.3.2 Trace OpenGL ES 1.1/2.0/3.0 Java application on the Android platform
13.3.3.3 Trace OpenGL application
13.3.3.4 Replay
13.3.3.5 Analysis
13.3.4 Reference
Chapter 14 GPU Memory Introduction
14.1 GPU memory overview
14.2 GPU memory pools
14.3 GPU memory allocators
14.4 GPU reserved memory
14.5 GPU memory base address
Chapter 15 Application Programming Recommendations
15.1 Understand the system configuration and target application
15.2 Optimize off chip data transfer such as accessing off-chip DDR memory/mobile DDR memory
15.3 Avoid W-Clipping issue in the Application Program
15.4 Avoid GPU hang and data corruption when use occlusion query
15.5 Avoid random cache or memory accesses
15.6 Optimize your use of system memory
15.7 Target a fixed frame rate that is visibly smooth
15.8 Minimize GL state changes
15.9 Batch primitives to minimize the number of draw calls
15.10 Perform calculations per vertex instead of per fragment/pixel
15.11 Enable early-Z, hierarchical-Z and back face culling
15.12 Use branching carefully
15.13 Do not use static or stack data as vertex data - use VBOs instead
15.14 Use dynamic VBO if data is changing frame by frame
15.15 Tessellate your data so that Hierarchical Z (HZ) can do its job
15.16 Use dynamic textures as a texture cache (texture atlas)
15.17 If you use many small triangle strips, stitch them together
15.18 Specify EGL configuration attributes precisely
15.19 Use aligned texture/render buffers
15.20 Disable MSAA rendering unless high quality is needed
15.21 Avoid partial clears
15.22 Avoid mask operations
15.23 Use MIPMAP textures
15.24 Use compressed textures if constricted by RAM/ROM budget
15.25 Draw objects from near to far if possible
15.26 Avoid indexed triangle strips.
15.27 Vertex attribute stride should not be larger than 256 bytes
15.28 Avoid binding buffers to mixed index/vertex array
15.29 Avoid using CPU to update texture/buffer contexts during render
15.30 Avoid frequent context switching
15.31 Optimize resources within a shader
15.32 Avoid using glScissor Clear for small regions
15.33 Use PRE to accelerate data transfer
15.34 i.MX 8QuadMax dual-GPU performance
Chapter 16 Demo Framework
16.1 Summaries
16.1.1 Executive summary
16.1.2 Technical overview
16.2 Introduction
16.3 Design overview
16.4 High level overview
16.4.1 DemoMain
16.4.2 DemoHost
16.4.3 DemoApp
16.5 Demo application details
16.5.1 Demo method overview
16.5.1.1 Resized
16.5.1.2 FixedUpdate
16.5.1.3 Update
16.5.1.4 Draw
16.5.2 Fixed or variable timestep update
16.5.3 Execution order of methods during a frame
16.5.4 Exit
16.5.5 Dealing with screen resolution changes
16.5.6 Content loading
16.5.7 Demo registration
16.6 Helper Class Overview
16.6.1 FslBase
16.6.1.1 Bits
16.6.1.2 IO
16.6.1.3 Log
16.6.1.4 Math
16.6.1.5 String
16.6.1.6 System
16.6.1.7 FslGraphics
16.6.1.8 IO
16.6.1.9 Vertices
16.6.2 FslGraphicsGLES2
16.6.3 FslGraphicsGLES3
16.7 Android SDK+NDK on Windows OS build guide
16.7.1 Prerequisites
16.7.2 Environment setup
16.7.3 Compiling and running an existing sample application
16.7.4 Creating a new GLES2 demo project named 'CoolNewDemo'
16.7.5 Notes
16.7.5.1 Content
16.7.5.2 Command line app building via Ant
16.8 Ubuntu build guide
16.8.1 Prerequisites
16.8.2 Environment setup
16.8.3 Compiling all samples
16.8.4 Compiling and running an existing sample application
16.8.5 Creating a new GLES2 demo project named 'CoolNewDemo'
16.8.6 NOTES:
16.8.6.1 Content
16.8.6.2 Manual environment setup
16.8.6.3 Override platform auto-detection
16.8.6.4 Executable location
16.9 Windows OS build guide
16.9.1 Prerequisites
16.9.2 Environment setup
16.9.3 Compiling and running an existing sample application
16.9.4 Creating a new GLES2 demo project named 'CoolNewDemo'
16.9.5 Notes
16.9.5.1 Content
16.9.5.2 Switching between emulators
16.9.5.3 Executable location
16.10 Yocto build guide
16.10.1 Prerequisites
16.10.2 Yocto project environment setup:
16.10.3 Demo framework environment setup
16.10.4 Compiling all samples
16.10.5 Compiling and running an existing sample application
16.10.6 Creating a new GLES2 demo project named 'CoolNewDemo'
16.10.7 NOTES
16.10.7.1 Content
16.10.7.2 Manual environment setup
16.10.7.3 Override platform auto-detection
16.10.7.4 Building for multiple backends
16.10.7.5 Executable location
16.11 FslContentSync.py notes
16.12 Roadmap – Upcoming features
16.12.1 Technical overview
16.13 Known limitations
16.13.1 General
16.13.2 Android platform
Chapter 17 Environment Variables Summary
17.1 Environment variable for drivers and HAL
17.2 Environment variable for compiler
NXP Semiconductors Document Number: IMXGRAPHICUG Rev. 0, 02/2018 i.MX Graphics User’s Guide
Contents Chapter 1 Introduction ............................................................................................................................................. 6 Chapter 2 i.MX G2D API ............................................................................................................................................ 6 2.1 2.2 2.3 2.4 2.5 2.6 Overview ...................................................................................................................................................... 6 Enumerations and structures ....................................................................................................................... 6 G2D function descriptions .......................................................................................................................... 10 Support of new operating system in G2D .................................................................................................. 16 Sample code for G2D API usage ................................................................................................................. 16 Feature list on multiple platforms.............................................................................................................. 19 Chapter 3 i.MX EGL and OGL Extension Support .................................................................................................... 20 3.1 3.2 3.3 3.4 3.5 Introduction ............................................................................................................................................... 20 EGL extension support ............................................................................................................................... 20 OpenGL ES extension support .................................................................................................................... 23 Extension GL_VIV_direct_texture .............................................................................................................. 29 Extension GL_VIV_texture_border_clamp ................................................................................................. 32 Chapter 4 i.MX Framebuffer API ............................................................................................................................ 35 4.1 4.2 4.3 Overview .................................................................................................................................................... 35 API data types and environment variables ................................................................................................ 35 API description and syntax ......................................................................................................................... 37 Chapter 5 OpenCL ................................................................................................................................................... 44 5.1 5.2 5.3 5.4 Overview .................................................................................................................................................... 44 Vivante OpenCL implementation ............................................................................................................... 51 Optimization for OpenCL embedded profile .............................................................................................. 53 OpenCL Debug messages ........................................................................................................................... 56 Chapter 6 OpenVX Introduction ............................................................................................................................. 57 6.1 6.2 6.3 6.4 Overview .................................................................................................................................................... 57 Designing framework of OpenVX ............................................................................................................... 57 OpenVX extension implementation ........................................................................................................... 59 OpenCL functions compatible with Vivante vision..................................................................................... 62 Chapter 7 Vulkan .................................................................................................................................................... 65 7.1 7.2 OverView .................................................................................................................................................... 65 Vivante Extension Support for Vulkan ....................................................................................................... 65 Chapter 8 Multiple GPUs and Virtualization........................................................................................................... 67 8.1 8.2 8.3 2 Overview .................................................................................................................................................... 67 Multi-GPU configurations .......................................................................................................................... 67 GPU affinity configuration .......................................................................................................................... 67 i.MX Graphics User’s Guide, Rev. 0, 02/2018 NXP Semiconductors
8.4 8.5 OpenCL on multi-GPU device ..................................................................................................................... 67 GPU virtualization configuration ................................................................................................................ 68 Chapter 9 G2D compositor on Weston .................................................................................................................. 69 9.1 9.2 Overview .................................................................................................................................................... 69 Enabe G2D compositor .............................................................................................................................. 69 Chapter 10 XServer Video Driver ......................................................................................................................... 70 10.1 10.2 EXA driver ................................................................................................................................................... 70 XRandR ....................................................................................................................................................... 71 Chapter 11 Advanced GPU Configuration ............................................................................................................ 82 11.1 GPU Scaling Governor ................................................................................................................................ 82 11.2 GPU Device Cooling .................................................................................................................................... 82 Chapter 12 Vivante Software Tool Kit .................................................................................................................. 82 12.1 12.2 12.3 12.4 12.5 12.6 Vivante Tool Kit overview .......................................................................................................................... 82 vEmulator ................................................................................................................................................... 84 vShader ...................................................................................................................................................... 95 vCompiler ................................................................................................................................................. 103 vTexture ................................................................................................................................................... 107 vProfiler and vAnalyzer ............................................................................................................................ 111 12.7 Debug and performance counters ........................................................................................................... 125 Chapter 13 GPU Tools ........................................................................................................................................ 127 13.1 13.2 13.3 gpuinfo tool .............................................................................................................................................. 127 gmem_info tool ........................................................................................................................................ 129 Apitrace user guide .................................................................................................................................. 130 Chapter 14 GPU Memory Introduction .............................................................................................................. 135 14.1 GPU memory overview ............................................................................................................................ 135 14.2 GPU memory pools .................................................................................................................................. 135 14.3 GPU memory allocators ........................................................................................................................... 135 14.4 GPU reserved memory ............................................................................................................................. 136 14.5 GPU memory base address ...................................................................................................................... 136 Chapter 15 Application Programming Recommendations ................................................................................. 138 15.1 Understand the system configuration and target application ................................................................. 138 15.2 Optimize off chip data transfer such as accessing off-chip DDR memory/mobile DDR memory ............ 138 15.3 15.4 15.5 Avoid W-Clipping issue in the Application Program ................................................................................. 138 Avoid GPU hang and data corruption when use occlusion query ............................................................ 139 Avoid random cache or memory accesses ............................................................................................... 139 15.6 Optimize your use of system memory ..................................................................................................... 139 3 i.MX Graphics User’s Guide, Rev. 0, 02/2018 NXP Semiconductors
15.7 Target a fixed frame rate that is visibly smooth....................................................................................... 139 15.8 Minimize GL state changes ...................................................................................................................... 140 15.9 Batch primitives to minimize the number of draw calls .......................................................................... 140 15.10 15.11 15.12 15.13 15.14 15.15 15.16 15.17 15.18 15.19 15.20 15.21 15.22 15.23 15.24 15.25 15.26 15.27 15.28 15.29 15.30 15.31 15.32 15.33 15.34 Perform calculations per vertex instead of per fragment/pixel .......................................................... 140 Enable early-Z, hierarchical-Z and back face culling ............................................................................ 140 Use branching carefully ....................................................................................................................... 141 Do not use static or stack data as vertex data - use VBOs instead ...................................................... 141 Use dynamic VBO if data is changing frame by frame ......................................................................... 141 Tessellate your data so that Hierarchical Z (HZ) can do its job ............................................................ 142 Use dynamic textures as a texture cache (texture atlas) ..................................................................... 142 If you use many small triangle strips, stitch them together ................................................................ 142 Specify EGL configuration attributes precisely .................................................................................... 142 Use aligned texture/render buffers ..................................................................................................... 142 Disable MSAA rendering unless high quality is needed ....................................................................... 143 Avoid partial clears .............................................................................................................................. 143 Avoid mask operations ........................................................................................................................ 143 Use MIPMAP textures .......................................................................................................................... 143 Use compressed textures if constricted by RAM/ROM budget ........................................................... 143 Draw objects from near to far if possible ............................................................................................ 143 Avoid indexed triangle strips. .............................................................................................................. 143 Vertex attribute stride should not be larger than 256 bytes ............................................................... 144 Avoid binding buffers to mixed index/vertex array ............................................................................. 144 Avoid using CPU to update texture/buffer contexts during render .................................................... 144 Avoid frequent context switching ........................................................................................................ 144 Optimize resources within a shader .................................................................................................... 144 Avoid using glScissor Clear for small regions ....................................................................................... 144 Use PRE to accelerate data transfer .................................................................................................... 144 i.MX 8QuadMax dual-GPU performance ............................................................................................. 145 Chapter 16 Demo Framework ............................................................................................................................ 146 16.1 16.2 Summaries................................................................................................................................................ 146 Introduction ............................................................................................................................................. 146 16.3 Design overview ....................................................................................................................................... 147 16.4 High level overview .................................................................................................................................. 147 16.5 Demo application details ......................................................................................................................... 148 16.6 Helper Class Overview .............................................................................................................................. 152 16.7 Android SDK+NDK on Windows OS build guide ....................................................................................... 157 4 i.MX Graphics User’s Guide, Rev. 0, 02/2018 NXP Semiconductors
16.8 Ubuntu build guide .................................................................................................................................. 158 16.9 Windows OS build guide .......................................................................................................................... 160 16.10 16.11 16.12 16.13 Yocto build guide ................................................................................................................................. 162 FslContentSync.py notes ...................................................................................................................... 166 Roadmap – Upcoming features ........................................................................................................... 166 Known limitations ................................................................................................................................ 167 Chapter 17 Environment Variables Summary .................................................................................................... 168 Environment variable for drivers and HAL ............................................................................................... 168 Environment variable for compiler .......................................................................................................... 169 17.1 17.2 5 i.MX Graphics User’s Guide, Rev. 0, 02/2018 NXP Semiconductors
Chapter 1 Introduction The purpose of this document is to provide information on graphic APIs and driver support. Each chapter describes a specific set of APIs or driver integration as well as specific hardware acceleration customization. The target audiences for this document are developers writing graphics applications or video drivers. Chapter 2 i.MX G2D API 2.1 Overview The G2D Application Programming Interface (API) is designed to be easy to understand and to use the 2D Bit blit (BLT) function. It allows the user to implement the customized applications with simple interfaces. It is hardware and platform independent for i.MX 2D Graphics. G2D API supports the following features but is not limited to these: Simple BLT operation from source to destination • • Alpha blending for source and destination with Porter-Duff rules • High-performance memory copy from source to destination • Up-scaling and down-scaling from source to destination 90/180/270 degree rotation from source to destination • • Horizontal and vertical flip from source to destination • • High performance memory clear for destination Pixel-level cropping for source surface • • Global alpha blending for source only • Asynchronous mode and sync Contiguous memory allocator • Support VG engine • Enhanced visual quality with dither for pixel precision-loss The G2D API document includes a detailed interface description and sample code for reference. The API is designed with C-Style coding and can be used in both C and C++ applications. G2D API supports the following features but is not limited to these: • Multi source blit Enumerations and structures 2.2 This chapter describes all enumeration and structure definitions in G2D. 2.2.1 g2d_format enumeration This enumeration describes the pixel format for source and destination. Name G2D_RGB565 G2D_RGBA8888 G2D_RGBX8888 G2D_BGRA8888 G2D_BGRX8888 6 Table 1. g2d_format enumeration Numeric Description 0 1 2 3 4 RGB565 pixel format 32 bit-RGBA pixel format 32 bit-RGBX without alpha blending 32 bit-BGRA pixel format 32 bit-BGRX without alpha blending i.MX Graphics User’s Guide, Rev. 0, 02/2018 NXP Semiconductors
G2D_BGR565 G2D_ARGBA8888 G2D_ABGR8888 G2D_XRGB8888 G2D_XBGR8888 G2D_RGB888 G2D_NV12 G2D_I420 G2D_YV12 G2D_NV21 G2D_YUYV G2D_YVYU G2D_UYVY G2D_VYUY G2D_NV16 G2D_NV61 5 6 7 8 9 10 20 21 22 23 24 25 26 27 28 29 16 bit-BGR565 pixel format 32 bit-ARGB pixel format 32 bit-ABGR pixel format 32 bit-XRGB without alpha 32 bit-XBGR without alpha 24 bit-RGB Y plane followed by interleaved U/V plane Y, U, V are within separate planes Y, V, U are within separate planes Y plane followed by interleaved V/U plane Interleaved Y/U/Y/V plane Interleaved Y/V/Y/U plane Interleaved U/Y/V/Y plane Interleaved V/Y/U/Y plane Y plane followed by interleaved U/V plane Y plane followed by interleaved V/U plane 2.2.2 g2d_blend_func enumeration This enumeration describes the blend factor for source and destination. Name G2D_ZERO G2D_ONE G2D_SRC_ALPHA G2D_ONE_MINUS_SRC_ALPHA G2D_DST_ALPHA G2D_ONE_MINUS_DST_ALPHA G2D_PRE_MULTIPLIED_ALPHA G2D_DEMULTIPLY_OUT_ALPHA Table 2. g2d_blend_func enumeration Numeric Description 0 1 2 3 4 5 Blend factor with 0 Blend factor with 1 Blend factor with source alpha Blend factor with 1 - source alpha Blend factor with destination alpha Blend factor with 1 - destination alpha 0 x 10 0 x 20 Extensive blend as pre-multiplied alpha Extensive blend as demultiply out alpha 2.2.3 g2d_cap_mode enumeration This enumeration describes the alternative capability in 2D BLT. Name G2D_BLEND G2D_DITHER G2D_GLOBAL_ALPHA Table 3. g2d_cap_mode enumeration Numeric Description 0 1 2 Enable alpha blend in 2D BLT Enable dither in 2D BLT Enable global alpha in blend Note: G2D_GLOBAL_ALPHA is only valid when G2D_BLEND is enabled. 7 i.MX Graphics User’s Guide, Rev. 0, 02/2018 NXP Semiconductors
2.2.4 g2d_rotation enumeration This enumeration describes the rotation mode in 2D BLT. Name G2D_ROTATION_0 G2D_ROTATION_90 G2D_ROTATION_180 G2D_ROTATION_270 G2D_FLIP_H G2D_FLIP_V Table 4. g2d_rotation enumeration Numeric Description 0 1 2 3 4 5 No rotation Rotation with 90 degree Rotation with 180 degree Rotation with 270 degree Horizontal flip Vertical flip 2.2.5 g2d_cache_mode enumeration This enumeration describes the cache operation mode. Table 5. g2d_cache_mode enumeration Name G2D_CACHE_CLEAN G2D_CACHE_FLUSH G2D_GLOBAL_INVALIDATE Numeric Description 0 1 2 Clean the cacheable buffer Clean and invalidate cacheable buffer Invalidate the cacheable buffer 2.2.6 g2d_hardware_type enumeration This enumeration describes the supported hardware type. Name G2D_HARDWARE_2D G2D_HARDWARE_VG Table 6. g2d_hardware_type enumeration Numeric Description 0 1 2D hardware type by default VG hardware type 2.2.7 g2d_surface structure This structure describes the surface with operation attributes. g2d_surface Members Type Description Table 7. g2d_surface structure format planes[3] left top right 8 g2d_format Pixel format of surface buffer Int Int Int Int Physical addresses of surface buffer Left offset in blit rectangle Top offset in blit rectangle Right offset in blit rectangle i.MX Graphics User’s Guide, Rev. 0, 02/2018 NXP Semiconductors
分享到:
收藏