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