1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/egl/egltest/inc/egltest_stress_common_sgimage.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,105 @@
1.4 +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +/**
1.20 + @file
1.21 + @test
1.22 +*/
1.23 +
1.24 +#ifndef __EGLTEST_STRESS_COMMON_SGIMAGE_H__
1.25 +#define __EGLTEST_STRESS_COMMON_SGIMAGE_H__
1.26 +
1.27 +#include <test/egltestcommonsgimageinfo.h>
1.28 +#include <test/egltestcommonprocess.h>
1.29 +
1.30 +#define EGL_LEAVE_ERROR(PASS) { if (!(PASS)) { User::Leave (eglGetError()); } }
1.31 +#define EGL_LEAVE_NULL(RET, FUNC) { EGLint res = FUNC; if(!(res)){ User::Leave (eglGetError()); } else{RET = res;} }
1.32 +
1.33 +_LIT(KTestType, "TestType");
1.34 +_LIT(KEglStressTest, "EglStressTest Semaphore");
1.35 +const TInt KTestStressUnexpectedPixelError = -911;
1.36 +
1.37 +
1.38 +//Use to pass RSGImage ID to the child processes
1.39 +const TInt KMultiProcessSlot = 1;
1.40 +
1.41 +//Supported formats for these stress tests
1.42 +const TUint32 KColourInitial32 = 0xFF80A0C0;
1.43 +const TUint32 KColourFinal32 = 0xFFC0407F;
1.44 +const TUint16 KColourInitial16 = 0x2408;
1.45 +const TUint16 KColourFinal16 = 0x6144;
1.46 +
1.47 +const TInt KNumberOfFrames = 100;
1.48 +
1.49 +void ChooseConfigAndCreateContextL(EGLDisplay& aDisplay, EGLContext& aContext, EGLConfig& aConfig, const RSgImage& aSgImage, const TDesC& aPanicString, TBool aPreMultAlpha);
1.50 +EGLSurface CreatePixmapSurfaceL(EGLDisplay aDisplay, EGLConfig aConfig, const RSgImage& aSgImage, TBool aAlphaPre);
1.51 +void GenerateVgImageL(const EGLDisplay aDisplay, RSgImage* aImage, VGImage& aVgImage);
1.52 +void VgLeaveIfErrorL();
1.53 +
1.54 +typedef enum TTestType
1.55 + {
1.56 + EStressRead,
1.57 + EStressReadWriteSingleImage,
1.58 + EStressReadWriteMultiImage,
1.59 + EStressVGImage,
1.60 + EStressPixmapSurface,
1.61 + }TTestType;
1.62 +
1.63 +struct TStressProcessInfo
1.64 + {
1.65 + TTestType iTestType;
1.66 + TInt iByteSize;
1.67 + TSgDrawableId iSgId;
1.68 + TBool iAlphaPre;
1.69 + };
1.70 +
1.71 +class CTReadWrite : public CTimer
1.72 + {
1.73 +public:
1.74 + ~CTReadWrite();
1.75 +
1.76 +protected:
1.77 + CTReadWrite(TInt aWidth, TInt aHeight, TInt aByteSize, VGImageFormat aFormat, const TTestType& aTestType, TBool& aTestPass);
1.78 + void RunL();
1.79 + void ConstructL();
1.80 + void ReadL();
1.81 + void ReadWriteImageL();
1.82 + void PixmapSurfaceL();
1.83 + virtual void ReadImageFuncL() = 0;
1.84 + virtual void ReadFuncL() = 0;
1.85 + virtual void WriteImageFuncL() = 0;
1.86 + virtual void VgImageFuncL() = 0;
1.87 + virtual void MakeCurrentL() const = 0;
1.88 + virtual TBool IsFinished() = 0;
1.89 + virtual void PixmapSurfaceFuncL() = 0;
1.90 +
1.91 +private:
1.92 + void VgImageL();
1.93 +
1.94 +protected:
1.95 + TInt iWidth;
1.96 + TInt iHeight;
1.97 + TInt iByteSize;
1.98 + VGImageFormat iFormat;
1.99 + TTestType iTestType;
1.100 + TBool& iTestPass;
1.101 + TUint32 iInitialColour;
1.102 + TUint32 iFinalColour;
1.103 + TInt iBufferSize;
1.104 + TInt iFrameNumber;
1.105 + TUint32* iData;
1.106 + };
1.107 +
1.108 +#endif //__EGLTEST_STRESS_COMMON_SGIMAGE_H__