equal
deleted
inserted
replaced
1 // Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
17 @file |
17 @file |
18 @test |
18 @test |
19 */ |
19 */ |
20 |
20 |
21 #include <test/tefunit.h> // for ASSERT macros |
21 #include <test/tefunit.h> // for ASSERT macros |
22 #include <iniparser.h> |
22 #ifndef __INIPARSER_H__ |
|
23 #include <cinidata.h> |
|
24 #endif // __INIPARSER_H__ |
23 #include <e32msgqueue.h> |
25 #include <e32msgqueue.h> |
24 |
26 |
25 #include "egltest_image_multiprocess.h" |
27 #include "egltest_image_multiprocess.h" |
26 |
28 |
27 #include <test/egltestcommonconversion.h> |
29 #include <test/egltestcommonconversion.h> |
514 TSgDrawableId sgImageId; |
516 TSgDrawableId sgImageId; |
515 messageQueue.ReceiveBlocking(sgImageId); |
517 messageQueue.ReceiveBlocking(sgImageId); |
516 ASSERT_EQUALS(rSgImageLocal.Open(sgImageId), KErrNone); |
518 ASSERT_EQUALS(rSgImageLocal.Open(sgImageId), KErrNone); |
517 } |
519 } |
518 |
520 |
519 // Wait for both processes to reach this point |
521 INFO_PRINTF2(_L("Process %d, Creating an EGLImage from the shared RSgImage"),aIdx); |
520 Rendezvous(aIdx); |
|
521 |
|
522 INFO_PRINTF2(_L("Process %d, Creating an EGLImage from the shared RSgImage"),aIdx); |
|
523 CleanupClosePushL(rSgImageLocal); |
522 CleanupClosePushL(rSgImageLocal); |
524 EGLImageKHR eglImageLocal = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &rSgImageLocal, KEglImageAttribsPreservedTrue); |
523 EGLImageKHR eglImageLocal = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &rSgImageLocal, KEglImageAttribsPreservedTrue); |
525 ASSERT_EGL_TRUE(eglImageLocal != EGL_NO_IMAGE_KHR); |
524 ASSERT_EGL_TRUE(eglImageLocal != EGL_NO_IMAGE_KHR); |
526 CleanupStack::PopAndDestroy(&rSgImageLocal); //transferring ownership of the buffer to the EGLImage |
525 CleanupStack::PopAndDestroy(&rSgImageLocal); //transferring ownership of the buffer to the EGLImage |
527 |
526 |
693 INFO_PRINTF2(_L("Process %d: Receiving SgImage ID from other process..."), aIdx); |
692 INFO_PRINTF2(_L("Process %d: Receiving SgImage ID from other process..."), aIdx); |
694 TSgDrawableId sgImageId; |
693 TSgDrawableId sgImageId; |
695 messageQueue.ReceiveBlocking(sgImageId); |
694 messageQueue.ReceiveBlocking(sgImageId); |
696 ASSERT_EQUALS(rSgImageLocal.Open(sgImageId),KErrNone); |
695 ASSERT_EQUALS(rSgImageLocal.Open(sgImageId),KErrNone); |
697 } |
696 } |
698 |
|
699 // Wait for both processes to reach this point |
|
700 Rendezvous(aIdx); |
|
701 |
697 |
702 INFO_PRINTF2(_L("Process %d, Creating an EGLImage from the shared RSgImage"),aIdx); |
698 INFO_PRINTF2(_L("Process %d, Creating an EGLImage from the shared RSgImage"),aIdx); |
703 CleanupClosePushL(rSgImageLocal); |
699 CleanupClosePushL(rSgImageLocal); |
704 EGLImageKHR eglImageLocal = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &rSgImageLocal, KEglImageAttribsPreservedTrue); |
700 EGLImageKHR eglImageLocal = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &rSgImageLocal, KEglImageAttribsPreservedTrue); |
705 ASSERT_EGL_TRUE(eglImageLocal != EGL_NO_IMAGE_KHR); |
701 ASSERT_EGL_TRUE(eglImageLocal != EGL_NO_IMAGE_KHR); |
1464 TSize bitmapSize = bitmap->SizeInPixels(); |
1460 TSize bitmapSize = bitmap->SizeInPixels(); |
1465 TUint8* address = reinterpret_cast<TUint8*>(bitmap->DataAddress()); |
1461 TUint8* address = reinterpret_cast<TUint8*>(bitmap->DataAddress()); |
1466 TInt stride = bitmap->DataStride(); |
1462 TInt stride = bitmap->DataStride(); |
1467 address += (bitmapSize.iHeight - 1) * stride; |
1463 address += (bitmapSize.iHeight - 1) * stride; |
1468 vgWritePixels(address, -stride, iSurfaceFormat, 0,0, bitmapSize.iWidth, bitmapSize.iHeight); |
1464 vgWritePixels(address, -stride, iSurfaceFormat, 0,0, bitmapSize.iWidth, bitmapSize.iHeight); |
1469 eglWaitClient(); // wait for writing to finish |
|
1470 delete bitmap; |
1465 delete bitmap; |
1471 bitmap = NULL; |
1466 bitmap = NULL; |
1472 ASSERT_TRUE(vgGetError()==VG_NO_ERROR); |
1467 ASSERT_TRUE(vgGetError()==VG_NO_ERROR); |
1473 |
1468 |
1474 // Make no surface current and destroy surface |
1469 // Make no surface current and destroy surface |
2109 TSgDrawableId sgImageId; |
2104 TSgDrawableId sgImageId; |
2110 messageQueueSgId.ReceiveBlocking(sgImageId); |
2105 messageQueueSgId.ReceiveBlocking(sgImageId); |
2111 ASSERT_EQUALS(rSgImageLocal.Open(sgImageId),KErrNone); |
2106 ASSERT_EQUALS(rSgImageLocal.Open(sgImageId),KErrNone); |
2112 } |
2107 } |
2113 |
2108 |
2114 // Wait for both processes to reach this point |
|
2115 Rendezvous(aIdx); |
|
2116 |
|
2117 INFO_PRINTF2(_L("Process %d, Creating an EGLImage from the shared RSgImage"),aIdx); |
2109 INFO_PRINTF2(_L("Process %d, Creating an EGLImage from the shared RSgImage"),aIdx); |
2118 CleanupClosePushL(rSgImageLocal); |
2110 CleanupClosePushL(rSgImageLocal); |
2119 EGLImageKHR eglImageLocal = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &rSgImageLocal, KEglImageAttribsPreservedTrue); |
2111 EGLImageKHR eglImageLocal = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &rSgImageLocal, KEglImageAttribsPreservedTrue); |
2120 ASSERT_EGL_TRUE(eglImageLocal != EGL_NO_IMAGE_KHR); |
2112 ASSERT_EGL_TRUE(eglImageLocal != EGL_NO_IMAGE_KHR); |
2121 CleanupStack::PopAndDestroy(&rSgImageLocal); //transferring ownership of the buffer to the EGLImage |
2113 CleanupStack::PopAndDestroy(&rSgImageLocal); //transferring ownership of the buffer to the EGLImage |