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