os/graphics/egl/egltest/endpointtestsuite/automated/tinc/egltest_endpoint_engine_types.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
/**
sl@0
    17
 @file
sl@0
    18
 @test
sl@0
    19
 @internalComponent - Internal Symbian test code
sl@0
    20
*/
sl@0
    21
sl@0
    22
sl@0
    23
#ifndef __EGLTEST_ENDPOINT_ENGINE_TYPES_H__
sl@0
    24
#define __EGLTEST_ENDPOINT_ENGINE_TYPES_H__
sl@0
    25
sl@0
    26
#include "egltest_surface.h"
sl@0
    27
sl@0
    28
sl@0
    29
enum TEngineCases
sl@0
    30
    {
sl@0
    31
    // ECreateEndpointCase
sl@0
    32
    // iEndPointIndex is used to store the endpoint at that index.
sl@0
    33
    ECreateEndpointCase = 0,
sl@0
    34
sl@0
    35
    // EBeginStreamingCase
sl@0
    36
    // Call EglEndpointBeginStreaming.
sl@0
    37
    // iEndpointIndex indicates the endpoint to call BeginStreaming on.
sl@0
    38
    EBeginStreamingCase = 1,
sl@0
    39
sl@0
    40
    // EAcquireImageCase
sl@0
    41
    // iEndpointIndex indicates the endpoint used to acquire the image.
sl@0
    42
    // iImageIndex is ignored.
sl@0
    43
    EAcquireImageCase = 2,
sl@0
    44
sl@0
    45
    // EReleaseImageCase
sl@0
    46
    // iEndpointIndex indicates the endpoint used to acquire the image.
sl@0
    47
    // iImageIndex indicates the slot of the eglImage to be used.
sl@0
    48
    EReleaseImageCase = 3,
sl@0
    49
sl@0
    50
    // EEndStreamingCase
sl@0
    51
    // Call EglEndPointEndStreaming.
sl@0
    52
    // iEndpointIndex indicates which endpoint to use.
sl@0
    53
    EEndStreamingCase = 4,
sl@0
    54
sl@0
    55
    // EContentUpdateCase
sl@0
    56
    // iEndpointIndex indicates which surface to use.
sl@0
    57
    // iImageIndex index to the rectangle set to pass in as "dirty rectangles".
sl@0
    58
    //             if index = 0, then a NULL is passed - indicating full surface 
sl@0
    59
    //             (no other value currently supported).
sl@0
    60
    // iFlags: ENoWait: complete immediately, rather than wait for displayed 
sl@0
    61
    //                  notification (only valid for non-EGL surfaces).
sl@0
    62
    //         ENoSync: Do not wait for contentupdate to complete, instead, 
sl@0
    63
    //                  use a short delay (300ms) to ensure the submitupdate
sl@0
    64
    //                  has reached SUS.
sl@0
    65
    //                  This is necessary to avoid a deadlock where the local
sl@0
    66
    //                  side is doing EglSwapBuffer [or similar], and the 
sl@0
    67
    //                  remote side has not yet done EglReleaseImageNOK.
sl@0
    68
    //                  If the local side was to wait for the EglSwapBuffer 
sl@0
    69
    //                  to complete, the EglReleaseImageNOK would not happen.
sl@0
    70
    //                  There is no need to have ENoSync if the EglReleaseBuffer
sl@0
    71
    //                  for that endpoint is called before the EContentUpdateCase.
sl@0
    72
    EContentUpdateCase = 5,
sl@0
    73
sl@0
    74
    // EDestroyEndpointCase
sl@0
    75
    // iEndpointIndex indciates the endpoint to be destroyed.
sl@0
    76
    EDestroyEndpointCase = 6,
sl@0
    77
sl@0
    78
    // ETerminateCase
sl@0
    79
    // Call eglTerminate and does various other cleanup.
sl@0
    80
    // No egl calls except eglInitialize is expected to "work" after this point.
sl@0
    81
    // This is also sent to the local exec thread to terminate it when test step
sl@0
    82
    // is finished. 
sl@0
    83
    ETerminateCase = 7,
sl@0
    84
sl@0
    85
    // EInitializeCase
sl@0
    86
    // Initialize. Call eglInitialize and other setup.
sl@0
    87
    EInitializeCase = 8,
sl@0
    88
sl@0
    89
    // EGetAttributeCase
sl@0
    90
    // iEndpointIndex indicates the endpoint to use.
sl@0
    91
    // iArg1 is the attribute key to request.
sl@0
    92
    // iArg2 is the value expected.
sl@0
    93
    EGetAttribCase = 9,
sl@0
    94
sl@0
    95
    // ESetAttributeCase
sl@0
    96
    // iEndpointIndex indicates the endpoint to use.
sl@0
    97
    // iImageIndex is ignored.
sl@0
    98
    // iArg1 is the attribute key to request.
sl@0
    99
    // iArg2 is the value to set.
sl@0
   100
    ESetAttribCase = 10,
sl@0
   101
sl@0
   102
    // ECreateSurfaceCase
sl@0
   103
    // iEndpointIndex indicates which the surface object is stored at
sl@0
   104
    // iImageIndex indicates the surfaceParams to use.
sl@0
   105
    ECreateSurfaceCase = 11,
sl@0
   106
sl@0
   107
    // EDrawContentCase
sl@0
   108
    // Draws an image.
sl@0
   109
    // iEndpointIndex indicates the surface to draw to.
sl@0
   110
    // iImageIndex is the index of the image to be drawn.
sl@0
   111
    EDrawContentCase = 12,
sl@0
   112
sl@0
   113
    // ECompareImageCase
sl@0
   114
    // iEndpointIndex = the index of the eglimage stored, the iImageIndex when it was acquired
sl@0
   115
    // iImageIndex is the index of the image to compare
sl@0
   116
    ECompareImageCase = 13,
sl@0
   117
sl@0
   118
    // EBufferCountCase
sl@0
   119
    // Query the surface to find out number of buffers, and only run the remainder
sl@0
   120
    // of case if the number of buffers match. If test fails, log a warning that
sl@0
   121
    // the test is not executed, then terminate the case.
sl@0
   122
    // iEndpointIndex = number of the surface to check.
sl@0
   123
    // iImageIndex = n/a - ignored.
sl@0
   124
    // arg1 = Min buffer count (inclusive). 0 -> any number.
sl@0
   125
    // arg2 = Max buffer count (inclusive). 0 -> any number
sl@0
   126
    EBufferCountCase = 14,
sl@0
   127
sl@0
   128
    // ENotifyWhenCase
sl@0
   129
    // iEndpointIndex = surface for which the notification applies.
sl@0
   130
    // iImageIndex = which notification (See TNotification in egltest_surface.h)
sl@0
   131
    // iArg1 = XTimes when ENotifyWhenDispXTimes
sl@0
   132
    ENotifyWhenCase = 15,
sl@0
   133
sl@0
   134
    // EWaitForCase
sl@0
   135
    // iExpectedError = KErrTimedOut if the notification is expected to "not be signaled", KErrNone for other cases.
sl@0
   136
    // iEndpointIndex = surface for which to wait on notification (also used for timestamp).
sl@0
   137
    // iImageIndex = which notification (See TNotification in egltest_surface.h)
sl@0
   138
    // iArg1 = Timeout length in microseconds.
sl@0
   139
    // iArg2 = expected timestamp. (NOtifywhendisplayed), relative to timestamp of ETimeStampCase.
sl@0
   140
    EWaitForCase = 16,
sl@0
   141
sl@0
   142
    // ECreateVgImageCase
sl@0
   143
    // iEndpointIndex = the index of the eglimage to create the vgimage from.
sl@0
   144
    // iImageIndex is the index in the vgimages array that the created vgimage will be saved to.
sl@0
   145
    ECreateVgImageCase = 17,
sl@0
   146
sl@0
   147
    // EDestroyVgImageCase
sl@0
   148
    // iImageIndex is the index in the vgimages array that will be destroyed.
sl@0
   149
    EDestroyVgImageCase = 18,
sl@0
   150
sl@0
   151
    // EDestroyEglImageCase
sl@0
   152
    // Note: This is not intended for normal endpoint tests - use EReleaseImageCase for that.
sl@0
   153
    // iEndpointIndex = ignored.
sl@0
   154
    // iImageIndex = image index to destroy.
sl@0
   155
    EDestroyEglImageCase = 19,
sl@0
   156
sl@0
   157
    // ETimeStampCase
sl@0
   158
    // Store current User::FastCounter().
sl@0
   159
    // iEndpointIndex = index to store timestamp at (should match the surface index).
sl@0
   160
    ETimeStampCase = 20,
sl@0
   161
sl@0
   162
    // ETestVgImageValidCase
sl@0
   163
    // Test that the VgImage is valid and "works" by reading some of the pixels in it.
sl@0
   164
    // No checking that the content is as expected, since where we use this
sl@0
   165
    // is to test that the VgImage is valid after destroying the endpoint - at which point
sl@0
   166
    // the content is undefined, but the VgImage must be usable by the effects engine code.
sl@0
   167
    // See also ECreateVgImageCase.
sl@0
   168
    // iEndpointIndex ignored.
sl@0
   169
    // iImageIndex is the index of the vgimage to be drawn.
sl@0
   170
    ETestVgImageValidCase = 21,
sl@0
   171
sl@0
   172
    // ERequestNotificationCase
sl@0
   173
    // Request a notification of update.
sl@0
   174
    // iEndpointIndexis the index of the endpoint to use.
sl@0
   175
    ERequestNotificationCase = 22,
sl@0
   176
sl@0
   177
    // ECancelNotificationCase
sl@0
   178
    // Cancel a notification of update.
sl@0
   179
    // iEndpointIndexis the index of the endpoint to use.
sl@0
   180
    ECancelNotificationCase = 23,
sl@0
   181
sl@0
   182
    // EWaitForNotificationCase
sl@0
   183
    // Wait for the notification of the
sl@0
   184
    // iEndpointIndex is the index of the endpoint to use.
sl@0
   185
    // iImageIndex - not used
sl@0
   186
    // iArg1 - timeout value in microseconds.
sl@0
   187
    EWaitForNotificationCase = 24,
sl@0
   188
sl@0
   189
    // EGetEndpointDirtyAreaCase
sl@0
   190
    // Get dirty area
sl@0
   191
    // iEndpointIndex is the index of the endpoint to use.
sl@0
   192
    // iImageIndex index to the rectangle set to pass in as "dirty rectangles".
sl@0
   193
    //             if index = 0, then full surface is expected.
sl@0
   194
    // iarg1 start_rect
sl@0
   195
    // iArg2 max_rects
sl@0
   196
    // iFlags - EUseNullRects - pass NULL as the rects value.
sl@0
   197
    //          EUseCollapseArea - pass TRUE for collapse
sl@0
   198
    EGetEndpointDirtyAreaCase = 25,
sl@0
   199
    
sl@0
   200
    // EGetSurfaceParamsCase
sl@0
   201
    // Get parameters of the surface. 
sl@0
   202
    // iEndpointIndex is the index of the surface being used.
sl@0
   203
    // This is used for internal communication between the controller thread
sl@0
   204
    // and the EGL execution thread, so the parameters can be passed over to
sl@0
   205
    // the remote side. This is due to the fact that we can only use the 
sl@0
   206
    // RWindow component that is part of an EGL surface in the thread that
sl@0
   207
    // created the RWindow.
sl@0
   208
    EGetSurfaceParamsCase = 26, 
sl@0
   209
    
sl@0
   210
    // EDestroySurfaceCase
sl@0
   211
    // Opposite of ECreatSurfaceCase.
sl@0
   212
    // iEndpointIndex indicates which surface object
sl@0
   213
    EDestroySurfaceCase = 27,
sl@0
   214
    
sl@0
   215
    // EStartLoadThreadCase
sl@0
   216
    // For tests that have some sort of second thread that does "loading" 
sl@0
   217
    // (e.g. heavy drawing or using up memory), this will start that thread.
sl@0
   218
    // iEndpointIndex is the thread number. 
sl@0
   219
    // Note, relies on the thread implementing a StartLoadThread() function -
sl@0
   220
    // default implementation will panic.
sl@0
   221
    EStartLoadThreadCase = 28,
sl@0
   222
    
sl@0
   223
    // EEndLoadThreadCase
sl@0
   224
    // For tests that have some sort of second thread that does "loading" 
sl@0
   225
    // (e.g. heavy drawing or using up memory), this will end the thread.
sl@0
   226
    // iEndpointIndex is the thread number. 
sl@0
   227
    // Note, relies on the thread implementing a EndLoadThread() function -
sl@0
   228
    // default implementation will panic.
sl@0
   229
    EEndLoadThreadCase = 29,
sl@0
   230
    
sl@0
   231
    // ECheckForMemoryLeaks
sl@0
   232
    // Used by tests that perform for example out-of-memory testing. 
sl@0
   233
    // Executed on the in the remote engine code. 
sl@0
   234
    // The amount of memory available is stored in an array, and when 
sl@0
   235
    // the ECheckForMemoryLeaksFinish is called, the statistics is
sl@0
   236
    // calculated abd deternubed if there is a leak or not. 
sl@0
   237
    ECheckForMemoryLeaks = 30,
sl@0
   238
    
sl@0
   239
    // ECheckForMemoryLeaksFinish
sl@0
   240
    // Check the collected data from ECheckForMemoryLeaks, and determine the
sl@0
   241
    // trend of memory usage. 
sl@0
   242
    // See ECheckForMemoryLeaks
sl@0
   243
    ECheckForMemoryLeaksFinish = 31,
sl@0
   244
    
sl@0
   245
    // ESpecialEglHeapCase
sl@0
   246
    // Configure a heap for the EGL calls. 
sl@0
   247
    // This is used to allow egl calls to be done with a heap that is full.
sl@0
   248
    // iEndpointIndex = min size
sl@0
   249
    // iImageIndex = max size
sl@0
   250
    // IMPORTANT NOTE: This HAS TO BE the first case sent to the remote engine. 
sl@0
   251
    ESpecialEglHeapCase = 32,
sl@0
   252
sl@0
   253
    
sl@0
   254
    ///
sl@0
   255
    /// Debug cases
sl@0
   256
    ///
sl@0
   257
    // EBreakPointCase
sl@0
   258
    // Used for debugging.
sl@0
   259
    // iFlags = EDebugExecThread, EDebugController, EDebugRemote - break 
sl@0
   260
    // exec_thread, controller and/or remote part of engine.
sl@0
   261
    EBreakPointCase = 64,
sl@0
   262
sl@0
   263
    // ELogEnableCase
sl@0
   264
    // Logging enable - all items executed after this point are written out, including data parameters.
sl@0
   265
    // iFlags = EDebugLocal, EDebugRemote - log on local/remote side.
sl@0
   266
    ELogEnableCase = 65,
sl@0
   267
sl@0
   268
    ///////////////////////////////////////////////////////
sl@0
   269
    // Control messages - "done", "sync", etc.
sl@0
   270
    ///////////////////////////////////////////////////////
sl@0
   271
    
sl@0
   272
    // ESetVerdictCase
sl@0
   273
    // Used to set the relevant threads "teststepresult".
sl@0
   274
    // Flags indicate which thread is updated.
sl@0
   275
    // iEndpointIndex = verdict to set. 
sl@0
   276
    // Note: Remote value is not using the ERtvXXX values, the standard
sl@0
   277
    // values in Test Framework are translated in the remote step.
sl@0
   278
    ESetVerdictCase = 996,
sl@0
   279
    
sl@0
   280
    // ESyncLocalCase
sl@0
   281
    // Used for synchronizing the local execution thread. 
sl@0
   282
    // Should normally not be needed for the common cases of coding, but used internally to 
sl@0
   283
    // perform the synchronization. 
sl@0
   284
    ESyncLocalCase = 997,
sl@0
   285
sl@0
   286
    // EPanicCase
sl@0
   287
    // Cause panic on local or remote side. Used for testing purposes only.
sl@0
   288
    // iFlags = EDebugExecThread, EDebugController, EDebugRemote - break 
sl@0
   289
    // exec_thread, controller and/or remote part of engine.
sl@0
   290
    EPanicCase = 998,
sl@0
   291
sl@0
   292
    // EIllegalCase
sl@0
   293
    // A case that is by definition not legal/valid. There should be no case-
sl@0
   294
    // statement for this in the engine, it should be treated as a "unknown" case,
sl@0
   295
    // and cause any test to fail in the same way as if an unused value was put
sl@0
   296
    // in the table. Used for testing purposes, and can also be used to make a
sl@0
   297
    // particular test fail on purpose (e.g. due to production code bugs).
sl@0
   298
    // All arguments ignored.
sl@0
   299
    EIllegalCase = 999,
sl@0
   300
sl@0
   301
    // Indicate end of sequence.
sl@0
   302
    EFinishedCase = 1000
sl@0
   303
    };
sl@0
   304
sl@0
   305
enum TEngineFlags
sl@0
   306
    {
sl@0
   307
    EUseBadDisplay      = 1 << 0,
sl@0
   308
    EUseBadEndpoint     = 1 << 1,
sl@0
   309
    EUseBadEglImage     = 1 << 2,
sl@0
   310
    EUseBadEndpointType = 1 << 3,
sl@0
   311
    EUseBadSourceType   = 1 << 4,
sl@0
   312
    EExpectError        = 1 << 5,  // Used when other flags are not indicating a failure expected.
sl@0
   313
    EUseBadSurfaceId    = 1 << 6,
sl@0
   314
    EUseBadApi          = 1 << 7,
sl@0
   315
    // Flag to modify EContentUpdateCase to not wait for displayed.
sl@0
   316
    EUseBadSync         = 1 << 8,
sl@0
   317
    EUseBadRects        = 1 << 9,
sl@0
   318
    // Extra flags for EGetEndpointDirtyAreaCase
sl@0
   319
    EUseNullRects       = 1 << 10,
sl@0
   320
    EUseCollapseArea    = 1 << 11,
sl@0
   321
    
sl@0
   322
    // flags used by EContentUpdateCase
sl@0
   323
    ENoWait             = 1 << 14,
sl@0
   324
    ENoSync             = 1 << 15,
sl@0
   325
sl@0
   326
    // Debug flags - perform operation on "Local"
sl@0
   327
    EDebugExecThread      = 1 << 16,
sl@0
   328
    EDebugRemote        = 1 << 17,
sl@0
   329
    EDebugController    = 1 << 18,
sl@0
   330
    
sl@0
   331
    // ThreadingFlags - just rename the debug flags, because it's actually the
sl@0
   332
    // same thing. We _RELY_ on this being the same to simplify the code in 
sl@0
   333
    // the controller thread.
sl@0
   334
    // Note: the lack of "execthread" is intentional. Since controller and exec
sl@0
   335
    // are in the same process, there is no reason to use the ExecThread to 
sl@0
   336
    // start a new thread. ??This may need to be changed int he future.??
sl@0
   337
    EThreadRemote       = EDebugRemote,
sl@0
   338
    EThreadController   = EDebugController,
sl@0
   339
    };
sl@0
   340
sl@0
   341
enum TEngineFlagsMask
sl@0
   342
    {
sl@0
   343
    // Mask to match all "bad".
sl@0
   344
    EExpectFailureMask  = EUseBadDisplay       |
sl@0
   345
                          EUseBadEndpoint      |
sl@0
   346
                          EUseBadEglImage      |
sl@0
   347
                          EUseBadEndpointType  |
sl@0
   348
                          EUseBadSourceType    |
sl@0
   349
                          EExpectError         |
sl@0
   350
                          EUseBadSurfaceId     |
sl@0
   351
                          EUseBadApi           |
sl@0
   352
                          EUseBadSync          |
sl@0
   353
                          EUseBadRects         |
sl@0
   354
                          0   // So that it's easier to merge.
sl@0
   355
    };
sl@0
   356
sl@0
   357
sl@0
   358
enum TRemoteThreadEngineThread
sl@0
   359
    {
sl@0
   360
    EUnknownThread = 0,
sl@0
   361
    EThreadLoadHeapMemory = 1,
sl@0
   362
    EThreadLoadGpuMemory = 2,
sl@0
   363
    EThreadLoadGpuProcessor = 3,
sl@0
   364
    };
sl@0
   365
sl@0
   366
struct TEngineTestCase
sl@0
   367
    {
sl@0
   368
    TEngineCases iCase;             // Command to execute. See TEngineCases for details.
sl@0
   369
    TInt         iFlags;            // Flags to indicate for example bad parameters (TEngineFlags).
sl@0
   370
    TInt         iErrorExpected;    // The value that eglGetError() is expected to return.
sl@0
   371
    TInt         iEndpointIndex;    // Index to the endpoint to use.
sl@0
   372
    TInt         iImageIndex;       // Index to image to draw/compare(egltest_endpoint_images)
sl@0
   373
    TInt         iArg1;             // E.g. GetAttrib or SetAttrib attrib.
sl@0
   374
    TInt         iArg2;             // E.g  GetAttrib expected value or SetAttrib value to set.
sl@0
   375
    };
sl@0
   376
sl@0
   377
sl@0
   378
struct TTestEndpointEngine
sl@0
   379
    {
sl@0
   380
    TSurfaceParamsRemote iSurfaceParams;
sl@0
   381
    TEngineTestCase      iEngineTestCase;
sl@0
   382
    };
sl@0
   383
sl@0
   384
// Passed to StartRemoteTestStep() during test startup.
sl@0
   385
struct TTestEndpointEngineConfig
sl@0
   386
    {
sl@0
   387
    TBool iLogErrors; 
sl@0
   388
    };
sl@0
   389
sl@0
   390
// Number of small steps that each test is allowed to contain. Since each test
sl@0
   391
// that uses the engine has at least one table like this, increasing this 
sl@0
   392
// hugely will increase the overall  memory usage of the application (each 
sl@0
   393
// entry is about 28 bytes). So, don't go multiplying by 10 or some such
sl@0
   394
// unless there is a REAL need for that.
sl@0
   395
// THe current tables take up approximately 28 * 80 = 2240 bytes.
sl@0
   396
// As of right now, there are about 100 tests -> 220KB of tables.
sl@0
   397
const TInt KMaxCases    = 80;
sl@0
   398
sl@0
   399
// Should be PLENTY of endpoints [also used for surfaces, images and other
sl@0
   400
// objects that have roughly 1:1 mapping with endpoints. This is dynamically
sl@0
   401
// allocated in the constructor of the engine class.
sl@0
   402
const TInt KMaxEndpoints = 1000;
sl@0
   403
sl@0
   404
// Max number of surfacetypes we expect to be listed. 
sl@0
   405
// This can be increased as and when needed. 
sl@0
   406
const TInt KMaxSurfaceList = 4;   
sl@0
   407
sl@0
   408
struct TTestCaseBase
sl@0
   409
    {
sl@0
   410
    const TText*       iRelatedTestIds;
sl@0
   411
    const TText*       iName;
sl@0
   412
    TInt               iSurfaceTypeCount;
sl@0
   413
    TSurfaceType       iSurfaceTypeList[KMaxSurfaceList];
sl@0
   414
    };
sl@0
   415
sl@0
   416
// Structure for lists of cases to execute
sl@0
   417
struct TTestCase
sl@0
   418
    {
sl@0
   419
    // Use anonymous struct to avoid changing code all over the place.
sl@0
   420
    TTestCaseBase      iBase;
sl@0
   421
    TEngineTestCase    iEngineTestCase[KMaxCases];
sl@0
   422
    };
sl@0
   423
sl@0
   424
struct TTestCases
sl@0
   425
    {
sl@0
   426
    const TTestCase *iCase;
sl@0
   427
    TInt             iCount;
sl@0
   428
    };
sl@0
   429
sl@0
   430
#endif