os/graphics/egl/egltest/inc/egltest_stress_common_sgimage.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 */
    20 
    21 #ifndef __EGLTEST_STRESS_COMMON_SGIMAGE_H__
    22 #define __EGLTEST_STRESS_COMMON_SGIMAGE_H__
    23 
    24 #include <test/egltestcommonsgimageinfo.h>
    25 #include <test/egltestcommonprocess.h>
    26 
    27 #define EGL_LEAVE_ERROR(PASS) { if (!(PASS)) { User::Leave (eglGetError()); } }
    28 #define EGL_LEAVE_NULL(RET, FUNC) { EGLint res = FUNC; if(!(res)){ User::Leave (eglGetError()); } else{RET = res;} }
    29 
    30 _LIT(KTestType, "TestType");
    31 _LIT(KEglStressTest, "EglStressTest Semaphore");
    32 const TInt KTestStressUnexpectedPixelError = -911;
    33 
    34 
    35 //Use to pass RSGImage ID to the child processes
    36 const TInt KMultiProcessSlot = 1;
    37 
    38 //Supported formats for these stress tests
    39 const TUint32 KColourInitial32 = 0xFF80A0C0;
    40 const TUint32 KColourFinal32 = 0xFFC0407F;
    41 const TUint16 KColourInitial16 = 0x2408;
    42 const TUint16 KColourFinal16 = 0x6144;
    43 
    44 const TInt KNumberOfFrames = 100;
    45 
    46 void ChooseConfigAndCreateContextL(EGLDisplay& aDisplay, EGLContext& aContext, EGLConfig& aConfig, const RSgImage& aSgImage, const TDesC& aPanicString, TBool aPreMultAlpha);
    47 EGLSurface CreatePixmapSurfaceL(EGLDisplay aDisplay, EGLConfig aConfig, const RSgImage& aSgImage, TBool aAlphaPre);
    48 void GenerateVgImageL(const EGLDisplay aDisplay, RSgImage* aImage, VGImage& aVgImage);
    49 void VgLeaveIfErrorL();
    50 
    51 typedef enum TTestType
    52     {
    53     EStressRead,
    54     EStressReadWriteSingleImage,
    55     EStressReadWriteMultiImage,
    56     EStressVGImage,
    57     EStressPixmapSurface,
    58     }TTestType;
    59 
    60 struct TStressProcessInfo
    61     {
    62     TTestType iTestType;
    63     TInt iByteSize;
    64     TSgDrawableId iSgId;
    65     TBool iAlphaPre;
    66     };
    67 
    68 class CTReadWrite : public CTimer
    69     {
    70 public:
    71     ~CTReadWrite();
    72 
    73 protected:
    74     CTReadWrite(TInt aWidth, TInt aHeight, TInt aByteSize, VGImageFormat aFormat, const TTestType& aTestType, TBool& aTestPass);
    75     void RunL();
    76     void ConstructL();
    77     void ReadL();
    78     void ReadWriteImageL();
    79     void PixmapSurfaceL();
    80     virtual void ReadImageFuncL() = 0;
    81     virtual void ReadFuncL() = 0;
    82     virtual void WriteImageFuncL() = 0;
    83     virtual void VgImageFuncL() = 0;
    84     virtual void MakeCurrentL() const = 0;
    85     virtual TBool IsFinished() = 0;
    86     virtual void PixmapSurfaceFuncL() = 0;
    87 
    88 private:
    89     void VgImageL();
    90 
    91 protected:
    92     TInt iWidth;
    93     TInt iHeight;
    94     TInt iByteSize;
    95     VGImageFormat iFormat;
    96     TTestType iTestType;
    97     TBool& iTestPass;
    98     TUint32 iInitialColour;
    99     TUint32 iFinalColour;
   100     TInt iBufferSize;
   101     TInt iFrameNumber;
   102     TUint32* iData;
   103     };
   104 
   105 #endif //__EGLTEST_STRESS_COMMON_SGIMAGE_H__