Home
Graphics Driver Manual for 2D core of S6E2D devices
Contents
1. sssseeee 61 6 9 1 SUE MEE 61 6 10 Tutorial Cover FERRE FAMAE S AREA 65 6 10 1 SUMMAN AT 65 6 10 2 Usage ette rebar ea EET REM Eier en RES Ee 65 6 11 Tutorial Digital Picture 67 6 11 1 Sin t 67 6 12 Tutorial Simple Drawing tree Fe rec 67 6 12 1 ine E 67 6 12 2 Code een 68 6 12 3 CraWING TUNCHONS ee 71 7 Module ndex 5 ic Rete een AL este ee aes 74 71 Modules semen ltt Merete ee 74 8 ceca duet 75 81 Class 75 9 Data Structure 76 9 1 Data Structures i P 76 10 77 10 1 Jil Ecc 77 11 Module 79 11 1 Basic Graphics iion detenti 79 11 1 1 Detailed Description 79 11 2 Driver Initialization API 79 11 2 1 Detailed Description 80 4 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE 11 2 2 Macro Definition Documentation
2. 244 13 5 mm module id h File 244 13 5 1 Detailed Description 244 13 6 mm version h File 244 13 6 1 Detailed Description 245 19 7 mm types h File Reference 245 13 7 1 Detailed Description iii coire eic fe ettet 245 13 8 interrupthandler h File Reference 245 13 8 1 Detailed Description irr 246 13 9 config h File 246 13 9 1 Detailed Description ied teet et dere 246 13 10 display h File Reference 246 13 10 1 Detailed Description 250 13 11 erp h File Reference 250 19 11 1 Detailed 5 250 13 12 pixeng h File 250 13 12 11 Detailed Description 254 13 13 surfman h File 254 13 13 1 Detailed Description 4 4 4 256 13 14 sync h File Reference 44 4 8 256 13 14 1 Detailed 256 13 15 sysinit h File Refe
3. blend mode Starting blend mode for the window see mmIGdcDispWinSetBlendMode Return values MML OK on success Otherwise the related error code or MML ERR The documentation for this class was generated from the following file ut class window h 12 8 CSurface lt NUM BUFFERS gt Class Template Reference include ut class surface h Public Member Functions CSurface void Init CSurface MM ERROR Delete virtual MM ERROR CreateBuffer const MM 032 width const MM 032 height const MML GDC SURF FORMAT format MML GDC SURF FORMAT R8G8B8A8 MM U32 MaxSize 0 virtual MM_ERROR CreateBuffer const 032 width const 032 height 032 bit_red 032 bit green 032 bit blue 032 bit alpha virtual MM ERROR CreateGrayBuffer const 032 width const 032 height 032 bit color MM U32 bit alpha virtual MM ERROR SurfLoadBitmap const void BOOL FALSE virtual MM ERROR Copy MML GDC SURFACE surface MM 532 GetWidth MM S32 GetHeight MM BOOL HasBuffer SURFACE GetSurface SURFACE GetHandle operator MML SURFACE MM 032 GetBufferBufferCnt MML SURFACE GetSurface int id void Swap Protected Attributes SURFACE CONTAINER m buffer NUM BUFFERS MM 032 m bufferldx MM BOOL m bHasBuffer 218 S6E2DH 709 00022 1 0 September
4. pBlue Pointer to array of blue values The size of the array depends on format Return values MML OK On success MML ERR DISP INVALID If an invalid argument was passed September 11 2015 S6E2DH_AN709 00022 1v0 E 109 SS CYPRESS APPLICATION NOTE SF PERFORM 11 5 5 3 MM ERROR mmliGdcDispCommit MML DISPLAY display The display related setting modification will not be active immediately The mmlGdcDispCommit submits these settings for processing By default this function is blocked until previous operations of device display are completely executed Use mmlGdcConfigSetAttribute set MML CONFIG ATTR DISPLAY NOBLOCK to 1 to make it non blocking Parameters display An MML DISPLAY returned from a previous call to mmlGdcDispOpenbDisplay Return values MML OK On success MML ERR DISP INVALID If one of the parameters is invalid If the writing to the device display is denied because the previous commit open create or destroy call is not completely executed e g shadow load request is pending Call again later MML ERR DISP BUSY 11 5 5 4 MM ERROR mmlGdcDispDitherCtrl MML DISPLAY display MML GDC DISP DITHER ENABLE enable MML GDC DISP DITHER MODE mode MML GDC DISP DITHER RANGE range MML GDC DISP DITHER FORMAT format Used to configure dithering on the display controller The dither processing is act
5. 80 11 2 3 Function 81 11 3 Configuration 2 PEE 82 11 3 1 Enumeration Type Documentation 82 11 3 2 Function 83 114 Surface RI ee 84 11 4 1 Detailed DescrlptiOm iei iii rrr ERR 86 11 4 2 Macro Definition Documentation 87 11 4 3 Typedef Documentation sss 87 11 4 4 Enumeration Type Documentation 88 11 4 5 Function 92 11 5 s Display AP EE 95 11 5 1 Detailed 98 11 5 2 Macro Definition Documentation 100 11 5 3 Typedef 102 11 5 4 Enumeration Type Documentation 102 11 5 5 Function 108 11 6 Pixel Engine iit Ren 118 11 6 1 Detailed Description 121 11 6 2 Macro Definition Documentation 122 11 6 3 125 11 6 4 Enumeration Type Documentation 2 125 11 6 5 Function Documentation ic ioa Ere LER neem 128 11 7 Synchronization 1 141 11 7 1
6. September 11 2015 56 20 AN709 00022 1v0 E 249 4 2 CYPRESS APPLICATION NOTE PERFORM Window Functions MM ERROR mmlGdcDispWinCreate MML DISPLAY display DISP WINDOW PROPERTIES properties MML DISP WINDOW pWin MM ERROR mmlGdcDispWinDestroy MML DISP WINDOW win MM ERROR mmlGdcDispWinSetSurface MML DISP WINDOW win MM 032 target MML GDC SURFACE surf MM ERROR mmlGdcDispWinSetBlendMode MML DISP WINDOW win 032 blend mode MM ERROR mmlGdcDispWinSetMatrix MML GDC DISP WINDOW win MM 032 target const MM FLOAT matrix MM ERROR mmlGdcDispWinSync MML DISP WINDOW win MML SYNC sync MM ERROR mmlGdcDispWinWaitSync MML DISP WINDOW win MML SYNC sync MM ERROR mmlGdcDispWinSetAttribute MML DISP WINDOW win DISP WIN pname MM U32 param MM ERROR mmlGdcDispWinGetAttribute MML DISP WINDOW win DISP WIN pname MM 032 MM ERROR mmlGdcDispWinCommit MML DISP WINDOW win 13 10 1 Detailed Description Display 13 11 erp h File Reference Error Reporting include mm defines h stinclude mm gdc erp h Typedefs typedef void PRINTFUNCTION const char string Functions MM ERROR mmlGdcErpSetMessageLevel MM 032 moduleld MM ERP MESSAGE LEVEL level MM ERROR mmlGdcErpSetMessageChannel
7. MSKAND 008 0 88 11 6 2 18 MASK amp SRC 123 September 11 2015 S6E2DH_AN709 00022 1v0 E APPLICATION NOTE aer 77 CYPRESS MML GDC PE ROP NOTDSTCOPY 11 6 2 19 define MM_U08 0x0F DST 11 6 2 20 define NOTMASK MM U08 0x33 MASK 11 6 2 21 PE NOTMASKERASE MM_U08 0x11 MASK SRC 11 6 2 22 MML_GDC NOTSRCCOPY MM_U08 0x55 SRC 11 6 2 23 PE SRCCOPY MM_U08 0xAA SRC 11 6 2 24 define MML_GDC_PE_ROP_WHITENESS MM_U08 0xFF 11 6 2 25 define MML_GDC_PE_SRC 0x00000002U blit source surface define MML_GDC_PE_STORE 0x00000001U 11 6 2 26 blit write target 11 6 2 27 define MML_GDC_PE_TILE_FILL_CONSTANT 1U Samples outside the frame are filled with constant color S6E2DH_AN709 00022 1v0 E September 11 2015 124 CYPRESS APPLICATION NOTE itdefine MML PE TILE FILL ZERO 00 11 6 2 28 Samples outside the frame are treated as zero pixel value define MML PE TILE PAD 20 11 6 2 29 Samples outside the frame are padded with the last valid border pixels itdefine PE TILE PAD ZERO 3U 11 6 2 30 Applies tile mode PAD to RGB channels and tile mode ZERO to alpha channel 11 6 3 Typedef Documentation 11 6 3 1 typedef MML PE CONTEXT CONTAINER MML GDC PE CONTEX
8. 2D MATRIX void utMat3x3Scale Mat3x3 m MM FLOAT x MM FLOAT y MML 2D MATRIX void utMat3x3RotX Mat3x3 m MM FLOAT f 2D MATRIX void utMat3x3RotZ Mat3x3 m MM FLOAT f 2D MATRIX void utMat4x4Copy Mat4x4 dst const Mat4x4 src 20 MATRIX void utMat4x4Multiply Mat4x4 dst const Mat4x4 src1 const Mat4x4 src2 MML_GDC_2D_MATRIX_API void utMat4x4Loadldentity Mat4x4 m MML_GDC_2D_MATRIX_API void utMat4x4Translate Mat4x4 MM FLOAT x MM FLOAT MM FLOAT z 2D MATRIX void utMat4x4Scale Mat4x4 m MM FLOAT x MM FLOAT MM FLOATZ 2D MATRIX void utMat4x4RotX Mat4x4 m MM FLOAT f 2D MATRIX void utMat4x4RotY Mat4x4 m MM FLOAT f 2D MATRIX void utMat4x4RotZ Mat4x4 MM FLOAT f 2D MATRIX void utMat4x4Perspective Mat4x4 m MM FLOAT fovy MM FLOAT aspect MM FLOAT zNear MM FLOAT zFar 2D MATRIX void utMat4x4GetXYZ Mat4x4 m float x float y float z float xout float yout float zout Matrix functions for the conversion of matrices MML 2D MATRIX void utMat3x2ToMat4x4 Mat3x2 src Mat4x4 dst MML 2D MATRIX void utMat3x3ToMat4x4 Mat3x3 src Mat4x4 dst 2D MATRIX void utMat4x4ToMat3x3
9. DISP SUB LAYER sub layerlDZMML GDC DISP SUB LAYER DEFAULT MM 032 features 0 032 blend mode 0 virtual MM ERROR Close virtual MM BOOL SyncReagy virtual MM ERROR Commit virtual MM ERROR SetSurface MML SURFACE surf unsigned int GetWidth unsigned int GetHeight MML DISPLAY GetDisplay MML DISP WINDOW GetWindowHandle operator MML DISP WINDOW MML SYNC GetSync Data Fields MML DISP WINDOW m win MML DISPLAY m display MML DISP WINDOW PROPERTIES m windowProp 12 10 1 Detailed Description Generic Window class Base class for some specialized derived classes September 11 2015 S6E2DH_AN709 00022 1v0 E 223 APPLICATION NOTE iim 12 10 2 Constructor amp Destructor Documentation inline Cypress 12 10 2 1 CWindow Class CWindow constructor 12 10 2 2 CWindow inline Class CWindow destructor 12 10 3 Member Function Documentation virtual MM ERROR Close inline virtual on success Otherwise the related error code or 12 10 3 1 Close the window MML ERR Return values MML OK Reimplemented in CSurfaceWindow NUM BUFFERS gt and CSurfaceWindow 1 gt 12 10 3 2 virtual MM ERROR Commit inline virtual Apply all changes Return values MML OK on success Otherwise the related error code or MML ERR MML DISPLAY GetDisplay
10. 13 LES Du PE 14 41 2D Graphics Driver 14 4 2 JOUER TOPICS a2 Ecc 14 43 Surface OVervieW ierra eia re soe 14 4 3 1 Surface ODjSCtS ci a cdc ated 14 4 4 Display Overview erede ir ieri Pe d a rip 15 4 4 1 Usage nee 18 4 5 Overview Pixel Engine 19 4 5 1 Pixel Englne utet EEG HE eee ee 19 4 6 Synchronization 23 4 6 1 Processing Units iiiter ic tet ior regt 23 4 6 2 23 4 6 3 Sample use Cases Eee 24 4 7 Error Reporting 26 48 Memory Management 26 4 8 1 System Memory esito rae excea nist cR RE 26 4 8 2 Video Memory 26 4 8 3 26 4 8 4 Physical Address Virtual 5 27 4 9 Coordinate System Hints iie torte ted Ei poeti inea SA ER Ere FER Euge 27 4 9 1 Surface Image 27 4 9 2 Display coorditiates EEG RA steele 27 4 9 3 PIXENG COOMCINATCS eC 27 4 9 4 Matrix helper f nctlons
11. Color format of color lookup table Enumerator MML GDC SURF CLF R8G8B8 R8G8B8 MML GDC SURF CLF B8G8R8 B8G8R8 MML_GDC_SURF_CLF_R5G5B5 R5G5B5 MML GDC SURF CLF A1R5G5B5 A1R5G5B5 MML SURF CLF A4R4G4B4 A4R4G4B4 11 4 4 3 enum MML GDC SURF CLM Mode definition for color lookup table Enumerator MML GDC SURF CLM NEUTRAL Module in neutral mode input data is bypassed to the output MML GDC SURF CLM INDEX RGB Module in color index table mode LUT holds a R G B color value indexed with the red input color MML GDC SURF CLM INDEX RGBA Module in color index table mode LUT holds a R G B A color value indexed with the red input color 11 4 4 4 enum MML GDC SURF COMP Compression format Enumerator MML GDC SURF COMP NON The buffer is not compressed MML GDC SURF COMP RLC Run Length Encoded allowed for read buffers only MML GDC SURF COMP RLA Run Length Adaptive lossless compression allowed for read buffers only MML GDC SURF COMP RLAD Run Length Adaptive Dithering lossy compression S6E2DH 709 00022 1 0 September 11 2015 90 d APPLICATION NOTE F CYPRESS PERFORM 11 4 4 5 enum MML_GDC_SURF_FORMAT Color format of surface buffer The syntax for RGBA buffers is the following R G B A and X stands for red green blue alpha and unused The field description s is followed by the bit width For instance R5G6B5 used 5 red 6 green and 5 blue bits but no alpha N
12. Graphics Driver Manual Ee for 2D core of S6E2D devices LES E CYPRESS 32 BIT MICROCONTROLLER FM4 Family APPLICATION NOTE Issue Date September 11 2015 Publication Number S6E2DH_AN709 00022 Revision 1 0 Q YPRESS APPLICATION NOTE SF PERFORM Target products This application note is described about below products TYPE4 M4 Product Number not included Package suffix S6E2DH S6E2DH5G0A S6E2DH5GAA Se6E2DH5GJA 56 20 5 66 2 5 S6E2DF S6E2DF5G0A S6E2DF5GAA SeE2DF5GJA Se6E2DF5J0A SeE2DF5JAA S6E2D5 S6E2D55G0A S6E2D55GAA S6E2D55GJA S6E2D55J0A S6E2D55JAA S6E2D3 S6E2D35G0A S6E2D35GAA S6E2D35GJA S6E2D35J0A S6E2D35JAA S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE Table of Contents 1 2D Graphics enn Eee eie 11 1 1 About Doc rmnent e 11 2 Put e iix re Ere aiU 12 2 1 Target System o ane ie eere dee te Tu i reete xx d a eh 12 22 About this i terrd e 12 2 3 Copyright i RERO ER Re E 12 SNC Stated PES 13 3 1 13 3 2 13 3 9 HARARE MAN
13. enum SURF SURF CLF R8G8B8 MML SURF CLF B8G8R8 MML R5G5B5 MML SURF A1R5G5B5 MML SURF CLF enum SURF SURF NEUTRAL 0x0 MML GDC SURF CLM INDEX RGB MML GDC SURF CLM INDEX RGBA enum MML SURF MML GDC SURF ATTR BASE ADDRESS 0x0 MML GDC SURF ATTR PHYS ADDRESS MML SURF ATTR BASE ADDRESS 2 SURF ATTR PHYS ADDRESS2 MML SURF WIDTH MML GDC SURF ATTR HEIGHT MML GDC SURF ATTR STRIDE MML SURF ATTR BITPERPIXEL MML GDC SURF ATTR COLORBITS MML GDC SURF ATTR COLORSHIFT MML GDC SURF ATTR COMPRESSION FORMAT MML GDC SURF ATTR RLAD MAXCOLORBITS MML SURF ATTR SIZEINBYTES MML GDC SURF ATTR CLUTMODE CE CYPRESS PERFORM September 11 2015 S6E2DH_AN709 00022 1v0 E 85 go CEN CYPRESS APPLICATION NOTE MML GDC SURF ATTR CLUTCOUNT MML GDC SURF ATTR CLUTBITPERPIXEL MML GDC SURF ATTR CLUTCOLORBITS MML GDC SURF ATTR CLUTCOLORSHIFT MML GDC SURF ATTR CLUTBUFFERADDRESS MML GDC SURF ATTR CLUTBUFFER PHYS ADDRESS MML SURF ATTR SURF FORMAT MML GDC SURF ATTR USERDEFINED Functions MM ERROR mmlGdcSmResetSurfaceObject MML SURFACE surf MM ERROR mmlGdcSmAssig
14. SRC MML PE GEO MATRIX FORMAT 3X2 mat BMP but we render the whole target buffer in one step UTIL SUCCESS ret mmlGdcPeSelectArea amp ctx MML PE STORE while TRUE 58 S6E2DH_AN709 00022 1v0 E September 11 2015 APPLICATION NOTE Cypress PERFORM Blend the hub over rotated needle but we draw the whole target frame so we don t need to clear the buffer UTIL SUCCESS ret mmlGdcPeSetMatrix amp ctx MML DST MML PE GEO MATRIX FORMAT 3X2 mat BMP NEEDLE UTIL_SUCCESS ret mmlGdcPeBlt amp ctx BGR WIDTH 0 51 ROT CENTER Y Now we have only one rendering step The hardware fills black pixels outside the hub and needle buffer and this is exactly what we need to clear the previous frame Figure 6 11 Version 3 6 8 6 4 Version 4 The previous version must always update the whole layer frame although only a very small part the old needle must be redrawn The most efficient way would be to re render only the new and the old needle parts UTIL SUCCESS ret mmlGdcPeBindSurface amp ctx MML PE STORE amp sNeedle Blend hub over rotated needle to store UTIL_SUCCESS ret mmlGdcPeBindSurface amp ctx MML PE DST amp sSrc BMP NEEDLE UTIL SUCCESS ret mmlGdcPeBindSurface amp ctx MML PE amp sSrc BMP UTIL SUCCESS ret mmlGdcPeSetMatrix amp ctx MML SRC
15. DISPLAY display MM U32line Delay blit execution until a defined line is passed by the display controller mmlGdcPeWaitForDispFrameEnd adds an instruction to the blit draw command list to wait until the display controller enters a defined line It can be used to start rendering in the blanking phase or at a defined time point in a single render buffer solution This function can be called multiple times within a frame to coordinate rendering of different regions Parameters display An MML DISPLAY returned from a previous call to mmlGdcDispOpenbDisplay line The line parameter defines the display line when rendering starts O stands for the first line The maximal valid line is the vertical resolution i e rendering will be continued in the blanking phase 11 6 5 22 MML MM ERROR mmiGdcPeWaitSync MML GDC SYNC sync Inserts a sync wait into the 2D command stream similar to the OpenGL glWaitSync call PixEngine operations performed after this call are only executed after sync gets signaled Parameters Return values MML OK On success Otherwise the related error code 140 S6E2DH_AN709 00022 1v0 E September 11 2015 APPLICATION NOTE Synchronization Synchronization of framebuffer operations Data Structures struct MML SYNC CONTAINER Typedefs typedef SYNC CONTAINER MML SYNC Functions MM ERROR mmlGdcSyncReset MML
16. edet eere 28 4 10 Image 0 nennen nennen ren rene n nenne rennen nnns 29 4 10 1 Compression Fortmals 1 rre reri aepo 29 4 11 Images With Color Index 31 4 11 1 Alpha SUPDOME sissies seek EM 31 4 11 2 31 4 11 3 Golot table teure EE aep tete ger 31 4 11 4 Surface properties for indexed 31 4 11 5 Index images for 32 4 11 6 Index images for the men 32 GOSS EE 33 6 ee eee ide EL ee 36 6 1 About the ees Ld cd ce I DD 36 6 2 Application 36 6 3 Restrictions 36 6 4 Tutorial Chapters sc cic err eta ee E 36 6 5 Tutorial 1 Surfaces Display 37 September 11 2015 56 20 AN709 00022 1v0 E M CYPRESS APPLICATION NOTE Wy PERFORM 6 5 1 EE 37 6 5 2 Chapters aet temet a etti dra 37 6 5 3 5 37 6 5 4
17. PE CLUT FORMAT format const MM S16 pRed const MM 516 pGreen const MM S16 pBlue Used to configure the Color Lookup Table CLUT e g for gamma correction The format MML GDC PE CLUT FORMAT 256 defines 256 sample points representing the the resulting color channel intensity The format MML GDC PE CLUT FORMAT 33 defines 33 sample points representing the resulting color channel intensity Intermediate values will be interpolated by the HW The 1st sample point corresponds to input color code 0 2nd one to 32 last one to 1024 of the 10 bit 2D core internal processing pipeline Although input 1024 is not possible the last sample point is needed for interpolation of codes 993 to 1023 An index entry of 0 stands for the minimum 1023 for the maximum intensity Index values outside this range will be clamped Note September 11 2015 S6E2DH_AN709 00022 1v0 E 133 APPLICATION NOTE SF PERFORM Example Let F in be the requested gamma formula Input values of F in are in the range 0 0 1 0 It is allowed that the output value is smaller than 0 0 or bigger 1 0 The value array in this example pRed must be calculated in the following way MML PE CLUT FORMAT 256 for i 0 i lt 255 i pRed i MM_S16 0 5f F i 255 0f 1023 0f MML PE CLUT FORMAT 33 for i 0 lt 32 i pRed i MM_S16 0 5f F i 32 0f 1024 0f 1023 0f 1023 Plea
18. SYNC ACCESS FAILED ERRCODE 0x11005002 define ERR SYNC TIMEOUT MM ERRCODE 0x11005003 define ERR CARD DEV BUSY MM ERRCODE 0x11007001 define ERR CARD TIMEOUT EXPIRED ERRCODE 0x11007002 define ERR CARD ACCESS FAILED ERRCODE 0x11007003 define ERR CARD TIME INTERVAL MM ERRCODE 0x11007004 define ERR CARD NOTSUPPORTED ERRCODE 0x11007005 11 10 1 Detailed Description Error Codes of this driver include errors h All used Error Codes for all modules are collected here 11 10 2 Macro Definition Documentation 11 10 2 1 define MMD ERR CARD ACCESS FAILED MM ERRCODE 0x11007003 An unexpected internal error occurred 11 10 2 2 ERR CARD BUSY ERRCODE 0x11007001 Access to a device is denied e g because a shadow load request is pending September 11 2015 S6E2DH_AN709 00022 1v0 E 153 APPLICATION NOTE 7 CYPRESS define MMD_ERR_GDC_CARD_DEV_NOTSUPPORTED 11 10 2 3 MM ERRCODE 0x11007005 Operation not supported for device define ERR CARD TIME INTERVAL 11 10 2 4 MM ERRCODE 0x11007004 Time interval for measurement to short define ERR CARD TIMEOUT EXPIRED 11 10 2 5 MM ERRCODE 0x11007002 A timeout expired while
19. SYNC TIMEOUT return MML OK Bind new background buffer to render context mmlGdcPeBindSurface amp ctx MML GDC PE STORE MML PE DST amp pdbWin gt sFramebuffer pdbWin gt id Render the next frame mmlGdcPe mmlGdcPe mmlGdcPe Get a sync object for the last blit operation mmlGdcPeSync amp pdbWin sync and push it in the windows pipe It ensures that the new buffer becomes visible after the last blit is executed in the hardware mmlGdcDispWinWaitSync pdbWin gt win amp pdbWin gt sync Swap the foreground and background layeron display mmlGdcDispWinSetSurface pdbWin gt win MML GDC DISP BUFF TARGET COLOR BUFF amp pdbWin gt sFramebuffer pdbWin gt id Commit changes mmlGdcDispWinCommit pdbWin gt win 24 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE Get a sync object for this commit function for the next loop mmlGdcDispWinSync pdbWin gt win amp pdbWin gt sync Switch foreground and background buffer id pdbWin gt id pdbWin gt id 0 1 0 return MML OK Here is the calling render loop main DOUBLE_BUFFERED_WINDOW win_struct Init variables open window Bind new background buffer to render context mmlGdcPeBindSurface amp ctx MML_GDC_PE_STORE MML GDC PE DST amp win struct sFramebuffer win struct id Render the first frame mmlGdcPe mmlGdcPe mmlG
20. define MML GDC DISP RGB HIGH 10 lt lt 3 Default initializer define define Typedefs typedef struct MML_GDC_DISPLAY MML GDC DISPLAY typedef struct MML_GDC_DISP_WINDOW MML_GDC_DISP_PROPERTIES_INITIALIZER MML GDC DISP WINDOW PROPERTIES INITIALIZER MML DISP WINDOW September 11 2015 56 20 AN709 00022 1v0 E 247 89 CYPRESS 4 APPLICATION NOTE PERFORM Enumerations enum MML DISP CONTROLLER MML DISP CONTROLLER 0 0 enum MML DISP MODE MML DISP SINGLE SCREEN 0 MML DISP DUAL SCREEN MML DISP DUAL VIEW enum MML DISP OUTPUT SCREEN DISP OUTPUT SCREEN PRIMARY 0 DISP OUTPUT SCREEN SECONDARY DISP OUTPUT SCREEN BOTH enum MML DISP MML DISP FILTER NEAREST 0 MML DISP FILTER BILINEAR enum MML DISP MML GDC DISP TILE MODE ZERO 0 MML DISP MODE CONST 1 MML DISP MODE PAD 2 MML DISP TILE MODE CLIP 3 enum MML DISP LAYER MML DISP LAYER 0 0 MML DISP LAYER 1 enum MML DISP SUB LAYER MML DISP SUB LAYER DEFAULT 0 MML DISP SUB LAYER MML DISP SUB LAYER MML DISP SUB LAYER MML DISP SUB LAYER DISP SUB LAYER MML DISP SUB LAYER MML
21. define MML GDC PE ROP NOTMASKERASE MM U08 0x11 define MML GDC PE ROP MERGEMASK MM_U08 0xEE define MML GDC PE ROP MERGEMASKNOT MM_U08 0xBB define MML GDC PE DSTCOPY U08 OxFO define MML GDC PE ROP NOTDSTCOPY MM_U08 0x0F define MML GDC PE ROP DSTPAINT MM U08 OxFE define MML GDC PE ROP MASKSEL MM_U08 0xB8 define MML GDC PE ROP DSTAND MM U08 0x80 define MML GDC PE FILTER_NEAREST 0 define MML GDC PE FILTER_BILINEAR 1 define MML GDC PE ATTR_ZERO_TOP_LEFT 0U define MML GDC PE ATTR_ZERO_BOTTOM_LEFT 1U define MML GDC PE TILE FILL_ZERO 0U define MML GDC TILE FILL CONSTANT 1U define MML GDC PE TILE PAD 20 define MML TILE PAD ZERO 3U Typedefs typedef PE CONTEXT CONTAINER MML PE CONTEXT Enumerations enum MML PE CTX ATTR PE CTX DITHER COLOR MML PE ATTR DITHER ALPHA MML CTX ATTR DITHER OFFSET PE ATTR FILTER PE ZERO POINT September 11 2015 56 20 AN709 00022 1v0 E 251 CYPRESS APPLICATION NOTE PERFORM
22. lrisExampleCleanup Reset graphics system interactive applications use the buttons of the FM4 Starter Kit to control the software This is accomplished by state variables set in ButtonCallback and passed on to IrisExampleDraw 6 3 Restrictions Please note that the sample code for this release may differ from the final version Especially the usage of synchronization instructions might not always represent the final version 6 4 Tutorial chapters The Tutorial 1 Surfaces Display Basic show the basic steps to use the 2D Graphics Driver It starts explaining surface objects executes some simple graphical operations to fill a pixel buffer and it ends up showing the rendered buffer on a screen connected to the S6E2D hardware The Tutorial Display Basic demonstrates the capabilities of the display path based on an example showing a navigation solution including different display layers The Tutorial Display Extended demonstrates buffer swapping technique for multiple windows The Tutorial Speedometer demonstrates an application for creating a speed gauge including a rotating needle Application uses techniques such as active area and background restoration The Tutorial Chart shows a single render buffer solution The Tutorial Cover Flow demonstrates several PixelEngine features in form of a cover flow The Tutorial Digital Picture Frame demonstrates several PixelEngine features in form of digital picture frame Th
23. DISP CLUT FORMAT MML DISP CLUT FORMAT 33 33 enum MML DISP FORMAT DISP CMATRIX FORMAT 4X3 0 MML DISP CMATRIX FORMAT 5X4 enum MML DISP DISP ATTR OUTPUT CONTROLLER 0 DISP ATTR X RESOLUTION DISP ATTR Y RESOLUTION MML DISP BUFF ERR DISP ATTR BACKGROUND COLOR enum MML DISP WIN DISP WIN ATTR LAYER ID 0 DISP WIN ATTR SUB LAYER ID GDC DISP WIN ATTR TOPLEFT X DISP WIN ATTR TOPLEFT DISP WIN WIDTH DISP WIN ATTR HEIGHT DISP WIN ATTR SCREEN DISP WIN ATTR COLOR DISP WIN ATTR DISABLE DISP WIN ATTR SWAP INTERVAL MML DISP WIN ATTR MAX BUFFER 96 S6E2DH 709 00022 1 0 September 11 2015 CE APPLICATION NOTE F CYPRESS e PERFORM MML_GDC_DISP_WIN_ATTR_TILE_MODE MML_GDC_DISP_WIN_ATTR_FEATURE Layer feature request define MML_GDC_DISP_FEATURE_INDEX_COLOR 1 lt lt 0 define MML_GDC_DISP_FEATURE_DECODE 1 lt lt 1 define MML_GDC_DISP_FEATURE_MULTI_LAYER 1 lt lt 7 Buffer target define MML_GDC_DISP_BUFF_TARGET_COLOR_BUFF 1 lt lt 1 Blend modes define MML_GDC_DISP_B
24. DISP SUB LAYER DISP SUB LAYER 8 NOOR WD enum MML_GDC_DISP_DCK_DELAY_ENABLE MML_GDC_DISP_DCK_DELAY_OFF 0 MML_GDC_DISP_DCK_DELAY_ON enum MML_GDC_DISP_DCK_INVERT_ENABLE MML_GDC_DISP_DCK_INVERT_OFF 0 MML_GDC_DISP_DCK_INVERT_ON enum MML_GDC_DISP_DITHER_ENABLE MML_GDC_DISP_DITHOFF 0 MML_GDC_DISP_DITHON enum MML_GDC_DISP_DITHER_MODE MML_GDC_DISP_TEMPDITH 0 MML_GDC_DISP_SPATDITH 1 lt lt 4 enum MML GDC DISP DITHER RANGE MML_GDC_DISP_DITHRS11LOW 0 enum MML DISP DITHER FORMAT MML DISP DITHER108 0x08080800 248 S6E2DH 709 00022 1 0 September 11 2015 CYPRESS APPLICATION NOTE PERFORM DISP DITHER107 0x07070700 DISP DITHER106 0x06060600 DISP DITHER105 0x05060500 enum MML DISP FORMAT MML DISP CLUT FORMAT 33 33 enum MML DISP FORMAT DISP FORMAT 4X3 0 MML DISP FORMAT 5X4 enum DISP ATTR DISP ATTR OUTPUT CONTROLLER 0 DISP ATTR X RESOLUTION MML DISP ATTR Y RESOLUTION MML DISP ATTR BUFF ERR DISP ATTR BACKGROUND COLOR enum MML DISP WIN DISP
25. DISP WRONG WINDOW ERRCODE 0x21001015 define MML ERR DISP WRONG PARAMS ERRCODE 0x21001016 define MML ERR DISP DISPLAY MODE MISSMATCH ERRCODE 0x21001017 define MML ERR DISP INVALID SCALING ERRCODE 0x21001018 define MML ERR DISP INVALID BLENDING MM_ERRCODE 0x21001019 define ERR DISP INVALID CLUTDATA ERRCODE 0x2100101a define MML ERR DISP INVALID MM ERRCODE 0x2100101c define MML ERR DISP BUSY MM ERRCODE 0x21001020 September 11 2015 S6E2DH_AN709 00022 1v0 E 241 89 CYPRESS 4 APPLICATION NOTE PERFORM Error codes for Error Reporting API define ERR ALREADY INITIALIZED MM ERRCODE 0x2100F000 define MML ERR ERP NOT INITIALIZED MM ERRCODE 0x2100F001 define ERR INVALID PARAMETER MM ERRCODE 0x2100F002 Error codes for Pixel Engine API Error define MML ERR PE OUT OF SPACE MM ERRCODE 0x2100D001 define ERR PE INVALID CONTEXT MM ERRCODE 0x2100D002 define ERR PE INVALID TARGET MM ERRCODE 0x2100D003 define MML ERR PE INVALID SURFACE OBJECT ERRCODE 0x2100D004 define ERR PE INVALID ADDRESS MM ERRCODE 0x2100D005 define ERR PE INVALID MATRIX MM ERRCODE 0x2100D006 define MML E
26. Matrix functions for the conversion of matrices 2D MATRIX void utMat3x2ToMat4x4 2D MATRIX void utMat3x3ToMat4x4 2D MATRIX void utMat4x4ToMat3x3 2D MATRIX void utMat4x4ToMat3x2 Mat3x2 src Mat4x4 dst Mat3x3 src Mat4x4 dst Mat4x4 src Mat3x3 dst Mat4x4 src Mat3x2 dst SoS Matrix functions for color operations MML 2D MATRIX void utMat4x3Copy Mat4x3 dst const Mat4x3 src 2D MATRIX void utMat4x3Multiply Mat4x3 dst const Mat4x3 src1 const Mat4x3 src2 MML_GDC_2D_MATRIX_API void utMat4x3Loadldentity Mat4x3 m MML_GDC_2D_MATRIX_API void utMat5x4Loadldentity Mat5x4 m 2D MATRIX void utMat4x3CalcColMatrix Mat4x3 dst MM FLOAT fContrast MM FLOAT fBrightness MM FLOAT fSaturation MM FLOAT fHue 178 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE 11 17 1 Detailed Description The functions in this block are used by some tutorial examples for matrix operations Different matrix formats and related functions are defined to support different use cases Mat3x2 This matrix format is sufficient for a fine operations like translation rotation scaling and sharing Mat3x3 A 3x3 matrix is required for perspective operations Mat4x4 4x4 matrix is required for perspective operations including 2 depth calculation The 2D
27. The focus of Display Extended is the synchronization of blit and buffer swap operations Open multiple windows on the display and prepare double buffering Trigger simple render operations and buffer swaps for each window Use different swap intervals for windows September 11 2015 S6E2DH_AN709 00022 1v0 E 49 ea P CYPRESS APPLICATION NOTE PERFORM 6 7 2 6 7 3 Setup The initialization routine opens the display controller Then it opens any vertical arranged windows Each window prepares 2frame buffers that will be used as foreground and background buffer Abiit context Anda sync object A structure for each window keeps all important variables to control the window struct DOUBLE BUFFERED WINDOW MML GDC DISP WINDOW win the window handle MML GDC SURFACE CONTAINER sFramebuffer 2 two buffers described in surface objects MML GDC SYNC CONTAINER sync a sync object used MML GDC PE CONTEXT CONTAINER ctx context for drawing MM 008 id an id storing which buffer is currently the foreground buffer MM FLOAT fRot a draw related parameter The final step for each window is getting sync object of the window pipe This sync object can be used to detect if the OpenWindow call is finished in the HW Draw function The main draw function calls a draw for each window Each window draw function checks first the window sync object If the sync object signals a timeout the
28. class CDisplay 13 20 1 Detailed Description This class abstracts the display initialisation 13 21ut class menu h File Reference This class realizes a simple menu include wchar h include sm util h stinclude ut compatibility h include ut class window h include ut class surface h include ut freetype h include pe matrix h Data Structures class CMenultem class CMenu 260 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE 13 22 2 1 13 21 1 Detailed Description This class realizes a simple menu 13 22ut class rlad h File Reference ES CYPRESS This sample code can be used to compress a buffer using the COMP RLA MML COMP RLAD or MML SURF COMP RLAD UNIFORM format include lt assert h gt include lt vector gt include lt queue gt Data Structures class RLAD class RLAD Frame struct RLAD Frame Pixel class RLAD BitStream struct RLAD Package Macros define RLAD VERSION 1 02 13 22 1 Detailed Description This sample code can be used to compress a buffer using the MML GDC SURF COMP RLA MML GDC SURF COMP RLAD or MML GDC SURF COMP RLAD UNIFORM format 13 22 2 Macro Definition Documentation define RLAD VERSION 1 02 Version information of this file 13 23ut class surface h File Reference This class abstracts MML SURFACE object
29. define MODULEID moduleld MM MODULE moduleld define MML ERR MM ERRCODE 0x3FFFFFFF define ERR MM ERRCODE 0x7FFFFFFF define MML_OK MM ERRCODE 0xO0 define MMD OK MM ERRCODE 0x0 define MM FALSE 0 define MM TRUE MM BOOL 1 define NULL void 0 define MM BIT x 1U x define MM TO ADDR 3 define MM ADDR TO void x define MM ADDR TO UINT32 x MM U32 x define MM UINT32 TO ADDR x MM ADDR 9 define UINT32 x MM U32 x define MM UINT32 TO void x define MM ADDR TO UINT32PTR x MM 132 define MM ADDR TO SINT32PTR x MM 532 define MM IO IRIS SUBSYSTEM 0xD0A00000U define MM IO IRIS CORE 0xD0A10000U define NULL FUNCTION void 0 define UNUSED_PARAMETER x void x MM ADDR x 11 14 1 Detailed Description 11 14 2 Macro Definition Documentation 11 14 2 1 define ADDR TO voids x Conversion MM ADDR to void 11 14 2 2 define ADDR TO SINT32PTR X 5832 Conversion ADDR to MM 532 11 14 23 define ADDR UINT32 32 Conversion ADDR to 032 11 14 24 define ADDR UINT32PTR X 132 Conversion ADDR to U32 11 14 2 5 MM x 10 lt lt Set bit 170 S6E2DH_AN709 00022 1v0 E September 11 201
30. enum MML_GDC_PE_SURF_ATTR MML_GDC_PE_SURF_ATTR_COLORMULTI MML GDC PE SURF ALPHAMULTI MML GDC PE SURF ATTR TILE MODE MML GDC PE SURF ATTR USE CLIPPING enum MML PE GL ZERO 0x0U MML PE BF GL ONE 0x1U MML GDC PE BF GL SRC COLOR 0x300U MML PE BF GL ONE MINUS COLOR 0x301U MML PE BF GL SRC ALPHA 0x302U MML GDC PE BF GL ONE MINUS SRC ALPHA 0x303U MML PE BF GL DST ALPHA 0x304U MML GDC PE BF GL ONE MINUS DST ALPHA 0x305U MML GDC PE BF GL DST COLOR 0x306U MML PE BF GL ONE MINUS DST COLOR 0x307U MML PE GL SRC ALPHA SATURATE 0x308U MML GDC PE BF GL CONSTANT COLOR 0x8001U MML BF GL ONE MINUS CONSTANT COLOR 0x8002U MML BF GL CONSTANT ALPHA 0x8003U MML BF GL ONE MINUS CONSTANT ALPHA 0x8004U enum MML PE GL FUNC ADD 0x8006U MML GDC PE BM GL MIN 0x8007U MML PE BM GL MAX 0x8008U MML GDC PE BM GL FUNC SUBTRACT 0x800AU MML PE BM GL REVERSE SUBTRACT 0x800BU MML PE BM VG BLEND SRC 0x2000U MML PE BM VG BLEND SRC OVER 0x2001U BM VG BLEND DST OVER 0x2002U MML PE BM VG BLEND SRC 0x2003U MML PE BM VG BLEND DST IN 0 20040 MML PE BM VG BL
31. 196 11 19 3 Function 196 11 20 Utilities for the compression 199 11 20 1 Detailed Description 199 11 20 2 Function 199 11 21 Utilities for RLA run length adaptive compression 200 11 21 1 Detailed Description 200 11 22 Utilities for run length compression 200 11 221 Detailed Description 200 11 22 2 Function Documentations 200 11 23 class ee 201 11 23 1 Detailed Description 201 Du xov HR 201 11524 17 Detailed Description r dert 201 RSINOBIUc G 201 11 25 1 Detailed Description 201 14 26 60 ee cet fae 201 11 26 1 Detailed Description iibri inicia 202 202 11 27 1 Detailed Description 202 11 28 CSurace dice Ge RR ais 202 11 28 1 Detailed 203 11 28 2 Function 203 1129 ep EE 205 11 29 1 Detailed Description sirine 205 12 Data Structure Documentation 207 12 1 RLAD BitStream Class Refere
32. Calculate the inverted matrix Parameters The matrix to modify Return values MML OK On success Otherwise The related error code 111744 2D MATRIX void utMat3x2Loadldentity Mat3x2m Reset the matrix content to a unit matrix Parameters The matrix to modify 11 17 4 5 MML 2D MATRIX void utMat3x2Multiply Mat3x2 dst const Mat3x2 src1 const Mat3x2 src2 Multiply 2 matrices The resulting matrix represents dst src1 src2 September 11 2015 S6E2DH_AN709 00022 1v0 E 181 YPRESS PERFORM Parameters APPLICATION NOTE The destination matrix The first source matrix The second source matrix 11 17 46 2D MATRIX void utMat3x2Rot Mat3x2 m MM FLOAT Modify a matrix to realize a rotation The resulting matrix represents m m rot Parameters inout m The matrix to modify in f 11 17 4 7 Rotation angle in degrees m MM FLOAT MML 2D MATRIX void utMat3x2RotPre Mat3x2 Modify a matrix by pre multiplying a rotation matrix The resulting matrix represents m 2 m rot m Parameters in out m The matrix to modify in f Rotation angle in degrees 11 17 48 2D MATRIX void utMat3x2Scale Mat3x2 m MM FLOAT x MM FLOATy Modify a matrix to realize a scale operation The resulting matrix represents m m scale Parameters in out The matrix to modify
33. Fade a layer Move a layer Switch buffers Use multi layer feature 6 6 1 2 Layer overview The example uses the following 4 surfaces September 11 2015 SSE2DH AN709 00022 1v0 E 43 F CYPRESS APPLICATION NOTE Surface Preview Dimension Color Format Shown features name The surface will be moved in a way that only a part of it is visible LAYER 0 1024 1024 Sub pixel precise movements for smooth animation 8 bits per pixel RGB 332 The unusual format 3 bit red 3 bit green 2 bit blue realizes an acceptable memory requirement Note Compression cannot be used for layers if the whole frame is not inside the display The unusual format 3 bit red 3 bit green 4 bit blue 6 bit alpha realizes an acceptable memory 16 bits per requirement sFrame 320 240 pixel RGBA R3G3B4A6 Note Compression cannot be used for this window because it is multi layer window 32 bit per pixel sPosition The layer will be faded in and out RGBA sArrow 1 and 2 bit per The image does not include any color data but only SArrow I about 40 50 pixel Alpha transparency sArrow_r 6 6 2 The limited number of layer blend units requires using the multi layer feature It means we use one normal like in this example however only the top most window color will be fetched and used for blending window as background window showing the moving map The frame t
34. bit red bit green bit blue bit alpha Number of blue bits in the buffer s Number of alpha bits in the buffer s Return values on success Otherwise the related error code or MML OK MML ERR 12 9 2 4 MM ERROR CreateGrayBuffer MM U32 bit color MM U32 bit alpha inline Create one or more pixel buffers with the size of the window and a grey pixel format Parameters in bit color Number of grey bits in the buffer s in bit alpha Number of alpha bits in the buffer s Return values MML OK on success Otherwise the related error code or ERR S6E2DH 709 00022 1 0 September 11 2015 222 APPLICATION NOTE XJ CYPRESS PERFORM 12 9 2 5 virtual MM ERROR Swap inline virtual Push the current buffer to the display and select the next buffer if any for next drawing operations Return values MML OK on success Otherwise the related error code or ERR 12 9 3 Field Documentation 12 9 3 1 CSurfacecNUM BUFFERS surface The surface array for this window The documentation for this class was generated from the following file ut class window h 12 10 CWindow Class Reference include ut class window h Public Member Functions OWindow OWindow virtual MM ERROR Open MML DISPLAY display MM S32 x 0 532 y 0 MM 032 w 0 MM 032 h 0 MML DISP LAYER DISP LAYER 0
35. define MML 2D MATRIX extern Typedefs typedef MM FLOAT Mat3x2 6 typedef MM FLOAT Mat3x3 9 typedef MM FLOAT Mat4x4 16 typedef MM FLOAT Mat4x3 12 typedef MM FLOAT Mat5x4 20 Matrix functions for geometric operations MML 2D MATRIX void utMat3x2Copy Mat3x2 dst const Mat3x2 src MML 2D MATRIX void utMat3x2Multiply Mat3x2 dst const Mat3x2 src1 const Mat3x2 src2 MML GDC 2D MATRIX void utMat3x2Loadldentity Mat3x2 m MML 2D MATRIX void utMat3x2Translate Mat3x2 m MM FLOAT x MM FLOAT y MML 2D MATRIX void utMat3x2TranslatePre Mat3x2 m MM FLOAT x MM FLOAT y September 11 2015 S6E2DH_AN709 00022 1v0 E 177 E APPLICATION NOTE PERFORM 2D MATRIX void utMat3x2Scale Mat3x2 m MM FLOAT x MM FLOAT y 2D MATRIX void utMat3x2ScalePre Mat3x2 m MM FLOAT x MM FLOAT y 2D MATRIX void utMat3x2Rot Mat3x2 m MM FLOAT f 2D MATRIX void utMat3x2RotPre Mat3x2 m MM FLOAT f 2D MATRIX MM U32 utMat3x2Invert Mat3x2 m 2D MATRIX void utMat3x2GetXY const Mat3x2 m const MM FLOAT x const MM FLOAT y MM FLOAT MM FLOAT MML 2D MATRIX void utMat3x3Loadldentity Mat3x3 m MML 2D MATRIX void utMat3x3Copy Mat3x3 dst
36. void Init void Reset PE CONTEXT GetHandle operator MML GDC PE CONTEXT 12 2 1 Detailed Description Class CCtx see CCtx 12 2 2 Constructor amp Destructor Documentation 12 2 2 1 CCtx inline Class CCtx constructor 208 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE PERFORM 12 2 2 2 CCtx inline Class CCtx destructor 12 2 3 Member Function Documentation 12 2 3 1 MML GDC PE CONTEXT GetHandle inline Return the PE CONTEXT object 12 2 3 2 inline Initialize context variables 12 2 3 3 operator MML GDC PE CONTEXT inline Return the PE CONTEXT object for direct use with 2D core driver calls 12 2 3 4 void Reset inline Reset the draw buffer The documentation for this class was generated from the following file class ctx h 12 3 CDevice Class Reference include ut class device h Public Member Functions MM ERROR Open 032 uCmdSeqSize 0 MM ERROR Close MM BOOL IsOpen 12 3 1 Detailed Description Class CDevice 12 3 2 Constructor amp Destructor Documentation 12 3 2 1 CDevice inline Class CDevice constructor 12 3 2 2 CDevice inline Class CDevice destructor September 11 2015 S6E2DH_AN709 00022 1v0 E 209 9 d 5 CYPRESS APPLICATION NOTE PERFORM 1
37. DISP DEVICE NOT FOUND MM ERRCODE 0x21001001 The display adapter requested was not found 11 10 2 28 MML ERR GDC DISP DISPLAY ALREADY OPEN MM ERRCODE 0x21001002 The display being opened was already open 11 10 2 29 MML ERR GDC DISP DISPLAY MODE MISSMATCH MM ERRCODE 0x21001017 The display is already opened and the current mode does not fit 11 10 2 30 MML ERR DISP FAILED MM ERRCODE 0x21001014 The operation failed for an unknown reason 11 10 2 31 define MML ERR DISP INVALID MM ERRCODE 0x21001003 An invalid argument was passed 11 10 2 32 define MML ERR DISP INVALID BLENDING MM ERRCODE 0x21001019 The blend mode is not supported 11 10 2 33 MML ERR DISP INVALID CLUTDATA MM ERRCODE 0x2100101a The CLUT data is not valid 157 September 11 2015 56 20 AN709 00022 1v0 E APPLICATION NOTE PERFOR YPRESS 11 10 2 34 define MML ERR GDC DISP INVALID DIMENSION MM ERRCODE 0x2100101c The buffer width or height is not valid define MML ERR DISP INVALID SCALING 11 10 2 35 MM ERRCODE 0x21001018 The scale factor is not supported MML ERR GDC DISP LAYER ALREADY USED define MM_ERRCODE 0x21001008 The requested layer is already being used 11 10 2 36 11 10 2 37 define MML ERR GDC DISP OUT OF SYSTEM MEMORY MM ERRCODE 0x21001007 The system is out of memory 11 1
38. SYNC sync MM ERROR mmlGdcSyncWait MML SYNC sync 532 timeout MM ERROR mmlGdcSynclncr MML SYNC sync MM S32 incr 11 7 1 Detailed Description Synchronization API Synchronization of framebuffer operations include sync h The Synchronization API provides mechanisms to synchronize framebuffer operations These are 2D graphics operations e g blt finished Display operations e g framebuffer displayed VSync happened Synchronization is achieved through sync objects a representation of events whose completion status can be tested or waited upon Waiting can be done by The CPU see mmlGdcSyncWait As part of a graphics operation more details below The function to initialize a sync object i e setting the sync condition and the function to perform a wait as part of a graphics operation are part of the corresponding module s 2D operations See Pixel Engine Display See Display 11 7 2 Typedef Documentation 11 7 2 1 typedef MML SYNC CONTAINER MML SYNC The sync object definition September 11 2015 56 20 AN709 00022 1v0 E 141 SES CYPRESS 11 7 Synchronization API PERFORM W 2 CYPRESS APPLICATION NOTE SF PERFORM 11 7 3 Function Documentation 11 7 3 1 MM ERROR mmliGdcSyncincr MML GDC SYNC sync MM S32 incr Increments the sync count for sync object sync This way a sync object can b
39. ee 38 6 5 5 Fill with constant 38 6 5 6 A simple black and white 39 6 5 7 A simple auto generated pattern 40 6 5 8 Blending two surfaces 42 6 5 9 Bring it to the 42 6 6 Tutorial Display B SlGC iint 43 6 6 1 e 43 6 6 2 CMAP llf ces 44 6 6 3 Code Descriptiori uic REDIT UHR 44 6 6 4 VINE 47 6 6 5 Frame Layer dedito a 47 6 6 6 las JE Um 48 6 6 7 Arrow Cayenne eek 48 6 7 Tutorial Display Extended 49 6 7 1 cc 49 6 7 2 IU E 50 6 7 3 Draw BI CUERO 50 6 7 4 Swap interval Matted 51 6 8 Tutorial 51 6 8 1 51 6 8 2 learning Goals ctii nies teer stulte eases 51 6 8 3 Chapters 52 6 8 4 laici 52 6 8 5 Matrix operations to scale rotate and translate images 54 6 8 6 Show different versions to restore and draw the needle layer 56 6 9 Tutorial Chart Single render buffer sample
40. 0x303U MML PE BF GL DST ALPHA 0x304U MML GDC PE BF GL ONE MINUS DST ALPHA 0x305U MML GDC PE BF GL DST COLOR 0x306U MML GDC PE BF GL ONE MINUS DST COLOR 0x307U MML GDC PE BF GL SRC ALPHA SATURATE 0x308U MML GDC PE BF GL CONSTANT COLOR 0x8001U MML GDC PE BF GL ONE MINUS CONSTANT COLOR 0x8002U MML PE BF GL CONSTANT ALPHA 0x8003U MML GDC PE BF GL ONE MINUS CONSTANT ALPHA 0x8004U enum GL FUNC ADD 0x8006U PE BM GL MIN 0x8007U MML PE BM GL MAX 0x8008U MML GDC PE BM GL FUNC SUBTRACT 0x800AU MML GDC PE BM GL FUNC REVERSE SUBTRACT 0x800BU MML GDC PE BM VG BLEND SRC 0x2000U MML GDC PE BM VG BLEND SRC OVER 0x2001U MML GDC PE BM VG BLEND DST OVER 0x2002U MML VG BLEND SRC 0x2003U MML PE VG BLEND DST IN 0 20040 MML PE BM VG BLEND MULTIPLY 0 20050 MML GDC PE BM VG BLEND SCREEN 0x2006U MML GDC PE BM VG BLEND DARKEN 0x2007U MML GDC PE BM VG BLEND LIGHTEN 0x2008U MML PE BM VG BLEND ADDITIVE 0x2009U enum MML FORMAT PE FORMAT 4X3 0 enum MML GEO MATRIX FORMAT MML PE GEO MATRIX FORMAT 3X2 MML GDC PE GEO MATRIX FORMAT 3X3 enum CLUT FORMAT
41. AN709 00022 1v0 E 233 Z CYPRESS APPLICATION NOTE 2 PERFORM 12 18 2 Field Documentation 12 18 2 1 MM 032 reserved 3 Reserved memory needed for any sync container The documentation for this struct was generated from the following file sync h 12 19MML SYSINIT INFO Struct Reference include lt mml_gdc_sysinit h gt Data Fields 032 ResourceLock MM 032 GfxPII 12 19 1 Detailed Description Data type used to program timing controller TCON registers 12 19 2 Field Documentation 12 19 2 1 MM 032 GfxPII Frequency of GFX PLL for Pixel Clock generation in Hertz Default 200000000 12 19 2 2 MM U32 ResourceLock Bitfield that describes resources allocated by safety driver The documentation for this struct was generated from the following file sysinit h 12 20 RLAD Package Struct Reference include ut class rlad h Public Member Functions Package void Reset void Add const RLAD Frame Pixel amp pix void Serialize queue RLAD Frame Pixel gt amp fifo RLAD BitStream amp bs unsigned amp pkg unsigned amp x unsigned amp y Data Fields RLAD cfg bool delta unsigned pent unsigned cbpc NUM C unsigned cbpp 234 S6E2DH_AN709 00022 1v0 E September 11 2015 APPLICATION NOTE PERFORM unsigned size unsigned cofs NUM C unsigned cran
42. Asrc i mode amp MML DISP BLEND SOURCE MULTIPLY ALPHA 2MML DISP BLEND SOURC E MULTIPLY ALPHA As As Asrc Cout Csrc As Cdst 1 Ad Note blend mode settings of the window does not becomes active immediately with the related mmlGdcDispWinSetBlendMode call but will be queued together with other settings of this window Use mmliGdcDispWinCommit to submit these settings for processing Transparency is not supported for the YUV format If blend mode MML GDC DISP BLEND TRANSPARENCY is selected set transparency color by mmliGdcDispWinsSetAttribute with attribute MML DISP WIN COLOR If blend mode MML GDC DISP BLEND GLOBAL ALPHA is selected set global alpha ratio by mmliGdcDispWinsSetAttribute with attribute MML DISP WIN COLOR If the matrix set to the window see mmlGdcDispWinSetMatrix is with a scaler factor then only blend mode MML GDC DISP BLEND NONE and MML GDC DISP BLEND GLOBAL ALPHA are allowed Parameters MML DISP WINDOW returned from a previous call to mmlGdcDispWinCreate Blend mode related parameter can be a bit field combination of MML DISP BLEND NONE Disable blending MML_GDC_DISP_BLEND_TRANSPARENCY Enable transparency MML_GDC_DISP_BLEND_GLOBAL_ALPHA Enable global alpha blending MML_GDC_DISP_BLEND_SOURCE_ALPHA Enable per pixel source alpha blending MML_GDC_DISP_BLEND_SOU
43. Color channels if it is an non pre multiplied image Required blend formula C Csrc Asrc Cdst 1 Asrc Color channels if it is a pre multiplied image Required blend formula Csrc Cdst 1 Asrc Expected blend result RLA Abbreviation for Run Length Adaptive This is a lossless compression type of an image supported by the 2D Graphics hardware RLAD Abbreviation for Run Length Adaptive Dithering This is a lossy compression type of an image supported by the 2D Graphics hardware RLAD Uniform Abbreviation for Run Length Adaptive Dithering with Uniform package size This is a lossy compression type of an image supported by the 2D Graphics hardware RLC Abbreviation for Run Length Coded Synonym for RLE RLE Abbreviation for Run Length Encoded This is a lossless compression type of an image supported by the 2D Graphics hardware Raster Operation with 2 sources A bit field defines how the color data bits of the first source are be combined with the color data bits of the second source to achieve the final color 34 S6E2DH 709 00022 1 0 September 11 2015 d APPLICATION NOTE NJ CYPRESS gt PERFORM Description Raster Operation with 3 sources A bit field defines how the color data bits of the 3 source are combined to achieve the final color Simple Transformation We talk about simple transformation if an image source is tra
44. Copy the content of a 4x4 matrix to a new one Parameters dst The destination matrix src The source matrix out in S6E2DH_AN709 00022 1v0 E September 11 2015 186 I APPLICATION NOTE CYPRESS PERFORM 11 17 4 27 MML 2D MATRIX void utMat4x4GetXYZ Mat4x4 m float x float y float z float xout float yout float zout Calculate the target position for a given matrix and source position Parameters The matrix Source x position Source y position Source z position Pointer to the destination x position Pointer to the destination y position Pointer to the destination z position 11 17 4 28 MML 2D MATRIX void utMat4x4Loadidentity 4 4 Fill a 4x4 matrix with a unit matrix Parameters The matrix to modify 11 17 4 29 MML 2D MATRIX void utMat4x4Multiply Mat4x4 dst const Mat4x4 src1 const Mat4x4 src2 Multiply 2 4x4 matrices The resulting matrix represents dst src src2 Parameters The destination matrix The first source matrix The second source matrix 11 17 4 30 2D MATRIX void utMat4x4Perspective Mat4x4 m MM FLOAT fovy MM FLOAT aspect MM FLOAT zNear MM FLOAT zFar Apply a perspective projection onto a 4x4 matrix Parameters m The input output matrix fovy The opening angle of the frustrum in d
45. MM ERROR utSurfCreateBuffer MML SURFACE surf MM 032 MM 032 h MML GDC SURF FORMAT eFormat void utSurfDeleteBuffer MML SURFACE surf MM ERROR utSurfGetPixel MML SURFACE src MM 032 x 032 y MM 008 MM 08 008 008 ERROR utSurfSetPixel MML SURFACE src 032 x 032 8 MM 08 g U08 b MM 008 a 13 17 1 Detailed Description This is just a helper implementation for development and will be removed in the final version 13 18ut class ctx h File Reference This class abstracts an MML GDC PE CONTEXT include pixeng h stinclude ut compatibility h Data Structures class CCtx 13 18 1 Detailed Description This class abstracts an MML GDC PE CONTEXT September 11 2015 S6E2DH_AN709 00022 1v0 E 259 4 2 APPLICATION NOTE 13 19ut class device h File Reference This class abstracts the device initialization include display h include sysinit h include sm util h include ut compatibility h zinclude memman h Data Structures class CDevice 13 19 1 Detailed Description This class abstracts the device initialization 13 20ut class display h File Reference This class abstracts the display initialisation include display h include sysinit h include sm util h Data Structures
46. S6E2DH 709 00022 1 0 September 11 2015 60 APPLICATION NOTE CYPRESS PERFORM 6 9 Tutorial Chart Single render buffer sample 6 9 1 Summary This example shows an animated chart using a single buffer render mode Source code 04 sample basic graphics chart Figure 6 13 chart Ji 6 9 1 1 Learning Goals The following techniques and features are used Work with clip rectangle for the STORE surface Synchronize display read blit operations Analyze render time Analyze command sequencer buffer size matrix operations for blit operations Use alpha multiply with MASK surface 6 9 1 2 Memory Calculation for VRAM The target device has VRAM size of 512 kByte The panel used for our samples has a size of 480 272 pixels The sample should use a high quality render buffer requiring an alpha channel If we want to use at least 6 bit for all color and the alpha channel we need 480 272 24 2 8 765 kByte That means double buffering is not possible for such a resolution and color format To render such targets anyway it is possible to use a single buffer render mode In single buffer mode we need only 383 kByte to store the frame buffer The command sequencer size assigned by mmlGdcSysSetlnstructionBuffer must be big enough to store all operations for one render loop This is important because the blit operations must be queued until the display c
47. etd 170 11 14 1 Detailed 170 11 14 2 Macro Definition Documentation 170 11 15 Tutorial Utlity Library iiri 172 11 15 1 Detailed Description 172 11 16 Utilities for the Memory 172 11 16 1 Detailed Description 173 September 11 2015 S6E2DH_AN709 00022 1v0 E 5 oss APPLICATION NOTE 11 16 2 Macro Definition Documentation 173 11 16 3 Typedef 174 11 16 4 Function 174 11 17 Utility functions for matrix 177 11 17 1 Detailed Description 179 11 17 2 Macro Definition Documentation 179 11 17 3 Typedef 179 11 17 4 Function 180 11 18 Utilities for the compatibility with other 189 11 18 1 Detailed Description 190 11 18 2 Enumeration Type Documentation 190 11 18 3 Function 190 11 19 Utilities for the Surface Management 195 11191 Detailed Description temen 195 11 19 2 Macro Definition Documentation
48. menu Insert O MENU LL FLAG L This is a check box menu menu Insert MENU LL MENU FONT 0 L Font menu Insert MENU FONT 0 MENU FONT 1 CMenu MENU FLAG POPUP CMenu MENU FLAG RADIO FLAG ISCHECKED L Font 1 menu Insert MENU FONT i MENU FONT i 1 CMenuzMENU FLAG RADIO L Font 2 while bRunning key menu HandleKey GetLastKeyStroke switch key menu Draw draw other things 11 28 CSurface Data Structures 202 S6E2DH_AN709 00022 1v0 E September 11 2015 d APPLICATION NOTE F CYPRESS PERFORM class CSurface lt NUM BUFFERS gt Functions CSurface void Init MM_ERROR Delete virtual MM ERROR CreateBuffer const 032 width const 032 height const MML SURF FORMAT formatZMML SURF FORMAT R8G8B8A8 MM 032 MaxSize 0 virtual MM ERROR CreateBuffer const 032 width const 032 height 032 bit red MM 032 bit green 032 bit blue MM 032 bit alpha virtual MM ERROR CreateGrayBuffer const MM 032 width const MM 032 height 032 bit color MM U32 bit alpha virtual MM ERROR SurfLoadBitmap const void plmage MM BOOL bCopyToVRAMZMM FALSE virtual MM ERROR Copy MML GDC SURFACE surface 11 28 1 Detailed Description The class CSurface is a abstraction of one or more MML SURFACE objects depending on
49. 0 Hsync signal high active 11 5 2 13 define DISP HSYNC LOW 0 Hsync signal low active 11 5 2 14 define MML DISP PROPERTIES INITIALIZER Value MML DISP CONTROLLER 0 MML DISP SINGLE SCREEN 0 0 60 0 0 0 0 11 5 2 15 define DISP RGB HIGH 10 lt lt 3 Pixel data inverted 11 5 2 16 define DISP RGB LOW 0 No inversion of pixel data 11 5 2 17 MML DISP VSYNC HIGH 10 lt lt 1 Vsync signal high active 101 September 11 2015 56 20 AN709 00022 1v0 E YPRESS 11 5 2 18 Vsync signal low active 11 5 2 19 APPLICATION NOTE define Value itdefine MML GDC DISP VSYNC LOW 0 MML GDC DISP WINDOW PROPERTIES INITIALIZER MML DISP SUB LAYER DEFAULT Window object MML DISP OUTPUT SCREEN PRIMARY 0 0 0 0 MML DISP LAYER 0 0 11 5 3 Typedef Documentation xMML GDC DISP WINDOW 11 5 3 1 typedef struct MML GDC DISP WINDOW 11 5 3 2 typedef struct MML GDC DISPLAY Display object 11 5 4 Enumeration Type Documentation Enumerator MML GDC DISPLAY 11 5 4 1 enum MML GDC DISP ATTR Enumeration of the different configuration attributes for display controllers MML GDC DISP ATTR OUTPUT CONTROLLER be read MML DISP ATTR X RESOLUTION MML DISP ATTR Y RESOLUTION Vertical resolution This attribute can only be read MML GDC DISP ATTR BUFF ER
50. 12 7 2 Member Function Documentation 217 12 8 CSurface NUM BUFFERS gt Class Template 218 12 8 1 Detailed Descrlption 219 12 8 2 Constructor amp Destructor 219 12 8 3 Member Function Documentation 219 12 8 4 Field Documentation 220 12 9 CSurfaceWindow NUM BUFFERS gt Class Template Reference 221 12 9 1 Detailed Description 221 12 9 2 Member Function Documentation 221 12 9 3 Field Documentation 223 12 10 CWindow Class Reference 223 1210 1 Detailed Description erected eere tre erret cete eret 223 12 10 2 Constructor amp Destructor Documentation 224 12 10 3 Member Function Documentation eeeeeeeeeeeeeeee nennen nennen 224 12 10 4 Field Documentation 226 12 11 READ Frame Glass Reference 226 12 11 1 Detailed Description 226 12 11 2 Constructor amp Destructor 226 12 11 3 Member Function Documentation eeeeeeeeeeeee eene 227 12 12 MML DISP MODE LINE Struct Reference 227 12 121 Detailed Des
51. 198 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE 11 19 3 8 MM 532 utSurfWidth MML SURFACE surf Return the width of a given surface object Parameters The surface object Return values 11 20 Utilities for the compression Modules Utilities for RLA run length adaptive compression Utilities for RLC run length compression Functions MM ERROR utSurfCompress MML GDC SURFACE surf MML_GDC_SURF_COMP mode 11 20 1 Detailed Description This group contains sample helper functions for surface compression It shows how the surface parameters must be used with the Utilities for RLA run length adaptive compression and Utilities for RLC run length compression utilities 11 20 2 Function Documentation 11 20 2 1 MM ERROR utSurfCompress MML GDC SURFACE surf MML GDC SURF COMP mode Compress a surface buffer Note This function shows how images can be compresses to reduce the memory usage The compressed images can be used as source surfaces for blit and display operations A real application will probably not use this function but only load uses such compressed buffers in an application Moreover this function may fail for large images because the system memory is not sufficient Parameters in out The surface object describing an uncompressed image buffer If the compression was successful the surface object describes the new compressed buffer The requested compressi
52. In this case the RLA compression is used because it shrinks the size for this bitmap to 12 096 of the original size September 11 2015 56 20 AN709 00022 1v0 E 47 go P CYPRESS APPLICATION NOTE PERFORM 6 6 6 6 6 7 Position Layer The position layer demonstrates the fading capabilities of the hardware To fade a layer with pixel based alpha information the following calculation inside the hardware is required Alpha Alpha pix Alpha fade For the calculation of the Alpha value we have to assign the related properties to the wPosition window UTIL_SUCCESS mmlGdcDispWinSetSurface wPosition MML GDC DISP BUFF TARGET COLOR BUFF sPosition We want to fade this layer multiply pixel alpha const alpha UTIL SUCCESS ret mmlGdcDispWinSetBlendMode wPosition DISP BLEND GLOBAL ALPHA MML DISP BLEND SOURCE ALPHA MML GDC DISP BLEND SOURCE MULTIPLY ALPHA UTIL_SUCCESS ret mmlGdcDispWinSetAttribute wPosition MML DISP WIN ATTR COLOR OxFFOOOOFF To realize the blink effect we have to modify the color UTIL_SUCCESS ret mmlIGdcDispWinSetAttribute wPosition MML GDC DISP WIN ATTR COLOR blink UTIL SUCCESS ret mmlGdcDispWinCommit wPosition Arrow Layer The arrow layer is a one bit alpha mask only So we have to define a constant color for the missing color data In addition we enable the pre multiplication of color and alpha because the
53. MM ERP MESSAGE DEST dest MM ERP MESSAGE CHANNEL PROP prop MM ERROR mmlGdcErpSetBuffer MM ADDR bufferAddr 032 bufferSize MM ERROR mmlGdcErpSetPrintf MM PRINTFUNCTION user print function 13 11 1 Detailed Description Error Reporting 13 12 pixeng h File Reference Pixel Engine include sync h include mm types h 250 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE include display h include mm errors h Data Structures struct MML GDC PE CONTEXT CONTAINER Macros define MML PE extern define MML PE STORE 0x00000001U define MML SRC 0x00000002U define MML PE DST 0x00000004U define MML MASK 0x00000008U CYPRESS define MML GDC PE ROP BLACKNESS MM_U08 0x00 define MML GDC PE ROP WHITENESS MM_U08 0xFF define MML GDC PE ROP SRCCOPY MM_U08 0xAA define MML GDC PE ROP NOTSRCCOPY MM_U08 0x55 define MML GDC PE ROP MASKCOPY MM_U08 0xCC define MML GDC PE ROP NOTMASK MM_U08 0x33 define MML GDC PE ROP define MML GDC PE ROP MASKINVERT _008 0 66 MSKAND MM U08 0x88 define MML GDC PE ROP MASKERASE MM_U08 0x22
54. Not all surfaces are defined for the specified ROP mode define MML ERR PE INVALID SCALING 11 10 2 69 MM ERRCODE 0x2100D019 S6E2DH_AN709 00022 1v0 E September 11 2015 The scale factor exceeds the hardware capabilities 162 PERFORM APPLICATION NOTE 11 10 2 70 define MML ERR PE INVALID STORE CLUT MM ERRCODE 0x2100D021 Store color lookup table not supported 11 10 2 71 MML ERR GDC PE INVALID STORE COMRESSION MM ERRCODE 0x2100D020 Unsupported store compression type 11 10 2 72 MML ERR PE INVALID STRIDE MM ERRCODE 0x2100D008 Invalid value for Stride 11 10 2 73 define ERR PE INVALID SURFACE OBJECT MM ERRCODE 0x2100D004 Surface object invalid 11 10 2 74 define MML ERR PE INVALID SURFACE ERRCODE 0x2100D013 The requested surface features are not supported 11 10 2 75 MML ERR PE INVALID TARGET MM ERRCODE 0x2100D003 Invalid target 11 10 2 76 MML ERR PE INVALID YUV MM ERRCODE 0x2100D028 The YUV surface properties is invalid 163 September 11 2015 56 20 AN709 00022 1v0 E APPLICATION NOTE YPRESS PERFOR 11 10 2 77 MML ERR PE OUT OF SPACE MM ERRCODE 0x2100D001 The system runs out of memory to perform this operation 11 10 2 78 MML_ERR_GDC_SURF_ERROR_ADDRESS_TRANSLATION MM ERRC
55. PE API MM ERROR mmlGdcPeSync MML SYNC sync API MM ERROR mmlGdcPeWaitSync MML SYNC sync MM ERROR mmlGdcPeWaitForDispFrameEnd MML DISPLAY display 032 line 13 12 1 Detailed Description Pixel Engine API 13 13mml gdc surfman h File Reference Surface Manager Interface include mm types h include mm module id h include mm errors h Data Structures struct MML SURFACE CONTAINER Macros define SURFACE WIDTH 4096 define SURFACE MAX HEIGHT 4096 define SURFACE CONTROL WIDTH 2048 define SURFACE CONTROL HEIGHT 2048 Typedefs typedef SURFACE CONTAINER MML SURFACE Enumerations enum MML SURF FORMAT MML SURF FORMAT R8G8B8A8 0x00 MML SURF FORMAT A8B8G8R8 MML SURF FORMAT A8R8G8B8 MML SURF FORMAT B8G8R8A8 MML SURF FORMAT R8G8B8X8 MML SURF FORMAT X8B8G8R8 MML SURF FORMAT X8R8G8B8 MML SURF FORMAT R8G amp 8B8 MML SURF FORMAT B8G8R8 MML SURF FORMAT R6G6B6 MML SURF FORMAT MML SURF FORMAT 4 404 4 MML SURF FORMAT R5G5B5At MML SURF FORMAT A1R5G5B5 MML SURF FORMAT A1B5G5R5 254 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE MML SURF FORMAT 5 5 5 1 MML GDC SURF
56. Scale factor in x direction Scale factor in y direction 11 17 4 9 MML 2D MATRIX void utMat3x2ScalePre Mat3x2m MM FLOAT x MM Modify a matrix by pre multiplying a scale matrix The resulting matrix represents m m scale m Parameters in out The matrix to modify Scale factor in x direction Scale factor in y direction 182 S6E2DH_AN709 00022 1v0 E September 11 2015 CYPRESS APPLICATION NOTE 11 17 4 10 2D MATRIX void utMat3x2ToMat4x4 Mat3x2src Mat4x4dst Convert a 3x2 matrix to a 4x4 matrix Parameters out dst The destination matrix in SIC The source matrix 11 17 4 11 MML 2D MATRIX void utMat3x2Translate Mat3x2m MM FLOAT x MM FLOAT y Modify a matrix to realize a move operation The resulting matrix represents m m m trans Parameters The matrix to modify Move dimension in x direction Move dimension in y direction 11 17 4 12 2D MATRIX void utMat3x2TranslatePre Mat3x2m MM FLOAT x MM FLOAT y Modify a matrix by pre multiplying a move matrix The resulting matrix represents m m trans m Parameters The matrix to modify Move dimension in x direction Move dimension in y direction MML 2D MATRIX void utMat3x3Copy Mat3x3 11 17 4 13 dst const Mat3x3 src Copy the content of a 3x3 matrix to a new one Parameters out dst
57. See also Physical Address Virtual Address Abbreviation for Video Random Access Memory This is a dedicated memory with short read and write access time that is designed to store and buffer images The VRAM can be part of the 2D Graphics hardware block but it is also possible to use external memory as VRAM Window The term Window is used to describe a software object that keeps all parameters to push a rectangular image to the display September 11 2015 S6E2DH_AN709 00022 1v0 E 35 go CYPRESS APPLICATION NOTE X PERFORM 6 Tutorial 6 1 About the Tutorial The tutorial is comprised of chapters which demonstrate the use and possibilities of the driver API The tutorial chapters are of different complexity levels starting with basic chapters to become familiar with the way to use the API The complexity then progressively increases to provide examples which demonstrate special features and ways to achieve effects with the 2D Graphics hardware 6 2 Application framework All sample applications are constructed according to a common scheme based on Cypress s FM4 application template Basic setup of peripherals timers etc is handled in main c which looks similar for all examples The following application specific functions are called from main InitlrisExample Application specific graphics initialization lJrisExampleDraw Graphics code executed in a loop e g once per frame
58. define MODULE ID GDC ALL USER MODULEID 0x2100FFFFU define MODULE ID GDC SURFMAN USER MODULEID 0x21000000U define MODULE ID GDC DISP USER MODULEID 0x21001000U define MODULE ID GDC IRIS USER MODULEID 0x21003000U define MODULE ID GDC SYNC USER MODULEID 0x21005000U define MODULE ID CARD USER MODULEID 0x21006000U define MODULE ID GDC CONFIG USER MODULEID 0x21007000U define MODULE ID GDC SYSINIT USER MODULEID 0x21008000U MODULE ID CMDSEQ USER MODULEID 0x21009000U define MODULE ID GDC PIXENG USER MODULEID 0x2100B000U define MODULE ID ERP USER MODULEID 0x2100D000U define MM_ERP_MODULE_ID_GDC_SERVICE_USER MM MODULEID 0x2100E000U Detailed Description Basic Graphics module ids common 13 6 mm version h File Reference Basic Graphics Driver Version Numbers include mm gdc build version h Macros define MAJOR VERSION 10 define MINOR VERSION 00 244 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE 13 6 1 Detailed Description Basic Graphics Driver Version Numbers 13 7 mm types h File Reference Basic type definitions Typedefs typedef unsigned char 008 typedef signed char MM S08 typedef unsigned short MM U16
59. define lt lt MM_U64 1 IRIS FRAMEGENO SECSYNC ON IRQ FRAMEGENO SECSYNC ON Synchronization status activated Display Controller Content stream 0 11 8 3 Function Documentation 11 8 3 1 void mmdGdcInterruptHandler void Interrupt service routine for 2D Core interrupts This function has to be called by ARM if any 2D Core Interrupt Handler Function interrupt occurs The function takes care that the interrupt status in the 2D Core is reset The related interrupt status in ARM must be reset by the calling function 11 8 3 2 MM ERROR mmdGdclinterruptRegisterHandler U64 void MM_U64 intrrpt pHandler Set an application defined interrupt handler function This function allows an application to define a callback function for dedicated interrupts at runtime The function ensures that the related interrupts are enabled in the 2D Core HW block Note The callback function must not call any 2D Core driver APIs as direct action because it is part of the ARM interrupt sequence The callback function will be called after the driver has handled the interrupt internally S6E2DH 709 00022 1 0 September 11 2015 144 APPLICATION NOTE Parameters or ed Bitmask with all interrupts calling pHandler pHandler Callback function that will be called if one or more requested interrupts occur The MM U64 parameter indicates the related interrupts If pHandler is zero th
60. pSurfaces 262 S6E2DH 709 00022 1 0 September 11 2015 LE APPLICATION NOTE F CYPRESS PERFORM MM ERROR mmlGdcSmDeleteSurfaceObjects MM 032 MML SURFACE pSurfaces MM ERROR mmlGdcPeGenContext MML PE CONTEXT pPectx void mmIGdcPeDeleteContext MML PE CONTEXT pectx void mmlOsLibcMalloc size_t Size void mmlOsLibcFree void Memory MM ERROR mmlGdcVideoConfig UTIL VRAM CONFIG config void mmlGdcVideoAlloc MM 032 size 032 alignment MM ADDR pAddr void mmlIGdcVideoFree void addr MM ERROR mmlGdcVideoGetSize 032 size MM ERROR mmlGdcVideoGetFreeTotal MM U32 size MM ERROR mmlGdcVideoGetLargestBlock 032 MM ERROR mmlGdcSyncCreate MM 032 uCnt MML SYNC pSyncObjects MM ERROR mmlGdcSyncDelete MM 032 uCnt MML SYNC pSyncObjects 13 25 1 Detailed Description This file defines some interfaces that are part of other drivers The util library implements very simple instances of it but they must be not used for software products However it allows to run the sample applications 13 26ut compression h File Reference This file defines a helper function that can be used to compress a surface include surfman h Functions MM ERROR utSurfCompress MML SURFACE surf MML COMP mode 13 26 1 Detailed Description This file defines a helper function that can
61. 00022 1v0 E 15 APPLICATION NOTE blended with each other they are drawn opaque i e only the content of the window with the highest sub layerld is visible Windows that overlap can be drawn opaque only the highest layer is visible or they can be blended using up to 2 blend units Overlapping Windows with the different layer ids can be blended with each other Overlapping Windows with the same layer id cannot be blended with each other Only the content of the window with the highest sub layer id will be used for the layer blend operation Note A Please note that the hardware manual uses a different wording compared to the software manual and The following table describes the different meaning Hardware manual naming Software manual naming Description Each display controller has the capability to Background Plane Background BG color of display generate a full screen constant color Foreground Plane Layer See glossary layer Layer Sub Layer See glossary sub layer When a Window is created it is assigned to a Display Figure 4 2 S6E2D display unit This architecture allows creating complex scenes with low VRAM usage and low memory usage The following example shows a possible scene for one display controller for a device with 5 blend units and up to 26 windows The S6E2D cannot handle such complex scene however the sample shows the idea behind the layers and windows S6E2DH
62. 1 Detailed Description iet ie fe entr 263 13 26 ut compression h File 263 19 26 1 Detailed Description eite tee cites De 263 13 27 ut memman h File 263 19 27 1 Detailled Description t eter tre deena 264 13 28 ut rlc h File 264 13 28 1 Detailed Description 00 4 264 14 265 September 11 2015 S6E2DH_AN709 00022 1v0 E 9 fe APPLICATION NOTE SF PERFORM Figures Figure 2 1 Hardware and software components Figure 4 1 Surface 4 2 56 20 display i e m e eL estie oe dont dies Deed testa Figure 4 3 Sample display scene Figure 4 4 Perspective view to the 5 Figure 4 5 Activity Fig re 4 6 PIxEng usage iof et ener dete ae Cer Eds Figure 4 7 Processing flow for blit Figure 4 8 Zoomed image with pixel enumeration Figure 4 9 Zoomed blit and draw result with bottom left coordinate system setting 28 Figure 4
63. 10 Zoomed blit and draw result with top left coordinate system setting 28 Figure 4 11 Zoomed blit result with matrix operation bottom left coordinate center 29 Fig re 6 1 Constant eee pro pei Ree ae 39 Figure 6 2 Black amp White image on constant 40 Figure 6 3 Pattern Black amp White image on constant color 41 6 4 Blended t6xt eniro ete tie eet io Lc xit 42 Fig re 6 5 Expected si ee 43 Figure 6 6 Display Extended 49 Figure 6 7 Expected 51 Figure 6 8 Previous layer frame 56 Fig re 6 9 Verston T x oi ER 57 Figure G10 Version p 58 Figure 6211 er ree ete 59 Fig re 6212 VESINA ER 60 Fig re 6 13 charte REOR EE ee 61 Figure 6 14 Background 62 Figure 6 115 Render ime analySiSs 64 FIQUIE 6216 e M 65 Fig re 6 17 Expected result eee EH Ae THERE IER I ERI Ree 68 10 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE 1 2D Graphics Driver 1 1 Ab
64. 11 2015 IE 2 APPLICATION NOTE SE Cypress PERFORM 12 8 1 Detailed Description template lt unsigned int NUM BUFFERS 1 gt class CSurface lt NUM BUFFERS gt Class CSurface 12 8 2 Constructor amp Destructor Documentation 12 8 2 1 CSurface inline Class CSurface destructor 12 8 3 Member Function Documentation 12 8 3 1 MM 032 GetBufferBufferCnt inline Get number of surfaces on the class 2 5 5 lt c return The number of surfaces in the class object 12 8 3 2 MML GDC SURFACE GetHandle inline return 2 e 5 3 lt v c The surface object 12 8 3 3 MM 532 GetHeight inline return Surface height D c 5 5 lt m c 12 8 3 4 MML SURFACE GetSurface inline Return values return The surface object 12 8 3 5 MML GDC SURFACE GetSurface int id inline Get a dedicated surface Parameters n E 0 return the current foreground buffer If id gt 0 the function will return the id next foreground buffer return The surface object D e 5 lt v N September 11 2015 S6E2DH_AN709 00022 1v0 E 9 APPLICATION NOTE inline Surface width 12 8 3 6 S32 GetWidth Get the surface width Return values inline return Returns whether or not the surface object owns the memory of the surfaces 12 8 3 7 M
65. 11 5 5 13 Sets the attribute pname to param win specify for which window the attribute should be set Any attribute settings of the window does not becomes active immediately with the related mmlGdadcDispWinSetAttribute call but will be queued together with other settings of this window Use Note mmlGdcDispWinCommit to submit these settings for processing Parameters i MML DISP WINDOW returned from a previous call to mmlGdcDispWinCreate Parameter name See MML GDC DISP WIN ATTR for valid values Value to set for parameter pname Return values MML OK On success MML ERR DISP INVALID If one of the parameters is invalid 11 5 5 14 MM ERROR mmiGdcDispWinSetBlendMode DISP WINDOW win MM 032 blend mode Sets blending mode Csrc Source color Asrc Source alpha Agbl Global alpha Cdst Blend destination color alpha value of destination is not used Aext External alpha S6E2DH_AN709 00022 1v0 E September 11 2015 Ctrans Transparency color Cout Output color from this layer blend unit 1 114 APPLICATION NOTE if mode amp MML DISP BLEND TRANSPARENCY MML DISP BLEND TRANSPARENCY amp amp Ctrans Csrc As 0 if mode amp MML GDC DISP BLEND GLOBAL ALPHA MML GDC DISP BLEND GLOBAL ALPHA As As Agbl Ad As if mode amp MML GDC DISP BLEND SOURCE ALPHA MML GDC DISP BLEND SOURCE ALPHA Ad Ad
66. 12 19 MML SYSINIT INFO Struct 234 12 19 1 Detailed Description iei br 234 12 19 2 Field Documentation 8 234 12 20 RLAD Package Struct 234 September 11 2015 56 20 AN709 00022 1v0 E 7 S37 Cypress APPLICATION NOTE 12 20 1 Detailed Description 235 12 20 2 Field Documentation 235 12 21 RLAD Frame Pixel Struct Reference nennen 236 12 211 Detailed Description iie ERE 236 12 21 2 Field Documentation 236 12 22 RLAD Class 236 12 221 Detailed Description 237 12 22 2 Member Enumeration 237 12 223 Member Function Documentation 237 12 224 Field Documentation 239 13 File Documentatii cinere niente enne er envie 240 13 1 flash resource h File Reference 240 13 2 mm defines h File Reference 240 13 2 1 Detailed Description 240 13 3 mm erp h File 444 4 30000000 240 13 3 1 Detailed Description 241 13 4 mm errors h File 241 13 4 1 Detailed Description
67. 1v0 E September 11 2015 APPLICATION NOTE Cypress ee eee PERFORM define MML_ERR_GDC_CARD_THREAD_LIMIT MM ERRCODE 0x21007005 define MML ERR GDC CARD TIMEOUT EXPIRED ERRCODE 0x21007006 define MML_ERR_GDC_CARD_DEV_BUSY MM ERRCODE 0x21007007 define MML ERR GDC IRIS CMD SEQ ARG ERROR ERRCODE 0x2100B001 define MML_ERR_GDC_IRIS_ CMD SEQ INVALID ADDRESS MM_ERRCODE 0x2100B002 define MML ERR GDC IRIS SEQ INVALID BUFFER SIZE MM ERRCODE 0x2100B003 define MML ERR IRIS SEQ FIFO UNINITIALIZED MM ERRCODE 0x2100B004 define MML ERR IRIS SEQ COMMAND QUEUE FULL MM ERRCODE 0x2100B005 define ERR DISP ERROR MM ERRCODE 0x11001003 define MML ERR INT OUT OF RANGE MM ERRCODE 0x21010001 define ERR INT OUT OF RANGE MM ERRCODE 0x11010001 define ERR IRIS MATH INVALID FLOAT MM_ERRCODE 0x21003001 define ERR IRIS MATH INVALID MATRIX ERRCODE 0x21003002 define ERR RES UNKNOWN MM ERRCODE 0x2100A000 define MML ERR RES EXCEEDED MAXIMUM USAGE ERRCODE 0x2100A001 define MML ERR RES USAGE COUNT ZERO MM ERRCODE 0x2100A002 define ERR RES MAN ALREADY INITIALIZED ERRCODE 0x2100A003 define ERR RES NOT INITIALIZED MM ERRCODE 0x2100A004 define ERR SYNC INVALID PARAMETER ERRCODE 0x11005001 define ERR
68. 2015 S6E2DH_AN709 00022 1v0 E 145 2 APPLICATION NOTE CYPRESS define MM MODULE ID USER MM MODULEID 0x21006000U define MM MODULE ID CONFIG USER MODULEID 0x21007000U define MM MODULE ID SYSINIT USER MODULEID 0x21008000U define MM MODULE ID CMDSEQ USER MODULEID 0x21009000U define MM MODULE ID PIXENG 05 MM MODULEID 0x2100B000U define MM MODULE ID USER MM MODULEID 0x2100D000U define MM MODULE ID SERVICE USER MM MODULEID 0x2100E000U 11 9 1 Detailed Description 11 9 2 Error Reporting Error Reporting for selected modules and level The module Ids of this driver stinclude erp h The Error Reporting API provides functions to report errors warnings and infos The modules that are covered can be specified The user has the options to select the level of messages for selectable modules mmlGdcErpSetMessageLevel to select the channel of messages mmlGdcErpSetMessageChannel When using channel ERP STDOUT the configuration of the print function by mmlGdcErpSetPrintf is necessary When using channel MM ERP BUFFER the configuration of the buffer by mmlGdcErpSetBuffer is necessary Note Error reporting is only available in Debug and Release configuration In Production configuration this functionality is switched
69. 5 4 5 enum MML DISP DCK DELAY ENABLE Display clock delay disable enable flags Enumerator MML GDC DISP DCK DELAY OFF Disable the display clock delay MML GDC DISP DCK DELAY ON Enable the display clock delay 11 5 4 6 enum MML DISP DCK INVERT ENABLE Inversion of display clock disable enable flags Enumerator MML GDC DISP DCK INVERT OFF Display clock output signal is not inverted MML GDC DISP DCK INVERT ON Display clock output signal is inverted 103 September 11 2015 56 20 AN709 00022 1v0 E d APPLICATION NOTE Z CYPRESS PERFORM 11 5 4 7 enum Dither enable Enumerator MML GDC DISP DITHER ENABLE MML GDC DISP DITHOFF Flag to disable dithering MML GDC DISP DITHON Flag to enable dithering 11 5 4 8 enum MML GDC DISP DITHER FORMAT Dither format OxOROGOBOO Enumerator MML_GDC_DISP_DITHER108 Flag to specify dithering output format of RGB 10x10x10 gt 8x8x8 MML_GDC_DISP_DITHER107 Flag to specify dithering output format of RGB 10x10x10 gt 7x7x7 MML GDC DISP DITHER106 Flag to specify dithering output format of RGB 10x10x10 6x6x6 MML GDC DISP DITHER105 Flag to specify dithering output format of RGB 10x10x10 5x6x5 11 5 4 9 enum MML GDC DISP DITHER MODE 11 5 4 10 Dither mode Enumerator MML GDC DISP TEMPDITH Flag to specify temporal dithering MML GDC DISP SPATDITH Flag to specify spatial dithering enum MML GDC DISP DITHER
70. ATTR MINOR VERSION MML GDC CONFIG ATTR BUILD VERSION MML CONFIG ATTR MIN INSTRUCTION BUFFER CONFIG ATTR CURRENT INSTRUCTION BUFFER MML GDC CONFIG ATTR DISPLAY NOBLOCK CONFIG BUILD Functions MM ERROR mmlGdcConfigSetAttribute MML CONFIG pname 032 param MM ERROR mmlGdcConfigGetAttribute MML ATTR pname MM 032 pParam Detailed Description The Configuration API allows changing or reading global graphics driver configurations or status information include config h 11 3 1 Enumeration Type Documentation 11 3 1 1 enum MML GDC CONFIG ATTR Enumeration of the different config attributes Enumerator MML GDC CONFIG ATTR MAJOR VERSION Returns the major version of the driver This is a read only attribute Setting this attribute will result in error MML GDC CONFIG ATTR MINOR VERSION Returns the minor version of the driver This is a read only attribute Setting this attribute will result in error 82 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE MML CONFIG ATTR BUILD VERSION Returns the build version of the driver This is a read only attribute Setting this attribute will result in error MML GDC CONFIG ATTR MIN INSTRUCTION BUFFER This attribute is only available in mmlGdcConfigGetAttribute The returned value represents the smallest available InstructionBuffer in bytes d
71. COLORMULTI RGBA Components GL ZERO GL ONE GL SRC COLOR GL ONE MINUS SRC COLOR F 1 Cs GL_SRC_ALPHA F As GL_ONE_MINUS_SRC_ALPHA F 1 As GL_DST_ALPHA F Ad GL_ONE_MINUS_DST_ALPHA F 1 Ad GL_DST_COLOR GL ONE MINUS DST COLOR 1 GL SRC ALPHA SATURATE min As 1 Ad GL CONSTANT COLOR GL ONE MINUS CONSTANT COLOR 1 GL CONSTANT ALPHA F Ac GL_ONE_MINUS_CONSTANT_ALPHA F 1 Ac Note f OpenVG blend mode See mmiGdcPeBlendMode is used setting for this function is ignored drawing image 130 S6E2DH 709 00022 1 0 September 11 2015 y d APPLICATION NOTE S amp A Cypress PERFORM Parameters pectx Pixel Engine context NULL func red src Blend function of source red default PE BF GL SRC ALPHA func red dst Blend function of destination red default MML GDC PE BF GL ONE MINUS SRC ALPHA func green src Blend function of source green default MML PE BF GL SRC ALPHA func green dst Blend function of destination green default MML GDC PE BF GL ONE MINUS SRC ALPHA func blue src Blend function of source blue default MML GDC PE BF GL SRC ALPHA func blue dst Blend function of destination blue default MML GDC PE BF GL ONE MINUS SRC ALPHA func alpha sr
72. ERRCODE 0x21000001 define MML ERR SURF OUT OF VRAM MM ERRCODE 0x21000002 define ERR SURF INVALID SURFACE MM ERRCODE 0x21000003 define ERR SURF INVALID FORMAT ERRCODE 0x21000004 define MML_ERR_GDC_SURF_INVALID_FOR_BUFFER_OWNED MM_ERRCODE 0x21000005 define MML_ERR_GDC_SURF_INVALID_ATTRIBUTE MM ERRCODE 0x21000006 define MML_ERR_GDC_SURF_ERROR_ADDRESS_TRANSLATION MM_ERRCODE 0x21000007 define MML_ERR_GDC_SURF_INVALID_PARAMETER 0 21000008 define MML_ERR_GDC_SURF_INVALID_ADDRESS_ALIGNMENT MM_ERRCODE 0x21000009 242 S6E2DH_AN709 00022 1v0 E September 11 2015 APPLICATION NOTE F CYPRESS 54 PERFORM Error codes for Synchronization API define MML_ERR_GDC_SYNC_INVALID_PARAMETER ERRCODE 0x21005001 define ERR SYNC OUT OF MEMORY ERRCODE 0x21005002 define ERR SYNC TIMEOUT MM ERRCODE 0x21005003 define ERR SYNC INVALID MM ERRCODE 0x21005004 Error codes for Driver Initialization API stdefine ERR SYS DEVICE INIT ERRCODE 0x21009001 define ERR SYS DEVICE CLOSE FAILED MM ERRCODE 0x21009002 define MML_ERR_GDC_SYS_DEVICE_ALREADY_INITIALIZED MM_ERRCODE 0x21009003 define MML_ERR_GDC_SYS_DEVICE_NOT_YET_INITIALIZED MM_ERRCODE 0x21009004 define MML_ERR_GDC_SYS_DEVICE_INVALID_PARAMETER MM_ERRCODE 0x
73. FORMAT R5G6B5 MML FORMAT A8RGBS MML SURF FORMAT RGBB MML GDC SURF FORMAT A8 MML SURF FORMAT A4RGBA MML GDC SURF FORMAT A4 MML GDC SURF FORMAT A2 MML SURF FORMAT 1 MML GDC SURF FORMAT RGB1 enum MML SURF COMP NON 0x4 MML GDC SURF COMP RLC 0x3 MML GDC SURF COMP RLA 0x2 MML GDC SURF COMP RLAD 0x0 enum MML SURF MML R8G8B8 MML SURF B8G8RS8 MML GDC SURF CLF R5G5B5 MML SURF A1R5G5B5 MML SURF CLF A4R4GA4BA enum NEUTRAL 0x0 MML GDC SURF CLM INDEX RGB MML GDC SURF CLM INDEX RGBA enum MML SURF MML GDC SURF ATTR BASE ADDRESS 0x0 MML GDC SURF ATTR PHYS ADDRESS MML SURF ATTR BASE ADDRESS 2 SURF ATTR PHYS ADDRESS2 MML SURF WIDTH MML GDC SURF ATTR HEIGHT MML GDC SURF ATTR STRIDE MML SURF ATTR BITPERPIXEL MML GDC SURF ATTR COLORBITS MML GDC SURF ATTR COLORSHIFT MML GDC SURF ATTR COMPRESSION FORMAT MML GDC SURF ATTR RLAD MAXCOLORBITS MML SURF ATTR SIZEINBYTES MML GDC SURF ATTR CLUTMODE MML GDC SURF ATTR CLUTCOUNT MML SURF CLUTBITPERPIXEL MML GDC SURF ATTR CLUTCOLORBITS MML GDC SURF ATTR CLUTCOLORSHIFT MML GDC SURF ATTR CLUTBUFFERADDRESS MML GDC SURF AT
74. MML CLUT FORMAT 33 33 MML CLUT FORMAT 256 256 enum FILTER CHANNEL FILTER CHANNEL 1U 3 September 11 2015 S6E2DH_AN709 00022 1v0 E 119 is CYPRESS APPLICATION NOTE MML GDC PE FILTER CHANNEL G 1U 2 MML PE FILTER CHANNEL B 10 lt lt 1 MML PE FILTER CHANNEL A 1U MML GDC PE FILTER CHANNEL RGB MML GDC PE FILTER CHANNEL R PE FILTER CHANNEL G MML PE FILTER CHANNEL MML GDC PE FILTER CHANNEL RGBA MML GDC PE FILTER CHANNEL R PE FILTER CHANNEL G MML PE FILTER CHANNEL B PE FILTER CHANNEL enum PE FILTER COLOR FORMAT MML GDC PE FILTER COLOR FORMAT R8G8B8 MML PE FILTER COLOR FORMAT R5G6B54A8 MML PE FILTER COLOR FORMAT R8G8B84A8 MML GDC PE FILTER COLOR FORMAT R10G10B10A8 Functions PE API MM ERROR mmlGdcPeResetContext MML PE CONTEXT pectx API MM ERROR mmlGdcPeBindSurface MML PE CONTEXT pectx MM 032 target SURFACE surface PE API MM ERROR mmlGdcPeAttribute MML PE CONTEXT CTX ATTR pname 032 param PE API MM ERROR mmlGdcPeColor MM
75. MML ERR GDC PE INVALID COMPRESSION OPERATION MM ERRCODE 0x2100D029 The requested operation with a compressed buffer is not supported 11 10 2 59 stdefine MML ERR PE INVALID CONTEXT ERRCODE 0x2100D002 Context object invalid 11 10 2 60 Zdefine MML ERR PE INVALID DIMENSION MM ERRCODE 0x2100D007 Surface dimension is out of range 11 10 21 MML ERR PE INVALID FLOAT MM ERRCODE 0x2100D023 A float value exceeds the range supported by hardware 161 September 11 2015 56 20 AN709 00022 1v0 E APPLICATION NOTE PERFOR 11 10 2 62 MML ERR PE INVALID MASK PARAM MM ERRCODE 0x2100D018 Required parameter is not supported for mask define MML ERR PE INVALID MATRIX 11 10 2 63 MM ERRCODE 0x2100D006 A matrix operation cannot be performed 11 10 2 64 MML ERR GDC PE INVALID NO ACTIVE AREA MM ERRCODE 0x2100D014 A blit operation was started but no active area source defined 11 10 2 65 define MML ERR PE INVALID OPERATION MM ERRCODE 0x2100D017 The requested operation failed define MML ERR PE INVALID PARAMETER 11 10 2 66 MM ERRCODE 0x2100D016 Invalid parameter was specified for an argument 11 10 2 67 define MML ERR PE INVALID RLD REQUEST MM ERRCODE 0x2100D011 Required fetch unit does not support RLD 11 10 2 68 define MML ERR PE INVALID MODE MM ERRCODE 0x2100D012
76. OFF include mm module id h The module ids are used to en disable message logging for certain modules of the driver Wildcards can be used to en disable messages for all modules of the driver For details see mmlGdcErpSetMessageLevel Macro Definition Documentation 11 9 2 1 define MM ERP MODULE ID ALL USER MM MODULEID 0x2100FFFFU Wildcard for all modules of basic graphics driver 11 9 2 2 define MM ERP MODULE ID CARD USER MM MODULEID 0x21006000U Card HW access 11 9 2 3 define MM MODULE ID CMDSEQ USER MM MODULEID 0x21009000U Command Sequencer 146 S6E2DH 709 00022 1 0 September 11 2015 PERFORM APPLICATION NOTE 11 9 2 4 define MM ERP MODULE ID CONFIG USER MM MODULEID 0x21007000U Configuration 11 9 2 5 define MM ERP MODULE ID DISP USER MM MODULEID 0x21001000U Display 11 9 2 6 Zdefine MM MODULE ID USER MM MODULEID 0x2100D000U Error Reporting 11 9 2 7 define MODULE ID IRIS USER MM MODULEID 0x21003000U Internal components 11 9 2 8 define MM ERP MODULE ID PIXENG USER MM MODULEID 0x2100B000U Pixel Engine 11 9 2 9 define MM ERP MODULE ID SERVICE USER MM MODULEID 0x2100E000U Resource Manager 11 9 2 10 define MODULE ID SURFMAN USER MM MODULEID 0x21000000U Surface Manager 11 9 2 11 define MM ERP MODULE ID SYNC USER MM MODULEID 0x21005000
77. RANGE Dither range Enumerator MML GDC DISP DITHRS11LOW Flag to specify dither range add Os to lower bits S6E2DH 709 00022 1 0 September 11 2015 104 APPLICATION NOTE 11 5 4 11 d enum MML GDC DISP FILTER Enumeration of possible filter settings for a window Enumerator MML GDC DISP FILTER NEAREST Nearest filter enable MML GDC DISP FILTER BILINEAR Bilinear filter enable 11 5 4 12 MML DISP LAYER Enumeration of layers Enumerator MML DISP LAYER 0 Layer 0 MML GDC DISP LAYER 1 Layer 1 11 5 4 13 enum DISP MODE Enumeration of display modes Enumerator MML GDC DISP SINGLE SCREEN Single screen mode MML GDC DISP DUAL SCREEN Reserved for future use MML GDC DISP DUAL VIEW Reserved for future use 11 5 4 14 enum MML DISP OUTPUT SCREEN Enumeration of possible locations to show a layer on a display Enumerator MML GDC DISP OUTPUT SCREEN PRIMARY Show layer on primary screen MML DISP OUTPUT SCREEN SECONDARY Show layer on secondary screen implies using dual screen mode see MML GDC DISP PROPERTIES MML DISP OUTPUT SCREEN BOTH D CYPRESS PERFORM Show layer on both screens implies using dual screen mode see MML_GDC_DISP_PROPERTIES September 11 2015 S6E2DH_AN709 00022 1v0 E 105 APPLICATION NOTE CYPRESS 11 5 4 15 enum MML GDC DISP SUB LAYER Enumeration of sub layer
78. September 11 2015 APPLICATION NOTE ES CYPRESS PERFORM UTIL SUCCESS ret mmlGdcPeFill ctx 0 0 storeWidth storeHeight Figure 6 1 Constant color 6 5 6 A simple black and white image Now a second surface surfSrc is needed for the source path It has to be initialized with mmlGdcSmResetSurfaceObject and filled with the image data a simple 32 x 32 pixel black and white image As itis a 1 bpp image SURF FORMAT is used for the color format The store surface keeps the same but the new source surface has to be added to the context mmlGdcPeBlt copies the image to the store surface at position 20 20 initialization of surfSrc mmlGdcSmhResetSurfaceObject surfSrc CopyToVram black and white MM US2 vImgAdar imgSize use the black and white format UTIL SUCCESS ret mmlGdcSmaAssignBuffer surfSrc imgWidth imgHeight MML SURF FORMAT vimgAddr 0 add it to the context as source UTIL SUCCESS ret mmlGdcPeBindSurface ctx MML SROC surfSrc UTIL SUCCESS ret mmlGdcPeBlt ctx 20 0f 20 0f CopyToVram is a small helper function to copy the image data to its destination in the VRAM static void CopyToVram const void data MM 032 addr MM 032 size void vaddr void addr MM_GDC_LOCK vaddr size MA WRITE September 11 2015 S6E2DH_AN709 00022 1v0 E 39 APPLICATION NOTE CYPRESS memcpy vaddr data size MM GDC UNLOCK vad
79. ZERO 0 MML DISP TILE MODE CONST 1 MML DISP TILE MODE PAD 2 MML DISP TILE MODE CLIP 3 enum DISP LAYER GDC DISP LAYER 0 0 MML GDC DISP LAYER 1 enum DISP SUB LAYER MML DISP SUB LAYER DEFAULT 0 MML DISP SUB LAYER MML DISP SUB LAYER DISP SUB LAYER MML DISP SUB LAYER MML DISP SUB LAYER MML DISP SUB LAYER MML DISP SUB LAYER NOOR WD September 11 2015 S6E2DH_AN709 00022 1v0 E 95 CYPRESS APPLICATION NOTE PERFORM MML DISP SUB LAYER 8 enum DISP DCK DELAY ENABLE MML DISP DCK DELAY OFF 0 GDC DISP DCK DELAY ON enum DISP DCK INVERT ENABLE GDC DISP INVERT OFF 0 MML DISP DCK INVERT enum MML DISP DITHER ENABLE DISP DITHOFF 0 MML DISP DITHON enum DISP DITHER MODE MML DISP TEMPDITH 0 MML DISP SPATDITH 1 lt lt 4 enum MML DISP DITHER RANGE MML DISP DITHRS11LOW 0 enum MML DISP DITHER FORMAT MML DISP DITHER108 0 08080800 MML DISP DITHER107 0x07070700 MML DISP DITHER106 0 06060600 DISP DITHER105 0x05060500 enum MML
80. amp ctx MML_GDC_PE_SRC amp sSrc BMP_HUB UTIL_SUCCESS ret mrmlGdcPeSetMatrix amp ctx MML_GDC_PE_SRC GEO MATRIX FORMAT 3X2 mat BMP_HUB UTIL_SUCCESS ret mmlGdcPeBlt amp ctx WIDTH 0 5f ROT CENTER The next image shows the draw boxes for these 3 rendering steps Figure 6 9 Version 1 6 8 6 2 Version 2 In the previous implementation the store buffer is read twice first when blending the needle then again when blending the hub on top of it To avoid this additional memory access we can blend both sources in one step onto the store buffer The problem by default the driver only processes the bounding box of the source buffer In our example the hub must be blended over the needle so just a part of the needle would be visible To avoid this issue we can force the driver to process both the SRC and the DST frame buffer by using the mmlGdcPeSelectArea function Here we blend hub over rotated needle to store UTIL_SUCCESS mmlGdcPeBindSurface amp ctx MML_GDC_PE_STORE amp sNeedle UTIL SUCCESS ret mmlGdcPeBindSurface amp ctx MML GDC DST amp sSrc BMP NEEDLE UTIL SUCCESS ret mmlGdcPeBindSurface amp ctx MML PE 5 amp sSrc BMP UTIL SUCCESS ret mmlGdcPeSetMatrix amp ctx MML PE SRC MML PE GEO MATRIX FORMAT 3X2 HUBJ We have to render the combined bounding box of needle and hub in this case U
81. applied to RGBA or YUVA channel not available for MML PE FILTER COLOR FORMAT R8G8B8 11 6 4 7 enum MML PE FILTER COLOR FORMAT Filter color formates Enumerator MML GDC PE FILTER COLOR FORMAT R8G8B8 RGB888 format Alpha is not filtered but set to constant value 255 MML GDC PE FILTER COLOR FORMAT R5G6B5A8 RGBA5658 format MML GDC PE FILTER COLOR FORMAT R8G8B8A8 RGBA8888 format Note Only available for PE FILTER TYPE 5 4 MML GDC PE FILTER COLOR FORMAT R10G10B10A8 RGBA1010108 format Note Only available for MML PE FILTER TYPE 5 11 6 4 8 enum MML GDC PE GEO MATRIX FORMAT Geometry matrix format Enumerator MML GDC PE GEO MATRIX FORMAT 3X2 float 6 array with 3 column and 2 lines MML GDC PE GEO MATRIX FORMAT 3X3 float 9 array with 3 column and 3 lines 11 6 4 9 enum MML GDC PE SURF ATTR Surface attributes used by mmlGdcPeSurfAttribute Enumerator MML PE SURF ATTR COLORMULTI Enable disable of color multiplication The related parameter can be MM TRUE Enable color multiplication MM FALSE Disable color multiplication default The related formula is if ColorMultiply MM TRUE else Cout Cin Aout Aout see MML PE SURF ALPHAMULTI September 11 2015 56 20 AN709 00022 1v0 E 127 CYPRESS PERFORM ies CENA CYPRESS APPLICATION NOTE X PERFORM 11 6 5 Cout Cin MML GDC
82. array describing a 2D core pixel buffer analog to utSurfLoadBitmap bCopyToVRAM If MM_TRUE the plmage will be copied to VRAM otherwise the display controller will read the plmage buffer direct x X position offset of the upper left window corner relative to the display screen y Y position offset of the upper left window corner relative to the display screen layerld Layer ID of the window sub_layerlD Sub Layer ID of the window blend_mode Starting blend mode for the window see mmlIGdcDispWinSetBlendMode Return values MML_OK on success Otherwise the related error code or MML_ERR 12 7 2 2 virtual MM ERROR Open MML GDC DISPLAY display MML SURFACE slmage 532 0 532 0 MML DISP LAYER layerld MML DISP LAYER 0 MML DISP SUB LAYER sub MML GDC DISP SUB LAYER DEFAULT MM U32 blend mode 0 inline virtual Open the window and show an image September 11 2015 S6E2DH_AN709 00022 1v0 E 217 EE 7 CYPRESS APPLICATION NOTE PERFORM Parameters display A display object that will be used to open the window slmage The MML_GDC_SURFACE object to be displayed x X position offset of the upper left window corner relative to the display screen y Y position offset of the upper left window corner relative to the display screen layerld Layer ID of the window sub layerlD Sub Layer ID of the window
83. be helpful to visualize the render time The sample application blits for both render parts a red line at different positions on the left side of the screen Different to all other blits this line will be drawn over the whole surface including the part that is currently read by the display controller The display will not show the line while the render task is still ongoing But if the blit queue executes this line drawing operation the display controller will read this new rendered object Figure 6 15 Render time analysis The application supports the keys on the developer board For this example the up and down keys can be used to modify the line split of the upper and lower part It can be used to force a wrong splitting and see the render issues The left key can be used to switch off the background animation You can see a relaxed render time in that case 6 9 1 6 Render tricks The following render tricks are used for this sample Background animation Two rotated and up scaled buffers with weak alpha value generate the background animation Mask buffer multiplication To draw the diagram it is necessary to modify the cylinderical bar height Scaling is not possible because it deforms the 3D optic Therefore the sample reads for each cylinderical bar and blit the bitmap twice The MASK surface only needs the alpha channel of the bitmap The SRC surface reads the alpha and the color channels of the bitmap but with a vertical offset
84. bound STORE surface The details of the operation are defined by the context and surface attributes Note offsetx and offsety position parameters will be added to the current geometric matrix of the src and mask surface That means they are not really required because the matrix changes can handle the same However the most common use case is to blend a modified source bitmap to a defined x y position and it is much simpler to commit this position as parameter The geometrical relation between pixels of the target buffer and pixels of the source buffer are defined in the following way represent a matrix using the offsets given from this function MS Xs Ys represent the surface matrix pixel of the related source SRC MASK ue Moffs x Ms x 5 Ys The path for the DST calculation is a little bit different 132 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE vetore Mast E A typical operation processes a store rectangle defined by the active area of the SRC surface and the given matrix transformation An application can change this behavior by using mmiGdcPeSelectArea A SRC and STORE surface must be defined in minimum to proceed a mmlGdcPeBlt simple copy operation If a DST surface is defined a blend operation will be performed If a MASK surface is defined the MASK alpha channel will be used as external alpha That me
85. color table formats are R8G8B8 or R6G6B6A6 but R8G8B8A8 with 32 bit per color is not supported 4 11 4 Surface properties for indexed images Like other images also indexed images are described by surface objects In this case the application must define the format and address of the image buffer and color table buffer September 11 2015 S6E2DH_AN709 00022 1v0 E 31 Fi APPLICATION NOTE PERFORM 4 11 5 4 11 6 Index images for blit operations Blit operations like blending a traffic sign to a target buffer can be proceeded like operations with standard RGB A images because the surface contains the required information Note The following restrictions exist for indexed images Surfaces describing an indexed image cannot be used as STORE buffer Itis not possible to use indexed images as DST and SOURCE surface for blit Indexed images cannot be scaled or rotated Index images for the windows The display hardware can directly show indexed images In this case the application needs to request the MML GDC DISP FEATURE INDEX COLOR feature while opening the window However there are some restrictions if the window also uses the MML GDC DISP FEATURE MULTI LAYER feature All windows with the same layer ID must use the same index width red channel bit width if they show indexed images One layer with up to 8 sub layer windows can only store 256 palette entries So if the index width is 8 fo
86. constant color for the specified target Indicated color is used for following usage See also mmlGdcPeSurfAttribute Constant color in color multiplication Constant color in tiling Constant color used for the generation of a color component in format conversion e g format conversion from RGB565 to RGBA8888 1234 5678 is used as constant color OXFFFF RGB565 gt OxFFFF FF78 RGBA8888 If pectx is equal to NULL mmlGdcPeSurfColor is terminated without any operation Parameters Pixel Engine context I NULL Setting target MML GDC PE SRC MML GDC PE DST MML GDC PE MASK Red component of color 0 255 default 255 Green component of color 0 255 default 255 Blue component of color 0 255 default 255 Alpha component of color 0 255 default 255 Return values September 11 2015 S6E2DH_AN709 00022 1v0 E 139 CYPRESS APPLICATION NOTE MML OK On success Otherwise the related error code 11 6 5 20 MML PE MM ERROR mmiGdcPeSync MML GDC SYNC sync Inserts a sync object into the 2D command stream similar to the OpenGL glFencSync call Parameters in out sync Sync object reset by mmlGdcSyncReset After successful completion of mmlGdcPeSync it holds the parameter of the inserted sync Return values MML OK On success Otherwise the related error code 11 6 5 21 MM ERROR mmiGdcPeWaitForDispFrameEnd
87. core HW does not calculate z coordinates and the driver API does not support this type of matrix However in the computer 3D world e g OpenGL 4x4 matrices are often used and for compatibility reasons in some tutorial examples the 4x4 matrix type is used To use such a matrix type with the 2D core HW it is required to convert this matrix to a 3x3 matrix type and in some cases to make the z order calculation in software Mat4x3 This matrix type is useful for color operations modifying the B or Y V color channels Mat5x4 This matrix type is useful for color operations modifying the B A or Y V A color channels The following code shows a matrix calculation using typical 3D operations with a 4x4 matrix The result will be converted into a 3x3 matrix and assigned to a blit context Mat4x4 m44 Mat3x3 m33 utMat4x4Loadldentity m44 utMat4x4 Translate m44 w 2 0f h 2 04 0 utMat4x4Scale m44 w 4 01 h 4 01 1 utMat4x4Perspective m44 60 0f float w h float O 1 100 0 utMat4x4Translate m44 0 0 2 utMat4x4RotX m44 40 fAngle utMat4x4RotZ m44 30 fAngle2 utMat4x4Scale m44 float 2 iw 1 2 ih 1 utMat4x4Translate m44 iw 2 0f ih 2 0f 0 utMat4x4Trace M4x4 44 utMat4x4ToMat3x3 m44 m33 utMat3x3Trace M3x3 m33 mmlGdcPeSetMatrix ctx MML_GDC_PE_SRC PE GEO MATRIX FORMAT 3X3 m33 11 17 2 Macro Definition Documentation 1
88. driver The header file contains different derived classed for different use cases For instance a CSurfaceWindow lt 2 gt object can be used to manage a double buffered render target that will be displayed as a window layer on the connected panel A CStaticSurfaceWindow object can be used as a static background layer or to display a static icon as foreground window The typical use or these CWindows object will be shown in the following sample void main September 11 2015 S6E2DH_AN709 00022 1v0 E 205 APPLICATION NOTE CYPRESS PERFORM CDevice device CDisplay display CStaticSurfaceWindow wndBg CSurfaceWindow 2 wndRender device device Open open display display Open ScreenWidth ScreenHeight open a background window and assign an image wndBg Open display background_image open a foreground window with alpha blending wndRender Open display 0 0 ScreenWidth ScreenHeight MML_GDC_DISP_LAYER_1 MML_GDC_DISP_SUB_LAYER_DEFAULT 0 MML GDC DISP BLEND SOURCE ALPHA create a double buffer for the window wndRender CreateBuffer while draw render something to wndRender m_surface swap the buffers wndRender Swap 206 S6E2DH_AN709 00022 1v0 E September 11 2015 APPLICATION NOTE PERFORM 12 Data Structure Documentation 12 1 RLAD BitStream Class Reference include ut class rlad h Public Member Func
89. function see utMmanCreateHeap Parameters i hdlmem Heap to perform the allocation from size Number of bytes to allocate alignment Alignment to use for the allocation Pointer to the newly allocated memory Return values MML OK On success MML ERR MMAN INVALID PARAMETER If a parameter is invalid MML ERR MMAN NO MEMORY If not enough system memory for internal data MML ERR MMAN NO VRAM If no contiguous block of size bytes with alignment is available 176 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE 11 16 4 7 MM ERROR utMmanHeapFree MML MMAN HEAP HANDLE hdlmem void Free a block of memory previously allocated by utMmanHeapAlloc Note Typically an application would not use this function see utMmanCreateHeap Parameters in Heap to perform the free from in addr Pointer to the memory to free Return values MML OK On success MML ERR MMAN INVALID PARAMETER If is NULL MML ERR MMAN INVALID MEMORY If addr does not point to a currently allocated memory block 11 16 4 8 MM ERROR utMmanReset void Reset build in memory heap s This function must be called before mmlGdcVideoAlloc etc are called Return values MML OK on success MML ERR MMAN NO MEMORY if not enough system memory for internal data 11 17 Utility functions for matrix calculations Macros
90. function returns mmlGdcSyncWait amp pdbWin gt sync 0 if ret MML_ERR_GDC_SYNC_TIMEOUT return MML OK Using this mechanism the drawing loop will not consume CPU time if the previous buffer swap is not yet finished The next step is rendering the new frame in the back buffer All these render operations will be pushed in the command sequencer queue and executed sequential by the hardware So if we now assign the new buffer to the window it is possible that the new buffer becomes visible before rendering is finished To avoid this it is possible to poll the end of the operation using mmlGdcPeFinish A better way is to use a sync object UTIL SUCCESS ret mmlGdcPeSync amp pdbWin sync UTIL SUCCESS ret mmlGdcDispWinWaitSync pdbWin win amp pdbWin sync UTIL SUCCESS ret mmlGdcDispWinSetSurface pdbWin win MML DISP BUFF TARGET COLOR BUFF amp pdbWin gt sFramebuffer pdbWin gt iq UTIL SUCCESS ret mmlGdcDispWinCommit pdbWin win It requests a sync object from the pixel engine and pushes it to the window pipe before the new buffer is assigned to the window All these functions are non blocking for the CPU and the driver will ensure that the hardware will be triggered in the correct order 50 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE 6 7 4 Swap interval The windows are set to different swap intervals SUCCESS ret mmlIGdcDisp
91. graphical operation use different coordinate systems The following definitions are used inside the 2D Graphics Driver 4 9 1 Surface Image buffer Images described by a surface are always line based from top to down left to right That means the first bits in a surface memory buffer describe the upper left pixel the next bits describe the pixel right of the first and so on Figure 4 8 Zoomed image with pixel enumeration 4 9 2 Display coordinates Analog to images the display coordinate system always starts at the top left pixel 4 9 3 PixEng coordinates For compatibility reasons the PixEng coordinate system starts per default with the bottom left pixel Note very first pixel starts at 0 0 0 0 and ends at 1 0 1 0 That means the geometrical center of this pixel is 0 5 0 5 The following image is the result of a copy instruction of the 4 pixel image above with offset 0 0 September 11 2015 56 20 AN709 00022 1v0 E 27 APPLICATION NOTE SF PERFORM Figure 4 9 Zoomed blit and draw result with bottom left coordinate system setting For some use cases it is much simpler to use the same coordinate system like the display Besides this some graphics formats 9 SVG and APIs use the opposite coordinate system That s why the 2D Graphics Driver supports the mirrored coordinate system too and the user can switch the coordinate handling to top left zero point The same image ren
92. inline 12 10 3 3 Return values 12 10 3 4 unsigned int GetHeight inline Return values 12 10 3 5 MML GDC SYNC GetSync inline Get the sync object of this window 12 10 3 6 unsigned int GetWidth inline S6E2DH_AN709 00022 1v0 E September 11 2015 2 5 lt v c Return 224 dl APPLICATION NOTE P CYPRESS PERFORM 12 10 37 MML DISP WINDOW GetWindowHandle inline Return values 12 10 3 8 virtual MM ERROR Open MML GDC DISPLAY display MM S32xz0 S32yz0 MM 032 0 MM 9321 0 MML DISP LAYER layerld MML DISP LAYER 0 MML DISP SUB LAYER sub MML GDC DISP SUB LAYER DEFAULT MM U32 features 0 MM U32 blend mode 0 inline virtual Open the window Parameters display A display object that will be used to open the window X position offset of the upper left window corner relative to the display screen Y position offset of the upper left window corner relative to the display screen Width of the window Height of the window layerld Layer ID of the window sub layerlD Sub Layer ID of the window features Requested features for the window see MML_GDC_DISP_WINDOW_PROPERTIES blend mode Starting blend mode for the window see mmlGdcDispWinSetBlendModer Return values MML OK on success Otherwise the related error code or MML ERR 12 10 3 9 operator M
93. instruction buffer usage an application can use the mmlGdcConfigGetAttribute function with attribute MML GDC CONFIG ATTR MIN INSTRUCTION BUFFER The function must be called after mmlGacSyslnitializeDriver before any render or display operations A reconfiguration of the instruction buffer is not possible Parameters address Start address in the VRAM Must be 32 byte aligned size Size in bytes of the buffer to assign must be DWORD 4 Bytes aligned the function will return an error otherwise The application must ensure that the address as well as the address plus size are within the range of the 2D core VRAM memory the function will not do this Return values MML OK success otherwise the related error code September 11 2015 S6E2DH_AN709 00022 1v0 E 81 Z CYPRESS APPLICATION NOTE PERFORM 11 2 3 3 MM ERROR mmlGdcSysUninitializeDriver void Used to shutdown the driver Applications must uninitialize the driver after calling mmlGdcSyslnitializeDriver Return values MML_OK Successfully shutdown the driver MML_ERR_GDC_SYS_DEVICE_NOT_YET_INITIALIZED not yet initialized MML_ERR_GDC_SYS_DEVICE_CLOSE_FAILED Driver shutdown failed 11 3 Configuration API The Configuration allows changing or reading global graphics driver configurations or status information Enumerations enum MML_GDC_CONFIG_ATTR MML_GDC_CONFIG_ATTR_MAJOR_VERSION 0 MML GDC CONFIG
94. it as font for the util lib utSetFont amp utCtx sFont Initialize a point bitmap UTIL_SUCCESS ret utlnitPoint amp utCtx 50 6 12 2 2 Doing the animation Now begin with the animation slightly different scenes 360 times First clear the screen Clear the whole frame You should optimize and only redraw the changed parts UTIL SUCCESS ret utRect amp utCtx 0 0 320 240 Then draw a rounded rectangle with a border Now we draw a RoundRect with border The simplest way is to draw it twice with different sizes and color i utColor amp utCtx 0 255 0 255 UTIL SUCCESS ret utRoundRect amp utCtx 163 83 154 154 10 10 And then draw the different parts of the complete scene The Drawing part is split into 5 sections The result of DrawSample is used for DrawMix Don t change the order UTIL SUCCESS ret DrawLines amp utCtx UTIL_SUCCESS ret utlnitPoint amp utCtx 20 70 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE F CYPRESS PERFORM UTIL_SUCCESS ret DrawPoints amp utCtx UTIL_SUCCESS DrawSample amp utCtx f UTIL_SUCCESS ret DrawLineEnds amp utCtx f UTIL SUCCESS ret DrawMix amp utCtx target nCurBuffer 6 12 3 The drawing functions 6 12 3 1 Drawlines We draw some flowers made of lines at different angles centered on the same point First set up the line width and line end write some informa
95. its own matrix so different translations for source buffer and blend destination are possible The coordinate center is per default the lower left corner of each surface so a simple copy instruction will copy the source surface to the lower left corner of the store surface Furthermore the connected surfaces STORE SRC DST and MASK can have different properties like color format dimension or compression Not all properties are supported for each pipe configuration Surface properties may also restrict other blit features For instance it is not possible to rotate a compressed image The mmlGdcPeBIt call reports an error if the given properties cannot be applied to the hardware In this case the application developer must simplify the blit operation or may split it into 2 separate blit instructions with a temporary buffer The following table gives an overview about supported surface properties and features Surface and context properties All RGBA formats All RGBA formats Geometry operations like translation scaling rotation and perspective transformation Decompression or indexed color Restriction DST must not use these features only scale and translation operations are supported Warping No geometry operations possible All RGBA formats Geometry operations like translation mirroring and simple rotation multiple of 90 degree Decompression or indexed color Restriction SRC must not use these features no mi
96. maximum size will not be exceeded 4 10 1 2 How to create compressed images The Tutorial Utility Library contains a Utilities for the compression part providing sample code to create run length coded and run length adaptive compressed buffers Furthermore the 2D Core Driver package contains a windows command line tool ResourceGenerator exe that can be used to convert a png image into a compressed buffer and store it in a c compliant header file Afterwards this content can be used by the utSurfLoadBitmap function to fill a SURFACE object that can be used for blit or display functions S6E2DH_AN709 00022 1v0 E September 11 2015 30 y I APPLICATION NOTE SJ CYPRESS PERFORM 4 11 Images With Color Index Table To reduce the amount of required memory the HW supports images with indexed colors In this case the image requires 2 buffers One buffer contains all possible colors for this image the color table or color look up table The second buffer is the typical image buffer But for each pixel in the image it only stores an index pointing to a color in the color table 4 11 1 Alpha support Index images can also include per pixel alpha values to control the transparency of the addressed color The alpha information can be stored either in the image buffer beside the index pointer or it can be part of the color table 4 11 2 Image buffer Like other image buffers also ima
97. or more windows or layers for each display see Display Use the Surface API to describe source and target frame buffers see Surface API Use any of the APIs described below to create and manipulate graphics content see Pixel Engine API Close all created windows see Display Close the display see Display Uninitialize the driver see Driver Initialization DOO September 11 2015 S6E2DH_AN709 00022 1v0 E 13 APPLICATION NOTE SF PERFORM 4 Overview 4 1 2D Graphics Driver parts As shown in the Introduction the 2D Graphics Driver consists of different modules The following sub pages will give an overview about the function of some of these modules Beside these overview pages this document includes a detailed API documentation for each module Surface Overview Display Overview Overview Pixel Engine PixEng Synchronization Overview Error Reporting Overview 4 2 Other topics Memory Management Coordinate System Hints Image Compression Images With Color Index Table 4 3 Surface Overview 4 3 1 Surface objects The 2D Graphics Driver uses surface objects to store information about video memory blocks representing an image a frame buffer and similar things That means the surface contains the related information about memory address es color format dimension compression format and more The following diagram shows the gen
98. range will be clamped Note Example Let F in be the requested gamma formula Input values of F in are the range 0 0 1 0 It is allowed that the output value is smaller than 0 0 or bigger 1 0 The value array in this example pRed must be calculated in the following way MML DISP CLUT FORMAT 33 for i 0 i lt 32 i pRed i MM_S16 0 5f F i 32 0f 1024 0f 1023 0f 1023 Please note that the given formula calculates the value for F 256 255 If F x is only defined for input values 0 0 1 0 then pRed 32 can be calculated as pRed 32 MM_S16 0 5f 32 0f F 1 F 31 0f 32 0f 1023 0f 1023 0f 31 0f If one pointer of color components is NULL then the CLUT is set to bypass This setting will not be active immediately Use mmlGdcDispCommit to submit for processing The three pointers to array of color component must be valid till the setting is committed Parameters display An MML DISPLAY returned from a previous call to mmlGdcDispOpenbDisplay Defines the number of entries in the array Depending on the hardware the CLUT hardware format may support not all format types In this case the driver interpolates the missing or skips the needless values S6E2D accepts only MML DISP CLUT FORMAT 33 pRed Pointer to array of red values The size of the array depends on format pGreen Pointer to array of green values The size of the array depends on format
99. red green blue alpha September 11 2015 S6E2DH_AN709 00022 1v0 E 195 APPLICATION NOTE F CYPRESS 11 19 2 Macro Definition Documentation define UTIL ERR OUT OF MEMORY 11 19 2 1 MM ERRCODE 0x31000001 execute Out of memory rc define UTIL SUCCESS 11 19 2 2 Value do X X if rc MML OK X X rc execute X if rc MML OK printf Error x in 96s 96s line d n int rc FUNCTION FILE LINE while 0 This macro avoids execution if the previous instruction failed MML_GDC_SURFACE 11 19 3 Function Documentation MM_ERROR utSurfCreateBuffer MM U32 h MML GDC SURF FORMAT 11 19 3 1 MM U32 w surf Create a buffer with the given dimension and color format and set the related surface object properties eFormat Please note the surface object must be created before The surface object Width of the surface Height of the surface The requested color format i eFormat Return values MML OK Success otherwise the related error code S6E2DH 709 00022 1 0 September 11 2015 Parameters 196 d APPLICATION NOTE SEEZCYPRESS PERFORM 11 19 3 2 void utSurfDeleteBuffer SURFACE surf Delete the surface buffers Parameters The surface object 11 19 3 3 MM ERROR utSurfGetPixel MML GDC SURFACE src MM 032 x MM U32 y MM 008 MM 008 g MM 008 MM 008 Get the g
100. single or OR combined value of MML GDC PE SRC MML GDC PE DST MML GDC PE MASK format Defines the matrix format see above fMatrix Transformation matrix see above Return values 138 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE MML OK On success Otherwise the related error code 11 6 5 18 MML MM ERROR mmiGdcPeSurfAttribute PE CONTEXT 032 target MML GDC PE SURF ATTR pname MM U32 param Set an attribute for the surface that is bound to the specified target If pectx is equal to NULL mmlGdcPeSurfAttribute is terminated without any operation Note MASK surface does not support color multiplication function reports an error if a related parameter is set Parameters in out Pixel Engine context I NULL in Setting target MML GDC PE SRC all attributes MML GDC PE DST all attributes PE MASK all attributes or MML PE STORE attribute SURF ATTR USE CLIPPING only State name for setting Can be one of MML PE SURF Parameter for target See MML GDC PE SURF ATTR description Return values MML OK On success Otherwise the related error code 11 6 5 19 MML MM ERROR mmlGdcPeSurfColor MML PE CONTEXT 032 target MM 008 red MM 008 green MM 008 blue MM 008 alpha Set the
101. the NUM BUFFERS definition The constructor takes over the surface object initialization To use the surface for blit or display operations it is typically required to allocate VRAM or to assign a static resource from FLASH memory The required functions are part of these class If the NUM BUFFERS is 2 or more the CSurface object can be used for multi buffer rendering The Swap member function can be used to toggle between foreground and background buffer The GetSurface GetHandle and will always return the foreground buffer 11 28 2 Function Documentation 11 28 2 1 MM ERROR Copy MML SURFACE surface virtual Copy the surface object Note This function copies the properties only Not the surface content of surface object Parameters Surface that should be copied Return values MML OK on success Otherwise the related error code 11 28 2 2 MM ERROR CreateBuffer const MM 032 width const MM U32 height const MML SURF FORMAT format MML SURF FORMAT R8G8B8A8 MM 032 MaxSize 0 virtual The CreateBuffer function can be used setup the member surface object s with allocated VRAM September 11 2015 S6E2DH_AN709 00022 1v0 E 203 YPRESS APPLICATION NOTE Q SF PERFORM Parameters width Defines the with of the surface s height Defines the height of the surface s format Defines the color format of the surface s MaxSize Experimental Defin
102. the memory block allocated for the surface The surface object Parameters Name of the attribute See MML GDC SURF ATTR The new value On success If illegal value is given for eName If NULL pointer is given for surf Return values MML OK MML ERR SURF INVALID ATTRIBUTE MML ERR SURF INVALID SURFACE S6E2DH 709 00022 1 0 September 11 2015 94 CE LE APPLICATION NOTE F CYPRESS PERFORM 11 5 Display API The Display API exposes all the hardware features of the display unit See also Display Overview Data Structures struct MML_GDC_DISP_MODE_LINE struct MML_GDC_DISP_TCON_PROPERTIES struct MML_GDC_DISP_PROPERTIES struct MML_GDC_DISP_WINDOW_PROPERTIES Typedefs typedef struct MML_GDC_DISPLAY MML_GDC_DISPLAY typedef struct MML GDC DISP WINDOW GDC DISP WINDOW Enumerations enum MML DISP CONTROLLER MML DISP CONTROLLER 0 0 enum DISP MODE MML DISP SINGLE SCREEN 0 MML DISP DUAL SCREEN MML DISP DUAL VIEW enum MML DISP OUTPUT SCREEN DISP OUTPUT SCREEN PRIMARY 0 DISP OUTPUT SCREEN SECONDARY DISP OUTPUT SCREEN BOTH enum MML DISP FILTER MML DISP FILTER NEAREST 0 MML DISP FILTER BILINEAR enum MML DISP MODE MML GDC DISP TILE MODE
103. trying to acquire a resource 11 10 2 6 ERR DISP ERROR MM ERRCODE 0x11001003 Wrong arguments define MMD ERR INT OUT OF RANGE 11 10 2 7 MM ERRCODE 0x11010001 Interrupt id is out of range define ERR SYNC ACCESS FAILED 11 10 2 8 ERRCODE 0x11005002 An unexpected internal error occurred define ERR SYNC INVALID PARAMETER 11 10 2 9 MM ERRCODE 0x11005001 An invalid value is specified in an argument 11 10 2 10 Zdefine ERR SYNC TIMEOUT MM ERRCODE 0x11005003 Timeout expired S6E2DH 709 00022 1 0 September 11 2015 154 PERFORM APPLICATION NOTE 11 10 2 11 MML ERR ERP ALREADY INITIALIZED MM ERRCODE 0x2100F000 The error manager is already initialized 11 10 2 12 define MML ERR ERP INVALID PARAMETER ERRCODE 0x2100F002 An invalid value is set in an argument 11 10 2 13 MML ERR INITIALIZED MM ERRCODE 0x2100F001 The error manager is not initialized 11 10 2 14 MML ERR CARD ACCESS FAILED MM ERRCODE 0x21007004 An unexpected internal error occurred 11 10 2 15 MML ERR CARD BUSY MM ERRCODE 0x21007007 Access to a device is denied e g because a shadow load request is pending 11 10 2 16 MML ERR CARD ENABLED MM ERRCODE 0x21007002 Device is still enabled 11 10 2 1
104. typedef signed short MM S16 typedef unsigned int MM U32 typedef signed int MM S32 typedef unsigned long long MM U64 typedef signed long long MM S64 typedef char CHAR typedef float MM FLOAT typedef double MM DOUBLE typedef int MM BOOL typedef unsigned int MM ADDR typedef S32 MM ERROR typedef S32 MM MODULE 13 7 1 Detailed Description Basic type definitions 13 8 mmd interrupthandler h File Reference 2D Core Interrupt Controller API include mm types h Macros define MM IRIS INT STORE9 FRAMECOMPLETE CP 1U define MM IRIS EXTDSTO FRAMECOMPLETE CP 4U define MM IRIS INT DISENGCFG FRAMECOMPLETEO IRQ CP 10U define MM IRIS INT CMDSEQ ERROR IRQ CP 20U define MM IRIS INT FRAMEGENO SECSYNC ON IRQ CP 27U define MM IRIS INT FRAMEGENO SECSYNC OFF IRQ CP 280 Interrupt signal These can be used in mmdGadclInterruptRegisterHandler define MM IRIS STORE9 FRAMECOMPLETE IRQ MM U64 1 lt lt MM IRIS INT STORE9 FRAMECOMPLETE IRQ CP define MM IRIS EXTDSTO FRAMECOMPLETE IRQ MM U64 1 lt lt MM IRIS INT EXTDSTO FRAMECOMPLETE IRQ CP CE LE CYPRESS PERFORM September 11 2015 S6E2DH_AN709 00022 1v0 E 245 Z CYPRESS APPLICATION NOTE SF PERFORM define MM GDC IRIS DISENGCFG FRAMECOMPLETEO IRQ MM U64 1 lt lt MM GDC IRIS INT DISENGCFG FRAME
105. void utMat3x2Copy Mat3x2 dst const Mat3x2 src MML 2D MATRIX void utMat3x2Multiply Mat3x2 dst const Mat3x2 src1 const Mat3x2 src2 MML GDC 2D MATRIX void utMat3x2Loadldentity Mat3x2 m MML 2D MATRIX void utMat3x2Translate Mat3x2 m MM FLOAT x MM FLOAT y September 11 2015 56 20 AN709 00022 1v0 E 257 is P CYPRESS APPLICATION NOTE PERFORM 2D MATRIX void utMat3x2TranslatePre Mat3x2 m MM FLOAT x MM FLOAT 2D MATRIX void utMat3x2Scale Mat3x2 m MM FLOAT x MM FLOAT y 2D MATRIX void utMat3x2ScalePre Mat3x2 m MM FLOAT x MM FLOAT y 2D MATRIX void utMat3x2Rot Mat3x2 m MM FLOAT f 2D MATRIX void utMat3x2RotPre Mat3x2 m MM FLOAT f MML 2D MATRIX MM U32 utMat3x2Invert Mat3x2 m 2D MATRIX void utMat3x2GetXY const Mat3x2 m const MM FLOAT x const MM FLOAT y MM FLOAT MM FLOAT yout 2D MATRIX void utMat3x3Loadldentity Mat3x3 m MML 2D MATRIX void utMat3x3Copy Mat3x3 dst const Mat3x3 src 2D MATRIX void utMat3x3Multiply Mat3x3 dst const Mat3x3 src1 const Mat3x3 Src2 2D MATRIX void utMat3x3Translate Mat3x3 m MM FLOAT x MM FLOAT y 2D MATRIX void utMat3x3TranslatePre Mat3x3 m MM FLOAT x MM FLOAT y
106. 0 2 38 MML ERR DISP UNSUPPORTED MODE MM ERRCODE 0x21001004 A display mode was requested that is not supported on the hardware 11 10 2 39 define MML ERR GDC DISP WRONG INDEX WINDOW MM ERRCODE 0x21001013 The layer does not support an indexed color format define MML_ERR_GDC_DISP_WRONG_PIXEL_FORMAT 11 10 2 40 MM ERRCODE 0x21001009 The pixel format is not supported by the display controller S6E2DH 709 00022 1 0 September 11 2015 158 PERFORM APPLICATION NOTE 11 10 2 41 MML ERR DISP WRONG STRIDE MM ERRCODE 0x21001011 The stride of the pixel buffer must be a multiple of 64 11 10 2 42 define MML ERR GDC DISP WRONG TCON PARAMS MM ERRCODE 0x21001016 Wrong timing controller parameters 11 10 2 43 MML ERR DISP WRONG WINDOW MM ERRCODE 0x21001012 The feature is not supported by the given window 11 10 2 44 define MML ERR DISP WRONG WINDOW MM ERRCODE 0x21001015 The layer does not support format 11 10 2 45 MML ERR INT OUT OF RANGE MM ERRCODE 0x21010001 Interrupt id is out of range 11 10 2 46 define MML ERR IRIS SEQ ERROR MM ERRCODE 0x2100B001 cmd seq Wrong arguments for CmdSeq 11 10 2 47 define MML ERR GDC IRIS CMD SEQ COMMAND QUEUE FULL MM ERRCODE 0x2100B005 Command buffer full 159 September 11 2015 56 20 AN709 00022 1v0 E A
107. 032 syncPolarity 12 12 1 Detailed Description Data type used to specify custom timing for a display mode 12 12 2 Field Documentation 12 12 2 1 MM U32 DCKDelay Number of display clock delay default no additional delay value is 0 16 12 12 2 2 MML GDC DISP DCK INVERT ENABLE DCKInvertEnable Enable inversion of display clock default set as not inverted 12 12 2 3 MM_U32 horDisplayPeriod Horizontal Display Period Illuminated area 12 12 2 4 032 horPulseEnd Number of the dot when the sync pulse ends 12 12 2 5 MM 032 horPulseStart Number of the dot when the sync pulse starts 12 12 2 6 MM U32 horTotal Total horizontal 12 12 2 7 MM FLOAT pixelClock Pixel clock in units of MHz 228 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE DJ CYPRESS PERFORM 12 12 2 8 032 syncPolarity field combination of polarity control possibilities MML GDC DISP HSYNC LOW MML GDC DISP HSYNC HIGH MML GDC DISP VSYNC LOW MML DISP VSYNC HIGH MML DISP DE LOW MML DISP DE HIGH MML GDC DISP RGB LOW MML GDC DISP RGB HIGH Default value MML DISP HSYNC LOW MML DISP VSYNC LOW MML DISP DE HIGH MML GDC DISP RGB LOW 12 12 2 9 MM U32 vertDisplayPeriod Vertical display period Illuminated area 12 12 2 10 032 vertPulseEnd Vertical sync end position 12 12 2 11 032 vert
108. 1 16 2 8 ERRCODE 0x18010002 Out of memory system 11 16 2 9 define MML ERR MMAN NO VRAM MM ERRCODE 0x18010003 Out of memory VRAM 11 16 3 Typedef Documentation 11 16 3 1 typedef void MML MMAN HEAP HANDLE Type definition for memory heap handle 11 16 4 Function Documentation 11 16 4 1 MM ERROR utMmanCreateHeap MML MMAN HEAP HANDLE MM U32 size MM 032 baseAddress Creates a video memory heap Typically an application would not use this function but call mmlGdcVideoAlloc instead which Note uses the build in memory heap Parameters out hdimem Handle to newly created heap in size Size of heap video memory in baseAddress Physical start address of heap video memory S6E2DH_AN709 00022 1v0 E September 11 2015 174 APPLICATION NOTE PERFORM Return values MML OK On success MML ERR MMAN NO MEMORY If not enough system memory for internal data 11 16 4 2 MM ERROR utMmanDestroyHeap MML MMAN HEAP HANDLE hdimem Destroys a video memory heap Note Typically an application would not use this function see utMmanCreateHeap U w o in Handle to heap Return values MML OK On success MML ERR MMAN INVALID PARAMETER If hdimem is NULL 11 16 4 3 MM ERROR utMmanGetFree MMAN HEAP HANDLE hdimem MM 032 size Get the total amount of free memory on the heap Note Typically an application would no
109. 1 17 2 1 define MML 2D MATRIX API extern MML GDC 2D MATRIX API can be used to define function types like dll export 11 17 3 Typedef Documentation 11 17 3 1 typedef MM FLOAT Mat3x2 6 Matrix with 3 columns and 2 rows for a fine geometry operations If m is a Mat3x2 matrix type and x y in an input vector the resulting vector is m 0 m 2 m 4 _ m 0 x x m 2 x y 4 Bm m 3 1 y E can x x m 3 i51 September 11 2015 S6E2DH_AN709 00022 1v0 E 179 APPLICATION NOTE 4 PERFORM 11 17 3 2 typedef MM FLOAT Mat3x3 9 Matrix with 3 columns and 3 rows for perspective geometry operations If m is a Mat3x3 matrix type and x y in an input vector the resulting vector is m 0 x x m 3 x y m 6 m 2 x x m 5 x y m 8 m 0 m 3 m 6 y m 1 m 4 m 7 x x m 1 x x m 4 x y m 7 m 2 m 5 m 8 1 m 2 x x m 5 x y m 8 1 11 17 3 3 typedef MM FLOAT Mat4x3 12 Matrix with 4 columns and 3 rows for color operations with the R G B or Y U V channels If m is a Mat4x3 matrix type and R G B in an input vector the resulting vector is m 0 m 3 m 6 9 R m 0 x R m 3 x m 6 x B m 9 m 1 m 4 m 7 m 12 x s m 1 x R m 4 x G m 7 x B m 10 11 m 2 x R 4 m 5 x G m 8 x B m 11 11 17 3 4 typedef FLOAT Mat4x4 16 Matrix with 4 columns and 4 rows for perspective geometry operations including z calculation The Mat4x4 matrix is de
110. 2 3 3 Member Function Documentation 12 3 3 1 MM ERRORCIose inline Close the device will be called from destructor Return values On success Otherwise the related error code or MML ERR MML OK 12 3 3 2 MM BOOLIsOpen inline Can be used to check the status Return values MM TRUE If Open was successfully called otherwise MM FALSE 12 3 3 3 MM ERROR MM 032 uCmdSeqSize 0 inline Open the device 70 5 3 2 D o uCmdSeqgSize Defines the size that will be allocated for the command sequencer Return values On success Otherwise the related error code or MML ERR MML OK The documentation for this class was generated from the following file Ut class device h 12 4 CDisplay Class Reference include ut class display h Public Member Functions MM ERROR Open unsigned int nWidth 0 unsigned int nHeight 0 MML DISP CONTROLLER displayZMML DISP CONTROLLER 0 MM ERROR Close virtual MM ERROR SetBgColor MM 032 color MM 032 GetWidth 032 GetHeight DISP CONTROLLER GetDisplayController DISPLAY GetHandle operator MML DISPLAY 210 S6E2DH 709 00022 1 0 September 11 2015 PERFORM APPLICATION NOTE Detailed Description Class CDisplay see CDisplay 12 4 1 12 4 2 Member Function Documentation 12 4 2 1 MM ERRORCIose inline Close the display contro
111. 21009005 define MML_ERR_GDC_SYS_DEVICE_WRONG_ID MM_ERRCODE 0x21009006 Error codes for Writeback API define MML_ERR_GDC_WB_DEVICE_BUSY MM_ERRCODE 0x21004001 define MML_ERR_GDC_WB_INVALID_PARAMETER MM_ERRCODE 0x21004002 Error codes for Internal function calls define MML_ERR_GDC_CARD NOT ENABLED ERRCODE 0x21007001 define ERR CARD ENABLED MM ERRCODE 0x21007002 define MML ERR CARD NOTSUPPORTED ERRCODE 0x21007003 define MML ERR CARD ACCESS FAILED ERRCODE 0x21007004 define ERR THREAD LIMIT ERRCODE 0x21007005 define MML ERR CARD TIMEOUT EXPIRED ERRCODE 0x21007006 define ERR CARD BUSY MM ERRCODE 0x21007007 define MML ERR IRIS SEQ ERROR ERRCODE 0x2100B001 define MML ERR IRIS SEQ INVALID ADDRESS MM ERRCODE 0x2100B002 define MML ERR IRIS SEQ INVALID BUFFER SIZE MM ERRCODE 0x2100B003 define MML ERR IRIS SEQ FIFO UNINITIALIZED MM ERRCODE 0x2100B004 define MML ERR IRIS SEQ COMMAND QUEUE FULL MM ERRCODE 0x2100B005 define MMD ERR DISP ERROR MM ERRCODE 0x11001003 define ERR OUT OF RANGE MM ERRCODE 0x21010001 define MMD ERR OUT OF RANGE MM ERRCODE 0x11010001 define MML ERR IRIS MATH INVALID FLOAT MM ERRCO
112. 40 define IRIS DISENGCFG FRAMECOMPLETEO CP 100 define IRIS CMDSEQ ERROR CP 200 define IRIS FRAMEGENO SECSYNC ON CP 270 define IRIS FRAMEGENO SECSYNC OFF IRQ 280 Interrupt signal These can be used mmdGdclInterruptRegisterHandler define MM_GDC_IRIS_STORE9_FRAMECOMPLETE_IRQ MM U64 1 lt lt MM GDC IRIS INT STORE9 define IRIS EXTDSTO FRAMECOMPLETE IRQ MM U64 1 lt lt MM GDC IRIS INT EXTDSTO FRAMECOMPLETE IRQ CP define IRIS DISENGCFG FRAMECOMPLETEO IRQ MM U64 1 lt lt MM IRIS DISENGCFG FRAMECOMPLETEO IRQ CP define IRIS CMDSEQ ERROR IRQ MM U64 1 lt lt MM IRIS INT CMDSEQ ERROR CP define MM IRIS FRAMEGENO SECSYNC ON IRQ MM U64 1 lt lt MM GDC IRIS INT FRAMEGENO SECSYNC ON IRQ CP define IRIS FRAMEGENO SECSYNC OFF IRQ MM U64 1 lt lt MM IRIS INT FRAMEGENO SECSYNC OFF IRQ CP Interrupt Operations Functions void mmdGadclinterruptHandler void Interrupt Handler Function MM ERROR mmdGdclinterruptRegisterHandler MM U64 void pHandler MM 064 intrrpt Set an application defined interrupt handler function 11 8 1 1 Detailed Description 2D Core Interrupt Controller handler functions include mmd g
113. 5 APPLICATION NOTE SE Cypress PERFORM 11 14 2 6 MM ERRCODE MM Macro to define the returned Error Code of the driver function 11 14 2 7 define MM FALSE MM BOOL 0 Definition of FALSE for bool types 11 14 2 8 define MM IO IRIS CORE 0xD0A10000U Graphics Core Base Address 11 14 2 9 define MM IO IRIS SUBSYSTEM 0 00 4000000 Graphics Subsystem Base Address 11 14 2 10 stdefine MM MODULEID moduleld MM MODULE moduleld Macro to define the IDs of the driver modules 11 14 2 11 TO ADDR X ADDR x Conversion void to MM ADDR 11 14 2 12 TO UINT3 932 Conversion void to MM 032 11 14 2 13 define MM TRUE MM 1 Definition of TRUE for bool types 11 14 2114 MM UINT32 TO ADDR X ADDR x Conversion U32 to ADDR 11 14 2 15 MM UINT32 TO voids x Conversion U32 to void 11 14 2 16 Zdefine ERR MM_ERRCODE 0x7FFFFFFF Abnormal termination kernel space September 11 2015 S6E2DH_AN709 00022 1v0 E 171 82 Cypress APPLICATION NOTE PERFORM 11 14 2 17 define OK MM_ERRCODE 0x0 Normal termination kernel space 11 14 2 18 define MML ERR MM_ERRCODE 0x3FFFFFFF Abnormal termination user space 11 14 2 19 MML OK 0 0 Normal
114. 7 4define MML ERR CARD NOT ENABLED MM ERRCODE 0x21007001 Device is not enabled 11 10 2 18 4define MML ERR CARD NOTSUPPORTED MM ERRCODE 0x21007003 Operation not supported for device 155 September 11 2015 56 20 AN709 00022 1v0 E APPLICATION NOTE F CYPRESS define MML ERR CARD THREAD LIMIT 11 10 2 19 MM ERRCODE 0x21007005 Maximum number of supported threads reached define MML ERR CARD TIMEOUT EXPIRED 11 10 2 20 MM ERRCODE 0x21007006 A timeout expired while trying to acquire a resource Work ltem etc define MML ERR CONFIG INTERNAL ERROR 11 10 2 21 MM ERRCODE 0x21008002 Graphics driver internal error define MML ERR CONFIG INVALID ADDRESS 11 10 2 22 MM ERRCODE 0x21008003 An invalid address is specified MML ERR GDC CONFIG INVALID PARAMETER 11 10 2 23 define MM ERRCODE 0x21008001 The parameter is wrong 11 10 2 24 define MML ERR DISP BUSY MM ERRCODE 0x21001020 Previously requested configuration is not completely set up MML ERR GDC DISP DEVICE CLOSE FAILED 11 10 2 25 define MM ERRCODE 0x21001006 Hardware device s failed to close define MML ERR DISP DEVICE INIT FAILED 11 10 2 26 MM ERRCODE 0x21001005 Hardware device s failed initialization S6E2DH_AN709 00022 1v0 E September 11 2015 156 PERFORM APPLICATION NOTE 11 10 2 27 define MML ERR
115. 709 00022 1 0 September 11 2015 APPLICATION NOTE 80 Figure 4 3 Sample display scene 100 120 140 7 160 x1000 d BAYERN 3 Rendered by IRIS Asingle layer architecture requires to render all details for each frame It requires much CPU time and VRAM The display window concept allows the following architecture visualized as perspective view W The gray colored window shows a background layer that might be a compressed 8 bpp indexed image buffer because the content is static W The yellow colored windows represent the second layer Each separate window may be rendered and updated with a different frame rate and color format W The green colored windows represent the next layer blend level W The red colored windows are the most top windows In this case they show static 4 bpp indexed images and can be independently switched and faded Figure 4 4 Perspective view to the scene All windows support a minimum functionality show a image or frame buffer with red green blue or gray and optional alpha information The color and optional alpha information will be read from a continuous video memory block with a defined width height and stride The bits per pixel BPP can be 1 2 4 8 16 18 24 or 32 The mapping to the color or alpha channels can be selected freely The images can be used with Simple Transformation Some windows support special features beside this standard feature set The diffe
116. 709 00022 1v0 E September 11 2015 APPLICATION NOTE F CYPRESS PERFORM Error codes for Display API define ERR DISP DEVICE NOT FOUND ERRCODE 0x21001001 define MML ERR DISP DISPLAY ALREADY OPEN MM ERRCODE 0x21001002 define ERR DISP INVALID MM ERRCODE 0x21001003 define MML ERR DISP UNSUPPORTED MODE ERRCODE 0x21001004 define MML ERR DISP DEVICE INIT FAILED MM ERRCODE 0x21001005 define MML ERR DISP DEVICE CLOSE FAILED MM ERRCODE 0x21001006 define MML ERR DISP OUT OF SYSTEM MEMORY MM ERRCODE 0x21001007 define MML ERR DISP LAYER ALREADY USED ERRCODE 0x21001008 define MML ERR DISP WRONG PIXEL FORMAT ERRCODE 0x21001009 define MML ERR DISP WRONG STRIDE MM ERRCODE 0x21001011 define MML ERR DISP WRONG WINDOW ERRCODE 0x21001012 define MML ERR DISP WRONG INDEX WINDOW ERRCODE 0x21001013 define ERR DISP FAILED MM ERRCODE 0x21001014 define MML ERR DISP WRONG WINDOW MM ERRCODE 0x21001015 define MML ERR DISP WRONG TCON PARAMS ERRCODE 0x21001016 define MML ERR DISP DISPLAY MODE MISSMATCH ERRCODE 0x21001017 define MML ERR DISP INVALID SCALING MM_ERRCODE 0x21001018 define MML ERR DISP INVALID ERRCODE 0x21001019 define MML ERR DISP INVAL
117. COMPLETEO IRQ CP define IRIS CMDSEQ ERROR IRQ MM U64 1 lt lt MM GDC IRIS INT CMDSEQ ERROR IRQ CP define MM IRIS FRAMEGENO SECSYNC ON IRQ MM U64 1 lt lt MM IRIS INT SECSYNC ON CP define IRIS FRAMEGENO SECSYNC OFF IRQ MM U64 1 lt lt MM GDC IRIS INT FRAMEGENO SECSYNC OFF IRQ CP Functions Interrupt Operations Functions void mmdGadclinterruptHandler void Interrupt Handler Function MM ERROR mmdGdcinterruptRegisterHandler MM_U64 void pHandler MM_U64 intrrpt Set an application defined interrupt handler function 13 8 1 Detailed Description 2D Core Interrupt Controller API 13 9 gdc config h File Reference Controls global graphics driver and hardware configurations include mm errors h Enumerations enum MML CONFIG MML CONFIG ATTR MAJOR VERSION 0 CONFIG ATTR MINOR VERSION MML GDC CONFIG ATTR BUILD VERSION MML CONFIG ATTR MIN INSTRUCTION BUFFER CONFIG ATTR CURRENT INSTRUCTION BUFFER MML GDC CONFIG ATTR DISPLAY NOBLOCK MML CONFIG BUILD Functions MM ERROR mmlGdcConfigSetAttribute MML CONFIG pname 032 param MM ERROR mmlGdcConfigGetAttribute MML ATTR pname MM 032 pParam 13 9 1 Detailed Description Controls global graphics driver and hardware configurat
118. D MODE RLAD UNIFORM MODE RLA MODE RL NUM Public Member Functions unsigned cbpc width unsigned i const unsigned cnt width const unsigned cwrap unsigned i const unsigned max code unsigned i const unsigned header size const unsigned buffer size const unsigned bpp const unsigned cbpp max const unsigned image size const double compression rate const bool Encode Frame amp f BitStream amp bs bool Decode BitStream amp bs Frame amp f 236 S6E2DH 709 00022 1 0 September 11 2015 Lum APPLICATION NOTE F CYPRESS PERFORM Data Fields enum RLAD Mode mode unsigned width unsigned height unsigned bpc NUM C unsigned cbpc max NUM C bool decode BufferTooSmall bool decode BufferTooLarge Protected Member Functions bool Encode Lossy Frame amp f BitStream amp bs bool Encode Lossless Frame amp f BitStream amp bs void set pbpc unsigned pbpc unsigned cbpc unsigned amp credit cnt unsigned pent Static Protected Member Functions static unsigned SpatialDither unsigned data in unsigned size in unsigned size out unsigned x unsigned y bool exact static unsigned MSBitReplication unsigned data in unsigned size in unsigned size out static int ClampToBpc unsigned int data in unsigned bpc Static unsigned Log2 unsigned t 12 22 1 Detailed Description This class contains sample code
119. DE 0x21003001 define MML ERR IRIS MATH INVALID MATRIX ERRCODE 0x21003002 define ERR RES UNKNOWN MM ERRCODE 0x2100A000 define MML ERR RES EXCEEDED MAXIMUM USAGE ERRCODE 0x2100A001 define ERR RES USAGE COUNT ZERO MM ERRCODE 0x2100A002 define MML ERR RES MAN ALREADY INITIALIZED ERRCODE 0x21004A003 define MML ERR RES MAN INITIALIZED MM ERRCODE 0x2100A004 define ERR SYNC INVALID PARAMETER ERRCODE 0x11005001 define ERR SYNC ACCESS FAILED ERRCODE 0x11005002 define ERR SYNC TIMEOUT MM ERRCODE 0x11005003 September 11 2015 S6E2DH_AN709 00022 1v0 E 243 ES CYPRESS APPLICATION NOTE define MMD_ERR_GDC_CARD_DEV_BUSY MM_ERRCODE 0x11007001 define MMD_ERR_GDC_CARD_TIMEOUT_EXPIRED ERRCODE 0x11007002 define MMD_ERR_GDC_CARD_ACCESS_ FAILED MM ERRCODE 0x11007003 define ERR GDC CARD TIME INTERVAL MM_ERRCODE 0x11007004 define MMD ERR GDC CARD DEV NOTSUPPORTED MM ERRCODE 0x11007005 13 4 1 Detailed Description Error Codes for the Basic Graphics modules 13 5 mm gdc module id h File Reference Basic Graphics module ids common 13 5 1 include mm defines h Macros Module Id s The error reporting level can be set per module id Note kernel modules are covered by the corresponding user module
120. DISP FEATURE MULTI LAYER 12 15 2 6 MM U32 topLeftX Top left X coordinate of the window on the display 12 15 27 U32 topLeftY Top left Y coordinate of the window on the display 12 15 2 8 MM 032 width Width of the window The documentation for this struct was generated from the following file display h 232 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE CYPRESS 12 16MML GDC PE CONTEXT CONTAINER Struct Reference include lt pixeng h Data Fields MM 032 reserved 84 12 16 1 Detailed Description The pixel engine context container 12 16 2 Field Documentation 12 16 2 1 MM U32 reserved 84 Reserved memory needed for any context container The documentation for this struct was generated from the following file mml gdc pixeng h 12 17 MML SURFACE CONTAINER Struct Reference include mml gdc surfman h Data Fields MM 032 reserved 15 12 17 1 Detailed Description The surface object container 12 17 2 Field Documentation 12 17 2 1 MM U32 reserved 15 Reserved memory needed for any surface container The documentation for this struct was generated from the following file gdc surfman h 12 18MML GDC SYNC CONTAINER Struct Reference include lt sync h Data Fields MM 032 reserved 3 12 18 1 Detailed Description Data type to refer to a sync object September 11 2015 56 20
121. Define some menu types and states Enumerator MENU FLAG POPUP menu entry MENU FLAG CHECKBOX Menu item with check box MENU FLAG RADIO item with radio button MENU FLAG ISCHECKED Menu item is checked 12 5 2 2 enum MENU KEYS Enumerator MENU KEY ENTER Enter select key MENU KEY UP Up key MENU KEY DOWN Down key MENU KEY LEFT Left key MENU KEY RIGHT Right key 12 5 3 Member Function Documentation 12 5 3 1 virtual MM ERROR Close inline virtual Close the menu 12 5 3 2 MM ERRORDraw inline Redraw the menu if required Return values MML OK on success Otherwise the related error code or MML ERR September 11 2015 S6E2DH_AN709 00022 1v0 E 213 APPLICATION NOTE Ls 12 5 3 3 CMenultem Find U32 id CMenultem pBase inline Search a menu item in the menu Parameters in id ID of the menu item to find pBase Base menu item to start the search Return the menu item on success Otherwise NULL in 12 5 3 4 CMenultem FindNext CMenultem pBase CMenultem pSearch CMenultem MENU ITEM FIND find inline Search a menu item in the menu Parameters pBase Base menu item to start the search pSearch Reverence menu item for the search Relation of the new item related to pSearch inline find Return the menu item on success Otherwise NULL 12 5 3 5 CMenultem FindSelected CMenultem pBase Find the current selected menu item Parameters inl
122. Detailed Description kde een deine 141 11 7 2 Typedef 141 11 7 3 Function 142 11 8 2D Core Interrupt Controller 143 11 8 2 Macro Definition Documentation 144 11 8 3 Function 144 11 9 Error Reporting AP 145 11 9 1 Detailed Description eei ER retia 146 11 9 2 Macro Definition Documentation 146 11 9 3 Typedef 148 11 9 4 Enumeration Type Documentation 148 11 9 5 Function 148 1110 roue 150 11 10 1 Detailed Description 153 11 10 2 Macro Definition Documentation 153 11 11 Basic Graphics Type Definitions 167 11 12 Version Numbers dee Se 167 11 12 1 Detailed Description iii nhe eren 167 11 12 2 Macro Definition Documentation 44 04000 168 11 13 Type Definition 168 11 19 1 Detailed Description ee UR 168 11 13 2 Typedef 168 11 14 Macro Definition
123. EADY INITIALIZED MM ERRCODE 0x2100A003 The Resource Manager is already initialized 11 10 2 101 define MML ERR RES MAN INITIALIZED MM ERRCODE 0x2100A004 The Resource Manager had not been initialized 11 10 2 102 define MML ERR RES UNKNOWN MM ERRCODE 0x2100A000 unknown resource 11 10 2 103 define MML ERR RES USAGE COUNT ZERO ERRCODE 0x2100A002 resource cannot be released as usage count is already zero 11 11 Basic Graphics Type Definitions Definition of types used in Basic Graphics Definition of types used in Basic Graphics include mml_gdc_types h 11 12 Version Numbers The Version numbers of this driver Macros define MM GDC MAJOR VERSION 10 define MM MINOR VERSION 00 11 12 1 Detailed Description The Version numbers of this driver include mm version h 167 September 11 2015 56 20 AN709 00022 1v0 E SF SS CYPRESS APPLICATION NOTE PERFORM 11 12 2 Macro Definition Documentation 11 12 2 1 define MM_GDC_MAJOR_VERSION 1U Major version of the driver 11 12 2 2 define MM_GDC_MINOR_VERSION 00 Minor version of the driver 11 13 Type Definition Typedefs typedef unsigned char MM_U08 typedef signed char S08 typedef unsigned short MM_U16 typedef signed short MM 516 typedef unsigned int MM 032 typedef signed int 32 typedef unsigned long long MM U64 typedef signed long long S64 typedef c
124. END MULTIPLY 0 20050 PE BM VG BLEND SCREEN 0x2006U BM VG BLEND DARKEN 0x2007U MML PE BM VG BLEND LIGHTEN 0x2008U PE BM VG BLEND ADDITIVE 0x2009U enum MML GDC PE CMATRIX FORMAT MML GDC PE CMATRIX FORMAT 4X3 0 enum MML PE GEO MATRIX FORMAT MML PE GEO MATRIX FORMAT 3X2 MML GDC PE GEO MATRIX FORMAT 3X3 enum MML CLUT FORMAT MML GDC PE CLUT FORMAT 33 33 MML GDC PE CLUT FORMAT 256 256 enum MML GDC PE FILTER CHANNEL MML PE FILTER CHANNEL 1U 3 PE FILTER CHANNEL 1U 2 MML PE FILTER CHANNEL B 10 lt lt 1 252 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE MML PE FILTER CHANNEL 10 MML PE FILTER CHANNEL RGB MML PE FILTER CHANNEL R MML PE FILTER CHANNEL MML GDC PE FILTER CHANNEL B MML PE FILTER CHANNEL MML PE FILTER CHANNEL R MML PE FILTER CHANNEL MML GDC PE FILTER CHANNEL B MML GDC PE FILTER CHANNEL A enum MML FILTER COLOR FORMAT MML GDC PE FILTER COLOR FORMAT R8G8B8 MML PE FILTER COLOR FORMAT R5G6B5A8 MML PE FILTER COLOR FORMAT R8G8B8A8 MML PE FILTER COLOR FORMAT R10G10B10A8 Funct
125. FACE surface void 032 baseAddr 032 clutAddr MM ERROR utSurfLoadBitmap MML_GDC_SURFACE surface const void plmage MM_BOOL bCopyToVRAM MM 532 utSurfWidth MML SURFACE surf MM S32 utSurfHeight MML GDC SURFACE surf MM ERROR utSurfCreateBuffer MML GDC SURFACE surf MM U32 w MM U32 h MML GDC SURF FORMAT eFormat void utSurfDeleteBuffer MML SURFACE surf MM ERROR utSurfGetPixel MML SURFACE src MM 032 x U32 1 08 r MM 008 g 08 b 008 MM ERROR utSurfSetPixel MML SURFACE src 032 x 032 MM 008 MM 008 g 008 b MM 008 11 19 1 Detailed Description This utility block realizes some helper functions related to the surface manager API of the 2D core graphics driver The following code allocates an 16bpp image buffer in the VRAM initializes a surface object Afterwards it fills the surface with generated pixel data void CreatePatternn mMML SURFACE surf MM 032 width 032 height 032 x 032 032 red 032 MM U32 blue MM 032 alpha mmlGdcSmhResetSurfaceObject surf utSurfCreateBuffer surf width height MML FORMAT for x 0 x width x for y 0 lt height y red 255 255 x width green 255 x width blue 255 width alpha 255 255 width utSurfSetPixel surf x y
126. For each cover bitmap we need a separate matrix Start with the pre matrix Load identity matrix utMat4x4Loadldentity m m44Pre September 11 2015 S6E2DH_AN709 00022 1v0 E 65 Fi APPLICATION NOTE PERFORM Scale the dimension 0 2 to screen dimension utMat4x4Scale m m44Pre GetWidth 2 0f GetHeight 2 0f 1 Move the window from 0 0 to 1 1 coordinates utMat4x4Translate m_m44Pre 1 08 1 0f 0 An OpenGL like perspective calculation utMat4x4Perspective m_m44Pre s fLensAngle float GetWidth GetHeight float O 1 100 0 get a distance to the object utMat4x4Translate m m44Pre 0 0 s fViewDist Now the cover movement Turn the view center point a little bit down utMat4x4RotX m44 5 fViewAngle Move a little bit over the scene utMat4x4 Translate m44 0 5 fViewPoint 0 Push the image on a circle utMat4x4Translate m44 s fCircleRadius cos angle 0 s fCircleRadius sin angle to get the 2 D lock we turn the cover here to correct the s fViewAngle utMat4x4RotX m44 s fViewAngle Scale it utMat4x4Scale m44 5 fCoverScaling s fCoverScaling 1 0f Now the post matrix Translate it to 1 1 The center point is now 0 0 utMat4x4 Translate m m44Post 1 0f 1 0f 0 Scale the cover bitmap of a size 0 2 utMat4x4Scale m m44Post float 2 COVER SIZE float 2 COVER SIZE 1 0f As
127. GetAttribute MML DISPLAY display DISP ATTR pname 032 pParam Gets the value for attribute pname display specify for which display controller the attribute should be retrieved Parameters display An MML DISPLAY returned from a previous call to mmlGdcDispOpenbDisplay pname Parameter name See MML DISP for valid values pParam Address where the read value of the attribute is stored Return values MML OK On success MML ERR DISP INVALID If one of the parameters is invalid 11 5 5 6 MM ERROR mmlGdcDispOpenDisplay DISP PROPERTIES mode MML DISPLAY xdisplay Used to open a display By default this function is blocked until previous operations of device display are completely executed Use mmlGdcConfigSetAttribute set MML GDC CONFIG ATTR DISPLAY NOBLOCK to 1 to make it non blocking Note This function must only be called once for each display output controller Parameters MML GDC DISP PROPERTIES structure describing the desired resolution and display timings mode display On success will contain a valid MML GDC DISPLAY Return values MML OK On success MML ERR DISP INVALID If an invalid argument was passed MML ERR DISP DISPLAY ALREADY OPEN If the display is already opened If the writing to the device display is denied because the previous close call is not completely execut
128. ID CLUTDATA ERRCODE 0x21001012 define MML ERR DISP INVALID DIMENSION ERRCODE 0x21001016 define ERR DISP DEV BUSY MM ERRCODE 0x21001020 Error codes for Error Reporting API define MML ERR ALREADY INITIALIZED MM ERRCODE 0x2100F000 define MML ERR ERP NOT INITIALIZED MM ERRCODE 0x2100F001 define MML ERR INVALID PARAMETER MM ERRCODE 0x2100F002 Error codes for Pixel Engine API define MML ERR PE OUT OF SPACE ERRCODE 0x2100D001 define ERR PE INVALID CONTEXT MM ERRCODE 0x2100D002 define ERR PE INVALID TARGET MM ERRCODE 0x2100D003 define MML ERR PE INVALID SURFACE OBJECT ERRCODE 0x2100D004 define ERR PE INVALID ADDRESS MM ERRCODE 0x2100D005 define ERR PE INVALID MATRIX MM ERRCODE 0x2100D006 define MML ERR PE INVALID DIMENSION MM ERRCODE 0x2100D007 define ERR PE INVALID STRIDE MM ERRCODE 0x2100D008 define MML ERR PE INVALID BITS PER ERRCODE 0x2100D009 define MML ERR PE INVALID COMPRESSION ERRCODE 0x2100D010 define MML ERR PE INVALID REQUEST ERRCODE 0x2100D011 define MML ERR PE INVALID MODE ERRCODE 0x2100D012 define MML ERR PE INVALID SURFACE PARAM ERRCODE 0x2100D013 define MML ERR PE INVA
129. ION NOTE PERFORM 6 8 6 ip Show different versions to restore and draw the needle layer Figure 6 8 Previous layer frame As mentioned we want to discuss different possibilities The scenario should be always the same a previous frame of the sNeedle surface was drawn and the new needle position must be drawn instead Version 1 Version 2 Version 3 Version 4 6 8 6 1 Version 1 A typical draw loop clears the buffer and draws the new objects on it We perform 3 rendering steps fill instruction clears the whole buffer Next the rotated needle is drawn Finally the hub is drawn Set target to sNeedle surface and enable blending with MML PE DST UTIL SUCCESS ret mmlGdcPeBindSurface amp ctx MML PE STORE MML DST amp sNeedle while TRUE Clear the last frame UTIL_SUCCESS ret mmlGdcPeColor amp ctx 0 0 0 0 UTIL_SUCCESS ret mmlGdcPeFill amp ctx 0 0 BGR_WIDTH BGR HEIGHT Draw the rotated needle UTIL SUCCESS ret mmlGdcPeBindSurface amp ctx MML PE SRC amp sSrc BMP NEEDLE UTIL SUCCESS ret mmlGdcPeSetMatrix amp ctx MML MML PE GEO MATRIX FORMAT 3X2 mat BMP_NEEDLE UTIL SUCCESS ret mmlGdcPeBlt amp ctx 0 0 56 S6E2DH_AN709 00022 1v0 E September 11 2015 d APPLICATION NOTE 17 CYPRESS PERFORM Draw the hub UTIL_SUCCESS ret mmlGdcPeBindSurface
130. L PE CONTEXT 008 red MM 008 green UO8 blue 0108 alpha PE API MM ERROR mmlGdcPeSurfAttribute MML PE CONTEXT pectx MM 032 target PE SURF pname 032 param PE API MM ERROR mmlGdcPeSurfColor MML PE CONTEXT pectx 032 target MM UO08 red 008 green MM 1 08 blue 1 08 alpha PE API MM ERROR mmlGdcPeBlendFunc MML PE CONTEXT pectx PE BF func red src MML PE BF func red dst MML PE BF func green src MML PE BF func green dst MML PE BF func blue src PE BF func blue dst MML PE BF func alpha src MML func alpha dst API MM ERROR mmlGdcPeBlendMode MML PE CONTEXT pectx PE BM mode MML PE BM mode green BM mode blue PE BM mode alpha PE API MM ERROR mmlGdcPeRopOperation MML PE CONTEXT pectx MM 008 op red UO08 op green MM 08 op blue 08 op alpha API MM ERROR mmlGdcPeSetMatrix MML PE CONTEXT pectx MM 032 target PE GEO MATRIX FORMAT format const MM FLOAT fMatrix PE API MM ERROR mmlGdcPeCLUTData MML PE CONTEXT pectx PE CLUT FORMAT format const MM 516 pRed const S16 pGreen const MM 516 pBlue PE API MM ERROR mm
131. L GDC DISP SUB LAYER 8 or MML GDC DISP SUB LAYER DEFAULT if feature MML GDC DISP FEATURE MULTI LAYER is not used for the window This attribute can only be read MML GDC DISP WIN ATTR TOPLEFT X Top left X coordinate of the window on the display Note To set a negative value for X use the following formula value Oxffffffff MM_U32 X 1 If the value is returned by mmlGdcDispWinGetAttribute the most significant bit must be used to check for negative values X value amp 0x80000000 0 int value int Oxffffffff value 1 MML_GDC_DISP_WIN_ATTR_TOPLEFT_Y Top left Y coordinate of the window on the display Note value can be negative Description see MML GDC DISP WIN ATTR TOPLEFT X MML_GDC_DISP_WIN_ATTR_WIDTH Width of window on the display Note area beyond the range of the underlying framebuffer or surface will be filled as black MML_GDC_DISP_WIN_ATTR_HEIGHT Height of window on the display Note area beyond the range of the underlying framebuffer or surface will be filled as black MML_GDC_DISP_WIN_ATTR_SCREEN Select the screen s where the layer is displayed Alpha layers do not have this attribute See MML_GDC_DISP_OUTPUT_SCREEN MML_GDC_DISP_OUTPUT_SCREEN_PRIMARY Show layer on screen 0 MML DISP OUTPUT SCREEN SECONDARY Show layer on screen 1 MML DISP OUTPUT SCREEN BOTH Show layer on both screens MML GDC DISP WIN A
132. LEND_NONE 0 define MML_GDC_DISP_BLEND_TRANSPARENCY 1U lt lt 0 define MML_GDC_DISP_BLEND_GLOBAL_ALPHA 1U lt lt 1 define MML_GDC_DISP_BLEND_SOURCE_ALPHA 1U lt lt 2 define MML_GDC_DISP_BLEND_SOURCE_MULTIPLY_ALPHA 1U lt lt 4 Polarity control define MML_GDC_DISP_HSYNC_LOW 0 define MML_GDC_DISP_HSYNC_HIGH 1U lt lt 0 define MML_GDC_DISP_VSYNC_LOW 0 define MML_GDC_DISP_VSYNC_HIGH 1U lt lt 1 define MML_GDC_DISP_DE_LOW 0 define MML_GDC_DISP_DE_HIGH 1U lt lt 2 define MML_GDC_DISP_RGB_LOW 0 define MML_GDC_DISP_RGB_HIGH 1U lt lt 3 Default initializer define MML_GDC_DISP_PROPERTIES_INITIALIZER define MML GDC DISP WINDOW PROPERTIES INITIALIZER Display Functions MM ERROR mmlGdcDispOpenDisplay MML DISP PROPERTIES mode DISPLAY display MM ERROR mmlGdcDispCloseDisplay MML DISPLAY display MM ERROR mmlGdcDispDitherCtrl MML DISPLAY display DISP DITHER ENABLE enable DISP DITHER MODE mode DISP DITHER RANGE range MML DISP DITHER FORMAT format MM ERROR mmlGdcDispCLUTData MML DISPLAY display DISP CLUT FORMAT format const MM 516 pRed const S16 pGreen const MM 516 pBlue MM ERROR mmlGdcDispSyncVSync MML DISPLAY display MML SYNC sync MM 532 vsyncCnt MM ERROR mmlGdcDispSetAttribute MML DISPLA
133. LID NO ACTIVE ERRCODE 0x2100D014 define MML ERR PE INVALID ATTRIBUTE MM ERRCODE 0x2100D015 define MML ERR PE INVALID PARAMETER ERRCODE 0x2100D016 define MML ERR PE INVALID OPERATION MM_ERRCODE 0x2100D017 define MML ERR PE INVALID MASK ERRCODE 0x2100D018 define ERR PE INVALID SCALING MM ERRCODE 0x2100D019 September 11 2015 S6E2DH_AN709 00022 1v0 E 151 V CYPRESS APPLICATION NOTE PERFORM define MML_ERR_GDC_PE_INVALID_STORE_COMRESSION MM_ERRCODE 0x2100D020 define MML ERR GDC PE INVALID STORE CLUT MM_ERRCODE 0x2100D021 define ERR PE INVALID FLOAT MM ERRCODE 0x2100D023 define MML ERR PE INVALID CLUT ERRCODE 0x2100D024 define MML ERR PE INVALID ERRCODE 0x2100D028 define MML ERR PE INVALID COMPRESSION OPERATION MM ERRCODE 0x2100D029 Error codes for Surface Manager API define MML ERR SURF OUT OF SPACE MM ERRCODE 0x21000001 define MML ERR SURF OUT OF VRAM MM ERRCODE 0x21000002 define ERR SURF INVALID SURFACE MM ERRCODE 0x21000003 define ERR SURF INVALID FORMAT ERRCODE 0x21000004 define MML_ERR_GDC_SURF_INVALID_FOR_BUFFER_OWNED MM_ERRCODE 0x21000005 define MML_ERR_GDC_SURF_INVALID_ATTRIBUTE MM ERRCODE 0x21000006 define MML_ERR_GDC_SURF_ERROR_ADDRESS_TRANSLATION MM_E
134. M BOOL HasBuffer Note Some member functions like CreateBuffer allocate VRAM other function like Copy only point to a memory buffer Return values MM TRUE 12 8 3 8 operator MML SURFACE inline Get the foreground surfaces Return values return 12 8 3 9 void Swap inline Toggle the foreground and background buffer protected Return values MML OK 12 8 4 Field Documentation MM TRUE if the buffer was allocated in this class In this case the destructor must free the memory 12 8 4 1 MM BOOL m bHasBuffer 12 8 4 2 MML SURFACE CONTAINER buffer NUM BUFFERS S protected MML GDC SURFACE CONTAINER object s used to describe the buffers s S6E2DH_AN709 00022 1v0 E September 11 2015 220 d APPLICATION NOTE F CYPRESS 12 8 4 3 032 m bufferldx PERFORM protected The index of the current render buffer The documentation for this class was generated from the following file Ut class surface h 12 9 CSurfaceWindow NUM BUFFERS Class Template Reference 12 9 1 include ut class window h Public Member Functions MM ERROR CreateBuffer const MML SURF FORMAT format MML SURF FORMAT R8G8B8A8 032 MaxSize 0 MM ERROR CreateBuffer 032 bit red MM 032 bit green MM 032 bit blue 032 bit alpha MM ERROR CreateGrayBuffer 032 bit color MM 032 bit alpha virtual MM ERROR Swap virtual MM ERROR Clo
135. M ERP CH STDOUT 00 MM CH BUFFER 13 3 1 Detailed Description Error Reporting 134 mm errors h File Reference Error Codes for the Basic Graphics modules include mm defines h Macros Error codes for Config API define MML ERR CONFIG INVALID PARAMETER MM ERRCODE 0x21008001 define ERR CONFIG INTERNAL ERROR MM ERRCODE 0x21008002 define ERR CONFIG INVALID ADDRESS ERRCODE 0x21008003 Error codes for Display API define MML ERR DISP DEVICE NOT FOUND ERRCODE 0x21001001 define MML ERR DISP DISPLAY ALREADY OPEN ERRCODE 0x21001002 define MML ERR DISP INVALID MM ERRCODE 0x21001003 define MML ERR DISP UNSUPPORTED MODE ERRCODE 0x21001004 define ERR DISP DEVICE INIT FAILED ERRCODE 0x21001005 define ERR DISP DEVICE CLOSE FAILED ERRCODE 0x21001006 define MML ERR DISP OUT OF SYSTEM MEMORY ERRCODE 0x21001007 define MML ERR DISP LAYER ALREADY USED ERRCODE 0x21001008 define MML ERR DISP WRONG PIXEL FORMAT ERRCODE 0x21001009 define ERR DISP WRONG STRIDE MM ERRCODE 0x21001011 define MML ERR DISP WRONG WINDOW ERRCODE 0x21001012 define MML ERR DISP WRONG INDEX WINDOW MM ERRCODE 0x21001013 define MML ERR DISP FAILED MM ERRCODE 0x21001014 define MML ERR
136. M ERRCODE 0x21005002 Out of memory 11 10 2 90 define MML ERR SYNC TIMEOUT MM ERRCODE 0x21005003 Timeout expired 11 10 2 91 define MML ERR GDC SYS DEVICE ALREADY INITIALIZED MM ERRCODE 0x21009003 Hardware device is already initialized 165 September 11 2015 56 20 AN709 00022 1v0 E APPLICATION NOTE aru Pres 11 10 2 92 define MML ERR SYS DEVICE CLOSE FAILED MM ERRCODE 0x21009002 Hardware device failed to close 11 10 2 93 4define MML ERR SYS DEVICE INIT FAILED MM ERRCODE 0x21009001 Hardware device failed initialization 11 10 2 94 MML ERR GDC SYS DEVICE INVALID PARAMETER MM ERRCODE 0x21009005 Invalid parameter 11 10 2 95 define MML ERR GDC SYS DEVICE NOT YET INITIALIZED MM ERRCODE 0x21009004 Hardware device is not yet initialized 11 10 2 96 define MML ERR SYS DEVICE WRONG ID MM ERRCODE 0x21009006 The software driver is not valid for the hardware 11 10 2 97 define MML ERR WB DEVICE BUSY MM ERRCODE 0x21004001 Writeback unit busy 11 10 2 98 define MML ERR WB INVALID PARAMETER MM ERRCODE 0x21004002 Invalid parameter was specified S6E2DH 709 00022 1 0 September 11 2015 166 PERFORM APPLICATION NOTE 11 10 2 99 define MML ERR RES EXCEEDED MAXIMUM USAGE MM ERRCODE 0x2100A001 resource cannot be acquired as it has already maximum usage count 11 10 2 100 define MML ERR RES MAN ALR
137. ML DISP WINDOW inline Return values 12 10 3 10 virtual MM ERROR SetSurface MML SURFACE surf inline virtual Set a new surface to the window and apply changes Parameters The new surface to be shown September 11 2015 S6E2DH_AN709 00022 1v0 E 225 P CYPRESS APPLICATION NOTE PERFORM Return values MML OK on success Otherwise the related error code or MML ERR 12 10 3 11 virtual BOOL SyncReady inline virtual Check the sync object of this window TRUE window is ready FALSE window is still bussy 12 10 4 Field Documentation 12 10 4 1 MML GDC DISPLAY m display The display object used by this class instance 12 10 4 2 MML DISP WINDOW m win The window object used by this class instance 12 10 4 3 MML GDC DISP WINDOW PROPERTIES m windowProp The MML GDC DISP WINDOW PROPERTIES structure used to create this window The documentation for this class was generated from the following file class window h 12 11 RLAD Frame Class Reference include ut class Data Structures struct Pixel Public Member Functions Frame unsigned width unsigned height Pixel amp Read void ResetRead void Write const Pixel amp pix void ResetWrite Pixel GetPixel unsigned x unsigned y const 12 11 1 Detailed Description The class Frame is used to store the uncompressed image 12 11 2 Constructor
138. ML SYSINIT INFO pDriverlnitinfo Used to initialize the driver at startup Applications must initialize the driver before they can call other driver functions Note The 2D core hardware must be in default state i e no registers may be altered between HW reset and the call of mmlGdcSysinitializeDriver The only except exception are the LockUnlock registers which can be used by a safety driver to protect specific streams against non privileged access The registers related to these streams may also be altered by the safety driver before mmliGacSysinitializeDriver is called Parameters pDriverlnitInfo Can be NULL or a pointer to MML SYSINIT INFO driver initialization structure Return values MML OK Successfully initialized driver MML ERR SYS DEVICE INVALID PARAMETER GfxPII parameter out of range MML ERR SYS DEVICE ALREADY INITIALIZED already initialized MML ERR SYS DEVICE INIT FAILED Initialization of the driver failed 11 2 3 2 MM ERROR mmlGdcSysSetlnstructionBuffer void address MM U32 size Assign internal VRAM for command queue Note The command queue is required to buffer the render instructions to allow a non blocking API handling The required instruction buffer size depends on the amount and complexity of the render instructions and which synchronization instructions are used A recommended size is 8 kByte To get information about the
139. MML PE GEO MATRIX FORMAT 3X2 mat BMP Needle and store define the bounding box UTIL SUCCESS ret mmlGdcPeSelectArea amp ctx MML PE DST MML PE STORE while TRUE UTIL_SUCCESS ret mmlGdcPeSetMatrix amp ctx MML_GDC_PE_DST PE GEO MATRIX FORMAT 3X2 September 11 2015 56 20 AN709 00022 1v0 E 59 APPLICATION NOTE CYPRESS Blend the hub over rotated needle UTIL SUCCESS ret mmlGdcPeBIt amp ctx MM FLOAT BGR WIDTH O 5f MM FLOAT ROT CENTER Determine draw box for the current frame UTIL SUCCESS ret mrmlGdcPeGetDrawBox amp ctx amp x amp y amp w amp h MM TRUE and assign it as active area to the target for the next frame This box includes the current needle mmlGacPeActiveArea amp ctx MML PE STORE h and must be repainted in the next frame UTIL SUCCESSY ret Again we have only one rendering step but this time the rendering box red is much smaller It is the bounding box from the previously rendered needle green and the new needle box blue The mmlGdcPeGetDrawBox returns the drawing box of the last rendering step and this box is set as the ActiveArea for the store surface Please note that mmlGdcPeGetDrawBox does not include the drawing box of the store surface otherwise the box would be increased with each new frame Figure 6 12 Version 4
140. MML SURF FORMAT R5G6B5 16 bits per pixel 5 bits for red 6 bits for green 5 bits for blue MML SURF FORMAT 8 bit per pixel for red green and blue which means 256 gray scale values MML SURF FORMAT 1 bit per pixel for red green and blue which means black and white 6 5 3 2 Compression format and parameter The 2D Graphics Core can use different kinds of pixel buffer compression RLC RLA RLAD or RLAD UNIFORM The surface holds information about compression format and related properties 6 5 3 3 Color look up table parameters A color lookup table can be assigned to a surface by using the function mmlGdcSmaAssignClut Lookup tables can be used for indexed images the value for red in the image defines an index of the color lookup table The color of the table entry defines the pixel color at this point September 11 2015 S6E2DH_AN709 00022 1v0 E 37 era P CYPRESS APPLICATION NOTE PERFORM 6 5 4 6 5 5 Initialization Driver initialization and 1kB for the command sequencer FIFO driver initialization UTIL SUCCESS ret mmlGdcSyslnitializeDriver 0 get virtual addresses not required for devices without MMU MM PHYS TO VIRT MM ADDhR instructionBufferAddr amp vlInstrBufferAddr recalculate addresses using the vlmgAddr as start MM PHYS TO VIRT MM ADDR imgAdar 8 patternAddr MM U32 vlmgAddr imgSize tex
141. MML GDC SYSINIT INFO Macros September 11 2015 S6E2DH_AN709 00022 1v0 E 79 Z CYPRESS APPLICATION NOTE SF PERFORM define GFX_PLL_MIN 200000000 define GFX PLL MAX 4150000000 Functions MM ERROR mmlGacSyslnitializeDriver SYSINIT INFO pDriverInitInfo MM ERROR mmlGdcSysUninitializeDriver void MM ERROR mmlGdcSysSetlnstructionBuffer void address U32 size Default initializer define SYSINIT INITIALIZER Resource names MM RES DISPO 10 lt lt 00 stdefine MM RES LAYERO 10 lt lt 10 stdefine MM RES LAYERt 10 lt lt 20 stdefine RES FETCH DECODEO 10 lt lt 30 define RES FETCH LAYERO 10 lt lt 40 11 2 1 Detailed Description The Driver Initialization exposes functions to initialize and uninitialize the driver include sysinit h 11 2 2 Macro Definition Documentation 11 2 2 1 define GFX PLL MAX 4150000000 maximum GFX PLL 415 MHz 11 2 2 2 define GFX PLL MIN 20000000U Allowed PLL frequency range minimum GFX PLL 20 MHz 11 2 2 3 define MML SYSINIT INITIALIZER Value X 00 no safety driver 320000000U GFXPLL320MHz 80 S6E2DH_AN709 00022 1v0 E September 11 2015 y a APPLICATION NOTE SJ CYPRESS PERFORM 11 2 3 Function Documentation 11 2 3 1 MM ERROR mmliGdcSyslnitializeDriverre m
142. Mat4x4 src Mat3x3 dst MML 2D MATRIX void utMat4x4ToMat3x2 Mat4x4 src Mat3x2 dst 2 2 oL Matrix functions for color operations MML 2D MATRIX void utMat4x3Copy Mat4x3 dst const Mat4x3 src 2D MATRIX void utMat4x3Multiply Mat4x3 dst const Mat4x3 src1 const Mat4x3 Src2 2D MATRIX void utMat4x3Loadldentity Mat4x3 m 2D MATRIX void utMat5x4Loadldentity Mat5x4 2D MATRIX void utMat4x3CalcColMatrix Mat4x3 dst MM FLOAT fContrast MM FLOAT fBrightness MM FLOAT fSaturation MM FLOAT fHue 13 16 1 Detailed Description Provide some matrix utility functions 258 S6E2DH 709 00022 1 0 September 11 2015 CE APPLICATION NOTE F CYPRESS gt PERFORM 13 17 sm util h File Reference This is just a helper implementation for development and will be removed in the final version include lt stdio h gt include mml_gdc_surfman h Macros define UTIL_SUCCESS rc execute define UTIL ERR OUT OF MEMORY MM ERRCODE 0x31000001 Functions MM ERROR utSurfReadBitmap MML SURFACE surface void plmage 032 baseAddr MM 032 clutAddr MM ERROR utSurfLoadBitmap MML SURFACE surface const void MM BOOL bCopyToRAM MM 532 utSurfWidth MML SURFACE surf MM S32 utSurfHeight MML SURFACE surf
143. N NOTE 3 Getting Started 3 1 Installation Unpack the archive to a location of your choice This package contains all headers libraries and documentation needed to develop graphics applications for the S6E2D Graphics Hardware The top level directory contains the following directory structure 00 s6e2dh demeter sw framework Cypress FM4 application template startup code and peripheral drivers 01 bin Graphics Core libraries 02 driver header files 04 sample Sample application source code 05 util Utility library source code used by some of the samples 08 tool Tools used by some of the samples 11 doc User Documentation Building examples For each sample application there is a subdirectory IAR ARM or GNU depending on the supported platform containing a project file for the respective tool chain e g IAR Embedded Workbench 7 10 or Keil uVision 3 2 to run an application If the toolchain provides flash support for both internal flash and external hyper flash the tutorial applications can be started from the debugger Otherwise an appropriate flash programmer is required to download the code and image data to the S6E2D Starter Kit 3 3 Writing an application The following steps list the typical flow of an application using the 2D Graphics hardware Initialize the graphics driver see Driver Initialization Open the display see Display Create
144. OCK to 1 to make it non blocking Note The display closed by the last process switches the display controller off Parameters in display An MML_GDC_DISPLAY returned from a previous call to mmIGdcDispOpenDisplay 108 S6E2DH_AN709 00022 1v0 E September 11 2015 APPLICATION NOTE Return values MML OK On success MML ERR DISP INVALID If an invalid argument was passed If the writing to the device display is denied because the previous commit open MML ERR DISP BUSY create or destroy call is not completely executed e g shadow load request is pending Call again later 11 5 5 2 MM ERROR mmliGdcDispCLUTData MML DISPLAY display MML DISP CLUT FORMAT format const MM S16 pRed const MM S16 pGreen const MM S16 pBlue Used to configure the color lookup table CLUT on the display controller e g for gamma correction The format MML GDC DISP CLUT FORMAT 33 defines 33 sample points representing the resulting color channel intensity Intermediate values will be interpolated by the HW The 1st sample point corresponds to input color code 0 2nd one to 32 last one to 1024 of the 10 bit 2D core internal processing pipeline Although input 1024 is not possible the last sample point is needed for interpolation of codes 993 to 1023 An index entry of 0 stands for the minimum 1023 for the maximum intensity Index values outside this
145. ODE 0x21000007 Address translation failed 11 10 2 79 MML ERR GDC SURF INVALID ADDRESS ALIGNMENT MM ERRCODE 0x21000009 The base address alignment is not suitable for this operation define MML ERR SURF INVALID ATTRIBUTE 11 10 2 80 MM ERRCODE 0x21000006 The given attribute is not supported 11 10 2 81 MML ERR GDC SURF INVALID FOR BUFFER OWNED MM ERRCODE 0x21000005 The operation is not allowed for buffer owned surface objects define MML ERR SURF INVALID FORMAT 11 10 2 82 MM ERRCODE 0x21000004 The given format is not supported define MML ERR SURF INVALID PARAMETER 11 10 2 83 MM ERRCODE 0x21000008 The parameter is wrong S6E2DH 709 00022 1 0 September 11 2015 164 PERFORM APPLICATION NOTE 11 10 2 84 MML ERR SURF INVALID SURFACE MM ERRCODE 0x21000003 Surface object invalid 11 10 2 85 MML ERR SURF OUT OF SPACE MM ERRCODE 0x21000001 The system runs out of memory to perform this operation 11 10 2 86 define MML ERR SURF OUT OF VRAM MM ERRCODE 0x21000002 The video memory runs out of memory to perform this operation 11 10 2 87 MML ERR SYNC INVALID MM ERRCODE 0x21005004 Invalid sync object 11 10 2 88 MML ERR SYNC INVALID PARAMETER MM ERRCODE 0x21005001 Invalid parameter 11 10 2 89 MML ERR SYNC OUT OF MEMORY M
146. OR utMmanCreateHeap MML MMAN HEAP HANDLE hdlmem 032 size MM 032 baseAddress MM ERROR utMmanDestroyHeap MML MMAN HEAP HANDLE hdlmem MM ERROR utMmanHeapAlloc MMAN HEAP HANDLE hdlmem MM U32 size MM 032 alignment MM ADDR addr MM ERROR utMmanHeapFree MML MMAN HEAP HANDLE hdlmem void addr MM ERROR utMmanGetSize MML MMAN HEAP HANDLE hdlmem 032 size MM ERROR utMmanGetFree MML MMAN HEAP HANDLE hdlmem MM U32 size MM ERROR utMmanGetLargest MML HEAP HANDLE hdlmem 032 size 11 16 1 Detailed Description This function group is used by many tutorial samples to manage video memory VRAM allocation and freeing 11 16 2 Macro Definition Documentation 11 16 2 1 define MM SDRAM BASE 0xB0080000U SDRAM Base Address 11 16 2 2 define MM SDRAM SIZE 0x01000000U Size of external SDRAM 16 MB on Starter Kit 11 16 2 3 define MM VRAM BASE 0xD0000000U VRAM Base Address 11 16 2 4 define MM VRAM SIZE 0x00080000U Size of embedded VRAM 512 KB 11 16 2 5 MML ERR MMAN ACCESS FAILED MM ERRCODE 0x18010005 Access failed September 11 2015 S6E2DH_AN709 00022 1v0 E 173 APPLICATION NOTE PERFOR define MML ERR MMAN INVALID MEMORY 11 16 2 6 MM ERRCODE 0x18010004 Address points to an unknown memory block 11 16 2 7 define MML ERR MMAN INVALID PARAMETER MM ERRCODE 0x18010001 Wrong argument specified define MML ERR MMAN NO MEMORY 1
147. PE SURF ATTR ALPHAMULTI Enable disable multiplication of pixel alpha with constant alpha defined by mmlGdcPeSurfColor The related parameter can be MM TRUE Enable alpha multiplication MM FALSE Disable alpha multiplication default The related formula is if AlphaMultiply MM TRUE Aout Ain Aconst else Aout Ain MML_GDC_PE_SURF_ATTR_TILE_MODE Mode of tiling mode for pixels outside of source buffer The related parameter can be MML FILL ZERO MML CONSTANT MML PE PAD PAD ZERO default Note Compressed and YUV422 images can only be used with PE FILL ZERO The MML PE SUHF MODE settings will be ignored for such images MML GDC PE SURF ATTR USE CLIPPING Define whether not the surface coordinates given by mmlGdcPeActiveArea are used as clip coordinates while reading SRC DST MASK or writing STORE the surface If USE CLIPPING is disabled the ActiveArea coordinates are used for the target blit bounding box calculation only If USE CLIPPING is enabled the surface will be used like a smaller bitmap Note While using clipping for source surfaces the attribute MML PE SURF ATTR TILE MODE must set to MML GDC PE TILE FILL ZERO The bounding box defined by mmlGdcPeActiveArea will be always used as clipping box if USE CLIPPING is enabled Independent o
148. PLICATION NOTE YPRESS PERFORM Height of rectangle region in line count 0 4096 Return values MML OK On success Otherwise the related error code 11 6 5 11 MML ERROR mmlGdcPeFinish void This is used to wait on blitting and drawing completion for synchronization Return values MML OK On success Otherwise the related error code 11 6 5 12 MML PE API MM ERROR mmiGdcPeFlush void Force execution of PixEng commands in finite time Return values MML OK On success Otherwise the related error code 11 6 5 13 MML PE MM ERROR mmiGdcPeGetDrawBox MML PE CONTEXT pectx U32 x MM 032 y MM U32 w MM U32 h MM U32reset mmlGdcPeGetDrawBox is a function to get the last draw box Each function calculates a store surface draw rectangle basing on the mmlGdcPeSelectArea settings and the related surface properties active area matrix The bounding box of this rectangle and the previously stored draw box will be stored as the new draw box The draw box will be cleared if the reset parameter of mmlGdcPeGetDrawBox is different from 0 An application can use the draw box to get the minimal rectangle of a frame buffer that must be restored The function returns an error if no blit operation was executed since the last reset Note The draw box calculation based only on bounding box calculations for SRC DST and MASK Possible STORE se
149. PPLICATION NOTE YPRESS PERFOR 11 10 2 48 MML ERR IRIS SEQ FIFO UNINITIALIZED MM ERRCODE 0x2100B004 Command buffer has not been initialized 11 10 2 49 MML ERR IRIS SEQ INVALID ADDRESS MM ERRCODE 0x2100B002 Buffer address unaligned 11 10 2 50 define MML ERR GDC IRIS CMD SEQ INVALID BUFFER SIZE MM ERRCODE 0x2100B003 Buffer size not aligned define MML ERR IRIS MATH INVALID FLOAT 11 10 2 51 MM ERRCODE 0x21003001 Float value is outside of the processable range define MML ERR IRIS MATH INVALID MATRIX 11 10 2 52 MM ERRCODE 0x21003002 Matrix inversion failed 11 10 2 53 define MML ERR PE INVALID ADDRESS MM ERRCODE 0x2100D005 Wrong address For instance not aligned 11 10 2 54 4define MML ERR PE INVALID ATTRIBUTE MM ERRCODE 0x2100D015 Invalid attribute target was specified for an argument S6E2DH 709 00022 1 0 September 11 2015 160 PERFORM APPLICATION NOTE 11 10 2 55 define MML ERR PE INVALID BITS PER PIXEL MM ERRCODE 0x2100D009 Invalid value for BitsPerPixel 11 10 2 56 define MML ERR GDC PE INVALID CLUT OPERATION MM ERRCODE 0x2100D024 A lookup table cannot be used in this mode 11 10 2 57 define MML ERR PE INVALID COMPRESSION MM ERRCODE 0x2100D010 The compression of a source buffer cannot be applied 11 10 2 58 define
150. PulseStart Vertical sync pulse start position 12 12 2 12 MM U32 vertTotal Total vertical lines The documentation for this struct was generated from the following file display h 12 13MML DISP PROPERTIES Struct Reference include lt mml_gdc_display h gt Data Fields MML_GDC_DISP_CONTROLLER outputController MML_GDC_DISP_MODE displayMode 032 xResolution 032 yResolution U32refreshRate MM 032 fcvm MML DISP MODE LINE modeLine MML DISP TCON PROPERTIES pDISP TCON PROPS MM 032 countTconProps 12 13 1 Detailed Description Data type used to configure a display controller There are 3 options to configure the display September 11 2015 S6E2DH_AN709 00022 1v0 E 229 SF Z CYPRESS APPLICATION NOTE PERFORM Option 1 Specify one of the predefined resolutions in xResolution yResolution refreshRate 320x240 60 Hz 480x272 60 Hz 640x480 60 Hz 800x480 60 Hz 800x600 60 Hz 1024x768 60 Hz 1280x720 60 Hz 1600x600 60 Hz 1280x800 60 Hz 1920x768 60 Hz 1280x1024 60 Hz 1600x900 60 Hz 1920x1080 60 Hz Option 2 Specify a custom resolution in xResolution yResolution refreshRate and set the timing parameters in the modeLine structure Option 3 In addition to Option 1 or 2 provide an array of TCON register address value pairs refer to hardware manual for a description of t
151. R Display controller used for the display see MML GDC DISP CONTROLLER This attribute can only Horizontal resolution This attribute can only be read The hardware status is cleared after read operation Get value 0 no buffer error 102 If internal response time to read SDRAM is too long internal FIFO buffer fails to supply display data Get value 0 buffer error occurred MML GDC DISP ATTR BACKGROUND COLOR This attribute shows error status of the FIFO for this display controller This attribute can only be read Sets background color OXRRGGBBAMA for the screen area not included any display window Background color is default blended with display layers The default value is 0 black S6E2DH 709 00022 1 0 September 11 2015 SJ CYPRESS APPLICATION NOTE 11 5 4 2 enum MML GDC DISP CLUT FORMAT For size of entries for the CLUT Enumerator MML GDC DISP CLUT FORMAT 33 Each array for RGB contains 33 10 bit values to describe the 0 255 index range The missing values are interpolated see mmlGdcDispCLUTData for details 11 5 4 3 enum MML GDC DISP CMATRIX FORMAT Color matrix format Enumerator MML GDC DISP CMATRIX FORMAT 4X3 float 12 array with 4 column and 3 lines MML GDC DISP CMATRIX FORMAT 5X4 float 20 array with 5 column and 4 lines 11 5 4 4 enum MML GDC DISP CONTROLLER Enumeration of display controllers Enumerator MML DISP CONTROLLER 0 Display controller 0 11
152. RCE_MULTIPLY_ALPHA Enable source alpha blend_mode multiplication The color components RR GG BB are always 8 bit values also for 16 bpp and indexed color modes For instance OxOOffffff disable the Oxffff color entry in a 16 bpp buffer The default blend mode is MML_GDC_DISP_BLEND_NONE Return values MML_OK On success MML_ERR_GDC_DISP_INVALID_ARG an invalid argument was passed September 11 2015 S6E2DH_AN709 00022 1v0 E 115 APPLICATION NOTE SF PERFORM 11 5 5 15 MM ERROR mmlGdcDispWinSetMatrix DISP WINDOW win MM 032 target const MM FLOAT matrix Set transformation matrix on window color buffer and or the extern alpha buffer for scaling rotation and flipping The formula for the transformation based on this matrix is xout matrix 0 x matrix 2 y matrix 4 yout matrix 1 x matrix 3 matrix 5 If matrix NULL following data is set in transformation matrix 52 matrix 2 s 0 matrix 1 matrix 3 matrix 5 0 1 0 Note matrix settings of the window does not becomes active immediately with the related mmlGdcDispWinSetMatrix call but will be queued together with other settings of this window Use mmlGdcDispWinCommit to submit these settings for processing The allowed matrix properties differ depending on the window features All windows support a panning matrix surface move inside the layer except if the
153. RR DISP INVALID If one of the parameters is invalid September 11 2015 SSE2DH 709 00022 1 0 1 7 4 APPLICATION NOTE 11 6 Pixel Engine API Pixel Engine PixEng API Data Structures struct MML GDC PE CONTEXT CONTAINER Macros define MML API extern define PE STORE 0x00000001U define MML PE SRC 0x00000002U define PE DST 0x00000004U define 0x00000008U define MML GDC PE ROP BLACKNESS MM U08 0x00 define MML GDC PE ROP WHITENESS MM_U08 0xFF define MML GDC SRCCOPY MM U08 0xAA define MML GDC PE ROP NOTSRCCOPY MM U08 0x55 define MML GDC PE ROP MASKCOPY MM_U08 0xCC define MML GDC PE ROP NOTMASK MM_U08 0x33 define MML GDC PE ROP define MML GDC PE ROP MASKINVERT MM_U08 0x66 MSKAND MM U08 0x88 define MML GDC PE ROP MASKERASE MM U08 0x22 define MML GDC PE ROP NOTMASKERASE MM U08 0x11 define MML GDC PE ROP MERGEMASK MM_U08 0xEE define MML GDC PE ROP MERGEMASKNOT U08 0xBB define MML GDC PE ROP DSTCOPY MM_U08 0xF0 define MML GDC PE ROP NOTDSTCOPY MM_U08 0x0F define MML GDC PE ROP DSTPAINT MM_U08 0
154. RR PE INVALID DIMENSION ERRCODE 0x2100D007 define MML ERR PE INVALID STRIDE MM ERRCODE 0x2100D008 define MML ERR PE INVALID BITS PER ERRCODE 0x2100D009 define MML ERR PE INVALID COMPRESSION ERRCODE 0x2100D010 define MML ERR PE INVALID REQUEST ERRCODE 0x2100D011 define MML ERR PE INVALID MODE ERRCODE 0x2100D012 define MML ERR PE INVALID SURFACE PARAM ERRCODE 0x2100D013 define MML ERR PE INVALID NO ACTIVE ERRCODE 0x2100D014 define MML ERR PE INVALID ATTRIBUTE MM ERRCODE 0x2100D015 define MML ERR PE INVALID PARAMETER ERRCODE 0x2100D016 define MML ERR PE INVALID OPERATION ERRCODE 0x2100D017 define MML ERR PE INVALID MASK ERRCODE 0x2100D018 define ERR PE INVALID SCALING MM ERRCODE 0x2100D019 define MML ERR PE INVALID STORE COMRESSION MM ERRCODE 0x2100D020 define MML ERR PE INVALID STORE CLUT ERRCODE 0x2100D021 define ERR PE INVALID FLOAT MM ERRCODE 0x2100D023 define MML ERR PE INVALID CLUT ERRCODE 0x2100D024 define MML ERR PE INVALID ERRCODE 0x2100D028 define MML ERR PE INVALID COMPRESSION OPERATION MM ERRCODE 0x2100D029 codes for Surface Manager API define ERR SURF OUT OF SPACE MM
155. RRCODE 0x21000007 define MML_ERR_GDC_SURF_INVALID_PARAMETER 0 21000008 define MML_ERR_GDC_SURF_INVALID_ADDRESS_ALIGNMENT MM_ERRCODE 0x21000009 Error codes for Synchronization API define MML_ERR_GDC_SYNC_INVALID_PARAMETER MM_ERRCODE 0x21005001 define MML_ERR_GDC_SYNC_OUT_OF_MEMORY MM_ERRCODE 0x21005002 define MML_ERR_GDC_SYNC_TIMEOUT MM_ERRCODE 0x21005003 define MML_ERR_GDC_SYNC_INVALID MM_ERRCODE 0x21005004 Error codes for Driver Initialization API define MML_ERR_GDC_SYS_DEVICE_INIT_FAILED MM_ERRCODE 0x21009001 define MML_ERR_GDC_SYS_DEVICE_CLOSE_FAILED MM_ERRCODE 0x21009002 define MML_ERR_GDC_SYS_DEVICE_ALREADY_INITIALIZED MM_ERRCODE 0x21009003 define MML_ERR_GDC_SYS_DEVICE_NOT_YET_INITIALIZED MM_ERRCODE 0x21009004 define MML_ERR_GDC_SYS_DEVICE_INVALID_PARAMETER MM_ERRCODE 0x21009005 define MML_ERR_GDC_SYS_DEVICE_WRONG_ID MM ERRCODE 0x21009006 Error codes for Writeback API define MML_ERR_GDC_WB_DEVICE_BUSY MM_ERRCODE 0x21004001 define MML_ERR_GDC_WB_INVALID_PARAMETER MM_ERRCODE 0x21004002 Error codes for Internal function calls define MML_ERR_GDC_CARD_DEV_NOT_ENABLED MM_ERRCODE 0x21007001 define MML_ERR_GDC_CARD_DEV_ENABLED MM_ERRCODE 0x21007002 define MML_ERR_GDC_CARD_DEV_NOTSUPPORTED MM_ERRCODE 0x21007003 define MML_ERR_GDC_CARD_ACCESS_FAILED MM ERRCODE 0x21007004 152 S6E2DH_AN709 00022
156. Return values MML OK Normal termination MML ERR ERP INVALID PARAMETER An invalid value is set in an argument 11 9 5 2 MM ERROR mmliGdcErpSetMessageChannel MM ERP MESSAGE DEST dest MM ERP MESSAGE CHANNEL PROP prop Set channel for error messages By default only MM ERP CH STDOUT is ON Note CH STDOUT and CH BUFFER can be en disabled independently Parameters Message channel selection MM ERP CH STDOUT Messages are routed to stdout MM ERP CH BUFFER Messages are routed to a buffer Setting of specified message channel MM ERP CH OFF Set message channel OFF MM ERP CH ON Set message channel ON Return values MML OK Normal termination MML ERR ERP INVALID PARAMETER An invalid value is set in an argument 11 9 5 3 MM ERROR mmlGdcErpSetMessageLevel 032 moduleld MM ERP MESSAGE LEVEL level Set level of error messages for an individual module For example mmlGdcErpSetMessageLevel MM ERP MODULE ID GDC DISP USER MM LEVEL INFO will print all messages info warning error that come from the display module The module IDs are defined for each driver component see Module Id s September 11 2015 S6E2DH_AN709 00022 1v0 E 149 md CYPRESS APPLICATION NOTE PERFORM Parameters moduleld Module ID selection MM ERP MODULE ALL USER MM ERP MODULE SURFMAN USER MM ERP MODULE DISP USER MM ERP MODULE IRIS USER MM ERP MODULE
157. SYNC USER MM ERP MODULE CARD USER MM ERP MODULE CONFIG USER MM ERP MODULE SYSINIT USER MM ERP MODULE CMDSEQ USER MM ERP MODULE USER MM ERP MODULE ERP USER MM ERP MODULE SERVICE USER Level selection MM ERP LEVEL NOTHING No messages MM ERP LEVEL ERROR All error messages MM ERP LEVEL WARNING All error and warning messages MM ERP LEVEL INFO All error warning and info messages Return values MML OK Normal termination MML ERR ERP INVALID PARAMETER An invalid value is set in an argument 11 9 5 4 MM ERROR mmlGdcErpSetPrintf PRINTFUNCTION user print function Set the print function that is used for the STDOUT channel Parameters in user print function A Function of type PRINTFUNCTION function returning void of parameter const char string that shall be used to print on STDOUT Note This will be initialized to NULL i e without setting this function there will be no messages on STDOUT Return values MML_OK Normal termination MML ERR ERP INVALID PARAMETER An invalid value is set in an argument 11 10 Error Codes Error Codes of this driver Error codes for Config API define MML ERR CONFIG INVALID PARAMETER MM ERRCODE 0x21008001 define ERR CONFIG INTERNAL ERROR ERRCODE 0x21008002 define ERR CONFIG INVALID ADDRESS ERRCODE 0x21008003 150 S6E2DH_AN
158. Synchronization of framebuffer operations 13 15 sysinit h File Reference Driver Initialization Module include errors h Data Structures struct MML GDC SYSINIT INFO 256 S6E2DH 709 00022 1 0 September 11 2015 CE APPLICATION NOTE 7 CYPRESS PERFORM Macros define GFX_PLL_MIN 200000000 define GFX PLL MAX 4150000000 Default initializer define MML SYSINIT INITIALIZER Resource names define MM RES DISPO 10 lt lt 00 stdefine RES LAYERO 10 lt lt 10 define RES LAYERI 10 lt lt 20 define RES FETCH DECODEO 10 lt lt 30 define RES FETCH LAYERO 10 lt lt 40 Functions MM ERROR mmlGacSyslnitializeDriver SYSINIT INFO pDriverInitInfo MM ERROR mmlGdcSysUninitializeDriver void MM ERROR mmlGdcSysSetlnstructionBuffer void address U32 size 13 15 1 Detailed Description Driver Initialization Module 13 16pe matrix h File Reference Provide some matrix utility functions include mm types h Macros didefine MML 2D MATRIX extern Typedefs typedef MM FLOAT Mat3x2 6 typedef MM FLOAT Mat3x3 9 typedef MM FLOAT Mat4x4 16 typedef MM FLOAT Mat4x3 12 typedef MM FLOAT Mat5x4 20 Functions Matrix functions for geometric operations MML 2D MATRIX
159. T The pixel engine context object definition 11 6 4 Enumeration Type Documentation 11 6 4 1 enum MML GDC PE BF Blend function definition used by mmlGdcPeBlendFunc 11 6 4 2 enum MML GDC PE BM Blend mode definition used by mmlGdcPeBlendMode 11 6 4 3 enum MML GDC PE CLUT FORMAT CLUT entities size Enumerator MML GDC PE CLUT FORMAT 33 Each array for RGB contains 33 10 bit values to describe the 0 255 index range The missing values are interpolated see mmlGdcPeCLUTData for details MML GDC PE CLUT FORMAT 256 Each array for RGB contains 256 values to describe the CLUT 11 6 4 4 enum MML PE CMATRIX FORMAT Color matrix format Enumerator MML GDC PE CMATRIX FORMAT 4X3 float 12 array with 4 column and 3 lines 125 September 11 2015 56 20 AN709 00022 1v0 E APPLICATION NOTE CYPRESS 11 6 4 5 enum MML GDC PE CTX ATTR Context attributes used by mmlGdcPehttribute Enumerator MML GDC PE CTX ATTR DITHER COLOR Set the color dither mode The related parameter can be MM TRUE Enable color dithering MM FALSE Disable color dithering default MML GDC PE CTX ATTR DITHER ALPHA Set the alpha dither mode The related parameter can be MM TRUE Enable alpha dithering MM FALSE Disable alpha dithering default MML GDC PE CTX ATTR DITHER OFFSET The value can be in the range from 0 15 Set a dither offset Note If the application renders a new frame with the vsync dis
160. T object Return values MML OK On success Otherwise the related error code 190 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE 11 18 3 2 MM ERROR mmiGdcPeGenContext PE CONTEXT pPectx mmlGdcPeGenContext creates pixel engine context Note Each function with a MML PE CONTEXT as parameter requires a previous call of mmlGdcPeGenContext for this context The context will be initialized with default values Please check the related property change functions to check the default values Parameters Pointer to get the MML_GDC_PE_CONTEXT object Return values MML_OK On success Otherwise the related error code 11 18 3 3 MM ERROR mmiGdcSmbDeleteSurfaceObjects U32 uCnt MML SURFACE pSurfaces Deletes a list of surface objects Note x This function deletes the state containing surface object Parameters in uCnt The number of surfaces to delete in pSurfaces The array of surfaces to delete Return values MML OK On success MML ERR GDC SURF INVALID PARAMETER If NULL pointer is given for pSurfaces 11 18 3 4 MM ERROR mmiGdcSmGenSurfaceObjects MM U32 uCnt MML SURFACE pSurfaces Creates uCnt empty surface objects returning their names Note This function only instantiates empty surface objects Before being used they must be initialized by a function like mmlGdcSmAssignBuffer or the application must set their parame
161. TIL SUCCESS ret mmlGdcPeSelectArea amp ctx MML PE SRC MML DST while TRUE September 11 2015 S6E2DH_AN709 00022 1v0 E 57 d CYPRESS APPLICATION NOTE PERFORM Clear the last frame UTIL SUCCESS ret mmlGdcPeColor amp ctx 0 0 0 0 UTIL SUCCESS ret mmlGdcPeFill amp ctx 0 0 WIDTH BGR HEIGHT Blend the hub over rotated needle UTIL SUCCESS ret mmlGdcPeSetMatrix amp ctx MML GDC PE DST MML PE GEO MATRIX FORMAT 3X2 NEEDLE UTIL_SUCCESS ret mmlGdcPeBlt amp ctx WIDTH 0 51 ROT CENTER Y This time only 2 rendering steps are required The fill instruction clears the whole buffer Blend the hub over the rotated needle The driver will calculate and render the bounding box of the rotated needle and the hub Figure 6 10 Version 2 6 8 6 3 Version 3 Can we use only one rendering pass by rendering images that are larger than the source We can We just define that the rendering rectangle is defined by the target buffer Again blend hub over rotated needle to store UTIL SUCCESS ret mmlGdcPeBindSurface amp ctx MML PE STORE amp sNeedle UTIL SUCCESS ret mmlGdcPeBindSurface amp ctx MML amp sSrc BMP NEEDLE UTIL SUCCESS ret mmlGdcPeBindSurface amp ctx MML PE 5 amp sSrc BMP UTIL SUCCESS ret mmlGdcPeSetMatrix amp ctx MML
162. TION NOTE PERFORM Blend Mode RGBA Components FUNC ADD Cs Fs Fd min Cs max Cs FUNC_SUBTRACT Cs Fs Cd Fd FUNC REVERSE SUBTRACT C Cd Fd Cs Fs BLEND_SRC C Cs BLEND_SRC_OVER Cs Cd 1 As BLEND DST OVER C Cs 1 Cd BLEND IN Cs Ad BLEND DST IN C Cd As BLEND_MULTIPLY C Cs 1 Ad Cd 1 As Cs BLEND SCREEN C Cs Cd Cs BLEND DARKEN min Cs Cd 1 As Cd Cs 1 Ad BLEND LIGHTEN C max Cs Cd 1 As Cd Cs 1 Ad BLEND ADDITIVE C Cs Parameters pectx Pixel Engine context NULL mode red Blend mode of red default MML GDC PE BM GL FUNC ADD mode green Blend mode of green default MML GDC PE BM GL FUNC ADD mode blue Blend mode of blue default MML GDC PE BM GL FUNC ADD mode alpha Blend mode of alpha default MML GDC PE BM GL FUNC ADD Return values MML OK On success Otherwise the related error code 11 6 5 6 ERROR mmlGdcPeBIit MML GDC PE CONTEXT pectx MM FLOAT offsetx MM FLOAT offsety This initiates an operation that reads pixel data from surfaces bound to SRC DST and MASK and performs a calculation using it The resulting pixel data build a rectangle that is written to the
163. TR CLUTBUFFER PHYS ADDRESS MML GDC SURF ATTR SURF FORMAT MML GDC SURF ATTR USERDEFINED CE CYPRESS PERFORM September 11 2015 S6E2DH_AN709 00022 1v0 E 255 EZ CYPRESS APPLICATION NOTE PERFORM ip Functions MM ERROR mmlGdcSmResetSurfaceObject MML SURFACE surf MM ERROR mmlGdcSmAssignBuffer MML SURFACE surf MM 032 uWidth MM 032 uHeight MML SURF FORMAT eFormat void pBufferAddress 032 uRleWords MM ERROR mmlGdcSmAssignClut MML SURFACE surf MML eMode MM 032 uCount MML SURF CLF eFormat void pBufferAddress MM ERROR mmiGdcSmSetAttribute const SURFACE surf MML eName MM U32 uValue MM ERROR mmiGdcSmGetAttribute const MML SURFACE surf MML ATTR eName MM U32 13 13 1 Detailed Description Surface Manager Interface 13 14 mml gdc sync h File Reference Synchronization of framebuffer operations include mm errors h Data Structures struct MML GDC SYNC CONTAINER Typedefs typedef MML SYNC CONTAINER MML SYNC Functions MM ERROR mmlGdcSyncReset MML SYNC sync MM ERROR mmlGdcSyncWait MML SYNC sync MM 532 timeout MM ERROR MML SYNC sync S32 incr 13 14 1 Detailed Description
164. TTR COLOR Set window color The format of the color value is OXRRGGBBAA Three use cases are possible for the window color If the color surface set to the window has RGB color the surface fetches the RGB color from the window color The window color will be ignored if the surface brings the RGB color by itself f blend mode is MML DISP BLEND TRANSPARENCY the transparency color is defined by the RGB part of the window color If blend mode is MML DISP BLEND GLOBAL ALPHA the global alpha value is defined by the alpha part of the window color September 11 2015 S6E2DH_AN709 00022 1v0 E 107 CYPRESS APPLICATION NOTE SF PERFORM MML_GDC_DISP_WIN_ATTR_DISABLE Switch the window off Default value 0 window is enabled Set value 1 window is switched off and invisible on screen MML_GDC_DISP_WIN_ATTR_SWAP_INTERVAL Selects the swap interval to be used for displaying sur faces This will be used if different surfaces get shown after each other using mmlGdcDispWinSetSurface and mmlGdcDispWinCommit The default value 1 The minimum allowed value 1 0 is possible but results in display flicker The maximum allowed value 2A31 1 MML_GDC_DISP_WIN_ATTR_MAX_BUFFER Defines the maximum number of framebuffers that can be queued by the driver for a window If an application submits surfaces using mmlGdcDispWinSetSurface and mmlGdcDispWinCommit faster than they can be displayed the
165. U Synchronization 147 September 11 2015 56 20 AN709 00022 1v0 E F APPLICATION NOTE PERFOR 11 9 2 12 MM MODULE ID GDC SYSINIT USER lin a3 trj ca MM MODULEID 0x21008000U Initialization 11 9 3 Typedef Documentation 11 9 3 1 typedef void MM PRINTFUNCTION const char string Function type definition for the print function that shall be used 11 9 4 Enumeration Type Documentation 11 9 4 1 enum MM ERP MESSAGE CHANNEL PROP Enumeration of message channel properties Enumerator MM ERP CH OFF message channel off MM ERP CH ON message channel on 11 9 4 2 enum MM ERP MESSAGE DEST Enumeration of message destination Enumerator MM ERP CH STDOUT report to stdout MM ERP CH BUFFER report to buffer 11 9 4 3 enum MM ERP MESSAGE LEVEL Enumeration of message levels Enumerator MM ERP LEVEL NOTHING report no messages MM ERP LEVEL ERROR report error messages MM ERP LEVEL WARNING report error warning messages MM ERP LEVEL INFO report error warning info messages 11 9 5 Function Documentation 11 9 5 1 MM ERROR mmliGdcErpSetBuffer ADDR bufferAddr MM 032 bufferSize Set the parameter for a buffer that is used as a channel for error messages 148 S6E2DH_AN709 00022 1v0 E September 11 2015 APPLICATION NOTE Parameters in bufferAddr Address of the provided buffer in bufferSize Size in Bytes of the provided buffer
166. UV color will be converted according to the user defined color matrix range for the multiplication factors is 3 5 3 5 The range for the constant factors is 3 0 3 0 Parameters pectx Pixel Engine context NULL format Format of the matrix must be MML GDC PE CMATRIX FORMAT 4X3 fMatrix Address of color matrix See Description Return values MML OK On success Otherwise the related error code 11 6 5 10 MML ERROR mmiGdcPeFill PE CONTEXT pectx U32 x U32 y MM U32w MM U32h This API fills the specified region of the surface that is bound to the MML GDC PE STORE target with the constant color see mmlGdcPeColor If w or h is equal to 0 this API returns MM TRUE but no work is done Note The graphical operation will not be finished after the mmlGdcPeFill call That means the target buffer may be still in use Please use synchronization objects or simple mmlGdcPeFinish to ensure that all operations are complete if the buffer is used by another hardware unit e g CPU display beside PixEng afterwards Parameters Pixel Engine context NULL Left start coordinate of the store surface 0 4095 Lower or upper see MML_GDC_PE_ATTR_ZERO_POINT start coordinate of the store surface 0 4095 Width of rectangle region in pixel count 0 4096 September 11 2015 S6E2DH_AN709 00022 1v0 E 135 SF m AP
167. WIN ATTR LAYER ID 0 DISP WIN SUB LAYER ID GDC DISP WIN ATTR TOPLEFT X DISP WIN ATTR TOPLEFT MML DISP WIN WIDTH DISP WIN ATTR HEIGHT MML DISP WIN ATTR SCREEN DISP WIN ATTR COLOR DISP WIN ATTR DISABLE DISP WIN ATTR SWAP INTERVAL MML DISP WIN ATTR MAX BUFFER DISP WIN ATTR TILE MODE DISP WIN ATTR FEATURE Functions Display Functions MM ERROR mmlGdcDispOpenDisplay MML DISP PROPERTIES mode MML DISPLAY display MM ERROR mmlGdcDispCloseDisplay MML DISPLAY display MM ERROR mmlGdcDispDitherCtrl MML DISPLAY display DISP DITHER ENABLE enable DISP DITHER MODE mode DISP DITHER RANGE range MML DISP DITHER FORMAT format MM ERROR mmlGdcDispCLUTData MML DISPLAY display DISP CLUT FORMAT format const MM S16 pRed const S16 pGreen const MM 516 pBlue MM ERROR mmlGdcDispSyncVSync MML DISPLAY display MML SYNC sync MM 532 vsyncCnt MM ERROR mmlGdcDispSetAttribute MML DISPLAY display MML DISP ATTR pname MM 032 param MM ERROR mmlGdcDispGetAttribute DISPLAY display MML DISP ATTR pname MM U32 pParam MM ERROR mmlGdcDispCommit MML DISPLAY display
168. WinSetAttribute s dbw i win MML DISP WIN ATTR SWAP INTERVAL window assignment i swap interval This feature can be used to control the window refresh interval Very important windows may keep the default swap interval 1 but low priority windows with may be GPU consuming draw operations can be set to a swap interval 2 or 3 In this case the window will be updated with 30 Hz or 20 Hz for a display with 60 Hz refresh rate 6 8 Tutorial Speedometer 6 8 1 Summary This example realizes a simple speedometer The aim is to use 2 layers One as static background for the scale And one dynamic layer with a rotating needle a fixed hub around the rotation center The hub image has a light shadow and must not be rotated with the needle The user can switch between 4 possible drawing versions which are commented on later by pressing the right button By pressing the left button the bShowDrawRects property be toggled which draws different rectangles to visualize the drawing areas The sample uses a single buffer render mode However different to the Chart sample this demo uses only the blanking period of the panel timing That s why it is important to use very fast render operations Figure 6 7 Expected result DSTI 100 120 140 160 180 200 6 8 2 Learning Goals The following techniques and features are used Show different ways to restore and render the needle l
169. Y display MML DISP ATTR pname 032 param MM ERROR mmlGdcDispGetAttribute MML DISPLAY display MML DISP ATTR pname 032 September 11 2015 S6E2DH_AN709 00022 1v0 E 97 APPLICATION NOTE PERFORM MM ERROR mmlGdcDispCommit MML DISPLAY display Window Functions MM ERROR mmlGdcDispWinCreate MML DISPLAY display DISP WINDOW PROPERTIES properties MML DISP WINDOW pWin MM ERROR mmlGdcDispWinDestroy MML DISP WINDOW win MM ERROR mmlGdcDispWinSetSurface MML DISP WINDOW win MM 032 target MML GDC SURFACE surf MM ERROR mmlGdcDispWinSetBlendMode MML DISP WINDOW win MM 032 blend mode MM ERROR mmlGdcDispWinSetMatrix MML DISP WINDOW win 032 target const MM FLOAT matrix MM ERROR mmlGdcDispWinSync MML DISP WINDOW win MML SYNC sync MM ERROR mmlGdcDispWinWaitSync MML DISP WINDOW win MML SYNC sync MM ERROR mmlGdcDispWinSetAttribute MML DISP WINDOW win DISP WIN pname MM 032 param MM ERROR mmlGdcDispWinGetAttribute MML DISP WINDOW win DISP WIN pname MM 032 MM ERROR mmlGdcDispWinCommit MML DISP WINDOW win 11 5 1 Detailed Description The Display API exposes all the hardware features of the display unit See also Display Overview inc
170. _COMP initial MML GDC SURF COMP NON MML GDC SURF ATTR RLAD MAXCOLORBITS Maximum for average number of bits per compressed pixel This value is used for surfaces with compression format MML SURF COMP RLAD The format is analog to MML SURF ATTR COLORBITS 0xRRGGBBAA or 0xYOUOY1 VO The initial value is 0x08080808 If the surface is used as target buffer blit and the compression format is MML GDC SURF COMP RLAD the RLAD BITPERPIXEL value defines the maximum write buffer size see MML GDC SURF ATTR SIZEINBYTES The application can use the 88 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE MML GDC SURF ATTR SIZEINBYTES parameter to calculate the required buffer size and can allocate and assign a VRAM space for this operation MML GDC SURF ATTR SIZEINBYTES Buffer size in bytes initial 0 Note This value must be set for images with compression type MML SURF COMP and SUHF COMP RLA The size can be set to zero for all other image types If size is zero mmlGdcSmGetAttribute will return the following size depending of the given compression type MML SURF COMP NON required buffer size Height Stride MML SURF COMP RLC 0 correct size must be set by application MML SURF COMP RLA 0 correct size must be set by application MML SURF COMP RLAD the maximal required size for the given compression s
171. ace Overview Data Structures struct MML SURFACE CONTAINER Macros define SURFACE MAX WIDTH 4096 define SURFACE MAX HEIGHT 4096 define SURFACE CONTROL WIDTH 2048 define SURFACE CONTROL HEIGHT 2048 Typedefs typedef MML SURFACE CONTAINER MML SURFACE Enumerations enum MML SURF FORMAT MML SURF FORMAT R8G8B8A8 0x00 MML SURF FORMAT A8B8G8R8 MML SURF FORMAT A8R8G8B8 MML SURF FORMAT B8G8R8A8 MML SURF FORMAT R8G8B8X8 MML SURF FORMAT X8B8G8R8 84 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE MML SURF FORMAT X8R8G8B8 MML GDC SURF FORMAT R8G8B8 MML SURF FORMAT B8G8R8 MML GDC SURF FORMAT R6G6B6 MML SURF FORMAT MML SURF FORMAT 4 MML SURF FORMAT R5G5B5A1 MML SURF FORMAT A1R5G5B5 MML SURF FORMAT A1B5G5R5 MML SURF FORMAT 5 5 5 1 MML SURF FORMAT R5G6B5 MML SURF FORMAT A8RGBS8 MML SURF FORMAT RGBB8 MML GDC SURF FORMAT A8 MML SURF FORMAT 4 MML SURF FORMAT 4 MML GDC SURF FORMAT A2 MML FORMAT 1 MML GDC SURF FORMAT RGB1 enum MML MML SURF COMP NON 0x4 MML SURF COMP RLC 0x3 MML SURF COMP RLA 0x2 MML SURF COMP RLAD 0x0
172. amp Destructor Documentation 12 11 2 1 Frame unsigned width unsigned height inline Constructor S6E2DH_AN709 00022 1v0 E September 11 2015 226 APPLICATION NOTE CYPRESS gt PERFORM Parameters in _width Frame width in _ height Frame height 12 11 3 Member Function Documentation 12 11 3 1 Pixel GetPixel unsigned x unsigned y const inline Get Pixel at position x y Parameters in x X position in y Y position Return values Pixel 12 11 3 2 Pixel amp Read inline Return values return Read and return one pixel 12 11 3 3 void ResetRead inline Reset read operation for frame start 12 11 3 4 void ResetWrite inline Reset write operation for frame start 12 11 3 5 void Write const Pixel amp pix inline Write one pixel Parameters n pix Pixel The documentation for this class was generated from the following file class rlad h 12 12MML GDC DISP MODE LINE Struct Reference include lt mml_gdc_display h gt September 11 2015 S6E2DH_AN709 00022 1v0 E 2 N 7 APPLICATION NOTE PERFORM Data Fields MM FLOAT pixelClock MM 032 horDisplayPeriod MM 032 horPulseStart MM 032 horPulseEnd MM 032 horTotal MM Ux32vertDisplayPeriod MM 032 vertPulseStart MM 032 vertPulseEnd MM 032 vertTotal MM 032 DCKDelay DISP INVERT ENABLE DCKInvertEnable
173. ans the resulting alpha for the blending step is A Asrc Amask If a ROP operation with MASK or DST is defined external alpha or blending mutates to ROP operation See mmlGdcPeRopOperation for more details The graphical operation will not be finished after the mmlGacPeBlit call That means the involved buffers are still in use Please use synchronization objects or simple mmlGdcPeFinish to ensure that all operations are complete Pixel Engine operations can be queued by the driver to enhance performance especially in multi threading environment The execution especially of long processing commands can be forced by a mmlGdcPeFlush call mmlGdcPeFinish mmlGdcDispWinSetSurface and also flush the command queue The following features can be defined for the bounded surfaces ALL simple transformation translation mirroring 90 if buffer is not compressed SRC rotate scale or index decompress DST index decompress if SRC does not require these features lt scale if scale factor is identical with SRC Parameters pectx Pixel Engine context I NULL offsetx Horizontal offset 4096 4095 offsety Vertical offset 4096 4095 count direction depends on MML GDC PE ATTR ZERO POINT Return values MML OK On success Otherwise the related error code 11 6 5 7 MML ERROR mmIGdcPeCLUTData PE CONTEXT pectx MML
174. anually using mmlGdcSmSetAttribute calls In the second case the minimal required attributes are typically MML ATTR BASE ADDRESS MML SURF ATTR WIDTH MML SURF ATTR HEIGHT MML GDC SURF ATTR BITPERPIXEL MML GDC SURF ATTR COLORBITS and SURF COLORSHIFT Optionally a color lookup table can be defined for the image color lookup table is list with a defined number of red green blue and optionally alpha values If an index table is defined for an image the blue and green color parts if the image are not longer used but the red component is used as pointer to the color lookup table and the related red green blue and alpha value define the pixel color 86 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE F CYPRESS PERFORM pixel color r g b color lookup table index r g b 0 0 0 0 1 255 255 255 2 0 255 255 resulting color 255 255 255 A color lookup table be defined with the helper function mmlGdcSmaAssignClut or manually using mmlGdcSmSetAttribute calls In the second case the minimal required attributes are MML GDC SURF ATTR CLUTMODE MML GDC SURF ATTR CLUTCOUNT MML GDC SURF ATTR CLUTBITPERPIXEL MML GDC SURF ATTR CLUTCOLORBITS MML GDC SURF ATTR CLUTCOLORSHIFT and MML GDC SURF ATTR CLUTBUFFERADDRESS Note zx The maximal bits per pixel for an index entry is 24 Therefore if an alpha channel is req
175. ated in the Speedometer sample A more sophisticated approach splits the frame buffer into several regions and updates only the region that is currently not read by the display controller as demonstrated in the Chart sample See Synchronization API for details 4 7 Error Reporting Overview This API provides functions to configure the reporting of ERROR WARNING and INFO messages The level of these messages can be specified per module See Error Reporting for details 4 8 Memory Management 4 8 1 4 8 2 4 8 3 Different to many other graphics drivers the 2D Graphics Driver for S6E2D does not include or use any memory management routines dynamic memory usage However memory is required for different functions System Memory System Memory is a memory block assigned to the CPU as operating memory for OS and application The driver requires some static memory blocks that should be assigned by the linker to this block In the reference implementation S6E2D s SRAMO is used for this purpose 2D Graphics hardware blocks can read and write system memory Typically the 2D Graphics components should not be configured to access system memory because especially frame buffer and similar operations are optimized for the VRAM access Video Memory VRAM The Video Memory is a dedicated memory block inside the Graphics hardware designed to store graphical content The VRAM is also used as command list buffer Therefore it is requir
176. ause the constructor takes over the initialization of the context After a call of OpenDrawCtx this context can be also used for drawing 11 25 CDevice Data Structures class CDevice 11 25 1 Detailed Description The Class CDevice is responsible to initialize the 2D core driver and util part in the Open function and also allocates and assigns command sequencer fifo It is required that this Open function is called before using any other util class functions and the application must also ensure that the device destruction is called as the last instruction of an application Only one object of the CDevice call is allowed in a program 11 26 CDisplay Data Structures class CDisplay September 11 2015 S6E2DH_AN709 00022 1v0 E 201 EZ CYPRESS APPLICATION NOTE PERFORM 11 26 1 Detailed Description The class CDisplay abstracts a MML GDC DISPLAY object and adds some helper functions 11 27 CMenu Data Structures class CMenu 11 27 1 Detailed Description The classes in this group realize a simple menu It can be used with an 2D core display layer for demo applications to allow selections switches and similar operations with a minimum keys Sample code CMenu menu menu Open display 0 0 320 240 MML DISP LAYER 4 MML GDC DISP SUB LAYER DEFAULT 0 MML GDC DISP BLEND SOURCE ALPHA MML GDC DISP BLEND SOURCE MULTIPLY ALPHA menu InitMenu Font ttf sizeof Font ttf 16
177. ay amp windowProp amp win Draw something in a surface MyDrawFunction target Push the surface to the surface to the window mmlGdcDispWinSetSurface win target mmlGdcDispWinCommit win Close Window and Display mmlGdcDispWinDestroy win mmlGdcDispCloseDisplay display Like mentioned in the Display Overview enhanced features MML GDC DISP WINDOW PROPERTIES can be requested while opening mmlGdcDispWinCreate a window The table below lists the available feature types and there restrictions Window Feature Comment Restrictions The window can MML GDC DISP FEATURE INDEX COLOR show an indexed image The surface must not be mirrored rotated if The window can compression is used MML GDC DISP FEATURE DECODE display a RLE or Cannot be combined with RLAD buffer MML GDC DISP FEATURE MULTI LAYER Only 2 windows with this feature are available September 11 2015 S6E2DH_AN709 00022 1v0 E 99 S CYPRESS APPLICATION NOTE PERFOR Window Feature Comment Restrictions Up to 8 windows with different size color format and buffer address but the same layerld can be opened and used simultaneously for one display The Overlapping windows of this layer cannot be combined blended one on top of the other Only the top MML GDC DISP FEATURE MULTI LAYER windows most window will be blended against the represent a background common layer that Cannot be combined with can be blended t
178. ayer Usage of mmlGdcPeSelectArea mmlGdcPeActiveArea and mmlGdcPeGetDrawBox Show the coordinate system transformation Use a colored 4 bit per pixel layer September 11 2015 S6E2DH_AN709 00022 1v0 E 51 ea CYPRESS APPLICATION NOTE 6 8 3 Chapters 1 Preparation 2 Matrix operations to scale rotate and translate images 3 Show different versions to restore and draw the needle layer 6 8 4 Preparation First step is to initialize the driver and setup the display Initialization of driver and display Initialize the driver UTIL SUCCESS ret mmlGacSyslnitializeDriver 0 UTIL SUCCESS ret utMmanReset Allocate some of VRAM for Instruction buffer for the command sequencer Note that mmlGdcVideoAlloc is an application defined routine to manage the VRAM space The 2D core driver does not include any management of the VRAM vinstrBuffer mmiGdcVideoAlloc fifo size 0 NULL UTIL SUCCESS ret mmlGacSysSetlnstructionBuffer vInstrBuffer size Setup and enable the display UTIL SUCCESS ret mmlGdcDispOpenDisplay amp dispParams 85 display If bShowDrawRects is set we prepare an additional layer sComment This layer represents a minimal colored layer only one bit is reserved for each color channel and for alpha As the utility function utSurfCreateBuffer only supports common color formats we create our own function CreateCommentSurface static MM ERROR CreateCommentSu
179. b a pixel data of surface at position x The pixel with the coordinates 0 0 is the upper left pixel analoge to the the memory organisation of the memory buffer Please note that this is different to the glReadPixels specification Please note not all possible surface formates are supported Parameters The surface object x positon of the pixel y positon of the pixel Pointer to get the red value Pointer to get the green value Pointer to get the blue value Pointer to get the alpha value Return values MML OK on success otherwise the related error code 11 19 3 4 MM S32 utSurfHeight MML SURFACE surf Return the height of a given surface object Parameters The surface object Return values Height of the surface 11 19 3 5 MM ERROR utSurfLoadBitmap MML GDC SURFACE surface const void plmage MM BOOL bCopyToVRAM Read a bitmap structure set the related surface attributes allocate the required memory for pixel and CLUT buffer and copy the related data Please note the surface object must be created before September 11 2015 S6E2DH_AN709 00022 1v0 E 197 M d CYPRESS SF APPLICATION NOTE PERFORM Parameters surface The surface object plmage pointer to the image Return values bCopyToVRAM MM_TRUE if the bitmap and color look up table memory should be copied into VRAM MML_OK on success otherwise the related
180. be overwritten MML GDC SURF ATTR BASE ADDRESS2 Not used for S6E2D Virtual base address of the UV buffer initial 0 MML GDC SURF ATTR PHYS ADDRESS2 Not used for S6E2D Physical base address of the UV buffer initial 0 MML GDC SURF ATTR WIDTH Wiath in pixels initial 0 MML SURF ATTR HEIGHT Height in pixels initial 0 MML SURF STRIDE Size of a line in bytes initial 0 Note fstride is 0 the default stride for the image buffer is assumed represented by the following formula stride Width BitPerPixel 7 gt gt 3 The GetAttribute call will return the previously set custom stride value or the default stride calculated with the formula above The stride value is not important for compressed images If the surface describes a compressed image the returned value will be 0 MML_GDC_SURF_ATTR_BITPERPIXEL Size of one pixel in bits Can be one of 1 2 4 8 12 16 24 32 initial 32 MML GDC SURF ATTR COLORBITS Color component size in bits OXRRGGBBAA or OxYOUOY 1 VO initial 0 08080808 color bits red_bits lt lt 24 green bits 16 blue bits 8 alpha bits for format MML GDC SURF ATTR COLORSHIFT Color component shift OXRRGGBBAA or OxYOUOY1 VO initial 18100800 color shift red_shift lt lt 24 green_shift lt lt 16 blue shift 8 alpha shift for RGBA format MML_GDC_SURF_ATTR_COMPRESSION_FORMAT Compression format must be of MML_GDC_SURF
181. be used to compress a surface 13 27 memman h File Reference This file defines some interfaces for the memory management include mm defines h Macros define ERR MMAN INVALID PARAMETER ERRCODE 0x18010001 define ERR MMAN NO MEMORY ERRCODE 0x18010002 define ERR MMAN NO VRAM MM ERRCODE 0x18010003 define ERR MMAN INVALID MEMORY MM ERRCODE 0x18010004 define ERR MMAN ACCESS FAILED MM ERRCODE 0x18010005 define VRAM BASE 0xD0000000U define MM VRAM SIZE 0x00080000U define MM SDRAM BASE 0xB0080000U define MM SDRAM SIZE 0x01000000U September 11 2015 S6E2DH_AN709 00022 1v0 E 263 APPLICATION NOTE SF PERFORM Typedefs typedef void x MML_MMAN_HEAP_HANDLE Functions MM ERROR utMmanReset void MM ERROR utMmanCreateHeap MML MMAN HEAP HANDLE hdlmem 032 size 032 base Address MM ERROR utMmanDestroyHeap MML MMAN HEAP HANDLE hdlmem MM ERROR utMmanHeapAlloc MML MMAN HEAP HANDLE hdlmem MM U32 size MM 032 alignment MM ADDR addr MM ERROR utMmanHeapFree MML MMAN HEAP HANDLE hdlmem void addr MM ERROR utMmanGetSize MMAN HEAP HANDLE hdlmem U32 size MM ERROR utMmanGetFree MML HEAP HANDLE hdlmem U32 size MM ERROR utMmanGetLargest MML HEAP HANDLE hdlmem 032 13 27 1 Detailed Description This file defines some interfaces for the m
182. blue 0 alpha 255 CYPRESS PERFORM MM_U32 addr 4 y width x red lt lt 24 green lt lt 16 blue lt lt 8 alpha MM UNLOCK addr Figure 6 3 Pattern on Black amp White image on constant color September 11 2015 56 20 AN709 00022 1v0 E 41 d 7 CYPRESS APPLICATION NOTE PERFORM 6 5 8 6 5 9 Blending two surfaces To blend an image with an alpha channel onto the existing store surface we have to connect surfStore both as destination input and store output The second input surface is again surfSrc It has to be reset because now it holds another image with just 8 bit alpha values Therefore SURF FORMAT A68 has to be used We define 255 0 0 255 as the constant color to see the text in red The alpha channel in the constant color definition has no effect because it is defined by the image re use the source surface for the text mmlGdcSmhResetSurfaceObject surfSrc UTIL SUCCESS ret mmlGdcSmAssignBuffer surfSrc textWidth textHeight MML FORMAT A8 void textAddr 0 UTIL SUCCESS ret mmlGdcPeSurfColor ctx MML SRC 255 0 0 255 UTIL SUCCESS ret mmlGdcPeBindSurface ctx MML PE STORE MML DST surfStore UTIL_SUCCESS ret mmlGdcPeBlt ctx 50 0f 70 0f Figure 6 4 Blended text Bring it to the display To see the surface on the display we nee
183. c Blend function of source alpha default MML GDC PE BF GL ONE func alpha dst Return values Blend function of destination alpha default MML GDC PE BF GL ONE MINUS SRC ALPHA MML OK On success Otherwise the related error code 11 6 5 5 MML PE ERROR mmiGdcPeBlendMode PE CONTEXT pectx MML PE BM mode red MML GDC PE BM mode green MML GDC PE BM mode blue MML GDC PE BM mode alpha Set the blending parameter If pectx is equal to NULL mmlGdcPeBlendMode is terminated without any operation Note The output of a blend operation is always alpha pre multiplied For the detail blend function refer to chapter 13 2 in OpenVG specification Version 1 1 March 27 2007 The following table is a brief description of the different blend modes Os Cd and C represents the incoming source blend destination and result component red green blue or alpha As Ad stands for incoming source and blend destination alpha component Fs and Fd stands for incoming source and blend destination blend function See mmlGdcPeBlendFunc 1 Note incoming color components Cs As and Ad can be the original image color or a result of a previous operation See MML PE SURF ALPHAMULTI SURF COLORMULTI September 11 2015 S6E2DH_AN709 00022 1v0 E 131 M Td CYPRESS APPLICA
184. ce must also be bound to the context SRC DST and MASK surfaces define the pixel sources for a blit operation A surface object can be associated to a memory address to operate with this memory It is also possible to use a surface without an attached memory address and use it as a blit source In this case only some properties such as the clear color and geometry are used September 11 2015 S6E2DH_AN709 00022 1v0 E 19 SEC Cypress APPLICATION NOTE PERFORM Figure 4 6 PixEng usage act pixeng Further actions required The active API calls processing and writing pixel data of the Pixel Engine API are mmlGdcPeFill and mmlGdcPeBlt The mmlGdcPeFill call with a previously attached store surface can be used to fill a buffer mmlGdcPeBlt can be used for all other operations like copying scaling rotation blending and color manipulating processing and combinations of them The surfaces bound to the context and the properties set to the context define the requested operations The following table shows the required and optional surfaces to perform an operation Operation Output required Input required Optional with Blend operation Optional with ROP2 or External Alpha Fill STORE Copy Scale Rotate STORE SRC MASK STORE SRC DST MASK 20 S6E2DH 709 00022 1 0 September 11 2015 SESZCYPhESS APPLICATION NOTE Not
185. const Mat3x3 src 2D MATRIX void utMat3x3Multiply Mat3x3 dst const Mat3x3 src1 const Mat3x3 src2 MML_GDC_2D_MATRIX_API void utMat3x3Translate Mat3x3 m MM FLOAT x MM FLOAT y 2D MATRIX void utMat3x3TranslatePre Mat3x3 m MM FLOAT x MM FLOAT 2D MATRIX void utMat3x3Scale Mat3x3 m MM FLOAT x MM FLOAT y 2D MATRIX void utMat3x3RotX Mat3x3 m MM FLOAT f 2D MATRIX void utMat3x3RotZ Mat3x3 m MM FLOAT f 2D MATRIX void utMat4x4Copy Mat4x4 dst const Mat4x4 src 2D MATRIX void utMat4x4Multiply Mat4x4 dst const Mat4x4 src1 const Mat4x4 src2 MML_GDC_2D_MATRIX_API void utMat4x4Loadldentity Mat4x4 m MML_GDC_2D_MATRIX_API void utMat4x4Translate Mat4x4 m MM_FLOAT x MM_FLOAT y MM_FLOAT z MML_GDC_2D_MATRIX_API void utMat4x4Scale Mat4x4 m MM_FLOAT x MM_FLOAT y MM_FLOAT z MML_GDC_2D_MATRIX_API void utMat4x4RotX Mat4x4 m MM_FLOAT f MML_GDC_2D_MATRIX_API void utMat4x4RotY Mat4x4 m MM_FLOAT f MML_GDC_2D_MATRIX_API void utMat4x4RotZ Mat4x4 MM FLOAT f 2D MATRIX void utMat4x4Perspective Mat4x4 m MM FLOAT fovy MM FLOAT aspect MM FLOAT zNear MM FLOAT zFar 2D MATRIX void utMat4x4GetXYZ Mat4x4 m float x float y float z float float yout float zout
186. cription nnn 228 12 12 2 Field Documentation 228 12 13 MML DISP PROPERTIES Struct Reference 229 12 13 1 Detailed Description 229 12 13 2 Field Documentation eines aitaa iiaeiai 230 12 14 MML DISP TCON PROPERTIES Struct 231 12141 Detailed Description 231 12 14 2 Field Documentation 231 12 15 MML DISP WINDOW PROPERTIES Struct Reference 231 12 15 1 Detailed Description 232 12 15 2 Field Documentation 8 232 12 16 MML PE CONTEXT CONTAINER Struct 233 12 16 1 Detailed Description 233 12 16 2 Field Documentation 233 12 17 MML SURFACE CONTAINER Struct Reference 233 12 171 Detailed Description EE ERREUR RR LR 233 12 17 2 Field Documentation 8 233 12 18 MML SYNC CONTAINER Struct 233 12 18 1 Detailed 233 12 18 2 Field Docurrientatloh eere ice ee eerte ee RR dpa 234
187. d a to create a display object by calling mmlGdcDispOpenDisplay Beside this a window is required using mmlGdcDispWinCreate Finally our surfStore must be set to the window using mmlGdcDispWinSetSurface and mmlGdcDispWinCommit activates the changes set up the display complete the display params dispParams xResolution 480 dispParams yResolution 272 UTIL SUCCESS ret mmlGdcDispOpenDisplay amp dispParams amp display create a display window and connect the store surface to it 42 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE complete the windows params winprop width dispParams xResolution horizontal display resolution winprop height dispParams yResolution vertical display resolution UTIL SUCCESS ret mmlGdcDispWinCreate display amp winprop amp win SW CYPRESS UTIL SUCCESS ret mmlGdcDispWinSetSurface win DISP BUFF TARGET COLOR BUFF surfStore UTIL SUCCESS ret mmlGdcDispWinCommit win 6 6 Tutorial Display Basic 6 6 1 Description This example realizes an animated but very simple navigation demo done just by the use of layer properties and operations The focus of this tutorial is to introduce different layer properties and how to set them up Figure 6 5 Expected result 6 6 1 1 Learning Goals The following techniques and features are used Blend 4 layers with pixel based alphas and different color formats
188. dc interrupthandler h The interrupt controller API provides all required functions to handle 2D core interrupts Note 2D core interrupts are required for the 2D Core Graphics Driver Therefore it is required that all 2D core IRQ lines connected to the ARM core are enabled and linked to the function provided by this interface The 2D Core Driver will take care that the interrupt sources are reset September 11 2015 S6E2DH_AN709 00022 1v0 E 143 APPLICATION NOTE Optionally it is possible for an application to register a callback function for dedicated 2D core interrupts CYPRESS MM U64 1 using mmadGdacinterruptRegisterHandler In this case the driver will call the function after clearing the interrupt status 11 8 2 Macro Definition Documentation MM IRIS CMDSEQ ERROR IRQ MM GDC IRIS INT CMDSEQ ERROR IRQ CP 11 8 2 1 define CMDSEQ ERROR Error condition Command Sequencer 11 8 2 2 define MM IRIS DISENGCFG FRAMECOMPLETEO IRQ MM IRIS INT DISENGCFG FRAMECOMPLETEO IRQ CP MM U64 1 DISENGCFG FRAMECOMPLETEO Frame complete Display Controller Display Stream 0 MM GDC IRIS FRAMEGENO SECSYNC OFF IRQ 11 8 2 3 define lt lt FRAMEGENO_SECSYNC_OFF Synchronization status deactivated Display Controller Content stream 0 MM_U64 1 MM GDC IRIS INT FRAMEGENO SECSYNC OFF IRQ CP MM GDC IRIS FRAMEGENO SECSYNC ON IRQ 11 8 2 4
189. dcPe Reset the sync mmlGdcSyncReset amp win struct sync Get a sync object for the first operation mmlGdcPeSync amp win struct sync while Proceed with any non graphics related operations do_anything Call the render routine Note that the draw function will only render new content if a frame swap was executed Otherwise the draw function will return immediately so that do_anything is called again draw amp win_struct September 11 2015 S6E2DH_AN709 00022 1v0 E 25 geo CEN CYPRESS APPLICATION NOTE X PERFORM The draw function starts rendering if the previously rendered buffer becomes visible The application can push all render instructions in the queue adds a sync instruction that the next buffer swap has to wait for blit complete and assigns the new buffer to the window Afterwards the CPU can handle other tasks Please note that the command sequencer queue see mmlGdcSysSetlnstructionBuffer must be big enough to store all blit operations 4 6 3 2 Single buffered window As double buffering requires more memory it is worthwhile to consider whether a single buffer is sufficient for a specific application In this case care must be taken that rendering does not affect the part of the window that is currently read by the display controller to avoid tearing A simple technique is to do the rendering completely in the blanking period of the display as demonstr
190. default layer blend mode expects a pre multiplied image and we have a constant color only UTIL SUCCESS ret mmlGdcDispWinSetBlendMode wArrow DISP BLEND SOURCE ALPHA MML DISP BLEND SOURCE MULTIPLY ALPHA UTIL SUCCESS ret mmlGdcDispWinSetAttribute wArrow MML DISP WIN ATTR COLOR 0x0000FFFF In the animation loop we simple change the arrow switch winker case 1 surfArrow sArrow_l break case 0 sArrow break case 1 surfArrow sArrow break Some 2D core drivers use layer rotation at this position to animate the arrow 48 S6E2DH_AN709 00022 1v0 E September 11 2015 APPLICATION NOTE E PM PERFORM We cannot use simple rotation while using sub windows but we can change the image So the following matrix calculation just moves the surface to the window center utMat3x2Loadldentity mat geo utMat3x2Translate mat geo 25 0f 25 0f utMat3x2Translate mat geo MM FLOAT utSurfWidth sArrow 0 51 FLOAT utSurfHeight sArrow 0 5f Set matrix UTIL SUCCESS ret mmlGdcDispWinSetMatrix wArrow MML DISP BUFF TARGET COLOR BUFF mat Set new surface UTIL SUCCESS ret mmlGdcDispWinSetSurface wArrow MML DISP BUFF TARGET COLOR BUFF surfArrow UTIL SUCCESS ret mmlGdcDispWinCommit wArrow 6 7 Tutorial Display Extended 6 7 1 Description Figure 6 6 Display Extended
191. dered above will now show the following result Figure 4 10 Zoomed blit and draw result with top left coordinate system setting 4 9 4 Matrix helper functions The 2D Graphics Driver comes with many tutorial samples and sample code For geometrical operation the utility part includes matrix calculation helpers Different matrix formats are available Mat3x2 This matrix format can be used for 2 dimensional operations like translation scaling and rotation Mat3x3 This matrix format must be used for the API in the blit path for the source image if a 3D operation is required Mat4x4 The 4x4 matrix is just a helper format The related functions are basically similar to other 3D render APIs like OpenGL However the depth information is not used so the 2D Graphics Driver API does not support this matrix format An application can anyway use these helper functions for the view calculation because the matrix result can be converted into a 3x3 matrix by removing the depth z parts from the matrix 28 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE ES CYPRESS PERFORM y The following example shows the required Mat3X2 operations to rotate the image above at the center of second pixel in the second line and blend the result to a target The rotation center of the source pixel will be located at the center of pixel 4 2 in the target reset the matrix utMat3x2Loadldentity mat translate to target co
192. described all operations must be calculated for each frame for each cover reduce the effort it is spit into 3 parts The pre and post matrix is constant over the scene That s why it can be calculated once during the initialization Only the dynamic part must be calculated for each cover The final matrix is Mdynamic Mpost For transformation of the 4 4 to a 3 2 matrix we use a utility function The idea is just to remove the z component for the matrix The z values are stored in the 3 line and 3 row Beside this the 4 line of the matrix must be removed Such a conversion assumes that the 4x4 matrix realizes only affine transformations This is only realized if the values are 0 0 1 Vscale All matrix elements must be divided by Vscale utMat4x4ToMat3x2 mat44 0 pos mat32 66 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE 6 10 2 3 z order sorting The hardware is not able to detect any z order The bitmaps will be drawn in the order as specified in the command list Later drawn bitmaps are on top of previously drawn bitmaps For this reason we calculate a z value of the center of each bitmap manually by using the 4 4 matrix utMat4x4GetXYZ mat44 0 COVER SIZE 2 COVER SIZE 2 0 amp fX amp fY amp fZ To sort the draw order we just sort a list of all bitmaps qsort amp positions 0 size positions size sizeof positions O CompareFno The compare function is int Co
193. device window are completely executed Use mmlGdcConfigSetAttribute set MML CONFIG ATTR DISPLAY NOBLOCK to 1 to make it non blocking Parameters Return values MML OK An MML DISP WINDOW returned from a previous call to mmlGdcDispWinCreate On success MML ERR DISP INVALID If an invalid argument was passed MML ERR DISP FAILED If an unexpected error occurs MML ERR DISP BUSY If the writing to the device display or device window is denied because the previous commit open or create call is not completely executed e g shadow load request is pending Call again later September 11 2015 S6E2DH_AN709 00022 1v0 E 113 APPLICATION NOTE SES cypress 11 5 5 12 MM ERROR mmiGdcDispWinGetAttribute DISP WINDOW win MML DISP WIN pname MM U32 Gets the value for attribute pname win specify for which window the attribute should be retrieved An MML DISP WINDOW returned from a previous call to mmlGdcDispWinCreate Parameters Parameter name See MML DISP WIN for valid values Address where the read value of the attribute is stored On success If one of the parameters is invalid Return values MML OK MML ERR GDC DISP INVALID mmlGdcDispWinSetAttribute MML DISP WINDOW win MM ERROR MML GDC DISP WIN ATTR pname MM U32 param
194. dr Figure 6 2 Black amp White image on constant color 6 5 7 A simple auto generated pattern Fill the source surface with a simple pattern and copy it to the store surface We reuse surfSrc but we use MML SURF FORMAT R8G8BB84A8 for the surface color format because it is much easier to write the data when each pixel is 4 byte aligned mmlGdcPeBlt copies the pattern to the store surface at position 35 45 so again the existing content of the store surface is overwritten in that area re use the source surface for the pattern mmlGdcSmhResetSurfaceObject surfSrc mmlGdcSmaAssignBuffer surfSrc patternWidth patternHeight UTIL SUCCESS ret MML SURF FORMAT R8G8B8A8 void patternAddr 0 create the pattern directly to VRAM CreatePattern MM U32 patternAddr patternSize patternWidth patternHeight add it to the context as source UTIL SUCCESS ret mmlGdcPeBindSurface ctx MML PE SRC SUCCESS ret mmlGdcPeBlt ctx 35 0f 45 0f Creating the pattern static void 032 addr MM U32 size 032 width MM 032 height S6E2DH 709 00022 1 0 September 11 2015 032 x 40 APPLICATION NOTE MM U32 y MM U32 red MM U32 green MM U32 blue MM 032 alpha MM LOCK addr size MA WRITE for x 0 x lt width x for y 0 y lt height y red 255 2 green y 4
195. driver queues them up to the maximum specified by MML_GDC_DISP_WIN_ATTR_MAX_BUFFER This attribute can only be read MML_GDC_DISP_WIN_ATTR_TILE_MODE This attribute can be used to define the tiling mode for windows The tile mode defines the color of pixels outside the surface but inside the window This is relevant if the assigned surface is smaller than the window or the geometry matrix for the window if moves the surface out of the window The tile mode must be a value of MML_GDC_DISP_TILE_MODE The default setting is MML GDC DISP TILE MODE CLIP Note If MML DISP TILE MODE CONST is set for window without an attached surface than the const color fills the window area Tip The mode MML_GDC_DISP_TILE_MODE_PAD can be used to generate a gradient background with a single line surface MML_GDC_DISP_WIN_ATTR_FEATURE This attribute be used by mmlGdcDispWinGetAttribute only It returns the available features for the given windows handle An application must use the features parameter of the MML GDC DISP WINDOW PROPERTIES structure to request a window feature when creating the window 11 5 5 Function Documentation 11 5 5 1 MM ERROR mmliGdcDispCloseDisplay MML DISPLAY display Close a display and all windows opened by this display By default this function is blocked until previous operations of device display are completely executed Use mmlGdcConfigSetAttribute set MML CONFIG ATTR DISPLAY NOBL
196. e PERFORM This function will not initiate any hardware updates Only the hardware resources are reserved for this window Updates are applied after the call mmlGdcDispWinCommit It is suggested to create windows in following order Window with feature MML DISP FEATURE DECODE Window with feature DISP FEATURE MULTI LAYER Window with feature MML_GDC_DISP_FEATURE_INDEX_COLOR or no feature Parameters display MML_GDC_DISPLAY returned from a previous call to mmlGdcDispOpenDisplay identifying the display to create the window on properties A pointer to an MML_GDC_DISP_WINDOW_PROPERTIES structure which specifies the properties of the window to create pWin Return values MML_OK On success will contain an MML_GDC_DISP_WINDOW On success MML_ERR_GDC_DISP_LAYER_ALREADY_USED if the specified layer is already in use MML_ERR_GDC_DISP_INVALID_ARG If an invalid argument was passed MML ERR DISP FAILED If internal error occurred MML ERR DISP BUSY If the writing to the device display or device window is denied because the previous commit open or destroy call is not completely executed e g shadow load request is pending Call again later 11 5 5 11 MM ERROR mmiGdcDispWinDestroy MML GDC DISP WINDOW win Used to destroy a window By default this function is blocked until previous operations of device display and
197. e Please note that the hardware manual uses a different wording compared to the software manual and The following table describes the different meaning Description Please note that the Pixel Engine defined in hardware manuel has a diffrent meaning See glossary PixEng Hardware manual naming Software manual naming Pixel Engine Pixel Engine PixENG The processing flow for the related operations are visualized in the following image Figure 4 7 Processing flow for blit operations Default elements Optional elements b DST Surface connected DST Surface connected and ROP uses DST MASK Surface connected MASK Surface connected and ROP uses MASK Example The following images are used Surface 2 color Surface 2 alpha A Surface 3 alpha A channel Surface 1 color channels RGB channels channel A A blit operation will show the following result depending on the bounded surfaces 21 September 11 2015 56 20 AN709 00022 1v0 E sd P CYPRESS APPLICATION NOTE PERFORM Operation Copy Blend Operation Blend with external alpha STORE Surface 1 STORE Surface 1 Bound STORE Surface 1 SRC Surface 2 SRC Surface 2 surfaces SRC Surface 2 DST Surface 1 DST Surface 1 MASK Surface 3 Result All geometry related settings like translation scaling or mirroring can be calculated using matrices Each source surface can get
198. e Tutorial Simple Drawing shows how complex features can be realized in software by combining simple hardware features The Tutorial Utility Library collects some functions used in different tutorials 36 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE F CYPRESS PERFORM 6 5 Tutorial 1 Surfaces Blit Display Basic 6 5 1 6 5 2 6 5 3 Description This is a very simple start up application to show the usage SURFACE and MML GDC PE CONTEXT A surface is required to perform operations in the blit and display path Please note Although all APIs use a SURFACE parameter you need to declare MML GDC SURFACE CONTAINER objects and use the pointer to these objects for all APIs It holds the following information Buffer dimension Memory address of the pixel data Color format and optionally Compression format and parameter Color look up table parameters Chapters MML SURFACE Initialization Fill with constant color simple black and white image Asimple auto generated pattern Blending two surfaces Bring it to the display NOORONS MML_GDC_SURFACE 6 5 3 1 Color format The color format defines the color depth bits per pixel for each color channel red green blue alpha A lot of common color formats are pre defined for example MML_GDC_SURF_FORMAT_R8G8B8A8 32 bits per pixel 8 bits for each channel
199. e callback function will no longer be called Return values MMD OK on success Otherwise the related error code 11 9 Error Reporting API Error Reporting API Error Reporting for selected modules and level Typedefs typedef void MM PRINTFUNCTION const char string Enumerations enum MM ERP MESSAGE LEVEL MM LEVEL NOTHING 00 MM ERP LEVEL ERROR MM LEVEL WARNING MM ERP LEVEL INFO enum ERP MESSAGE CHANNEL PROP MM CH OFF 00 MM CH ON enum MM MESSAGE 8 MM CH STDOUT 00 MM CH BUFFER Functions MM ERROR mmlGdcErpSetMessageLevel MM 032 moduleld MM ERP MESSAGE LEVEL level MM ERROR mmlGdcErpSetMessageChannel MM ERP MESSAGE DEST dest MM ERP MESSAGE CHANNEL PROP prop MM ERROR mmlGdcErpSetBuffer MM ADDR bufferAddr MM 032 bufferSize MM ERROR mmlGdcErpSetPrintf MM PRINTFUNCTION print function Module Id s The error reporting level can be set per module id Note kernel modules are covered by the corresponding user module define MM MODULE ID ALL USER MM MODULEID 0x2100FFFFU define MM MODULE ID SURFMAN USER MM MODULEID 0x21000000U define MM MODULE ID DISP USER MM MODULEID 0x21001000U define MODULE ID IRIS USER MM MODULEID 0x21003000U define MM MODULE ID SYNC USER MM MODULEID 0x21005000U September 11
200. e used to wait for last sync condition incr This must only be used for sync sources that increment the sync counter in a known fashion e g display controller VSync Parameters Sync object for which to increment the sync counter Sync counter increment Parameter must be 32768 lt incr lt 32767 Return values MML OK Success MML ERR GDC SYNC INVALID Sync object not valid MML ERR SYNC INVALID PARAMETER Invalid parameter 11 7 3 2 MM ERROR mmlGdcSyncReset MML SYNC sync Reset all parameters of the sync object Parameters Return values MML OK On success Otherwise the related error code 11 7 3 3 MM ERROR mmlGdcSyncWait MML SYNC sync MM S32 timeout Waits for a sync object to be signaled Parameters in Sync Sync object to wait for getting signaled in timeout This parameter MUST be 0 for S6E2D Return values MML OK Success MML ERR GDC SYNC INVALID PARAMETER Invalid parameter MML ERR GDC SYNC INVALID Sync object not valid MML ERR GDC SYNC TIMEOUT Sync object is not signaled 142 S6E2DH 709 00022 1 0 September 11 2015 CE APPLICATION NOTE F CYPRESS PERFORM 11 8 2D Core Interrupt Controller API 2D Core Interrupt Controller handler functions Macros define IRIS STORE9 FRAMECOMPLETE IRQ CP 10 define IRIS EXTDSTO FRAMECOMPLETE CP
201. e with index width 8 it means that each commit of a window with the same layer id can trigger the swap and the window with the indexed surface will sometimes show the correct and sometimes wrong colors To avoid this problem the application must commit a surface with a new palette twice The two times commits ensure that the shadow palette is filled with the correct color table In practice the application may call 2 times mmlGdcDispWinCommit directly In this case the CPU will be blocked until the first commit is taken over by the hardware when a new display frame is started If blocking is not acceptable the application must take care that the next render loop calls the mmlGdcDispWinCommit for this window As Soon as the application changes properties for this window e g change global transparency for fading the mmlGdcDispWinCommit call is anyway necessary 32 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE XP CYPRESS 5 Glossary Name PERFORM Description Basic Graphics Term to summarize the functions of the Graphics driver that use the 2D Graphics hardware Used to differentiate it from other graphics functions like OGL if supported by the hardware Blend Operation Blend Operation stands for a calculation of output pixels depending on the color and alpha information of 2 input pixels bpp bpp stands for bit per pixel and describes how many bits are required to define
202. eDriver 0 UTIL SUCCESS ret utMmanReset Allocate some of VRAM for Instruction buffer for the command sequencer Note that mmlGdcVideoAlloc is an application defined routine to manage the VRAM space The 2D core driver does not include any management of the VRAM vinstrBuffer mmiGdcVideoAlloc fifo size 0 NULL UTIL SUCCESS ret mmlGdcSysSetlnstructionBuffer vInstrBuffer fifo size Setup and enable the display UTIL SUCCESS ret mmlGdcDispOpenDisplay amp dispParams amp display windowProp topLeftX dispParams xResolution BGR WIDTH 2 windowProp topLeftY dispParams yResolution BGR HEIGHT 2 windowProp width BGR WIDTH windowProp height HEIGHT windowProp layerld MML DISP LAYER 0 Create a window and assign it as layer 0 September 11 2015 S6E2DH_AN709 00022 1v0 E 69 CYPRESS APPLICATION NOTE PERFORM UTIL SUCCESS ret mmlGdcDispWinCreate display amp windowProp amp win Allocate our buffers for i 0 i lt BUFFER COUNT i UTIL_SUCCESS ret mrmlGdcSmResetSurfaceObject amp target c i target i amp target_c i UTIL_SUCCESS ret utSurfCreateBuffer target i windowProp width windowProp height MML_GDC_SURF_FORMAT_R5G6B5 utResetContext amp utCtx Load a font bitmap mmlGdcSmGenSurfaceObjects 1 amp sFont UTIL SUCCESS ret utSurfLoadBitmap sFont courier 12 MM FALSE Set
203. eate display amp winprop amp wMap sFrame winprop topLeftX 0 winprop topLeftY 0 winprop width dispParams xResolution horizontal display resolution winprop height dispParams yResolution vertical display resolution winprop features MML DISP FEATURE MULTI LAYER use multi layer feature to get more windows winprop layerld MML DISP LAYER 1 use layer 1 winprop sub layerld MML DISP SUB LAYER DEFAULT sub layer default means the driver will assign the sub window order The first opened window is the bottom most UTIL SUCCESS ret mmlGdcDispWinCreate display amp winprop amp wFrame sPosition winprop topLeftX CENTER_X 16 winprop topLeftY CENTER_Y 16 winprop width 32 winprop height 32 winprop features MML_GDC_DISP_FEATURE_MULTI_LAYER winprop layerld MML_GDC_DISP_LAYER_1 UTIL SUCCESS ret mmlGdcDispWinCreate display amp winprop amp wPosition sArrow winprop topLeftX 30 winprop topLeftY 25 winprop width 50 winprop height 50 winprop features MML GDC DISP FEATURE MULTI LAYER winprop layerld MML DISP LAYER 1 UTIL SUCCESS ret mmlGdcDispWinCreate display amp winprop amp wArrow The following sections describe how these surfaces are used in this example 46 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE 6 6 4 Layer The map will be assigned t
204. ed e g shadow load request is pending Call again later MML ERR DISP BUSY 11 5 5 7 MM ERROR mmlGdcDispSetAttribute MML DISPLAY display MML GDC DISP ATTR pname MM U32 param Sets the attribute pname to param display specify for which display controller the attribute should be set Note This setting will not be active immediately Use mmlGdcDispCommit to submit for processing Parameters display An MML DISPLAY returned from a previous call to mmlGdcDispOpenbDisplay pname Parameter name See MML GDC DISP ATTR for valid values param Value to set for parameter pname September 11 2015 S6E2DH_AN709 00022 1v0 E 111 P CYPRESS APPLICATION NOTE PERFORM Return values On success MML OK If one of the parameters is invalid MML ERR GDO DISP INVALID ARG 11 5 5 8 MM ERROR mmlGdcDispSyncVSync MML DISPLAY display MML GDC SYNC sync MM S32 vsyncCnt Initializes the sync object sync to get signaled after vsyncCnt VSync s have happened The VSync is taken from the display controller specified by display Parameters An MML DISPLAY returned from a previous call to mmlGdcDispOpenDisplay display Sync Sync object to initialize with the sync condition Number of VSync s to elapse until the sync object gets signaled Parameter must be vsyncCnt Ox7FFFFFFF lt vsyncCnt lt Ox7FFFFFFF Return
205. ed Description Data type used to program timing controller TCON registers 12 14 2 Field Documentation 12 14 2 1 MM U32 address Address of the TCON register 12 14 2 2 MM 032 value Value of the TCON register The documentation for this struct was generated from the following file display h 12 15 MML DISP WINDOW PROPERTIES Struct Reference include lt display h Data Fields MML DISP OUTPUT SCREEN outputScreen MM 032 topLeftX MM 032 topLeftY MM 032 width September 11 2015 S6E2DH_AN709 00022 1v0 E 231 Z SSF CYPRESS APPLICATION NOTE 932 height DISP LAYER layerld MM U32features MML DISP SUB LAYER sub layerld 12 15 1 Detailed Description Data type used to specify window creation parameters 12 15 2 Field Documentation 12 15 2 1 MM 032 features Features requested by the layer the related parameter can be a bit field combination of MML DISP FEATURE INDEX COLOR DISP FEATURE DECODE DISP FEATURE MULTI LAYER 12 15 2 2 MM U32 height Height of the window 12 15 2 3 MML GDC DISP LAYER layerld Layer to use for the window see MML GDC DISP LAYER 12 15 24 MML DISP OUTPUT SCREEN outputScreen Which output screen should the window be created on 12 15 2 5 MML GDC DISP SUB LAYER sub layerld Sub Layer to use for for windows with feature MML GDC
206. ed that the CPU must also have access to the VRAM Flash Memory Program code and image data are typically read from embedded or external flash memory In most of the example applications the embedded flash is used for code and external hyper flash for data used by the graphics engine RES SECTION This is accomplished by a linker directive see flash resource h 26 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE 4 8 4 Physical Address Virtual Address In this document in particular in the Surface API description the terms Virtual Address and Physical Address are used For S6E2D devices the physical and virtual address of a register or memory block are identical because the hardware does not contain a Memory Management Unit Such a Memory Management Unit is typically used by complex operating systems to assign different applications or drivers individual virtual memory ranges different from the real physical addresses If the 2D Graphics Driver is used in such a system an address type differentiation and translation is required and therefore the driver partly supports both types Because the 2D Graphics Driver was developed using a software model of the 2D core that requires a differentiation of physical and virtual address some tutorial examples use an address translation macro The macro does not change the address for the final 2D Graphics Driver 4 9 Coordinate System Hints Driver APIs for
207. ed with the feature MML GDC DISP FEATURE INDEX COLOR Parameters An MML DISP WINDOW returned from a previous call to mmlGdcDispWinCreate The target where the surface is set to must be DISP BUFF TARGET COLOR BUFF Color buffer as target The MML GDC SURFACE object to show Return values MML OK On success MML ERR DISP INVALID If an invalid argument was passed 11 5 5 17 MM ERROR mmliGdcDispWinSync MML GDC DISP WINDOW win MML GDC SYNC sync Inserts a sync object into the window settings queue The sync object will be signaled after the preceding mmlGdcDispWinCommit has been processed Parameters AMML DISP WINDOW returned from a previous call to mmlGdcDispWinCreate Sync object After successful completion of mmlGdcDispWinSync it holds the parameter of the inserted sync Return values MML OK On success MML ERR DISP INVALID If one of the parameters is invalid 11 5 5 18 MM ERROR mmliGdcDispWinWaitSync MML GDC DISP WINDOW win MML GDC SYNC sync Inserts a sync wait into the window settings queue for win mmlGdcDispWinCommit operations performed after this call are only executed after sync gets signaled mmlGdcDispWinWaitSync shall only be called once before a call to mmlGdcDispWinCommit Parameters in win The window to apply the wait condition in Sync Sync object to wait for Return values MML OK On success MML E
208. eference include ut class window h Public Member Functions virtual MM ERROR Open MML DISPLAY display const void MM BOOL bCopyToVRAM MM FALSE MM 532 0 MM S32 y 0 MML DISP LAYER layeridZMML DISP LAYER 0 MML DISP SUB LAYER sub layerIDZMML DISP SUB LAYER DEFAULT 032 blend 0 216 S6E2DH_AN709 00022 1v0 E September 11 2015 CE d APPLICATION NOTE X CYPRESS 2 PERFORM virtual MM ERROR Open MML_GDC_DISPLAY display MML_GDC_SURFACE slmage 532 x20 S32 yz0 MML DISP LAYER layerldZMML DISP LAYER 0 DISP SUB LAYER sub 0 DISP SUB LAYER DEFAULT 032 blend mode 0 Additional Inherited Members 12 7 1 Detailed Description The Class CStaticSurfaceWindow uses a 2D core window showing a static image like a background image or a for instance sign as foreground layer 12 7 2 Member Function Documentation 12 7 2 1 virtual MM ERROR Open MML GDC DISPLAY display const void MM BOOL bCopyToVRAM MM FALSE MM 532 0 MM 532 0 MML DISP LAYER layerld MML DISP LAYER 0 MML DISP SUB LAYER sub layerlD MML GDC DISP SUB LAYER DEFAULT MM U32 blend mode 0 inline virtual Open the window and show an image Parameters display A display object that will be used to open the window plmage Pointer to an buffer
209. egrees aspect The ratio of width height zNear The near distance zFar The far distance September 11 2015 S6E2DH_AN709 00022 1v0 E 187 SE press APPLICATION NOTE 11 17 4 31 2D MATRIX void utMat4x4RotX Mat4x4 m MM Rotate a 4x4 matrix around the X axis Parameters The input output matrix The rotation angle in radians inout m in f 11 17 4 32 MML 2D MATRIX void utMat4x4RotY Mat4x4 m MM FLOAT Rotate a 4x4 matrix around the Y axis Parameters in out m The input output matrix in f The rotation angle in radians 11 17 4 33 2D MATRIX void utMat4x4RotZ 4 4 m MM FLOAT Rotate a 4x4 matrix around the Z axis Parameters inout m The input output matrix in f The rotation angle in radians 11 17 4 34 MML 2D MATRIX void utMat4x4Scale Mat4x4 m MM FLOATx MM FLOAT y MM FLOATz Modify 4x4 matrix to realize a scale operation The resulting matrix represents m m m scale Parameters The matrix to modify Scale factor in x direction Scale factor in y direction Scale factor in z direction MML GDC 2D MATRIX API void utMat4x4ToMat3x2 11 17 4 35 4 4 src Mat3x2dst Convert a 4x4 matrix to a 3x2 matrix S6E2DH 709 00022 1 0 September 11 2015 188 W Cypress APPLICATION NOTE Param
210. em id or O if it is the root item only one root item must be defined id ID of the inserted menu item flags One or more ored MENU FLAG s pszString Menu item string Return values MML OK On success Otherwise the related error code or MML ERR 12 5 3 10 virtual MM ERROR SetText const wchar t pszString inline virtual Do not use this function The documentation for this class was generated from the following file class menu h September 11 2015 S6E2DH_AN709 00022 1v0 E 215 B APPLICATION NOTE PERFORM 4 12 6 CMenultem Class Reference Public Types enum MENU ITEM FLAG MENU ITEM FLAG VISIBLE 0x1000 MENU ITEM FLAG FOCUS 0x2000 MENU ITEM FLAG CHECKBOX 0x100 MENU ITEM FLAG RADIO 0x200 MENU ITEM FLAG ISCHECKED 0x400 enum MENU ITEM FIND MENU ITEM FIND UP MENU ITEM FIND DOWN MENU ITEM FIND TOP MENU ITEM FIND BOTTOM MENU ITEM FIND PARENT MENU ITEM FIND SELECTED Public Member Functions U32 id U32 flag const wchar t pszString const wchar t GetString Data Fields m pSubltem CMenultem m pNextltem MM 032 id 032 m flag 916 width MM 008 m nTextOffset MM 008 m height Friends class CMenu The documentation for this class was generated from the following file class menu h 12 7 CStaticSurfaceWindow Class R
211. emory management 13 28 ut File Reference This sample code can be used to create a run length encoded buffer include mm types h include mm defines h Functions MM 032 utRidEncode 032 pixeldata MM 032 unWidth 032 unHeight MM 032 strideBytes 032 dataBpp 032 032 rldCount 13 28 1 Detailed Description This sample code can be used to create a run length encoded buffer 264 S6E2DH_AN709 00022 1v0 E September 11 2015 APPLICATION NOTE 14 Major Changes Page Section Change results Revision 1 0 Initial release September 11 2015 S6E2DH_AN709 00022 1v0 E 265 APPLICATION NOTE YPRESS PERFORM S6E2DH 709 00022 1 0 September 11 2015 266 APPLICATION NOTE d CYPRESS PERFORM 709 00022 1 0 Cypress e Application Note FM3 Family 32 BIT MICROCONTROLLER S6E2DH S6E2DF S6E2D5 S6E2D3 Series GRAPHIC DRIVER USER MANUAL September 2015 Rev 1 0 Published Cypress Semiconductor Corp Edited Communications Dept September 11 2015 S6E2DH_AN709 00022 1v0 E 267 CYPRESS APPLICATION NOTE PERFORM Colophon The products described in this document are designed developed and manufactured as contemplated for general use including without limitation ordinary industrial use general office use personal use and household use b
212. en MM 08 op blue 108 op alpha MML MM ERROR mmlGdcPeSetMatrix MML PE CONTEXT pectx 032 target PE GEO MATRIX FORMAT format const MM FLOAT fMatrix MML MM ERROR mmlGdcPeCLUTData PE CONTEXT pectx PE CLUT FORMAT format const MM 516 pRed const S16 pGreen const MM 516 pBlue MML PE API MM ERROR mmlGdcPeColorMatrix MML PE CONTEXT pectx PE CMATRIX FORMAT format const MM FLOAT fMatrix MML PE API MM ERROR mmlGdcPeGetDrawBox MML PE CONTEXT MM 032 x MM 032 y MM 032 032 MM 032 reset MML PE API MM ERROR mmlGdcPeActiveArea MML PE CONTEXT pectx MM 032 target S32 x MM S32 y MM 032 032 MML PE API MM ERROR mmlGdcPeSelectArea MML PE CONTEXT MM 032 target MML API MM ERROR mmlGadcPeFill MML PE CONTEXT pectx MM U32 x MM U32 y MM U32 w MM U32 h September 11 2015 S6E2DH_AN709 00022 1v0 E 253 2 CYPRESS 4 APPLICATION NOTE PERFORM MML PE API MM ERROR mmlGdcPeBIt MML PE CONTEXT pectx MM FLOAT offsetx MM FLOAT offsety API MM ERROR mmlGdcPeFinish void MM ERROR mmlGdcPeFlush void
213. eporting API Error Codes Basic Graphics Type Definitions Version Numbers Type Definition Macro Definition Tutorial Utility Library Utilities for the Memory Management Utility functions for matrix calculations Utilities for the compatibility with other drivers Utilities for the Surface Management Utilities for the compression Utilities for RLA run length adaptive compression Utilities for RLC run length compression Util class collection CCtx CDevice CDisplay CMenu CSurface CWindow 74 S6E2DH 709 00022 1 0 September 11 2015 CE APPLICATION NOTE F CYPRESS PERFORM 8 Hierarchical Index 8 1 Class Hierarchy This inheritance list is sorted roughly but not completely alphabetically RLAD BitStream CCtx CDevice CDisplay CMenultem CSurface lt NUM_BUFFERS gt CSurface lt 1 gt CTextWindow CMenu CWindow CSurfaceWindow lt NUM_BUFFERS gt CSurfaceWindow 1 gt CStaticSurfaceWindow RLAD Frame MML GDC DISP MODE LINE MML GDC DISP PROPERTIES MML GDC DISP TCON PROPERTIES MML GDC DISP WINDOW PROPERTIES MML GDC PE CONTEXT CONTAINER MML GDC SURFACE CONTAINER MML GDC SYNC CONTAINER MML SYSINIT INFO RLAD Package RLAD Frame Pixel RLAD September 11 2015 S6E2DH_AN709 00022 1v0 E 75 APPLICATION NOTE EZ CYPRESS d 9 Data Structure Index Data Structures Here are the data structures with brief descriptions 9 1 RLAD BitSt
214. er Initialization The Driver Initialization exposes functions to initialize and uninitialize the driver Configuration The Configuration allows changing or reading global graphics driver configurations or status information Surface API The Surface API provides all functions to manage memory blocks with image content called image buffer See also Surface Overview Display The Display API exposes all the hardware features of the display unit See also Display Overview Pixel Engine Pixel Engine PixEng API Synchronization Synchronization API Synchronization of framebuffer operations 2D Core Interrupt Controller 2D Core Interrupt Controller handler functions Error Reporting API Error Reporting API Error Reporting for selected modules and level Error Codes Error Codes of this driver Basic Graphics Type Definitions Version Numbers The Version numbers of this driver 11 1 1 Detailed Description This section collects all APIs of the driver The collection of APIs includes APIs for the access of the hardware units e g Displays Pixel Engine 2D Rendering APIs for services like driver initialization synchronization surface management configuration 11 2 Driver Initialization API The Driver Initialization exposes functions to initialize and uninitialize the driver Data Structures struct
215. eric usage of a surface object 14 S6E2DH 709 00022 1 0 September 11 2015 c LRL APPLICATION NOTE F CYPRESS y PERFORM Figure 4 1 Surface usage Create Surface Object Describe the surface Perform e surface Further actions required Yes Note Not all hardware blocks can operate with each surface format Please check the related description about the supported formats See Surface for details 4 4 Display Overview The 2D Graphics core has one display controller that can be connected to a screen in the following named Display The Display has a constant background color BG Color Up to 9 different frame buffers can be used to show content at individual rectangles called Windows on the display The Windows are arranged in a defined z order which is determined by the layer id and sub layer id specified in the properties of each window The display controller of the S6E2D device supports up to 2 layers One of them supports up to 8 sub layers It means it is possible to open 8 windows with the same layer id To use the sub layers the related window must be opened with the MML GDC DISP FEATURE MULTI LAYER feature request Windows that share the same layerld are called Multi Window up to 8 windows with identical layerld but with different sub layerlds also specified in the properties of each window Multi Windows that overlap cannot be September 11 2015 S6E2DH_AN709
216. error code 11 19 3 6 MM_ERROR utSurfReadBitmap MML_GDC_SURFACE surface void MM U32 baseAddr 032 clutAddr Read a bitmap structure in memory and set the related surface attributes Please note the surface object must be created before No memory will be allocated in this function The plmage pointer will be increased by the size of the whole image so it points to the next image object if further images are in the memory block Parameters surface The surface object plmage address of the pointer to the image baseAddr Pointer to get color buffer virtual base address clutAddr Return values Pointer to get clut buffer virtual base address MML OK on success otherwise the related error code 11 19 3 7 MM ERROR utSurfSetPixel MML GDC SURFACE src MM U32x MM U32y U08r UO8 g MM 008 b MM 008 Set the g b a pixel data of a surface at position x y The pixel with the coordinates 0 0 is the upper left pixel analoge to the the memory organisation of the memory buffer Please note that this is different to the glReadPixels specification Please note not all possible surface formates are supported Parameters The surface object x positon of the pixel y positon of the pixel New red value New green value New blue value Return values New alpha value MML OK Success otherwise the related error code
217. es the maximum size for the buffers No limitation the required buffer will be allocated Size in bytes the buffer will be created with MML GDC SURF COMP RLAD UNIFORM parameter and the allocated buffer size will be smaller or equal MaxSize Return values MML_OK on success Otherwise the related error code 11 28 2 3 MM_ERROR CreateBuffer const MM_U32 width const 032 height MM U32 bit red MM U32 bit green 032 bit blue MM U32 bit alpha virtual The CreateBuffer function can be used setup the member surface object s with allocated VRAM Parameters width Defines the with of the surface s height Defines the height of the surface s bit red Defines the bits for the red channel of the surface s bit Defines the bits for the green channel of the surface s bit blue Defines the bits for the blue channel of the surface s bit alpha Defines the bits for the alpha channel of the surface s Return values MML OK on success Otherwise the related error code 11 28 2 4 MM ERROR CreateGrayBuffer const MM U32 width const MM 032 height MM 032 bit color MM 032 bit alpha virtual The CreateBuffer function can be used setup the member surface object s with allocated VRAM Parameters width Defines the with of the surface s height Defines the height of the surface s bit color Defines the common bits for the red green and blue channel of
218. eters out dst The destination matrix in src The source matrix 11 17 4 36 2D MATRIX void utMat4x4ToMat3x3 Mat4x4 src Mat3x3dst Convert a 4x4 matrix to a 3x3 matrix Parameters out dst The destination matrix in SIC The source matrix 11 17 4 37 MML 2D MATRIX void utMat4x4Translate Mat4x4 m MM FLOAT x MM FLOAT y MM FLOATz Modify a 4x4 matrix to realize a move operation The resulting matrix represents m m m trans Parameters The matrix to modify Move dimension in x direction in out Move dimension in y direction Move dimension in z direction 11 17 4 38 MML 2D MATRIX void utMat5x4Loadidentity 5 4 Fill a 5x4 matrix with a unit matrix Parameters The matrix to modify 11 18Utilities for the compatibility with other drivers Enumerations enum UTIL VRAM CONFIG UTIL VRAM CONFIG VRAM ONLY Ox1U UTIL VRAM CONFIG SDRAM ONLY 0x2U UTIL VRAM CONFIG VRAM PREFERRED 0x3U Functions MM ERROR mmiGdcSmGenSurfaceObjects MM 032 uCnt MML SURFACE pSurfaces MM ERROR mmiGdcSmbDeleteSurfaceObjects MM 032 MML SURFACE pSurfaces 189 September 11 2015 56 20 AN709 00022 1v0 E 2 CYPRESS APPLICATION NOTE PERFORM MM ERROR mmlGdcPeGenContext MML PE CONTEXT void mmlGdcPeDeleteContext MML GDC PE CONTEXT pectx void mm
219. ettings MML GDC SURF ATTR CLUTMODE Color look up table mode must be one of SURF initial MML GDC SURF CLM NEUTRAL MML GDC SURF ATTR CLUTCOUNT Number of color look up table entries 0 255 initial 0 no color look up table MML GDC SURF ATTR CLUTBITPERPIXEL Size of one entry in bits 1 2 4 8 16 24 32 initial O MML GDC SURF ATTR CLUTCOLORBITS Color component size of one entry in bits OXRRGGBBAA initial 0 MML GDC SURF ATTR CLUTCOLORSHIFT Color component shift of one entry in bits OxRRGGBBAA initial 0 MML GDC SURF ATTR CLUTBUFFERADDRESS Virtual address of CLUT data initial 0 ML GDC SURF ATTR CLUTBUFFER PHYS ADDRESS Physical address of CLUT data initial 0 MML GDC SURF ATTR SURF FORMAT Macro attribute to set and get MML SURF FORMAT Note AmmliGdcSmSetAttribute call with the attribute MML SURF FORMAT will implicitly set the attributes MML BITPERPIXEL 5 ATTR COLORBITS and MML SUHF ATTR COLOHSHIFT A mmlGdcSmGetAttribute call with the attribute MML SURF SURF FORMAT will return the related color format if the same attributes match the FORMAT definition MML GDC SURF ATTR USERDEFINED User defined initial O September 11 2015 S6E2DH_AN709 00022 1v0 E 89 APPLICATION NOTE EZ CYPRESS 11 4 4 2 enum MML GDC SURF CLF
220. f 0 f lt 180 f 9 01 30 cosf f DegreeToPI 30 sinf f DegreeToPI UTIL_SUCCESS ret utLinef putCtx cx cy S Cy S px 80 utLineWidth putCtx 2 0f UTIL SUCCESS ret utTextOut putCtx MM S32 px MM S32 py Width 2 0 30 px cy 50 py for f 0 f lt 180 f 9 0f 30 cosf f DegreeToPI 30 sinf f DegreeToPI UTIL_SUCCESS ret utLinef putCtx cx cy S S return ret 72 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE 6 12 3 2 Drawpoints CYPRESS Draws 12 points with different sizes using the utility function Now paint for i 15 1 lt 12 i utPointSize putCtx MM_FLOAT i UTIL_SUCCESS ret utPoint putCtx 5 i 105 6 12 3 3 DrawSample This function draws a flower with different line widths and colors 6 12 3 4 DrawLineEnds Draws the end of the lines by combining line and point draw utility functions 6 12 3 5 DrawMix Draws some text lines and points with different colors or a brush September 11 2015 S6E2DH_AN709 00022 1v0 E 73 go CEN CYPRESS APPLICATION NOTE PERFORM 7 Module Index 7 1 Modules Here is a list of all modules Basic Graphics Driver Initialization Configuration API Surface API Display API Pixel Engine API Synchronization API 2D Core Interrupt Controller API Error R
221. f the mmlGdcPeSelectArea settings MM FALSE default disable CLIP feature TRUE enable clip feature Function Documentation 11 6 5 1 MML PE APIMM ERROR mmliGdcPeActiveArea MML PE CONTEXT 032 target MM S32 x MM S32 032 032 mmlGdcPeActiveArea defines the processing area for the surface that is bound to the specified target See also mmiGdcPeSelectArea and MML PE SURF ATTR USE CLIPPING The area is defined by lower left coordinate width and height The lower left coordinate is inside of processing area The upper right coordinate x w y h is outside of processing area Parameters must be x lt x w and y lt y h If x y is equal to 4096 function returns MML ERR PE INVALID PARAMETER If w and h are equal to 0 active area is disabled If x and are negative the color value is defined by mmlGdcPeSurfAttribute and MML SURF ATTR MODE If pectx is equal to NULL mmlGdcPeActiveArea is terminated without any operation Note Blit operations with a non default mmlGdcPeActiveArea setting may fail and report an error if buffers are involved with a bit per pixel size different to multiple of 8bit or YUV color format 128 S6E2DH 709 00022 1 0 September 11 2015 y I APPLICATION NOTE cypress a 741 354 PERFORM Parameters in out Pixel Engine context NULL in in Se
222. feature MML GDC DISP FEATURE DECODE was requested P 0 xof 0 1 yoffset A mirror matrix can be used for windows without the above features and MML GDC DISP FEATURE MULTI LAYER ira 0 2 0 1 yoffset Down scaling is not supported by display Not all of rotation angles are supported by display A rotation must be 0 90 180 or 270 degrees The extern alpha buffer cannot be scaled The buffer larger than window will be cut to fit the window size The YUV buffer cannot be cut to odd pixel width Parameters win MML DISP WINDOW returned from a previous call to mmlGdcDispWinCreate The target where the matrix is set to the related parameter must be target 9 MML DISP BUFF TARGET COLOR BUFF Color buffer as target matrix Transformation 3x2 matrix for scaling rotation and flip Return values MML OK On success Otherwise the related error code 116 S6E2DH_AN709 00022 1v0 E September 11 2015 APPLICATION NOTE 11 5 5 16 MM ERROR mmiGdcDispWinSetSurface MML DISP WINDOW win U32 target MML SURFACE surf Show the surface content on a previously opened window Note The function will not be executed immediately but will be queued together with other modifications of this window Use mmlGacDispWinCommit to submit for processing If the surface describes an indexed color format the driver will apply this color table to the hardware only if the window was creat
223. fined in the following order m 0 m 4 ml 8 m 12 m 1 m 5 ml 9 m 13 m 2 m 6 m 10 m 14 m 3 m 7 m 11 m 15 11 17 3 5 typedef MM FLOAT Mat5x4 20 Matrix with 5 columns and 4 rows for color operations with the G B Aor V A channels If m is Mat5x4 matrix type and G B Ain an input vector the resulting vector is m 0 m 4 m 8 m 12 m 16 R m 0 x R m 4 x G m 8 x B m 12 x A m 16 m 1 m 5 m 9 m 13 m 17 G m 1 x R m 5 x G m 9 x B m 13 x A m 17 m 2 m 6 m 10 m 14 m 18 B m 2 x R m 6 x m 10 x B m 14 x A m 18 m 3 m 7 m 11 m 15 m 19 A m 3 x R m 7 x m 11 x B m 15 x m 19 11 17 4 Function Documentation 11 17 4 1 MML 2D MATRIX void utMat3x2Copy Mat3x2 dst const Mat3x2 src Copy the matrix content to a new one 180 S6E2DH_AN709 00022 1v0 E September 11 2015 APPLICATION NOTE PERFORM Parameters out dst The destination matrix in src The source matrix 11 17 4 2 MML 2D MATRIX void utMat3x2GetXY const Mat3x2 m const MM FLOAT x const MM FLOAT y MM FLOAT MM FLOAT yout Calculate the target position for a given matrix and source position Parameters The matrix Source x position Source y position Pointer to the destination x position Pointer to the destination y position 11 17 4 3 MML 2D MATRIX U32 utMat3x2Invert Mat3x2m
224. for compression 12 22 2 Member Enumeration Documentation 12 22 2 1 enum Mode configuration Enumerator MODE RLAD UNIFORM Proprietary lossy with upper limit for compression rate Proprietary lossy with fixed compression rate MODE RLA Proprietary lossless MODE RL Standard RL format according to TGA spec for backward compatibility 12 22 3 Member Function Documentation 12 22 3 1 unsigned bpp const inline return sum of component bpp 12 22 3 2 unsigned buffer size const calc buffer size 12 22 3 3 unsigned cbpc width unsigned i const inline bit width of cbpc fields in package headers September 11 2015 S6E2DH_AN709 00022 1v0 E 237 2 CYPRESS APPLICATION NOTE d Mi PERFORM 12 22 3 4 unsigned cbpp max const inline return sum of compressed component bpp 12 22 3 5 unsigned cnt width const inline return max bit size 12 22 3 6 double compression rate const inline Return compression rate 12 22 3 7 unsigned cwrap unsigned i const inline return component size 12 22 3 8 bool Decode BitStream amp bs Frame amp f Decode image Parameters in bs BitStream class containing the compressed data out f Store the uncompressed image Return values True if successful otherwise false 12 22 3 9 bool Encode Frame amp f BitStream amp bs Encode image Parameters in f Uncompressed image out bs BitStream class storing the compressed da
225. ge NUM C unsigned start NUM C unsigned prev NUM C intdmin NUM C intdmax NUM C 12 20 1 Detailed Description Helper structure for RLA compression 12 20 2 Field Documentation 12 20 2 1 unsigned cbpc NUM C bits per compressed component 12 20 2 2 unsigned cbpp bits per compressed pixels 12 20 2 33 RLAD Reference 12 20 2 4 unsigned cofs NUM C offset package 12 20 2 5 bool delta package type 12 20 2 6 unsigned pcnt pixel count 12 20 2 7 unsigned size package size in bits 12 20 2 8 unsigned start NUM C delta package The documentation for this struct was generated from the following file class rlad h September 11 2015 S6E2DH_AN709 00022 1v0 E 235 2 12 21 RLAD Frame Pixel Struct Reference CYPRESS APPLICATION NOTE PERFORM include lt ut_class_rlad h gt Data Fields unsigned col NUM C 12 21 1 Detailed Description Helper structure to store one pixel 12 21 2 Field Documentation 12 21 2 1 unsigned col NUM C array with bit size for all components The documentation for this struct was generated from the following file ut class rlad h 12 22 Class Reference include ut class rlad h Data Structures class BitStream class Frame struct Package Public Types enum NUM C 4 enum 8 enum RLAD 8 enum RLA 32 enum Mode MODE RLA
226. ge buffer for indexed images can use different sizes Depending on the bit width of the index pointer the image can store a defined maximum of different colors Beside the index pointer the image buffer may also contain alpha bits The sum of alpha and index bits must be 1 2 4 16 24 or 32 The index bits must start at bit position O The following table shows some possible pixel buffer color formats for indexed images Only the size of red channel in a surface defines the index width The green and blue channel definition is not used for such images Therefore a short format RGB8 is equivalent to 8 bit index Maximum of Short format Bit per pixel Index bits Alpha bits ce Use case visible colors Images without per pixel alpha a maximum RGB8 256 of 256 different colors Images with 16 colors only please note the palette may include an alpha bit too That s why is a possible use case to address 15 visible colors and 1 transparent color Images with per pixel alpha and a maximum of A8RGB8 256 different colors Images with 8 levels of transparency alpha A3RGBS g y alpha and a maximum of 32 different colors RGB1 All images with only 2 different colors 4 11 3 Color table The color table can store up to 256 different colors Each entry defines the RGB and optionally the alpha value The maximum number of bits to store these values are 24 bit per entry Therefore supported
227. ground surface on background layer UTIL SUCCESS ret mmlGdcDispWinSetSurface s winBgr MML GDC DISP BUFF TARGET COLOR BUFF amp s sBgr UTIL SUCCESS ret mmlGdcDispWinCommit s winBgr Now we create a layer for the hub and needle We need a buffer with an alpha channel because the layer blending should only pass the needle and hub All other parts must have an alpha 0 value so that they are not visible Create a window for needle layer windowProp layerld MML DISP LAYER 1 UTIL SUCCESS ret mmlGdcDispWinCreate s display amp windowProp amp s winNeedle UTIL SUCCESS ret mmlGdcDispWinSetBlendMode s winNeedle MML GDC DISP BLEND SOURCE ALPHA UTIL SUCCESS ret mmlGdcPeResetContext amp s Create a target surface for the needle This is the focus layer for this demonstration UTIL SUCCESS ret mmlGdcSmResetSurfaceObject amp s sNeedle UTIL SUCCESS ret utSurfCreateBuffer amp s sNeedle WIDTH BGR HEIGHT MML SURF FORMAT R6G6B6 September 11 2015 S6E2DH_AN709 00022 1v0 E 53 ies P CYPRESS APPLICATION NOTE PERFORM 6 8 5 Matrix operations to scale rotate and translate images All geometry changes such as translation rotation sharing scaling and mirroring in the blit path are based on matrix settings The application can calculate such matrices on its own or by using the utility functions from the driver The x y offset in the mmlGdcPeBlt func
228. har CHAR typedef float FLOAT typedef double MM DOUBLE typedef int BOOL typedef unsigned int MM ADDR typedef S32 MM ERROR typedef MM S32 MM MODULE 11 13 1 Detailed Description 11 13 2 Typedef Documentation 11 13 2 1 typedef unsigned int MM ADDR physical memory address 11 13 2 2 typedef int MM BOOL boolean 11 13 2 3 typedef char MM CHAR string character 11 13 2 4 typedef double MM DOUBLE 64 bit IEEE float 168 S6E2DH 709 00022 1 0 September 11 2015 PERFORM APPLICATION NOTE 11 13 2 5 typedef MM S32 MM ERROR function return code 11 13 2 6 typedef float MM FLOAT 32 bit IEEE float typedef MM S32 MM MODULE 11 13 2 7 module id 11 13 2 8 typedef signed char MM 508 signed 8 bit integer 11 13 2 9 typedef signed short MM S16 signed 16 bit integer 11 13 2 10 typedef signed int MM S32 signed 32 bit integer 11 13 2 11 typedef signed long long MM S64 signed 64 bit integer 11 13 2 12 typedef unsigned char 008 unsigned 8 bit integer 11 13 2 13 typedef unsigned short MM 016 unsigned 16 bit integer 11 13 2 14 typedef unsigned int MM U32 unsigned 32 bit integer 11 13 2 15 typedef unsigned long long MM 064 unsigned 64 bit integer 169 September 11 2015 56 20 AN709 00022 1v0 E d CYPRESS APPLICATION NOTE PERFORM 11 14 Macro Definition Macros define ERRCODE err ERROR err
229. he arrow and the position will be Code Description realized as multi layer windows which means that they cannot be blended to each other but they can be Map Layer blended to the map background window using different properties The multi layer windows can overlap too Chapters Frame Layer Position Layer aR ono Arrow Layer 6 6 3 Code Description is a simple error handling helper We start with driver initialization and setup of the display The macro UTIL SUCCESS used this example Initialize the driver UTIL SUCCESS ret 44 mmlGdcSyslnitializeDriver 0 UTIL_SUCCESS utMmanReset S6E2DH_AN709 00022 1v0 E September 11 2015 APPLICATION NOTE Allocate some of VRAM for Instruction buffer for the command sequencer Note that mmlGdcVideoAlloc is an application defined routine to manage the VRAM space The 2D core driver does not include any management of the VRAM vinstrBuffer mmiGdcVideoAlloc fifo size 0 NULL UTIL SUCCESS ret mmlGdcSysSetlnstructionBuffer vInstrBuffer fifo size Setup and enable the display UTIL SUCCESS ret mmlGdcDispOpenDisplay amp dispParams amp display Reset the surfaces to apply default values UTIL SUCCESS ret mmlGdcSmResetSurfaceObject sFrame UTIL SUCCESS ret mmlGdcSmResetSurfaceObject sMap UTIL SUCCESS ret mmlGdcSmResetSurfaceObject sPosition UTIL SUCCESS ret mmlGdcSmResetSurfaceObject sArrow We load the s
230. he display controller This example uses a single full screen buffer splitted into an upper and a lower part It is also possible to divide the screen resolution by using smaller windows Using different windows is the preferred version because it allows to render a window one time per frame However the size and position of the windows must fit the memory scan order for the panel Typical panels are landscape panels that means the windows must be arranged vertical For a single buffer window solution the render function must ensure that only parts of the buffer a updated This can be realized by using the STORE clipping function of the driver To use partial rendering we switch on clipping and set the rectangle mmlGdcPeSurfAttribute s PE STORE MML PE SURF ATTR USE CLIPPING MM TRUE mmlGdcPeActiveArea s MML PE STORE 0 start s win GetWidth lines This code ensures that all mmlGdcPeBIt calls never write pixels to the target buffer below line start or above start lines In some cases the driver will detect that a blit operation for the upper part does not affect any pixels in the clipped target buffer The driver will generate a warning in this case and does not trigger any operation in the HW Note Please remember the default zero point for blit operations is the lower left corner of the buffer To render the whole frame we need to call our render function 2 times a
231. he timing controller registers TCON is only supported by display controller 0 MML DISP CONTROLLER 0 12 13 2 Field Documentation 12 13 2 1 MM U32 countTconProps Number of TCON registers to be programmed Must be zero if no TCON is used Must be O if it is not display controller O 12 13 2 2 MML DISP MODE displayMode Single screen dual screen or dual view 12 13 2 3 MM 032 Set to a non zero value to have the driver use the modeLine settings specified by modeLine 12 13 2 4 MML DISP MODE LINE modeLine Custom display timing information 12 13 2 5 MML DISP CONTROLLER _ outputController Must be MML DISP CONTROLLER 0 12 13 2 6 MML DISP TCON PROPERTIES pDISP TCON PROPS Pointer to TCON register value structure array Must be NULL if no TCON is used Must be NULL if it is not display controller O 230 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE PERFORM 12 13 2 7 032 refreshRate Refresh rate in Hz 60 75 85 etc 12 13 2 8 MM 032 xhResolution Horizontal resolution 640 800 1024 etc 12 13 2 9 MM 032 yhResolution Vertical resolution 480 600 768 etc The documentation for this struct was generated from the following file display h 12 14MML DISP TCON PROPERTIES Struct Reference include lt display h Data Fields MM 032 address MM U32 value 12 14 1 Detail
232. in src The destination matrix The source matrix 11 17 4 14 MML 2D MATRIX void utMat3x3Loadidentity Mat3x3m Fill a 3x3 matrix with a unit matrix Parameters The matrix to modify 183 September 11 2015 56 20 AN709 00022 1v0 E APPLICATION NOTE md 2 218 MML 20 MATRIX void utMat3x3Multiply Mat3x3 11 17 4 15 dst const Mat3x3 src1 const Mat3x3 src2 Multiply 2 3x3 matrices The resulting matrix represents dst src1 src2 Parameters out dst The destination matrix in src The first source matrix in src2 The second source matrix 1117416 2D MATRIX void utMat3x3RotX Mat3x3 m MM Rotate 3x3 matrix around the X axis Parameters The input output matrix inout m The rotation angle in radians in f 11 17 4 17 MML 2D MATRIX void utMat3x3RotZ Mat3x3 m MM FLOAT Rotate a 3x3 matrix around the Z axis Parameters The input output matrix The rotation angle in radians in out f 11 17 4 18 MML 2D MATRIX void utMat3x3Scale Mat3x3 m MM FLOAT x MM FLOATy Modify a 3x3 matrix to realize a scale operation The resulting matrix represents m m scale Parameters The matrix to modify Scale factor in x direction Scale factor in y direction 1117419 2D MATRIX void
233. in the store surface If there is a MASK surface by default MASK buffer alpha channel is read as extern alpha value of SRC surface If one of the ROP modes uses the MASK surface the extern alpha path of the SRC surface will be switched off and the MASK surface is the input of ROP operation The required ROP mode can be calculated by the following table surface DST MASK 5 output STORE 0 0 0 0 0 0 1 1 0 1 0 0 0 1 1 1 1 0 1 1 1 1 1 Operation index 0x5B Some useful ROP modes are predefined in the define section of this file see PE Parameters pectx Pixel Engine context NULL op red ROP3 operation code for red component default MML GDC PE ROP SRCCOPY Op green ROP3 operation code for green component default MML SRCCOPY op blue ROP3 operation code for blue component default MML GDC PE ROP SRCCOPY September 11 2015 S6E2DH_AN709 00022 1v0 E 137 md fe APPLICATION NOTE SF PERFORM op_alpha operation code for alpha component default MML_GDC_PE_ROP_SRCCOPY Return values MML_OK On success Otherwise the related error code 11 6 5 16 MML MM ERROR mmlGdcPeSelectArea CONTEXT 032 target mmlGdcPeSelectArea defines which surfaces are used to calculate the processing area default mmlGdcPeBlt function processes rectangle in store surface defined by the acti
234. ine Return the menu item on success Otherwise NULL 12 5 3 6 MM U32 GetDefautltemHeight Return values 12 5 3 7 int HandleKey MM U32 key inline Progress the key press input for instance select the lower menu item if key down was pressed S6E2DH 709 00022 1 0 September 11 2015 Parameters 214 y APPLICATION NOTE cypress gt PERFORM Return values The function return The original key code if no action inside the menu was proceed 0 if an action was proceeded e g selection changed Or the selected menu item id if the menu was opened and the enter key was pressed 12 5 3 8 MM ERROR InitMenu const void Font int size of font int font height MML PE CONTEXT draw 0 inline Initialize the menu Parameters Font Define the tt font for the menu if size of font 0 it defines the location in the file system if size of font 0 it is the pointer to the font buffer with a size of size of font size of font See font parameter font height Define the requested font height in pixel draw ctx Initialized draw context objec t Return values MML OK On success Otherwise the related error code or MML ERR 12 5 3 9 MM ERROR Insert MM U32 old id MM U32 id MM 032 flags const wchar t 525 inline Insert a menu item to the menu Parameters old id ID of the parent menu it
235. ions MML API MM ERROR mmlGdcPeResetContext MML PE CONTEXT pectx MML API MM ERROR mmlGdcPeBindSurface MML PE CONTEXT MM 032 target SURFACE surface MML API MM ERROR mmlGdcPeAttribute MML PE CONTEXT pectx PE CTX ATTR pname MM 032 param MML MM ERROR mmlGdcPeColor MML PE CONTEXT pectx MM 008 red MM 008 green MM UO08 blue 1 08 alpha MML PE API MM ERROR mmlGdcPeSurfAttribute MML PE CONTEXT MM 032 target PE SURF pname 032 param MML MM ERROR mmlGdcPeSurfColor MML PE CONTEXT pectx MM 032 target MM UO08 red 008 green 008 blue MM_U08 alpha MML MM ERROR mmlGdcPeBlendFunc MML PE CONTEXT PE BF func red src MML PE BF func red dst MML PE BF func green src MML GDC PE BF func green dst MML GDC PE BF func blue src PE BF func blue dst MML PE BF func alpha src MML func alpha dst MML PE API MM ERROR mmlGdcPeBlendMode MML PE CONTEXT PE BM mode MML BM mode green MML PE BM mode blue PE BM mode alpha MML PE API MM ERROR mmlGdcPeRopOperation MML PE CONTEXT MM 008 op red UO08 op gre
236. ions 13 10 display h File Reference Display 246 S6E2DH_AN709 00022 1v0 E September 11 2015 APPLICATION NOTE include mm types h include surfman h include sync h include Data Structures struct MML_GDC_DISP_MODE_LINE mm_gdc_errors h struct MML_GDC_DISP_TCON_PROPERTIES struct MML_GDC_DISP_PROPERTIES struct Macros Layer feature request define MML_GDC_DISP_FEATURE_INDEX_COLOR 1 lt lt 0 define MML_GDC_DISP_FEATURE_DECODE 1 lt lt 1 define MML_GDC_DISP_FEATURE_MULTI_LAYER 1 lt lt 7 Buffer target define MML GDC DISP MML_GDC_DISP_WINDOW_PROPERTIES BUFF_TARGET_COLOR_BUFF 1 lt lt 1 Blend modes define MML GDC DISP BLEND_NONE 0 define MML GDC DISP BLEND_TRANSPARENCY 10 lt lt 0 define MML GDC DISP BLEND GLOBAL ALPHA 1U lt lt 1 define MML GDC DISP BLEND SOURCE ALPHA 1U 2 define MML GDC DISP BLEND SOURCE MULTIPLY ALPHA 1U 4 Polarity control define MML GDC DISP HSYNC LOW 0 define MML GDC DISP HSYNC HIGH 1U 0 define MML GDC DISP VSYNC_LOW 0 define MML GDC DISP VSYNC HIGH 1U lt lt 1 define MML GDC DISP DE_LOW 0 define MML GDC DISP DE HIGH 1U lt lt 2 define MML GDC DISP RGB_LOW 0
237. itiate many fill and blit commands in a series without having to wait for completion of these commands The graphics hardware starts operating in parallel typically it requires more time to process the pixels than to setup the processing by the CPU W Windows All graphics hardware layers are represented as Windows in the driver and handled as separate processing units Changing properties like the frame buffer address of a window must be committed using mmlGdcDispWinCommit The new properties become active with the next frame start on the display A commit instruction may block the CPU if the previously called mmlGdcDispWinCommit is not yet active in the HW That means if two calls of mmlGdcDispWinCommit are called one after the other the second call will be blocked until the next frame start This behavior can be changed using the ATTR DISPLAY NOBLOCK attribute mmlGdcConfigSetAttribute or by using the driver synchronization W Display The display more precisely display controller is also handled as a separate unit 4 6 2 Synchronization The Synchronization API provides mechanisms to synchronize the processing blocks This is done through sync objects A sync object describes a sync condition e g a certain image buffer operation that has to be completed Sync objects are managed through the Synchronization API which provides functions to reset sync objects and to wait for a sync condition to bec
238. ive if MML DISP DITHON is set Dithering improves the display images if the display has less color levels than the original picture The number of bits per pixel is lowered from the original value e g RGB888 to RGB666 with MML DISP DITHER106 The value of lower bits are randomly round up or down based on location of the pixel in the frame MML GDC DISP SPATDITH Or a random vector is generated to address the dither matrix MML GDC DISP TEMPDITH Note x This setting will not be active immediately Use mmlGdcDispCommit to submit for processing Parameters display MML DISPLAY returned from a previous call to mmlGdcDispOpenDisplay Enable Dithering enable z MML_GDC_DISP_DITHOFF Disable dithering MML_GDC_DISP_DITHON Enable dithering Select mode for dithering MML_GDC_DISP_TEMPDITH Temporal dithering MML_GDC_DISP_SPATDITH Spatial dithering Sets dither range MML GDC DISP DITHRS11LOW adds Os to lower bits Select output format for dithering MML DISP DITHER108 10x10x10 gt 8x8x8 format MML DISP DITHER107 10x10x10 gt 7x7x7 MML DISP DITHER106 10x10x10 gt 6x6x6 DISP DITHER105 10x10x10 gt 5x6x5 Return values MML OK On success MML ERR DISP INVALID If an invalid argument was passed 110 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE 11 5 5 5 MM ERROR mmlGdcDisp
239. lGdcPeColorMatrix PE CONTEXT pectx PE CMATRIX FORMAT format const MM FLOAT API MM ERROR mmlGdcPeGetDrawBox MML PE CONTEXT pectx MM 032 x 032 032 032 MM U32 reset PE API MM ERROR mmlGdcPeActiveArea MML CONTEXT pectx MM 032 target MM S32 x MM S32 y 032 032 PE API MM ERROR mmlGdcPeSelectArea MML PE CONTEXT pectx MM 032 target API MM ERROR mmlGdcPeFill MML PE CONTEXT 032 x MM 032 y MM 032 MM 032 h 120 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE MML PE API MM ERROR mmlGdcPeBIt MML PE CONTEXT pectx MM FLOAT offsetx MM FLOAT offsety MML API MM ERROR mmlGdacPeFinish void MML MM ERROR mmlGdcPeFlush void MML PE API MM ERROR mmlGdcPeSync MML SYNC sync MML PE API MM ERROR mmlGdcPeWaitSync MML SYNC sync MM ERROR mmlGdcPeWaitForDispFrameEnd MML DISPLAY display 032 line 11 6 1 Detailed Description Pixel Engine PixEng API include gdc pixeng h The pixel engine provides all functions for blit operations using the pixel engine 2D core blit hardware As mentioned in the Overview Pixel Engine PixEng it requires MML GDC SURFACE objects to de
240. lOsLibcMalloc size_t Size void mmlOsLibcFree void Memory MM ERROR mmlGdcVideoConfig UTIL VRAM CONFIG config void mmlGdcVideoAlloc MM 032 size 032 alignment MM pAddr void mmlGdcVideoFree void addr MM ERROR mmlGdcVideoGetSize MM 032 size MM ERROR mmlGdcVideoGetFreeTotal MM 032 size MM ERROR mmlGdcVideoGetLargestBlock MM 032 size MM ERROR mmlGdcSyncCreate 032 uCnt MML SYNC pSyncObjects MM ERROR mmlGdcSyncDelete MM 032 uCnt MML SYNC pSyncObjects 11 18 1 Detailed Description The functions of this group are used in some samples to make the application code identical to other 2D core based devices For instance the mmlGdcSmGenSurfaceObjects function is not available in this driver API for this hardware because system memory allocation is not allowed 11 18 2 Enumeration Type Documentation 11 18 2 1 enum UTIL VRAM CONFIG Configuration of video memory manager This defines the memory region where VideoAlloc shall allocate memory Enumerator UTIL VRAM CONFIG VRAM ONLY Allocate memory from VRAM UTIL VRAM CONFIG SDRAM ONLY Allocate memory from SDRAM UTIL VRAM CONFIG VRAM PREFERRED Try to allocate memory from VRAM If this fails allocate memory from SDRAM 11 18 3 Function Documentation 11 18 3 1 void mmlGdcPeDeleteContext PE CONTEXT pectx mmlGdcPeDeleteContext deletes a context Parameters The MML GDC PE CONTEX
241. lated error code or MML ERR MML OK The documentation for this class was generated from the following file ut class display h 12 5 CMenu Class Reference include ut class menu h Public Types enum MENU FLAG MENU FLAG POPUP 1 MENU FLAG CHECKBOX CMenultem MENU ITEM FLAG CHECKBOX MENU FLAG RADIO CMenultem MENU ITEM FLAG RADIO MENU FLAG ISCHECKED CMenultem MENU ITEM FLAG ISCHECKED enum MENU KEYS MENU KEY ENTER 0x10000000 MENU KEY UP 0x10000001 MENU KEY DOWN 0x10000002 MENU KEY LEFT 0x10000003 MENU KEY RIGHT 0x10000004 212 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE X CYPRESS PERFORM Public Member Functions virtual MM ERROR SetText const wchar t pszString MM ERROR const void Font int size of font int font height PE CONTEXT draw 0 virtual MM ERROR Close MM ERROR Insert MM 032 old id MM 032114 U32 flags const wchar t pszString Find MM U32 id CMenultem FindSelected CMenultem pBase FindNext CMenultem pBase CMenultem pSearch CMenultem MENU ITEM FIND find int HandleKey 032 key MM 032 GetDefautltemHeight MM ERROR Draw 12 5 1 Detailed Description Class CMenu see CMenu 12 5 2 Member Enumeration Documentation 12 5 2 1 enum MENU FLAG
242. lay background color from the visitors point of view If multiple planes or layers are supported by hardware they will have a defined z order Each upper level can modify the pixel color of the lower level In the end one pixel on the display can be the blend result of background color and all layer levels Physical Address The Physical Address stands for an address representing the real hardware address of a register or start of a memory block or similar In contrast to Virtual Address this address type is used by 2D Graphics hardware components See also Physical Address Virtual Address Stands for Pixel Engine Part of a chip based on the 2D core components that is responsible for pixel buffer based transformations like copying rotation bending and much more September 11 2015 S6E2DH_AN709 00022 1v0 E 33 APPLICATION NOTE PERFORM Description Pre multiply If images contain an alpha channel this alpha channel will be often used for per pixel blending The required blending formula depends on the way how the color channels RGB are stored in such an image Non pre multiplied they contain the original pixel color independent of the alpha value for this pixel Pre multiplied the stored pixel color is already multiplied with the alpha value of the same pixel PNG images are often stored as non pre multiplied images An 2D core render buffer is typical a pre multiplied image Alpha channel of an image
243. les include mm types h Macros define ERRCODE err ERROR err define MODULEID moduleld MM MODULE moduleld define MML ERR MM ERRCODE 0x3FFFFFFF define ERR MM ERRCODE 0x7FFFFFFF define MML_OK MM ERRCODE 0xO0 define OK MM ERRCODE 0x0 define MM FALSE BOOL 0 define MM TRUE MM BOOL 1 define NULL void 0 define MM BIT x 1U lt lt x define MM TO ADDR X define MM ADDR TO void x define MM ADDR TO UINT32 x MM U32 x define MM UINT32 TO ADDR x MM ADDR 9 define TO UINT32 x MM U32 x define MM UINT32 TO void x define MM ADDR TO UINT32PTR x MM 132 define MM ADDR TO SINT32PTR x 532 define MM IO IRIS SUBSYSTEM 0xD0A00000U define MM IO IRIS CORE 0xD0A10000U define NULL FUNCTION void 0 define UNUSED_PARAMETER x void x ADDR x 13 2 1 Detailed Description Common macro definitions for all modules 13 3 mm gdc erp h File Reference Error Reporting 240 S6E2DH_AN709 00022 1v0 E September 11 2015 APPLICATION NOTE ES CYPRESS Enumerations enum MM MESSAGE LEVEL MM LEVEL NOTHING OU MM LEVEL ERROR MM ERP LEVEL WARNING MM ERP LEVEL INFO enum MM MESSAGE CHANNEL PROP ERP CH OFF 00 MM ERP CH enum MM MESSAGE DEST M
244. lignment Alignment to use for the allocation pAddr If non NULL a pointer to a variable to receive the physical address of the memory block on success Returns NULL on failure or the virtual address of the allocated memory 11 18 3 8 MM ERROR mmlGdcVideoConfig UTIL VRAM CONFIG config Configuration of video memory manager This defines the memory region where VideoAlloc shall allocate memory Parameters in config Video memory manager configuration default UTIL VRAM CONFIG VRAM PREFERRED Returns MML ERR MMAN INVALID PARAMETER If illegal value for config is given MML OK otherwise 11 18 3 9 void mmlGdcVideoFree void addr Free video memory allocated by mmlIGdcVideoAlloc Parameters in Virtual address previously returned from mmlGdcVideoAlloc 11 18 3 10 MM ERROR mmlGdcVideoGetFreeTotal 032 x size Retrieve the total amount of free video memory Depending on the configuration see mmlGdcVideoConfig this refers to VRAM SDRAM or both Parameters out Parameter to receive the query result not NULL Return values MML OK Normal termination MML ERR MMAN INVALID PARAMETER An unexpected internal error occurred September 11 2015 56 20 AN709 00022 1v0 E 193 APPLICATION NOTE MM ERROR mmlGdcVideoGetLargestBlock U32 CYPRESS 11 18 3 11 size Retrieve the size of the largest contiguous block of free video memory Depending on the co
245. ller Return values MML OK On success Otherwise the related error code or MML ERR 12 4 2 2 MML DISP CONTROLLER GetDisplayController inline Return values the used display controller id Return 12 4 2 3 MML GDC DISPLAY GetHandle inline Return values the used MML GDC DISPLAY object Return inline the height of the panel inline 12 4 2 4 MM U32 GetHeight D c 5 5 lt c Return 12 4 2 5 MM 032 GetWidth Return values the width of the panel Return 12 4 2 6 MM ERROR Open unsigned int nWidth 0 unsigned int nHeight 0 MML DISP CONTROLLER display MML DISP CONTROLLER 0 inline Open initialize the 2D core display controller N September 11 2015 56 20 AN709 00022 1v0 E SS CYPRESS APPLICATION NOTE SF PERFORM Parameters nWidth Number of horizontal pixel nHeight Number of vertical pixel display ID of display controller Return values MML_OK On success Otherwise the related error code or MML_ERR 12 4 2 7 operator MML DISPLAY inline Return values Return the used MML GDC DISPLAY object 12 4 2 8 virtual MM ERROR SetBgColor MM U32 color inline virtual Change the background color and applay changes with commit 70 5 3 2 D o in see MML DISP BACKGROUND COLOR Return values On success Otherwise the re
246. lude The software interface provides 2 objects required to use and control the display unit The MML DISPLAY is a software handle for a hardware display controller and is required to Setup video modes Configure dithering or gamma correction The MML GDC DISP WINDOW is the software handle for hardware layers and is required use hardware layers to show rendered content configure blending and transparency of layers For synchronization between layers and other hardware components The following example demonstrates the steps to show an image on Display 0 Use default initializer for the properties and change later the important fields MML GDC DISP PROPERTIES dispProp MML DISP PROPERTIES INITIALIZER MML DISP WINDOW PROPERTIES windowProp MML GDC DISP WINDOW PROPERTIES INITIALIZER MML GDC DISPLAY display MML GDC DISP WINDOW win MML GDC SURFACE target Set your requested display properties 98 S6E2DH_AN709 00022 1v0 E September 11 2015 APPLICATION NOTE dispProp outputController MML DISP CONTROLLER 0 dispProp xResolution 640 dispProp yResolution 480 Open the display mmlGdcDispOpenDisplay amp dispProp amp display Set Window properties windowProp topLeftX 0 windowProp topLeftY 0 windowProp width 640 windowProp height 480 Create the window mmlGdcDispWinCreate displ
247. m for geometry operation starts in the upper left corner For blit operation it is equal to buffer content and display coordinate orientation For draw operation Note it means the buffer content orientation is mirrored 11 6 2 4 define MML DST 0x00000004U Background for blend operations 11 6 2 5 define MML PE FILTER BILINEAR 1 Bilinear filter enable 11 6 2 6 define MML PE FILTER NEAREST 0 Nearest filter enable 11 6 2 7 define MML PE 0x00000008U MM_U08 0x00 Mask surface MML_GDC_PE_ROP_BLACKNESS 11 6 2 8 define 0 11 6 2 9 define MML PE DSTAND MM 008 0 80 DST amp MASK amp SRC itdefine MML PE DSTCOPY MM UO8 OxFO DST 11 6 2 10 122 S6E2DH_AN709 00022 1v0 E September 11 2015 PERFORM APPLICATION NOTE 11 6 2 11 define DSTPAINT MM UO8 OxFE DST MASK SRC 11 6 2 12 PE ROP MASKCOPY MM_U08 0xCC MASK 11 6 2 13 MML_GDC PE MASKERASE MM_U08 0x22 SRC amp MASK 11 6 2 14 MML_GDC PE MASKINVERT MM_U08 0x66 MASK A SRC 11 6 2 15 PE ROP MASKSEL 08 0 8 MASK 2 SRC DST 11 6 2 16 define MML_GDC PE MERGEMASK MM_U08 0xEE SRC MASK 11 6 2 17 MML_GDC PE ROP MERGEMASKNOT 008 0 SRC MASK itdetine
248. nBuffer MML SURFACE surf 032 uWidth 032 uHeight MML FORMAT eFormat void pBufferAddress 032 uRleWords MM ERROR mmlGdcSmAssignClut MML SURFACE surf MML SURF eMode MM 032 uCount MML SURF CLF eFormat void pBufferAddress MM ERROR mmlGdcSmSetAttribute const MML SURFACE surf MML SURF eName MM U32 uValue MM ERROR mmlGdcSmGetAttribute const MML SURFACE surf MML SURF eName MM U32 11 4 1 Detailed Description The Surface provides all functions to manage memory blocks with image content called image buffer See also Surface Overview include surfman h The Surface provides all functions to manage memory blocks with image content called image buffer A surface is a description of such an image buffer including dimension of the image pixel format and physical address in memory The described image can be a compressed RGB A buffer and optionally use a color lookup table Most modules of this driver can work on surfaces Examples are display and PixEng The Surface API allows for instance to Pass surfaces created by the application to PixEng for further processing Pass surfaces created by the application to Display for displaying on the screen etc The properties can be assigned by using the helper functions mmlGdcSmAssignBuffer and mmlGdcSmAssignClut or m
249. nce 207 12 1 1 Detailed Description 207 12 1 2 Constructor amp Destructor 207 12 1 3 Member Function Documentation 207 12 2 CCtx Class 208 12 2 1 Detailed Description 208 12 2 2 Constructor amp Destructor 208 12 2 3 Member Function Documentation 209 12 3 CDevice Class 209 12 3 1 Detailed Description oai Poetic rer a 209 12 3 2 Constructor amp Destructor 209 12 3 3 Member Function Documentation 210 12 4 CbDisplay Class Reference 210 6 S6E2DH_AN709 00022 1v0 E September 11 2015 APPLICATION NOTE 12 4 1 Detailed Description ie hd eae 211 12 4 2 Member Function 211 12 5 Class 212 12 5 1 Detailed Description 213 12 5 2 Member Enumeration 213 12 5 3 Member Function Documentation 213 12 6 CMenultem Class Reference 216 12 7 CStaticSurfaceWindow Class Reference 216 12 7 1 Detailed Description 217
250. nd add the required instructions for synchronization UTIL SUCCESS ret mmlGdcPeWaitForDispFrameEnd s display s nSyncPoint UTIL_SUCCESS ret Render s display GetHeight s nSyncPoint s nSyncPoint UTIL SUCCESS UTIL SUCCESS ret Render 0 s display GetHeight s nSyncPoint ret mnmlGdcPeWaitForDispFrameEnd s display s display GetHeight The first instruction is a wait instruction for the line position s nSyncPoint Then we render the buffer part above the sync point Now we wait for the end of the screen and start to render the lower part of the screen s nSyncPoint is set to a line below the middle of the screen because the bars are more present in the lower part so this part will take more time This example splits the target buffer into 2 parts It is possible to use 3 or more parts however it is not recommended because each sync point will generate a render gap because the command sequencer must wait for a display controller line September 11 2015 S6E2DH_AN709 00022 1v0 E 63 E PES SF APPLICATION NOTE PERFORM Note Itis possible to get a frame drop if the render time is too long for one part and the display line sync point is already passed when the command sequencer reaches this instruction It means the command sequencer will wait one frame until the expected line is passed next time 6 9 1 5 Render time visualization If the render time is critical for a single buffer solution it might
251. nfiguration see mmlGdcVideoConfig this refers to VRAM SDRAM or both U w 3 n out Parameter to receive the query result not NULL Normal termination An unexpected internal error occurred Return values MML ERR MMAN INVALID PARAMETER MML OK MM ERROR mmlGdcVideoGetSize U32 size Retrieve the size of video memory heap Depending the configuration see mmlGdcVideoContfig this is 11 18 3 12 the size of VRAM SDRAM or both Parameters Return values MML ERR MMAN INVALID PARAMETER MML OK void mmlOsLibcFree void Memory not NULL Parameter to receive the query result Normal termination An unexpected internal error occurred 11 18 3 13 Implements the standard C Library function free Virtual address previously returned from mmlOsLibcMalloc void mmlOsLibcMalloc size t Size Implements the standard C Library function malloc U 3 o 11 18 3 14 Amount of memory to be allocated in bytes U w o In NULL on failure or the virtual address of the allocated memory Returns S6E2DH_AN709 00022 1v0 E September 11 2015 194 APPLICATION NOTE F CYPRESS PERFORM 11 19 Utilities for the Surface Management Macros define UTIL_SUCCESS rc execute define UTIL_ERR_OUT_OF_MEMORY MM_ERRCODE 0x31000001 Functions MM ERROR utSurfReadBitmap MML_GDC_SUR
252. nslated mirrored and or rotated by a multiple of 90 Nearly all 2D core components can do simple transformation while reading an image For instance a display controller can directly show horizontal mirrored images Note 90 and 270 rotations result a higher memory read rate Especially for high resolution displays it is not recommended to use this feature Compressed images cannot be used with simple transformations The amount of bytes that must be skipped over to get from one pixel in an image to the pixel with the same horizontal position in the next line of this image Sub layer A sub layer is analog to layers an image that is blended over a background in the display controller A sub layer is always part of a layer Different to layers it is not possible to blend overlapping sub layers together if they share the same layer id Only the top most sub layer image pixel will be read from memory and this color information will be used for the layer blend operation Surface Surface stands for an memory object describing one or more memory blocks describing an image Many 2D Graphics Driver API calls use surface objects for the functions See also Surface Overview Virtual Address The Virtual Address stands for an address representing the CPU view of an hardware address like a register or start of a memory block In contrast to the Physical Address this address type cannot be used by 2D Graphics hardware components
253. nt color used in blend mode for detail information refer to mmlGdcPeBlendMode If pectx is equal to NULL mmlGdcPeColor is terminated without any operation Parameters in out Pixel Engine context NULL Red component of color 0 255 default 0 Green component of color 0 255 default 0 Blue component of color 0 255 default 0 Alpha component of color 0 255 default 0 Return values 134 S6E2DH_AN709 00022 1v0 E September 11 2015 APPLICATION NOTE On success Otherwise the related error code 11 6 5 9 MML ERROR mmiGdcPeColorMatrix PE CONTEXT MML PE CMATRIX FORMAT format const MM FLOAT fMatrix mmlGdcPeColorMatrix is setting function for color matrix If pectx is equal to NULL mmlGdcPeColorMatrix is terminated without any operation fMatrix is a 4x3 matrix represented as float 12 array for RGB modification red out fMatrix 0 red fMatrix 3 green fMatrix 6 blue fMatrix 9 255 green out fMatrix 1 red fMatrix 4 green fMatrix 7 blue fMatrix 10 255 blue out fMatrix 2 red fMatrix 5 green fMatrix 8 blue fMatrix 11 255 alpha out alpha If fMatrix NULL default the color matrix function will be switched off Note Ifa color matrix is set using mmlGdcPeColorMatrix then driver internal automatic YUV to RGB conversion of SRC buffer will be shut off The Y
254. o DISP FEATURE DECODE the lower level windows For overlapping windows ID the resulting pixel is defined by the latest opened window 11 5 2 Macro Definition Documentation 11 5 2 1 define MML DISP BLEND GLOBAL ALPHA 10 lt lt 1 Enable global alpha blending 11 5 2 2 define MML GDC DISP BLEND NONE 0 Disable blending 11 5 2 3 define MML DISP BLEND SOURCE ALPHA 1U lt lt 2 Enable per pixel source alpha blending 11 5 2 4 GDC DISP BLEND SOURCE MULTIPLY ALPHA lt lt Enable source alpha multiplication 11 5 2 5 define MML GDC DISP BLEND TRANSPARENCY 1U lt lt 0 Enable transparency 11 5 2 6 define MML DISP BUFF TARGET COLOR BUFF 1 lt lt 1 Color buffer as target buffer 100 S6E2DH 709 00022 1 0 September 11 2015 PERFORM APPLICATION NOTE 11 5 2 7 define MML DISP DE HIGH 1U lt lt 2 Data enable signal high active 11 5 2 8 define MML DISP DE LOW 0 Data enable signal low active 11 5 2 9 define MML DISP FEATURE DECODE 1 lt lt 1 Show encoded images 11 5 2 10 define MML DISP FEATURE INDEX COLOR 1 lt lt 0 Indexed color support define MML DISP FEATURE MULTI LAYER 1 lt lt 7 11 5 2 11 The window is Multi Window i e it shares the same layer with all other Multi Windows 11 5 2 12 define DISP HSYNC HIGH 10 lt lt
255. o move it to the correct position mmlGdcPeBlt amp ctx BGR WIDTH 0 5f ROT CENTER Y 54 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE All source surfaces including hub get a similar matrix except background in PrepareSurfaces utMat3x2Loadldentity mat 0 we 7 sources so we can simply handle it in an array for i 1 lt 7 i UTIL_SUCCESS ret mmlGdcSmResetSurfaceObject amp sSrc i UTIL_SUCCESS ret utSurfLoadBitmap amp sSrc i mysrc i name MM FALSE prepare matrix array for surfaces utMat3x2Loadldentity mat i align the rotation centers of surfaces utMat3x2Translate mat i MM FLOAT utSurfWidth amp sSrc i 0 5f mysrc i fCenterY The rotation angle is changed frame by frame so we have to calculate a new matrix each time for this surface We encapsulated it in the function GetRotMatrix static ERROR GetRotMatrix MM_U32 SurflD SURFACE CONTAINER sSrc MM FLOAT fAngle Mat3x2 mat MM ERROR ret move the surface to the rotation center utMat3x2Loadldentity mat SurfID utMat3x2Translate mat SurflD FLOAT BGR WIDTH 0 5f MM FLOAT ROT CENTER Y utMat3x2Rot mat SurflD fAngle utMat3x2Translate mat SurflD MM FLOAT utSurfWidth amp sSrc SurflD 0 51 mysrc SurfID fCenterY return ret September 11 2015 S6E2DH_AN709 00022 1v0 E 55 IZ CYPRESS APPLICAT
256. o the wMap window UTIL SUCCESS ret mmlGdcDispWinSetSurface wMap MML DISP BUFF TARGET COLOR BUFF sMap Besides this we want to see a moving map That means we have to move the layer in our animation loop The driver ensures that only pixels inside the screen of this surface are read from memory GetPosition frameCount amp x amp y amp winker To get a moving map we have to recalculate a new matrix for the map layer utMat3x2Loadldentity mat geo Move it in a way that the requested center point fits the current position utMat3x2Translate mat geo MM FLOAT CENTER X x MM FLOAT CENTER Y y Assign the matrix to the window UTIL SUCCESS ret mmlGdcDispWinSetMatrix wMap MML GDC DISP BUFF TARGET COLOR BUFF mat geo UTIL SUCCESS ret mmlGdcDispWinCommit wMap 6 6 5 Frame Layer The frame layer is the simplest layer for this example because it is not included in an animation UTIL SUCCESS ret mmlGdcDispWinSetSurface wFrame MML GDC DISP BUFF TARGET COLOR BUFF sFrame UTIL SUCCESS ret mmlGdcDispWinSetBlendMode wFrame MML GDC DISP BLEND SOURCE ALPHA MML GDC DISP BLEND SOURCE MULTIPLY ALPHA UTIL SUCCESS ret mmlGdcDispWinSetAttribute wFrame MML DISP WIN ATTR COLOR Ox80FFFFFF UTIL SUCCESS ret mmlGdcDispWinCommit wFrame The related properties required for the compression were already assigned to the surface in the utSurfLoadBitmap function
257. ocumentation 11 22 2 1 MM 032 utRidEncode 032 pixeldata 032 unWidth 032 unHeight 032 strideBytes 032 dataBpp 032 U32rldCount Encode pixel data to RLD bit stream Parameters pixeldata Pixel data unWidth Width of the image unHeight Height of the image strideBytes Number of bytes required for one line Bits per pixel 1 2 4 8 16 24 32 RLD bit stream rldCount Maximum number of RLD words dataBpp 200 S6E2DH_AN709 00022 1v0 E September 11 2015 APPLICATION NOTE Return values Required number of RLD words This number may me larger than rldCount in which case only rldCount words are actually written Note The RLD bit stream is filled up with zero bits at the end for alignment with word boundaries RLD will ignore the fill bits since the expected data size is provided as a parameter for decoding 11 23 Util class collection Modules CDevice CDisplay QCMenu CSurface CWindow 11 23 1 Detailed Description The util class collection defines some classes to abstract low level driver functionality All these classes are defined as header files only 11 24 Data Structures class CCtx 11 24 1 Detailed Description The class CCtx is a simple abstraction of a PE CONTEXT object The application can use object of this calls direct for blitting bec
258. ome true Setting a sync condition in a sync object is done by the component that owns the sync type For example the Display API provides a function to write the sync condition Surface to be displayed is actually shown on the screen to a sync object Waiting for a sync condition can be done by an application as described above which is called a client wait but also in a graphics processing pipeline without intervention by the application This is called a server wait Server waits are implemented by the component that owns the graphics processing pipeline For example the Pixel Engine API provides a function to submit a sync condition to the Pixel Engine command queue queue to hold the submitted PixEng operations PixEng operations submitted after the sync will only be executed after the sync condition becomes true Following are a few examples to illustrate the use of sync objects application renders 2D graphics onto the screen using double buffering It can use sync objects to make sure a pixel buffer has already been displayed i e is free to render a new 2D graphics into it The following processing unit events can be used to generate a sync condition Display Controller VSync new frame started see mmlGdcDispSyncVSync Window mmlGdcDispWinCommit is executed see mmlGdcDispWinSync Previously committed PixEng operations are finished see mmlGdcPeSync The following possibilities for sync server waits e
259. omponent offset A useful range for fBrightness is 1 0 1 0 with 0 0 stands for no brightness modifications and higher and lower values stand for amplification and attenuation fSaturation Set the color saturation A useful range for fSaturation is 0 0 2 0 with 1 0 stands for no saturation modifications and higher and lower values stand for amplification and attenuation A value of 0 0 will result in a gray image Color modification in degrees The useful range is 0 360 where 0 and 360 run into a identical result which means no modification September 11 2015 S6E2DH_AN709 00022 1v0 E 185 APPLICATION NOTE CYPRESS Note The parameters are not checked concerning the range A wrong value will result a wrong image MML 2D MATRIX void utMat4x3Copy Mat4x3 11 17 4 23 dst const Mat4x3 src Copy the matrix content to a new one Parameters dst The destination matrix The source matrix out src MML GDC 2D MATRIX API void utMat4x3Loadldentity in 11 17 4 24 4 3 Fill a 4x3 matrix with a unit matrix Parameters MML 2D MATRIX void utMat4x3Multiply Mat4x3 11 17 4 25 dst const Mat4x3 src1 const Mat4x3 src2 Multiply 2 matrices Parameters The destination matrix The first source matrix The second source matrix 2D MATRIX void utMat4x4Copy Mat4x4 11 17 4 26 const Mat4x4 src dst
260. on mode Return values MML_OK On success MML_ERR If the requested compression is not possible September 11 2015 S6E2DH_AN709 00022 1v0 E 199 IZ CYPRESS APPLICATION NOTE PERFORM a 11 21 Utilities for RLA run length adaptive compression Data Structures class RLAD 11 21 1 Detailed Description The code for this group can be used to create compressed buffers of the type MML GDC SURF COMP RLA MML GDC SURF COMP RLAD zMML GDC SURF COMP RLAD UNIFORM and Note The header and the source code for this functions are included in the utility block delivered with the driver although it is not recommended to compress an image with the CPU on the target system However if required this part can used to create compression utilities for different platforms 11 22Utilities for RLC run length compression Functions MM 032 utRIdEncode MM U32 pixeldata 032 unWidth 032 unHeight 032 strideBytes 032 dataBpp 032 032 rldCount 11 22 1 Detailed Description This group defines function to create run length compression streams Note The header and the source code for this functions are included in the utility block delivered with the driver although it is not recommended to compress an image with the CPU on the target system However if required this part can used to create compression utilities for different platforms 11 22 2 Function D
261. ontroller passes a defined line in a single buffer environment The example starts with a Command Sequencer buffer size measurement for the first frame if MEASURE_CMD_SEQ is defined with the following result CmdSeq buffer size 13 46 of 16 00 kB used September 11 2015 S6E2DH_AN709 00022 1v0 E 61 P CYPRESS APPLICATION NOTE PERFORM The sample draws 10 bars 2 background images and a debug bar in one half of the frame It means the driver needs approximately 500 Byte or 125 registers writes for one blit in this sample Please note the required bytes for a blit depends on the operation and properties We need 3 sources to render the bars In many cases only 2 sources are used However a blit with a surface with an index table of 256 colors needs much more instruction buffer because the palette with 256 4 register values already requires 1 command sequencer space To allow a fancy background animation the init function also allocates a 128 128 4 alpha bpp surface and renders the following pattern in this surface Figure 6 14 Background pattern All these memory blocks together need about 411 VRAM 6 9 1 3 Render time analysis To generate a render job that generates a real GPU load for the 2D render hardware this sample uses a background animation using 2 bilinear full screen rotations For real applications this is not a typical use case and the GPU load will be smaller The animated bars of the cha
262. or release version of driver p for production version of driver This is a read only attribute Setting this attribute will result in error 11 3 2 Function Documentation 11 3 2 1 MM ERROR mmliGdcConfigGetAttribute MML CONFIG ATTR MM U32 pParam Gets the current value a graphics library attribute See MML CONFIG ATTR for a list of attributes Parameters in pname Name of the attribute to get See MML CONFIG out pParam Address where the read value of the attribute is stored September 11 2015 S6E2DH_AN709 00022 1v0 E 83 fe APPLICATION NOTE SF PERFORM Return values MML_OK on success MML_ERR_GDC_CONFIG_INVALID_PARAMETER if pname is invalid MML_ERR_GDC_CONFIG_INTERNAL_ERROR if value could not be retrieved 11 3 2 2 MM ERROR mmliGdcConfigSetAttribute MML CONFIG pname MM U32 param Sets a graphics library attribute See MML CONFIG for a list of attributes Parameters in pname Name of the attribute to set See MML CONFIG in param Value to set for the attribute Return values MML OK on success MML ERR GDC CONFIG INVALID PARAMETER if a parameter is invalid MML ERR GDC CONFIG INTERNAL ERROR if value could not be set 11 4 Surface API The Surface provides all functions to manage memory blocks with image content called image buffer See also Surf
263. ordinates utMat3x2Translate mat 4 5f 2 5f 90 degrees rotation utMat3x2Rot mat 90 0f translate to center of pixel 1 1 in source coordinate system utMat3x2Translate mat 1 5f 1 5f Figure 4 11 Zoomed blit result with matrix operation bottom left coordinate center 4 10 Image Compression To reduce the amount of required memory the 2D core HW supports compressed images 4 10 1 Compression Formats The following compression formats for pixel buffer are supported by the 2D core Features Limitations Recommended use case Lossless compression Only supported as read Backward compatible to buffer for blit operations and Compression of source Run length coded legacy devices as window content images with long line parts MML GDC SURF COMP RLC RLC compression can be Rotation or mirroring is not with constant color used in combination with supported indexed color September 11 2015 S6E2DH_AN709 00022 1v0 E 29 APPLICATION NOTE F cypress Features Limitations Recommended use case Only supported as read Run Length Adaptive MML_GDC_SURF_COMP_RLA buffer for blit operations and as window content Rotation or mirroring is not Compression of source Lossless compression Good compression results images supported for images with smooth A compressed buffer must content borders not exceed the window dimension Lo
264. ote Additional formats are supported by the PixEng hardware They can be defined with the attribute function The following examples show the related memory organization R8G8B8A8 Byte 0 1 2 3 4 5 6 7 Color AO BO GO RO A1 B1 G1 R1 RGB8A8 Byte 0 1 2 3 Color RGBO A1 RGB1 The memory organisation is described with below Enumerator MML GDC SURF FORMAT R8G8B8A8 32 bpp RGBA format MML SURF FORMAT A8B8G8R8 32 bpp ABGR format MML SURF FORMAT A8R8G8B8 32 bpp ARGB format MML GDC SURF FORMAT B8G8R8A8 32 bpp BGRA format MML GDC SURF FORMAT R8G8B8X8 32 bpp RGB format MML GDC SURF FORMAT X8B8G8R8 32 bpp BGR format MML GDC SURF FORMAT X8R8G8B8 32 bpp RGB format MML GDC SURF FORMAT R8G8B8 24 bpp RGB format MML GDC SURF FORMAT B8G8R8 24 bpp BGR format MML GDC SURF FORMAT R6G6B6 18 bpp BGR format MML SURF FORMAT R4G4B4A4 16 bpp RGBA format MML SURF FORMAT 16 bpp ARGB format MML GDC SURF FORMAT R5G5B5A1 16 bpp RGBA format 5 bit for RGB 1 bit alpha September 11 2015 S6E2DH_AN709 00022 1v0 E 91 4 2 55 APPLICATION NOTE PERFORM MML GDC SURF FORMAT A1R5G5B5 16 bpp ARGB format 5 bit for RGB 1 bit alpha MML GDC SURF FORMAT A1B5G5R5 16 bpp ABGR format 5 bit for RGB 1 bit alpha MML GDC SURF FORMAT B5G5R5A1 16 bpp BGRA format 5 bit for RGB 1 bit alpha MML GDC SURF FORMAT R5G6B5 16 bpp BGR fo
265. out Document This manual explains the functions of Cypress s 2D Graphics Driver for the S6E2D devices Please refer to the Delivery Note of your product for devices currently supported with this product Introduction Getting Started Overview Tutorial Glossary Revision History September 11 2015 S6E2DH_AN709 00022 1v0 E 11 APPLICATION NOTE PERFORM 2 Introduction 2 1 Target system The 2D Graphics core and its encircling graphics sub system is a hardware sub component of an integrated SOC like S6E2D Beside the graphical sub system the chip supports many different peripherals The following image shows the basic SOC hardware and software components required to run a typical application Figure 2 1 Hardware and software components 2 2 About this document This document describes the API and usage of the 2D Graphics Driver required to use the 2D Graphics core The document does not describe the required application framework or the usage of other peripherals apart from the 2D Graphics core 2 3 Copyright Copyright O 2015 Cypress ALL RIGHTS RESERVED No part of this publication may be copied and provided to any third party in any form or by any means without the written permission of Cypress unless expressly agreed to in written form by Cypress All trademarks used in this document are the property of their respective owners 12 S6E2DH 709 00022 1 0 September 11 2015 APPLICATIO
266. play frame rate the quality may be improved by increasing this dither offset value with each frame It is the same effect like dithering 8 bit color buffer component to a 6 bit panel Using this feature it is possible to use a smaller render buffer with the same color quality Warning For target buffers with few bits e g lt 4 per color component it will cause visible flickering artifacts MML GDC PE CTX ATTR FILTER Set the filter mode The related parameter can be MML PE FILTER NEAREST MML PE FILTER BILINEAR PE FILTER ANISOTROPIC default MML GDC PE ATTR ZERO POINT Define the coordinate zero point for geometry operations See also Coordinate System Hints The related parameter can be PE ATTR ZERO TOP LEFT ATTR ZERO BOTTOM LEFT default 11 6 4 6 enum MML GDC PE FILTER CHANNEL Color channels for filter Enumerator MML GDC PE FILTER CHANNEL R Filter is applied to R or Y channel MML GDC PE FILTER CHANNEL G Filter is applied to G or U channel MML GDC PE FILTER CHANNEL B Filter is applied to B or V channel MML GDC PE FILTER CHANNEL A Filter is applied to Alpha channel not available for MML PE FILTER COLOR FORMAT R8G8B8 S6E2DH_AN709 00022 1v0 E September 11 2015 126 APPLICATION NOTE MML GDC PE FILTER CHANNEL RGB Filter is applied to RGB or YUV channel MML GDC PE FILTER CHANNEL RGBA Filter is
267. play initializations Initialization of driver and display nitialize the driver UTIL SUCCESS ret mmlGdcSyslnitializeDriver 0 UTIL SUCCESS ret utMmanReset Allocate some of VRAM for Instruction buffer for the command sequencer Note that mmlGdcVideoAlloc is an application defined routine to manage the VRAM space The 2D core driver does not include any management of the VRAM vinstrBuffer mmiGdcVideoAlloc fifo size 0 NULL UTIL SUCCESS ret mmlGdcSysSetlnstructionBuffer vInstrBuffer fifo size 68 S6E2DH_AN709 00022 1v0 E September 11 2015 APPLICATION NOTE We need target surface in VRAM to render strings in it Allocate our buffers for i 0 i lt BUFFER COUNT i UTIL SUCCESS ret mrmlGdcSmResetSurfaceObject amp target target i amp target c i UTIL_SUCCESS ret utSurfCreateBuffer target i windowProp width windowProp height MML SURF FORMAT R5G6B5 We want to print some information on the screen We can set up a font by using the utility functions of this tutorial with the code Load a font bitmap mmlGdcSmGenSurfaceObjects 1 amp sFont UTIL SUCCESS ret utSurfLoadBitmap sFont courier 12 MM FALSE Set it as font for the util lib utSetFont amp utCtx sFont Then we create a point 50 pixels in diameter actually a bitmap again using utility functions Initialize the driver UTIL SUCCESS ret mmlGacSyslnitializ
268. r this layer all windows will use the same palette If the index width is smaller than 8 than the palette is split in 2 or more parts and the sub layer windows can partly use different palettes The following rule is implemented in hardware the upper bits of the 8 bit look up index are then filled up with the upper bits of the sub layer index Example when a 6 bit color index value is used 64 colors 4 palettes can be stored each shared by 2 layers layer 0 and 1 use palette entries 0 63 layers 2 and use 64 127 and so on Note The driver does check this rule If the application binds surfaces with different palettes to windows sharing the same hardware palette a wrong image will be the result Like other settings also palettes are shadowed It means you can commit the binding of a new indexed image surface with a new palette while an old one is still visible If sub layer windows share the same palette it is recommended to hide all windows before the new palette becomes active Notes Unfortunately the hardware shadow handling for palettes is in some cases not as expected Each update request in a window group with the same palette triggers the palette swap For instance 2 or more sub windows address the same palette part e g if index width is 8 all sub windows use the same palette Only one window uses the palette The commits for all windows without palette may also trigger the palette swap for exampl
269. realized by a geometry matrix operation The default operation for MASK and SRC surface is alpha multiplication An additional constant alpha multiplication realizes the semi transparency of some bars The result of this product is finally used for the blend operation against the animated background Color modification The sample uses the color matrix to colorize the gray image source 64 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE 6 10 Tutorial Cover Flow 6 10 1 Summary This example demonstrates several Pixel Engine features in form of a cover flow Source code 04_sample basic_graphics coverflow Figure 6 16 coverflow 6 10 2 Usage Use the right button to switch between circle and perspective mode 6 10 2 1 Learning Goals The following techniques and features are used Work with matrices 2 sorting The focus in this tutorial is not the initialization nor the double buffer technique 6 10 2 2 Matrix Calculation The driver supports an 3 2 matrix It allows to translate rotate scale and share an bitmap However to simplify the development task we decide to make the matrix calculation with a 4 4 matrix first This is a matrix format that is well documented because it is used for many OpenGL applications A matrix calculation like this for the circle mode can be the following Please note Itis easier to read the matrix operation from bottom to top
270. ream CCtx CDevice CDisplay CMenu CMenultem CStaticSurfaceWindow CSurface NUM BUFFERS gt CSurfaceWindow NUM BUFFERS gt CWindow RLAD Frame MML GDC DISP MODE LINE MML DISP PROPERTIES MML DISP TCON PROPERTIES MML DISP WINDOW PROPERTIES PE CONTEXT CONTAINER SURFACE CONTAINER SYNC CONTAINER MML SYSINIT INFO RLAD Package RLAD Frame Pixel RLAD S6E2DH 709 00022 1 0 September 11 2015 76 APPLICATION NOTE 10 File Index 10 1 File List Here is a list of all documented files with brief descriptions flash resource h Include this file before the definition of a bitmap mm defines h Common macro definitions for all modules mm erp h Error Reporting API mm errors h Error Codes for the Basic Graphics modules mm gdc module id h Basic Graphics module ids common mm version h Basic Graphics Driver Version Numbers mm types h Basic type definitions interrupthandler h 2D Core Interrupt Controller mml gdc config h Controls global graphics driver and hardware configurations display h Display Error Reporting mml gdc pixeng h Pixel Engine API mml gdc surfman h Surface Manager Interface mml gdc sync h Synchronization of framebuffer operations sysinit h Driver Initialization Module pe matrix h Provide
271. rence 2 eene 256 19 15 1 DetailedDescrIption 2 oit roter rt e tent 257 13 16 pe matrix h File Reference 257 13 16 1 Detailed Description 258 13 17 sm util File Referente jesi meierei 259 13 17 1 Detailed Description 4 4 444 259 13 18 ut class ctx h File Reference 259 13 18 1 Detailed Description 259 13 19 ut class device h File Reference 260 13191 Detailed Description iis i See UHR es 260 13 20 ut_class_display h File Reference 260 19 20 1 Detailed Descriptio e 260 13 21 ut class menu h File 260 13 21 1 Detailed Description 261 13 22 ut class rlad h File 261 8 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE 13 22 1 JDetailed Description oi ee EE 261 13 222 Macro Definition Documentation 261 13 23 ut class surface h File 261 13 23 1 Detailed Description 262 13 24 ut class window h File 262 13 24 1 Detailed Description 262 13 25 ut compatibility h File Reference 262 19 25
272. rent window names in the image above reflect such features The usage of such an advanced feature may restrict other Display or Windows properties September 11 2015 S6E2DH_AN709 00022 1v0 E 17 APPLICATION NOTE EE CYPRESS 4 4 1 Usage The following image shows the steps required to use one 2D core Display Controller with one Window Figure 4 5 Activity diagram Operation Complete Changes required S6E2DH_AN709 00022 1v0 E September 11 2015 The Display API lists all supported features and the related restrictions 18 y I APPLICATION NOTE CYPRESS PERFORM 4 5 Overview Pixel Engine PixEng 4 5 1 Pixel Engine The Pixel Engine is a hardware IP that efficiently performs pixel operations on two dimensional memory blocks It reads simultaneously from up to three source rectangles executes pixel processing operations on these and stores the result in another rectangular memory region The Pixel Engine functionality is covered by the Pixel Engine API of the 2D Graphics Driver The Pixel Engine API uses the concept of surface objects and context objects to perform all operations Surface objects are created and bound to a context to perform blit operations to the memory and deleted when no longer needed A context needs always a surface bound to the STORE target where the resulting pixel data will be stored Depending on the requested operation a SRC DST and MASK surfa
273. rface MML_GDC_SURFACE sComment MM_ERROR ret void vp mmlGdcVideoAlloc BGR_WIDTH BGR HEIGHT 4 8 0 NULL if vp NULL return MML_ERR UTIL_SUCCESS ret mrmlGdcSmResetSurfaceObject sComment mmlGdcSmSetAttribute sComment MML_GDC_SURF_ATTR_WIDTH BGR WIDTH mmlGdcSmSetAttribute sComment MML GDC SURF ATTR HEIGHT BGR HEIGHT mmlGdcSmSetAttribute scomment SURF ATTR BITPERPIXEL 4 mmlGdcSmSetAttribute scomment MML SURF ATTR COLORBITS 0x01010101 mmlGdcSmSetAttribute sComment MML ATTR COLORSHIFT 0x030201 00 52 S6E2DH 709 00022 1 0 September 11 2015 ER Z IE APPLIGATION NOTE CYPRESS PERFORM mmlGdcSmSetAttribute sComment MML GDC SURF ATTR BASE ADDRESS MM_U32 vp return ret The background layer the scale will only be visible if DShowDrawRects is not set to keep the example simple As this layer is not of interest for the tutorial we just use a helper function DrawBgr to draw several image sources in our sBgr buffer Create a surface for background UTIL SUCCESS ret mmlGdcSmResetSurfaceObject amp s sBgr UTIL SUCCESS ret utSurfCreateBuffer amp s sBgr WIDTH BGR HEIGHT MML SURF FORMAT R5G6B5 draw the scale on background surface You may use a fixed bitmap too UTIL SUCCESS ret DrawBgr amp s sBgr s sSrc s mat display the back
274. rmat 5 bit for RB 6 bit for G MML SURF FORMAT A8RGB8 16 bpp ABRGBS can be used for gray or indexed image buffers with additional alpha value For the Second use case an indexed color lookup table must be defined in the surface MML GDC SURF FORMAT RGB8 8 bpp RGB8 can be used for gray or indexed image buffers For the second use case an indexed color lookup table must be defined in the surface MML GDC SURF FORMAT A8 8 bpp alpha format can be used e g as text buffer or external alpha mask buffer MML SURF FORMAT A4RGB4 8 bpp can be used for gray or indexed image buffers with additional alpha value For the Second use case an indexed color lookup table must be defined in the surface MML GDC SURF FORMAT A4 4 bpp alpha format can be used e g as text buffer or external alpha mask buffer MML GDC SURF FORMAT A2 2 bpp alpha format can be used e g as text buffer or external alpha mask buffer MML GDC SURF FORMAT A1 1 bpp alpha format can be used e g as text buffer or external alpha mask buffer MML GDC SURF FORMAT RGB1 1 bpp back white buffer no alpha 11 4 5 Function Documentation 11 4 5 1 MM ERROR mmiGdcSmaAssignBuffer MML SURFACE surf MM U32 uWidth MM U32 uHeight MML GDC SURF FORMAT eFormat void pBufferAddress 32 uRleWords Assign a memory address width height and color format representing an image to a surface object The buffer is owned by the calling f
275. rroring or simple rotation All RGBA formats except 18 bpp Geometry operations like translation mirroring and multiple of 90 degree rotations Scaling Restriction SRC must use the same scale factors Note pixel operations may not be finished after mmlGdcPeFill or call That means the involved buffers may still be in use Please use synchronization objects or simply mmlGdcPeFinish to ensure that all operations are complete Pixel Engine operations can be queued by the driver to enhance performance especially in a multi threading environment The fast execution especially of long processing commands can be forced by an mmlGdcPeFlush call For more details about the usage of the Pixel Engine API see the tutorials and the respective sample code that are part of this driver documentation 22 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE 4 6 Synchronization Overview 4 6 1 Processing Units The S6E2D hardware consists of several independent parallel running units The driver is designed so that applications can use this parallel processing also in single threaded environment The driver distinguishes the following processing pipelines W CPU The ARM core executing the program code W The PixEng processing block All blit instructions for this pipeline will be pushed by the driver into the Command Sequencer queue That means the application the CPU can in
276. rt are the foreground for this sample Approximately up to 7596 of the screen size are filled by the bars It means that the buffer will be filled about 2 75 times by bilinear blit operations Bilinear blits here rotation and sub pixel movement need 2 clock cycles for one pixel so we expect 480 272 2 2 75 clock cycles to render one frame For a 160 MHz clocked blit engine it requires about 5 ms or 1 3 frame if we use a 60 Hz panel In practice the render time will be much longer because the cylinderical bitmap used to blit the bars will be read from external flash and access to external resources are not as fast as VRAM access To see the render time of about 5 ms you can simple change the line UTIL SUCCESS ret 5 sOylinder SurfLoadBitmap oylinder to UTIL SUCCESS ret s sOylinder SurfLoadBitmap cylinder MM TRUE This change copies the bitmap to VRAM with fast access time The example does not make a VRAM copy to generate the high GPU load 62 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE 6 9 1 4 Single buffer render mode One possible implementation for single buffer render mode is to use the blanking period of the timing only This procedure is used in the Speedometer sample In many cases the banking period is too short to redraw all animated buffers In this case the application can force the HW only to update a part of the frame buffer if this part of the frame buffer is currently not read by t
277. rther blit operations with the context Parameters Pixel Engine context NULL Binding target It is a single or OR combined value of MML GDC PE SRC MML GDC PE DST MML GDC PE STORE MML GDC PE MASK surface Surface object NULL unbind surface September 11 2015 S6E2DH_AN709 00022 1v0 E 129 md SESS YpnESS APPLICATION NOTE SF PERFORM Return values MML_OK On success Otherwise the related error code 11 6 5 4 MML GDC ERROR mmiGdcPeBlendFunc PE CONTEXT MML PE BF func red src MML GDC PE BF func red dst MML GDC PE BF func green src MML GDC PE BF func green dst MML GDC PE BF func blue src MML GDC PE BF func blue dst MML GDC PE BF func alpha src MML GDC PE BF func alpha dst Set the blending parameter If is equal to NULL mmlGdcPeBlendFunc is terminated without any operation The following table shows the possible blend functions F stands for the selected blend function See mmlGdcPeBlendMode for further usage Os Cd represent the incoming color or alpha component As Ad represent the incoming alpha component Cc represent the constant color or alpha component defined by mmlGdcPeColor Note incoming color components Cs Cd As and Ad can be the original image color a result of a previous operation See MML 5 ALPHAMULTI 5
278. s include lt stdio h gt include lt string h gt include mml_gdc_surfman h include sm util h Data Structures class CSurface lt NUM BUFFERS gt September 11 2015 56 20 AN709 00022 1v0 E 261 4 2 APPLICATION NOTE 13 23 1 Detailed Description This class abstracts MML SURFACE objects 13 24ut class window h File Reference This class abstracts windows include display h include sysinit h include ut class display h include ut class surface h include ut class ctx h include sm util h include win h Data Structures class CWindow class CSurfaceWindow NUM BUFFERS gt class CStaticSurfaceWindow 13 24 1 Detailed Description This class abstracts windows 13 25ut compatibility h File Reference This file defines some interfaces that are part of other drivers The util library implements very simple instances of it but they must be not used for software products However it allows to run the sample applications include lt stdlib h gt include lt stdio h gt include lt string h gt include mml_gdc_surfman h include Enumerations enum UTIL CONFIG UTIL VRAM CONFIG VRAM ONLY 0x1U UTIL VRAM CONFIG SDRAM ONLY 0x2U UTIL VRAM CONFIG VRAM PREFERRED 0x3U Functions MM ERROR mmlGdcSmGenSurfaceObjects MM 032 uCnt MML SURFACE
279. s for windows with feature DISP FEATURE MULTI LAYER Enumerator MML GDC DISP SUB LAYER DEFAULT Window is not a Multi Window or the next free sub layer is used DISP SUB LAYER 1 sub layer 1 MML GDC DISP SUB LAYER 2 sub layer 2 MML GDC DISP SUB LAYER 3 sub layer 3 MML GDC DISP SUB LAYER 4 sub layer 4 MML GDC DISP SUB LAYER 5 sub layer 5 MML GDC DISP SUB LAYER 6 sub layer 6 MML DISP SUB LAYER 7 sub layer 7 MML GDC DISP SUB LAYER 8 sub layer 8 enum MML GDC DISP TILE MODE 11 5 4 16 Enumeration of possible tile modes for a window Enumerator MML GDC DISP TILE MODE ZERO Pixel outside the surface are 0 MML GDC DISP TILE MODE CONST Pixel outside the surface use the const color of the window Pixel outside the surface use the closest pixel from source buffer this must not be set for RLD MML GDC DISP TILE MODE PAD operations MML GDC DISP TILE MODE CLIP The window position and size will be clipped to the overlapped area of the given window and the surface S6E2DH 709 00022 1 0 September 11 2015 106 APPLICATION NOTE 11 5 4 17 enum MML DISP WIN ATTR Enumeration of the different configuration attributes for windows Enumerator MML GDC DISP WIN ATTR LAYER ID Layer used for the window see MML GDC DISP LAYER This attribute can only be read MML GDC DISP WIN ATTR SUB LAYER ID Sub layer used for the window MML GDC DISP SUB LAYER 1 MM
280. scribe the pixel buffers and a PE CONTEXT object to describe the requested pixel operation The following example demonstrates the steps to fill a target buffer with blue and blend a src surface at the center of target buffer MML GDC PE CONTEXT CONTAINER ctx reset the MML PE CONTEXT object mmlGdcPeResetContext amp ctx Bind a target surface as STORE and blend DeSTination buffer to the context The target pixel will be read blended with src and written back to the target buffer mmlGdcPeBindSurface amp ctxX MML PE STORE MML PE DST target Set a fill color mmlGdcPeColor amp ctx 0 0 255 0 Fill the store buffer mmlGdcPeFill amp ctx 0 0 target width target height the source buffer mmlGdcPeBindSurface amp ctx MML SRC src Blend the source pixel to the target mmlGdcPeBlt amp ctx target width src width 2 target height src height 2 Optional Ensure that the operation finished execution mmlGdcPeFinish September 11 2015 S6E2DH_AN709 00022 1v0 E 121 APPLICATION NOTE SE ss 11 6 2 Macro Definition Documentation 11 6 2 1 define MML PE extern Placeholder for export changes 11 6 2 2 define MML ATTR ZERO BOTTOM LEFT 10 The coordinate system for geometry operation starts in the lower left corner 11 6 2 3 define MML PE ATTR ZERO TOP LEFT 00 The coordinate syste
281. se Data Fields CSurface lt NUM BUFFERS gt m surface Detailed Description template lt unsigned int NUM BUFFERS class CSurfaceWindow NUM BUFFERS gt The class CSurfaceWindow represents a CWindow with one or more pixel buffers The pixel buffers can be used to store a rendered image that will be showed in the Window after calling Swap 12 9 2 Member Function Documentation 12 9 2 1 virtual MM ERROR Close inline virtual Close the Window Return values MML OK on success Otherwise the related error code or MML ERR Reimplemented from CWindow September 11 2015 56 20 AN709 00022 1v0 E 221 APPLICATION NOTE F Cypress 12 9 2 2 MM_ERROR CreateBuffer const MML_GDC_SURF_FORMAT format MML GDC SURF FORMAT R8G8B8A8 032 MaxSize 0 inline Create one or more pixel buffers with the size of the window Parameters define the color format of the buffer experimental if a size 0 is defined the function tries to create compressed buffers equal or format smaller than MaxSize see Image Compression Return values MML OK on success Otherwise the related error code or MML ERR 12 9 2 3 MM ERROR CreateBuffer MM U32 bit red MM U32 bit green MM U32 bit blue MM 032 bit alpha inline Create one or more pixel buffers with the size of the window Parameters Number of red bits in the buffer s Number of green bits in the buffer s
282. se note that the given formula calculates the value for F 256 255 If F x is only defined for input values 0 0 1 0 then pRed 32 can be calculated as pRed 32 MM S16 0 5f 32 0f F 1 F 31 0f 32 0f 1023 0f 1023 0f 31 05 The pRed and pBlue pointers must be valid for all following mmlGdcPeBIt calls If valid CLUT data is loaded context attribute MML PE CTX GAMMA is set to MML PE GAMMA NEUTRAL If one pointer of color components is NULL then the CLUT is set to bypass If pectx is equal to NULL mmlGdcPeCLUTData is terminated without any operation Parameters in out pectx Pixel Engine context I NULL Defines the number of entries in the array Depending on the hardware the CLUT hardware may support not all format types In this case the driver interpolates the missing or skips the format needless values Pointer to array of red values The size of the array depends on format Pointer to array of green values The size of the array depends on format Pointer to array of blue values The size of the array depends on format Return values MML OK On success Otherwise the related error code 11 6 5 8 MML PE APIMM ERROR mmlGdcPeColor MML PE CONTEXT pectx MM 008 red MM 0 08 green MM 008 blue MM 0 08 alpha Set the constant color value This color has the following usage Fill color used in mmlGacPeFill Consta
283. some matrix utility functions sm util h This is just a helper implementation for development and will be removed in the final version ut class ctx h This class abstracts an MML GDC PE CONTEXT ut class device h September 11 2015 56 20 AN709 00022 1v0 E 7T APPLICATION NOTE SES CYPRESS This class abstracts the device initialization ut class display h This class abstracts the display initialisation ut class menu h This class realizes a simple menu This sample code can be used to compress a buffer using the MML GDC SURF COMP RLA MML SURF COMP RLAD or MML SURF COMP UNIFORM format ut class rlad h ut class surface h This class abstracts MML SURFACE objects ut class window h This class abstracts windows This file defines some interfaces that are part of other drivers The util library implements very ut compatibility h simple instances of it but they must be not used for software products However it allows to run the sample applications ut compression h This file defines a helper function that can be used to compress a surface ut memman h This file defines some interfaces for the memory management ut rlc h This sample code can be used to create a run length encoded buffer S6E2DH 709 00022 1 0 September 11 2015 78 APPLICATION NOTE 11 Module Documentation 11 1 Basic Graphics This section collects all APIs of the driver Modules Driv
284. ssy compression Run Length Adaptive Dithering MML_GDC_SURF_COMP_RLAD The 2D core HW can read Rotation or mirroring is not Compression of source supported A compressed buffer must not exceed the window and write this format images with size limitation Maximum buffer size can be calculated 1 dimension 4 10 1 1 1 Calculation of required buffer size for RLAD compression The following formula can be used to calculate the maximal required buffer size pixel size copcO_max cbpc1_max cbpc2 max cbpc3_max header size cbpcO width cbpc1_width cbpc2 width cbpc3_width bpcO bpc1 bpc2 bpc3 num_header ceil frame_width 8 frame_height buf_size num_header header_size frame_width frame_height pixel_size buf_words ceil buf_size 32 bpc0 1 2 3 ComponentBitsRed Green Blue Alpha see MML_GDC_SURF_ATTR_COLORBITS 0 1 2 3 max RLADCompBitsRed Green Blue Alpha see MML SURF ATTR RLAD MAXCOLORBITS cbpc0 1 2 3 width floor log2 bpc0 1 2 3 1 or 0 if the component size is 0 frame width height 2 dimension of input frame Some typical setups and resulting compression rates compressed uncompressed for RGB888 image data RLADCompBitsRed Green Blue 4 5 4 gt 73 96 3 4 3 gt 61 2 3 2 gt 48 96 Note Images compressed with MML_GDC_SURF_COMP_RLAD may result in a smaller size however also for worst case images the
285. t use this function but call mmlGdcVideoGetFreeTotal Parameters in Heap to get information for out size Pointer to variable to receive the information Return values MML OK On success MML ERR MMAN INVALID PARAMETER If hdimem is NULL 11 16 4 4 MM ERROR utMmanGetLargest MMAN HEAP HANDLE MM U32 size Get the size of the largest free contiguous memory block on the heap Note Typically an application would not use this function but call mmlGdcVideoGetLargestBlock September 11 2015 56 20 AN709 00022 1v0 E 1 N 5 b APPLICATION NOTE Parameters in hdlmem Heap to get information for out size Pointer to variable to receive the information Return values MML OK On success ERR MMAN INVALID PARAMETER If hdimem is NULL 11 16 4 5 MM ERROR utMmanGetSize MMAN HEAP HANDLE hdimem MM 032 size Get the size of the heap Note Typically an application would not use this function but call mmlGdcVideoGetSize Parameters in hdlmem Heap to get information for out size Pointer to variable to receive the information Return values MML OK On success MML ERR MMAN INVALID PARAMETER If hdimem is NULL 11 16 4 6 MM ERROR utMmanHeapAlloc MML MMAN HEAP HANDLE hdimem MM U32 size MM 032 alignment MM ADDR addr Allocate a block of memory from the specified heap Note Typically an application would not use this
286. tAddr patternAddr patternSize storeAddr textAddr textSize set up an instruction buffer for the command sequencer UTIL_SUCCESS ret mmlGacSysSetlnstructionBuffer vinstrBufferAddr instructionBufferSize Fill with constant color First of all the store surface surfStore has to be initialized with mmlGdcSmResetSurfaceObject We use MML GDC SURF FORMAT R5G6B5 as the color format which means 5 bits for red channel 6 bits for green channel 5 bits for blue channel We use 0 0 255 255 pure blue non transparent as the constant color for the store surface To setup the blit path the context has to be reset and the store surface is bound to MML PE STORE mmlGdcPeFill finally fills the store surface with the given constant color the store surface mmlGdcSmhResetSurfaceObject surfStore use format 5 6 5 UTIL SUCCESS ret mmlGdcSmaAssignBuffer surfStore storeWidth storeHeight MML FORMAT R5G6B5 void storeAdadr 0 the context must be reset like the surface mmlGdcPeResetContext ctx we use a coordinate system starting in the upper left corner mmlGdcPeAttribute ctx MML PE ATTR ZERO POINT MML GDC PE ATTR ZERO TOP LEFT Bind the surface to the context UTIL SUCCESS ret mmlGdcPeBindSurface ctx MML GDC PE STORE surfStore define the constant color UTIL SUCCESS ret mmlGdcPeColor ctx 0 0 255 255 38 S6E2DH 709 00022 1 0
287. ta Return values True if successful otherwise false 12 22 3 10 unsigned header size const calc header size 12 22 3 11 unsigned image size const inline return uncompressed image size 238 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE 12 22 3 12 unsigned max code unsigned i const return max component value 12 22 4 Field Documentation 12 22 4 1 unsigned bpc NUM C bits per channel and pixel of uncompressed image 12 22 4 2 unsigned cbpc max NUM C max value for compressed bits per channel and pixel RLAD only 12 22 4 3 bool decode BufferTooLarge Buffer larger than required 12 22 4 4 bool decode BufferTooSmall Buffer too small for decompression 12 22 4 5 unsigned height frame dimension height in pixels 12 22 4 6 enum RLAD Mode mode store the compression mode 12 22 4 7 unsigned width frame dimension width in pixels The documentation for this class was generated from the following file ut class rlad h September 11 2015 56 20 AN709 00022 1v0 E inline ERG Z um CYPRESS PERFORM 239 Z CYPRESS APPLICATION NOTE E Ja PERFORM 13 File Documentation 13 1 flash_resource h File Reference Include this file before the definition of a bitmap 13 1 1 1 Detailed Description Include this file before the definition of a bitmap 13 2 mm defines h File Reference Common macro definitions for all modu
288. tents of this document are subject to change without notice This document may contain information on a Cypress product under development by Cypress Cypress reserves the right to change or discontinue work on any product without notice The information in this document is provided as is without warranty or guarantee of any kind as to its accuracy completeness operability fitness for particular purpose merchantability non infringement of third party rights or any other warranty express implied or statutory Cypress assumes no liability for any damages of any kind arising out of the use of the information in this document Copyright 2015 Cypress Semiconductor Corp All rights reserved Cypress the Cypress logo Spansion the Spansion logo MirrorBit MirrorBit Eclipse ORNAND Easy DesignSim Traveo and combinations thereof are trademarks and registered trademarks of Cypress Semiconductor Corp in the United States and other countries Other names used are for informational purposes only and may be trademarks of their respective owners 268 S6E2DH_AN709 00022 1v0 E September 11 2015
289. termination user space 11 14 2 20 NULL void 0 Definition of NULL pointer 11 14 2 21 define NULL FUNCTION void 0 Helper macro for deactivated functions 11 14 2 22 UNUSED PARAMETER x void x Helper macro for unused parameters 11 15 Tutorial Utility Library Modules Utilities for the Memory Management Utility functions for matrix calculations Utilities for the compatibility with other drivers Ulilities for the Surface Management Utilities for the compression Util class collection 11 15 1 Detailed Description The Utility Library contains many functions to simplify applications or to show the usage of 2D core features 11 16 Utilities for the Memory Management Macros define MML_ERR_MMAN_INVALID_PARAMETER MM_ERRCODE 0x18010001 define MML_ERR_MMAN_NO_MEMORY MM_ERRCODE 0x18010002 define MML_ERR_MMAN_NO_VRAM MM_ERRCODE 0x18010003 define ERR MMAN INVALID MEMORY MM_ERRCODE 0x18010004 define ERR MMAN ACCESS FAILED MM ERRCODE 0x18010005 stdefine VRAM BASE 0xD0000000U define MM VRAM SIZE 0x00080000U define SDRAM BASE 0xB0080000U 172 S6E2DH 709 00022 1 0 September 11 2015 M gt APPLICATION NOTE SJ CYPRESS PERFORM define MM SDRAM SIZE 0 010000000 Typedefs typedef void x MML MMAN HEAP HANDLE Functions MM ERROR utMmanReset void MM ERR
290. ters manually September 11 2015 56 20 AN709 00022 1v0 E 191 CYPRESS APPLICATION NOTE Parameters in uCnt The number of surface objects to create out pSurfaces The output array for the returned names Return values MML OK On success MML ERR GDC SURF INVALID PARAMETER If NULL pointer is given for pSurfaces MML ERR GDC SURF OUT OF SPACE If not enough memory to create the surface object 11 18 3 5 MM ERROR mmiGdcSyncCreate MM U32 uCnt MML SYNC pSyncObjects Creates cnt empty sync objects returning their names Parameters in uCnt Number of sync objects to create out pSyncObjects Output array for the returned names Return values MML OK Success MML ERR GDC SYNC INVALID PARAMETER Invalid parameter MML ERR GDC SYNC OUT OF MEMORY Out of memory 11 18 3 6 MM ERROR mmiGdcSyncDelete MM U32 uCnt MML SYNC pSyncObjects Deletes a list of sync objects Parameters in uCnt Number of sync objects to delete in pSyncObjects Array of sync objects to delete Return values MML OK Success MML ERR GDC SYNC INVALID PARAMETER Invalid parameter 11 18 3 7 void mmlGdcVideoAlloc 032 size U32 alignment MM ADDR pAddr Allocate a contiguous block of video memory 192 S6E2DH_AN709 00022 1v0 E September 11 2015 APPLICATION NOTE Parameters size Amount of memory to be allocated in bytes a
291. th in pixels of the image uHeight The height in pixels of the image The format of the image The format defines the fields BitPerPixel ColorBits ColorShift Color format eFormat pBufferAddress The memory address of the image The buffer starts with the upper left pixel Number of 32 bit words that are required to decode the run length encoded source uRleWords buffer Zero indicates an uncompressed buffer Return values MML_OK On success MML_ERR_GDC_SURF_INVALID_SURFACE If NULL pointer is given for surf MML_ERR_GDC_SURF_INVALID_FORMAT If illegal value is given for eFormat If surface size is out of range see MML ERR GDC SURF INVALID PARAMETER MML GDC SURFACE MAX WIDTH and MML GDC SURFACE MAX HEIGHT 11 4 5 2 MM ERROR mmiGdcSmAssignClut MML SURFACE surf MML GDC SURF CLM eMode MM U32 uCount MML SURF CLF eFormat void pBufferAddress Assign a color lookup table to a surface It points to VRAM memory address owned by the application The application must ensure that the memory is available as long as the surface is still in use and that the memory block is large enough with respect to the width height and format parameters of the surface Note uCount 0 or pBufferAddress 0 set the CLUT in neutral mode input data is bypassed to the output Parameters surf The surface object getting this new property eMode Defines the operation mode for
292. the color and alpha values on one pixel in an image Most modules inside the 2D core support the following bpp sizes 1 2 4 8 16 18 24 32 Display The term display is used to describe the output device showing the content generated by the 2D core Depending on connected hardware it can be an LCD panel monitor beamer or similar In context with the Basics Graphics Driver it is also the short name for the 2D core Display Controller a part of the 2D Graphics hardware External Alpha External alpha stands for an image buffer containing an alpha channel that is used as transparency information while blending a different color buffer over a background image The external alpha value will be multiplied with the alpha channel of the color buffer in this case Frame buffer A frame buffer is an image buffer that is typical first used as render target and afterwards it s content will be shown on a connected display Indexed image An indexed image does not store for each color a separate RGB A value but a single index value This index value points to a color look up table with up to 256 RGB A values that will be used as pixel color Such images can not contain more than 256 different colors but the size of such images are smaller The alpha channel can be part of the look up table it can be a separate channel beside the index channel or the image does not contain alpha information Acolor plane in front of the disp
293. the CLUT uCount Number of table entries to be written eFormat Format of the table entries pBufferAddress The address of the color index buffer Return values MML OK On success MML ERR SURF INVALID SURFACE If NULL pointer is given for surf MML ERR GDC SURF INVALID PARAMETER If illegal value is given for eMode MML ERR GDC SURF INVALID FORMAT If illegal value is given for eFormat September 11 2015 S6E2DH_AN709 00022 1v0 E 93 E CYPRESS APPLICATION NOTE 11 4 5 3 MM ERROR mmlGdcSmGetAttribute const MML SURFACE surf MML SURF eName U32 puValue Get surface attributes Parameters surf The surface eName Name of the attribute See MML GDC SURF ATTR puValue Pointer to a variable to receive the parameter value On success If illegal value is given for eName If NULL pointer is given for surf Return values MML ERR GDC SURF INVALID ATTRIBUTE MML OK MML ERR SURF INVALID SURFACE mmliGdcSmhResetSurfaceObject MML SURFACE surf 11 4 5 4 MM ERROR Reset a surface object with default values Parameters Return values 11 4 5 5 MM ERROR mmlGdcSmSetAttribute const MML SURFACE MML GDC SURF ATTR eName MM U32 uValue Set surface attributes The application must ensure that the parameters like stride height size and format of surf the surface are always consistent and match the size of
294. the surface s bit alpha Defines the bits for the alpha channel of the surface s Return values MML OK on success Otherwise the related error code 204 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE 11 28 2 5 CSurface Class CSurface constructor 11 28 2 6 MM ERROR Delete The Delete function can be used to free up allocated memory if any This function will be called in destructor too Return values MML OK on success Otherwise the related error code 11 28 2 7 void Init Class CSurface init function This functions does exactly the same as the constructor It is needed for some compilers at the moment ghs and gnu not running the constructors of global classes before main This function can be called from main as a workarroung 11 28 2 8 MM ERROR SurfLoadBitmap const void plmage MM BOOL bCopyToVRAM MM FALSE virtual The CreateBuffer function uses the utSurfLoadBitmap function to initialize the current surface object Parameters in plmage Pointer to the image in bCopyToVRAM MM TRUE if the bitmap and color look up table memory should be copied into VRAM Return values MML OK on success Otherwise the related error code 11 29 CWindow Data Structures class CWindow class CSurfaceWindow NUM BUFFERS gt class CStaticSurfaceWindow 11 29 1 Detailed Description The class CWindow can be used to open a window with the 2D core
295. tion and then draw the flower Draw 4 flowers with lines of different width MM U32 DrawLines UTIL CONTEXT putCtx MM_U32 ret MML OK MM FLOAT f cx cy px S Set the line end to round utLineEnd putCtx UT_LINE_END_BUTT px 5 py 0 The the paint color utColor putCtx 255 255 255 255 Change the line width to 0 5 pixel utLineWidth putCtx 0 6f Print a text as comment UTIL_SUCCESS ret utTextOut putCtx MM_S32 px MM_S32 py Width 0 6 30 px 50 py Draw lines in a loop for f 0 f lt 180 f 9 0f 30 cosf f DegreeToPI 30 sinf f DegreeToPI UTIL SUCCESS ret utLinef putCtx cx S S Repeat with different line widths at different positions on the screen repeat the code with different offsets and line width September 11 2015 56 20 AN709 00022 1v0 E 71 CYPRESS an APPLICATION NOTE PERFORM px 80 utLineWidth putCtx 1 0f UTIL SUCCESS ret utTextOut putCtx MM S32 px MM S32 py Width 1 0 cx 30 px cy 50 py for f 0 f lt 180 f 9 0f 30 cosf f DegreeToPI 30 sinf f DegreeToPl UTIL_SUCCESS ret utLinef putCtx cy S S px 80 utLineWidth putCtx 1 5f UTIL SUCCESS ret utTextOut putCtx MM S32 px MM S32 py Width 1 5 30 px cy 50 py for
296. tion can be used for simple translations The default behavior is that all matrices are reset to identity matrices That means a mmlGdcPeBlt amp ctx 10 20 would copy the source buffer to the target buffer with an offset x 2 10 and y 20 Depending on the MML GDC PE ATTR ZERO POINT settings the y offset is counted from the upper or lower left store surface coordinate An equivalent operation with a matrix would be the following if sSrc is the source surface Mat3x2Loadldentity mat Mat3x2Translate mat 10 20 mmlGdcPeSetMatrix ctx MML PE SRC mat mmlGdcPeBIt 0 0 However there are differences if several source buffers are involved If the offset x y is represented by a matrix Moffs 2 0 The following relationship to the store surface is be valid for the SRC surface represented by Ms 2 Moffs x Ms x 5 5 The path for the DST calculation is a little bit different is the DST matrix 2 5 This means the offsets valid for all paths except the DST and the individual matrix for each source buffer is used for this path only This behavior can be used to simplify any operations For instance you can set a mirror matrix to the store and without any other changes you can mirror all blit operations for this target In the speedometer example we calculate matrices for the rotation center of the images and use the blit offset t
297. tions BitStream bool big endian false unsigned Size const bool IsBigEndian const void Push unsigned bits unsigned data void Clear unsigned Read unsigned bits bool 0 void ResetRead Friends class RLAD 12 1 1 Detailed Description The class BitStream is used to store the compressed image 12 1 2 Constructor amp Destructor Documentation 12 1 2 1 BitStream bool big endian false inline Constructor Parameters Set true if system is big endian 12 1 3 Member Function Documentation 12 1 3 1 void Clear Reset stream 12 1 3 2 boolIsBigEndian const inline Return values 12 1 3 3 void Push unsigned bits unsigned data Push bits to the compressed stream September 11 2015 S6E2DH_AN709 00022 1v0 E 207 Td CYPRESS APPLICATION NOTE Parameters in bits Number of bits in data in data Data to push 12 1 3 4 unsigned Read unsigned bits bool err 0 Read bits from the compressed stream Parameters in bits Number of bits to read in out err Will be set to true if error occurs Return values 12 1 3 5 void ResetRead reset Read operation to begin 12 1 3 6 unsigned Size Size in bits const The documentation for this class was generated from the following file class rlad h 12 2 CCtx Class Reference include ut class ctx h Public Member Functions CCtx
298. tting target It is a single or OR combined value of MML GDC PE SRC MML GDC PE DST MML GDC PE STORE MML GDC PE MASK Left start coordinate of the active area 4095 4096 Lower or upper see MML GDC PE ATTR ZERO POINT start coordinate of the active area 4095 4096 Width of active area 0 4096 Height of active area 0 4096 Return values MML OK On success Otherwise the related error code 11 6 5 2 MML GDC PE API MM ERROR mmliGdcPeAttribute MML PE CONTEXT MML pname 032 param Set an attribute for the specified context If pectx is equal to NULL mmlGdcPeAttribute is terminated without any operation Parameters Pixel Engine context NULL State name for setting Can be one of MML PE CTX Parameter for argument target See MML GDC PE CTX ATTR description Return values MML OK On success Otherwise the related error code 11 6 5 3 ERROR mmlGdcPeBindSurface PE CONTEXT pectx U32 target MML GDC SURFACE surface mmlGdcPeBindSurface is setting function for parameters about source destination mask and store surface If pectx is equal to NULL mmlGdcPeBindSurface is terminated without any operation Note All bound surfaces must not be deleted as long as the context is used Parameter changes in the surface object after binding are used for fu
299. ttings does not influence the calculation The draw box is not influenced by Fill operations Parameters in out Pixel Engine context NULL in out Pointer to get horizontal start point in out Pointer to get vertical start point zero point depends on MML_GDC_PE_ATTR_ZERO_POINT in out Pointer to get width in out Pointer to get height in Reset flag see above Return values 136 S6E2DH 709 00022 1 0 September 11 2015 APPLICATION NOTE MML OK On success Otherwise the related error code 11 6 5 14 MML MM ERROR mmliGdcPeResetContext MML PE CONTEXT pectx Reset all parameters of the context object Parameters Pixel Engine context Return values MML OK On success Otherwise the related error code 11 6 5 15 MML MM ERROR mmliGdcPeRopOperation MML PE CONTEXT UO068 op red MM 008 op green 008 op blue MM 008 op alpha Set the Raster Operation ROP for each color channel and the alpha channel If pectx is equal to NULL mmlGdcPeRopOperation is terminated without any operation Note The involved source surfaces depend of the ROP mode The driver will report an error if a requested surface is not defined and is called of the ROP modes uses the DST surface the blend unit in the path will be switched off and the result will be written directly
300. uired a reduced bit with for the color channels are required e g R6G6B6A6 If this is not enough the alpha channel can also be stored in the image pixel If an indexed image is used it is required that the red component starts at the lowest bit for each pixel see MML SURF ATTR COLORBITS 11 4 2 Macro Definition Documentation 11 4 2 1 define MML SURFACE CONTROL HEIGHT 2048 Maximum supported height for surfaces 11 4 2 2 define MML SURFACE CONTROL WIDTH 2048 Maximum supported width for surfaces 11 4 2 3 Zdefine MML SURFACE MAX HEIGHT 4096 Absolute maximum height for surfaces 11 4 2 4 define MML SURFACE MAX WIDTH 4096 Absolute maximum width for surfaces 11 4 3 Typedef Documentation 11 4 3 1 typedef MML SURFACE MML GDC SURFACE The surface object definition September 11 2015 S6E2DH_AN709 00022 1v0 E 87 APPLICATION NOTE 11 4 4 Enumeration Type Documentation 11 4 4 1 enum MML GDC SURF ATTR Surface attribute Enumerator MML GDC SURF ATTR BASE ADDRESS Virtual base address initial O Note The base address should be used to address images inside the VRAM While setting a virtual address the physical address will be overwritten MML GDC SURF ATTR PHYS ADDRESS Physical base address initial 0 Note be used to read image buffers direct from NOR flash While setting a physical address the virtual address will
301. unction It just describes how the image buffer must be used by a function The application must ensure that the memory is available as long as the surface is being used Note The mmlGdcSmAssignBuffer call is a fast way to assign an image to a surface object Alternatively it is also possible to assign the same properties with several calls of mmlGdcSmsSetAttribute x The eFormat value can be used to define the most useful color formats Please note that not all hardware units support all color formats The MML SURF FORMAT description includes hints which format can be used with which unit PixEng HW can operate with many more color formats Use mmlGdcSmsSetAttribute in this case to assign the correct format to the surface 92 S6E2DH 709 00022 1 0 September 11 2015 y APPLICATION NOTE cypress PERFORM some cases pBufferAddress be zero Such surfaces can be used as source surfaces in PixEng operations In this case the hardware will not access surface memory but the driver uses the geometry settings of the surface Surfaces with run length encoded buffers uRleWords 0 are only supported for source surfaces in PixEng operations If uRleWords is different from zero MML SURF will be set to SURF COMPRESSION FORMAT otherwise MML GDC SURF COMP NON Parameters surf The surface object uWidth The wid
302. urfaces for the example using a utility function The utility function sets all the related properties including compression parameter First we load the the map surface with 1024 1024 pixel resolution Of course we will read only a part if we use it as layer in this example UTIL SUCCESS ret utSurfLoadBitmap sMap FALSE Now we load the blue frame surface Please note that this surface is run length encoded UTIL SUCCESS ret utSurfLoadBitmap sFrame frame FALSE Next we load a position indicator bitmap UTIL SUCCESS ret utSurfLoadBitmap sPosition position FALSE Finally we load the arrow bitmaps 1 bpp and 2 bpp alpha channel UTIL SUCCESS ret utSurfL oadBitmap sArrow arrow FALSE Additional we have to create 4 windows create 4 windows for the layer sMap winprop topLeftX 0 winprop topLeftY 0 winprop width dispParams xResolution horizontal display resolution winprop height dispParams yResolution vertical display resolution winprop features MML DISP FEATURE DECODE We do not need decode However it ensures the driver uses this fetch and not the multilayer fetch September 11 2015 S6E2DH_AN709 00022 1v0 E 45 CYPRESS 4 APPLICATION NOTE PERFORM Other way just open this window as the last one winprop layerld MML DISP LAYER 0 use layer 0 UTIL SUCCESS ret mmlGdcDispWinCr
303. uring all calls A function call with this parameter resets the measurement The returned value can be used by an application to measure the usage of the instruction buffer assigned by mmlGdcSysSetlnstructionBuffer MML GDC CONFIG ATTR CURRENT INSTRUCTION BUFFER This attribute is only available in mmlGdcConfigGetAttribute The returned value represents the current available InstructionBuffer in bytes The returned value can be used by an application to decide whether or not further render steps should be delayed and continued later because the hardware is currently still busy MML GDC CONFIG ATTR DISPLAY NOBLOCK The following functions can not be executed if a previous reconfiguration of a corresponding window or display is not yet finished mmlGdcDispOpenDisplay mmlGdcDispCloseDisplay mmlGdcDispWinCreate mmlGdcDispWinDestroy mmlGdcDispCommit mmlGdcDispWinCommit If this attribute is O default the function will block the CPU until it can be executed If this attribute is not 0 the function will return immediately in that case with error MML_ERR_GDC_DISP_DEV_BUSY It is up to the application to handle this case and reschedule the function call later Note application can also use the synchronization to find out if the previous reconfiguration is finished MML_GDC_CONFIG_ATTR_BUILD_TYPE Returns the build type of the driver The returned values can be d for debug version of driver r f
304. ut are not designed developed and manufactured as contemplated 1 for any use that includes fatal risks or dangers that unless extremely high safety is secured could have a serious effect to the public and could lead directly to death personal injury severe physical damage or other loss i e nuclear reaction control in nuclear facility aircraft flight control air traffic control mass transport control medical life support system missile launch control in weapon system or 2 for any use where chance of failure is intolerable i e submersible repeater and artificial satellite Please note that Cypress will not be liable to you and or any third party for any claims or damages arising in connection with above mentioned uses of the products Any semiconductor devices have an inherent chance of failure You must protect against injury damage or loss from such failures by incorporating safety design measures into your facility and equipment such as redundancy fire protection and prevention of over current levels and other abnormal operating conditions If any products described in this document represent goods or technologies subject to certain restrictions on export under the Foreign Exchange and Foreign Trade Law of Japan the US Export Administration Regulations or the applicable laws of any other country the prior authorization by the respective government entity will be required for export of those products Trademarks and Notice The con
305. utMat3x3ToMat4x4 Mat3x3 src Convert a 3x3 matrix to a 4x4 matrix Mat4x4 dst S6E2DH 709 00022 1 0 September 11 2015 184 APPLICATION NOTE EZ CYPRESS Parameters out dst The destination matrix in SIC The source matrix 11 17 4 20 MML 2D MATRIX void utMat3x3Translate Mat3x3 MM FLOAT x MM FLOAT y Modify a 3x3 matrix to realize a move operation The resulting matrix represents m m m trans Parameters The matrix to modify Move dimension in x direction Move dimension in y direction 11 17 4 24 2D MATRIX void utMat3x3TranslatePre Mat3x3 m MM FLOAT x MM FLOAT y Modify a 3x3 matrix by pre multiplying a move matrix The resulting matrix represents m 2 m trans m Parameters The matrix to modify Move dimension in x direction Move dimension in y direction 11 17 4 22 MML 2D MATRIX void utMat4x3CalcColMatrix Mat4x3 dst MM FLOAT fContrast MM FLOAT fBrightness MM FLOAT fSaturation MM FLOAT fHue Calculate a color matrix with given parameters Parameters dst Destination color matrix Previous matrix values will be overwritten fContrast Set the contrast color component amplification A useful range for fContrast is 0 0 2 0 with 1 0 stands for no contrast modifications and higher and lower values stand for amplification and attenuation fBrightness Set the brightness color c
306. values On success MML OK If a parameter is invalid MML ERR GDO DISP INVALID ARG 11 5 5 9 MM ERROR mmlGdcDispWinCommit MML DISP WINDOW win All window related updates will be written in a work item mmlGdcDispWinCommit submit the work item of a window for processing By default this function is blocked until previous operations of device window are completely executed Use mmlGdcConfigSetAttribute set MML CONFIG ATTR DISPLAY NOBLOCK to 1 to make it non blocking Parameters win MML DISP WINDOW returned from a previous call to mmlGdcDispWinCreate Return values On success One of the parameters is invalid The writing to the device window is denied because MML OK MML ERR GDO DISP INVALID ARG the previous commit create MML ERR GDC DISP DEV BUSY or destroy call is not completely executed e g shadow load request is pending Call again later 11 5 5 10 MM ERROR mmiGdcDispWinCreate DISPLAY display MML DISP WINDOW PROPERTIES properties MML DISP WINDOW Used to create a window By default this function is blocked until previous operations of device display and device window are completely executed Use mmlGdcConfigSetAttribute set MML CONFIG ATTR DISPLAY NOBLOCK to 1 to make it non blocking S6E2DH 709 00022 1 0 September 11 2015 112 y APPLICATION NOTE Z7 CYPRESS e Not
307. ve area see mmlGdcPeActiveArea of the src surface and the given matrix transformation defined by mmlGdcPeSetMatrix mmlGdcPeSelectArea changed it to active area of any other bounded surfaces or a combination of surfaces Combination can be defined like this mmlGdcPeSelectArea pectx MML SRC GDC PE DST If more than one surface defines to target the bounding box of all active areas will be used Parameters Pixel Engine context I NULL in Selecting target It is a single or OR combined value of MML default MML GDC PE DST MML GDC PE STORE MML GDC PE MASK Return values MML OK On success Otherwise the related error code 11 6 5 17 MML MM ERROR mmlGdcPeSetMatrix PE CONTEXT U32 target MML GDC PE GEO MATRIX FORMAT format const MM FLOAT fMatrix mmlGdcPeSetMatrix is setting function of transformation matrix for scaling rotation translation and flipping for all source surfaces MML GDC PE SRC MML GDC PE DST and MML GDC PE MASK The formula for the transformation based on this matrix is as follows xout fMatrix 0 xin fMatrix 2 yin fMatrix 4 yout fMatrix 1 xin fMatrix 3 yin fMatrix 5 If fMatrix NULL an identity matrix no transformation will be set If pectx is equal to NULL mmlGdcPeSetMatrix is terminated without any operation Parameters pectx Pixel Engine context I NULL target Setting target It is a
308. verflow CompareFnc const void arg1 const void arg2 Coverflow COVERPOS Coverflow COVERPOS 1 Coverflow COVERPOS 2 Coverflow COVERPOS 2 if p1 z lt 2 gt 2 return 1 if p1 z gt p2 z return 1 return 0 6 11 Tutorial Digital Picture Frame 6 11 1 Summary This example demonstrates several PixelEngine features in form of digital picture frame software It includes several blend classes to show different old picture new picture animations by using different features like Movements Rotation Alpha blend Alpha masking Color matrix modification 6 12 Tutorial Simple Drawing 6 12 1 Summary This is a more complex example that draws lines circles rectangles and text The example shows how complex features can be achieved in software by combining simple features supported by the hardware Draw lines with different widths and line ends September 11 2015 S6E2DH_AN709 00022 1v0 E 67 ESS APPLICATION NOTE PERFORM Draw circles and points Draw rectangles Figure 6 17 Expected result Points 1 114 Width O 6Width l 0Width 1 5Width Some information text is also displayed The functions for drawing lines circles and texts are implemented as utility functions in the util lib directory 6 12 2 Code documentation 6 12 2 1 Preparation Once again we start with a collection of several driver and dis
309. xFE define MML GDC PE ROP MASKSEL MM_U08 0xB8 define MML GDC PE ROP DSTAND MM U08 0x80 define MML GDC PE FILTER NEAREST 0 define MML GDC PE FILTER_BILINEAR 1 define MML GDC PE ATTR_ZERO_TOP_LEFT 0U define MML GDC PE ATTR_ZERO_BOTTOM_LEFT 1U define MML GDC PE TILE FILL ZERO 0U define MML GDC PE TILE FILL_CONSTANT 1U define MML GDC_ PE_TILE_PAD 2U define MML_GDC_PE_TILE_PAD_ZERO 3U Typedefs typedef PE CONTEXT CONTAINER MML GDC PE CONTEXT Enumerations enum CTX MML PE DITHER COLOR PE DITHER ALPHA MML CTX ATTR DITHER OFFSET MML PE ATTR FILTER PE ZERO POINT 118 S6E2DH 709 00022 1 0 September 11 2015 CE APPLICATION NOTE F CYPRESS e PERFORM enum MML_GDC_PE_SURF_ATTR MML_GDC_PE_SURF_ATTR_COLORMULTI MML GDC PE SURF ATTR ALPHAMULTI MML GDC PE SURF ATTR TILE MODE MML GDC PE SURF ATTR USE CLIPPING enum PE GL ZERO 0x0U MML PE BF GL ONE 0x1U MML GDC PE BF GL SRC COLOR 0x300U MML GDC PE BF GL ONE MINUS SRC COLOR 0x301U MML PE BF GL SRC ALPHA 0x302U MML GDC PE BF GL ONE MINUS SRC ALPHA
310. xist within the 2D Graphics Driver The Window mmlGdcDispWinCommit may wait for a sync condition see mmlGdcDispWinWaitSync The Pixel Engine command queue can wait for a sync condition see mmlGdcPeWaitSync The CPU can check a sync condition Check sync condition see mmlGdcSyncWait September 11 2015 S6E2DH_AN709 00022 1v0 E 23 CYPRESS APPLICATION NOTE f PERFORM 4 6 3 Sample use cases 4 6 3 1 Double buffered window A typical application must render a new frame content for each display loop Double buffered frame buffers are used to render the next frame in a background buffer while the foreground buffer memory is read by the display controller The following sample code shows how the application can use the 2D Graphics Driver Synchronization API to realize a double buffered Window This structure contains the objects required for a double buffered window struct DOUBLE BUFFERED WINDOW MML_GDC_DISP_WINDOW win the window handle MML_GDC_SURFACE_CONTAINER sFramebuffer 2 Two buffers described as surface objects MML_GDC_SYNC_CONTAINER sync A sync object MM 008 id An id storing which buffer is currently the foreground buffer This is the draw function for the window including buffer swap and synchronization MM ERROR draw DOUBLE BUFFERED WINDOW pdbWin Return if the last render operation is still ongoing if mmlGdcSyncWait amp pdbWin gt sync 0 MML ERR
Download Pdf Manuals
Related Search
Related Contents
Info rehab. Route de St Leu-Villetaneuse FORBOISDECOR 2 UC-7420/7410 User`s Manual 計装 - 三菱電機システムサービス HQ WB1 Kenroy Home 50198SMG Installation Guide BARNIZ PARQUET Y TARIMA Discrete - Mark Pagel - University of Reading SuperBus 2000 Energy Saver Module Installation Les fiches guide du dirigeant Copyright © All rights reserved.
Failed to retrieve file